summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorM. Scot Breitenfeld <brtnfld@hdfgroup.org>2019-06-25 17:39:35 (GMT)
committerM. Scot Breitenfeld <brtnfld@hdfgroup.org>2019-06-25 17:39:35 (GMT)
commit35c9af8371c4da7f5327c76ddab097b442128f59 (patch)
treed51be51c385a9b463388ba154efc3fa37cad49e8
parentc752332bfd0e9c3090f3a0c02d0253cd45c2e2ce (diff)
parent1d8f7bf297100ec11204442708a7f670a89f3f02 (diff)
downloadhdf5-inactive/parallel_vds_develop.zip
hdf5-inactive/parallel_vds_develop.tar.gz
hdf5-inactive/parallel_vds_develop.tar.bz2
Merge branch 'develop' into parallel_vds_developinactive/parallel_vds_develop
-rw-r--r--CMakeInstallation.cmake10
-rw-r--r--CMakeLists.txt47
-rw-r--r--CTestConfig.cmake4
-rw-r--r--MANIFEST67
-rw-r--r--Makefile.am33
-rw-r--r--README.txt2
-rw-r--r--bin/Makefile.am57
-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
-rwxr-xr-xbin/batch/ctest.qsub.in.cmake21
-rw-r--r--bin/batch/ctestP.lsf.in.cmake2
-rw-r--r--bin/batch/ctestP.sl.in.cmake6
-rw-r--r--bin/batch/ctestS.lsf.in.cmake2
-rw-r--r--bin/batch/ctestS.sl.in.cmake2
-rw-r--r--bin/batch/knl_ctestP.sl.in.cmake6
-rw-r--r--bin/batch/knl_ctestS.sl.in.cmake2
-rw-r--r--bin/batch/ray_ctestP.lsf.in.cmake2
-rw-r--r--bin/batch/ray_ctestS.lsf.in.cmake2
-rwxr-xr-xbin/checkposix244
-rw-r--r--bin/h5cc.in (renamed from tools/src/misc/h5cc.in)0
-rw-r--r--bin/h5redeploy.in (renamed from tools/src/misc/h5redeploy.in)0
-rwxr-xr-xbin/snapshot25
-rwxr-xr-xbin/warnhist514
-rw-r--r--c++/Makefile.am14
-rw-r--r--c++/examples/CMakeLists.txt22
-rw-r--r--c++/examples/CMakeTests.cmake8
-rw-r--r--c++/src/C2Cppfunction_map.htm36
-rw-r--r--c++/src/CMakeLists.txt40
-rw-r--r--c++/src/H5File.cpp21
-rw-r--r--c++/src/H5File.h3
-rw-r--r--c++/src/H5LaccProp.h11
-rw-r--r--c++/src/H5LcreatProp.cpp40
-rw-r--r--c++/src/H5LcreatProp.h19
-rw-r--r--c++/src/H5Location.cpp7
-rw-r--r--c++/src/H5Object.cpp73
-rw-r--r--c++/src/H5Object.h26
-rw-r--r--c++/src/cpp_doc_config2
-rw-r--r--c++/test/CMakeLists.txt15
-rw-r--r--c++/test/tarray.cpp3
-rw-r--r--c++/test/tfile.cpp59
-rw-r--r--c++/test/tlinks.cpp416
-rw-r--r--c++/test/tobject.cpp128
-rw-r--r--config/cmake/CTestCustom.cmake10
-rw-r--r--config/cmake/FindHDFJAVA.cmake.in79
-rw-r--r--config/cmake/FindJNI.cmake347
-rw-r--r--config/cmake/H5pubconf.h.in7
-rw-r--r--config/cmake/HDF5UseFortran.cmake12
-rw-r--r--config/cmake/HDFCompilerFlags.cmake7
-rw-r--r--config/cmake/README.txt.cmake.in2
-rw-r--r--config/cmake/UseJava.cmake1149
-rw-r--r--config/cmake/UseJavaClassFilelist.cmake23
-rw-r--r--config/cmake/UseJavaSymlinks.cmake19
-rw-r--r--config/cmake/cacheinit.cmake2
-rw-r--r--config/cmake/hdf5-config-version.cmake.in50
-rw-r--r--config/cmake/hdf5-config.cmake.in42
-rw-r--r--config/cmake/jrunTest.cmake42
-rw-r--r--config/cmake/libhdf5.settings.cmake.in10
-rw-r--r--config/cmake/mccacheinit.cmake2
-rw-r--r--config/cmake/scripts/CTestScript.cmake20
-rw-r--r--config/cmake/scripts/HDF5config.cmake154
-rw-r--r--config/cmake/scripts/HDF5options.cmake16
-rw-r--r--config/cmake/scripts/HPC/bsub-HDF5options.cmake31
-rw-r--r--config/cmake/scripts/HPC/par-HDF5options.cmake126
-rw-r--r--config/cmake/scripts/HPC/qsub-HDF5options.cmake42
-rw-r--r--config/cmake/scripts/HPC/raybsub-HDF5options.cmake32
-rw-r--r--config/cmake/scripts/HPC/sbatch-HDF5options.cmake43
-rw-r--r--config/cmake/scripts/HPC/ser-HDF5options.cmake119
-rw-r--r--config/cmake/userblockTest.cmake12
-rw-r--r--config/cmake/vfdTest.cmake4
-rw-r--r--config/cmake/volTest.cmake4
-rw-r--r--config/cmake_ext_mod/ConfigureChecks.cmake22
-rw-r--r--config/cmake_ext_mod/FindSZIP.cmake232
-rw-r--r--config/cmake_ext_mod/HDFLibMacros.cmake122
-rw-r--r--config/cmake_ext_mod/HDFMacros.cmake13
-rw-r--r--config/cmake_ext_mod/HDFUseCXX.cmake4
-rw-r--r--config/cmake_ext_mod/HDFUseFortran.cmake8
-rw-r--r--config/cmake_ext_mod/grepTest.cmake141
-rw-r--r--config/cmake_ext_mod/runTest.cmake16
-rw-r--r--config/commence.am4
-rw-r--r--config/conclude.am6
-rw-r--r--config/gnu-flags66
-rw-r--r--config/toolchain/crayle.cmake10
-rw-r--r--configure.ac65
-rw-r--r--examples/CMakeLists.txt36
-rw-r--r--examples/CMakeTests.cmake183
-rw-r--r--fortran/Makefile.am17
-rw-r--r--fortran/examples/CMakeLists.txt145
-rw-r--r--fortran/examples/CMakeTests.cmake96
-rw-r--r--fortran/src/CMakeLists.txt301
-rw-r--r--fortran/src/H5Ff.c34
-rw-r--r--fortran/src/H5Fff.F9039
-rw-r--r--fortran/src/H5Pff.F9099
-rw-r--r--fortran/src/H5Sf.c20
-rw-r--r--fortran/src/H5Sff.F9027
-rw-r--r--fortran/src/H5VLff.F90315
-rw-r--r--fortran/src/H5_f.c16
-rw-r--r--fortran/src/H5_ff.F9027
-rw-r--r--fortran/src/H5f90global.F9035
-rw-r--r--fortran/src/H5f90proto.h5
-rw-r--r--fortran/src/HDF5.F901
-rw-r--r--fortran/src/Makefile.am3
-rw-r--r--fortran/src/hdf5_fortrandll.def.in11
-rw-r--r--fortran/test/CMakeLists.txt502
-rw-r--r--fortran/test/CMakeTests.cmake204
-rw-r--r--fortran/test/Makefile.am3
-rw-r--r--fortran/test/tH5F.F9029
-rw-r--r--fortran/test/tH5MISC_1_8.F9033
-rw-r--r--fortran/test/tH5O_F03.F902
-rw-r--r--fortran/test/vol_connector.F90284
-rw-r--r--fortran/testpar/CMakeTests.cmake2
-rw-r--r--hl/Makefile.am18
-rw-r--r--hl/c++/Makefile.am8
-rw-r--r--hl/c++/examples/CMakeLists.txt23
-rw-r--r--hl/c++/src/CMakeLists.txt34
-rw-r--r--hl/c++/test/CMakeLists.txt29
-rw-r--r--hl/examples/CMakeLists.txt11
-rw-r--r--hl/examples/CMakeTests.cmake4
-rw-r--r--hl/fortran/Makefile.am8
-rw-r--r--hl/fortran/examples/CMakeLists.txt42
-rw-r--r--hl/fortran/src/CMakeLists.txt204
-rw-r--r--hl/fortran/src/H5DSff.F9034
-rw-r--r--hl/fortran/src/H5HL_buildiface.F9016
-rw-r--r--hl/fortran/src/H5IMff.F904
-rw-r--r--hl/fortran/src/H5TBff.F9012
-rw-r--r--hl/fortran/test/CMakeLists.txt51
-rw-r--r--hl/fortran/test/CMakeTests.cmake64
-rw-r--r--hl/fortran/test/tstimage.F902
-rw-r--r--hl/fortran/test/tsttable.F902
-rw-r--r--hl/src/CMakeLists.txt34
-rw-r--r--hl/src/H5LDprivate.h17
-rw-r--r--hl/src/H5LT.c19
-rw-r--r--hl/test/CMakeLists.txt68
-rw-r--r--hl/test/CMakeTests.cmake4
-rw-r--r--hl/test/test_ds.c2
-rw-r--r--hl/tools/gif2h5/CMakeLists.txt65
-rw-r--r--hl/tools/gif2h5/CMakeTests.cmake16
-rw-r--r--hl/tools/gif2h5/Makefile.am12
-rw-r--r--hl/tools/h5watch/CMakeLists.txt56
-rw-r--r--hl/tools/h5watch/CMakeTests.cmake17
-rw-r--r--hl/tools/h5watch/Makefile.am27
-rw-r--r--java/CMakeLists.txt4
-rw-r--r--java/Makefile.am15
-rw-r--r--java/examples/datasets/CMakeLists.txt11
-rw-r--r--java/examples/datatypes/CMakeLists.txt4
-rw-r--r--java/examples/groups/CMakeLists.txt14
-rw-r--r--java/examples/intro/CMakeLists.txt4
-rw-r--r--java/src/hdf/hdf5lib/H5.java21
-rw-r--r--java/src/hdf/hdf5lib/HDF5Constants.java12
-rw-r--r--java/src/hdf/hdf5lib/exceptions/HDF5LibraryException.java5
-rw-r--r--java/src/jni/CMakeLists.txt28
-rw-r--r--java/src/jni/Makefile.am5
-rw-r--r--java/src/jni/exceptionImp.c206
-rw-r--r--java/src/jni/h5Constants.c10
-rw-r--r--java/src/jni/h5Imp.c108
-rw-r--r--java/src/jni/h5aImp.c2779
-rw-r--r--java/src/jni/h5dImp.c2578
-rw-r--r--java/src/jni/h5eImp.c638
-rw-r--r--java/src/jni/h5fImp.c649
-rw-r--r--java/src/jni/h5fImp.h11
-rw-r--r--java/src/jni/h5gImp.c246
-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.c36
-rw-r--r--java/src/jni/h5pACPLImp.h27
-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.c572
-rw-r--r--java/src/jni/h5pFCPLImp.h207
-rw-r--r--java/src/jni/h5pGAPLImp.c36
-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.c6051
-rw-r--r--java/src/jni/h5pImp.h1462
-rw-r--r--java/src/jni/h5pLAPLImp.c240
-rw-r--r--java/src/jni/h5pLAPLImp.h107
-rw-r--r--java/src/jni/h5pLCPLImp.c36
-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.h61
-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.c1667
-rw-r--r--java/src/jni/h5tImp.c1469
-rw-r--r--java/src/jni/h5util.c4714
-rw-r--r--java/src/jni/h5util.h33
-rw-r--r--java/src/jni/h5vlImp.c157
-rw-r--r--java/src/jni/h5vlImp.h2
-rw-r--r--java/src/jni/h5zImp.c29
-rw-r--r--java/src/jni/nativeData.c1342
-rw-r--r--java/test/TestH5.java21
-rw-r--r--java/test/TestH5A.java18
-rw-r--r--java/test/TestH5Edefault.java2
-rw-r--r--java/test/TestH5F.java110
-rw-r--r--java/test/TestH5Oparams.java4
-rw-r--r--java/test/TestH5P.java2
-rw-r--r--java/test/TestH5Sbasic.java2
-rw-r--r--java/test/testfiles/JUnit-TestH5.txt3
-rw-r--r--java/test/testfiles/JUnit-TestH5F.txt4
-rw-r--r--m4/ax_check_class.m475
-rw-r--r--m4/ax_check_classpath.m46
-rw-r--r--m4/ax_check_java_home.m46
-rw-r--r--m4/ax_check_junit.m44
-rw-r--r--m4/ax_check_rqrd_class.m46
-rw-r--r--m4/ax_java_check_class.m48
-rw-r--r--m4/ax_java_options.m44
-rw-r--r--m4/ax_jni_include_dir.m461
-rw-r--r--m4/ax_prog_jar.m44
-rw-r--r--m4/ax_prog_java.m46
-rw-r--r--m4/ax_prog_java_cc.m46
-rw-r--r--m4/ax_prog_java_works.m451
-rw-r--r--m4/ax_prog_javac.m46
-rw-r--r--m4/ax_prog_javac_works.m46
-rw-r--r--m4/ax_prog_javadoc.m44
-rw-r--r--m4/ax_prog_javah.m416
-rw-r--r--m4/ax_try_compile_java.m48
-rw-r--r--m4/ax_try_run_java.m44
-rw-r--r--release_docs/HISTORY-1_10.txt1035
-rw-r--r--release_docs/INSTALL_CMake.txt2
-rw-r--r--release_docs/README_HDF5_CMake23
-rw-r--r--release_docs/README_HPC285
-rw-r--r--release_docs/RELEASE.txt205
-rw-r--r--release_docs/USING_CMake_Examples.txt24
-rw-r--r--src/CMakeLists.txt86
-rw-r--r--src/H5.c6
-rw-r--r--src/H5A.c26
-rw-r--r--src/H5AC.c2
-rw-r--r--src/H5Abtree2.c9
-rw-r--r--src/H5Adense.c41
-rw-r--r--src/H5Adeprec.c13
-rw-r--r--src/H5Aint.c66
-rw-r--r--src/H5Apkg.h2
-rw-r--r--src/H5B.c59
-rw-r--r--src/H5B2.c8
-rw-r--r--src/H5B2cache.c6
-rw-r--r--src/H5B2int.c75
-rw-r--r--src/H5B2leaf.c14
-rw-r--r--src/H5Bcache.c3
-rw-r--r--src/H5Bdbg.c6
-rw-r--r--src/H5C.c69
-rw-r--r--src/H5CX.c646
-rw-r--r--src/H5CXprivate.h30
-rw-r--r--src/H5Cimage.c16
-rw-r--r--src/H5Clog_trace.c2
-rw-r--r--src/H5Cmpio.c12
-rw-r--r--src/H5D.c44
-rw-r--r--src/H5Dbtree.c5
-rw-r--r--src/H5Dbtree2.c3
-rw-r--r--src/H5Dchunk.c585
-rw-r--r--src/H5Dcompact.c18
-rw-r--r--src/H5Dcontig.c68
-rw-r--r--src/H5Ddeprec.c18
-rw-r--r--src/H5Dearray.c11
-rw-r--r--src/H5Defl.c5
-rw-r--r--src/H5Dfarray.c4
-rw-r--r--src/H5Dfill.c11
-rw-r--r--src/H5Dint.c116
-rw-r--r--src/H5Dio.c4
-rw-r--r--src/H5Dlayout.c1
-rw-r--r--src/H5Dmpio.c114
-rw-r--r--src/H5Dpkg.h17
-rw-r--r--src/H5Dprivate.h1
-rw-r--r--src/H5Dscatgath.c88
-rw-r--r--src/H5Dselect.c10
-rw-r--r--src/H5Dvirtual.c71
-rw-r--r--src/H5E.c10
-rw-r--r--src/H5EA.c5
-rw-r--r--src/H5EAcache.c13
-rw-r--r--src/H5EAdbg.c6
-rw-r--r--src/H5EAhdr.c3
-rw-r--r--src/H5EAstat.c3
-rw-r--r--src/H5EAtest.c2
-rw-r--r--src/H5Eint.c14
-rw-r--r--src/H5F.c109
-rw-r--r--src/H5FA.c9
-rw-r--r--src/H5FAcache.c9
-rw-r--r--src/H5FAhdr.c3
-rw-r--r--src/H5FAstat.c3
-rw-r--r--src/H5FAtest.c2
-rw-r--r--src/H5FD.c4
-rw-r--r--src/H5FDcore.c6
-rw-r--r--src/H5FDdirect.c10
-rw-r--r--src/H5FDfamily.c6
-rw-r--r--src/H5FDlog.c2
-rw-r--r--src/H5FDmpio.c2
-rw-r--r--src/H5FDmulti.c52
-rw-r--r--src/H5FL.c12
-rw-r--r--src/H5FS.c3
-rw-r--r--src/H5FScache.c5
-rw-r--r--src/H5Faccum.c21
-rw-r--r--src/H5Fint.c25
-rw-r--r--src/H5Fmpi.c2
-rw-r--r--src/H5Fprivate.h26
-rw-r--r--src/H5Fpublic.h7
-rw-r--r--src/H5Fsuper.c14
-rw-r--r--src/H5Fsuper_cache.c4
-rw-r--r--src/H5G.c11
-rw-r--r--src/H5Gbtree2.c13
-rw-r--r--src/H5Gcache.c3
-rw-r--r--src/H5Gdeprec.c49
-rw-r--r--src/H5Gent.c3
-rw-r--r--src/H5Glink.c19
-rw-r--r--src/H5Gloc.c5
-rw-r--r--src/H5Gname.c3
-rw-r--r--src/H5Gnode.c4
-rw-r--r--src/H5Gtest.c1
-rw-r--r--src/H5Gtraverse.c4
-rw-r--r--src/H5HF.c6
-rw-r--r--src/H5HFcache.c20
-rw-r--r--src/H5HFdbg.c2
-rw-r--r--src/H5HFhdr.c3
-rw-r--r--src/H5HFhuge.c4
-rw-r--r--src/H5HFman.c2
-rw-r--r--src/H5HFsection.c8
-rw-r--r--src/H5HFtest.c4
-rw-r--r--src/H5HFtiny.c3
-rw-r--r--src/H5HG.c6
-rw-r--r--src/H5HGcache.c4
-rw-r--r--src/H5HL.c2
-rw-r--r--src/H5HLcache.c11
-rw-r--r--src/H5I.c11
-rw-r--r--src/H5Ipublic.h1
-rw-r--r--src/H5L.c43
-rw-r--r--src/H5Lexternal.c17
-rw-r--r--src/H5MM.c46
-rw-r--r--src/H5MMprivate.h1
-rw-r--r--src/H5O.c14
-rw-r--r--src/H5Oalloc.c11
-rw-r--r--src/H5Oattr.c20
-rw-r--r--src/H5Oattribute.c2
-rw-r--r--src/H5Ocache.c7
-rw-r--r--src/H5Ocopy.c4
-rw-r--r--src/H5Odrvinfo.c10
-rw-r--r--src/H5Odtype.c8
-rw-r--r--src/H5Oefl.c4
-rw-r--r--src/H5Ofill.c43
-rw-r--r--src/H5Oflush.c1
-rw-r--r--src/H5Oint.c8
-rw-r--r--src/H5Olayout.c18
-rw-r--r--src/H5Olink.c14
-rw-r--r--src/H5Omtime.c2
-rw-r--r--src/H5Oname.c2
-rw-r--r--src/H5Opkg.h4
-rw-r--r--src/H5Opline.c5
-rw-r--r--src/H5Osdspace.c8
-rw-r--r--src/H5Oshared.c5
-rw-r--r--src/H5P.c19
-rw-r--r--src/H5PB.c23
-rw-r--r--src/H5Pacpl.c50
-rw-r--r--src/H5Pdapl.c6
-rw-r--r--src/H5Pdcpl.c44
-rw-r--r--src/H5Pdeprec.c49
-rw-r--r--src/H5Pdxpl.c2
-rw-r--r--src/H5Pfapl.c59
-rw-r--r--src/H5Pgcpl.c6
-rw-r--r--src/H5Pint.c249
-rw-r--r--src/H5Plapl.c2
-rw-r--r--src/H5Plcpl.c54
-rw-r--r--src/H5Pocpl.c2
-rw-r--r--src/H5Pocpypl.c2
-rw-r--r--src/H5Ppkg.h4
-rw-r--r--src/H5Pprivate.h4
-rw-r--r--src/H5Ppublic.h7
-rw-r--r--src/H5Rint.c4
-rw-r--r--src/H5S.c446
-rw-r--r--src/H5SL.c4
-rw-r--r--src/H5SM.c5
-rw-r--r--src/H5SMbtree2.c3
-rw-r--r--src/H5SMcache.c4
-rw-r--r--src/H5SMmessage.c5
-rw-r--r--src/H5ST.c16
-rw-r--r--src/H5Sall.c370
-rw-r--r--src/H5Sdbg.c18
-rw-r--r--src/H5Sdeprec.c121
-rw-r--r--src/H5Shyper.c10691
-rw-r--r--src/H5Smpio.c1243
-rw-r--r--src/H5Snone.c577
-rw-r--r--src/H5Spkg.h191
-rw-r--r--src/H5Spoint.c1577
-rw-r--r--src/H5Sprivate.h58
-rw-r--r--src/H5Spublic.h113
-rw-r--r--src/H5Sselect.c910
-rw-r--r--src/H5Stest.c333
-rw-r--r--src/H5T.c60
-rw-r--r--src/H5Tcommit.c4
-rw-r--r--src/H5Tconv.c24
-rw-r--r--src/H5Tenum.c6
-rw-r--r--src/H5Tfields.c12
-rw-r--r--src/H5Tnative.c14
-rw-r--r--src/H5Torder.c4
-rw-r--r--src/H5Tvlen.c34
-rw-r--r--src/H5VL.c443
-rw-r--r--src/H5VLcallback.c360
-rw-r--r--src/H5VLconnector.h417
-rw-r--r--src/H5VLconnector_passthru.h166
-rw-r--r--src/H5VLint.c1044
-rw-r--r--src/H5VLnative.c25
-rw-r--r--src/H5VLnative_attr.c16
-rw-r--r--src/H5VLnative_dataset.c19
-rw-r--r--src/H5VLnative_file.c25
-rw-r--r--src/H5VLnative_group.c14
-rw-r--r--src/H5VLnative_link.c32
-rw-r--r--src/H5VLnative_object.c25
-rw-r--r--src/H5VLnative_private.h8
-rw-r--r--src/H5VLpassthru.c314
-rw-r--r--src/H5VLpkg.h15
-rw-r--r--src/H5VLprivate.h36
-rw-r--r--src/H5VLpublic.h491
-rw-r--r--src/H5VM.c23
-rw-r--r--src/H5VMprivate.h3
-rw-r--r--src/H5Z.c6
-rw-r--r--src/H5Zfletcher32.c6
-rw-r--r--src/H5Zscaleoffset.c29
-rw-r--r--src/H5Zshuffle.c18
-rw-r--r--src/H5Ztrans.c8
-rw-r--r--src/H5checksum.c11
-rw-r--r--src/H5dbg.c2
-rw-r--r--src/H5err.txt2
-rw-r--r--src/H5private.h14
-rw-r--r--src/H5public.h4
-rw-r--r--src/H5system.c132
-rw-r--r--src/H5timer.c16
-rw-r--r--src/H5trace.c26
-rw-r--r--src/H5vers.txt2
-rw-r--r--src/H5win32defs.h14
-rw-r--r--src/Makefile.am13
-rw-r--r--src/libhdf5.settings.in2
-rw-r--r--test/CMakeLists.txt257
-rw-r--r--test/CMakePassthroughVOLTests.cmake (renamed from test/CMakeVOLTests.cmake)179
-rw-r--r--test/CMakeTests.cmake547
-rw-r--r--test/CMakeVFDTests.cmake209
-rw-r--r--test/Makefile.am20
-rw-r--r--test/accum.c6
-rw-r--r--test/app_ref.c6
-rw-r--r--test/big.c4
-rw-r--r--test/bittests.c174
-rw-r--r--test/cache_logging.c6
-rw-r--r--test/cache_tagging.c54
-rw-r--r--test/cmpd_dset.c2
-rw-r--r--test/direct_chunk.c131
-rw-r--r--test/dsets.c30
-rw-r--r--test/dtypes.c24
-rw-r--r--test/enc_dec_plist.c878
-rw-r--r--test/evict_on_close.c6
-rw-r--r--test/external.c262
-rw-r--r--test/external_common.c127
-rw-r--r--test/external_common.h45
-rw-r--r--test/external_env.c218
-rw-r--r--test/fheap.c11
-rw-r--r--test/file_image.c2
-rw-r--r--test/fill18.h5bin0 -> 3479 bytes
-rw-r--r--test/flush1.c2
-rw-r--r--test/flush2.c2
-rw-r--r--test/flushrefreshTest.cmake106
-rw-r--r--test/gen_plist.c4
-rw-r--r--test/h5test.c233
-rw-r--r--test/h5test.h6
-rw-r--r--test/hyperslab.c8
-rw-r--r--test/links.c2
-rw-r--r--test/mount.c38
-rw-r--r--test/null_vol_connector.c32
-rw-r--r--test/objcopy.c47
-rw-r--r--test/ohdr.c407
-rw-r--r--test/page_buffer.c4
-rw-r--r--test/set_extent.c4
-rw-r--r--test/tattr.c220
-rw-r--r--test/testerror.sh.in4
-rw-r--r--test/testexternal_env.sh.in42
-rw-r--r--test/testframe.c338
-rw-r--r--test/testvds_env.sh.in44
-rw-r--r--test/tfile.c551
-rw-r--r--test/th5o.c4
-rw-r--r--test/th5s.c972
-rw-r--r--test/tid.c28
-rw-r--r--test/titerate.c12
-rw-r--r--test/trefer.c238
-rw-r--r--test/tselect.c3012
-rw-r--r--test/tsohm.c30
-rw-r--r--test/ttime.c6
-rw-r--r--test/ttsafe_error.c65
-rw-r--r--test/tunicode.c2
-rw-r--r--test/tvlstr.c18
-rw-r--r--test/vds.c1006
-rw-r--r--test/vds_env.c364
-rw-r--r--test/vfd.c44
-rw-r--r--test/vol.c98
-rw-r--r--testpar/CMakeLists.txt40
-rw-r--r--testpar/CMakeTests.cmake106
-rw-r--r--testpar/CMakeVFDTests.cmake30
-rw-r--r--testpar/Makefile.am5
-rw-r--r--testpar/t_cache.c17
-rw-r--r--testpar/t_coll_md_read.c336
-rw-r--r--testpar/t_filters_parallel.c11
-rw-r--r--testpar/t_mdset.c7
-rw-r--r--testpar/t_prop.c4
-rw-r--r--testpar/t_pvds.c4
-rw-r--r--testpar/t_shapesame.c32
-rw-r--r--testpar/t_span_tree.c28
-rw-r--r--testpar/testphdf5.c421
-rw-r--r--testpar/testphdf5.h3
-rw-r--r--tools/Makefile.am13
-rw-r--r--tools/lib/CMakeLists.txt38
-rw-r--r--tools/lib/h5diff.c1
-rw-r--r--tools/lib/h5diff_array.c11
-rw-r--r--tools/src/h5copy/CMakeLists.txt18
-rw-r--r--tools/src/h5diff/CMakeLists.txt70
-rw-r--r--tools/src/h5dump/CMakeLists.txt26
-rw-r--r--tools/src/h5format_convert/CMakeLists.txt26
-rw-r--r--tools/src/h5import/CMakeLists.txt30
-rw-r--r--tools/src/h5jam/CMakeLists.txt59
-rw-r--r--tools/src/h5ls/CMakeLists.txt18
-rw-r--r--tools/src/h5repack/CMakeLists.txt20
-rw-r--r--tools/src/h5repack/Makefile.am2
-rw-r--r--tools/src/h5repack/h5repack.c14
-rw-r--r--tools/src/h5repack/h5repack_copy.c30
-rw-r--r--tools/src/h5repack/h5repack_filters.c10
-rw-r--r--tools/src/h5stat/CMakeLists.txt18
-rw-r--r--tools/src/h5stat/h5stat.c3
-rw-r--r--tools/src/misc/CMakeLists.txt98
-rw-r--r--tools/src/misc/Makefile.am24
-rw-r--r--tools/test/h5copy/CMakeLists.txt26
-rw-r--r--tools/test/h5copy/CMakeTests.cmake72
-rw-r--r--tools/test/h5diff/CMakeLists.txt26
-rw-r--r--tools/test/h5diff/CMakeTests.cmake44
-rw-r--r--tools/test/h5dump/CMakeLists.txt28
-rw-r--r--tools/test/h5dump/CMakeTests.cmake145
-rw-r--r--tools/test/h5dump/CMakeTestsPBITS.cmake16
-rw-r--r--tools/test/h5dump/CMakeTestsVDS.cmake32
-rw-r--r--tools/test/h5dump/CMakeTestsXML.cmake16
-rw-r--r--tools/test/h5dump/h5dumpgentest.c24
-rw-r--r--tools/test/h5dump/testh5dump.sh.in41
-rw-r--r--tools/test/h5format_convert/CMakeLists.txt17
-rw-r--r--tools/test/h5format_convert/CMakeTests.cmake99
-rw-r--r--tools/test/h5import/CMakeLists.txt11
-rw-r--r--tools/test/h5import/CMakeTests.cmake33
-rw-r--r--tools/test/h5jam/CMakeLists.txt26
-rw-r--r--tools/test/h5jam/CMakeTests.cmake36
-rw-r--r--tools/test/h5ls/CMakeLists.txt22
-rw-r--r--tools/test/h5ls/CMakeTests.cmake25
-rw-r--r--tools/test/h5ls/CMakeTestsVDS.cmake24
-rw-r--r--tools/test/h5repack/CMakeLists.txt66
-rw-r--r--tools/test/h5repack/CMakeTests.cmake108
-rw-r--r--tools/test/h5repack/CMakeVFDTests.cmake2
-rw-r--r--tools/test/h5repack/h5repack.sh.in8
-rw-r--r--tools/test/h5repack/h5repacktst.c12
-rw-r--r--tools/test/h5repack/testfiles/h5repack_layout.h5-plugin_version_test.ddl14
-rw-r--r--tools/test/h5stat/CMakeLists.txt4
-rw-r--r--tools/test/h5stat/CMakeTests.cmake28
-rw-r--r--tools/test/misc/CMakeLists.txt46
-rw-r--r--tools/test/misc/CMakeTestsClear.cmake50
-rw-r--r--tools/test/misc/CMakeTestsMkgrp.cmake18
-rw-r--r--tools/test/misc/CMakeTestsRepart.cmake14
-rw-r--r--tools/test/misc/vds/CMakeLists.txt11
-rw-r--r--tools/test/perform/CMakeLists.txt112
-rw-r--r--tools/test/perform/CMakeTests.cmake4
-rw-r--r--tools/test/perform/chunk_cache.c24
-rw-r--r--tools/test/perform/pio_engine.c6
-rw-r--r--tools/test/perform/pio_standalone.c4
-rw-r--r--tools/test/perform/sio_engine.c6
-rw-r--r--tools/testfiles/t128bit_float.h5bin0 -> 2160 bytes
574 files changed, 49627 insertions, 34197 deletions
diff --git a/CMakeInstallation.cmake b/CMakeInstallation.cmake
index 7a0746a..b933c29 100644
--- a/CMakeInstallation.cmake
+++ b/CMakeInstallation.cmake
@@ -33,7 +33,7 @@ if (NOT HDF5_EXTERNALLY_CONFIGURED)
EXPORT ${HDF5_EXPORTED_TARGETS}
DESTINATION ${HDF5_INSTALL_CMAKE_DIR}/hdf5
FILE ${HDF5_PACKAGE}${HDF_PACKAGE_EXT}-targets.cmake
- NAMESPACE ${HDF5_PACKAGE}::
+ NAMESPACE ${HDF_PACKAGE_NAMESPACE}
COMPONENT configinstall
)
endif ()
@@ -45,7 +45,7 @@ if (NOT HDF5_EXTERNALLY_CONFIGURED)
export (
TARGETS ${HDF5_LIBRARIES_TO_EXPORT} ${HDF5_LIB_DEPENDENCIES} ${HDF5_UTILS_TO_EXPORT}
FILE ${HDF5_PACKAGE}${HDF_PACKAGE_EXT}-targets.cmake
- NAMESPACE ${HDF5_PACKAGE}::
+ NAMESPACE ${HDF_PACKAGE_NAMESPACE}
)
endif ()
endif ()
@@ -104,6 +104,12 @@ endif ()
# Configure the hdf5-config-version .cmake file for the install directory
#-----------------------------------------------------------------------------
if (NOT HDF5_EXTERNALLY_CONFIGURED)
+ # 3.11 or greater
+ #write_basic_package_version_file (
+ # ${HDF5_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/${HDF5_PACKAGE}${HDF_PACKAGE_EXT}-config-version.cmake
+ # VERSION ${HDF5_PACKAGE_VERSION}
+ # COMPATIBILITY SameMinorVersion
+ #)
configure_file (
${HDF_RESOURCES_DIR}/hdf5-config-version.cmake.in
${HDF5_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/${HDF5_PACKAGE}${HDF_PACKAGE_EXT}-config-version.cmake @ONLY
diff --git a/CMakeLists.txt b/CMakeLists.txt
index b9cdf4d..fc656c0 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -10,7 +10,7 @@ project (HDF5 C)
# set CMAKE_INSTALL_PREFIX to the required install path.
# Make install can be used to install all components for system-wide use.
#
-if ("${CMAKE_CURRENT_SOURCE_DIR}" STREQUAL "${CMAKE_CURRENT_BINARY_DIR}")
+if (CMAKE_CURRENT_SOURCE_DIR STREQUAL CMAKE_CURRENT_BINARY_DIR)
MESSAGE(FATAL_ERROR "\nERROR! ${PROJECT_NAME} DOES NOT SUPPORT IN SOURCE BUILDS!\n"
"CMAKE_CURRENT_SOURCE_DIR=${CMAKE_CURRENT_SOURCE_DIR}"
" == CMAKE_CURRENT_BINARY_DIR=${CMAKE_CURRENT_BINARY_DIR}\n"
@@ -314,7 +314,7 @@ set (HDF5_PACKAGE_NAME "HDF5")
set (HDF5_PACKAGE_VERSION "${H5_VERS_MAJOR}.${H5_VERS_MINOR}.${H5_VERS_RELEASE}")
set (HDF5_PACKAGE_VERSION_MAJOR "${H5_VERS_MAJOR}.${H5_VERS_MINOR}")
set (HDF5_PACKAGE_VERSION_MINOR "${H5_VERS_RELEASE}")
-if (NOT "${H5_VERS_SUBRELEASE}" STREQUAL "")
+if (H5_VERS_SUBRELEASE)
set (HDF5_PACKAGE_VERSION_STRING "${HDF5_PACKAGE_VERSION}-${H5_VERS_SUBRELEASE}")
else ()
set (HDF5_PACKAGE_VERSION_STRING "${HDF5_PACKAGE_VERSION}")
@@ -416,18 +416,23 @@ set (CMAKE_INCLUDE_CURRENT_DIR_IN_INTERFACE ON)
# Mac OS X Options
#-----------------------------------------------------------------------------
if (HDF5_BUILD_FRAMEWORKS AND NOT BUILD_SHARED_LIBS)
- set (BUILD_SHARED_LIBS ON CACHE BOOL "Build Shared Libraries")
+ set (BUILD_SHARED_LIBS ON CACHE BOOL "Build Shared Libraries" FORCE)
endif ()
#-----------------------------------------------------------------------------
# Option to Build Shared and Static libs, default is both
#-----------------------------------------------------------------------------
+option (ONLY_SHARED_LIBS "Only Build Shared Libraries" OFF)
+set (H5_ENABLE_STATIC_LIB YES)
+if (ONLY_SHARED_LIBS)
+ set (H5_ENABLE_STATIC_LIB NO)
+ set (BUILD_SHARED_LIBS ON CACHE BOOL "Build Shared Libraries")
+endif ()
option (BUILD_SHARED_LIBS "Build Shared Libraries" ON)
set (H5_ENABLE_SHARED_LIB NO)
if (BUILD_SHARED_LIBS)
set (H5_ENABLE_SHARED_LIB YES)
endif ()
-set (H5_ENABLE_STATIC_LIB YES)
set (CMAKE_POSITION_INDEPENDENT_CODE ON)
#-----------------------------------------------------------------------------
@@ -683,8 +688,10 @@ endif ()
option (HDF5_ENABLE_THREADSAFE "Enable thread-safety" OFF)
if (HDF5_ENABLE_THREADSAFE)
# check for unsupported options
- message (STATUS " **** thread-safety option not supported with static library **** ")
- message (STATUS " **** thread-safety option will not be used building static library **** ")
+ if (WIN32)
+ message (STATUS " **** thread-safety option not supported with static library **** ")
+ message (STATUS " **** thread-safety option will not be used building static library **** ")
+ endif ()
if (HDF5_ENABLE_PARALLEL)
if (NOT ALLOW_UNSUPPORTED)
message (FATAL_ERROR " **** parallel and thread-safety options are not supported **** ")
@@ -722,9 +729,9 @@ if (HDF5_ENABLE_THREADSAFE)
endif ()
endif ()
set(THREADS_PREFER_PTHREAD_FLAG ON)
- find_package(Threads)
- if (NOT Threads_FOUND)
- message (STATUS " **** thread-safe package not found - threads still might work **** ")
+ find_package(Threads REQUIRED)
+ if (Threads_FOUND)
+ set (H5_HAVE_THREADSAFE 1)
endif ()
endif ()
@@ -735,13 +742,17 @@ add_subdirectory (src)
if (HDF5_ALLOW_EXTERNAL_SUPPORT MATCHES "GIT" OR HDF5_ALLOW_EXTERNAL_SUPPORT MATCHES "TGZ")
if (ZLIB_FOUND AND ZLIB_USE_EXTERNAL)
- add_dependencies (${HDF5_LIB_TARGET} ZLIB)
+ if (NOT ONLY_SHARED_LIBS)
+ add_dependencies (${HDF5_LIB_TARGET} ZLIB)
+ endif ()
if (BUILD_SHARED_LIBS)
add_dependencies (${HDF5_LIBSH_TARGET} ZLIB)
endif ()
endif ()
if (SZIP_FOUND AND SZIP_USE_EXTERNAL)
- add_dependencies (${HDF5_LIB_TARGET} SZIP)
+ if (NOT ONLY_SHARED_LIBS)
+ add_dependencies (${HDF5_LIB_TARGET} SZIP)
+ endif ()
if (BUILD_SHARED_LIBS)
add_dependencies (${HDF5_LIBSH_TARGET} SZIP)
endif ()
@@ -754,7 +765,7 @@ endif ()
option (BUILD_TESTING "Build HDF5 Unit Testing" ON)
if (BUILD_TESTING)
set (DART_TESTING_TIMEOUT 1200
- CACHE INTEGER
+ CACHE STRING
"Timeout in seconds for each test (default 1200=20minutes)"
)
@@ -770,11 +781,11 @@ if (BUILD_TESTING)
mark_as_advanced (HDF5_TEST_FHEAP_VFD)
endif ()
- option (HDF5_TEST_VOL "Execute tests with different VOL connectors" OFF)
- mark_as_advanced (HDF5_TEST_VOL)
- if (HDF5_TEST_VOL)
- option (HDF5_TEST_FHEAP_VOL "Execute fheap test with different VOL connectors" ON)
- mark_as_advanced (HDF5_TEST_FHEAP_VOL)
+ option (HDF5_TEST_PASSTHROUGH_VOL "Execute tests with different passthrough VOL connectors" OFF)
+ mark_as_advanced (HDF5_TEST_PASSTHROUGH_VOL)
+ if (HDF5_TEST_PASSTHROUGH_VOL)
+ option (HDF5_TEST_FHEAP_PASSTHROUGH_VOL "Execute fheap test with different passthrough VOL connectors" ON)
+ mark_as_advanced (HDF5_TEST_FHEAP_PASSTHROUGH VOL)
endif ()
option (HDF_TEST_EXPRESS "Control testing framework (0-3)" "0")
@@ -845,7 +856,7 @@ if (EXISTS "${HDF5_SOURCE_DIR}/fortran" AND IS_DIRECTORY "${HDF5_SOURCE_DIR}/for
message (STATUS "Fortran compiler ID is ${CMAKE_Fortran_COMPILER_ID}")
# Building with PGI requires CMake 3.3 or greater because previous versions
# of CMake add the wrong compiler flag for the PGI Fortran compiler.
- if ("${CMAKE_Fortran_COMPILER_ID}" MATCHES "PGI" AND "${CMAKE_VERSION}" VERSION_LESS "3.3")
+ if (CMAKE_Fortran_COMPILER_ID MATCHES "PGI" AND CMAKE_VERSION VERSION_LESS "3.3")
message (FATAL_ERROR " **** PGI FORTRAN REQUIRES CMAKE VERSION 3.3 OR GREATER **** ")
endif ()
diff --git a/CTestConfig.cmake b/CTestConfig.cmake
index 5b35688..d80f48f 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 0fd0d5c..01ee8d8 100644
--- a/MANIFEST
+++ b/MANIFEST
@@ -71,12 +71,15 @@
./bin/errors _DO_NOT_DISTRIBUTE_
./bin/genparser
./bin/gcov_script _DO_NOT_DISTRIBUTE_
+./bin/h5cc.in
+./bin/h5redeploy.in
./bin/h5vers
./bin/iostats
./bin/locate_sw
./bin/make_err
./bin/make_overflow
./bin/make_vers
+./bin/Makefile.am
./bin/makehelp
./bin/mkdirs
./bin/newer
@@ -91,11 +94,8 @@
./bin/switch_maint_mode _DO_NOT_DISTRIBUTE_
./bin/timekeeper _DO_NOT_DISTRIBUTE_
./bin/trace
+./bin/warnhist _DO_NOT_DISTRIBUTE_
./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
@@ -103,6 +103,7 @@
./bin/batch/knl_ctestP.sl.in.cmake
./bin/batch/knl_ctestS.sl.in.cmake
./bin/batch/knl_H5detect.sl.in.cmake
+./bin/batch/ctest.qsub.in.cmake
./bin/batch/ray_ctestP.lsf.in.cmake
./bin/batch/ray_ctestS.lsf.in.cmake
./bin/batch/raybsub
@@ -245,6 +246,7 @@
./fortran/src/H5Sff.F90
./fortran/src/H5Tf.c
./fortran/src/H5Tff.F90
+./fortran/src/H5VLff.F90
./fortran/src/H5Zf.c
./fortran/src/H5Zff.F90
./fortran/src/H5config_f.inc.cmake
@@ -264,8 +266,8 @@
./fortran/src/h5fc.in
./fortran/src/hdf5_fortrandll.def.in
-
./fortran/test/Makefile.am
+./fortran/test/vol_connector.F90
./fortran/test/fflush1.F90
./fortran/test/fflush2.F90
./fortran/test/fortranlib_test.F90
@@ -461,8 +463,9 @@
./release_docs/INSTALL_parallel
./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/RELEASE.txt
./release_docs/USING_HDF5_CMake.txt
./release_docs/USING_HDF5_VS.txt
@@ -846,6 +849,7 @@
./src/H5S.c
./src/H5Sall.c
./src/H5Sdbg.c
+./src/H5Sdeprec.c
./src/H5Shyper.c
./src/H5Smodule.h
./src/H5Smpio.c
@@ -900,6 +904,8 @@
./src/H5TSprivate.h
./src/H5VL.c
./src/H5VLcallback.c
+./src/H5VLconnector.h
+./src/H5VLconnector_passthru.h
./src/H5VLint.c
./src/H5VLmodule.h
./src/H5VLnative.c
@@ -990,6 +996,9 @@
./test/evict_on_close.c
./test/extend.c
./test/external.c
+./test/external_common.c
+./test/external_common.h
+./test/external_env.c
./test/error_test.c
./test/err_compat.c
./test/filter_error.h5
@@ -1007,6 +1016,7 @@
./test/file_image.c
./test/file_image_core_test.h5
./test/fill_old.h5
+./test/fill18.h5
./test/fillval.c
./test/filter_fail.c
./test/filter_plugin.c
@@ -1114,6 +1124,7 @@
./test/tcoords.c
./test/testabort_fail.sh.in
./test/testcheck_version.sh.in
+./test/testexternal_env.sh.in
./test/testerror.sh.in
./test/testlinks_env.sh.in
./test/test_filter_plugin.sh.in
@@ -1129,6 +1140,7 @@
./test/testmeta.c
./test/testswmr.sh.in
./test/testvdsswmr.sh.in
+./test/testvds_env.sh.in
./test/tfile.c
./test/tgenprop.c
./test/th5o.c
@@ -1168,6 +1180,7 @@
./test/use_disable_mdc_flushes.c
./test/use.h
./test/vds.c
+./test/vds_env.c
./test/vds_swmr.h
./test/vds_swmr_gen.c
./test/vds_swmr_reader.c
@@ -1535,11 +1548,9 @@
./tools/lib/io_timer.h
./tools/src/misc/Makefile.am
-./tools/src/misc/h5cc.in
./tools/src/misc/h5clear.c
./tools/src/misc/h5debug.c
./tools/src/misc/h5mkgrp.c
-./tools/src/misc/h5redeploy.in
./tools/src/misc/h5repart.c
./tools/test/misc/Makefile.am
./tools/test/misc/h5repart_gentest.c
@@ -1689,6 +1700,7 @@
./tools/testfiles/h5dump-help.txt
./tools/testfiles/non_existing.ddl
./tools/testfiles/packedbits.ddl
+./tools/testfiles/t128bit_float.h5
./tools/testfiles/taindices.h5
./tools/testfiles/tall-1.ddl
./tools/testfiles/tall-2.ddl
@@ -2902,6 +2914,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
@@ -3211,8 +3249,6 @@
./config/cmake/ConfigureChecks.cmake
./config/cmake/CPack.Info.plist.in
./config/cmake/CTestCustom.cmake
-./config/cmake/FindHDFJAVA.cmake.in
-./config/cmake/FindJNI.cmake
./config/cmake/H5cxx_config.h.in
./config/cmake/H5pubconf.h.in
./config/cmake/hdf5-config.cmake.in
@@ -3312,9 +3348,9 @@
./hl/tools/h5watch/CMakeTests.cmake
./src/CMakeLists.txt
./test/CMakeLists.txt
+./test/CMakePassthroughVOLTests.cmake
./test/CMakeTests.cmake
./test/CMakeVFDTests.cmake
-./test/CMakeVOLTests.cmake
./test/flushrefreshTest.cmake
./test/ShellTests.cmake
./testpar/CMakeLists.txt
@@ -3371,8 +3407,12 @@
./config/cmake/scripts/CTestScript.cmake
./config/cmake/scripts/HDF5config.cmake
./config/cmake/scripts/HDF5options.cmake
-./config/cmake/scripts/HPC/par-HDF5options.cmake
-./config/cmake/scripts/HPC/ser-HDF5options.cmake
+
+# CMake-specific HPC Scripts
+./config/cmake/scripts/HPC/sbatch-HDF5options.cmake
+./config/cmake/scripts/HPC/bsub-HDF5options.cmake
+./config/cmake/scripts/HPC/qsub-HDF5options.cmake
+./config/cmake/scripts/HPC/raybsub-HDF5options.cmake
# Files generated by autogen
./aclocal.m4
@@ -3387,6 +3427,7 @@
./c++/examples/Makefile.in
./c++/Makefile.in
./configure
+./bin/Makefile.in
./c++/src/Makefile.in
./c++/test/Makefile.in
./examples/Makefile.in
diff --git a/Makefile.am b/Makefile.am
index d58b1b4..d96ffe3 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -49,11 +49,6 @@ include $(top_srcdir)/config/commence.am
# Conditionals. These conditionals are defined during configure
# Define each variable to empty if it is not used to placate pmake
-if BUILD_PARALLEL_CONDITIONAL
- TESTPARALLEL_DIR =testpar
-else
- TESTPARALLEL_DIR=
-endif
if BUILD_CXX_CONDITIONAL
CXX_DIR =c++
else
@@ -74,9 +69,24 @@ if BUILD_HDF5_HL_CONDITIONAL
else
HDF5_HL_DIR=
endif
+if BUILD_TESTS_CONDITIONAL
+ TESTSERIAL_DIR =test
+else
+ TESTSERIAL_DIR=
+endif
+if BUILD_TESTS_PARALLEL_CONDITIONAL
+ TESTPARALLEL_DIR =testpar
+else
+ TESTPARALLEL_DIR=
+endif
+if BUILD_TOOLS_CONDITIONAL
+ TOOLS_DIR =tools
+else
+ TOOLS_DIR=
+endif
-SUBDIRS = src test $(TESTPARALLEL_DIR) tools . $(CXX_DIR) $(FORTRAN_DIR) \
- $(JAVA_DIR) $(HDF5_HL_DIR)
+SUBDIRS = src $(TESTSERIAL_DIR) $(TESTPARALLEL_DIR) bin $(TOOLS_DIR) . \
+ $(CXX_DIR) $(FORTRAN_DIR) $(JAVA_DIR) $(HDF5_HL_DIR)
DIST_SUBDIRS = src test testpar tools . c++ fortran hl examples java
# Some files generated during configure that should be cleaned
@@ -186,10 +196,11 @@ check-vfd:
fi; \
done
-# Run tests with different Virtual Object Layer Connectors.
-# Currently, only invoke check-vol in the test directory.
-check-vol:
- for d in src test; do \
+# Run tests with different passthrough Virtual Object Layer Connectors.
+# NOTE: Will only succeed with passthrough VOL connectors that use
+# the native VOL connector as the terminal connector.
+check-passthrough-vol:
+ for d in $(SUBDIRS); do \
if test $$d != .; then \
(cd $$d && $(MAKE) $(AM_MAKEFLAGS) $@) || exit 1; \
fi; \
diff --git a/README.txt b/README.txt
index 03e8dd7..64f1345 100644
--- a/README.txt
+++ b/README.txt
@@ -1,4 +1,4 @@
-HDF5 version 1.11.4 currently under development
+HDF5 version 1.11.6 currently under development
------------------------------------------------------------------------------
Please refer to the release_docs/INSTALL file for installation instructions.
diff --git a/bin/Makefile.am b/bin/Makefile.am
new file mode 100644
index 0000000..a39b695
--- /dev/null
+++ b/bin/Makefile.am
@@ -0,0 +1,57 @@
+#
+# 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.
+##
+## Makefile.am
+## Run automake to generate a Makefile.in from this file.
+#
+# HDF5 Library Makefile(.in)
+#
+
+include $(top_srcdir)/config/commence.am
+
+# Include src directory
+AM_CPPFLAGS+=-I$(top_srcdir)/src -I$(top_srcdir)/tools/lib
+
+# These are our main targets
+bin_SCRIPTS=h5redeploy
+
+# Tell automake to clean h5redeploy script
+CLEANFILES=h5redeploy
+
+# These were generated by configure. Remove them only when distclean.
+DISTCLEANFILES=h5cc
+
+# All programs rely on hdf5 library and h5tools library
+LDADD=$(LIBH5TOOLS) $(LIBHDF5)
+
+# How to build h5redeploy script
+h5redeploy: h5redeploy.in
+ @cp $(srcdir)/$@.in $@
+
+# h5cc needs custom install and uninstall rules, since it may be
+# named h5pcc if hdf5 is being built in parallel mode.
+if BUILD_PARALLEL_CONDITIONAL
+ H5CC_NAME=h5pcc
+else
+ H5CC_NAME=h5cc
+endif
+
+$(DESTDIR)$(bindir):
+ echo " $(MKDIR_P) '$(DESTDIR)$(bindir)'"; \
+ $(MKDIR_P) "$(DESTDIR)$(bindir)" || exit 1;
+
+install-exec-local: $(DESTDIR)$(bindir)
+ @$(INSTALL) h5cc $(DESTDIR)$(bindir)/$(H5CC_NAME)
+uninstall-local:
+ @$(RM) $(DESTDIR)$(bindir)/$(H5CC_NAME)
+
+include $(top_srcdir)/config/conclude.am
diff --git a/bin/batch/cori_ctestP.sl.in.cmake b/bin/batch/cori_ctestP.sl.in.cmake
deleted file mode 100644
index 6aa4916..0000000
--- a/bin/batch/cori_ctestP.sl.in.cmake
+++ /dev/null
@@ -1,17 +0,0 @@
-#!/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 TEST_PAR|PH5DIFF|PERFORM|ph5example -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
deleted file mode 100644
index cf68826..0000000
--- a/bin/batch/cori_ctestS.sl.in.cmake
+++ /dev/null
@@ -1,16 +0,0 @@
-#!/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 TEST_PAR|PH5DIFF|PERFORM|ph5example -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
deleted file mode 100644
index 90dd52a..0000000
--- a/bin/batch/cori_knl_ctestP.sl.in.cmake
+++ /dev/null
@@ -1,17 +0,0 @@
-#!/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 TEST_PAR|PH5DIFF|PERFORM|ph5example -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
deleted file mode 100644
index 7db4483..0000000
--- a/bin/batch/cori_knl_ctestS.sl.in.cmake
+++ /dev/null
@@ -1,16 +0,0 @@
-#!/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 TEST_PAR|PH5DIFF|PERFORM|ph5example -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/ctest.qsub.in.cmake b/bin/batch/ctest.qsub.in.cmake
new file mode 100755
index 0000000..702fca7
--- /dev/null
+++ b/bin/batch/ctest.qsub.in.cmake
@@ -0,0 +1,21 @@
+#!/bin/bash -l
+if [ $# -gt 0 ]; then
+ SUMMARY_FILE=$1
+fi
+ACCOUNT_ID=@ACCOUNT_ID@
+
+echo "Run parallel test command. Test output will be in build/${SUMMARY_FILE}"
+CTEST_CMD=`which ctest`
+
+#SKIPTESTS <<KEYWORD:script inserts list of skips tests here -- don't remove>>
+
+cd @HDF5_BINARY_DIR@
+if [[ $SUMMARY_FILE == *"ctestS"* ]]; then
+ CMD="${CTEST_CMD} . -E MPI_TEST_ -C Release -j 32 -T test"
+else
+ CMD="${CTEST_CMD} . -R MPI_TEST_ ${SKIP_TESTS} -C Release -T test"
+fi
+
+qsub -t 60 -n 1 -q debug-flat-quad -A ${ACCOUNT_ID} ${CMD} >& ${SUMMARY_FILE}
+
+echo "Done running ctest parallel command."
diff --git a/bin/batch/ctestP.lsf.in.cmake b/bin/batch/ctestP.lsf.in.cmake
index 2777f39..3fdd5ce 100644
--- a/bin/batch/ctestP.lsf.in.cmake
+++ b/bin/batch/ctestP.lsf.in.cmake
@@ -14,6 +14,6 @@
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
+ctest . -R MPI_TEST_ -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
index 9fed14d..6399de7 100644
--- a/bin/batch/ctestP.sl.in.cmake
+++ b/bin/batch/ctestP.sl.in.cmake
@@ -8,9 +8,7 @@
#SBATCH --job-name=h5_ctestP
cd @HDF5_BINARY_DIR@
-CMD="ctest . -R TEST_PAR|PH5DIFF|PERFORM|ph5example -E t_cache_image -C Release -T test"
+ctest . -R MPI_TEST_ -C Release -T test >& ctestP.out
-echo "Run $CMD. Test output will be in build/ctestP.out"
-$CMD >& ctestP.out
-echo "Done running $CMD"
+echo "Done running ctestP.sl"
diff --git a/bin/batch/ctestS.lsf.in.cmake b/bin/batch/ctestS.lsf.in.cmake
index 7ef5af5..a01d39b 100644
--- a/bin/batch/ctestS.lsf.in.cmake
+++ b/bin/batch/ctestS.lsf.in.cmake
@@ -11,7 +11,7 @@
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
+ctest . -E MPI_TEST_ -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
index 98c1bcd..4f96bb9 100644
--- a/bin/batch/ctestS.sl.in.cmake
+++ b/bin/batch/ctestS.sl.in.cmake
@@ -8,7 +8,7 @@
#SBATCH --job-name=h5_ctestS
cd @HDF5_BINARY_DIR@
-CMD="ctest . -E TEST_PAR|PH5DIFF|PERFORM|ph5example -C Release -j 32 -T test"
+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
diff --git a/bin/batch/knl_ctestP.sl.in.cmake b/bin/batch/knl_ctestP.sl.in.cmake
index 5c7c83f..f985fbb 100644
--- a/bin/batch/knl_ctestP.sl.in.cmake
+++ b/bin/batch/knl_ctestP.sl.in.cmake
@@ -6,13 +6,11 @@
#SBATCH --mail-type=BEGIN,END,FAIL
##SBATCH --mail-user=<username>@sandia.gov
#SBATCH --export=ALL
-#SBATCH --job-name=h5_ctestS
+#SBATCH --job-name=h5_ctestP
cd @HDF5_BINARY_DIR@
#run parallel tests except t_cache_image test
-CMD="ctest . -R TEST_PAR|PH5DIFF|PERFORM|ph5example -E t_cache_image -C Release -T test"
+ctest . -R MPI_TEST_ -C Release -T test >& ctestP.out
-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
index 0dae31f..af6353b 100644
--- a/bin/batch/knl_ctestS.sl.in.cmake
+++ b/bin/batch/knl_ctestS.sl.in.cmake
@@ -9,7 +9,7 @@
#SBATCH --job-name=h5_ctestS
cd @HDF5_BINARY_DIR@
-CMD="ctest . -E TEST_PAR|PH5DIFF|PERFORM|ph5example -C Release -j 32 -T test"
+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
diff --git a/bin/batch/ray_ctestP.lsf.in.cmake b/bin/batch/ray_ctestP.lsf.in.cmake
index 6b5316a..7067a65 100644
--- a/bin/batch/ray_ctestP.lsf.in.cmake
+++ b/bin/batch/ray_ctestP.lsf.in.cmake
@@ -15,6 +15,6 @@
cd @HDF5_BINARY_DIR@
echo "Run parallel test command. Test output will be in build/ctestP.out"
-ctest . -R 'TEST_PAR|PH5DIFF|PERFORM|ph5example' -E t_cache_image -C Release -T test >& ctestP.out
+ctest . -R 'MPI_TEST_' -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
index d23a513..da20438 100644
--- a/bin/batch/ray_ctestS.lsf.in.cmake
+++ b/bin/batch/ray_ctestS.lsf.in.cmake
@@ -11,7 +11,7 @@
cd @HDF5_BINARY_DIR@
echo "Run command. Test output will be in build/ctestS.out"
-ctest . -E 'TEST_PAR|PH5DIFF|PERFORM|ph5example' -C Release -j 32 -T test >& 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/checkposix b/bin/checkposix
index 7ab741c..30128e3 100755
--- a/bin/checkposix
+++ b/bin/checkposix
@@ -13,101 +13,165 @@ require 5.003;
# If you do not have access to either file, you may request a copy from
# help@hdfgroup.org.
#
-# Robb Matzke, matzke@llnl.gov
-# 30 Aug 1997
+# Dana Robinson
+# Spring 2019
+# (Original by Robb Matzke)
#
-# Purpose: Given the names of C source files this script will print the
-# file name, line number, and function name of any function that
-# doesn't begin with the letter `h' or `H' as stipulated by the
-# HDF5 programming style guide.
+# Purpose: Given the names of C source files this script will print the
+# file name, line number, and function name of any function that
+# doesn't begin with the letter 'h' or 'H' as stipulated by the
+# HDF5 programming style guide.
#
-# Emacs users can run this script as the compile command and
-# use `next-error' (usually bound to M-`) to find each name
-# violation.
-
-if(<>) {
- if($ARGV =~ /\//) {
- ($filename) = ($ARGV =~ /^.*\/([A-Za-z0-9_]*)\.c$/);
- } else {
- ($filename) = ($ARGV =~ /([A-Za-z0-9_]*)\.c$/);
+# Emacs users can run this script as the compile command and
+# use 'next-error' (usually bound to M-`) to find each name
+# violation.
+
+use File::Basename;
+
+# Loop over all files passed to the function
+foreach $arg (@ARGV) {
+
+ # Get the filename from the path
+ $filename = fileparse($arg);
+
+ # Skip files that don't include H5private.h
+ # H5system. has to be inspected by hand since it wraps POSIX files
+ #
+ # H5detect and H5make_libsettings are created before the library exists
+ # so calls that link to function replacements won't work. We'll ignore
+ # it here.
+ #
+ # If a user specifies one file, process it no matter what so people
+ # can inspect files we normally skip (like H5system.c).
+ if($#ARGV gt 0 and $filename =~ /H5FDmulti|H5FDstdio|H5VLpassthru|H5system|H5detect|H5make_libsettings/) {
+ print "$filename is exempt from using Standard library macro wrappers\n";
+ next;
}
- if($filename =~ /H5FDmulti|H5FDstdio/) {
- print "$ARGV is exempt from using Standard library macro wrappers\n";
- } else {
- while (<>) {
-
- # Get rid of comments by removing the inside part.
- s|/\*.*?\*/||g;
- if ($in_comment) {
- if (/\*\//) {
- s|.*?\*/||;
- $in_comment = 0;
- } else {
- $_="\n";
- }
- } elsif (m|/\*|) {
- s|/\*.*||;
- $in_comment = 1;
- }
-
- # Get rid of string constants if they begin and end on this line.
- s/([\'\"])([^\1]|\\\1)*?\1/$1$1/g;
-
- # Get rid of preprocessor directives
- s/^\#.*//;
-
- # Skip callbacks invoked as methods in a struct
- next if $_ =~ /\b(\)?->|\.)\(?([a-z_A-Z]\w*)\s*\(/;
-
- # Now find all function calls on this line which don't start with 'H'
- while (($name)=/\b([a-z_A-GI-Z]\w*)\s*\(/) {
- $_ = $';
+ # Open the file
+ open(my $fh, "<", $arg) or do {
+ warn "NOTE: Unable to open $arg: !$\n";
+ next;
+ };
+
+ # Loop over all lines in the file to find undecorated functions
+ while (<$fh>) {
+
+ # Get rid of comments by removing the inside part.
+ s|/\*.*?\*/||g;
+ if ($in_comment) {
+ if (/\*\//) {
+ s|.*?\*/||;
+ $in_comment = 0;
+ } else {
+ $_="\n";
+ }
+ } elsif (m|/\*|) {
+ s|/\*.*||;
+ $in_comment = 1;
+ }
+
+ # Get rid of string constants if they begin and end on this line.
+ s/([\'\"])([^\1]|\\\1)*?\1/$1$1/g;
+
+ # Get rid of preprocessor directives
+ s/^\#.*//;
+
+ # Skip callbacks invoked as methods in a struct
+ next if $_ =~ /\b(\)?]?->|\.)\(?([a-z_A-Z]\w*)\s*\(/;
+
+ # Now find all function calls on this line which don't start with 'H'
+ while (($name)=/\b([a-z_A-GI-Z]\w*)\s*\(/) {
+ $_ = $';
- # Ignore C statements that look sort of like function
- # calls.
- next if $name =~ /^(if|for|offsetof|return|sizeof|switch|while|void)$/;
-
- # Ignore things that get misdetected because of the simplified
- # parsing that takes place here.
- next if $name =~ /^(int|herr_t|_term_interface)$/;
-
- # These are really HDF5 functions/macros even though they don't
- # start with `h' or `H'.
- next if $name =~ /^FUNC_(ENTER|LEAVE)(_(NO)?API|_PACKAGE|_STATIC)?(_NOFS|_NOCLEAR|_NOINIT)?(_NOFUNC|_TAG)?$/;
- next if $name =~ /^(BEGIN|END)_FUNC$/;
- next if $name =~ /^U?INT(8|16|32|64)(ENCODE|DECODE)(_VAR)?$/;
- next if $name =~ /^CI_(PRINT_STATS|INC_SRC|INC_DST)$/;
- next if $name =~ /^(ABS|ADDR_OVERFLOW|ALL_MEMBERS|BOUND|CONSTR|DETECT_[I|F|M]|DOWN)$/;
- next if $name =~ /^(MIN3?|MAX3?|NELMTS|POWER_OF_TWO|REGION_OVERFLOW)$/;
- next if $name =~ /^(UNIQUE_MEMBERS)$/;
- next if $name =~ /^addr_defined$/;
-
- # These functions/macros are exempt.
- next if $name =~ /^(main|[fs]?printf|va_(start|arg|end))$/;
-
- # These are Windows system calls. Ignore them.
- next if $name =~ /^(_get_osfhandle|GetFileInformationByHandle|SetFilePointer|GetLastError|SetEndOfFile)$/;
- next if $name =~ /^(FindNextFile|FindClose|_tzset|Wgettimeofday|GetSystemTimeAsFileTime|Wgetlogin|GetUserName)$/;
-
- # These are MPI function calls. Ignore them.
- next if $name =~ /^(MPI_|MPE_)/;
-
- # These are POSIX threads function calls. Ignore them.
- next if $name =~ /^pthread_/;
-
- # These are Windows threads function calls. Ignore them.
- next if $name =~ /^(_beginthread|(Initialize|Enter|Leave)CriticalSection|TlsAlloc)$/;
-
- # These are zlib & szlib function calls. Ignore them.
- next if $name =~ /^(inflate|SZ_)/;
- next if $name =~ /^compress2$/;
-
- print "$ARGV:$.: $name\n";
- }
-
- } continue {
- close ARGV if eof; # reset line number
+ # Ignore C statements that look sort of like function
+ # calls.
+ next if $name =~ /^(if|for|offsetof|return|sizeof|switch|while|void)$/;
+
+ # Ignore things that get misdetected because of the simplified
+ # parsing that takes place here.
+ next if $name =~ /^(int|herr_t|_term_interface|_term_package)$/;
+
+ # These are really HDF5 functions/macros even though they don't
+ # start with `h' or `H'.
+ next if $name =~ /^FUNC_(ENTER|LEAVE)(_(NO)?API|_PACKAGE|_STATIC)?(_NOFS|_NOCLEAR|_NOINIT)?(_NOFUNC|_TAG)?$/;
+ next if $name =~ /^(BEGIN|END)_FUNC$/;
+ next if $name =~ /^U?INT(8|16|32|64)(ENCODE|DECODE)(_VAR)?$/;
+ next if $name =~ /^CI_(PRINT_STATS|INC_SRC|INC_DST)$/;
+ next if $name =~ /^(ABS|ADDR_OVERFLOW|ALL_MEMBERS|BOUND|CONSTR|DETECT_[I|F|M]|DOWN)$/;
+ next if $name =~ /^(MIN3?|MAX3?|NELMTS|POWER_OF_TWO|REGION_OVERFLOW)$/;
+ next if $name =~ /^(UNIQUE_MEMBERS|S_ISDIR)$/;
+ next if $name =~ /^addr_defined$/;
+
+ # These functions/macros are exempt.
+ # op, cb, and OP are often spuriously flagged so ignore them.
+ next if $name =~ /^(main|op|cb|OP)$/;
+
+ # This often appears in preprocessor lines that span multiple lines
+ next if $name =~ /^(defined)$/;
+
+ # These are Windows system calls. Ignore them.
+ next if $name =~ /^(_get_osfhandle|GetFileInformationByHandle|SetFilePointer|GetLastError|SetEndOfFile)$/;
+ next if $name =~ /^(FindNextFile|FindClose|_tzset|Wgettimeofday|GetSystemTimeAsFileTime|Wgetlogin|GetUserName)$/;
+ next if $name =~ /^(DeleteCriticalSection|TlsFree|TlsGetValue|CreateThread)$/;
+ next if $name =~ /^(ExpandEnvironmentStringsA|LockFileEx|UnlockFileEx)$/;
+ next if $name =~ /^(DllMain|LocalAlloc|LocalFree)$/;
+ next if $name =~ /^(FindFirstFileA|FindNextFileA)$/;
+ next if $name =~ /^(_beginthread|(Initialize|Enter|Leave)CriticalSection|TlsAlloc)$/;
+
+ # These are MPI function calls. Ignore them.
+ next if $name =~ /^(MPI_|MPE_)/;
+
+ # These are POSIX threads function calls. Ignore them.
+ next if $name =~ /^pthread_/;
+
+ # These are zlib & szlib function calls. Ignore them.
+ next if $name =~ /^(inflate|SZ_)/;
+ next if $name =~ /^compress2$/;
+
+ # These is an H5Dfill function. Ignore it in this file.
+ if($filename =~ /H5Dfill/) {
+ next if $name =~ /^(alloc_func)$/;
+ }
+
+ # These are H5Zscaleoffset functions. Ignore them in this file.
+ if($filename =~ /H5Zscaleoffset/) {
+ next if $name =~ /^(pow_fun|round_fun|abs_fun|lround_fun|llround_fun)$/;
+ }
+
+ # TESTING (not comprehensive - just noise reduction)
+
+ # Test macros and functions (testhdf5.h)
+ next if $name =~ /^(AddTest|TestErrPrintf|TestSummary|TestCleanup|TestShutdown)$/;
+ next if $name =~ /^(CHECK|CHECK_PTR|CHECK_PTR_NULL|CHECK_PTR_EQ|CHECK_I)$/;
+ next if $name =~ /^(VERIFY|VERIFY_STR|VERIFY|TYPE|MESSAGE|ERROR)$/;
+
+ # Test macros and functions (h5test.h)
+ next if $name =~ /^(TESTING|PASSED|SKIPPED|FAIL_PUTS_ERROR|FAIL_STACK_ERROR|TEST_ERROR)$/;
+ next if $name =~ /^(GetTestExpress)$/;
+
+ # Ignore functions that start with test_ or check_
+ next if $name =~ /^test_/;
+ next if $name =~ /^check_/;
+
+ # Ignore functions that start with h5_
+ next if $name =~ /^h5_/;
+
+ # Ignore usage functions
+ next if $name =~ /^usage$/;
+
+ print "$filename:$.: $name\n";
}
+
}
+
+ # Close the file
+ close($fh);
+}
+
+if($#ARGV gt 0) {
+ print "\n";
+ print "NOTE:\n";
+ print "If any files were skipped due to being exempt, you can inspect them manually\n";
+ print "by using this script on them one at a time, which will always process the file.\n";
}
diff --git a/tools/src/misc/h5cc.in b/bin/h5cc.in
index 9c4e3ca..9c4e3ca 100644
--- a/tools/src/misc/h5cc.in
+++ b/bin/h5cc.in
diff --git a/tools/src/misc/h5redeploy.in b/bin/h5redeploy.in
index 242459a..242459a 100644
--- a/tools/src/misc/h5redeploy.in
+++ b/bin/h5redeploy.in
diff --git a/bin/snapshot b/bin/snapshot
index 5900728..1218caa 100755
--- a/bin/snapshot
+++ b/bin/snapshot
@@ -130,10 +130,10 @@ DISPLAYUSAGE()
set -
cat <<EOF
Usage: $PROGNAME [all] [checkout] [ftp <URL> [diff] [test] [srcdir] [release] [help]
- [clean] [distclean] [echo] [deploy <dir>] [deploydir <dir>]
- [zlib <zlib_path>] [releasedir <dir>] [srcdirname <dir>] [check-vfd]
- [check-vol]
- [exec <command>] [module-load <module-list>] [op-configure <option>]
+ [clean] [distclean] [echo] [deploy <dir>] [deploydir <dir>]
+ [zlib <zlib_path>] [releasedir <dir>] [srcdirname <dir>] [check-vfd]
+ [check-passthrough-vol]
+ [exec <command>] [module-load <module-list>] [op-configure <option>]
[--<option>]
all: Run all commands (checkout, test & release)
[Default is all]
@@ -150,8 +150,8 @@ Usage: $PROGNAME [all] [checkout] [ftp <URL> [diff] [test] [srcdir] [release] [h
setenv <name> <value>:
Set environment variable <name> to <value>.
setenvN <N> <name> <value> ...:
- Set environment variable with <N> values.
- E.g., setenvN 3 x a b c is same as setenv x="a b c".
+ Set environment variable with <N> values.
+ E.g., setenvN 3 x a b c is same as setenv x="a b c".
srcdir: Use srcdir option (does not imply other commands)
"snapshot srcdir" is equivalent to "snapshot srcdir all"
"snapshot srcdir checkout" is equivalent to "snapshot checkout"
@@ -169,9 +169,12 @@ Usage: $PROGNAME [all] [checkout] [ftp <URL> [diff] [test] [srcdir] [release] [h
Use <dir> as the release directory
[Default is $ReleaseDir_default]
check-vfd:
- Run make check-vfd instead of just make check.
- check-vol:
- Run make check-vol instead of just make check.
+ Run make check-vfd instead of just make check.
+ check-passthrough-vol:
+ Run make check-passthrough-vol instead of just make check.
+ NOTE: Will only succeed with passthrough VOL connectors
+ that use the native VOL connector as the terminal
+ connector.
exttest <testscript>;
Run testscript;
exec <command>:
@@ -425,8 +428,8 @@ while [ $# -gt 0 ] ; do
check-vfd)
CHECKVAL=check-vfd
;;
- check-vol)
- CHECKVAL=check-vol
+ check-passthrough-vol)
+ CHECKVAL=check-passthrough-vol
;;
module-load)
shift
diff --git a/bin/warnhist b/bin/warnhist
new file mode 100755
index 0000000..5750c77
--- /dev/null
+++ b/bin/warnhist
@@ -0,0 +1,514 @@
+#!/usr/bin/perl -w
+require 5.003;
+
+#
+# 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 files COPYING and Copyright.html. COPYING can be found at the root
+# of the source code distribution tree; Copyright.html can be found at the
+# root level of an installed copy of the electronic HDF5 document set and
+# is linked from the top-level documents page. It can also be found at
+# http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have
+# access to either file, you may request a copy from help@hdfgroup.org.
+#
+# Quincey Koziol, koziol@hdfgroup.org
+# 9 Aug 2013
+#
+# Purpose: Given an input file containing the output from a build of the
+# library, gather the file names and line numbers, alias
+# identical types of warnings together into a single bin and
+# report the number of warnings for each type of warning, each file
+# and the total count of warnings
+
+# Perl modules/settings
+use strict;
+use Getopt::Std;
+
+# Global variables, for accumulating information
+my $totalcount = 0;
+my %warn_count = ();
+my $warncount;
+my %warn_file = ();
+my %warn_file_line = ();
+my %file_count = ();
+my $filecount;
+my $ignorecount = 0;
+my @ignorenames;
+my %ignored_files = ();
+my %warn_file_indices = ();
+my %file_warn_indices = ();
+my %file_warn = ();
+my %file_warn_line = ();
+my $current_warning = 0;
+my $current_file = 0;
+my $warn_index;
+my $last_c_name;
+my $last_fort_name;
+my $last_fort_line;
+
+# declare the Perl command line flags/options we want to allow
+my %options=();
+getopts("FWht:w:f:i:l", \%options);
+
+# Display usage, if requested
+if($options{h}) {
+ print "Usage: 'warnhist [-h] [-t <prefix>] [-w <n>] [-W] [-f <n>] [-F] [-l] [-i <name list> [file]'\n";
+ print "\t-h\tDisplay this usage\n";
+ print "\t-t <prefix>\tTrim pathname prefix from filenames, <prefix>\n";
+ print "\t-w <n>\tDisplay files for a given warning index list, <n>\n";
+ print "\t\t<n> can be a single value, a range, or a comma separated list\n";
+ print "\t\tFor example: '0' or '0,4' or '8-10' or '0,2-4,8-10,13'\n";
+ print "\t-W\tDisplay files for all warnings\n";
+ print "\t-f <n>\tDisplay warnings for a given file index list, <n>\n";
+ print "\t\t<n> can be a single value, a range, or a comma separated list\n";
+ print "\t\tFor example: '0' or '0,4' or '8-10' or '0,2-4,8-10,13'\n";
+ print "\t-F\tDisplay warnings for all files\n";
+ print "\t-l\tDisplay line nunbers for file/warning\n";
+ print "\t-i <name list>\tIgnore named files, <name list>\n";
+ print "\t\t<name list> is a comma separated list, with no spaces\n";
+ print "\t\tFor example: 'H5LTparse' or 'H5LTparse,H5LTanalyze'\n";
+ print "\tfile\tFilename containing build output\n";
+ print "\t\tIf no file is given, standard input is used.\n";
+ exit;
+}
+
+# Parse list of file names to ignore
+if(exists $options{i}) {
+ @ignorenames = split /,/, $options{i};
+#print @ignorenames;
+}
+
+# Parse list of warning indices to expand file names
+if(exists $options{w}) {
+ my @tmp_indices;
+
+ @tmp_indices = split /,/, $options{w};
+#print @tmp_indices;
+ for my $x (@tmp_indices) {
+#print "x = '$x'\n";
+ if($x =~ /\-/) {
+ my $start_index;
+ my $end_index;
+
+#print "matched = '$x'\n";
+ ($start_index, $end_index) = split /\-/, $x;
+#print "start_index = '$start_index', end_index = '$end_index'\n";
+ for my $y ($start_index..$end_index) {
+#print "y = '$y'\n";
+ if(!(exists $warn_file_indices{$y})) {
+ $warn_file_indices{$y} = $y;
+ }
+ }
+ }
+ else {
+ if(!(exists $warn_file_indices{$x})) {
+ $warn_file_indices{$x} = $x;
+ }
+ }
+ }
+#foreach (sort keys %warn_file_indices) {
+# print "$_ : $warn_file_indices{$_}\n";
+#}
+}
+
+# Parse list of file indices to expand warnings
+if(exists $options{f}) {
+ my @tmp_indices;
+
+ @tmp_indices = split /,/, $options{f};
+#print @tmp_indices;
+ for my $x (@tmp_indices) {
+#print "x = '$x'\n";
+ if($x =~ /\-/) {
+ my $start_index;
+ my $end_index;
+
+#print "matched = '$x'\n";
+ ($start_index, $end_index) = split /\-/, $x;
+#print "start_index = '$start_index', end_index = '$end_index'\n";
+ for my $y ($start_index..$end_index) {
+#print "y = '$y'\n";
+ if(!(exists $file_warn_indices{$y})) {
+ $file_warn_indices{$y} = $y;
+ }
+ }
+ }
+ else {
+ if(!(exists $file_warn_indices{$x})) {
+ $file_warn_indices{$x} = $x;
+ }
+ }
+ }
+#foreach (sort keys %warn_file_indices) {
+# print "$_ : $warn_file_indices{$_}\n";
+#}
+}
+
+PARSE_LINES:
+while (<>) {
+ my $name;
+ my $line;
+ my $prev_line;
+ my $toss;
+ my $offset;
+ my $warning;
+ my $extra;
+
+ # Retain last FORTRAN compile line, which comes a few lines before warning
+ if($_ =~ /.*\.[fF]90:.*/) {
+ ($last_fort_name, $last_fort_line, $toss) = split /\:/, $_;
+ ($last_fort_line, $toss) = split /\./, $last_fort_line;
+ }
+
+ # Retain last C compile line, which possibly comes a few lines before warning
+ if($_ =~ /.*[A-Za-z0-9_]\.c:.*/) {
+ ($last_c_name, $toss) = split /\:/, $_;
+ }
+
+ next if $_ !~ /[Ww]arning:/;
+
+ # Skip warnings from linker
+ next if $_ =~ /ld: warning:/;
+
+ # Check for weird formatting of warning message
+ if($_ =~ /^cc1: warning:.*/) {
+ $name = $last_c_name;
+ $line = "??";
+ ($toss, $toss, $warning, $extra) = split /\:/, $_;
+ # Check for FORTRAN warning output
+ } elsif($_ =~ /^Warning:.*/) {
+ $name = $last_fort_name;
+ $line = $last_fort_line;
+ ($toss, $warning, $extra) = split /\:/, $_;
+#print "1:",$.,":",$_;
+# $_ = <>;
+#print "2:",$.,":",$_;
+# if($_ =~ /^\sFC.*/) {
+# $_ = <>;
+#print "3:",$.,":",$_;
+# }
+# ($name, $line, $toss) = split /\:/, $_;
+#print "4:","'",$name,"'","-","'",$line,"'","\n";
+ # Check for improperly parsed filename or line
+ if($name =~ /^$/) {
+ print "Filename is a null string! Input line #$. is: '$_'";
+ next
+ }
+ if($line =~ /^$/) {
+ print "Line is a null string! Input line #$. is: '$_'";
+ next
+ }
+ } else {
+ # Check for 'character offset' field
+ if($_ =~ /^.*[0-9]+\:[0-9]+\:/) {
+ ($name, $line, $offset, $toss, $warning, $extra) = split /\:/, $_;
+ } else {
+ ($name, $line, $toss, $warning, $extra) = split /\:/, $_;
+ }
+ }
+
+ # Check for extra ':' followed by more text in original warning string,
+ # and append the ':' and text back onto the parsed warning
+ # (Use 'length $extra' idiom to avoid warning when $extra is undefined)
+ if(length $extra ) {
+ $warning = join ':', $warning, $extra;
+ }
+
+ # Trim leading '..' paths from filename
+ while($name =~ /^\.\.\//) {
+ $name =~ s/^\.\.\///g;
+ }
+
+ # Check for trimming prefix
+ if((exists $options{t}) && ($name =~ /$options{t}/)) {
+ $name =~ s/^$options{t}\///g;
+ }
+
+ # Check for ignored file
+ if(exists $options{i}) {
+ for my $x (@ignorenames) {
+#print "x = '$x'\n";
+ if($name =~ /$x/) {
+# print "matched name = '$name'\n";
+ $ignorecount++;
+ if(!(exists $ignored_files{$name})) {
+ $ignored_files{$name} = $name;
+ }
+ next PARSE_LINES;
+ }
+ }
+ }
+
+ # Check for improperly parsed warning (usually an undefined warning string)
+ if(!defined $warning) {
+ print "Warning Undefined! Input line is: '$_'";
+ next
+ }
+
+ # Get rid of leading & trailing whitespace
+ $warning =~ s/^\s//g;
+ $warning =~ s/\s$//g;
+
+ # Check for improperly parsed warning
+ if($warning =~ /^$/) {
+ print "Warning is a null string! Input line is: '$_'";
+ next
+ }
+
+ # Convert all quotes to '
+ $warning =~ s/‘/'/g;
+ $warning =~ s/’/'/g;
+
+ # Skip supplemental warning message
+ next if $warning =~ /near initialization for/;
+
+ # Skip GCC warning that should be a note
+ next if $_ =~ /\(this will be reported only once per input file\)/;
+
+ # Eliminate "{aka <some type>}" info
+ if($warning =~ /\s\{aka [A-Za-z_0-9\s\*]*\}'/) {
+ $warning =~ s/\s\{aka [A-Za-z_0-9\s\*]*\}//g;
+ }
+
+ # Genericize warnings
+ if($warning =~ /variable '[A-Za-z_0-9]*' set but not used.*/) {
+ $warning =~ s/'[A-Za-z_0-9]*'/'-'/g;
+ } elsif($warning =~ /unused variable '[A-Za-z_0-9]*'.*/) {
+ $warning =~ s/'[A-Za-z_0-9]*'/'-'/g;
+ } elsif($warning =~ /implicit conversion from '[A-Za-z_0-9]*' to '[A-Za-z_0-9]*' when passing argument to function.*/) {
+ $warning =~ s/'[A-Za-z_0-9]*'/'-'/g;
+ } elsif($warning =~ /implicit conversion from '[A-Za-z_0-9]*' to '[A-Za-z_0-9]*' to match other operand of binary expression.*/) {
+ $warning =~ s/'[A-Za-z_0-9]*'/'-'/g;
+ } elsif($warning =~ /conversion to '[A-Za-z_0-9\s]*' from '[A-Za-z_0-9\s]*' may alter its value.*/) {
+ $warning =~ s/'[A-Za-z_0-9\s]*'/'-'/g;
+ } elsif($warning =~ /conversion to '[A-Za-z_0-9\s]*' from '[A-Za-z_0-9\s]*' may change the sign of the result.*/) {
+ $warning =~ s/'[A-Za-z_0-9\s]*'/'-'/g;
+ } elsif($warning =~ /passing argument [0-9]* of '[A-Za-z_0-9\s]*' discards '[A-Za-z_0-9\s]*'.*/) {
+ $warning =~ s/passing argument [0-9]*/passing argument -/g;
+ $warning =~ s/'[A-Za-z_0-9\s]*'/'-'/g;
+ } elsif($warning =~ /'[A-Za-z_0-9\s]*' defined but not used.*/) {
+ $warning =~ s/'[A-Za-z_0-9\s]*'/'-'/g;
+ } elsif($warning =~ /cast discards '[A-Za-z_0-9\(\)\s]*'.*/) {
+ $warning =~ s/'[A-Za-z_0-9\(\)\s]*'/'-'/g;
+ } elsif($warning =~ /size of '[A-Za-z_0-9\(\)\s\*]*' is [0-9]* bytes.*/) {
+ $warning =~ s/is [0-9]* bytes/is - bytes/g;
+ $warning =~ s/'[A-Za-z_0-9\(\)\s\*]*'/'-'/g;
+ } elsif($warning =~ /passing argument [0-9]* of '[A-Za-z_0-9\(\)\s]*' from incompatible.*/) {
+ $warning =~ s/passing argument [0-9]*/passing argument -/g;
+ $warning =~ s/'[A-Za-z_0-9\(\)\s]*'/'-'/g;
+ } elsif($warning =~ /stack usage is [0-9]* bytes.*/) {
+ $warning =~ s/stack usage is [0-9]*/stack usage is -/g;
+ } elsif($warning =~ /stack usage might be [0-9]* bytes.*/) {
+ $warning =~ s/stack usage might be [0-9]*/stack usage might be -/g;
+ } elsif($warning =~ /the frame size of [0-9]* bytes is larger than [0-9]* bytes.*/) {
+ $warning =~ s/the frame size of [0-9]* bytes is larger than [0-9]*/the frame size of - bytes is larger than -/g;
+ } elsif($warning =~ /enumeration value '[A-Za-z_0-9\s]*' not handled in switch.*/) {
+ $warning =~ s/'[A-Za-z_0-9\s]*'/'-'/g;
+ } elsif($warning =~ /"[A-Za-z_0-9\s]*" is not defined.*/) {
+ $warning =~ s/"[A-Za-z_0-9\s]*"/"-"/g;
+ } elsif($warning =~ /macro "[A-Za-z_0-9\s]*" is not used.*/) {
+ $warning =~ s/"[A-Za-z_0-9\s]*"/"-"/g;
+ } elsif($warning =~ /unused parameter '[A-Za-z_0-9\s]*'.*/) {
+ $warning =~ s/'[A-Za-z_0-9\s]*'/'-'/g;
+ } elsif($warning =~ /request for implicit conversion from '[A-Za-z_0-9\s\*]*' to '[A-Za-z_0-9\s\<\>\[\]\(\)\*]*' not permitted in C\+\+.*/) {
+ $warning =~ s/'[A-Za-z_0-9\s\*\<\>\[\]\(\)]*'/'-'/g;
+ } elsif($warning =~ /no previous prototype for '[A-Za-z_0-9\s]*'.*/) {
+ $warning =~ s/'[A-Za-z_0-9\s]*'/'-'/g;
+ } elsif($warning =~ /declaration of '[A-Za-z_0-9\s]*' shadows a previous local.*/) {
+ $warning =~ s/'[A-Za-z_0-9\s]*'/'-'/g;
+ } elsif($warning =~ /cast from function call of type '[A-Za-z_0-9\s\*]*' to non-matching type '[A-Za-z_0-9\s\*]*'.*/) {
+ $warning =~ s/'[A-Za-z_0-9\s\*]*'/'-'/g;
+ } elsif($warning =~ /'[A-Za-z_0-9\s]*' declared '[A-Za-z_0-9\s]*' but never defined.*/) {
+ $warning =~ s/'[A-Za-z_0-9\s]*'/'-'/g;
+ } elsif($warning =~ /declaration of '[A-Za-z_0-9\s]*' shadows a global declaration.*/) {
+ $warning =~ s/'[A-Za-z_0-9\s]*'/'-'/g;
+ } elsif($warning =~ /typedef '[A-Za-z_0-9\s]*' locally defined but not used.*/) {
+ $warning =~ s/'[A-Za-z_0-9\s]*'/'-'/g;
+ } elsif($warning =~ /format '%[a-z]*' expects argument of type '[A-Za-z_0-9\s\*]*', but argument [0-9]* has type '[A-Za-z_0-9\s\*\(\),]*'.*/) {
+ $warning =~ s/but argument [0-9]*/but argument -/g;
+ $warning =~ s/'[%A-Za-z_0-9\s\*\(\),]*'/'-'/g;
+ } elsif($warning =~ /conversion to '[A-Za-z_0-9\s]*' alters '[A-Za-z_0-9\s]*' constant value.*/) {
+ $warning =~ s/'[A-Za-z_0-9\s]*'/'-'/g;
+ } elsif($warning =~ /to be safe all intermediate pointers in cast from '[A-Za-z_0-9\s\*]*' to '[A-Za-z_0-9\s\*]*' must be 'const' qualified.*/) {
+ $warning =~ s/'[A-Za-z_0-9\s\*]*'/'-'/g;
+ } elsif($warning =~ /identifier '[A-Za-z_0-9]*' conflicts with C\+\+ keyword.*/) {
+ $warning =~ s/'[A-Za-z_0-9]*'/'-'/g;
+ } elsif($warning =~ /nested extern declaration of '[A-Za-z_0-9]*'.*/) {
+ $warning =~ s/'[A-Za-z_0-9]*'/'-'/g;
+ } elsif($warning =~ /Procedure '[A-Za-z_0-9]*' called with an implicit interface.*/) {
+ $warning =~ s/'[A-Za-z_0-9]*'/'-'/g;
+ } elsif($warning =~ /Unused dummy argument '[A-Za-z_0-9]*'.*/) {
+ $warning =~ s/'[A-Za-z_0-9]*'/'-'/g;
+ } elsif($warning =~ /Unused parameter '[A-Za-z_0-9]*' declared at.*/) {
+ $warning =~ s/'[A-Za-z_0-9]*'/'-'/g;
+ } elsif($warning =~ /Unused variable '[A-Za-z_0-9]*' declared at.*/) {
+ $warning =~ s/'[A-Za-z_0-9]*'/'-'/g;
+ } elsif($warning =~ /Inequality comparison for REAL\([0-9]*\) at.*/) {
+ $warning =~ s/REAL\([0-9]*\)/REAL\(-\)/g;
+ } elsif($warning =~ /Possible change of value in conversion from INTEGER\([0-9]*\) to (INTEGER|REAL)\([0-9]*\) at.*/) {
+ $warning =~ s/INTEGER\([0-9]*\)/INTEGER\(-\)/g;
+ $warning =~ s/REAL\([0-9]*\)/REAL\(-\)/g;
+ } elsif($warning =~ /passing argument [0-9]* of '[A-Za-z_0-9]*' with different width due to prototype.*/) {
+ $warning =~ s/passing argument [0-9]*/passing argument -/g;
+ $warning =~ s/'[A-Za-z_0-9]*'/'-'/g;
+ } elsif($warning =~ /passing argument [0-9]* of '[A-Za-z_0-9]*' as unsigned due to prototype.*/) {
+ $warning =~ s/passing argument [0-9]*/passing argument -/g;
+ $warning =~ s/'[A-Za-z_0-9]*'/'-'/g;
+ } elsif($warning =~ /passing argument [0-9]* of '[A-Za-z_0-9]*' discards qualifiers from pointer target type.*/) {
+ $warning =~ s/passing argument [0-9]*/passing argument -/g;
+ $warning =~ s/'[A-Za-z_0-9]*'/'-'/g;
+ } elsif($warning =~ /passing argument [0-9]* of '[A-Za-z_0-9]*' as floating rather than integer due to prototype.*/) {
+ $warning =~ s/passing argument [0-9]*/passing argument -/g;
+ $warning =~ s/'[A-Za-z_0-9]*'/'-'/g;
+ } elsif($warning =~ /passing argument [0-9]* of '[A-Za-z_0-9]*' as 'float' rather than 'double' due to prototype.*/) {
+ $warning =~ s/passing argument [0-9]*/passing argument -/g;
+ $warning =~ s/'[A-Za-z_0-9]*'/'-'/;
+ } elsif($warning =~ /passing argument [0-9]* of '[A-Za-z_0-9]*' as signed due to prototype.*/) {
+ $warning =~ s/passing argument [0-9]*/passing argument -/g;
+ $warning =~ s/'[A-Za-z_0-9]*'/'-'/g;
+ } elsif($warning =~ /format '\%[A-Za-z0-9]*' expects type '[a-z][a-z\s\*]*', but argument [0-9]* has type '[a-z][a-z\(\)_,\s\*]*'.*/) {
+ $warning =~ s/but argument [0-9]*/but argument -/g;
+ $warning =~ s/'\%[A-Za-z0-9]*'/'\%-'/g;
+ $warning =~ s/'[a-z][a-z_,\s\*\(\)]*'/'-'/g;
+ } elsif($warning =~ /implicit declaration of function '[A-Za-z_0-9]*'.*/) {
+ $warning =~ s/'[A-Za-z_0-9]*'/'-'/g;
+ } elsif($warning =~ /'[A-Za-z_\.\[\]0-9]*' may be used uninitialized in this function.*/) {
+ $warning =~ s/'[A-Za-z_\.\[\]0-9]*'/'-'/g;
+ } elsif($warning =~ /redundant redeclaration of '[A-Za-z_0-9]*'.*/) {
+ $warning =~ s/'[A-Za-z_0-9]*'/'-'/g;
+ } elsif($warning =~ /declaration of '[A-Za-z_0-9]*' shadows a parameter.*/) {
+ $warning =~ s/'[A-Za-z_0-9]*'/'-'/g;
+ } elsif($warning =~ /ISO C90 does not support the '[a-z]*' gnu_scanf length modifier.*/) {
+ $warning =~ s/'[a-z]*'/'-'/g;
+ } elsif($warning =~ /ISO C90 does not support the '[a-z]*' gnu_printf length modifier.*/) {
+ $warning =~ s/'[a-z]*'/'-'/g;
+ } elsif($warning =~ /ISO C90 does not support the '%[a-z]*' gnu_printf format.*/) {
+ $warning =~ s/'%[a-z]*'/'%-'/g;
+ } elsif($warning =~ /string length '[0-9]*' is greater than the length.*/) {
+ $warning =~ s/string length '[0-9]*' is/string length '-' is/g;
+ } elsif($warning =~ /enum conversion when passing argument [0-9]* of '[A-Za-z_0-9]*' is invalid.*/) {
+ $warning =~ s/passing argument [0-9]*/passing argument -/g;
+ $warning =~ s/'[A-Za-z_0-9]*'/'-'/g;
+ } elsif($warning =~ /duplicate declaration of '[A-Za-z_0-9]*' is invalid in.*/) {
+ $warning =~ s/'[A-Za-z_0-9]*'/'-'/g;
+ } elsif($warning =~ /Variable '[A-Za-z_0-9]*' at \([0-9]*\) is a dummy argument of the BIND\(C\) procedure '[A-Za-z_0-9]*' but may not be C interoperable.*/) {
+ $warning =~ s/'[A-Za-z_0-9]*'/'-'/g;
+ $warning =~ s/at \([0-9]*\)/at \(-\)/g;
+ } elsif($warning =~ /Variable '[A-Za-z_0-9]*' at \([0-9]*\) may not be a C interoperable kind but it is BIND\(C\).*/) {
+ $warning =~ s/'[A-Za-z_0-9]*'/'-'/g;
+ $warning =~ s/at \([0-9]*\)/at \(-\)/g;
+ } elsif($warning =~ /Component '[A-Za-z_0-9]*' in derived type '[A-Za-z_0-9]*' at \([0-9]*\) may not be C interoperable, even though derived type '[A-Za-z_0-9]*' is BIND\(C\).*/) {
+ $warning =~ s/'[A-Za-z_0-9]*'/'-'/g;
+ $warning =~ s/at \([0-9]*\)/at \(-\)/g;
+ } elsif($warning =~ /function might be candidate for attribute '[A-Za-z_0-9]*' if it is known to return normally \[-Wsuggest-attribute=[A-Za-z_0-9]*\].*/) {
+ $warning =~ s/'[A-Za-z_0-9]*'/'-'/g;
+ $warning =~ s/=[A-Za-z_0-9]*\]/=-\]/g;
+ } elsif($warning =~ /function might be candidate for attribute '[A-Za-z_0-9]*' \[-Wsuggest-attribute=[A-Za-z_0-9]*\].*/) {
+ $warning =~ s/'[A-Za-z_0-9]*'/'-'/g;
+ $warning =~ s/=[A-Za-z_0-9]*\]/=-\]/g;
+ } elsif($warning =~ /passing argument [0-9]+ of '[A-Za-z_0-9]*' makes integer from pointer without a cast \[-Wint-conversion\].*/) {
+ $warning =~ s/'[A-Za-z_0-9]*'/'-'/g;
+ $warning =~ s/[0-9]+/-/g;
+ } elsif($warning =~ /function '[A-Za-z_0-9]*' might be a candidate for '[A-Za-z_0-9]*' format attribute \[-Wsuggest-attribute=format\].*/) {
+ $warning =~ s/'[A-Za-z_0-9]*'/'-'/g;
+ } elsif($warning =~ /inlining failed in call to '[A-Za-z_0-9]*': call is unlikely and code size would grow \[-Winline\].*/) {
+ $warning =~ s/'[A-Za-z_0-9]*'/'-'/g;
+ } elsif($warning =~ /'%[0-9]*[\.\*]*[0-9]*[dfsu]' directive writing between [0-9]+ and [0-9]+ bytes into a region of size [0-9]+ \[-Wformat-overflow=\].*/) {
+ $warning =~ s/'%[0-9]*[\.\*]*[0-9]*[dfsu]'/'-'/g;
+ $warning =~ s/[0-9]+/-/g;
+ } elsif($warning =~ /'%[0-9]*[\.\*]*[0-9]*[dfsu]' directive writing between [0-9]+ and [0-9]+ bytes into a region of size between [0-9]+ and [0-9]+ \[-Wformat-overflow=\].*/) {
+ $warning =~ s/'%[0-9]*[\.\*]*[0-9]*[dfsu]'/'-'/g;
+ $warning =~ s/[0-9]+/-/g;
+ } elsif($warning =~ /'%[0-9]*[\.\*]*[0-9]*[dfsu]' directive output may be truncated writing between [0-9]+ and [0-9]+ bytes into a region of size [0-9]+ \[-Wformat-truncation=\].*/) {
+ $warning =~ s/'%[0-9]*[\.\*]*[0-9]*[dfsu]'/'-'/g;
+ $warning =~ s/[0-9]+/-/g;
+ } elsif($warning =~ /'%[0-9]*[\.\*]*[0-9]*[dfsu]' directive output may be truncated writing up to [0-9]+ bytes into a region of size [0-9]+ \[-Wformat-truncation=\].*/) {
+ $warning =~ s/'%[0-9]*[\.\*]*[0-9]*[dfsu]'/'-'/g;
+ $warning =~ s/[0-9]+/-/g;
+ } elsif($warning =~ /'%[0-9]*[\.\*]*[0-9]*[dfsu]' directive output may be truncated writing between [0-9]+ and [0-9]+ bytes into a region of size between [0-9]+ and [0-9]+ \[-Wformat-truncation=\].*/) {
+ $warning =~ s/'%[0-9]*[\.\*]*[0-9]*[dfsu]'/'-'/g;
+ $warning =~ s/[0-9]+/-/g;
+ }
+
+ # Increment count for [generic] warning
+ $warn_count{$warning}++;
+ $warn_file{$warning}{$name}++;
+ push(@{ $warn_file_line{$warning}{$name} }, $line);
+
+ # Increment count for filename
+ $file_count{$name}++;
+ $file_warn{$name}{$warning}++;
+ push(@{ $file_warn_line{$name}{$warning} }, $line);
+
+ # Increment total count of warnings
+ $totalcount++;
+
+# print "name = $name\n";
+# print "line = $line\n";
+# print "offset = $offset\n";
+# print "warning = \"$warning\"\n";
+}
+
+print "Total [non-ignored] warnings: $totalcount\n";
+print "Total ignored warnings: $ignorecount\n";
+$warncount = keys %warn_count;
+print "Total unique kinds of warnings: $warncount\n";
+$filecount = keys %file_count;
+print "Total files with warnings: $filecount\n\n";
+
+# Print warnings in decreasing frequency
+print "# of Warnings by frequency (file count)\n";
+print "=======================================\n";
+for my $x (sort {$warn_count{$b} <=> $warn_count{$a}} keys(%warn_count)) {
+ printf ("[%2d] %4d (%2d) - %s\n", $current_warning++, $warn_count{$x}, scalar(keys %{$warn_file_line{$x}}), $x);
+ if((exists $options{W}) || (exists $options{w})) {
+ my $curr_index = $current_warning - 1;
+
+ if((exists $warn_file_indices{$curr_index}) && $curr_index == $warn_file_indices{$curr_index}) {
+ for my $y (sort {$warn_file{$x}{$b} <=> $warn_file{$x}{$a}} keys(%{$warn_file{$x}})) {
+ printf ("\t%4d - %s\n", $warn_file{$x}{$y}, $y);
+ if(exists $options{l}) {
+ printf ("\t\tLines: ");
+ for my $z ( @{ $warn_file_line{$x}{$y} } ) {
+ printf ("%s, ", $z);
+ }
+ printf("\n");
+ }
+ }
+ }
+ }
+}
+
+# Print warnings in decreasing frequency, by filename
+print "\n# of Warnings by filename (warning type)\n";
+print "========================================\n";
+for my $x (sort {$file_count{$b} <=> $file_count{$a}} keys(%file_count)) {
+ printf ("[%3d] %4d (%2d) - %s\n", $current_file++, $file_count{$x}, scalar(keys %{$file_warn_line{$x}}), $x);
+ if((exists $options{F}) || (exists $options{f})) {
+ my $curr_index = $current_file - 1;
+
+ if((exists $file_warn_indices{$curr_index}) && $curr_index == $file_warn_indices{$curr_index}) {
+ for my $y (sort {$file_warn{$x}{$b} <=> $file_warn{$x}{$a}} keys(%{$file_warn{$x}})) {
+ printf ("\t%4d - %s\n", $file_warn{$x}{$y}, $y);
+ if(exists $options{l}) {
+ printf ("\t\tLines: ");
+ for my $z ( @{ $file_warn_line{$x}{$y} } ) {
+ printf ("%s, ", $z);
+ }
+ printf("\n");
+ }
+ }
+ }
+ }
+}
+
+# Print names of files that were ignored
+print "\nIgnored filenames\n";
+print "=================\n";
+for my $x (sort keys(%ignored_files)) {
+ print "$x\n";
+}
+
diff --git a/c++/Makefile.am b/c++/Makefile.am
index 94fbefc..319ce6e 100644
--- a/c++/Makefile.am
+++ b/c++/Makefile.am
@@ -18,9 +18,21 @@
include $(top_srcdir)/config/commence.am
+if BUILD_TESTS_CONDITIONAL
+ TEST_DIR = test
+else
+ TEST_DIR=
+endif
+
## Only recurse into subdirectories if C++ interface is enabled.
if BUILD_CXX_CONDITIONAL
- SUBDIRS=src test
+ SUBDIRS=src $(TEST_DIR)
+
+# Test with just the native connector, with a single pass-through connector
+# and with a doubly-stacked pass-through.
+VOL_LIST = native "pass_through under_vol=0;under_info={}" \
+ "pass_through under_vol=505;under_info={under_vol=0;under_info={}}"
+
endif
DIST_SUBDIRS = src test examples
diff --git a/c++/examples/CMakeLists.txt b/c++/examples/CMakeLists.txt
index d3a18f2..2088019 100644
--- a/c++/examples/CMakeLists.txt
+++ b/c++/examples/CMakeLists.txt
@@ -34,17 +34,27 @@ set (tutr_examples
foreach (example ${examples})
add_executable (cpp_ex_${example} ${HDF5_CPP_EXAMPLES_SOURCE_DIR}/${example}.cpp)
- target_include_directories(cpp_ex_${example} PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>")
- TARGET_C_PROPERTIES (cpp_ex_${example} STATIC)
- target_link_libraries (cpp_ex_${example} PRIVATE ${HDF5_CPP_LIB_TARGET} ${HDF5_LIB_TARGET})
+ target_include_directories (cpp_ex_${example} PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>")
+ if (NOT BUILD_SHARED_LIBS)
+ TARGET_C_PROPERTIES (cpp_ex_${example} STATIC)
+ target_link_libraries (cpp_ex_${example} PRIVATE ${HDF5_CPP_LIB_TARGET} ${HDF5_LIB_TARGET})
+ else ()
+ TARGET_C_PROPERTIES (cpp_ex_${example} SHARED)
+ target_link_libraries (cpp_ex_${example} PRIVATE ${HDF5_CPP_LIBSH_TARGET} ${HDF5_LIBSH_TARGET})
+ endif ()
set_target_properties (cpp_ex_${example} PROPERTIES FOLDER examples/cpp)
endforeach ()
foreach (example ${tutr_examples})
add_executable (cpp_ex_${example} ${HDF5_CPP_EXAMPLES_SOURCE_DIR}/${example}.cpp)
- target_include_directories(cpp_ex_${example} PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>")
- TARGET_C_PROPERTIES (cpp_ex_${example} STATIC)
- target_link_libraries (cpp_ex_${example} PRIVATE ${HDF5_CPP_LIB_TARGET} ${HDF5_LIB_TARGET})
+ target_include_directories (cpp_ex_${example} PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>")
+ if (NOT BUILD_SHARED_LIBS)
+ TARGET_C_PROPERTIES (cpp_ex_${example} STATIC)
+ target_link_libraries (cpp_ex_${example} PRIVATE ${HDF5_CPP_LIB_TARGET} ${HDF5_LIB_TARGET})
+ else ()
+ TARGET_C_PROPERTIES (cpp_ex_${example} SHARED)
+ target_link_libraries (cpp_ex_${example} PRIVATE ${HDF5_CPP_LIBSH_TARGET} ${HDF5_LIBSH_TARGET})
+ endif ()
set_target_properties (cpp_ex_${example} PROPERTIES FOLDER examples/cpp)
endforeach ()
diff --git a/c++/examples/CMakeTests.cmake b/c++/examples/CMakeTests.cmake
index bd1f95b..58bdb68 100644
--- a/c++/examples/CMakeTests.cmake
+++ b/c++/examples/CMakeTests.cmake
@@ -26,7 +26,7 @@
SDSextendible.h5
Select.h5
)
- if (NOT "${last_test}" STREQUAL "")
+ if (last_test)
set_tests_properties (CPP_ex-clear-objects PROPERTIES DEPENDS ${last_test})
endif ()
set (last_test "CPP_ex-clear-objects")
@@ -46,7 +46,7 @@
-P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake"
)
endif ()
- if (NOT "${last_test}" STREQUAL "")
+ if (last_test)
set_tests_properties (CPP_ex_${example} PROPERTIES DEPENDS ${last_test})
endif ()
set (last_test "CPP_ex_${example}")
@@ -66,7 +66,7 @@
h5tutr_groups.h5
h5tutr_subset.h5
)
- if (NOT "${last_test}" STREQUAL "")
+ if (last_test)
set_tests_properties (CPP_ex_tutr-clear-objects PROPERTIES DEPENDS ${last_test})
endif ()
set (last_test "CPP_ex_tutr-clear-objects")
@@ -86,7 +86,7 @@
-P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake"
)
endif ()
- if (NOT "${last_test}" STREQUAL "")
+ if (last_test)
set_tests_properties (CPP_ex_${example} PROPERTIES DEPENDS ${last_test})
endif ()
set (last_test "CPP_ex_${example}")
diff --git a/c++/src/C2Cppfunction_map.htm b/c++/src/C2Cppfunction_map.htm
index b53ea15..2d779a3 100644
--- a/c++/src/C2Cppfunction_map.htm
+++ b/c++/src/C2Cppfunction_map.htm
@@ -7666,6 +7666,42 @@ normal'><span style='font-size:14.0pt;mso-bidi-font-size:11.0pt;line-height:
normal'><o:p>&nbsp;</o:p></p>
</td>
</tr>
+ <tr style='mso-yfti-irow:180'>
+ <td width=263 style='width:197.2pt;border:solid windowtext 1.0pt;border-top:
+ none;mso-border-top-alt:solid windowtext .5pt;mso-border-alt:solid windowtext .5pt;
+ padding:0in 5.4pt 0in 5.4pt'>
+ <p class=MsoNormal style='margin-bottom:0in;margin-bottom:.0001pt;line-height:
+ normal'>H5Fget_fileno</p>
+ </td>
+ <td width=474 valign=top style='width:355.2pt;border-top:none;border-left:
+ none;border-bottom:solid windowtext 1.0pt;border-right:solid windowtext 1.0pt;
+ mso-border-top-alt:solid windowtext .5pt;mso-border-left-alt:solid windowtext .5pt;
+ mso-border-alt:solid windowtext .5pt;padding:0in 5.4pt 0in 5.4pt'>
+ <p class=MsoNormal style='margin-bottom:0in;margin-bottom:.0001pt;line-height:
+ normal'>unsigned long H5File::getFileNum()</p>
+ </td>
+ <td width=35 valign=top style='width:26.05pt;border-top:none;border-left:
+ none;border-bottom:solid windowtext 1.0pt;border-right:solid windowtext 1.0pt;
+ mso-border-top-alt:solid windowtext .5pt;mso-border-left-alt:solid windowtext .5pt;
+ mso-border-alt:solid windowtext .5pt;padding:0in 5.4pt 0in 5.4pt'>
+ <p class=MsoNormal align=center style='margin-bottom:0in;margin-bottom:.0001pt;
+ text-align:center;line-height:normal'><o:p>&nbsp;</o:p></p>
+ </td>
+ <td width=42 valign=top style='width:31.45pt;border-top:none;border-left:
+ none;border-bottom:solid windowtext 1.0pt;border-right:solid windowtext 1.0pt;
+ mso-border-top-alt:solid windowtext .5pt;mso-border-left-alt:solid windowtext .5pt;
+ mso-border-alt:solid windowtext .5pt;padding:0in 5.4pt 0in 5.4pt'>
+ <p class=MsoNormal align=center style='margin-bottom:0in;margin-bottom:.0001pt;
+ text-align:center;line-height:normal'><o:p>&nbsp;</o:p></p>
+ </td>
+ <td width=169 valign=top style='width:126.65pt;border-top:none;border-left:
+ none;border-bottom:solid windowtext 1.0pt;border-right:solid windowtext 1.0pt;
+ mso-border-top-alt:solid windowtext .5pt;mso-border-left-alt:solid windowtext .5pt;
+ mso-border-alt:solid windowtext .5pt;padding:0in 5.4pt 0in 5.4pt'>
+ <p class=MsoNormal style='margin-bottom:0in;margin-bottom:.0001pt;line-height:
+ normal'><o:p>&nbsp;</o:p></p>
+ </td>
+ </tr>
<tr style='mso-yfti-irow:181'>
<td width=263 style='width:197.2pt;border:solid windowtext 1.0pt;border-top:
none;mso-border-top-alt:solid windowtext .5pt;mso-border-alt:solid windowtext .5pt;
diff --git a/c++/src/CMakeLists.txt b/c++/src/CMakeLists.txt
index 945b352..8e7f8be 100644
--- a/c++/src/CMakeLists.txt
+++ b/c++/src/CMakeLists.txt
@@ -84,24 +84,26 @@ set (CPP_HDRS
${HDF5_CPP_SRC_SOURCE_DIR}/H5VarLenType.h
)
-add_library (${HDF5_CPP_LIB_TARGET} STATIC ${CPP_SOURCES} ${CPP_HDRS})
-target_include_directories(${HDF5_CPP_LIB_TARGET}
- PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>"
- INTERFACE "$<INSTALL_INTERFACE:$<INSTALL_PREFIX>/include>"
-)
-target_compile_definitions(${HDF5_CPP_LIB_TARGET}
- PRIVATE $<$<BOOL:${HDF5_ENABLE_PARALLEL}>:MPICH_SKIP_MPICXX;MPICH_IGNORE_CXX_SEEK># Parallel/MPI, prevent spurious cpp/cxx warnings
-)
-TARGET_C_PROPERTIES (${HDF5_CPP_LIB_TARGET} STATIC)
-target_link_libraries (${HDF5_CPP_LIB_TARGET} PUBLIC ${HDF5_LIB_TARGET})
-set_global_variable (HDF5_LIBRARIES_TO_EXPORT "${HDF5_LIBRARIES_TO_EXPORT};${HDF5_CPP_LIB_TARGET}")
-H5_SET_LIB_OPTIONS (${HDF5_CPP_LIB_TARGET} ${HDF5_CPP_LIB_NAME} STATIC 0)
-set_target_properties (${HDF5_CPP_LIB_TARGET} PROPERTIES FOLDER libraries/cpp)
-set (install_targets ${HDF5_CPP_LIB_TARGET})
+if (NOT ONLY_SHARED_LIBS)
+ add_library (${HDF5_CPP_LIB_TARGET} STATIC ${CPP_SOURCES} ${CPP_HDRS})
+ target_include_directories (${HDF5_CPP_LIB_TARGET}
+ PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>"
+ INTERFACE "$<INSTALL_INTERFACE:$<INSTALL_PREFIX>/include>"
+ )
+ target_compile_definitions(${HDF5_CPP_LIB_TARGET}
+ PRIVATE $<$<BOOL:${HDF5_ENABLE_PARALLEL}>:MPICH_SKIP_MPICXX;MPICH_IGNORE_CXX_SEEK># Parallel/MPI, prevent spurious cpp/cxx warnings
+ )
+ TARGET_C_PROPERTIES (${HDF5_CPP_LIB_TARGET} STATIC)
+ target_link_libraries (${HDF5_CPP_LIB_TARGET} PUBLIC ${HDF5_LIB_TARGET})
+ set_global_variable (HDF5_LIBRARIES_TO_EXPORT "${HDF5_LIBRARIES_TO_EXPORT};${HDF5_CPP_LIB_TARGET}")
+ H5_SET_LIB_OPTIONS (${HDF5_CPP_LIB_TARGET} ${HDF5_CPP_LIB_NAME} STATIC 0)
+ set_target_properties (${HDF5_CPP_LIB_TARGET} PROPERTIES FOLDER libraries/cpp)
+ set (install_targets ${HDF5_CPP_LIB_TARGET})
+endif ()
if (BUILD_SHARED_LIBS)
add_library (${HDF5_CPP_LIBSH_TARGET} SHARED ${CPP_SOURCES} ${CPP_HDRS})
- target_include_directories(${HDF5_CPP_LIBSH_TARGET}
+ target_include_directories (${HDF5_CPP_LIBSH_TARGET}
PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>"
INTERFACE "$<INSTALL_INTERFACE:$<INSTALL_PREFIX>/include>"
)
@@ -136,7 +138,9 @@ if (HDF5_EXPORTED_TARGETS)
if (BUILD_SHARED_LIBS)
INSTALL_TARGET_PDB (${HDF5_CPP_LIBSH_TARGET} ${HDF5_INSTALL_BIN_DIR} cpplibraries)
endif ()
- INSTALL_TARGET_PDB (${HDF5_CPP_LIB_TARGET} ${HDF5_INSTALL_BIN_DIR} cpplibraries)
+ if (NOT ONLY_SHARED_LIBS)
+ INSTALL_TARGET_PDB (${HDF5_CPP_LIB_TARGET} ${HDF5_INSTALL_BIN_DIR} cpplibraries)
+ endif ()
install (
TARGETS
@@ -163,7 +167,9 @@ set (_PKG_CONFIG_VERSION "${HDF5_PACKAGE_VERSION}")
set (_PKG_CONFIG_LIBS_PRIVATE)
-set (_PKG_CONFIG_LIBS "${_PKG_CONFIG_LIBS} -l${HDF5_CPP_LIB_CORENAME}")
+if (NOT ONLY_SHARED_LIBS)
+ set (_PKG_CONFIG_LIBS "${_PKG_CONFIG_LIBS} -l${HDF5_CPP_LIB_CORENAME}")
+endif ()
if (BUILD_SHARED_LIBS)
set (_PKG_CONFIG_SH_LIBS "${_PKG_CONFIG_SH_LIBS} -l${HDF5_CPP_LIB_CORENAME}")
endif ()
diff --git a/c++/src/H5File.cpp b/c++/src/H5File.cpp
index 719c1ba..b9ecded 100644
--- a/c++/src/H5File.cpp
+++ b/c++/src/H5File.cpp
@@ -580,6 +580,27 @@ hsize_t H5File::getFileSize() const
}
//--------------------------------------------------------------------------
+// Function: H5File::getFileNum
+///\brief Returns the file number of the HDF5 file.
+///\return File number
+///\exception H5::FileIException
+///\par Description
+/// This function is called after an existing file is opened in
+/// order to retrieve the unique 'file number' for the file.
+// Programmer Quincey Koziol - April 13, 2019
+//--------------------------------------------------------------------------
+unsigned long H5File::getFileNum() const
+{
+ unsigned long fileno = 0;
+ herr_t ret_value = H5Fget_fileno(id, &fileno);
+ if (ret_value < 0)
+ {
+ throw FileIException("H5File::getFileNum", "H5Fget_fileno failed");
+ }
+ return (fileno);
+}
+
+//--------------------------------------------------------------------------
// Function: H5File::getId
///\brief Get the id of this file
///\return File identifier
diff --git a/c++/src/H5File.h b/c++/src/H5File.h
index 332685e..1b1227f 100644
--- a/c++/src/H5File.h
+++ b/c++/src/H5File.h
@@ -69,6 +69,9 @@ class H5_DLLCPP H5File : public Group {
// Returns the file size of the HDF5 file.
hsize_t getFileSize() const;
+ // Returns the 'file number' of the HDF5 file.
+ unsigned long getFileNum() const;
+
// Determines if a file, specified by its name, is in HDF5 format
static bool isHdf5(const char* name);
static bool isHdf5(const H5std_string& name);
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.cpp b/c++/src/H5LcreatProp.cpp
index 695c1fe..bde9339 100644
--- a/c++/src/H5LcreatProp.cpp
+++ b/c++/src/H5LcreatProp.cpp
@@ -103,6 +103,46 @@ LinkCreatPropList::LinkCreatPropList(const LinkCreatPropList& original) : PropLi
LinkCreatPropList::LinkCreatPropList(const hid_t plist_id) : PropList(plist_id) {}
//--------------------------------------------------------------------------
+// Function: LinkCreatPropList::setCreateIntermediateGroup
+///\brief Specifies in property list whether to create missing
+/// intermediate groups.
+///\param crt_intmd_group - IN: Flag specifying whether to create
+/// intermediate groups upon the creation of an object
+///\exception H5::PropListIException
+// April, 2019
+//--------------------------------------------------------------------------
+void LinkCreatPropList::setCreateIntermediateGroup(bool crt_intmd_group) const
+{
+ herr_t ret_value = H5Pset_create_intermediate_group(id, (unsigned)crt_intmd_group);
+ // Throw exception if H5Pset_create_intermediate_group returns failure
+ if (ret_value < 0)
+ {
+ throw PropListIException("setCreateIntermediateGroup", "H5Pset_create_intermediate_group failed");
+ }
+}
+
+//--------------------------------------------------------------------------
+// Function: LinkCreatPropList::getCreateIntermediateGroup
+///\brief Determines whether property is set to enable creating missing
+/// intermediate groups.
+///\return true if creating intermediate groups is enabled, and false, otherwise
+///\exception H5::PropListIException
+// April, 2019
+//--------------------------------------------------------------------------
+bool LinkCreatPropList::getCreateIntermediateGroup() const
+{
+ unsigned crt_intmd_group;
+ herr_t ret_value = H5Pget_create_intermediate_group(id, &crt_intmd_group);
+ // Throw exception if H5Pget_create_intermediate_group returns failure
+ if (ret_value < 0)
+ {
+ throw PropListIException("getCreateIntermediateGroup", "H5Pget_create_intermediate_group failed");
+ }
+
+ return((bool)crt_intmd_group);
+}
+
+//--------------------------------------------------------------------------
// Function: LinkCreatPropList::setCharEncoding
///\brief Sets the character encoding of the string.
///
diff --git a/c++/src/H5LcreatProp.h b/c++/src/H5LcreatProp.h
index 12cb479..908ef63 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,10 +36,18 @@ 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);
+ // Specifies in property list whether to create missing
+ // intermediate groups
+ void setCreateIntermediateGroup(bool crt_intmd_group) const;
+
+ // Determines whether property is set to enable creating missing
+ // intermediate groups
+ bool getCreateIntermediateGroup() const;
+
// Sets the character encoding of the string.
void setCharEncoding(H5T_cset_t encoding) const;
diff --git a/c++/src/H5Location.cpp b/c++/src/H5Location.cpp
index 2c49016..2641960 100644
--- a/c++/src/H5Location.cpp
+++ b/c++/src/H5Location.cpp
@@ -1066,7 +1066,7 @@ void H5Location::link(const char *curr_name, const Group& new_loc,
hid_t lcpl_id = lcpl.getId();
hid_t lapl_id = lapl.getId();
- ret_value = H5Lcreate_hard(getId(), curr_name, new_loc.getId(), new_name, H5P_DEFAULT, H5P_DEFAULT);
+ ret_value = H5Lcreate_hard(getId(), curr_name, new_loc_id, new_name, lcpl_id, lapl_id);
if (ret_value < 0)
throwException("link", "creating link failed");
}
@@ -1102,14 +1102,13 @@ void H5Location::link(const H5std_string& curr_name, const Group& new_loc,
/// H5Lcreate_hard APIs in the HDF5 C Reference Manual.
// March 2018
//--------------------------------------------------------------------------
-void H5Location::link(const char *curr_name, const hid_t same_loc,
- const char *new_name, const LinkCreatPropList& lcpl, const LinkAccPropList& lapl) const
+void H5Location::link(const char *curr_name, const hid_t same_loc, const char *new_name, const LinkCreatPropList& lcpl, const LinkAccPropList& lapl) const
{
herr_t ret_value = -1;
hid_t lcpl_id = lcpl.getId();
hid_t lapl_id = lapl.getId();
- ret_value = H5Lcreate_hard(getId(), curr_name, same_loc, new_name, H5P_DEFAULT, H5P_DEFAULT);
+ ret_value = H5Lcreate_hard(getId(), curr_name, same_loc, new_name, lcpl_id, lapl_id);
if (ret_value < 0)
throwException("link", "creating link failed");
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/cpp_doc_config b/c++/src/cpp_doc_config
index 697fb77..14ca90c 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.11.4"
+PROJECT_NUMBER = "1.11.6"
# 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/CMakeLists.txt b/c++/test/CMakeLists.txt
index 8e2d685..95ca9b1 100644
--- a/c++/test/CMakeLists.txt
+++ b/c++/test/CMakeLists.txt
@@ -38,16 +38,17 @@ set (srcdir ${CMAKE_CURRENT_SOURCE_DIR})
configure_file (${HDF5_CPP_TEST_SOURCE_DIR}/H5srcdir_str.h.in H5srcdir_str.h @ONLY)
add_executable (cpp_testhdf5 ${CPP_TEST_SOURCES} )
-target_include_directories(cpp_testhdf5 PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};${HDF5_TEST_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>")
+target_include_directories (cpp_testhdf5 PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};${HDF5_TEST_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>")
target_compile_definitions(cpp_testhdf5
PRIVATE $<$<BOOL:${HDF5_ENABLE_PARALLEL}>:MPICH_SKIP_MPICXX;MPICH_IGNORE_CXX_SEEK># Parallel/MPI, prevent spurious cpp/cxx warnings
)
-TARGET_C_PROPERTIES (cpp_testhdf5 STATIC)
-target_link_libraries (cpp_testhdf5 PRIVATE
- ${HDF5_CPP_LIB_TARGET}
- ${HDF5_LIB_TARGET}
- ${HDF5_TEST_LIB_TARGET}
-)
+if (NOT BUILD_SHARED_LIBS)
+ TARGET_C_PROPERTIES (cpp_testhdf5 STATIC)
+ target_link_libraries (cpp_testhdf5 PRIVATE ${HDF5_CPP_LIB_TARGET} ${HDF5_LIB_TARGET} ${HDF5_TEST_LIB_TARGET})
+else ()
+ TARGET_C_PROPERTIES (cpp_testhdf5 SHARED)
+ target_link_libraries (cpp_testhdf5 PRIVATE ${HDF5_CPP_LIBSH_TARGET} ${HDF5_LIBSH_TARGET} ${HDF5_TEST_LIBSH_TARGET})
+endif ()
set_target_properties (cpp_testhdf5 PROPERTIES FOLDER test/cpp)
include (CMakeTests.cmake)
diff --git a/c++/test/tarray.cpp b/c++/test/tarray.cpp
index 6bd4ca6..fccc556 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;
}
@@ -371,7 +371,6 @@ static void test_array_info()
s1_t rdata[SPACE1_DIM1][ARRAY1_DIM1]; // Information read in
hsize_t sdims1[] = {SPACE1_DIM1};
hsize_t tdims1[] = {ARRAY1_DIM1};
- int nmemb; // Number of compound members
int ii; // counting variables
hsize_t idxi, idxj, idxk; // dimension indicing variables
H5T_class_t mclass; // Datatype class for field
diff --git a/c++/test/tfile.cpp b/c++/test/tfile.cpp
index a2bf1c2..055cf23 100644
--- a/c++/test/tfile.cpp
+++ b/c++/test/tfile.cpp
@@ -412,6 +412,64 @@ static void test_file_size()
/*-------------------------------------------------------------------------
+ * Function: test_file_num
+ *
+ * Purpose Test file number.
+ *
+ * Return None
+ *
+ * Programmer Quincey Koziol
+ * April, 2019
+ *-------------------------------------------------------------------------
+ */
+static void test_file_num()
+{
+ // Output message about test being performed
+ SUBTEST("File Number");
+
+ hid_t fapl_id;
+ fapl_id = h5_fileaccess(); // in h5test.c, returns a file access template
+
+ try {
+ // Use the file access template id to create a file access prop.
+ // list object to pass in H5File::H5File
+ FileAccPropList fapl(fapl_id);
+
+ // Create two files
+ H5File file1(FILE1, H5F_ACC_TRUNC, FileCreatPropList::DEFAULT, fapl);
+ H5File file2(FILE2, H5F_ACC_TRUNC, FileCreatPropList::DEFAULT, fapl);
+
+ // Open the first file again
+ H5File file3(FILE1, H5F_ACC_RDWR);
+
+ // Get file numbers
+ unsigned long file_num1 = file1.getFileNum();
+ unsigned long file_num2 = file2.getFileNum();
+ unsigned long file_num3 = file3.getFileNum();
+
+ // Check file numbers
+ if (file_num1 == file_num2)
+ issue_fail_msg("test_file_num()", __LINE__, __FILE__, "getFileNum() returned wrong value");
+ if (file_num1 != file_num3)
+ issue_fail_msg("test_file_num()", __LINE__, __FILE__, "getFileNum() returned wrong value");
+
+ PASSED();
+ } // end of try block
+
+ catch (Exception& E)
+ {
+ issue_fail_msg("test_file_num()", __LINE__, __FILE__, E.getCDetailMsg());
+ }
+
+ // use C test utility routine to close property list.
+ herr_t ret = H5Pclose(fapl_id);
+ if (ret < 0)
+ issue_fail_msg("test_file_num()", __LINE__, __FILE__, "H5Pclose failed");
+
+} // test_file_num()
+
+
+/*-------------------------------------------------------------------------
* Function: test_file_name
*
* Purpose Test getting file's name.
@@ -966,6 +1024,7 @@ void test_file()
test_file_create(); // Test file creation (also creation templates)
test_file_open(); // Test file opening
test_file_size(); // Test file size
+ test_file_num(); // Test file number
test_file_name(); // Test getting file's name
test_file_attribute(); // Test file attribute feature
test_libver_bounds(); // Test format version
diff --git a/c++/test/tlinks.cpp b/c++/test/tlinks.cpp
index 6e990c9..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
*
@@ -858,7 +731,8 @@ void test_links()
hid_t fapl_id, fapl2_id; /* File access property lists */
unsigned new_format; /* Whether to use the new format or not */
- 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"));
@@ -891,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());
}
-
}
@@ -926,7 +794,3 @@ void cleanup_links()
HDremove(FILENAME[0]);
HDremove(FILENAME[1]);
}
-
-
-
-
diff --git a/c++/test/tobject.cpp b/c++/test/tobject.cpp
index 537716f..232ece2 100644
--- a/c++/test/tobject.cpp
+++ b/c++/test/tobject.cpp
@@ -609,10 +609,121 @@ static void test_getobjectinfo_same_file()
catch (Exception& E)
{
cerr << " in Exception " << E.getCFuncName() << "detail: " << E.getCDetailMsg() << endl;
- issue_fail_msg("test_file_name()", __LINE__, __FILE__, E.getCDetailMsg());
+ issue_fail_msg("test_getobjectinfo_same_file()", __LINE__, __FILE__, E.getCDetailMsg());
+ }
+
+} // test_getobjectinfo_same_file
+
+/*-------------------------------------------------------------------------
+ * Function: test_intermediate_groups
+ *
+ * Purpose Test that intermediate groups are created as specified by
+ * the property setting.
+ *
+ * Return None
+ *
+ * April, 2019
+ *-------------------------------------------------------------------------
+ */
+const H5std_string FILE_INTERGRPS("tobject_intergrps.h5");
+const H5std_string GROUP10NAME("/group10");
+const H5std_string GROUP11NAME("/group10/group11");
+const H5std_string GROUP12NAME("/group10/group11/group12");
+const H5std_string GROUP13NAME("/group10/group11/group12/group13");
+const H5std_string GROUP14NAME("/group10/group11/group12/group13/group14");
+const H5std_string GROUP14FROM13NAME("group14");
+const H5std_string GROUP20NAME("/group20");
+const H5std_string GROUP21NAME("/group20/group21");
+const H5std_string GROUP22NAME("group21/group22");
+const H5std_string GROUP22FULLNAME("/group20/group21/group22");
+static void test_intermediate_groups()
+{
+ // Output message about test being performed
+ SUBTEST("Group::set/getCreateIntermediateGroup");
+
+ try {
+ // Create a new HDF5 file
+ H5File file(FILE_INTERGRPS, H5F_ACC_TRUNC);
+
+ // Create a link create property list and set the "create
+ // intermediate groups" flag
+ LinkCreatPropList lcpl;
+ lcpl.setCreateIntermediateGroup(true);
+
+ // Verify value of create missing groups flag
+ bool crt_int_grps = lcpl.getCreateIntermediateGroup();
+ verify_val(crt_int_grps, true, "LinkCreatPropList::getCreateIntermediateGroup", __LINE__, __FILE__);
+
+ // Create GROUP12NAME with creating missing groups
+ Group grp12(file.createGroup(GROUP12NAME, lcpl));
+
+ // Missing groups: GROUP10NAME and GROUP11NAME
+
+ // Create GROUP14NAME without the use of link create plist, should
+ // fail because group GROUP13NAME is missing
+ try {
+ Group grp14_nopl(file.createGroup(GROUP14NAME));
+ } catch (FileIException& expected1) {} // Failure is ignored
+
+ // Create GROUP14NAME with the flag to create missing groups set
+ // to FALSE, should fail because group GROUP13NAME is missing
+
+ // Reset flag to not create missing groups
+ lcpl.setCreateIntermediateGroup(false);
+
+ // Verify value of create missing groups flag
+ crt_int_grps = lcpl.getCreateIntermediateGroup();
+ verify_val(crt_int_grps, false, "LinkCreatPropList::getCreateIntermediateGroup", __LINE__, __FILE__);
+
+ try {
+ Group grp14_false(file.createGroup(GROUP14NAME, lcpl));
+ } catch (FileIException& expected2) {} // Failure is ignored
+
+ // Set the flag to create missing groups set to TRUE
+ lcpl.setCreateIntermediateGroup(true);
+ crt_int_grps = lcpl.getCreateIntermediateGroup();
+ verify_val(crt_int_grps, true, "LinkCreatPropList::getCreateIntermediateGroup", __LINE__, __FILE__);
+
+
+ // Create GROUP14NAME with the use of link create plist
+ Group grp14(file.createGroup(GROUP14NAME, lcpl));
+
+ // Missing groups: GROUP13NAME
+
+ // Create group GROUP20NAME
+ Group grp20(file.createGroup(GROUP20NAME));
+
+ // Create group GROUP22NAME with missing group GROUP21NAME
+ Group grp22(grp20.createGroup(GROUP22NAME, lcpl));
+
+ // Close groups and file
+ grp12.close();
+ grp14.close();
+ grp20.close();
+ grp22.close();
+ file.close();
+
+ // Reopen the file
+ file.openFile(FILE_INTERGRPS, H5F_ACC_RDWR);
+
+ // Open the missing groups and various combinations
+ Group grp10(file.openGroup(GROUP10NAME));
+ Group grp11(file.openGroup(GROUP11NAME));
+ Group grp13(file.openGroup(GROUP13NAME));
+ Group grp14from13(grp13.openGroup(GROUP14FROM13NAME));
+ Group grp21(file.openGroup(GROUP21NAME));
+ Group grp22fromfile(file.openGroup(GROUP22FULLNAME));
+
+ PASSED();
+ } // end of try block
+ // catch all other exceptions
+ catch (Exception& E)
+ {
+ cerr << " in Exception " << E.getCFuncName() << "detail: " << E.getCDetailMsg() << endl;
+ issue_fail_msg("test_intermediate_groups()", __LINE__, __FILE__, E.getCDetailMsg());
}
-} // test_h5o_getinfo_same_file
+} // test_intermediate_groups
/*-------------------------------------------------------------------------
* Function: test_object
@@ -631,12 +742,13 @@ void test_object()
// Output message about test being performed
MESSAGE(5, ("Testing Object Functions\n"));
- test_get_objname(); // Test get object name from groups/datasets
- test_existance(); // Test check for object existance
- test_get_objname_ontypes(); // Test get object name from types
- test_get_objtype(); // Test get object type
- test_open_object_header(); // Test object header functions (H5O)
- test_getobjectinfo_same_file(); // Test object info in same file
+ test_get_objname(); // Test get object name from groups/datasets
+ test_existance(); // Test check for object existance
+ test_get_objname_ontypes(); // Test get object name from types
+ test_get_objtype(); // Test get object type
+ test_open_object_header(); // Test object header functions (H5O)
+ test_getobjectinfo_same_file(); // Test object info in same file
+ test_intermediate_groups(); // Test intermediate group property
} // test_object
diff --git a/config/cmake/CTestCustom.cmake b/config/cmake/CTestCustom.cmake
index 27eaa56..6db0f6f 100644
--- a/config/cmake/CTestCustom.cmake
+++ b/config/cmake/CTestCustom.cmake
@@ -39,7 +39,6 @@ set (CTEST_CUSTOM_MEMCHECK_IGNORE
H5TEST-flush2 #designed to need flush1
H5TEST-error_test #uses runTest.cmake
H5TEST-err_compat #uses runTest.cmake
- H5TEST-links_env #uses runTest.cmake
H5TEST-testlibinfo #uses grepTest.cmake
#########
H5TEST-clear-objects
@@ -64,11 +63,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
@@ -86,6 +93,7 @@ set (CTEST_CUSTOM_MEMCHECK_IGNORE
H5DUMP_PACKED_BITS-clearall-objects
H5DUMP-XML-clearall-objects
H5DUMP_VDS-clearall-objects
+ H5DUMP-t128bit_float #uses grepTest.cmake
######### tools/h5format_convert #########
H5FC-clearall-objects
######### tools/h5import #########
diff --git a/config/cmake/FindHDFJAVA.cmake.in b/config/cmake/FindHDFJAVA.cmake.in
deleted file mode 100644
index ed2b8c2..0000000
--- a/config/cmake/FindHDFJAVA.cmake.in
+++ /dev/null
@@ -1,79 +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.
-#
-#
-# To be used by projects that make use of CMakeified hdf-java
-#
-
-#
-# Find the HDFJAVA includes and get all installed hdf-java library settings from
-# HDFJAVA-config.cmake file : Requires a CMake compatible hdf-java-@HDFJAVA_PACKAGE_VERSION@ or later
-# for this feature to work. The following vars are set if hdf-java is found.
-#
-# HDFJAVA_FOUND - True if found, otherwise all other vars are undefined
-# HDFJAVA_VERSION_STRING - full version (e.g. @HDFJAVA_PACKAGE_VERSION@)
-# HDFJAVA_VERSION_MAJOR - major part of version (e.g. @HDFJAVA_PACKAGE_VERSION_MAJOR@)
-# HDFJAVA_VERSION_MINOR - minor part (e.g. @HDFJAVA_PACKAGE_VERSION_MINOR@)
-#
-# Target names that are valid (depending on enabled options)
-# will be the following
-#
-#
-# To aid in finding HDFJAVA as part of a subproject set
-# HDFJAVA_ROOT_DIR_HINT to the location where @HDFJAVA_PACKAGE@@HDF_PACKAGE_EXT@-config.cmake lies
-
-INCLUDE (SelectLibraryConfigurations)
-INCLUDE (FindPackageHandleStandardArgs)
-
-# The HINTS option should only be used for values computed from the system.
-set (_HDFJAVA_HINTS
- $ENV{HOME}/.local
- $ENV{HDFJAVA_ROOT}
- $ENV{HDFJAVA_ROOT_DIR_HINT}
-)
-# Hard-coded guesses should still go in PATHS. This ensures that the user
-# environment can always override hard guesses.
-set (_HDFJAVA_PATHS
- $ENV{HOME}/.local
- $ENV{HDFJAVA_ROOT}
- $ENV{HDFJAVA_ROOT_DIR_HINT}
- /usr/lib/@HDFJAVA_PACKAGE@
- /usr/share/@HDFJAVA_PACKAGE@
- /usr/local/@HDFJAVA_PACKAGE@
- /usr/local/@HDFJAVA_PACKAGE@/share
-)
-
-FIND_PATH (HDFJAVA_ROOT_DIR "@HDFJAVA_PACKAGE@@HDF_PACKAGE_EXT@-config.cmake"
- HINTS ${_HDFJAVA_HINTS}
- PATHS ${_HDFJAVA_PATHS}
- PATH_SUFFIXES
- cmake/@HDFJAVA_PACKAGE@
- lib/cmake/@HDFJAVA_PACKAGE@
- share/cmake/@HDFJAVA_PACKAGE@
-)
-
-FIND_PATH (HDFJAVA_LIBRARY "jarhdf5-@HDFJAVA_PACKAGE_VERSION@.jar"
- HINTS ${_HDFJAVA_HINTS}
- PATHS ${_HDFJAVA_PATHS}
- PATH_SUFFIXES
- lib
-)
-
-if (HDFJAVA_ROOT_DIR)
- set (HDFJAVA_FOUND "YES")
- INCLUDE (${HDFJAVA_ROOT_DIR}/@HDFJAVA_PACKAGE@@HDF_PACKAGE_EXT@-config.cmake)
- set (HDFJAVA_LIBRARIES "${HDFJAVA_LIBRARY}")
- set (HDFJAVA_INCLUDE_DIRS
- ${HDFJAVA_LIBRARY}/jarhdf-@HDFJAVA_PACKAGE_VERSION@.jar
- ${HDFJAVA_LIBRARY}/jarhdf5-@HDFJAVA_PACKAGE_VERSION@.jar
- )
-
-endif ()
diff --git a/config/cmake/FindJNI.cmake b/config/cmake/FindJNI.cmake
deleted file mode 100644
index 1e6daf6..0000000
--- a/config/cmake/FindJNI.cmake
+++ /dev/null
@@ -1,347 +0,0 @@
-# Distributed under the OSI-approved BSD 3-Clause License. See https://cmake.org/licensing for details.
-
-#.rst:
-# FindJNI
-# -------
-#
-# Find JNI java libraries.
-#
-# This module finds if Java is installed and determines where the
-# include files and libraries are. It also determines what the name of
-# the library is. The caller may set variable JAVA_HOME to specify a
-# Java installation prefix explicitly.
-#
-# This module sets the following result variables:
-#
-# ::
-#
-# JNI_INCLUDE_DIRS = the include dirs to use
-# JNI_LIBRARIES = the libraries to use
-# JNI_FOUND = TRUE if JNI headers and libraries were found.
-# JAVA_AWT_LIBRARY = the path to the jawt library
-# JAVA_JVM_LIBRARY = the path to the jvm library
-# JAVA_INCLUDE_PATH = the include path to jni.h
-# JAVA_INCLUDE_PATH2 = the include path to jni_md.h
-# JAVA_AWT_INCLUDE_PATH = the include path to jawt.h
-
-# Expand {libarch} occurences to java_libarch subdirectory(-ies) and set ${_var}
-macro(java_append_library_directories _var)
- # Determine java arch-specific library subdir
- # Mostly based on openjdk/jdk/make/common/shared/Platform.gmk as of openjdk
- # 1.6.0_18 + icedtea patches. However, it would be much better to base the
- # guess on the first part of the GNU config.guess platform triplet.
- if(CMAKE_SYSTEM_PROCESSOR STREQUAL "x86_64")
- if(CMAKE_LIBRARY_ARCHITECTURE STREQUAL "x86_64-linux-gnux32")
- set(_java_libarch "x32" "amd64" "i386")
- else()
- set(_java_libarch "amd64" "i386")
- endif()
- elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "^i.86$")
- set(_java_libarch "i386")
- elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "^alpha")
- set(_java_libarch "alpha")
- elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "^arm")
- # Subdir is "arm" for both big-endian (arm) and little-endian (armel).
- set(_java_libarch "arm" "aarch32")
- elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "^mips")
- # mips* machines are bi-endian mostly so processor does not tell
- # endianess of the underlying system.
- set(_java_libarch "${CMAKE_SYSTEM_PROCESSOR}" "mips" "mipsel" "mipseb" "mips64" "mips64el" "mipsn32" "mipsn32el")
- elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "^(powerpc|ppc)64le")
- set(_java_libarch "ppc64" "ppc64le")
- elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "^(powerpc|ppc)64")
- set(_java_libarch "ppc64" "ppc")
- elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "^(powerpc|ppc)")
- set(_java_libarch "ppc" "ppc64")
- elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "^sparc")
- # Both flavours can run on the same processor
- set(_java_libarch "${CMAKE_SYSTEM_PROCESSOR}" "sparc" "sparcv9")
- elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "^(parisc|hppa)")
- set(_java_libarch "parisc" "parisc64")
- elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "^s390")
- # s390 binaries can run on s390x machines
- set(_java_libarch "${CMAKE_SYSTEM_PROCESSOR}" "s390" "s390x")
- elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "^sh")
- set(_java_libarch "sh")
- else()
- set(_java_libarch "${CMAKE_SYSTEM_PROCESSOR}")
- endif()
-
- # Append default list architectures if CMAKE_SYSTEM_PROCESSOR was empty or
- # system is non-Linux (where the code above has not been well tested)
- if(NOT _java_libarch OR NOT (CMAKE_SYSTEM_NAME MATCHES "Linux"))
- list(APPEND _java_libarch "i386" "amd64" "ppc")
- endif()
-
- # Sometimes ${CMAKE_SYSTEM_PROCESSOR} is added to the list to prefer
- # current value to a hardcoded list. Remove possible duplicates.
- list(REMOVE_DUPLICATES _java_libarch)
-
- foreach(_path ${ARGN})
- if(_path MATCHES "{libarch}")
- foreach(_libarch ${_java_libarch})
- string(REPLACE "{libarch}" "${_libarch}" _newpath "${_path}")
- if(EXISTS ${_newpath})
- list(APPEND ${_var} "${_newpath}")
- endif()
- endforeach()
- else()
- if(EXISTS ${_path})
- list(APPEND ${_var} "${_path}")
- endif()
- endif()
- endforeach()
-endmacro()
-
-#include(${CMAKE_CURRENT_LIST_DIR}/CMakeFindJavaCommon.cmake)
-INCLUDE (CMakeFindJavaCommon)
-
-# Save CMAKE_FIND_FRAMEWORK
-if(DEFINED CMAKE_FIND_FRAMEWORK)
- set(_JNI_CMAKE_FIND_FRAMEWORK ${CMAKE_FIND_FRAMEWORK})
-else()
- unset(_JNI_CMAKE_FIND_FRAMEWORK)
-endif()
-
-if(_JAVA_HOME_EXPLICIT)
- set(CMAKE_FIND_FRAMEWORK NEVER)
-endif()
-
-set(JAVA_AWT_LIBRARY_DIRECTORIES)
-if(_JAVA_HOME)
- JAVA_APPEND_LIBRARY_DIRECTORIES(JAVA_AWT_LIBRARY_DIRECTORIES
- ${_JAVA_HOME}/jre/lib/{libarch}
- ${_JAVA_HOME}/jre/lib
- ${_JAVA_HOME}/lib/{libarch}
- ${_JAVA_HOME}/lib
- ${_JAVA_HOME}
- )
-endif()
-get_filename_component(java_install_version
- "[HKEY_LOCAL_MACHINE\\SOFTWARE\\JavaSoft\\Java Development Kit;CurrentVersion]" NAME)
-
-list(APPEND JAVA_AWT_LIBRARY_DIRECTORIES
- "[HKEY_LOCAL_MACHINE\\SOFTWARE\\JavaSoft\\Java Development Kit\\1.4;JavaHome]/lib"
- "[HKEY_LOCAL_MACHINE\\SOFTWARE\\JavaSoft\\Java Development Kit\\1.3;JavaHome]/lib"
- "[HKEY_LOCAL_MACHINE\\SOFTWARE\\JavaSoft\\Java Development Kit\\${java_install_version};JavaHome]/lib"
- )
-JAVA_APPEND_LIBRARY_DIRECTORIES(JAVA_AWT_LIBRARY_DIRECTORIES
- /usr/java/lib
- /usr/java/jre/lib
- /usr/lib
- /usr/lib64
- /usr/local/lib
- /usr/local/lib64
- /usr/lib/jvm/java/lib
- /usr/lib64/jvm/java/lib
- /usr/lib/java/jre/lib/{libarch}
- /usr/lib64/java/jre/lib/{libarch}
- /usr/lib/jvm/jre/lib/{libarch}
- /usr/local/lib/java/jre/lib/{libarch}
- /usr/local/share/java/jre/lib/{libarch}
- /usr/lib/j2sdk1.4-sun/jre/lib/{libarch}
- /usr/lib/j2sdk1.5-sun/jre/lib/{libarch}
- /opt/sun-jdk-1.5.0.04/jre/lib/{libarch}
- /usr/lib/jvm/java-6-sun/jre/lib/{libarch}
- /usr/lib/jvm/java-1.5.0-sun/jre/lib/{libarch}
- /usr/lib/jvm/java-6-sun-1.6.0.00/jre/lib/{libarch} # can this one be removed according to #8821 ? Alex
- /usr/lib/jvm/java-6-openjdk/jre/lib/{libarch}
- /usr/lib/jvm/java-1.6.0-openjdk-1.6.0.0/jre/lib/{libarch} # fedora
- # Debian specific paths for default JVM
- /usr/lib/jvm/default-java/jre/lib/{libarch}
- /usr/lib/jvm/default-java/jre/lib
- /usr/lib/jvm/default-java/lib
- # Arch Linux specific paths for default JVM
- /usr/lib/jvm/default/jre/lib/{libarch}
- /usr/lib/jvm/default/lib/{libarch}
- # Ubuntu specific paths for default JVM
- /usr/lib/jvm/java-8-openjdk-{libarch}/jre/lib/{libarch} # Ubuntu 15.10
- /usr/lib/jvm/java-7-openjdk-{libarch}/jre/lib/{libarch} # Ubuntu 15.10
- /usr/lib/jvm/java-6-openjdk-{libarch}/jre/lib/{libarch} # Ubuntu 15.10
- # OpenBSD specific paths for default JVM
- /usr/local/jdk-1.7.0/jre/lib/{libarch}
- /usr/local/jre-1.7.0/lib/{libarch}
- /usr/local/jdk-1.6.0/jre/lib/{libarch}
- /usr/local/jre-1.6.0/lib/{libarch}
- # SuSE specific paths for default JVM
- /usr/lib64/jvm/java/jre/lib/{libarch}
- /usr/lib64/jvm/jre/lib/{libarch}
- )
-
-set(JAVA_JVM_LIBRARY_DIRECTORIES)
-foreach(dir ${JAVA_AWT_LIBRARY_DIRECTORIES})
- list(APPEND JAVA_JVM_LIBRARY_DIRECTORIES
- "${dir}"
- "${dir}/client"
- "${dir}/server"
- # IBM SDK, Java Technology Edition, specific paths
- "${dir}/j9vm"
- "${dir}/default"
- )
-endforeach()
-
-set(JAVA_AWT_INCLUDE_DIRECTORIES)
-if(_JAVA_HOME)
- list(APPEND JAVA_AWT_INCLUDE_DIRECTORIES ${_JAVA_HOME}/include)
-endif()
-list(APPEND JAVA_AWT_INCLUDE_DIRECTORIES
- "[HKEY_LOCAL_MACHINE\\SOFTWARE\\JavaSoft\\Java Development Kit\\1.4;JavaHome]/include"
- "[HKEY_LOCAL_MACHINE\\SOFTWARE\\JavaSoft\\Java Development Kit\\1.3;JavaHome]/include"
- "[HKEY_LOCAL_MACHINE\\SOFTWARE\\JavaSoft\\Java Development Kit\\${java_install_version};JavaHome]/include"
-)
-
-JAVA_APPEND_LIBRARY_DIRECTORIES(JAVA_AWT_INCLUDE_DIRECTORIES
- ${_JAVA_HOME}/include
- /usr/include
- /usr/java/include
- /usr/local/include
- /usr/lib/java/include
- /usr/lib64/java/include
- /usr/local/lib/java/include
- /usr/lib/jvm/java/include
- /usr/lib/jvm/java-6-sun/include
- /usr/lib/jvm/java-1.5.0-sun/include
- /usr/lib/jvm/java-6-sun-1.6.0.00/include # can this one be removed according to #8821 ? Alex
- /usr/lib/jvm/java-6-openjdk/include
- /usr/lib/jvm/java-7-openjdk/include
- /usr/lib64/jvm/java-7-openjdk/include
- /usr/lib64/jvm/java-7-openjdk-amd64/include
- /usr/lib/jvm/java-8-openjdk-{libarch}/include # ubuntu 15.10
- /usr/lib/jvm/java-7-openjdk-{libarch}/include # ubuntu 15.10
- /usr/lib/jvm/java-6-openjdk-{libarch}/include # ubuntu 15.10
- /usr/local/share/java/include
- /usr/lib/j2sdk1.4-sun/include
- /usr/lib/j2sdk1.5-sun/include
- /opt/sun-jdk-1.5.0.04/include
- # Debian specific path for default JVM
- /usr/lib/jvm/default-java/include
- # Arch specific path for default JVM
- /usr/lib/jvm/default/include
- # OpenBSD specific path for default JVM
- /usr/local/jdk-1.7.0/include
- /usr/local/jdk-1.6.0/include
- # SuSE specific paths for default JVM
- /usr/lib64/jvm/java/include
- )
-
-foreach(JAVA_PROG "${JAVA_RUNTIME}" "${JAVA_COMPILE}" "${JAVA_ARCHIVE}")
- get_filename_component(jpath "${JAVA_PROG}" PATH)
- foreach(JAVA_INC_PATH ../include ../java/include ../share/java/include)
- if(EXISTS ${jpath}/${JAVA_INC_PATH})
- list(APPEND JAVA_AWT_INCLUDE_DIRECTORIES "${jpath}/${JAVA_INC_PATH}")
- endif()
- endforeach()
- foreach(JAVA_LIB_PATH
- ../lib ../jre/lib ../jre/lib/i386
- ../java/lib ../java/jre/lib ../java/jre/lib/i386
- ../share/java/lib ../share/java/jre/lib ../share/java/jre/lib/i386)
- if(EXISTS ${jpath}/${JAVA_LIB_PATH})
- list(APPEND JAVA_AWT_LIBRARY_DIRECTORIES "${jpath}/${JAVA_LIB_PATH}")
- endif()
- endforeach()
-endforeach()
-
-if(APPLE)
- if(CMAKE_FIND_FRAMEWORK STREQUAL "ONLY")
- set(_JNI_SEARCHES FRAMEWORK)
- elseif(CMAKE_FIND_FRAMEWORK STREQUAL "NEVER")
- set(_JNI_SEARCHES NORMAL)
- elseif(CMAKE_FIND_FRAMEWORK STREQUAL "LAST")
- set(_JNI_SEARCHES NORMAL FRAMEWORK)
- else()
- set(_JNI_SEARCHES FRAMEWORK NORMAL)
- endif()
- set(_JNI_FRAMEWORK_JVM NAMES JavaVM)
- set(_JNI_FRAMEWORK_JAWT "${_JNI_FRAMEWORK_JVM}")
-else()
- set(_JNI_SEARCHES NORMAL)
-endif()
-
-set(_JNI_NORMAL_JVM
- NAMES jvm
- PATHS ${JAVA_JVM_LIBRARY_DIRECTORIES}
- )
-
-set(_JNI_NORMAL_JAWT
- NAMES jawt
- PATHS ${JAVA_AWT_LIBRARY_DIRECTORIES}
- )
-
-foreach(search ${_JNI_SEARCHES})
- find_library(JAVA_JVM_LIBRARY ${_JNI_${search}_JVM})
- find_library(JAVA_AWT_LIBRARY ${_JNI_${search}_JAWT})
- if(JAVA_JVM_LIBRARY)
- break()
- endif()
-endforeach()
-unset(_JNI_SEARCHES)
-unset(_JNI_FRAMEWORK_JVM)
-unset(_JNI_FRAMEWORK_JAWT)
-unset(_JNI_NORMAL_JVM)
-unset(_JNI_NORMAL_JAWT)
-
-# Find headers matching the library.
-if("${JAVA_JVM_LIBRARY};${JAVA_AWT_LIBRARY};" MATCHES "(/JavaVM.framework|-framework JavaVM);")
- set(CMAKE_FIND_FRAMEWORK ONLY)
-else()
- set(CMAKE_FIND_FRAMEWORK NEVER)
-endif()
-
-# add in the include path
-find_path(JAVA_INCLUDE_PATH jni.h
- ${JAVA_AWT_INCLUDE_DIRECTORIES}
-)
-
-find_path(JAVA_INCLUDE_PATH2 NAMES jni_md.h jniport.h
- PATHS
- ${JAVA_INCLUDE_PATH}
- ${JAVA_INCLUDE_PATH}/darwin
- ${JAVA_INCLUDE_PATH}/win32
- ${JAVA_INCLUDE_PATH}/linux
- ${JAVA_INCLUDE_PATH}/freebsd
- ${JAVA_INCLUDE_PATH}/openbsd
- ${JAVA_INCLUDE_PATH}/solaris
- ${JAVA_INCLUDE_PATH}/hp-ux
- ${JAVA_INCLUDE_PATH}/alpha
- ${JAVA_INCLUDE_PATH}/aix
-)
-
-find_path(JAVA_AWT_INCLUDE_PATH jawt.h
- ${JAVA_INCLUDE_PATH}
-)
-
-# Restore CMAKE_FIND_FRAMEWORK
-if(DEFINED _JNI_CMAKE_FIND_FRAMEWORK)
- set(CMAKE_FIND_FRAMEWORK ${_JNI_CMAKE_FIND_FRAMEWORK})
- unset(_JNI_CMAKE_FIND_FRAMEWORK)
-else()
- unset(CMAKE_FIND_FRAMEWORK)
-endif()
-
-#include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
-INCLUDE (FindPackageHandleStandardArgs)
-FIND_PACKAGE_HANDLE_STANDARD_ARGS(JNI DEFAULT_MSG JAVA_AWT_LIBRARY
- JAVA_JVM_LIBRARY
- JAVA_INCLUDE_PATH
- JAVA_INCLUDE_PATH2
- JAVA_AWT_INCLUDE_PATH)
-
-mark_as_advanced(
- JAVA_AWT_LIBRARY
- JAVA_JVM_LIBRARY
- JAVA_AWT_INCLUDE_PATH
- JAVA_INCLUDE_PATH
- JAVA_INCLUDE_PATH2
-)
-
-set(JNI_LIBRARIES
- ${JAVA_AWT_LIBRARY}
- ${JAVA_JVM_LIBRARY}
-)
-
-set(JNI_INCLUDE_DIRS
- ${JAVA_INCLUDE_PATH}
- ${JAVA_INCLUDE_PATH2}
- ${JAVA_AWT_INCLUDE_PATH}
-)
-
diff --git a/config/cmake/H5pubconf.h.in b/config/cmake/H5pubconf.h.in
index 273adb5..9e7b8b7 100644
--- a/config/cmake/H5pubconf.h.in
+++ b/config/cmake/H5pubconf.h.in
@@ -390,8 +390,13 @@
/* Define to 1 if you have the <szlib.h> header file. */
#cmakedefine H5_HAVE_SZLIB_H @H5_HAVE_SZLIB_H@
+#if defined(_WIN32) && !defined(H5_BUILT_AS_DYNAMIC_LIB)
+/* Not supported on WIN32 platforms with static linking */
+/* #undef H5_HAVE_THREADSAFE */
+#else
/* Define if we have thread safe support */
-#cmakedefine H5_HAVE_THREADSAFE @H5_HAVE_THREADSAFE@
+# cmakedefine H5_HAVE_THREADSAFE @H5_HAVE_THREADSAFE@
+#endif
/* Define if timezone is a global variable */
#cmakedefine H5_HAVE_TIMEZONE @H5_HAVE_TIMEZONE@
diff --git a/config/cmake/HDF5UseFortran.cmake b/config/cmake/HDF5UseFortran.cmake
index 6b77ca4..279e077 100644
--- a/config/cmake/HDF5UseFortran.cmake
+++ b/config/cmake/HDF5UseFortran.cmake
@@ -234,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 ()
@@ -376,11 +376,11 @@ macro (C_RUN FUNCTION_NAME SOURCE_CODE RETURN_VAR)
set (${RETURN_VAR} ${OUTPUT_VAR})
- #message ( "* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * ")
- #message ( "Test COMPILE_RESULT_VAR ${COMPILE_RESULT_VAR} ")
- #message ( "* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * ")
- #message ( "Test RUN_RESULT_VAR ${RUN_RESULT_VAR} ")
- #message ( "* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * ")
+ #message (STATUS "* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * ")
+ #message (STATUS "Test COMPILE_RESULT_VAR ${COMPILE_RESULT_VAR} ")
+ #message (STATUS "* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * ")
+ #message (STATUS "Test RUN_RESULT_VAR ${RUN_RESULT_VAR} ")
+ #message (STATUS "* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * ")
if (${COMPILE_RESULT_VAR})
if (${RUN_RESULT_VAR} MATCHES 1)
diff --git a/config/cmake/HDFCompilerFlags.cmake b/config/cmake/HDFCompilerFlags.cmake
index 0a39568..4712f50 100644
--- a/config/cmake/HDFCompilerFlags.cmake
+++ b/config/cmake/HDFCompilerFlags.cmake
@@ -195,7 +195,12 @@ if (NOT MSVC AND CMAKE_COMPILER_IS_GNUCC)
# Append more extra warning flags that only gcc 6.x+ know about
if (CMAKE_C_COMPILER_ID STREQUAL "GNU" AND NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 6.0)
- set (H5_CFLAGS4 "${H5_CFLAGS4} -Wnull-dereference -Wunused-const-variable -Wduplicated-cond -Whsa")
+ set (H5_CFLAGS4 "${H5_CFLAGS4} -Wnull-dereference -Wunused-const-variable -Wduplicated-cond -Whsa -Wnormalized")
+ endif ()
+
+ # Append more extra warning flags that only gcc 7.x+ know about
+ if (CMAKE_C_COMPILER_ID STREQUAL "GNU" AND NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 7.0)
+ set (H5_CFLAGS4 "${H5_CFLAGS4} -Walloc-zero -Walloca -Wduplicated-branches -Wformat-overflow=2 -Wformat-truncation=2 -Wimplicit-fallthrough=5 -Wrestrict")
endif ()
endif ()
diff --git a/config/cmake/README.txt.cmake.in b/config/cmake/README.txt.cmake.in
index be6ddc1..b29d50b 100644
--- a/config/cmake/README.txt.cmake.in
+++ b/config/cmake/README.txt.cmake.in
@@ -34,9 +34,9 @@ utility should be installed.
To test the installation with the examples;
Create a directory to run the examples.
Copy HDF5Examples folder to this directory.
+ Copy CTestScript.cmake to this directory.
Copy HDF5_Examples.cmake to this directory.
Copy HDF5_Examples_options.cmake to this directory.
- Copy CTestScript.cmake to this directory.
The default source folder is defined as "HDF5Examples". It can be changed
with the CTEST_SOURCE_NAME script option.
The default installation folder is defined as "@CMAKE_INSTALL_PREFIX@".
diff --git a/config/cmake/UseJava.cmake b/config/cmake/UseJava.cmake
index 754d742..1f6b04c 100644
--- a/config/cmake/UseJava.cmake
+++ b/config/cmake/UseJava.cmake
@@ -1,437 +1,373 @@
# Distributed under the OSI-approved BSD 3-Clause License. See https://cmake.org/licensing for details.
-#.rst:
-# UseJava
-# -------
-#
-# Use Module for Java
-#
-# This file provides functions for Java. It is assumed that
-# FindJava.cmake has already been loaded. See FindJava.cmake for
-# information on how to load Java into your CMake project.
-#
-# ::
-#
-# add_jar(target_name
-# [SOURCES] source1 [source2 ...] [resource1 ...]
-# [INCLUDE_JARS jar1 [jar2 ...]]
-# [ENTRY_POINT entry]
-# [VERSION version]
-# [OUTPUT_NAME name]
-# [OUTPUT_DIR dir]
-# [GENERATE_NATIVE_HEADERS target [DESTINATION dir]]
-# )
-#
-# This command creates a <target_name>.jar. It compiles the given
-# source files (source) and adds the given resource files (resource) to
-# the jar file. Source files can be java files or listing files
-# (prefixed by '@'). If only resource files are given then just a jar file
-# is created. The list of include jars are added to the classpath when
-# compiling the java sources and also to the dependencies of the target.
-# INCLUDE_JARS also accepts other target names created by add_jar. For
-# backwards compatibility, jar files listed as sources are ignored (as
-# they have been since the first version of this module).
-#
-# The default OUTPUT_DIR can also be changed by setting the variable
-# CMAKE_JAVA_TARGET_OUTPUT_DIR.
-#
-# Optionally, using option GENERATE_NATIVE_HEADERS, native header files can be generated
-# for methods declared as native. These files provide the connective glue that allow your
-# Java and C code to interact. An INTERFACE target will be created for an easy usage
-# of generated files. Sub-option DESTINATION can be used to specify output directory for
-# generated header files.
-#
-# GENERATE_NATIVE_HEADERS option requires, at least, version 1.8 of the JDK.
-#
-# Additional instructions:
-#
-# ::
-#
-# To add compile flags to the target you can set these flags with
-# the following variable:
-#
-#
-#
-# ::
-#
-# set(CMAKE_JAVA_COMPILE_FLAGS -nowarn)
-#
-#
-#
-# ::
-#
-# To add a path or a jar file to the class path you can do this
-# with the CMAKE_JAVA_INCLUDE_PATH variable.
-#
-#
-#
-# ::
-#
-# set(CMAKE_JAVA_INCLUDE_PATH /usr/share/java/shibboleet.jar)
-#
-#
-#
-# ::
-#
-# To use a different output name for the target you can set it with:
-#
-#
-#
-# ::
-#
-# add_jar(foobar foobar.java OUTPUT_NAME shibboleet.jar)
-#
-#
-#
-# ::
-#
-# To use a different output directory than CMAKE_CURRENT_BINARY_DIR
-# you can set it with:
-#
-#
-#
-# ::
-#
-# add_jar(foobar foobar.java OUTPUT_DIR ${PROJECT_BINARY_DIR}/bin)
-#
-#
-#
-# ::
-#
-# To define an entry point in your jar you can set it with the ENTRY_POINT
-# named argument:
-#
-#
-#
-# ::
-#
-# add_jar(example ENTRY_POINT com/examples/MyProject/Main)
-#
-#
-#
-# ::
-#
-# To define a custom manifest for the jar, you can set it with the manifest
-# named argument:
-#
-#
-#
-# ::
-#
-# add_jar(example MANIFEST /path/to/manifest)
-#
-#
-#
-# ::
-#
-# To add a VERSION to the target output name you can set it using
-# the VERSION named argument to add_jar. This will create a jar file with the
-# name shibboleet-1.0.0.jar and will create a symlink shibboleet.jar
-# pointing to the jar with the version information.
-#
-#
-#
-# ::
-#
-# add_jar(shibboleet shibbotleet.java VERSION 1.2.0)
-#
-#
-#
-# ::
-#
-# If the target is a JNI library, utilize the following commands to
-# create a JNI symbolic link:
-#
-#
-#
-# ::
-#
-# set(CMAKE_JNI_TARGET TRUE)
-# add_jar(shibboleet shibbotleet.java VERSION 1.2.0)
-# install_jar(shibboleet ${LIB_INSTALL_DIR}/shibboleet)
-# install_jni_symlink(shibboleet ${JAVA_LIB_INSTALL_DIR})
-#
-#
-#
-# ::
-#
-# If a single target needs to produce more than one jar from its
-# java source code, to prevent the accumulation of duplicate class
-# files in subsequent jars, set/reset CMAKE_JAR_CLASSES_PREFIX prior
-# to calling the add_jar() function:
-#
-#
-#
-# ::
-#
-# set(CMAKE_JAR_CLASSES_PREFIX com/redhat/foo)
-# add_jar(foo foo.java)
-#
-#
-#
-# ::
-#
-# set(CMAKE_JAR_CLASSES_PREFIX com/redhat/bar)
-# add_jar(bar bar.java)
-#
-#
-#
-# ::
-#
-# For an optimum usage of option GENERATE_NATIVE_HEADERS, it is recommended to
-# include module JNI before any call to add_jar. The produced target for native
-# headers can then be used to compile C/C++ sources with command
-# target_link_libraries.
-#
-#
-# ::
-#
-# find_package(JNI)
-# add_jar(foo foo.java GENERATE_NATIVE_HEADERS foo-native)
-# add_library(bar bar.cpp)
-# target_link_libraries(bar PRIVATE foo-native)
-#
-#
-# Target Properties:
-#
-# ::
-#
-# The add_jar() function sets some target properties. You can get these
-# properties with the
-# get_property(TARGET <target_name> PROPERTY <propery_name>)
-# command.
-#
-#
-#
-# ::
-#
-# INSTALL_FILES The files which should be installed. This is used by
-# install_jar().
-# JNI_SYMLINK The JNI symlink which should be installed.
-# This is used by install_jni_symlink().
-# JAR_FILE The location of the jar file so that you can include
-# it.
-# CLASSDIR The directory where the class files can be found. For
-# example to use them with javah.
-#
-# ::
-#
-# find_jar(<VAR>
-# name | NAMES name1 [name2 ...]
-# [PATHS path1 [path2 ... ENV var]]
-# [VERSIONS version1 [version2]]
-# [DOC "cache documentation string"]
-# )
-#
-# This command is used to find a full path to the named jar. A cache
-# entry named by <VAR> is created to stor the result of this command.
-# If the full path to a jar is found the result is stored in the
-# variable and the search will not repeated unless the variable is
-# cleared. If nothing is found, the result will be <VAR>-NOTFOUND, and
-# the search will be attempted again next time find_jar is invoked with
-# the same variable. The name of the full path to a file that is
-# searched for is specified by the names listed after NAMES argument.
-# Additional search locations can be specified after the PATHS argument.
-# If you require special a version of a jar file you can specify it with
-# the VERSIONS argument. The argument after DOC will be used for the
-# documentation string in the cache.
-#
-# ::
-#
-# install_jar(target_name destination)
-# install_jar(target_name DESTINATION destination [COMPONENT component])
-#
-# This command installs the TARGET_NAME files to the given DESTINATION.
-# It should be called in the same scope as add_jar() or it will fail.
-#
-# Target Properties:
-#
-# ::
-#
-# The install_jar() function sets the INSTALL_DESTINATION target property
-# on jars so installed. This property holds the DESTINATION as described
-# above, and is used by install_jar_exports(). You can get this property
-# with the
-# get_property(TARGET <target_name> PROPERTY INSTALL_DESTINATION)
-# command.
-#
-#
-#
-# ::
-#
-# install_jni_symlink(target_name destination)
-# install_jni_symlink(target_name DESTINATION destination [COMPONENT component])
-#
-# This command installs the TARGET_NAME JNI symlinks to the given
-# DESTINATION. It should be called in the same scope as add_jar() or it
-# will fail.
-#
-# ::
-#
-# install_jar_exports(TARGETS jars...
-# [NAMESPACE <namespace>]
-# FILE <filename>
-# DESTINATION <dir> [COMPONENT <component>])
-#
-# This command installs a target export file ``<filename>`` for the named jar
-# targets to the given ``DESTINATION``. Its function is similar to that of
-# :command:`install(EXPORTS ...)`.
-#
-# ::
-#
-# export_jars(TARGETS jars...
-# [NAMESPACE <namespace>]
-# FILE <filename>)
-#
-# This command writes a target export file ``<filename>`` for the named jar
-# targets. Its function is similar to that of :command:`export(...)`.
-#
-# ::
-#
-# create_javadoc(<VAR>
-# PACKAGES pkg1 [pkg2 ...]
-# [SOURCEPATH <sourcepath>]
-# [CLASSPATH <classpath>]
-# [INSTALLPATH <install path>]
-# [DOCTITLE "the documentation title"]
-# [WINDOWTITLE "the title of the document"]
-# [AUTHOR TRUE|FALSE]
-# [USE TRUE|FALSE]
-# [VERSION TRUE|FALSE]
-# )
-#
-# Create java documentation based on files or packages. For more
-# details please read the javadoc manpage.
-#
-# There are two main signatures for create_javadoc. The first signature
-# works with package names on a path with source files:
-#
-# ::
-#
-# Example:
-# create_javadoc(my_example_doc
-# PACKAGES com.example.foo com.example.bar
-# SOURCEPATH "${CMAKE_CURRENT_SOURCE_DIR}"
-# CLASSPATH ${CMAKE_JAVA_INCLUDE_PATH}
-# WINDOWTITLE "My example"
-# DOCTITLE "<h1>My example</h1>"
-# AUTHOR TRUE
-# USE TRUE
-# VERSION TRUE
-# )
-#
-#
-#
-# The second signature for create_javadoc works on a given list of
-# files.
-#
-# ::
-#
-# create_javadoc(<VAR>
-# FILES file1 [file2 ...]
-# [CLASSPATH <classpath>]
-# [INSTALLPATH <install path>]
-# [DOCTITLE "the documentation title"]
-# [WINDOWTITLE "the title of the document"]
-# [AUTHOR TRUE|FALSE]
-# [USE TRUE|FALSE]
-# [VERSION TRUE|FALSE]
-# )
-#
-#
-#
-# Example:
-#
-# ::
-#
-# create_javadoc(my_example_doc
-# FILES ${example_SRCS}
-# CLASSPATH ${CMAKE_JAVA_INCLUDE_PATH}
-# WINDOWTITLE "My example"
-# DOCTITLE "<h1>My example</h1>"
-# AUTHOR TRUE
-# USE TRUE
-# VERSION TRUE
-# )
-#
-#
-#
-# Both signatures share most of the options. These options are the same
-# as what you can find in the javadoc manpage. Please look at the
-# manpage for CLASSPATH, DOCTITLE, WINDOWTITLE, AUTHOR, USE and VERSION.
-#
-# The documentation will be by default installed to
-#
-# ::
-#
-# ${CMAKE_INSTALL_PREFIX}/share/javadoc/<VAR>
-#
-#
-#
-# if you don't set the INSTALLPATH.
-#
-# ::
-#
-# create_javah(TARGET <target>
-# GENERATED_FILES <VAR>
-# CLASSES <class>...
-# [CLASSPATH <classpath>...]
-# [DEPENDS <depend>...]
-# [OUTPUT_NAME <path>|OUTPUT_DIR <path>]
-# )
-#
-# Create C header files from java classes. These files provide the connective glue
-# that allow your Java and C code to interact.
-#
-# This command will no longer be supported starting with version 10 of the JDK due
-# to the `suppression of javah tool <http://openjdk.java.net/jeps/313>`_.
-# Command ``add_jar(GENERATE_NATIVE_HEADERS)`` must be used instead.
-#
-# There are two main signatures for create_javah. The first signature
-# returns generated files through variable specified by GENERATED_FILES option:
-#
-# ::
-#
-# Example:
-# Create_javah(GENERATED_FILES files_headers
-# CLASSES org.cmake.HelloWorld
-# CLASSPATH hello.jar
-# )
-#
-#
-#
-# The second signature for create_javah creates a target which encapsulates
-# header files generation.
-#
-# ::
-#
-# Example:
-# Create_javah(TARGET target_headers
-# CLASSES org.cmake.HelloWorld
-# CLASSPATH hello.jar
-# )
-#
-#
-#
-# Both signatures share same options.
-#
-# ``CLASSES <class>...``
-# Specifies Java classes used to generate headers.
-#
-# ``CLASSPATH <classpath>...``
-# Specifies various paths to look up classes. Here .class files, jar files or targets
-# created by command add_jar can be used.
-#
-# ``DEPENDS <depend>...``
-# Targets on which the javah target depends
-#
-# ``OUTPUT_NAME <path>``
-# Concatenates the resulting header files for all the classes listed by option CLASSES
-# into <path>. Same behavior as option '-o' of javah tool.
-#
-# ``OUTPUT_DIR <path>``
-# Sets the directory where the header files will be generated. Same behavior as option
-# '-d' of javah tool. If not specified, ${CMAKE_CURRENT_BINARY_DIR} is used as output directory.
+#[=======================================================================[.rst:
+UseJava
+-------
+
+Use Module for Java
+
+This file provides functions for Java. It is assumed that
+:module:`FindJava` has already been loaded. See :module:`FindJava` for
+information on how to load Java into your CMake project.
+
+Creating And Installing JARs
+^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+.. code-block:: cmake
+
+ add_jar(<target_name>
+ [SOURCES] <source1> [<source2>...] [<resource1>...]
+ [INCLUDE_JARS <jar1> [<jar2>...]]
+ [ENTRY_POINT <entry>]
+ [VERSION <version>]
+ [OUTPUT_NAME <name>]
+ [OUTPUT_DIR <dir>]
+ [GENERATE_NATIVE_HEADERS <target> [DESTINATION <dir>]]
+ )
+
+This command creates a ``<target_name>.jar``. It compiles the given
+``<source>`` files and adds the given ``<resource>`` files to
+the jar file. Source files can be java files or listing files
+(prefixed by ``@``). If only resource files are given then just a jar file
+is created. The list of ``INCLUDE_JARS`` are added to the classpath when
+compiling the java sources and also to the dependencies of the target.
+``INCLUDE_JARS`` also accepts other target names created by ``add_jar()``.
+For backwards compatibility, jar files listed as sources are ignored (as
+they have been since the first version of this module).
+
+The default ``OUTPUT_DIR`` can also be changed by setting the variable
+``CMAKE_JAVA_TARGET_OUTPUT_DIR``.
+
+Optionally, using option ``GENERATE_NATIVE_HEADERS``, native header files can
+be generated for methods declared as native. These files provide the
+connective glue that allow your Java and C code to interact. An INTERFACE
+target will be created for an easy usage of generated files. Sub-option
+``DESTINATION`` can be used to specify the output directory for generated
+header files.
+
+``GENERATE_NATIVE_HEADERS`` option requires, at least, version 1.8 of the JDK.
+
+The ``add_jar()`` function sets the following target properties on
+``<target_name>``:
+
+``INSTALL_FILES``
+ The files which should be installed. This is used by ``install_jar()``.
+``JNI_SYMLINK``
+ The JNI symlink which should be installed. This is used by
+ ``install_jni_symlink()``.
+``JAR_FILE``
+ The location of the jar file so that you can include it.
+``CLASSDIR``
+ The directory where the class files can be found. For example to use them
+ with ``javah``.
+
+.. code-block:: cmake
+
+ install_jar(<target_name> <destination>)
+ install_jar(<target_name> DESTINATION <destination> [COMPONENT <component>])
+
+This command installs the ``<target_name>`` files to the given
+``<destination>``. It should be called in the same scope as ``add_jar()`` or
+it will fail.
+
+The ``install_jar()`` function sets the ``INSTALL_DESTINATION`` target
+property on jars so installed. This property holds the ``<destination>`` as
+described above, and is used by ``install_jar_exports()``. You can get this
+information with :command:`get_property` and the ``INSTALL_DESTINATION``
+property key.
+
+.. code-block:: cmake
+
+ install_jni_symlink(<target_name> <destination>)
+ install_jni_symlink(<target_name> DESTINATION <destination> [COMPONENT <component>])
+
+This command installs the ``<target_name>`` JNI symlinks to the given
+``<destination>``. It should be called in the same scope as ``add_jar()`` or
+it will fail.
+
+.. code-block:: cmake
+
+ install_jar_exports(TARGETS <jars>...
+ [NAMESPACE <namespace>]
+ FILE <filename>
+ DESTINATION <destination> [COMPONENT <component>])
+
+This command installs a target export file ``<filename>`` for the named jar
+targets to the given ``<destination>`` directory. Its function is similar to
+that of :command:`install(EXPORTS)`.
+
+.. code-block:: cmake
+
+ export_jars(TARGETS <jars>...
+ [NAMESPACE <namespace>]
+ FILE <filename>)
+
+This command writes a target export file ``<filename>`` for the named ``<jars>``
+targets. Its function is similar to that of :command:`export`.
+
+
+Examples
+""""""""
+
+To add compile flags to the target you can set these flags with the following
+variable:
+
+.. code-block:: cmake
+
+ set(CMAKE_JAVA_COMPILE_FLAGS -nowarn)
+
+
+To add a path or a jar file to the class path you can do this with the
+``CMAKE_JAVA_INCLUDE_PATH`` variable.
+
+.. code-block:: cmake
+
+ set(CMAKE_JAVA_INCLUDE_PATH /usr/share/java/shibboleet.jar)
+
+To use a different output name for the target you can set it with:
+
+.. code-block:: cmake
+
+ add_jar(foobar foobar.java OUTPUT_NAME shibboleet.jar)
+
+To use a different output directory than ``CMAKE_CURRENT_BINARY_DIR`` you can
+set it with:
+
+.. code-block:: cmake
+
+ add_jar(foobar foobar.java OUTPUT_DIR ${PROJECT_BINARY_DIR}/bin)
+
+To define an entry point in your jar you can set it with the ``ENTRY_POINT``
+named argument:
+
+.. code-block:: cmake
+
+ add_jar(example ENTRY_POINT com/examples/MyProject/Main)
+
+To define a custom manifest for the jar, you can set it with the ``MANIFEST``
+named argument:
+
+.. code-block:: cmake
+
+ add_jar(example MANIFEST /path/to/manifest)
+
+To add a version to the target output name you can set it using the ``VERSION``
+named argument to ``add_jar()``. The following example will create a jar file
+with the name ``shibboleet-1.0.0.jar`` and will create a symlink
+``shibboleet.jar`` pointing to the jar with the version information.
+
+.. code-block:: cmake
+
+ add_jar(shibboleet shibbotleet.java VERSION 1.2.0)
+
+If the target is a JNI library, utilize the following commands to
+create a JNI symbolic link:
+
+.. code-block:: cmake
+
+ set(CMAKE_JNI_TARGET TRUE)
+ add_jar(shibboleet shibbotleet.java VERSION 1.2.0)
+ install_jar(shibboleet ${LIB_INSTALL_DIR}/shibboleet)
+ install_jni_symlink(shibboleet ${JAVA_LIB_INSTALL_DIR})
+
+If a single target needs to produce more than one jar from its
+java source code, to prevent the accumulation of duplicate class
+files in subsequent jars, set/reset ``CMAKE_JAR_CLASSES_PREFIX`` prior
+to calling the ``add_jar()`` function:
+
+.. code-block:: cmake
+
+ set(CMAKE_JAR_CLASSES_PREFIX com/redhat/foo)
+ add_jar(foo foo.java)
+
+ set(CMAKE_JAR_CLASSES_PREFIX com/redhat/bar)
+ add_jar(bar bar.java)
+
+For an optimum usage of option ``GENERATE_NATIVE_HEADERS``, it is recommended to
+include module JNI before any call to ``add_jar()``. The produced target for
+native headers can then be used to compile C/C++ sources with the
+:command:`target_link_libraries` command.
+
+.. code-block:: cmake
+
+ find_package(JNI)
+ add_jar(foo foo.java GENERATE_NATIVE_HEADERS foo-native)
+ add_library(bar bar.cpp)
+ target_link_libraries(bar PRIVATE foo-native)
+
+
+Finding JARs
+^^^^^^^^^^^^
+
+.. code-block:: cmake
+
+ find_jar(<VAR>
+ <name> | NAMES <name1> [<name2>...]
+ [PATHS <path1> [<path2>... ENV <var>]]
+ [VERSIONS <version1> [<version2>]]
+ [DOC "cache documentation string"]
+ )
+
+This command is used to find a full path to the named jar. A cache
+entry named by ``<VAR>`` is created to store the result of this command.
+If the full path to a jar is found the result is stored in the
+variable and the search will not repeated unless the variable is
+cleared. If nothing is found, the result will be ``<VAR>-NOTFOUND``, and
+the search will be attempted again next time ``find_jar()`` is invoked with
+the same variable. The name of the full path to a file that is
+searched for is specified by the names listed after ``NAMES`` argument.
+Additional search locations can be specified after the ``PATHS`` argument.
+If you require special a version of a jar file you can specify it with
+the ``VERSIONS`` argument. The argument after ``DOC`` will be used for the
+documentation string in the cache.
+
+
+Javadoc
+^^^^^^^
+
+The ``create_javadoc()`` command can be used to create java documentation
+based on files or packages. For more details please read the javadoc manpage.
+
+There are two main signatures for ``create_javadoc()``. The first signature
+works with package names on a path with source files.
+
+.. code-block:: cmake
+
+ create_javadoc(<VAR>
+ PACKAGES <pkg1> [<pkg2>...]
+ [SOURCEPATH <sourcepath>]
+ [CLASSPATH <classpath>]
+ [INSTALLPATH <install path>]
+ [DOCTITLE "the documentation title"]
+ [WINDOWTITLE "the title of the document"]
+ [AUTHOR TRUE|FALSE]
+ [USE TRUE|FALSE]
+ [VERSION TRUE|FALSE]
+ )
+
+For example:
+
+.. code-block:: cmake
+
+ create_javadoc(my_example_doc
+ PACKAGES com.example.foo com.example.bar
+ SOURCEPATH "${CMAKE_CURRENT_SOURCE_DIR}"
+ CLASSPATH ${CMAKE_JAVA_INCLUDE_PATH}
+ WINDOWTITLE "My example"
+ DOCTITLE "<h1>My example</h1>"
+ AUTHOR TRUE
+ USE TRUE
+ VERSION TRUE
+ )
+
+The second signature for ``create_javadoc()`` works on a given list of
+files.
+
+.. code-block:: cmake
+
+ create_javadoc(<VAR>
+ FILES <file1> [<file2>...]
+ [CLASSPATH <classpath>]
+ [INSTALLPATH <install path>]
+ [DOCTITLE "the documentation title"]
+ [WINDOWTITLE "the title of the document"]
+ [AUTHOR TRUE|FALSE]
+ [USE TRUE|FALSE]
+ [VERSION TRUE|FALSE]
+ )
+
+For example:
+
+.. code-block:: cmake
+
+ create_javadoc(my_example_doc
+ FILES ${example_SRCS}
+ CLASSPATH ${CMAKE_JAVA_INCLUDE_PATH}
+ WINDOWTITLE "My example"
+ DOCTITLE "<h1>My example</h1>"
+ AUTHOR TRUE
+ USE TRUE
+ VERSION TRUE
+ )
+
+Both signatures share most of the options. These options are the same
+as what you can find in the javadoc manpage. Please look at the
+manpage for ``CLASSPATH``, ``DOCTITLE``, ``WINDOWTITLE``, ``AUTHOR``, ``USE``
+and ``VERSION``.
+
+If you don't set the ``INSTALLPATH``, then by default the documentation will
+be installed to :
+
+::
+
+ ${CMAKE_INSTALL_PREFIX}/share/javadoc/<VAR>
+
+
+Header Generation
+^^^^^^^^^^^^^^^^^
+
+.. code-block:: cmake
+
+ create_javah(TARGET <target> | GENERATED_FILES <VAR>
+ CLASSES <class>...
+ [CLASSPATH <classpath>...]
+ [DEPENDS <depend>...]
+ [OUTPUT_NAME <path>|OUTPUT_DIR <path>]
+ )
+
+Create C header files from java classes. These files provide the connective glue
+that allow your Java and C code to interact.
+
+.. deprecated:: 3.11
+
+.. note::
+
+ This command will no longer be supported starting with version 10 of the JDK
+ due to the `suppression of javah tool <http://openjdk.java.net/jeps/313>`_.
+ The ``add_jar(GENERATE_NATIVE_HEADERS)`` command should be used instead.
+
+There are two main signatures for ``create_javah()``. The first signature
+returns generated files through variable specified by the ``GENERATED_FILES``
+option. For example:
+
+.. code-block:: cmake
+
+ create_javah(GENERATED_FILES files_headers
+ CLASSES org.cmake.HelloWorld
+ CLASSPATH hello.jar
+ )
+
+The second signature for ``create_javah()`` creates a target which encapsulates
+header files generation. E.g.
+
+.. code-block:: cmake
+
+ create_javah(TARGET target_headers
+ CLASSES org.cmake.HelloWorld
+ CLASSPATH hello.jar
+ )
+
+Both signatures share same options.
+
+``CLASSES <class>...``
+ Specifies Java classes used to generate headers.
+
+``CLASSPATH <classpath>...``
+ Specifies various paths to look up classes. Here .class files, jar files or
+ targets created by command add_jar can be used.
+
+``DEPENDS <depend>...``
+ Targets on which the javah target depends.
+
+``OUTPUT_NAME <path>``
+ Concatenates the resulting header files for all the classes listed by option
+ ``CLASSES`` into ``<path>``. Same behavior as option ``-o`` of javah tool.
+
+``OUTPUT_DIR <path>``
+ Sets the directory where the header files will be generated. Same behavior
+ as option ``-d`` of javah tool. If not specified,
+ :variable:`CMAKE_CURRENT_BINARY_DIR` is used as the output directory.
+#]=======================================================================]
include(CMakeParseArguments)
@@ -446,7 +382,7 @@ function (__java_copy_file src dest comment)
endfunction ()
function(__java_lcat VAR)
- foreach(_line ${ARGN})
+ foreach(_line IN LISTS ARGN)
string(APPEND ${VAR} "${_line}\n")
endforeach()
@@ -568,7 +504,7 @@ function(add_jar _TARGET_NAME)
set(CMAKE_JAVA_INCLUDE_FLAG_SEP ":")
endif()
- foreach (JAVA_INCLUDE_DIR ${CMAKE_JAVA_INCLUDE_PATH})
+ foreach (JAVA_INCLUDE_DIR IN LISTS CMAKE_JAVA_INCLUDE_PATH)
string(APPEND CMAKE_JAVA_INCLUDE_PATH_FINAL "${CMAKE_JAVA_INCLUDE_FLAG_SEP}${JAVA_INCLUDE_DIR}")
endforeach()
@@ -592,7 +528,7 @@ function(add_jar _TARGET_NAME)
set(_JAVA_COMPILE_DEPENDS)
set(_JAVA_RESOURCE_FILES)
set(_JAVA_RESOURCE_FILES_RELATIVE)
- foreach(_JAVA_SOURCE_FILE ${_JAVA_SOURCE_FILES})
+ foreach(_JAVA_SOURCE_FILE IN LISTS _JAVA_SOURCE_FILES)
get_filename_component(_JAVA_EXT ${_JAVA_SOURCE_FILE} EXT)
get_filename_component(_JAVA_FILE ${_JAVA_SOURCE_FILE} NAME_WE)
get_filename_component(_JAVA_PATH ${_JAVA_SOURCE_FILE} PATH)
@@ -607,7 +543,7 @@ function(add_jar _TARGET_NAME)
file(RELATIVE_PATH _JAVA_REL_SOURCE_PATH ${CMAKE_CURRENT_SOURCE_DIR} ${_JAVA_FULL})
string(LENGTH ${_JAVA_REL_BINARY_PATH} _BIN_LEN)
string(LENGTH ${_JAVA_REL_SOURCE_PATH} _SRC_LEN)
- if (${_BIN_LEN} LESS ${_SRC_LEN})
+ if (_BIN_LEN LESS _SRC_LEN)
set(_JAVA_REL_PATH ${_JAVA_REL_BINARY_PATH})
else ()
set(_JAVA_REL_PATH ${_JAVA_REL_SOURCE_PATH})
@@ -637,14 +573,14 @@ function(add_jar _TARGET_NAME)
endif ()
endforeach()
- foreach(_JAVA_INCLUDE_JAR ${_add_jar_INCLUDE_JARS})
+ foreach(_JAVA_INCLUDE_JAR IN LISTS _add_jar_INCLUDE_JARS)
if (TARGET ${_JAVA_INCLUDE_JAR})
get_target_property(_JAVA_JAR_PATH ${_JAVA_INCLUDE_JAR} JAR_FILE)
if (_JAVA_JAR_PATH)
string(APPEND CMAKE_JAVA_INCLUDE_PATH_FINAL "${CMAKE_JAVA_INCLUDE_FLAG_SEP}${_JAVA_JAR_PATH}")
list(APPEND CMAKE_JAVA_INCLUDE_PATH ${_JAVA_JAR_PATH})
list(APPEND _JAVA_DEPENDS ${_JAVA_INCLUDE_JAR})
- list(APPEND _JAVA_COMPILE_DEPENDS ${_JAVA_INCLUDE_JAR})
+ list(APPEND _JAVA_COMPILE_DEPENDS ${_JAVA_JAR_PATH})
else ()
message(SEND_ERROR "add_jar: INCLUDE_JARS target ${_JAVA_INCLUDE_JAR} is not a jar")
endif ()
@@ -705,7 +641,7 @@ function(add_jar _TARGET_NAME)
# create the jar file
set(_JAVA_JAR_OUTPUT_PATH
- ${_add_jar_OUTPUT_DIR}/${_JAVA_TARGET_OUTPUT_NAME})
+ "${_add_jar_OUTPUT_DIR}/${_JAVA_TARGET_OUTPUT_NAME}")
if (CMAKE_JNI_TARGET)
add_custom_command(
OUTPUT ${_JAVA_JAR_OUTPUT_PATH}
@@ -800,7 +736,8 @@ function(add_jar _TARGET_NAME)
# this INTERFACE library depends on jar generation
add_dependencies (${_GENERATE_NATIVE_HEADERS_TARGET} ${_TARGET_NAME})
- set_property (DIRECTORY PROPERTY ADDITIONAL_MAKE_CLEAN_FILES "${_GENERATE_NATIVE_HEADERS_OUTPUT_DIR}")
+ set_property (DIRECTORY APPEND PROPERTY ADDITIONAL_CLEAN_FILES
+ "${_GENERATE_NATIVE_HEADERS_OUTPUT_DIR}")
endif()
endfunction()
@@ -903,15 +840,15 @@ function (find_jar VARIABLE)
set(_state "name")
- foreach (arg ${ARGN})
- if (${_state} STREQUAL "name")
- if (${arg} STREQUAL "VERSIONS")
+ foreach (arg IN LISTS ARGN)
+ if (_state STREQUAL "name")
+ if (arg STREQUAL "VERSIONS")
set(_state "versions")
- elseif (${arg} STREQUAL "NAMES")
+ elseif (arg STREQUAL "NAMES")
set(_state "names")
- elseif (${arg} STREQUAL "PATHS")
+ elseif (arg STREQUAL "PATHS")
set(_state "paths")
- elseif (${arg} STREQUAL "DOC")
+ elseif (arg STREQUAL "DOC")
set(_state "doc")
else ()
set(_jar_names ${arg})
@@ -919,22 +856,22 @@ function (find_jar VARIABLE)
set(_jar_doc "Finding ${arg} jar")
endif ()
endif ()
- elseif (${_state} STREQUAL "versions")
- if (${arg} STREQUAL "NAMES")
+ elseif (_state STREQUAL "versions")
+ if (arg STREQUAL "NAMES")
set(_state "names")
- elseif (${arg} STREQUAL "PATHS")
+ elseif (arg STREQUAL "PATHS")
set(_state "paths")
- elseif (${arg} STREQUAL "DOC")
+ elseif (arg STREQUAL "DOC")
set(_state "doc")
else ()
set(_jar_versions ${_jar_versions} ${arg})
endif ()
- elseif (${_state} STREQUAL "names")
- if (${arg} STREQUAL "VERSIONS")
+ elseif (_state STREQUAL "names")
+ if (arg STREQUAL "VERSIONS")
set(_state "versions")
- elseif (${arg} STREQUAL "PATHS")
+ elseif (arg STREQUAL "PATHS")
set(_state "paths")
- elseif (${arg} STREQUAL "DOC")
+ elseif (arg STREQUAL "DOC")
set(_state "doc")
else ()
set(_jar_names ${_jar_names} ${arg})
@@ -942,22 +879,22 @@ function (find_jar VARIABLE)
set(_jar_doc "Finding ${arg} jar")
endif ()
endif ()
- elseif (${_state} STREQUAL "paths")
- if (${arg} STREQUAL "VERSIONS")
+ elseif (_state STREQUAL "paths")
+ if (arg STREQUAL "VERSIONS")
set(_state "versions")
- elseif (${arg} STREQUAL "NAMES")
+ elseif (arg STREQUAL "NAMES")
set(_state "names")
- elseif (${arg} STREQUAL "DOC")
+ elseif (arg STREQUAL "DOC")
set(_state "doc")
else ()
set(_jar_paths ${_jar_paths} ${arg})
endif ()
- elseif (${_state} STREQUAL "doc")
- if (${arg} STREQUAL "VERSIONS")
+ elseif (_state STREQUAL "doc")
+ if (arg STREQUAL "VERSIONS")
set(_state "versions")
- elseif (${arg} STREQUAL "NAMES")
+ elseif (arg STREQUAL "NAMES")
set(_state "names")
- elseif (${arg} STREQUAL "PATHS")
+ elseif (arg STREQUAL "PATHS")
set(_state "paths")
else ()
set(_jar_doc ${arg})
@@ -969,8 +906,8 @@ function (find_jar VARIABLE)
message(FATAL_ERROR "find_jar: No name to search for given")
endif ()
- foreach (jar_name ${_jar_names})
- foreach (version ${_jar_versions})
+ foreach (jar_name IN LISTS _jar_names)
+ foreach (version IN LISTS _jar_versions)
set(_jar_files ${_jar_files} ${jar_name}-${version}.jar)
endforeach ()
set(_jar_files ${_jar_files} ${jar_name}.jar)
@@ -998,301 +935,301 @@ function(create_javadoc _target)
set(_state "package")
- foreach (arg ${ARGN})
- if (${_state} STREQUAL "package")
- if (${arg} STREQUAL "PACKAGES")
+ foreach (arg IN LISTS ARGN)
+ if (_state STREQUAL "package")
+ if (arg STREQUAL "PACKAGES")
set(_state "packages")
- elseif (${arg} STREQUAL "FILES")
+ elseif (arg STREQUAL "FILES")
set(_state "files")
- elseif (${arg} STREQUAL "SOURCEPATH")
+ elseif (arg STREQUAL "SOURCEPATH")
set(_state "sourcepath")
- elseif (${arg} STREQUAL "OVERVIEW")
+ elseif (arg STREQUAL "OVERVIEW")
set(_state "overview")
- elseif (${arg} STREQUAL "CLASSPATH")
+ elseif (arg STREQUAL "CLASSPATH")
set(_state "classpath")
- elseif (${arg} STREQUAL "INSTALLPATH")
+ elseif (arg STREQUAL "INSTALLPATH")
set(_state "installpath")
- elseif (${arg} STREQUAL "DOCTITLE")
+ elseif (arg STREQUAL "DOCTITLE")
set(_state "doctitle")
- elseif (${arg} STREQUAL "WINDOWTITLE")
+ elseif (arg STREQUAL "WINDOWTITLE")
set(_state "windowtitle")
- elseif (${arg} STREQUAL "AUTHOR")
+ elseif (arg STREQUAL "AUTHOR")
set(_state "author")
- elseif (${arg} STREQUAL "USE")
+ elseif (arg STREQUAL "USE")
set(_state "use")
- elseif (${arg} STREQUAL "VERSION")
+ elseif (arg STREQUAL "VERSION")
set(_state "version")
else ()
set(_javadoc_packages ${arg})
set(_state "packages")
endif ()
- elseif (${_state} STREQUAL "packages")
- if (${arg} STREQUAL "FILES")
+ elseif (_state STREQUAL "packages")
+ if (arg STREQUAL "FILES")
set(_state "files")
- elseif (${arg} STREQUAL "SOURCEPATH")
+ elseif (arg STREQUAL "SOURCEPATH")
set(_state "sourcepath")
- elseif (${arg} STREQUAL "OVERVIEW")
+ elseif (arg STREQUAL "OVERVIEW")
set(_state "overview")
- elseif (${arg} STREQUAL "CLASSPATH")
+ elseif (arg STREQUAL "CLASSPATH")
set(_state "classpath")
- elseif (${arg} STREQUAL "INSTALLPATH")
+ elseif (arg STREQUAL "INSTALLPATH")
set(_state "installpath")
- elseif (${arg} STREQUAL "DOCTITLE")
+ elseif (arg STREQUAL "DOCTITLE")
set(_state "doctitle")
- elseif (${arg} STREQUAL "WINDOWTITLE")
+ elseif (arg STREQUAL "WINDOWTITLE")
set(_state "windowtitle")
- elseif (${arg} STREQUAL "AUTHOR")
+ elseif (arg STREQUAL "AUTHOR")
set(_state "author")
- elseif (${arg} STREQUAL "USE")
+ elseif (arg STREQUAL "USE")
set(_state "use")
- elseif (${arg} STREQUAL "VERSION")
+ elseif (arg STREQUAL "VERSION")
set(_state "version")
else ()
list(APPEND _javadoc_packages ${arg})
endif ()
- elseif (${_state} STREQUAL "files")
- if (${arg} STREQUAL "PACKAGES")
+ elseif (_state STREQUAL "files")
+ if (arg STREQUAL "PACKAGES")
set(_state "packages")
- elseif (${arg} STREQUAL "SOURCEPATH")
+ elseif (arg STREQUAL "SOURCEPATH")
set(_state "sourcepath")
- elseif (${arg} STREQUAL "OVERVIEW")
+ elseif (arg STREQUAL "OVERVIEW")
set(_state "overview")
- elseif (${arg} STREQUAL "CLASSPATH")
+ elseif (arg STREQUAL "CLASSPATH")
set(_state "classpath")
- elseif (${arg} STREQUAL "INSTALLPATH")
+ elseif (arg STREQUAL "INSTALLPATH")
set(_state "installpath")
- elseif (${arg} STREQUAL "DOCTITLE")
+ elseif (arg STREQUAL "DOCTITLE")
set(_state "doctitle")
- elseif (${arg} STREQUAL "WINDOWTITLE")
+ elseif (arg STREQUAL "WINDOWTITLE")
set(_state "windowtitle")
- elseif (${arg} STREQUAL "AUTHOR")
+ elseif (arg STREQUAL "AUTHOR")
set(_state "author")
- elseif (${arg} STREQUAL "USE")
+ elseif (arg STREQUAL "USE")
set(_state "use")
- elseif (${arg} STREQUAL "VERSION")
+ elseif (arg STREQUAL "VERSION")
set(_state "version")
else ()
list(APPEND _javadoc_files ${arg})
endif ()
- elseif (${_state} STREQUAL "sourcepath")
- if (${arg} STREQUAL "PACKAGES")
+ elseif (_state STREQUAL "sourcepath")
+ if (arg STREQUAL "PACKAGES")
set(_state "packages")
- elseif (${arg} STREQUAL "FILES")
+ elseif (arg STREQUAL "FILES")
set(_state "files")
- elseif (${arg} STREQUAL "OVERVIEW")
+ elseif (arg STREQUAL "OVERVIEW")
set(_state "overview")
- elseif (${arg} STREQUAL "CLASSPATH")
+ elseif (arg STREQUAL "CLASSPATH")
set(_state "classpath")
- elseif (${arg} STREQUAL "INSTALLPATH")
+ elseif (arg STREQUAL "INSTALLPATH")
set(_state "installpath")
- elseif (${arg} STREQUAL "DOCTITLE")
+ elseif (arg STREQUAL "DOCTITLE")
set(_state "doctitle")
- elseif (${arg} STREQUAL "WINDOWTITLE")
+ elseif (arg STREQUAL "WINDOWTITLE")
set(_state "windowtitle")
- elseif (${arg} STREQUAL "AUTHOR")
+ elseif (arg STREQUAL "AUTHOR")
set(_state "author")
- elseif (${arg} STREQUAL "USE")
+ elseif (arg STREQUAL "USE")
set(_state "use")
- elseif (${arg} STREQUAL "VERSION")
+ elseif (arg STREQUAL "VERSION")
set(_state "version")
else ()
list(APPEND _javadoc_sourcepath ${arg})
endif ()
- elseif (${_state} STREQUAL "classpath")
- if (${arg} STREQUAL "PACKAGES")
+ elseif (_state STREQUAL "classpath")
+ if (arg STREQUAL "PACKAGES")
set(_state "packages")
- elseif (${arg} STREQUAL "FILES")
+ elseif (arg STREQUAL "FILES")
set(_state "files")
- elseif (${arg} STREQUAL "SOURCEPATH")
- set(_state "sourcepath")
- elseif (${arg} STREQUAL "OVERVIEW")
+ elseif (arg STREQUAL "OVERVIEW")
set(_state "overview")
- elseif (${arg} STREQUAL "INSTALLPATH")
+ elseif (arg STREQUAL "SOURCEPATH")
+ set(_state "sourcepath")
+ elseif (arg STREQUAL "INSTALLPATH")
set(_state "installpath")
- elseif (${arg} STREQUAL "DOCTITLE")
+ elseif (arg STREQUAL "DOCTITLE")
set(_state "doctitle")
- elseif (${arg} STREQUAL "WINDOWTITLE")
+ elseif (arg STREQUAL "WINDOWTITLE")
set(_state "windowtitle")
- elseif (${arg} STREQUAL "AUTHOR")
+ elseif (arg STREQUAL "AUTHOR")
set(_state "author")
- elseif (${arg} STREQUAL "USE")
+ elseif (arg STREQUAL "USE")
set(_state "use")
- elseif (${arg} STREQUAL "VERSION")
+ elseif (arg STREQUAL "VERSION")
set(_state "version")
else ()
list(APPEND _javadoc_classpath ${arg})
endif ()
- elseif (${_state} STREQUAL "installpath")
- if (${arg} STREQUAL "PACKAGES")
+ elseif (_state STREQUAL "installpath")
+ if (arg STREQUAL "PACKAGES")
set(_state "packages")
- elseif (${arg} STREQUAL "FILES")
+ elseif (arg STREQUAL "FILES")
set(_state "files")
- elseif (${arg} STREQUAL "SOURCEPATH")
+ elseif (arg STREQUAL "SOURCEPATH")
set(_state "sourcepath")
- elseif (${arg} STREQUAL "OVERVIEW")
+ elseif (arg STREQUAL "OVERVIEW")
set(_state "overview")
- elseif (${arg} STREQUAL "DOCTITLE")
+ elseif (arg STREQUAL "DOCTITLE")
set(_state "doctitle")
- elseif (${arg} STREQUAL "WINDOWTITLE")
+ elseif (arg STREQUAL "WINDOWTITLE")
set(_state "windowtitle")
- elseif (${arg} STREQUAL "AUTHOR")
+ elseif (arg STREQUAL "AUTHOR")
set(_state "author")
- elseif (${arg} STREQUAL "USE")
+ elseif (arg STREQUAL "USE")
set(_state "use")
- elseif (${arg} STREQUAL "VERSION")
+ elseif (arg STREQUAL "VERSION")
set(_state "version")
else ()
set(_javadoc_installpath ${arg})
endif ()
- elseif (${_state} STREQUAL "doctitle")
+ elseif (_state STREQUAL "doctitle")
if (${arg} STREQUAL "PACKAGES")
set(_state "packages")
- elseif (${arg} STREQUAL "FILES")
+ elseif (arg STREQUAL "FILES")
set(_state "files")
- elseif (${arg} STREQUAL "SOURCEPATH")
+ elseif (arg STREQUAL "SOURCEPATH")
set(_state "sourcepath")
- elseif (${arg} STREQUAL "OVERVIEW")
+ elseif (arg STREQUAL "OVERVIEW")
set(_state "overview")
- elseif (${arg} STREQUAL "INSTALLPATH")
+ elseif (arg STREQUAL "INSTALLPATH")
set(_state "installpath")
- elseif (${arg} STREQUAL "CLASSPATH")
+ elseif (arg STREQUAL "CLASSPATH")
set(_state "classpath")
- elseif (${arg} STREQUAL "WINDOWTITLE")
+ elseif (arg STREQUAL "WINDOWTITLE")
set(_state "windowtitle")
- elseif (${arg} STREQUAL "AUTHOR")
+ elseif (arg STREQUAL "AUTHOR")
set(_state "author")
- elseif (${arg} STREQUAL "USE")
+ elseif (arg STREQUAL "USE")
set(_state "use")
- elseif (${arg} STREQUAL "VERSION")
+ elseif (arg STREQUAL "VERSION")
set(_state "version")
else ()
set(_javadoc_doctitle ${arg})
endif ()
- elseif (${_state} STREQUAL "windowtitle")
+ elseif (_state STREQUAL "windowtitle")
if (${arg} STREQUAL "PACKAGES")
set(_state "packages")
- elseif (${arg} STREQUAL "FILES")
+ elseif (arg STREQUAL "FILES")
set(_state "files")
- elseif (${arg} STREQUAL "SOURCEPATH")
+ elseif (arg STREQUAL "SOURCEPATH")
set(_state "sourcepath")
- elseif (${arg} STREQUAL "OVERVIEW")
+ elseif (arg STREQUAL "OVERVIEW")
set(_state "overview")
- elseif (${arg} STREQUAL "CLASSPATH")
+ elseif (arg STREQUAL "CLASSPATH")
set(_state "classpath")
- elseif (${arg} STREQUAL "INSTALLPATH")
+ elseif (arg STREQUAL "INSTALLPATH")
set(_state "installpath")
- elseif (${arg} STREQUAL "DOCTITLE")
+ elseif (arg STREQUAL "DOCTITLE")
set(_state "doctitle")
- elseif (${arg} STREQUAL "AUTHOR")
+ elseif (arg STREQUAL "AUTHOR")
set(_state "author")
- elseif (${arg} STREQUAL "USE")
+ elseif (arg STREQUAL "USE")
set(_state "use")
- elseif (${arg} STREQUAL "VERSION")
+ elseif (arg STREQUAL "VERSION")
set(_state "version")
else ()
set(_javadoc_windowtitle ${arg})
endif ()
- elseif (${_state} STREQUAL "author")
- if (${arg} STREQUAL "PACKAGES")
+ elseif (_state STREQUAL "author")
+ if (arg STREQUAL "PACKAGES")
set(_state "packages")
- elseif (${arg} STREQUAL "FILES")
+ elseif (arg STREQUAL "FILES")
set(_state "files")
- elseif (${arg} STREQUAL "SOURCEPATH")
+ elseif (arg STREQUAL "SOURCEPATH")
set(_state "sourcepath")
- elseif (${arg} STREQUAL "OVERVIEW")
+ elseif (arg STREQUAL "OVERVIEW")
set(_state "overview")
- elseif (${arg} STREQUAL "CLASSPATH")
+ elseif (arg STREQUAL "CLASSPATH")
set(_state "classpath")
- elseif (${arg} STREQUAL "INSTALLPATH")
+ elseif (arg STREQUAL "INSTALLPATH")
set(_state "installpath")
- elseif (${arg} STREQUAL "DOCTITLE")
+ elseif (arg STREQUAL "DOCTITLE")
set(_state "doctitle")
- elseif (${arg} STREQUAL "WINDOWTITLE")
+ elseif (arg STREQUAL "WINDOWTITLE")
set(_state "windowtitle")
- elseif (${arg} STREQUAL "AUTHOR")
+ elseif (arg STREQUAL "AUTHOR")
set(_state "author")
- elseif (${arg} STREQUAL "USE")
+ elseif (arg STREQUAL "USE")
set(_state "use")
- elseif (${arg} STREQUAL "VERSION")
+ elseif (arg STREQUAL "VERSION")
set(_state "version")
else ()
set(_javadoc_author ${arg})
endif ()
- elseif (${_state} STREQUAL "use")
- if (${arg} STREQUAL "PACKAGES")
+ elseif (_state STREQUAL "use")
+ if (arg STREQUAL "PACKAGES")
set(_state "packages")
- elseif (${arg} STREQUAL "FILES")
+ elseif (arg STREQUAL "FILES")
set(_state "files")
- elseif (${arg} STREQUAL "SOURCEPATH")
+ elseif (arg STREQUAL "SOURCEPATH")
set(_state "sourcepath")
- elseif (${arg} STREQUAL "OVERVIEW")
+ elseif (arg STREQUAL "OVERVIEW")
set(_state "overview")
- elseif (${arg} STREQUAL "CLASSPATH")
+ elseif (arg STREQUAL "CLASSPATH")
set(_state "classpath")
- elseif (${arg} STREQUAL "INSTALLPATH")
+ elseif (arg STREQUAL "INSTALLPATH")
set(_state "installpath")
- elseif (${arg} STREQUAL "DOCTITLE")
+ elseif (arg STREQUAL "DOCTITLE")
set(_state "doctitle")
- elseif (${arg} STREQUAL "WINDOWTITLE")
+ elseif (arg STREQUAL "WINDOWTITLE")
set(_state "windowtitle")
- elseif (${arg} STREQUAL "AUTHOR")
+ elseif (arg STREQUAL "AUTHOR")
set(_state "author")
- elseif (${arg} STREQUAL "USE")
+ elseif (arg STREQUAL "USE")
set(_state "use")
- elseif (${arg} STREQUAL "VERSION")
+ elseif (arg STREQUAL "VERSION")
set(_state "version")
else ()
set(_javadoc_use ${arg})
endif ()
- elseif (${_state} STREQUAL "version")
- if (${arg} STREQUAL "PACKAGES")
+ elseif (_state STREQUAL "version")
+ if (arg STREQUAL "PACKAGES")
set(_state "packages")
- elseif (${arg} STREQUAL "FILES")
+ elseif (arg STREQUAL "FILES")
set(_state "files")
- elseif (${arg} STREQUAL "SOURCEPATH")
+ elseif (arg STREQUAL "SOURCEPATH")
set(_state "sourcepath")
- elseif (${arg} STREQUAL "OVERVIEW")
+ elseif (arg STREQUAL "OVERVIEW")
set(_state "overview")
- elseif (${arg} STREQUAL "CLASSPATH")
+ elseif (arg STREQUAL "CLASSPATH")
set(_state "classpath")
- elseif (${arg} STREQUAL "INSTALLPATH")
+ elseif (arg STREQUAL "INSTALLPATH")
set(_state "installpath")
- elseif (${arg} STREQUAL "DOCTITLE")
+ elseif (arg STREQUAL "DOCTITLE")
set(_state "doctitle")
- elseif (${arg} STREQUAL "WINDOWTITLE")
+ elseif (arg STREQUAL "WINDOWTITLE")
set(_state "windowtitle")
- elseif (${arg} STREQUAL "AUTHOR")
+ elseif (arg STREQUAL "AUTHOR")
set(_state "author")
- elseif (${arg} STREQUAL "USE")
+ elseif (arg STREQUAL "USE")
set(_state "use")
- elseif (${arg} STREQUAL "VERSION")
+ elseif (arg STREQUAL "VERSION")
set(_state "version")
else ()
set(_javadoc_version ${arg})
endif ()
- elseif (${_state} STREQUAL "overview")
- if (${arg} STREQUAL "PACKAGES")
+ elseif (_state STREQUAL "overview")
+ if (arg STREQUAL "PACKAGES")
set(_state "packages")
- elseif (${arg} STREQUAL "FILES")
+ elseif (arg STREQUAL "FILES")
set(_state "files")
- elseif (${arg} STREQUAL "SOURCEPATH")
+ elseif (arg STREQUAL "SOURCEPATH")
set(_state "sourcepath")
- elseif (${arg} STREQUAL "CLASSPATH")
+ elseif (arg STREQUAL "CLASSPATH")
set(_state "classpath")
- elseif (${arg} STREQUAL "INSTALLPATH")
+ elseif (arg STREQUAL "INSTALLPATH")
set(_state "installpath")
- elseif (${arg} STREQUAL "DOCTITLE")
+ elseif (arg STREQUAL "DOCTITLE")
set(_state "doctitle")
- elseif (${arg} STREQUAL "WINDOWTITLE")
+ elseif (arg STREQUAL "WINDOWTITLE")
set(_state "windowtitle")
- elseif (${arg} STREQUAL "AUTHOR")
+ elseif (arg STREQUAL "AUTHOR")
set(_state "author")
- elseif (${arg} STREQUAL "USE")
+ elseif (arg STREQUAL "USE")
set(_state "use")
- elseif (${arg} STREQUAL "VERSION")
+ elseif (arg STREQUAL "VERSION")
set(_state "version")
else ()
- list(APPEND _javadoc_overview ${arg})
+ set(_javadoc_overview ${arg})
endif ()
endif ()
endforeach ()
@@ -1302,7 +1239,7 @@ function(create_javadoc _target)
if (_javadoc_sourcepath)
set(_start TRUE)
- foreach(_path ${_javadoc_sourcepath})
+ foreach(_path IN LISTS _javadoc_sourcepath)
if (_start)
set(_sourcepath ${_path})
set(_start FALSE)
@@ -1315,7 +1252,7 @@ function(create_javadoc _target)
if (_javadoc_overview)
set(_start TRUE)
- foreach(_path ${_javadoc_overview})
+ foreach(_path IN LISTS _javadoc_overview)
if (_start)
set(_overview ${_path})
set(_start FALSE)
@@ -1328,7 +1265,7 @@ function(create_javadoc _target)
if (_javadoc_classpath)
set(_start TRUE)
- foreach(_path ${_javadoc_classpath})
+ foreach(_path IN LISTS _javadoc_classpath)
if (_start)
set(_classpath ${_path})
set(_start FALSE)
@@ -1495,7 +1432,7 @@ function(export_jars)
# Set content of generated exports file
string(REPLACE ";" " " __targets__ "${_export_jars_TARGETS}")
set(__targetdefs__ "")
- foreach(_target ${_export_jars_TARGETS})
+ foreach(_target IN LISTS _export_jars_TARGETS)
get_target_property(_jarpath ${_target} JAR_FILE)
get_filename_component(_jarpath ${_jarpath} PATH)
__java_export_jar(__targetdefs__ ${_target} "${_jarpath}")
@@ -1533,7 +1470,7 @@ function(install_jar_exports)
endif()
# Determine relative path from installed export file to install prefix
- if(IS_ABSOLUTE ${_install_jar_exports_DESTINATION})
+ if(IS_ABSOLUTE "${_install_jar_exports_DESTINATION}")
file(RELATIVE_PATH _relpath
${_install_jar_exports_DESTINATION}
${CMAKE_INSTALL_PREFIX}
@@ -1552,7 +1489,7 @@ function(install_jar_exports)
# Set content of generated exports file
string(REPLACE ";" " " __targets__ "${_install_jar_exports_TARGETS}")
set(__targetdefs__ "set(_prefix \${CMAKE_CURRENT_LIST_DIR}/${_relpath})\n\n")
- foreach(_target ${_install_jar_exports_TARGETS})
+ foreach(_target IN LISTS _install_jar_exports_TARGETS)
get_target_property(_dir ${_target} INSTALL_DESTINATION)
__java_export_jar(__targetdefs__ ${_target} "\${_prefix}/${_dir}")
endforeach()
diff --git a/config/cmake/UseJavaClassFilelist.cmake b/config/cmake/UseJavaClassFilelist.cmake
index 4420550..b98276f 100644
--- a/config/cmake/UseJavaClassFilelist.cmake
+++ b/config/cmake/UseJavaClassFilelist.cmake
@@ -1,16 +1,17 @@
# Distributed under the OSI-approved BSD 3-Clause License. See https://cmake.org/licensing for details.
-#.rst:
-# UseJavaClassFilelist
-# --------------------
-#
-#
-#
-#
-#
-# This script create a list of compiled Java class files to be added to
-# a jar file. This avoids including cmake files which get created in
-# the binary directory.
+#[=======================================================================[.rst:
+UseJavaClassFilelist
+--------------------
+
+
+
+
+
+This script create a list of compiled Java class files to be added to
+a jar file. This avoids including cmake files which get created in
+the binary directory.
+#]=======================================================================]
if (CMAKE_JAVA_CLASS_OUTPUT_PATH)
if (EXISTS "${CMAKE_JAVA_CLASS_OUTPUT_PATH}")
diff --git a/config/cmake/UseJavaSymlinks.cmake b/config/cmake/UseJavaSymlinks.cmake
index cd73348..a4db5c1 100644
--- a/config/cmake/UseJavaSymlinks.cmake
+++ b/config/cmake/UseJavaSymlinks.cmake
@@ -1,14 +1,15 @@
# Distributed under the OSI-approved BSD 3-Clause License. See https://cmake.org/licensing for details.
-#.rst:
-# UseJavaSymlinks
-# ---------------
-#
-#
-#
-#
-#
-# Helper script for UseJava.cmake
+#[=======================================================================[.rst:
+UseJavaSymlinks
+---------------
+
+
+
+
+
+Helper script for UseJava.cmake
+#]=======================================================================]
if (UNIX AND _JAVA_TARGET_OUTPUT_LINK)
if (_JAVA_TARGET_OUTPUT_NAME)
diff --git a/config/cmake/cacheinit.cmake b/config/cmake/cacheinit.cmake
index d5c5e52..5254115 100644
--- a/config/cmake/cacheinit.cmake
+++ b/config/cmake/cacheinit.cmake
@@ -19,6 +19,8 @@ set (CMAKE_INSTALL_FRAMEWORK_PREFIX "Library/Frameworks" CACHE STRING "Framework
set (HDF_PACKAGE_EXT "" CACHE STRING "Name of HDF package extension" FORCE)
+set (HDF_PACKAGE_NAMESPACE "hdf5::" CACHE STRING "Name for HDF package namespace (can be empty)" FORCE)
+
set (HDF5_BUILD_FORTRAN ON CACHE BOOL "Build FORTRAN support" FORCE)
set (HDF5_BUILD_GENERATORS ON CACHE BOOL "Build Test Generators" FORCE)
diff --git a/config/cmake/hdf5-config-version.cmake.in b/config/cmake/hdf5-config-version.cmake.in
index 8e16725..575c1ab 100644
--- a/config/cmake/hdf5-config-version.cmake.in
+++ b/config/cmake/hdf5-config-version.cmake.in
@@ -21,38 +21,38 @@
set (PACKAGE_VERSION "@HDF5_VERSION_STRING@")
-if("${PACKAGE_VERSION}" VERSION_LESS "${PACKAGE_FIND_VERSION}" )
+if(PACKAGE_VERSION VERSION_LESS PACKAGE_FIND_VERSION)
set(PACKAGE_VERSION_COMPATIBLE FALSE)
-else ()
- if ("${PACKAGE_FIND_VERSION_MAJOR}" STREQUAL "@H5_VERS_MAJOR@")
+else()
+ if("@H5_VERS_MAJOR@.@H5_VERS_MINOR@" MATCHES "^([0-9]+)\\.([0-9]+)")
+ set(CVF_VERSION_MAJOR "${CMAKE_MATCH_1}")
+ set(CVF_VERSION_MINOR "${CMAKE_MATCH_2}")
+ else()
+ set(CVF_VERSION_MAJOR "@HDF5_VERSION_STRING@")
+ set(CVF_VERSION_MINOR "")
+ endif()
+
+ if((PACKAGE_FIND_VERSION_MAJOR STREQUAL CVF_VERSION_MAJOR) AND
+ (PACKAGE_FIND_VERSION_MINOR STREQUAL CVF_VERSION_MINOR))
+ set(PACKAGE_VERSION_COMPATIBLE TRUE)
+ else()
+ set(PACKAGE_VERSION_COMPATIBLE FALSE)
+ endif()
+
+ if(PACKAGE_FIND_VERSION STREQUAL PACKAGE_VERSION)
+ set(PACKAGE_VERSION_EXACT TRUE)
+ endif()
+endif()
- # exact match for version @H5_VERS_MAJOR@.@H5_VERS_MINOR@
- if ("${PACKAGE_FIND_VERSION_MINOR}" STREQUAL "@H5_VERS_MINOR@")
-
- # compatible with any version @H5_VERS_MAJOR@.@H5_VERS_MINOR@.x
- set (PACKAGE_VERSION_COMPATIBLE TRUE)
-
- if ("${PACKAGE_FIND_VERSION_PATCH}" STREQUAL "@H5_VERS_RELEASE@")
- set (PACKAGE_VERSION_EXACT TRUE)
-
- if ("${PACKAGE_FIND_VERSION_TWEAK}" STREQUAL "@H5_VERS_SUBRELEASE@")
- # not using this yet
- endif ()
- endif ()
- else ()
- set (PACKAGE_VERSION_COMPATIBLE FALSE)
- endif ()
- endif ()
-endif ()
# if the installed or the using project don't have CMAKE_SIZEOF_VOID_P set, ignore it:
-if("${CMAKE_SIZEOF_VOID_P}" STREQUAL "" OR "@CMAKE_SIZEOF_VOID_P@" STREQUAL "")
+if("${CMAKE_SIZEOF_VOID_P}" STREQUAL "" OR "@CMAKE_SIZEOF_VOID_P@" STREQUAL "")
return()
-endif ()
+endif()
# check that the installed version has the same 32/64bit-ness as the one which is currently searching:
-if(NOT "${CMAKE_SIZEOF_VOID_P}" STREQUAL "@CMAKE_SIZEOF_VOID_P@")
+if(NOT CMAKE_SIZEOF_VOID_P STREQUAL "@CMAKE_SIZEOF_VOID_P@")
math(EXPR installedBits "@CMAKE_SIZEOF_VOID_P@ * 8")
set(PACKAGE_VERSION "${PACKAGE_VERSION} (${installedBits}bit)")
set(PACKAGE_VERSION_UNSUITABLE TRUE)
-endif ()
+endif()
diff --git a/config/cmake/hdf5-config.cmake.in b/config/cmake/hdf5-config.cmake.in
index e687a58..1803117 100644
--- a/config/cmake/hdf5-config.cmake.in
+++ b/config/cmake/hdf5-config.cmake.in
@@ -38,13 +38,17 @@ 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@)
-set (${HDF5_PACKAGE_NAME}_BUILD_SHARED_LIBS @BUILD_SHARED_LIBS@)
+set (${HDF5_PACKAGE_NAME}_BUILD_SHARED_LIBS @H5_ENABLE_SHARED_LIB@)
+set (${HDF5_PACKAGE_NAME}_BUILD_STATIC_LIBS @H5_ENABLE_STATIC_LIB@)
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
@@ -105,10 +109,10 @@ set (HDF5_VERSION_MINOR @HDF5_VERSION_MINOR@)
# project which has already built hdf5 as a subproject
#-----------------------------------------------------------------------------
if (NOT TARGET "@HDF5_PACKAGE@")
- if (${HDF5_PACKAGE_NAME}_ENABLE_Z_LIB_SUPPORT AND ${HDF5_PACKAGE_NAME}_PACKAGE_EXTLIBS AND NOT TARGET "zlib")
+ if (${HDF5_PACKAGE_NAME}_ENABLE_Z_LIB_SUPPORT AND ${HDF5_PACKAGE_NAME}_PACKAGE_EXTLIBS)
include (@PACKAGE_SHARE_INSTALL_DIR@/@ZLIB_PACKAGE_NAME@/@ZLIB_PACKAGE_NAME@@HDF_PACKAGE_EXT@-targets.cmake)
endif ()
- if (${HDF5_PACKAGE_NAME}_ENABLE_SZIP_SUPPORT AND ${HDF5_PACKAGE_NAME}_PACKAGE_EXTLIBS AND NOT TARGET "szip")
+ if (${HDF5_PACKAGE_NAME}_ENABLE_SZIP_SUPPORT AND ${HDF5_PACKAGE_NAME}_PACKAGE_EXTLIBS)
include (@PACKAGE_SHARE_INSTALL_DIR@/@SZIP_PACKAGE_NAME@/@SZIP_PACKAGE_NAME@@HDF_PACKAGE_EXT@-targets.cmake)
endif ()
include (@PACKAGE_SHARE_INSTALL_DIR@/@HDF5_PACKAGE@/@HDF5_PACKAGE@@HDF_PACKAGE_EXT@-targets.cmake)
@@ -116,22 +120,28 @@ endif ()
# Handle default component(static) :
if (NOT ${HDF5_PACKAGE_NAME}_FIND_COMPONENTS)
+ if (${HDF5_PACKAGE_NAME}_BUILD_STATIC_LIBS)
set (${HDF5_PACKAGE_NAME}_LIB_TYPE)
set (${HDF5_PACKAGE_NAME}_FIND_COMPONENTS C HL static)
set (${HDF5_PACKAGE_NAME}_FIND_REQUIRED_static_C true)
+ else ()
+ set (${HDF5_PACKAGE_NAME}_LIB_TYPE)
+ set (${HDF5_PACKAGE_NAME}_FIND_COMPONENTS C HL shared)
+ set (${HDF5_PACKAGE_NAME}_FIND_REQUIRED_shared_C true)
+ endif ()
endif ()
# Handle requested components:
list (REMOVE_DUPLICATES ${HDF5_PACKAGE_NAME}_FIND_COMPONENTS)
foreach (comp IN LISTS ${HDF5_PACKAGE_NAME}_FIND_COMPONENTS)
- if (${comp} STREQUAL "shared")
+ if (comp STREQUAL "shared")
list (REMOVE_ITEM ${HDF5_PACKAGE_NAME}_FIND_COMPONENTS ${comp})
set (${HDF5_PACKAGE_NAME}_LIB_TYPE ${${HDF5_PACKAGE_NAME}_LIB_TYPE} ${comp})
if (${HDF5_PACKAGE_NAME}_BUILD_FORTRAN)
set (${HDF5_PACKAGE_NAME}_INCLUDE_DIR_FORTRAN "@PACKAGE_INCLUDE_INSTALL_DIR@/shared")
endif ()
- elseif (${comp} STREQUAL "static")
+ elseif (comp STREQUAL "static")
list (REMOVE_ITEM ${HDF5_PACKAGE_NAME}_FIND_COMPONENTS ${comp})
set (${HDF5_PACKAGE_NAME}_LIB_TYPE ${${HDF5_PACKAGE_NAME}_LIB_TYPE} ${comp})
@@ -143,32 +153,32 @@ endforeach ()
foreach (libtype IN LISTS ${HDF5_PACKAGE_NAME}_LIB_TYPE)
foreach (comp IN LISTS ${HDF5_PACKAGE_NAME}_FIND_COMPONENTS)
set (hdf5_comp2)
- if (${comp} STREQUAL "C")
+ if (comp STREQUAL "C")
set (hdf5_comp "hdf5")
- elseif (${comp} STREQUAL "CXX")
+ elseif (comp STREQUAL "CXX")
set (hdf5_comp "hdf5_cpp")
- elseif (${comp} STREQUAL "HL")
+ elseif (comp STREQUAL "HL")
set (hdf5_comp "hdf5_hl")
- elseif (${comp} STREQUAL "CXX_HL")
+ elseif (comp STREQUAL "CXX_HL")
set (hdf5_comp "hdf5_hl_cpp")
- elseif (${comp} STREQUAL "Java")
+ elseif (comp STREQUAL "Java")
set (hdf5_comp "hdf5_java")
- elseif (${comp} STREQUAL "Tools")
+ elseif (comp STREQUAL "Tools")
set (hdf5_comp "hdf5_tools")
- elseif (${comp} STREQUAL "Fortran")
+ elseif (comp STREQUAL "Fortran")
set (hdf5_comp2 "hdf5_f90cstub")
set (hdf5_comp "hdf5_fortran")
- elseif (${comp} STREQUAL "Fortran_HL")
+ elseif (comp STREQUAL "Fortran_HL")
set (hdf5_comp2 "hdf5_hl_f90cstub")
set (hdf5_comp "hdf5_hl_fortran")
endif ()
- if (${comp} STREQUAL "Java")
+ if (comp STREQUAL "Java")
list (FIND ${HDF5_PACKAGE_NAME}_EXPORT_LIBRARIES "${hdf5_comp}" HAVE_COMP)
else ()
list (FIND ${HDF5_PACKAGE_NAME}_EXPORT_LIBRARIES "${hdf5_comp}-${libtype}" HAVE_COMP)
endif ()
if (${HAVE_COMP} LESS 0)
- if (${comp} STREQUAL "Java")
+ if (comp STREQUAL "Java")
set (${HDF5_PACKAGE_NAME}_${comp}_FOUND 0)
else ()
set (${HDF5_PACKAGE_NAME}_${libtype}_${comp}_FOUND 0)
@@ -183,7 +193,7 @@ foreach (libtype IN LISTS ${HDF5_PACKAGE_NAME}_LIB_TYPE)
string(TOUPPER ${HDF5_PACKAGE_NAME}_${comp}_${libtype}_LIBRARY COMP_LIBRARY)
set (${COMP_LIBRARY} ${${COMP_LIBRARY}} @HDF5_PACKAGE@::${hdf5_comp2}-${libtype} @HDF5_PACKAGE@::${hdf5_comp}-${libtype})
endif ()
- elseif (${comp} STREQUAL "Java")
+ elseif (comp STREQUAL "Java")
set (${HDF5_PACKAGE_NAME}_${comp}_FOUND 1)
string(TOUPPER ${HDF5_PACKAGE_NAME}_${comp}_LIBRARY COMP_LIBRARY)
set (${COMP_LIBRARY} ${${COMP_LIBRARY}} hdf5::${hdf5_comp})
diff --git a/config/cmake/jrunTest.cmake b/config/cmake/jrunTest.cmake
index 23f297c..44ac15b 100644
--- a/config/cmake/jrunTest.cmake
+++ b/config/cmake/jrunTest.cmake
@@ -9,7 +9,7 @@
# If you do not have access to either file, you may request a copy from
# help@hdfgroup.org.
#
-# runTest.cmake executes a command and captures the output in a file. File is then compared
+# jrunTest.cmake executes a command and captures the output in a file. File is then compared
# against a reference file. Exit status of command can also be compared.
cmake_policy(SET CMP0007 NEW)
@@ -24,7 +24,7 @@ if (NOT TEST_LIBRARY_DIRECTORY)
message (STATUS "Require TEST_LIBRARY_DIRECTORY to be defined")
endif ()
if (NOT TEST_FOLDER)
- message ( FATAL_ERROR "Require TEST_FOLDER to be defined")
+ message (FATAL_ERROR "Require TEST_FOLDER to be defined")
endif ()
if (NOT TEST_OUTPUT)
message (FATAL_ERROR "Require TEST_OUTPUT to be defined")
@@ -51,6 +51,8 @@ message (STATUS "COMMAND: ${TEST_TESTER} -Xmx1024M -Dorg.slf4j.simpleLogger.defa
if (WIN32 AND NOT MINGW)
set (ENV{PATH} "$ENV{PATH}\\;${TEST_LIBRARY_DIRECTORY}")
+else ()
+ set (ENV{LD_LIBRARY_PATH} "$ENV{LD_LIBRARY_PATH}:${TEST_LIBRARY_DIRECTORY}")
endif ()
# run the test program, capture the stdout/stderr and the result var
@@ -64,6 +66,7 @@ execute_process (
RESULT_VARIABLE TEST_RESULT
OUTPUT_FILE ${TEST_OUTPUT}
ERROR_FILE ${TEST_OUTPUT}.err
+ OUTPUT_VARIABLE TEST_OUT
ERROR_VARIABLE TEST_ERROR
)
@@ -126,11 +129,22 @@ if (NOT TEST_SKIP_COMPARE)
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_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 ()
+
if (TEST_RESULT)
set (TEST_RESULT 0)
file (STRINGS ${TEST_FOLDER}/${TEST_OUTPUT} test_act)
@@ -142,10 +156,10 @@ if (NOT TEST_SKIP_COMPARE)
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 (str_act)
set (TEST_RESULT 1)
- message ("line = ${line}\n***ACTUAL: ${str_act}\n****REFER: ${str_ref}\n")
+ message (STATUS "line = ${line}\n***ACTUAL: ${str_act}\n****REFER: ${str_ref}\n")
endif ()
endif ()
endforeach ()
@@ -194,10 +208,10 @@ if (NOT TEST_SKIP_COMPARE)
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 (str_act)
set (TEST_RESULT 1)
- message ("line = ${line}\n***ACTUAL: ${str_act}\n****REFER: ${str_ref}\n")
+ message (STATUS "line = ${line}\n***ACTUAL: ${str_act}\n****REFER: ${str_ref}\n")
endif ()
endif ()
endforeach ()
@@ -245,5 +259,5 @@ if (TEST_GREP_COMPARE)
endif ()
# everything went fine...
-message ("${TEST_PROGRAM} Passed")
+message (STATUS "${TEST_PROGRAM} Passed")
diff --git a/config/cmake/libhdf5.settings.cmake.in b/config/cmake/libhdf5.settings.cmake.in
index 9a534df..9e91ac0 100644
--- a/config/cmake/libhdf5.settings.cmake.in
+++ b/config/cmake/libhdf5.settings.cmake.in
@@ -32,7 +32,7 @@ Linking Options:
Languages:
----------
- C: yes
+ C: YES
C Compiler: @CMAKE_C_COMPILER@ @CMAKE_C_COMPILER_VERSION@
CPPFLAGS: @CPPFLAGS@
H5_CPPFLAGS: @H5_CPPFLAGS@
@@ -41,7 +41,7 @@ Languages:
H5_CFLAGS: @H5_CFLAGS@
AM_CFLAGS: @AM_CFLAGS@
Shared C Library: @H5_ENABLE_SHARED_LIB@
- Static C Library: YES
+ Static C Library: @H5_ENABLE_STATIC_LIB@
Fortran: @HDF5_BUILD_FORTRAN@
@BUILD_FORTRAN_CONDITIONAL_TRUE@ Fortran Compiler: @CMAKE_Fortran_COMPILER@ @CMAKE_Fortran_COMPILER_VERSION@
@@ -49,7 +49,7 @@ Languages:
@BUILD_FORTRAN_CONDITIONAL_TRUE@ H5 Fortran Flags: @H5_FCFLAGS@
@BUILD_FORTRAN_CONDITIONAL_TRUE@ AM Fortran Flags: @AM_FCFLAGS@
@BUILD_FORTRAN_CONDITIONAL_TRUE@ Shared Fortran Library: @H5_ENABLE_SHARED_LIB@
-@BUILD_FORTRAN_CONDITIONAL_TRUE@ Static Fortran Library: YES
+@BUILD_FORTRAN_CONDITIONAL_TRUE@ Static Fortran Library: @H5_ENABLE_STATIC_LIB@
C++: @HDF5_BUILD_CPP_LIB@
@BUILD_CXX_CONDITIONAL_TRUE@ C++ Compiler: @CMAKE_CXX_COMPILER@ @CMAKE_CXX_COMPILER_VERSION@
@@ -57,10 +57,10 @@ Languages:
@BUILD_CXX_CONDITIONAL_TRUE@ H5 C++ Flags: @H5_CXXFLAGS@
@BUILD_CXX_CONDITIONAL_TRUE@ AM C++ Flags: @AM_CXXFLAGS@
@BUILD_CXX_CONDITIONAL_TRUE@ Shared C++ Library: @H5_ENABLE_SHARED_LIB@
-@BUILD_CXX_CONDITIONAL_TRUE@ Static C++ Library: YES
+@BUILD_CXX_CONDITIONAL_TRUE@ Static C++ Library: @H5_ENABLE_STATIC_LIB@
JAVA: @HDF5_BUILD_JAVA@
-@BUILD_JAVA_CONDITIONAL_TRUE@ JAVA Compiler: @CMAKE_Java_COMPILER@ @Java_VERSION@
+@BUILD_JAVA_CONDITIONAL_TRUE@ JAVA Compiler: @CMAKE_Java_COMPILER@ @Java_VERSION@
Features:
---------
diff --git a/config/cmake/mccacheinit.cmake b/config/cmake/mccacheinit.cmake
index 577144b..c35f51f 100644
--- a/config/cmake/mccacheinit.cmake
+++ b/config/cmake/mccacheinit.cmake
@@ -23,6 +23,8 @@ set (BUILD_TESTING ON CACHE BOOL "Build HDF5 Unit Testing" FORCE)
set (HDF_PACKAGE_EXT "" CACHE STRING "Name of HDF package extension" FORCE)
+set (HDF_PACKAGE_NAMESPACE "hdf5::" CACHE STRING "Name for HDF package namespace" FORCE)
+
set (HDF5_BUILD_CPP_LIB ON CACHE BOOL "Build HDF5 C++ Library" FORCE)
set (HDF5_BUILD_EXAMPLES ON CACHE BOOL "Build HDF5 Library Examples" FORCE)
diff --git a/config/cmake/scripts/CTestScript.cmake b/config/cmake/scripts/CTestScript.cmake
index 0e2afc7..e1fe85a 100644
--- a/config/cmake/scripts/CTestScript.cmake
+++ b/config/cmake/scripts/CTestScript.cmake
@@ -257,7 +257,7 @@ message (STATUS "Dashboard script configuration:\n${vars}\n")
# 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
+ # 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})
@@ -277,11 +277,15 @@ message (STATUS "Dashboard script configuration:\n${vars}\n")
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")
+ 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 ()
+ if (LOCAL_BATCH_SCRIPT_COMMAND STREQUAL "qsub")
+ execute_process (COMMAND ${CTEST_BINARY_DIRECTORY}/${LOCAL_BATCH_SCRIPT_NAME} ctestS.out)
+ else ()
+ execute_process (COMMAND ${LOCAL_BATCH_SCRIPT_COMMAND} ${LOCAL_BATCH_SCRIPT_ARGS} ${CTEST_BINARY_DIRECTORY}/${LOCAL_BATCH_SCRIPT_NAME})
+ endif()
+ 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)
@@ -296,10 +300,14 @@ message (STATUS "Dashboard script configuration:\n${vars}\n")
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")
+ 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})
+ if (LOCAL_BATCH_SCRIPT_COMMAND STREQUAL "qsub")
+ execute_process (COMMAND ${CTEST_BINARY_DIRECTORY}/${LOCAL_BATCH_SCRIPT_NAME} ctestP.out)
+ else ()
+ execute_process (COMMAND ${LOCAL_BATCH_SCRIPT_COMMAND} ${LOCAL_BATCH_SCRIPT_ARGS} ${CTEST_BINARY_DIRECTORY}/${LOCAL_BATCH_SCRIPT_PARALLEL_NAME})
+ endif ()
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)
diff --git a/config/cmake/scripts/HDF5config.cmake b/config/cmake/scripts/HDF5config.cmake
index 1d8d501..44ed531 100644
--- a/config/cmake/scripts/HDF5config.cmake
+++ b/config/cmake/scripts/HDF5config.cmake
@@ -34,7 +34,7 @@ cmake_minimum_required (VERSION 3.10)
# CTEST_SOURCE_NAME - source folder
##############################################################################
-set (CTEST_SOURCE_VERSION "1.11.4")
+set (CTEST_SOURCE_VERSION "1.11.6")
set (CTEST_SOURCE_VERSEXT "")
##############################################################################
@@ -44,6 +44,8 @@ set (CTEST_SOURCE_VERSEXT "")
#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, qsub
+#MPI - enable MPI;
if (DEFINED CTEST_SCRIPT_ARG)
# transform ctest script arguments of the form
# script.ctest,var1=value1,var2=value2
@@ -56,6 +58,11 @@ if (DEFINED CTEST_SCRIPT_ARG)
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")
@@ -93,77 +100,85 @@ 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")
+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 ()
- message (FATAL_ERROR "Invalid BUILD_GENERATOR must be - Unix, VS2017, or VS201764, VS2015, VS201564, VS2013, VS201364")
+ 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 ()
-## Set the following to unique id your computer ##
- set (CTEST_SITE "WIN7${BUILD_GENERATOR}.XXXX")
else ()
+ set (CTEST_SITE "${SITE_OS_NAME}")
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 ()
###################################################################
@@ -213,6 +228,9 @@ if (WIN32)
else ()
set (BINFILEBASE "HDF5-${CTEST_SOURCE_VERSION}${CTEST_SOURCE_VERSEXT}")
include (${CTEST_SCRIPT_DIRECTORY}/HDF5options.cmake)
+ if (DEFINED HPC)
+ include (${CTEST_SOURCE_DIRECTORY}/config/cmake/scripts/HPC/${HPC}-HDF5options.cmake)
+ endif ()
include (${CTEST_SCRIPT_DIRECTORY}/CTestScript.cmake)
if (APPLE)
if (EXISTS "${CTEST_BINARY_DIRECTORY}/${BINFILEBASE}-Darwin.dmg")
diff --git a/config/cmake/scripts/HDF5options.cmake b/config/cmake/scripts/HDF5options.cmake
index 45877d7..738c6c4 100644
--- a/config/cmake/scripts/HDF5options.cmake
+++ b/config/cmake/scripts/HDF5options.cmake
@@ -27,7 +27,9 @@
#############################################################################################
#### Only build static libraries ####
#set (ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DBUILD_SHARED_LIBS:BOOL=OFF")
-#### Add PICC option on linux/mac ####
+#### Only build shared libraries ####
+#set (ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DONLY_SHARED_LIBS:BOOL=OFF")
+#### Add PIC option on linux/mac ####
#set (ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DCMAKE_ANSI_CFLAGS:STRING=-fPIC")
#############################################################################################
@@ -69,12 +71,12 @@ set (ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DHDF5_ALLOW_EXTERNAL_SUPPORT:STRIN
#############################################################################################
### 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")
-
+if (DEFINED MPI)
+ 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()
#############################################################################################
### enable thread-safety builds
diff --git a/config/cmake/scripts/HPC/bsub-HDF5options.cmake b/config/cmake/scripts/HPC/bsub-HDF5options.cmake
new file mode 100644
index 0000000..7473e8a
--- /dev/null
+++ b/config/cmake/scripts/HPC/bsub-HDF5options.cmake
@@ -0,0 +1,31 @@
+#
+# 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") ###
+#############################################################################################
+if (DEFINED MPI)
+ # maximum parallel processor count for build and test ####
+ set (MAX_PROC_COUNT 8)
+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/par-HDF5options.cmake b/config/cmake/scripts/HPC/par-HDF5options.cmake
deleted file mode 100644
index c7b22b9..0000000
--- a/config/cmake/scripts/HPC/par-HDF5options.cmake
+++ /dev/null
@@ -1,126 +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.
-#
-#############################################################################################
-#### 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
-
-#############################################################################################
-#### maximum parallel processor count for build and test ####
-set (MAX_PROC_COUNT 8)
-
-#############################################################################################
-#### alternate toolsets ####
-#set (CMAKE_GENERATOR_TOOLSET "Intel C++ Compiler 17.0")
-
-#############################################################################################
-#### Only build static libraries ####
-#set (ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DBUILD_SHARED_LIBS:BOOL=OFF")
-#### Add PICC option on linux/mac ####
-#set (ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DCMAKE_ANSI_CFLAGS:STRING=-fPIC")
-
-#############################################################################################
-#### fortran enabled ####
-set (ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DHDF5_BUILD_FORTRAN:BOOL=ON")
-#### fortran disabled ####
-#set (ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DHDF5_BUILD_FORTRAN:BOOL=OFF")
-
-#############################################################################################
-#### java enabled ####
-#set (ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DHDF5_BUILD_JAVA:BOOL=ON")
-#### java disabled ####
-set (ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DHDF5_BUILD_JAVA:BOOL=OFF")
-
-#############################################################################################
-### change install prefix (default use INSTALLDIR value)
-set (ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DCMAKE_INSTALL_PREFIX:PATH=${INSTALLDIR}")
-
-#############################################################################################
-#### ext libraries ####
-
-### ext libs from tgz
-#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")
-### ext libs on system
-#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 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.12.4-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")
-
-#############################################################################################
-### 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")
-
-#############################################################################################
-### disable test program builds
-
-#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")
-### Create install package with external libraries (szip, zlib)
-set (ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DHDF5_PACKAGE_EXTLIBS:BOOL=ON")
-
-
-#options to run test scripts in batch commands
-set (LOCAL_BATCH_SCRIPT_COMMAND "sbatch")
-set (LOCAL_BATCH_TEST "TRUE")
-set (LOCAL_BATCH_SCRIPT_NAME "ctestS.sl")
-set (LOCAL_BATCH_SCRIPT_PARALLEL_NAME "ctestP.sl")
-set (ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DLOCAL_BATCH_TEST:BOOL=ON")
-set (ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DLOCAL_BATCH_SCRIPT_NAME:STRING=ctestS.sl")
-set (ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DLOCAL_BATCH_SCRIPT_PARALLEL_NAME:STRING=ctestP.sl")
-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")
-
-
-#############################################################################################
-### use a toolchain file
-
-#set (ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DCMAKE_TOOLCHAIN_FILE:STRING=config/toolchain/crayle.cmake")
-#set (ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DCMAKE_TOOLCHAIN_FILE:STRING=config/toolchain/intel.cmake")
-#set (ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DCMAKE_TOOLCHAIN_FILE:STRING=config/toolchain/GCC.cmake")
-
-#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 (SITE_BUILDNAME_SUFFIX "knl-intel17-SHARED"
-#set (ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DLOCAL_BATCH_SCRIPT_NAME:STRING=knl_ctestS.sl")
-#set (ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DLOCAL_BATCH_SCRIPT_PARALLEL_NAME:STRING=knl_ctestP.sl")
-#############################################################################################
diff --git a/config/cmake/scripts/HPC/qsub-HDF5options.cmake b/config/cmake/scripts/HPC/qsub-HDF5options.cmake
new file mode 100644
index 0000000..34eba1b
--- /dev/null
+++ b/config/cmake/scripts/HPC/qsub-HDF5options.cmake
@@ -0,0 +1,42 @@
+#
+# 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") ###
+#############################################################################################
+if (DEFINED MPI)
+ # maximum parallel processor count for build and test ####
+ set (MAX_PROC_COUNT 8)
+endif()
+#############################################################################################
+### options to run test scripts in batch commands
+set (LOCAL_BATCH_SCRIPT_NAME "ctest.qsub")
+set (LOCAL_BATCH_SCRIPT_PARALLEL_NAME "ctest.qsub")
+if (DEFINED KNL)
+ ### some additions and alternatives to cross compile on haswell for knl
+ set (COMPUTENODE_HWCOMPILE_MODULE "craype-mic-knl")
+ set (ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DCMAKE_TOOLCHAIN_FILE:STRING=config/toolchain/crayle.cmake")
+endif ()
+set (LOCAL_BATCH_SCRIPT_COMMAND "qsub")
+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=aprun")
+# Option to suppress writing job statistics; to avoid issues with h5diff comparisons.
+set (ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DMPIEXEC_PREFLAGS:STRING=-q")
+set (ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DMPIEXEC_NUMPROC_FLAG:STRING=-n")
+set (ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DMPIEXEC_MAX_NUMPROCS:STRING=6")
+set (ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DACCOUNT_ID:STRING=${LOCAL_BATCH_SCRIPT_ARGS}")
+
+#############################################################################################
+#############################################################################################
diff --git a/config/cmake/scripts/HPC/raybsub-HDF5options.cmake b/config/cmake/scripts/HPC/raybsub-HDF5options.cmake
new file mode 100644
index 0000000..fa1ec4a
--- /dev/null
+++ b/config/cmake/scripts/HPC/raybsub-HDF5options.cmake
@@ -0,0 +1,32 @@
+#
+# 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") ###
+#############################################################################################
+if (DEFINED MPI)
+ # maximum parallel processor count for build and test ####
+ set (MAX_PROC_COUNT 8)
+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..3205a1c
--- /dev/null
+++ b/config/cmake/scripts/HPC/sbatch-HDF5options.cmake
@@ -0,0 +1,43 @@
+#
+# 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") ###
+#############################################################################################
+if (DEFINED MPI)
+ # maximum parallel processor count for build and test ####
+ set (MAX_PROC_COUNT 8)
+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/scripts/HPC/ser-HDF5options.cmake b/config/cmake/scripts/HPC/ser-HDF5options.cmake
deleted file mode 100644
index 7f2e96f..0000000
--- a/config/cmake/scripts/HPC/ser-HDF5options.cmake
+++ /dev/null
@@ -1,119 +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.
-#
-#############################################################################################
-#### 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
-
-#############################################################################################
-#### maximum parallel processor count for build and test ####
-#set (MAX_PROC_COUNT 8)
-
-#############################################################################################
-#### alternate toolsets ####
-#set (CMAKE_GENERATOR_TOOLSET "Intel C++ Compiler 17.0")
-
-#############################################################################################
-#### Only build static libraries ####
-#set (ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DBUILD_SHARED_LIBS:BOOL=OFF")
-#### Add PICC option on linux/mac ####
-#set (ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DCMAKE_ANSI_CFLAGS:STRING=-fPIC")
-
-#############################################################################################
-#### fortran enabled ####
-#set (ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DHDF5_BUILD_FORTRAN:BOOL=ON")
-#### fortran disabled ####
-set (ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DHDF5_BUILD_FORTRAN:BOOL=OFF")
-
-#############################################################################################
-#### java enabled ####
-#set (ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DHDF5_BUILD_JAVA:BOOL=ON")
-#### java disabled ####
-set (ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DHDF5_BUILD_JAVA:BOOL=OFF")
-
-#############################################################################################
-### change install prefix (default use INSTALLDIR value)
-set (ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DCMAKE_INSTALL_PREFIX:PATH=${INSTALLDIR}")
-
-#############################################################################################
-#### ext libraries ####
-
-### ext libs from tgz
-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")
-### ext libs on system
-#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 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.12.4-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")
-
-#############################################################################################
-### 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")
-
-#############################################################################################
-### disable test program builds
-
-#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")
-### Create install package with external libraries (szip, zlib)
-set (ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DHDF5_PACKAGE_EXTLIBS:BOOL=ON")
-
-#options to run test scripts in batch commands
-set (LOCAL_BATCH_SCRIPT_COMMAND "sbatch")
-set (LOCAL_BATCH_TEST "TRUE")
-set (LOCAL_BATCH_SCRIPT_NAME "ctestS.sl")
-set (ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DLOCAL_BATCH_TEST:BOOL=ON")
-set (ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DLOCAL_BATCH_SCRIPT_NAME:STRING=ctestS.sl")
-
-#############################################################################################
-### use a toolchain file
-
-#set (ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DCMAKE_TOOLCHAIN_FILE:STRING=config/toolchain/intel.cmake")
-#set (ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DCMAKE_TOOLCHAIN_FILE:STRING=config/toolchain/crayle.cmake")
-#set (ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DCMAKE_TOOLCHAIN_FILE:STRING=config/toolchain/GCC.cmake")
-
-#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 (SITE_BUILDNAME_SUFFIX "knl-intel17-SHARED"
-#set (ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DLOCAL_BATCH_SCRIPT_NAME:STRING=knl_ctestS.sl")
-
-#############################################################################################
diff --git a/config/cmake/userblockTest.cmake b/config/cmake/userblockTest.cmake
index 9af7e5b..0e9d01b 100644
--- a/config/cmake/userblockTest.cmake
+++ b/config/cmake/userblockTest.cmake
@@ -20,7 +20,7 @@ if (NOT TEST_GET_PROGRAM)
message (FATAL_ERROR "Require TEST_GET_PROGRAM getub to be defined")
endif ()
if (NOT TEST_FOLDER)
- message ( FATAL_ERROR "Require TEST_FOLDER to be defined")
+ message (FATAL_ERROR "Require TEST_FOLDER to be defined")
endif ()
if (NOT TEST_HFILE)
message (FATAL_ERROR "Require TEST_HFILE the hdf file to be defined")
@@ -62,7 +62,7 @@ if (TEST_CHECKUB STREQUAL "YES")
OUTPUT_VARIABLE TEST_OUT
ERROR_VARIABLE TEST_ERROR
)
- if (NOT ${TEST_RESULT} STREQUAL "0")
+ if (TEST_RESULT)
message (FATAL_ERROR "Failed: The output of ${TEST_PROGRAM} ${TEST_OFILE} is: ${TEST_ERROR}")
endif ()
file (READ ${TEST_HFILE}.len.txt TEST_O_STRING_LEN)
@@ -70,7 +70,7 @@ if (TEST_CHECKUB STREQUAL "YES")
math( EXPR TEST_STRING_SIZE "${TEST_U_STRING_LEN} + ${TEST_O_STRING_LEN}" )
- if (NOT TEST_O_STRING_LEN STREQUAL "0")
+ if (TEST_O_STRING_LEN)
#$JAM_BIN/getub -c $s2 $origfile > $cmpfile
EXECUTE_PROCESS (
COMMAND ${TEST_GET_PROGRAM} -c ${TEST_O_STRING_LEN} ${TEST_OFILE}
@@ -108,7 +108,7 @@ if (TEST_CHECKUB STREQUAL "YES")
message (STATUS "COMPARE Result: ${TEST_RESULT}: ${TEST_STRING_SIZE}=${TEST_U_STRING_LEN}+${TEST_O_STRING_LEN}")
# if the return value is !=${TEST_EXPECT} bail out
- if (NOT ${TEST_RESULT} STREQUAL ${TEST_EXPECT})
+ if (NOT TEST_RESULT EQUAL TEST_EXPECT)
message (FATAL_ERROR "Failed: The output of ${TEST_HFILE}-ub did not match ${TEST_HFILE}.\n${TEST_ERROR}")
endif ()
else ()
@@ -121,11 +121,11 @@ else ()
OUTPUT_VARIABLE TEST_OUT
ERROR_VARIABLE TEST_ERROR
)
- if (NOT TEST_H_STRING_LEN STREQUAL "0")
+ if (TEST_H_STRING_LEN)
message (FATAL_ERROR "Failed: The output of ${TEST_HFILE} was NOT empty")
endif ()
endif ()
# everything went fine...
-message ("Passed: The output of CHECK matched expectation")
+message (STATUS "Passed: The output of CHECK matched expectation")
diff --git a/config/cmake/vfdTest.cmake b/config/cmake/vfdTest.cmake
index b616958..8e186e9 100644
--- a/config/cmake/vfdTest.cmake
+++ b/config/cmake/vfdTest.cmake
@@ -17,7 +17,7 @@ if (NOT TEST_PROGRAM)
message (FATAL_ERROR "Require TEST_PROGRAM to be defined")
endif ()
if (NOT TEST_FOLDER)
- message ( FATAL_ERROR "Require TEST_FOLDER to be defined")
+ message (FATAL_ERROR "Require TEST_FOLDER to be defined")
endif ()
if (NOT TEST_VFD)
message (FATAL_ERROR "Require TEST_VFD to be defined")
@@ -73,4 +73,4 @@ endif ()
message (STATUS "COMMAND Error: ${TEST_ERROR}")
# everything went fine...
-message ("Passed: The ${TEST_PROGRAM} program used vfd ${TEST_VFD}")
+message (STATUS "Passed: The ${TEST_PROGRAM} program used vfd ${TEST_VFD}")
diff --git a/config/cmake/volTest.cmake b/config/cmake/volTest.cmake
index d8c82a4..a9dd756 100644
--- a/config/cmake/volTest.cmake
+++ b/config/cmake/volTest.cmake
@@ -17,7 +17,7 @@ if (NOT TEST_PROGRAM)
message (FATAL_ERROR "Require TEST_PROGRAM to be defined")
endif ()
if (NOT TEST_FOLDER)
- message ( FATAL_ERROR "Require TEST_FOLDER to be defined")
+ message (FATAL_ERROR "Require TEST_FOLDER to be defined")
endif ()
if (NOT TEST_VOL)
message (FATAL_ERROR "Require TEST_VOL to be defined")
@@ -73,4 +73,4 @@ endif ()
message (STATUS "COMMAND Error: ${TEST_ERROR}")
# everything went fine...
-message ("Passed: The ${TEST_PROGRAM} program used vol ${TEST_VOL}")
+message (STATUS "Passed: The ${TEST_PROGRAM} program used vol ${TEST_VOL}")
diff --git a/config/cmake_ext_mod/ConfigureChecks.cmake b/config/cmake_ext_mod/ConfigureChecks.cmake
index 986280f..63d9ee9 100644
--- a/config/cmake_ext_mod/ConfigureChecks.cmake
+++ b/config/cmake_ext_mod/ConfigureChecks.cmake
@@ -28,7 +28,7 @@ if (APPLE)
list (LENGTH CMAKE_OSX_ARCHITECTURES ARCH_LENGTH)
if (ARCH_LENGTH GREATER 1)
set (CMAKE_OSX_ARCHITECTURES "" CACHE STRING "" FORCE)
- message(FATAL_ERROR "Building Universal Binaries on OS X is NOT supported by the HDF5 project. This is"
+ message (FATAL_ERROR "Building Universal Binaries on OS X is NOT supported by the HDF5 project. This is"
"due to technical reasons. The best approach would be build each architecture in separate directories"
"and use the 'lipo' tool to combine them into a single executable or library. The 'CMAKE_OSX_ARCHITECTURES'"
"variable has been set to a blank value which will build the default architecture for this system.")
@@ -229,7 +229,7 @@ macro (HDF_FUNCTION_TEST OTHER_TEST)
endif ()
#message (STATUS "Performing ${OTHER_TEST}")
- TRY_COMPILE (${OTHER_TEST}
+ try_compile (${OTHER_TEST}
${CMAKE_BINARY_DIR}
${HDF_RESOURCES_EXT_DIR}/HDFTests.c
COMPILE_DEFINITIONS "${MACRO_CHECK_FUNCTION_DEFINITIONS}"
@@ -274,12 +274,10 @@ 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. Even later, this was changed to 200809L to support
- # pread/pwrite in VFDs.
- #
+ # systems.
# 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=200809L)
+ set (HDF_EXTRA_C_FLAGS -D_POSIX_C_SOURCE=200112L)
# Need to add this so that O_DIRECT is visible for the direct
# VFD on Linux systems.
@@ -288,7 +286,7 @@ if (NOT WINDOWS)
option (HDF_ENABLE_LARGE_FILE "Enable support for large (64-bit) files on Linux." ON)
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
+ try_run (TEST_LFS_WORKS_RUN TEST_LFS_WORKS_COMPILE
${CMAKE_BINARY_DIR}
${HDF_RESOURCES_EXT_DIR}/HDFTests.c
COMPILE_DEFINITIONS "-DTEST_LFS_WORKS"
@@ -445,7 +443,7 @@ if (NOT WINDOWS)
# Check a bunch of time functions
#-----------------------------------------------------------------------------
CHECK_FUNCTION_EXISTS (gettimeofday ${HDF_PREFIX}_HAVE_GETTIMEOFDAY)
- foreach (test
+ foreach (time_test
HAVE_TM_GMTOFF
HAVE___TM_GMTOFF
# HAVE_TIMEZONE
@@ -455,7 +453,7 @@ if (NOT WINDOWS)
HAVE_TM_ZONE
HAVE_STRUCT_TM_TM_ZONE
)
- HDF_FUNCTION_TEST (${test})
+ HDF_FUNCTION_TEST (${time_test})
endforeach ()
if (NOT CYGWIN AND NOT MINGW)
HDF_FUNCTION_TEST (HAVE_TIMEZONE)
@@ -559,7 +557,7 @@ endif ()
# Check a bunch of other functions
#-----------------------------------------------------------------------------
if (NOT WINDOWS)
- foreach (test
+ foreach (other_test
HAVE_ATTRIBUTE
HAVE_C99_FUNC
# STDC_HEADERS
@@ -568,7 +566,7 @@ if (NOT WINDOWS)
SYSTEM_SCOPE_THREADS
HAVE_SOCKLEN_T
)
- HDF_FUNCTION_TEST (${test})
+ HDF_FUNCTION_TEST (${other_test})
endforeach ()
endif ()
@@ -658,7 +656,7 @@ if (NOT ${HDF_PREFIX}_PRINTF_LL_WIDTH OR ${HDF_PREFIX}_PRINTF_LL_WIDTH MATCHES "
set (${HDF_PREFIX}_PRINTF_LL_WIDTH "\"${${HDF_PREFIX}_PRINTF_LL}\"" CACHE INTERNAL "Width for printf for type `long long' or `__int64', us. `ll")
set (PRINT_LL_FOUND 1)
else ()
- message ("Width test failed with result: ${${HDF_PREFIX}_PRINTF_LL_TEST_RUN}")
+ message (STATUS "Width test failed with result: ${${HDF_PREFIX}_PRINTF_LL_TEST_RUN}")
endif ()
else ()
file (APPEND ${CMAKE_BINARY_DIR}/CMakeFiles/CMakeError.log
diff --git a/config/cmake_ext_mod/FindSZIP.cmake b/config/cmake_ext_mod/FindSZIP.cmake
index 699be85..152f8ac 100644
--- a/config/cmake_ext_mod/FindSZIP.cmake
+++ b/config/cmake_ext_mod/FindSZIP.cmake
@@ -9,136 +9,108 @@
# If you do not have access to either file, you may request a copy from
# help@hdfgroup.org.
#
+#########################################################################
+
+# - Derived from the FindTiff.cmake and FindJPEG.cmake that is included with cmake
+# FindSZIP
-# - Find SZIP library
-# - Derived from the FindTiff.cmake that is included with cmake
# Find the native SZIP includes and library
-# This module defines
-# SZIP_INCLUDE_DIRS, where to find tiff.h, etc.
-# SZIP_LIBRARIES, libraries to link against to use SZIP.
-# SZIP_FOUND, If false, do not try to use SZIP.
-# also defined, but not for general use are
-# SZIP_LIBRARY, where to find the SZIP library.
-# SZIP_LIBRARY_DEBUG - Debug version of SZIP library
-# SZIP_LIBRARY_RELEASE - Release Version of SZIP library
-# message (STATUS "Finding SZIP library and headers..." )
+# Imported targets
+##################
-############################################
+# This module defines the following :prop_tgt:`IMPORTED` targets:
#
-# Check the existence of the libraries.
+# SZIP::SZIP
+# The SZIP library, if found.
#
-############################################
-# This macro was taken directly from the FindQt4.cmake file that is included
-# with the CMake distribution. This is NOT my work. All work was done by the
-# original authors of the FindQt4.cmake file. Only minor modifications were
-# made to remove references to Qt and make this file more generally applicable
-#########################################################################
+# Result variables
+###################
-macro (SZIP_ADJUST_LIB_VARS basename)
- if (${basename}_INCLUDE_DIR)
+# This module will set the following variables in your project:
- # if only the release version was found, set the debug variable also to the release version
- if (${basename}_LIBRARY_RELEASE AND NOT ${basename}_LIBRARY_DEBUG)
- set (${basename}_LIBRARY_DEBUG ${${basename}_LIBRARY_RELEASE})
- set (${basename}_LIBRARY ${${basename}_LIBRARY_RELEASE})
- set (${basename}_LIBRARIES ${${basename}_LIBRARY_RELEASE})
- endif ()
+# SZIP_FOUND, true if the SZIP headers and libraries were found.
+# SZIP_INCLUDE_DIR, the directory containing the SZIP headers.
+# SZIP_INCLUDE_DIRS, the directory containing the SZIP headers.
+# SZIP_LIBRARIES, libraries to link against to use SZIP.
- # if only the debug version was found, set the release variable also to the debug version
- if (${basename}_LIBRARY_DEBUG AND NOT ${basename}_LIBRARY_RELEASE)
- set (${basename}_LIBRARY_RELEASE ${${basename}_LIBRARY_DEBUG})
- set (${basename}_LIBRARY ${${basename}_LIBRARY_DEBUG})
- set (${basename}_LIBRARIES ${${basename}_LIBRARY_DEBUG})
- endif ()
- if (${basename}_LIBRARY_DEBUG AND ${basename}_LIBRARY_RELEASE)
- # if the generator supports configuration types then set
- # optimized and debug libraries, or if the CMAKE_BUILD_TYPE has a value
- if (CMAKE_CONFIGURATION_TYPES OR CMAKE_BUILD_TYPE)
- set (${basename}_LIBRARY optimized ${${basename}_LIBRARY_RELEASE} debug ${${basename}_LIBRARY_DEBUG})
- else ()
- # if there are no configuration types and CMAKE_BUILD_TYPE has no value
- # then just use the release libraries
- set (${basename}_LIBRARY ${${basename}_LIBRARY_RELEASE} )
- endif ()
- set (${basename}_LIBRARIES optimized ${${basename}_LIBRARY_RELEASE} debug ${${basename}_LIBRARY_DEBUG})
- endif ()
+# Cache variables
+#################
- set (${basename}_LIBRARY ${${basename}_LIBRARY} CACHE FILEPATH "The ${basename} library")
+# The following variables may also be set:
- if (${basename}_LIBRARY)
- set (${basename}_FOUND 1)
- endif ()
- endif ()
+# SZIP_LIBRARY, where to find the SZIP library.
+# SZIP_LIBRARY_DEBUG - Debug version of SZIP library
+# SZIP_LIBRARY_RELEASE - Release Version of SZIP library
- # Make variables changeble to the advanced user
- MARK_AS_ADVANCED (${basename}_LIBRARY ${basename}_LIBRARY_RELEASE ${basename}_LIBRARY_DEBUG ${basename}_INCLUDE_DIR )
-endmacro ()
-
-
-# Look for the header file.
-set (SZIP_INCLUDE_SEARCH_DIRS
- $ENV{SZIP_INSTALL}/include
- $ENV{SZIP_INSTALL}/include/szip
- /usr/include
- /usr/include/szip
-)
-
-set (SZIP_LIB_SEARCH_DIRS
- $ENV{SZIP_INSTALL}/lib
- /usr/lib
-)
-
-set (SZIP_BIN_SEARCH_DIRS
- $ENV{SZIP_INSTALL}/bin
- /usr/bin
-)
-
-FIND_PATH (SZIP_INCLUDE_DIR
- NAMES szlib.h
- PATHS ${SZIP_INCLUDE_SEARCH_DIRS}
- NO_DEFAULT_PATH
-)
-
-if (WIN32)
- set (SZIP_SEARCH_DEBUG_NAMES "sz_d;libsz_d")
- set (SZIP_SEARCH_RELEASE_NAMES "sz;libsz;libszip")
-else ()
- set (SZIP_SEARCH_DEBUG_NAMES "sz_d")
- set (SZIP_SEARCH_RELEASE_NAMES "sz;szip")
-endif ()
+# message (STATUS "Finding SZIP library and headers..." )
+#########################################################################
-# Look for the library.
-FIND_LIBRARY (SZIP_LIBRARY_DEBUG
- NAMES ${SZIP_SEARCH_DEBUG_NAMES}
- PATHS ${SZIP_LIB_SEARCH_DIRS}
- NO_DEFAULT_PATH
-)
-
-FIND_LIBRARY (SZIP_LIBRARY_RELEASE
- NAMES ${SZIP_SEARCH_RELEASE_NAMES}
- PATHS ${SZIP_LIB_SEARCH_DIRS}
- NO_DEFAULT_PATH
-)
-
-SZIP_ADJUST_LIB_VARS (SZIP)
-
-if (SZIP_INCLUDE_DIR AND SZIP_LIBRARY)
- set (SZIP_FOUND 1)
- set (SZIP_LIBRARIES ${SZIP_LIBRARY})
- set (SZIP_INCLUDE_DIRS ${SZIP_INCLUDE_DIR})
- if (SZIP_LIBRARY_DEBUG)
- get_filename_component (SZIP_LIBRARY_PATH ${SZIP_LIBRARY_DEBUG} PATH)
- set (SZIP_LIB_DIR ${SZIP_LIBRARY_PATH})
- elseif ()
- get_filename_component (SZIP_LIBRARY_PATH ${SZIP_LIBRARY_RELEASE} PATH)
- set (SZIP_LIB_DIR ${SZIP_LIBRARY_PATH})
- endif ()
-else ()
- set (SZIP_FOUND 0)
- set (SZIP_LIBRARIES)
- set (SZIP_INCLUDE_DIRS)
-endif ()
+
+find_path(SZIP_INCLUDE_DIR szlib.h)
+
+set(szip_names ${SZIP_NAMES} sz szip szip-static libsz libszip libszip-static)
+foreach(name ${szip_names})
+ list(APPEND szip_names_debug "${name}d")
+endforeach()
+
+if(NOT SZIP_LIBRARY)
+ find_library(SZIP_LIBRARY_RELEASE NAMES ${szip_names})
+ find_library(SZIP_LIBRARY_DEBUG NAMES ${szip_names_debug})
+ include(${CMAKE_CURRENT_LIST_DIR}/SelectLibraryConfigurations.cmake)
+ select_library_configurations(SZIP)
+ mark_as_advanced(SZIP_LIBRARY_RELEASE SZIP_LIBRARY_DEBUG)
+endif()
+unset(szip_names)
+unset(szip_names_debug)
+
+if(SZIP_INCLUDE_DIR AND EXISTS "${SZIP_INCLUDE_DIR}/SZconfig.h")
+ file(STRINGS "${SZIP_INCLUDE_DIR}/SZconfig.h" szip_version_str
+ REGEX "^#define[\t ]+SZIP_PACKAGE_VERSION[\t ]+.*")
+
+ string(REGEX REPLACE "^#define[\t ]+SZIP_PACKAGE_VERSION[\t ]+([0-9]+).*"
+ "\\1" SZIP_VERSION "${szip_version_str}")
+ unset(szip_version_str)
+endif()
+
+include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
+find_package_handle_standard_args(SZIP
+ REQUIRED_VARS SZIP_LIBRARY SZIP_INCLUDE_DIR
+ VERSION_VAR SZIP_VERSION)
+
+if(SZIP_FOUND)
+ set(SZIP_LIBRARIES ${SZIP_LIBRARY})
+ set(SZIP_INCLUDE_DIRS "${SZIP_INCLUDE_DIR}")
+
+ if(NOT TARGET SZIP::SZIP)
+ add_library(SZIP::SZIP UNKNOWN IMPORTED)
+ if(SZIP_INCLUDE_DIRS)
+ set_target_properties(SZIP::SZIP PROPERTIES
+ INTERFACE_INCLUDE_DIRECTORIES "${SZIP_INCLUDE_DIRS}")
+ endif()
+ if(EXISTS "${SZIP_LIBRARY}")
+ set_target_properties(SZIP::SZIP PROPERTIES
+ IMPORTED_LINK_INTERFACE_LANGUAGES "C"
+ IMPORTED_LOCATION "${SZIP_LIBRARY}")
+ endif()
+ if(EXISTS "${SZIP_LIBRARY_RELEASE}")
+ set_property(TARGET SZIP::SZIP APPEND PROPERTY
+ IMPORTED_CONFIGURATIONS RELEASE)
+ set_target_properties(SZIP::SZIP PROPERTIES
+ IMPORTED_LINK_INTERFACE_LANGUAGES_RELEASE "C"
+ IMPORTED_LOCATION_RELEASE "${SZIP_LIBRARY_RELEASE}")
+ endif()
+ if(EXISTS "${SZIP_LIBRARY_DEBUG}")
+ set_property(TARGET SZIP::SZIP APPEND PROPERTY
+ IMPORTED_CONFIGURATIONS DEBUG)
+ set_target_properties(SZIP::SZIP PROPERTIES
+ IMPORTED_LINK_INTERFACE_LANGUAGES_DEBUG "C"
+ IMPORTED_LOCATION_DEBUG "${SZIP_LIBRARY_DEBUG}")
+ endif()
+ endif()
+endif()
+
+mark_as_advanced(SZIP_LIBRARY SZIP_INCLUDE_DIR)
# Report the results.
if (NOT SZIP_FOUND)
@@ -153,29 +125,3 @@ if (NOT SZIP_FOUND)
endif ()
endif ()
endif ()
-
-if (SZIP_FOUND)
- include (CheckSymbolExists)
- #############################################
- # Find out if SZIP was build using dll's
- #############################################
- # Save required variable
- set (CMAKE_REQUIRED_INCLUDES_SAVE ${CMAKE_REQUIRED_INCLUDES})
- set (CMAKE_REQUIRED_FLAGS_SAVE ${CMAKE_REQUIRED_FLAGS})
- # Add SZIP_INCLUDE_DIR to CMAKE_REQUIRED_INCLUDES
- set (CMAKE_REQUIRED_INCLUDES "${CMAKE_REQUIRED_INCLUDES};${SZIP_INCLUDE_DIRS}")
-
- # Restore CMAKE_REQUIRED_INCLUDES and CMAKE_REQUIRED_FLAGS variables
- set (CMAKE_REQUIRED_INCLUDES ${CMAKE_REQUIRED_INCLUDES_SAVE})
- set (CMAKE_REQUIRED_FLAGS ${CMAKE_REQUIRED_FLAGS_SAVE})
- #
- #############################################
-endif ()
-
-if (FIND_SZIP_DEBUG)
- message (STATUS "SZIP_INCLUDE_DIR: ${SZIP_INCLUDE_DIR}")
- message (STATUS "SZIP_INCLUDE_DIRS: ${SZIP_INCLUDE_DIRS}")
- message (STATUS "SZIP_LIBRARY_DEBUG: ${SZIP_LIBRARY_DEBUG}")
- message (STATUS "SZIP_LIBRARY_RELEASE: ${SZIP_LIBRARY_RELEASE}")
- message (STATUS "CMAKE_BUILD_TYPE: ${CMAKE_BUILD_TYPE}")
-endif ()
diff --git a/config/cmake_ext_mod/HDFLibMacros.cmake b/config/cmake_ext_mod/HDFLibMacros.cmake
index 2eda66c..9df2b4b 100644
--- a/config/cmake_ext_mod/HDFLibMacros.cmake
+++ b/config/cmake_ext_mod/HDFLibMacros.cmake
@@ -14,25 +14,7 @@ macro (EXTERNAL_JPEG_LIBRARY compress_type jpeg_pic)
# May need to build JPEG with PIC on x64 machines with gcc
# Need to use CMAKE_ANSI_CFLAGS define so that compiler test works
- if (${compress_type} MATCHES "SVN")
- EXTERNALPROJECT_ADD (JPEG
- SVN_REPOSITORY ${JPEG_URL}
- # [SVN_REVISION rev]
- INSTALL_COMMAND ""
- CMAKE_ARGS
- -DBUILD_SHARED_LIBS:BOOL=${BUILD_SHARED_LIBS}
- -DJPEG_PACKAGE_EXT:STRING=${HDF_PACKAGE_EXT}
- -DJPEG_EXTERNALLY_CONFIGURED:BOOL=OFF
- -DCMAKE_BUILD_TYPE:STRING=${CMAKE_BUILD_TYPE}
- -DCMAKE_INSTALL_PREFIX:PATH=${CMAKE_INSTALL_PREFIX}
- -DCMAKE_RUNTIME_OUTPUT_DIRECTORY:PATH=${CMAKE_RUNTIME_OUTPUT_DIRECTORY}
- -DCMAKE_LIBRARY_OUTPUT_DIRECTORY:PATH=${CMAKE_LIBRARY_OUTPUT_DIRECTORY}
- -DCMAKE_ARCHIVE_OUTPUT_DIRECTORY:PATH=${CMAKE_ARCHIVE_OUTPUT_DIRECTORY}
- -DCMAKE_PDB_OUTPUT_DIRECTORY:PATH=${CMAKE_PDB_OUTPUT_DIRECTORY}
- -DCMAKE_ANSI_CFLAGS:STRING=${jpeg_pic}
- -DCMAKE_TOOLCHAIN_FILE:STRING=${CMAKE_TOOLCHAIN_FILE}
- )
- elseif (${compress_type} MATCHES "GIT")
+ if (${compress_type} MATCHES "GIT")
EXTERNALPROJECT_ADD (JPEG
GIT_REPOSITORY ${JPEG_URL}
GIT_TAG ${JPEG_BRANCH}
@@ -49,6 +31,7 @@ macro (EXTERNAL_JPEG_LIBRARY compress_type jpeg_pic)
-DCMAKE_PDB_OUTPUT_DIRECTORY:PATH=${CMAKE_PDB_OUTPUT_DIRECTORY}
-DCMAKE_ANSI_CFLAGS:STRING=${jpeg_pic}
-DCMAKE_TOOLCHAIN_FILE:STRING=${CMAKE_TOOLCHAIN_FILE}
+ -DPACKAGE_NAMESPACE=${HDF_PACKAGE_NAMESPACE}
)
elseif (${compress_type} MATCHES "TGZ")
EXTERNALPROJECT_ADD (JPEG
@@ -67,23 +50,24 @@ macro (EXTERNAL_JPEG_LIBRARY compress_type jpeg_pic)
-DCMAKE_PDB_OUTPUT_DIRECTORY:PATH=${CMAKE_PDB_OUTPUT_DIRECTORY}
-DCMAKE_ANSI_CFLAGS:STRING=${jpeg_pic}
-DCMAKE_TOOLCHAIN_FILE:STRING=${CMAKE_TOOLCHAIN_FILE}
+ -DPACKAGE_NAMESPACE=${HDF_PACKAGE_NAMESPACE}
)
endif ()
externalproject_get_property (JPEG BINARY_DIR SOURCE_DIR)
##include (${BINARY_DIR}/${JPEG_PACKAGE_NAME}${HDF_PACKAGE_EXT}-targets.cmake)
# Create imported target jpeg-static
- add_library(jpeg-static STATIC IMPORTED)
- HDF_IMPORT_SET_LIB_OPTIONS (jpeg-static "jpeg" STATIC "")
- add_dependencies (jpeg-static JPEG)
- set (JPEG_STATIC_LIBRARY "jpeg-static")
+ add_library(${HDF_PACKAGE_NAMESPACE}jpeg-static STATIC IMPORTED)
+ HDF_IMPORT_SET_LIB_OPTIONS (${HDF_PACKAGE_NAMESPACE}jpeg-static "jpeg" STATIC "")
+ add_dependencies (${HDF_PACKAGE_NAMESPACE}jpeg-static JPEG)
+ set (JPEG_STATIC_LIBRARY "${HDF_PACKAGE_NAMESPACE}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-shared JPEG)
- set (JPEG_SHARED_LIBRARY "jpeg-shared")
+ add_library(${HDF_PACKAGE_NAMESPACE}jpeg-shared SHARED IMPORTED)
+ HDF_IMPORT_SET_LIB_OPTIONS (${HDF_PACKAGE_NAMESPACE}jpeg-shared "jpeg" SHARED "")
+ add_dependencies (${HDF_PACKAGE_NAMESPACE}jpeg-shared JPEG)
+ set (JPEG_SHARED_LIBRARY "${HDF_PACKAGE_NAMESPACE}jpeg-shared")
set (JPEG_LIBRARIES ${JPEG_LIBRARIES} ${JPEG_SHARED_LIBRARY})
endif ()
@@ -100,33 +84,14 @@ macro (PACKAGE_JPEG_LIBRARY compress_type)
COMMENT "Copying ${JPEG_INCLUDE_DIR_GEN}/jconfig.h to ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/"
)
set (EXTERNAL_HEADER_LIST ${EXTERNAL_HEADER_LIST} ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/jconfig.h)
- if (${compress_type} MATCHES "GIT" OR ${compress_type} MATCHES "SVN" OR ${compress_type} MATCHES "TGZ")
+ if (${compress_type} MATCHES "GIT" OR ${compress_type} MATCHES "TGZ")
add_dependencies (JPEG-GenHeader-Copy JPEG)
endif ()
endmacro ()
#-------------------------------------------------------------------------------
macro (EXTERNAL_SZIP_LIBRARY compress_type encoding)
- if (${compress_type} MATCHES "SVN")
- EXTERNALPROJECT_ADD (SZIP
- SVN_REPOSITORY ${SZIP_URL}
- # [SVN_REVISION rev]
- INSTALL_COMMAND ""
- CMAKE_ARGS
- -DBUILD_SHARED_LIBS:BOOL=${BUILD_SHARED_LIBS}
- -DSZIP_PACKAGE_EXT:STRING=${HDF_PACKAGE_EXT}
- -DSZIP_EXTERNALLY_CONFIGURED:BOOL=OFF
- -DCMAKE_BUILD_TYPE:STRING=${CMAKE_BUILD_TYPE}
- -DCMAKE_INSTALL_PREFIX:PATH=${CMAKE_INSTALL_PREFIX}
- -DCMAKE_RUNTIME_OUTPUT_DIRECTORY:PATH=${CMAKE_RUNTIME_OUTPUT_DIRECTORY}
- -DCMAKE_LIBRARY_OUTPUT_DIRECTORY:PATH=${CMAKE_LIBRARY_OUTPUT_DIRECTORY}
- -DCMAKE_ARCHIVE_OUTPUT_DIRECTORY:PATH=${CMAKE_ARCHIVE_OUTPUT_DIRECTORY}
- -DCMAKE_PDB_OUTPUT_DIRECTORY:PATH=${CMAKE_PDB_OUTPUT_DIRECTORY}
- -DCMAKE_ANSI_CFLAGS:STRING=${CMAKE_ANSI_CFLAGS}
- -DSZIP_ENABLE_ENCODING:BOOL=${encoding}
- -DCMAKE_TOOLCHAIN_FILE:STRING=${CMAKE_TOOLCHAIN_FILE}
- )
- elseif (${compress_type} MATCHES "GIT")
+ if (${compress_type} MATCHES "GIT")
EXTERNALPROJECT_ADD (SZIP
GIT_REPOSITORY ${SZIP_URL}
GIT_TAG ${SZIP_BRANCH}
@@ -144,6 +109,7 @@ macro (EXTERNAL_SZIP_LIBRARY compress_type encoding)
-DCMAKE_ANSI_CFLAGS:STRING=${CMAKE_ANSI_CFLAGS}
-DSZIP_ENABLE_ENCODING:BOOL=${encoding}
-DCMAKE_TOOLCHAIN_FILE:STRING=${CMAKE_TOOLCHAIN_FILE}
+ -DPACKAGE_NAMESPACE=${HDF_PACKAGE_NAMESPACE}
)
elseif (${compress_type} MATCHES "TGZ")
EXTERNALPROJECT_ADD (SZIP
@@ -163,23 +129,24 @@ macro (EXTERNAL_SZIP_LIBRARY compress_type encoding)
-DCMAKE_ANSI_CFLAGS:STRING=${CMAKE_ANSI_CFLAGS}
-DSZIP_ENABLE_ENCODING:BOOL=${encoding}
-DCMAKE_TOOLCHAIN_FILE:STRING=${CMAKE_TOOLCHAIN_FILE}
+ -DPACKAGE_NAMESPACE=${HDF_PACKAGE_NAMESPACE}
)
endif ()
externalproject_get_property (SZIP BINARY_DIR SOURCE_DIR)
##include (${BINARY_DIR}/${SZIP_PACKAGE_NAME}${HDF_PACKAGE_EXT}-targets.cmake)
# Create imported target szip-static
- add_library(szip-static STATIC IMPORTED)
- HDF_IMPORT_SET_LIB_OPTIONS (szip-static "szip" STATIC "")
- add_dependencies (szip-static SZIP)
- set (SZIP_STATIC_LIBRARY "szip-static")
+ add_library(${HDF_PACKAGE_NAMESPACE}szip-static STATIC IMPORTED)
+ HDF_IMPORT_SET_LIB_OPTIONS (${HDF_PACKAGE_NAMESPACE}szip-static "szip" STATIC "")
+ add_dependencies (${HDF_PACKAGE_NAMESPACE}szip-static SZIP)
+ set (SZIP_STATIC_LIBRARY "${HDF_PACKAGE_NAMESPACE}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-shared SZIP)
- set (SZIP_SHARED_LIBRARY "szip-shared")
+ add_library(${HDF_PACKAGE_NAMESPACE}szip-shared SHARED IMPORTED)
+ HDF_IMPORT_SET_LIB_OPTIONS (${HDF_PACKAGE_NAMESPACE}szip-shared "szip" SHARED "")
+ add_dependencies (${HDF_PACKAGE_NAMESPACE}szip-shared SZIP)
+ set (SZIP_SHARED_LIBRARY "${HDF_PACKAGE_NAMESPACE}szip-shared")
set (SZIP_LIBRARIES ${SZIP_LIBRARIES} ${SZIP_SHARED_LIBRARY})
endif ()
@@ -196,32 +163,14 @@ macro (PACKAGE_SZIP_LIBRARY compress_type)
COMMENT "Copying ${SZIP_INCLUDE_DIR_GEN}/SZconfig.h to ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/"
)
set (EXTERNAL_HEADER_LIST ${EXTERNAL_HEADER_LIST} ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/SZconfig.h)
- if (${compress_type} MATCHES "GIT" OR ${compress_type} MATCHES "SVN" OR ${compress_type} MATCHES "TGZ")
+ if (${compress_type} MATCHES "GIT" OR ${compress_type} MATCHES "TGZ")
add_dependencies (SZIP-GenHeader-Copy SZIP)
endif ()
endmacro ()
#-------------------------------------------------------------------------------
macro (EXTERNAL_ZLIB_LIBRARY compress_type)
- if (${compress_type} MATCHES "SVN")
- EXTERNALPROJECT_ADD (ZLIB
- SVN_REPOSITORY ${ZLIB_URL}
- # [SVN_REVISION rev]
- INSTALL_COMMAND ""
- CMAKE_ARGS
- -DBUILD_SHARED_LIBS:BOOL=${BUILD_SHARED_LIBS}
- -DZLIB_PACKAGE_EXT:STRING=${HDF_PACKAGE_EXT}
- -DZLIB_EXTERNALLY_CONFIGURED:BOOL=OFF
- -DCMAKE_BUILD_TYPE:STRING=${CMAKE_BUILD_TYPE}
- -DCMAKE_INSTALL_PREFIX:PATH=${CMAKE_INSTALL_PREFIX}
- -DCMAKE_RUNTIME_OUTPUT_DIRECTORY:PATH=${CMAKE_RUNTIME_OUTPUT_DIRECTORY}
- -DCMAKE_LIBRARY_OUTPUT_DIRECTORY:PATH=${CMAKE_LIBRARY_OUTPUT_DIRECTORY}
- -DCMAKE_ARCHIVE_OUTPUT_DIRECTORY:PATH=${CMAKE_ARCHIVE_OUTPUT_DIRECTORY}
- -DCMAKE_PDB_OUTPUT_DIRECTORY:PATH=${CMAKE_PDB_OUTPUT_DIRECTORY}
- -DCMAKE_ANSI_CFLAGS:STRING=${CMAKE_ANSI_CFLAGS}
- -DCMAKE_TOOLCHAIN_FILE:STRING=${CMAKE_TOOLCHAIN_FILE}
- )
- elseif (${compress_type} MATCHES "GIT")
+ if (${compress_type} MATCHES "GIT")
EXTERNALPROJECT_ADD (ZLIB
GIT_REPOSITORY ${ZLIB_URL}
GIT_TAG ${ZLIB_BRANCH}
@@ -238,6 +187,7 @@ macro (EXTERNAL_ZLIB_LIBRARY compress_type)
-DCMAKE_PDB_OUTPUT_DIRECTORY:PATH=${CMAKE_PDB_OUTPUT_DIRECTORY}
-DCMAKE_ANSI_CFLAGS:STRING=${CMAKE_ANSI_CFLAGS}
-DCMAKE_TOOLCHAIN_FILE:STRING=${CMAKE_TOOLCHAIN_FILE}
+ -DPACKAGE_NAMESPACE=${HDF_PACKAGE_NAMESPACE}
)
elseif (${compress_type} MATCHES "TGZ")
EXTERNALPROJECT_ADD (ZLIB
@@ -256,6 +206,7 @@ macro (EXTERNAL_ZLIB_LIBRARY compress_type)
-DCMAKE_PDB_OUTPUT_DIRECTORY:PATH=${CMAKE_PDB_OUTPUT_DIRECTORY}
-DCMAKE_ANSI_CFLAGS:STRING=${CMAKE_ANSI_CFLAGS}
-DCMAKE_TOOLCHAIN_FILE:STRING=${CMAKE_TOOLCHAIN_FILE}
+ -DPACKAGE_NAMESPACE=${HDF_PACKAGE_NAMESPACE}
)
endif ()
externalproject_get_property (ZLIB BINARY_DIR SOURCE_DIR)
@@ -267,17 +218,18 @@ macro (EXTERNAL_ZLIB_LIBRARY compress_type)
endif ()
##include (${BINARY_DIR}/${ZLIB_PACKAGE_NAME}${HDF_PACKAGE_EXT}-targets.cmake)
# 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-static ZLIB)
- set (ZLIB_STATIC_LIBRARY "zlib-static")
+ add_library(${HDF_PACKAGE_NAMESPACE}zlib-static STATIC IMPORTED)
+# add_library(${HDF_PACKAGE_NAMESPACE}zlib-static ALIAS zlib-static)
+ HDF_IMPORT_SET_LIB_OPTIONS (${HDF_PACKAGE_NAMESPACE}zlib-static ${ZLIB_LIB_NAME} STATIC "")
+ add_dependencies (${HDF_PACKAGE_NAMESPACE}zlib-static ZLIB)
+ set (ZLIB_STATIC_LIBRARY "${HDF_PACKAGE_NAMESPACE}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-shared ZLIB)
- set (ZLIB_SHARED_LIBRARY "zlib-shared")
+ add_library(${HDF_PACKAGE_NAMESPACE}zlib-shared SHARED IMPORTED)
+ HDF_IMPORT_SET_LIB_OPTIONS (${HDF_PACKAGE_NAMESPACE}zlib-shared ${ZLIB_LIB_NAME} SHARED "")
+ add_dependencies (${HDF_PACKAGE_NAMESPACE}zlib-shared ZLIB)
+ set (ZLIB_SHARED_LIBRARY "${HDF_PACKAGE_NAMESPACE}zlib-shared")
set (ZLIB_LIBRARIES ${ZLIB_LIBRARIES} ${ZLIB_SHARED_LIBRARY})
endif ()
@@ -294,7 +246,7 @@ macro (PACKAGE_ZLIB_LIBRARY compress_type)
COMMENT "Copying ${ZLIB_INCLUDE_DIR_GEN}/zconf.h to ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/"
)
set (EXTERNAL_HEADER_LIST ${EXTERNAL_HEADER_LIST} ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/zconf.h)
- if (${compress_type} MATCHES "GIT" OR ${compress_type} MATCHES "SVN" OR ${compress_type} MATCHES "TGZ")
+ if (${compress_type} MATCHES "GIT" OR ${compress_type} MATCHES "TGZ")
add_dependencies (ZLIB-GenHeader-Copy ZLIB)
endif ()
endmacro ()
diff --git a/config/cmake_ext_mod/HDFMacros.cmake b/config/cmake_ext_mod/HDFMacros.cmake
index 2f4ce52..9da5006 100644
--- a/config/cmake_ext_mod/HDFMacros.cmake
+++ b/config/cmake_ext_mod/HDFMacros.cmake
@@ -28,7 +28,7 @@ macro (SET_HDF_BUILD_TYPE)
endif()
endif()
if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES)
- message(STATUS "Setting build type to 'RelWithDebInfo' as none was specified.")
+ message (STATUS "Setting build type to 'RelWithDebInfo' as none was specified.")
set(CMAKE_BUILD_TYPE RelWithDebInfo CACHE STRING "Choose the type of build." FORCE)
# Set the possible values of build type for cmake-gui
set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS "Debug" "Release"
@@ -224,10 +224,9 @@ macro (TARGET_C_PROPERTIES wintarget libtype)
$<$<C_COMPILER_ID:MSVC>:${WIN_COMPILE_FLAGS}>
$<$<CXX_COMPILER_ID:MSVC>:${WIN_COMPILE_FLAGS}>
)
- target_link_libraries(${wintarget} INTERFACE
- $<$<C_COMPILER_ID:MSVC>:${WIN_LINK_FLAGS}>
- $<$<CXX_COMPILER_ID:MSVC>:${WIN_LINK_FLAGS}>
- )
+ if(MSVC)
+ set_property(TARGET ${wintarget} APPEND PROPERTY LINK_FLAGS "${WIN_LINK_FLAGS}")
+ endif()
endmacro ()
#-----------------------------------------------------------------------------
@@ -294,7 +293,9 @@ macro (HDF_README_PROPERTIES target_fortran)
set (BINARY_PLATFORM "${BINARY_PLATFORM} / ${CMAKE_Fortran_COMPILER_ID} Fortran")
endif ()
- if (BUILD_SHARED_LIBS)
+ if (ONLY_SHARED_LIBS)
+ set (LIB_TYPE "Shared")
+ elseif (BUILD_SHARED_LIBS)
set (LIB_TYPE "Static and Shared")
else ()
set (LIB_TYPE "Static")
diff --git a/config/cmake_ext_mod/HDFUseCXX.cmake b/config/cmake_ext_mod/HDFUseCXX.cmake
index efaa556..8d98147 100644
--- a/config/cmake_ext_mod/HDFUseCXX.cmake
+++ b/config/cmake_ext_mod/HDFUseCXX.cmake
@@ -96,7 +96,7 @@ endmacro ()
# Check a bunch of cxx functions
#-----------------------------------------------------------------------------
if (CMAKE_CXX_COMPILER_LOADED)
- foreach (test
+ foreach (cxx_test
OLD_HEADER_FILENAME
HDF_NO_NAMESPACE
HDF_NO_STD
@@ -104,6 +104,6 @@ if (CMAKE_CXX_COMPILER_LOADED)
NO_STATIC_CAST
CXX_HAVE_OFFSETOF
)
- HDF_CXX_FUNCTION_TEST (${test})
+ HDF_CXX_FUNCTION_TEST (${cxx_test})
endforeach ()
endif ()
diff --git a/config/cmake_ext_mod/HDFUseFortran.cmake b/config/cmake_ext_mod/HDFUseFortran.cmake
index c68c921..bed1fc1 100644
--- a/config/cmake_ext_mod/HDFUseFortran.cmake
+++ b/config/cmake_ext_mod/HDFUseFortran.cmake
@@ -13,7 +13,7 @@
# This file provides functions for Fortran support.
#
#-------------------------------------------------------------------------------
-ENABLE_LANGUAGE (Fortran)
+enable_language (Fortran)
set (HDF_PREFIX "H5")
#-------------------------------------------------------------------------------
@@ -65,9 +65,9 @@ macro (CHECK_FORTRAN_FEATURE FUNCTION CODE VARIABLE)
OUTPUT_VARIABLE OUTPUT
)
-# message ( "* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * ")
-# message ( "Test result ${OUTPUT}")
-# message ( "* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * ")
+# message (STATUS "* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * ")
+# message (STATUS "Test result ${OUTPUT}")
+# message (STATUS "* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * ")
if (${RESULT_VAR})
set (${VARIABLE} 1 CACHE INTERNAL "Have Fortran function ${FUNCTION}")
diff --git a/config/cmake_ext_mod/grepTest.cmake b/config/cmake_ext_mod/grepTest.cmake
index 1417204..4b58639 100644
--- a/config/cmake_ext_mod/grepTest.cmake
+++ b/config/cmake_ext_mod/grepTest.cmake
@@ -20,7 +20,7 @@ endif ()
# message (STATUS "Require TEST_ARGS to be defined")
#endif ()
if (NOT TEST_FOLDER)
- message ( FATAL_ERROR "Require TEST_FOLDER to be defined")
+ message (FATAL_ERROR "Require TEST_FOLDER to be defined")
endif ()
if (NOT TEST_OUTPUT)
message (FATAL_ERROR "Require TEST_OUTPUT to be defined")
@@ -29,14 +29,35 @@ endif ()
# message (STATUS "Require TEST_EXPECT to be defined")
#endif ()
if (NOT TEST_FILTER)
- message (STATUS "Require TEST_FILTER to be defined")
+ message (STATUS "Optional TEST_FILTER 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})
+endif ()
+
+if (EXISTS ${TEST_FOLDER}/${TEST_OUTPUT}.err)
+ file (REMOVE ${TEST_FOLDER}/${TEST_OUTPUT}.err)
+endif ()
+
message (STATUS "COMMAND: ${TEST_PROGRAM} ${TEST_ARGS}")
+if (TEST_LIBRARY_DIRECTORY)
+ if (WIN32 AND NOT MINGW)
+ set (ENV{PATH} "$ENV{PATH};${TEST_LIBRARY_DIRECTORY}")
+ else ()
+ set (ENV{LD_LIBRARY_PATH} "$ENV{LD_LIBRARY_PATH}:${TEST_LIBRARY_DIRECTORY}")
+ endif ()
+endif ()
+
+if (TEST_ENV_VAR)
+ set (ENV{${TEST_ENV_VAR}} "${TEST_ENV_VALUE}")
+ #message (STATUS "ENV:${TEST_ENV_VAR}=$ENV{${TEST_ENV_VAR}}")
+endif ()
+
# run the test program, capture the stdout/stderr and the result var
execute_process (
COMMAND ${TEST_PROGRAM} ${TEST_ARGS}
@@ -49,27 +70,117 @@ execute_process (
)
message (STATUS "COMMAND Result: ${TEST_RESULT}")
+
message (STATUS "COMMAND Error: ${TEST_ERROR}")
-# now grep the output with the reference
+# 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 ()
-# 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}")
+# if the TEST_ERRREF exists grep the error output with the error reference
+if (TEST_ERRREF)
+ # if the .err file exists grep the error output with the error reference before comparing stdout
+ if (EXISTS ${TEST_FOLDER}/${TEST_OUTPUT}.err)
+ file (READ ${TEST_FOLDER}/${TEST_OUTPUT}.err TEST_ERR_STREAM)
+
+ # TEST_ERRREF should always be matched
+ string (REGEX MATCH "${TEST_ERRREF}" TEST_MATCH ${TEST_ERR_STREAM})
+ string (COMPARE EQUAL "${TEST_ERRREF}" "${TEST_MATCH}" TEST_RESULT)
+ if (NOT TEST_RESULT)
+ message (FATAL_ERROR "Failed: The error output of ${TEST_PROGRAM} did not contain ${TEST_ERRREF}")
+ endif ()
+ endif ()
+
+ #always compare output file to reference unless this must be skipped
+ if (NOT TEST_SKIP_COMPARE)
+ 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)
+ endif ()
+ endif ()
+
+ 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 (str_act)
+ set (TEST_RESULT 1)
+ message (STATUS "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 ()
+ endif ()
+ if (NOT len_act EQUAL len_ref)
+ set (TEST_RESULT 1)
+ endif ()
+ endif ()
+
+ message (STATUS "COMPARE Result: ${TEST_RESULT}")
+
+ # 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 ()
+ endif ()
+else ()
+ # else 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 ()
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}")
+
+if (TEST_FILTER)
+ 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} matched")
+message (STATUS "Passed: The output of ${TEST_PROGRAM} matched")
diff --git a/config/cmake_ext_mod/runTest.cmake b/config/cmake_ext_mod/runTest.cmake
index 48402a2..c9508f3 100644
--- a/config/cmake_ext_mod/runTest.cmake
+++ b/config/cmake_ext_mod/runTest.cmake
@@ -18,7 +18,7 @@ if (NOT TEST_PROGRAM)
message (FATAL_ERROR "Require TEST_PROGRAM to be defined")
endif ()
if (NOT TEST_FOLDER)
- message ( FATAL_ERROR "Require TEST_FOLDER to be defined")
+ message (FATAL_ERROR "Require TEST_FOLDER to be defined")
endif ()
if (NOT TEST_OUTPUT)
message (FATAL_ERROR "Require TEST_OUTPUT to be defined")
@@ -218,10 +218,10 @@ if (NOT TEST_SKIP_COMPARE)
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 (str_act)
set (TEST_RESULT 1)
- message ("line = ${line}\n***ACTUAL: ${str_act}\n****REFER: ${str_ref}\n")
+ message (STATUS "line = ${line}\n***ACTUAL: ${str_act}\n****REFER: ${str_ref}\n")
endif ()
endif ()
endforeach ()
@@ -270,10 +270,10 @@ if (NOT TEST_SKIP_COMPARE)
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 (str_act)
set (TEST_RESULT 1)
- message ("line = ${line}\n***ACTUAL: ${str_act}\n****REFER: ${str_ref}\n")
+ message (STATUS "line = ${line}\n***ACTUAL: ${str_act}\n****REFER: ${str_ref}\n")
endif ()
endif ()
endforeach ()
@@ -321,5 +321,5 @@ if (TEST_GREP_COMPARE)
endif ()
# everything went fine...
-message ("${TEST_PROGRAM} Passed")
+message (STATUS "${TEST_PROGRAM} Passed")
diff --git a/config/commence.am b/config/commence.am
index 5d88a88..a16eee5 100644
--- a/config/commence.am
+++ b/config/commence.am
@@ -97,8 +97,8 @@ CHECK_CLEANFILES=*.chkexe *.chklog *.clog *.clog2
# exists.
.PHONY: build-check-clean build-check-p build-check-s build-lib build-progs \
build-tests check-clean check-install check-p check-s check-vfd \
- check-vol install-doc lib progs tests uninstall-doc _exec_check-s \
- _test help
+ check-passthrough-vol install-doc lib progs tests uninstall-doc \
+ _exec_check-s _test help
help:
@$(top_srcdir)/bin/makehelp
diff --git a/config/conclude.am b/config/conclude.am
index 9da1da5..2eec03a 100644
--- a/config/conclude.am
+++ b/config/conclude.am
@@ -282,8 +282,10 @@ check-vfd: $(LIB) $(PROGS) $(chk_TESTS)
fi; \
done
-# Run test with different Virtual Object Layer Connector
-check-vol: $(LIB) $(PROGS) $(chk_TESTS)
+# Run test with different passthrough Virtual Object Layer Connector
+# NOTE: Will only succeed with passthrough VOL connectors that use
+# the native VOL connector as the terminal connector.
+check-passthrough-vol: $(LIB) $(PROGS) $(chk_TESTS)
@for vol in $(VOL_LIST) dummy; do \
if test "$$vol" != dummy; then \
echo "============================"; \
diff --git a/config/gnu-flags b/config/gnu-flags
index 225f072..c55391d 100644
--- a/config/gnu-flags
+++ b/config/gnu-flags
@@ -1,4 +1,4 @@
-# -*- shell-script -*-
+# -*- shell-script -*-
#
# Copyright by The HDF Group.
# Copyright by the Board of Trustees of the University of Illinois.
@@ -37,10 +37,10 @@ if test X = "X$cc_flags_set"; then
cc_vendor=`echo $cc_version |sed 's/\([a-z]*\).*/\1/'`
cc_version=`echo $cc_version |sed 's/[-a-z]//g'`
if test X = "X$cc_vendor" -a X != "X$cc_version"; then
- cc_vendor=gcc
+ cc_vendor=gcc
fi
if test "-" != "$cc_vendor-$cc_version"; then
- echo "compiler '$CC' is GNU $cc_vendor-$cc_version"
+ echo "compiler '$CC' is GNU $cc_vendor-$cc_version"
fi
# Some version numbers
@@ -87,7 +87,7 @@ case "$cc_vendor-$cc_version" in
case "$host_os-$host_cpu" in
# cygwin needs the "-std=c99" flag removed, so make
# a specific case for Cygwin without the flag and a default
- # case to add the flag everywhere else
+ # case to add the flag everywhere else
cygwin-*)
;;
@@ -111,13 +111,13 @@ case "$cc_vendor-$cc_version" in
# know if they do start showing up.
#
# NOTE: Don't add -Wpadded here since we can't/won't fix the (many)
- # warnings that are emitted. If you need it, add it from the
+ # warnings that are emitted. If you need it, add it from the
# environment variable at configure time.
H5_CFLAGS="$H5_CFLAGS $arch -pedantic -Wall -Wextra -Wbad-function-cast -Wc++-compat -Wcast-align"
H5_CFLAGS="$H5_CFLAGS -Wcast-qual -Wconversion -Wdeclaration-after-statement -Wdisabled-optimization -Wfloat-equal"
H5_CFLAGS="$H5_CFLAGS -Wformat=2 -Winit-self -Winvalid-pch -Wmissing-declarations -Wmissing-include-dirs"
H5_CFLAGS="$H5_CFLAGS -Wmissing-prototypes -Wnested-externs -Wold-style-definition -Wpacked -Wpointer-arith"
- H5_CFLAGS="$H5_CFLAGS -Wredundant-decls -Wshadow -Wstrict-prototypes -Wswitch-default -Wswitch-enum"
+ H5_CFLAGS="$H5_CFLAGS -Wredundant-decls -Wshadow -Wstrict-prototypes -Wswitch-enum -Wswitch-default"
H5_CFLAGS="$H5_CFLAGS -Wundef -Wunused-macros -Wunsafe-loop-optimizations -Wwrite-strings"
# Production
@@ -126,7 +126,7 @@ case "$cc_vendor-$cc_version" in
gcc-4.*)
PROD_CFLAGS=
;;
- gcc-[56].*)
+ gcc-[56789].*)
PROD_CFLAGS="-fstdarg-opt"
;;
*)
@@ -140,7 +140,7 @@ case "$cc_vendor-$cc_version" in
# NDEBUG is handled explicitly by the configure script
# -g is handled by the symbols flags
case "$cc_vendor-$cc_version" in
- gcc-[56].*)
+ gcc-[56789].*)
DEBUG_CFLAGS="-ftrapv -fno-common"
;;
*)
@@ -165,7 +165,7 @@ case "$cc_vendor-$cc_version" in
HIGH_OPT_CFLAGS="-O3"
DEBUG_OPT_CFLAGS=
;;
- gcc-[56].*)
+ gcc-[56789].*)
HIGH_OPT_CFLAGS="-O3"
DEBUG_OPT_CFLAGS="-Og"
;;
@@ -187,9 +187,53 @@ esac
# the information from the previous version and adding modifications to that.
case "$cc_vendor-$cc_version" in
-# When the gcc 7.x release is out, we should check for additional flags to
+# When the gcc 8.x release is out, we should check for additional flags to
# include and break it out into it's own section, like the other versions
# below. -QAK
+ gcc-[789].*)
+ # Append warning flags that only gcc 4.2+ knows about
+ # (none, or incorporated in -Wall / -Wextra now)
+
+ # Append warning flags that only gcc 4.3+ knows about
+ #
+ # Technically, variable-length arrays are part of the C99 standard, but
+ # we should approach them a bit cautiously... -QAK
+ H5_CFLAGS="$H5_CFLAGS -Wlogical-op -Wlarger-than=2048 -Wvla"
+
+ # Append warning flags that only gcc 4.4+ knows about
+ H5_CFLAGS="$H5_CFLAGS -Wsync-nand -Wframe-larger-than=16384 -Wpacked-bitfield-compat"
+
+ # Append warning flags that only gcc 4.5+ knows about
+ H5_CFLAGS="$H5_CFLAGS -Wstrict-overflow=5 -Wjump-misses-init -Wunsuffixed-float-constants"
+
+ # Append warning flags that only gcc 4.6+ knows about
+ H5_CFLAGS="$H5_CFLAGS -Wdouble-promotion -Wtrampolines"
+ DEVELOPER_WARNING_CFLAGS="$DEVELOPER_WARNING_CFLAGS -Wsuggest-attribute=const"
+ NO_DEVELOPER_WARNING_CFLAGS="$NO_DEVELOPER_WARNING_CFLAGS -Wno-suggest-attribute=const"
+
+ # Append warning flags that only gcc 4.7+ knows about
+ H5_CFLAGS="$H5_CFLAGS -Wstack-usage=8192 -Wvector-operation-performance"
+ DEVELOPER_WARNING_CFLAGS="$DEVELOPER_WARNING_CFLAGS -Wsuggest-attribute=pure -Wsuggest-attribute=noreturn"
+ NO_DEVELOPER_WARNING_CFLAGS="$NO_DEVELOPER_WARNING_CFLAGS -Wno-suggest-attribute=pure -Wno-suggest-attribute=noreturn"
+
+ # Append warning flags that only gcc 4.8+ knows about
+ DEVELOPER_WARNING_CFLAGS="$DEVELOPER_WARNING_CFLAGS -Wsuggest-attribute=format"
+ NO_DEVELOPER_WARNING_CFLAGS="$NO_DEVELOPER_WARNING_CFLAGS -Wno-suggest-attribute=format"
+
+ # Append warning flags that only gcc 4.9+ knows about
+ H5_CFLAGS="$H5_CFLAGS -Wdate-time"
+
+ # Append warning flags that only gcc 5.x+ knows about
+ H5_CFLAGS="$H5_CFLAGS -Warray-bounds=2 -Wc99-c11-compat"
+
+ # Append warning flags that only gcc 6.x+ knows about
+ H5_CFLAGS="$H5_CFLAGS -Wnull-dereference -Wunused-const-variable -Wduplicated-cond -Whsa -Wnormalized"
+
+ # Append warning flags that only gcc 7.x+ knows about
+ DEVELOPER_WARNING_CFLAGS="$DEVELOPER_WARNING_CFLAGS -Wstringop-overflow=2"
+ H5_CFLAGS="$H5_CFLAGS -Walloc-zero -Walloca -Wduplicated-branches -Wformat-overflow=2 -Wformat-truncation=2 -Wimplicit-fallthrough=5 -Wrestrict"
+ ;;
+
gcc-6*)
# Append warning flags that only gcc 4.2+ knows about
# (none, or incorporated in -Wall / -Wextra now)
@@ -227,7 +271,7 @@ case "$cc_vendor-$cc_version" in
H5_CFLAGS="$H5_CFLAGS -Warray-bounds=2 -Wc99-c11-compat"
# Append warning flags that only gcc 6.x+ knows about
- H5_CFLAGS="$H5_CFLAGS -Wnull-dereference -Wunused-const-variable -Wduplicated-cond -Whsa"
+ H5_CFLAGS="$H5_CFLAGS -Wnull-dereference -Wunused-const-variable -Wduplicated-cond -Whsa -Wnormalized"
;;
gcc-5*)
diff --git a/config/toolchain/crayle.cmake b/config/toolchain/crayle.cmake
index 159f43a..bf7cf69 100644
--- a/config/toolchain/crayle.cmake
+++ b/config/toolchain/crayle.cmake
@@ -8,13 +8,3 @@ set(CMAKE_Fortran_COMPILER ftn)
# the following is used if cross-compiling
set(CMAKE_CROSSCOMPILING_EMULATOR "")
-
-# option to use pre-generated H5Tinit.c file
-set(HDF5_USE_PREGEN OFF)
-# directory where H5Tinit.c file will be found
-#set(HDF5_USE_PREGEN_DIR "/lscratch1/lknox/HDF5_1_10_4/CMake-hdf5-1.10.4")
-
-# option to generate H5Tinit.c by running H5detect on knl compute node during build
-#set(HDF5_BATCH_H5DETECT ON)
-#set(HDF5_BATCH_CMD "sbatch")
-#set(HDF5_BATCH_H5DETECT_SCRIPT "knl_H5detect.sl")
diff --git a/configure.ac b/configure.ac
index 30fe725..33b3251 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.11.4], [help@hdfgroup.org])
+AC_INIT([HDF5], [1.11.6], [help@hdfgroup.org])
AC_CONFIG_SRCDIR([src/H5.c])
AC_CONFIG_HEADERS([src/H5config.h])
@@ -48,7 +48,7 @@ m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])]) # use silent rules where a
##
## By default, it is enabled. Users can configure with
## --disable-maintainer-mode to prevent running the autotools.
-AM_MAINTAINER_MODE([enable])
+AM_MAINTAINER_MODE([disable])
## ----------------------------------------------------------------------
## Set prefix default (install directory) to a directory in the build area.
@@ -943,6 +943,48 @@ fi
AM_CONDITIONAL([FORTRAN_SHARED_CONDITIONAL], [test "X$H5_FORTRAN_SHARED" = "Xyes"])
## ----------------------------------------------------------------------
+## Check if they would like to disable building tests
+##
+
+## This needs to be exposed for the library info file.
+AC_SUBST([HDF5_TESTS])
+
+## Default is to build tests
+HDF5_TESTS=yes
+
+AC_MSG_CHECKING([if building tests is disabled])
+
+AC_ARG_ENABLE([tests],
+ [AS_HELP_STRING([--enable-tests],
+ [Compile the HDF5 tests [default=yes]])],
+ [HDF5_TESTS=$enableval])
+
+if test "X$HDF5_TESTS" = "Xno"; then
+ echo "Building HDF5 tests is disabled"
+fi
+
+## ----------------------------------------------------------------------
+## Check if they would like to disable building tools
+##
+
+## This needs to be exposed for the library info file.
+AC_SUBST([HDF5_TOOLS])
+
+## Default is to build tests and tools
+HDF5_TOOLS=yes
+
+AC_MSG_CHECKING([if building tools is disabled])
+
+AC_ARG_ENABLE([tools],
+ [AS_HELP_STRING([--enable-tools],
+ [Compile the HDF5 tools [default=yes]])],
+ [HDF5_TOOLS=$enableval])
+
+if test "X$HDF5_TOOLS" = "Xno"; then
+ echo "Building HDF5 tools is disabled"
+fi
+
+## ----------------------------------------------------------------------
## Create libtool. If shared/static libraries are going to be enabled
## or disabled, it should happen before these macros.
LT_PREREQ([2.2])
@@ -2511,8 +2553,10 @@ AC_SUBST([PARALLEL_FILTERED_WRITES])
AC_SUBST([LARGE_PARALLEL_IO])
if test -n "$PARALLEL"; then
- ## The 'testpar' directory should participate in the build
- TESTPARALLEL=testpar
+ if test "X$HDF5_TESTS" = "Xyes"; then
+ ## The 'testpar' directory should participate in the build
+ TESTPARALLEL=testpar
+ fi
## We are building a parallel library
AC_DEFINE([HAVE_PARALLEL], [1], [Define if we have parallel support])
@@ -3361,11 +3405,13 @@ LDFLAGS="$saved_user_LDFLAGS"
## need to be compiled
AM_CONDITIONAL([BUILD_CXX_CONDITIONAL], [test "X$HDF_CXX" = "Xyes"])
-AM_CONDITIONAL([BUILD_PARALLEL_CONDITIONAL], [test -n "$TESTPARALLEL"])
+AM_CONDITIONAL([BUILD_PARALLEL_CONDITIONAL], [test "X$PARALLEL" = "Xyes"])
AM_CONDITIONAL([BUILD_FORTRAN_CONDITIONAL], [test "X$HDF_FORTRAN" = "Xyes"])
AM_CONDITIONAL([BUILD_JAVA_CONDITIONAL], [test "X$HDF_JAVA" = "Xyes"])
AM_CONDITIONAL([BUILD_HDF5_HL_CONDITIONAL], [test "X$HDF5_HL" = "Xyes"])
-
+AM_CONDITIONAL([BUILD_TESTS_CONDITIONAL], [test "X$HDF5_TESTS" = "Xyes"])
+AM_CONDITIONAL([BUILD_TESTS_PARALLEL_CONDITIONAL], [test -n "$TESTPARALLEL"])
+AM_CONDITIONAL([BUILD_TOOLS_CONDITIONAL], [test "X$HDF5_TOOLS" = "Xyes"])
## ----------------------------------------------------------------------
## Build the Makefiles.
@@ -3477,10 +3523,12 @@ AC_CONFIG_FILES([src/libhdf5.settings
test/testabort_fail.sh
test/testcheck_version.sh
test/testerror.sh
+ test/testexternal_env.sh
test/testflushrefresh.sh
test/testlibinfo.sh
test/testlinks_env.sh
test/testswmr.sh
+ test/testvds_env.sh
test/testvdsswmr.sh
test/test_filter_plugin.sh
test/test_usecases.sh
@@ -3498,7 +3546,6 @@ AC_CONFIG_FILES([src/libhdf5.settings
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
@@ -3538,6 +3585,8 @@ AC_CONFIG_FILES([src/libhdf5.settings
examples/Makefile
examples/run-c-ex.sh
examples/testh5cc.sh
+ bin/h5cc
+ bin/Makefile
c++/Makefile
c++/src/Makefile
c++/src/h5c++
@@ -3600,7 +3649,7 @@ AC_CONFIG_COMMANDS([.classes], [], [$MKDIR_P java/src/.classes;
AC_OUTPUT
-chmod 755 tools/src/misc/h5cc
+chmod 755 src/h5cc
if test "X$HDF_CXX" = "Xyes"; then
chmod 755 c++/src/h5c++
fi
diff --git a/examples/CMakeLists.txt b/examples/CMakeLists.txt
index 2239d64..6e1f79d 100644
--- a/examples/CMakeLists.txt
+++ b/examples/CMakeLists.txt
@@ -41,32 +41,28 @@ set (examples
foreach (example ${examples})
add_executable (${example} ${HDF5_EXAMPLES_SOURCE_DIR}/${example}.c)
- target_include_directories(${example} PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>")
- TARGET_C_PROPERTIES (${example} STATIC)
- target_link_libraries (${example} PRIVATE ${HDF5_LIB_TARGET})
- set_target_properties (${example} PROPERTIES FOLDER examples)
- if (BUILD_SHARED_LIBS)
- add_executable (${example}-shared ${HDF5_EXAMPLES_SOURCE_DIR}/${example}.c)
- target_include_directories(${example}-shared PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>")
- TARGET_C_PROPERTIES (${example}-shared SHARED)
- target_link_libraries (${example}-shared PRIVATE ${HDF5_LIBSH_TARGET})
- set_target_properties (${example}-shared PROPERTIES FOLDER examples)
+ target_include_directories (${example} PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>")
+ if (NOT BUILD_SHARED_LIBS)
+ TARGET_C_PROPERTIES (${example} STATIC)
+ target_link_libraries (${example} PRIVATE ${HDF5_LIB_TARGET})
+ else ()
+ TARGET_C_PROPERTIES (${example} SHARED)
+ target_link_libraries (${example} PRIVATE ${HDF5_LIBSH_TARGET})
endif ()
+ set_target_properties (${example} PROPERTIES FOLDER examples)
endforeach ()
if (H5_HAVE_PARALLEL)
add_executable (ph5example ${HDF5_EXAMPLES_SOURCE_DIR}/ph5example.c)
- target_include_directories(ph5example PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>")
- TARGET_C_PROPERTIES (ph5example STATIC)
- target_link_libraries (ph5example PRIVATE ${HDF5_LIB_TARGET} ${MPI_C_LIBRARIES})
- set_target_properties (ph5example PROPERTIES FOLDER examples)
- if (BUILD_SHARED_LIBS)
- add_executable (ph5example-shared ${HDF5_EXAMPLES_SOURCE_DIR}/ph5example.c)
- target_include_directories(ph5example-shared PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>")
- TARGET_C_PROPERTIES (ph5example-shared SHARED)
- target_link_libraries (ph5example-shared PRIVATE ${HDF5_LIBSH_TARGET} ${MPI_C_LIBRARIES})
- set_target_properties (ph5example-shared PROPERTIES FOLDER examples)
+ target_include_directories (ph5example PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>")
+ if (NOT BUILD_SHARED_LIBS)
+ TARGET_C_PROPERTIES (ph5example STATIC)
+ target_link_libraries (ph5example PRIVATE ${HDF5_LIB_TARGET} ${MPI_C_LIBRARIES})
+ else ()
+ TARGET_C_PROPERTIES (ph5example SHARED)
+ target_link_libraries (ph5example PRIVATE ${HDF5_LIBSH_TARGET} ${MPI_C_LIBRARIES})
endif ()
+ set_target_properties (ph5example PROPERTIES FOLDER examples)
endif ()
if (BUILD_TESTING)
diff --git a/examples/CMakeTests.cmake b/examples/CMakeTests.cmake
index dd1e03b..6cab7dd 100644
--- a/examples/CMakeTests.cmake
+++ b/examples/CMakeTests.cmake
@@ -16,93 +16,8 @@
##############################################################################
##############################################################################
file (MAKE_DIRECTORY ${PROJECT_BINARY_DIR}/red ${PROJECT_BINARY_DIR}/blue ${PROJECT_BINARY_DIR}/u2w)
- if (BUILD_SHARED_LIBS)
- file (MAKE_DIRECTORY "${PROJECT_BINARY_DIR}/H5EX-shared")
- file (MAKE_DIRECTORY ${PROJECT_BINARY_DIR}/H5EX-shared/red ${PROJECT_BINARY_DIR}/H5EX-shared/blue ${PROJECT_BINARY_DIR}/H5EX-shared/u2w)
- endif ()
- # Remove any output file left over from previous test run
- add_test (
- NAME EXAMPLES-clear-objects
- COMMAND ${CMAKE_COMMAND}
- -E remove
- Attributes.h5
- btrees_file.h5
- cmprss.h5
- default_file.h5
- dset.h5
- extend.h5
- extlink_prefix_source.h5
- extlink_source.h5
- extlink_target.h5
- group.h5
- groups.h5
- hard_link.h5
- mount1.h5
- mount2.h5
- one_index_file.h5
- only_dspaces_and_attrs_file.h5
- only_huge_mesgs_file.h5
- REF_REG.h5
- refere.h5
- SDS.h5
- SDScompound.h5
- SDSextendible.h5
- Select.h5
- separate_indexes_file.h5
- small_lists_file.h5
- soft_link.h5
- subset.h5
- unix2win.h5
- blue/prefix_target.h5
- red/prefix_target.h5
- u2w/u2w_target.h5
- vds.h5
- vds-exc.h5
- vds-excalibur.h5
- vds-exclim.h5
- vds-percival.h5
- vds-percival-unlim.h5
- vds-percival-unlim-maxmin.h5
- a.h5
- b.h5
- c.h5
- d.h5
- vds-simpleIO.h5
- vds-eiger.h5
- )
- if (NOT "${last_test}" STREQUAL "")
- set_tests_properties (EXAMPLES-clear-objects PROPERTIES DEPENDS ${last_test})
- endif ()
- set (last_test "EXAMPLES-clear-objects")
-
- foreach (example ${examples})
- if (HDF5_ENABLE_USING_MEMCHECKER)
- add_test (NAME EXAMPLES-${example} COMMAND $<TARGET_FILE:${example}>)
- else ()
- add_test (NAME EXAMPLES-${example} COMMAND "${CMAKE_COMMAND}"
- -D "TEST_PROGRAM=$<TARGET_FILE:${example}>"
- -D "TEST_ARGS:STRING="
- -D "TEST_EXPECT=0"
- -D "TEST_SKIP_COMPARE=TRUE"
- -D "TEST_OUTPUT=${example}.txt"
- #-D "TEST_REFERENCE=${example}.out"
- -D "TEST_FOLDER=${PROJECT_BINARY_DIR}"
- -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake"
- )
- endif ()
- if (NOT "${last_test}" STREQUAL "")
- set_tests_properties (EXAMPLES-${example} PROPERTIES DEPENDS ${last_test})
- endif ()
- set (last_test "EXAMPLES-${example}")
- endforeach ()
-
- if (BUILD_SHARED_LIBS)
- # Remove any output file left over from previous test run
- add_test (
- NAME EXAMPLES-shared-clear-objects
- COMMAND ${CMAKE_COMMAND}
- -E remove
+ set (test_CLEANFILES
Attributes.h5
btrees_file.h5
cmprss.h5
@@ -131,6 +46,9 @@
soft_link.h5
subset.h5
unix2win.h5
+ blue/prefix_target.h5
+ red/prefix_target.h5
+ u2w/u2w_target.h5
vds.h5
vds-exc.h5
vds-excalibur.h5
@@ -144,46 +62,46 @@
d.h5
vds-simpleIO.h5
vds-eiger.h5
- blue/prefix_target.h5
- red/prefix_target.h5
- u2w/u2w_target.h5
- WORKING_DIRECTORY
- ${PROJECT_BINARY_DIR}/H5EX-shared
- )
- if (NOT "${last_test}" STREQUAL "")
- set_tests_properties (EXAMPLES-shared-clear-objects PROPERTIES DEPENDS ${last_test})
- endif ()
- set (last_test "EXAMPLES-shared-clear-objects")
+ )
- foreach (example ${examples})
- if (HDF5_ENABLE_USING_MEMCHECKER)
- add_test (NAME EXAMPLES-shared-${example} COMMAND $<TARGET_FILE:${example}-shared>)
- else ()
- add_test (NAME EXAMPLES-shared-${example} COMMAND "${CMAKE_COMMAND}"
- -D "TEST_PROGRAM=$<TARGET_FILE:${example}>"
- -D "TEST_ARGS:STRING="
- -D "TEST_EXPECT=0"
- -D "TEST_SKIP_COMPARE=TRUE"
- -D "TEST_OUTPUT=${example}.txt"
- #-D "TEST_REFERENCE=${example}.out"
- -D "TEST_FOLDER=${PROJECT_BINARY_DIR}/H5EX-shared"
- -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake"
- )
- endif ()
- set_tests_properties (EXAMPLES-shared-${example} PROPERTIES WORKING_DIRECTORY ${PROJECT_BINARY_DIR}/H5EX-shared)
- if (NOT "${last_test}" STREQUAL "")
- set_tests_properties (EXAMPLES-shared-${example} PROPERTIES DEPENDS ${last_test})
- endif ()
- set (last_test "EXAMPLES-shared-${example}")
- endforeach ()
+ # Remove any output file left over from previous test run
+ add_test (
+ NAME EXAMPLES-clear-objects
+ COMMAND ${CMAKE_COMMAND}
+ -E remove ${test_CLEANFILES}
+ )
+ if (last_test)
+ set_tests_properties (EXAMPLES-clear-objects PROPERTIES DEPENDS ${last_test})
endif ()
+ set (last_test "EXAMPLES-clear-objects")
+
+ foreach (example ${examples})
+ if (HDF5_ENABLE_USING_MEMCHECKER)
+ add_test (NAME EXAMPLES-${example} COMMAND $<TARGET_FILE:${example}>)
+ else ()
+ add_test (NAME EXAMPLES-${example} COMMAND "${CMAKE_COMMAND}"
+ -D "TEST_PROGRAM=$<TARGET_FILE:${example}>"
+ -D "TEST_ARGS:STRING="
+ -D "TEST_EXPECT=0"
+ -D "TEST_SKIP_COMPARE=TRUE"
+ -D "TEST_OUTPUT=${example}.txt"
+ #-D "TEST_REFERENCE=${example}.out"
+ -D "TEST_FOLDER=${PROJECT_BINARY_DIR}"
+ -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake"
+ )
+ endif ()
+ if (last_test)
+ set_tests_properties (EXAMPLES-${example} PROPERTIES DEPENDS ${last_test})
+ endif ()
+ set (last_test "EXAMPLES-${example}")
+ endforeach ()
### 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_PAR-ph5example COMMAND ${MPIEXEC_EXECUTABLE} ${MPIEXEC_NUMPROC_FLAG} ${MPIEXEC_MAX_NUMPROCS} ${MPIEXEC_PREFLAGS} $<TARGET_FILE:ph5example> ${MPIEXEC_POSTFLAGS})
+ 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_PAR-ph5example COMMAND "${CMAKE_COMMAND}"
+ 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"
@@ -194,29 +112,8 @@
-P "${HDF_RESOURCES_EXT_DIR}/grepTest.cmake"
)
endif ()
- if (NOT "${last_test}" STREQUAL "")
- set_tests_properties (EXAMPLES_PAR-ph5example PROPERTIES DEPENDS ${last_test})
- endif ()
- set (last_test "EXAMPLES_PAR-ph5example")
- if (BUILD_SHARED_LIBS)
- if (HDF5_ENABLE_USING_MEMCHECKER)
- add_test (NAME EXAMPLES_PAR-shared-ph5example COMMAND ${MPIEXEC_EXECUTABLE} ${MPIEXEC_NUMPROC_FLAG} ${MPIEXEC_MAX_NUMPROCS} ${MPIEXEC_PREFLAGS} $<TARGET_FILE:ph5example-shared> ${MPIEXEC_POSTFLAGS})
- else ()
- add_test (NAME EXAMPLES_PAR-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_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}/grepTest.cmake"
- )
- endif ()
- set_tests_properties (EXAMPLES_PAR-shared-ph5example PROPERTIES WORKING_DIRECTORY ${PROJECT_BINARY_DIR}/H5EX-shared)
- if (NOT "${last_test}" STREQUAL "")
- set_tests_properties (EXAMPLES_PAR-shared-ph5example PROPERTIES DEPENDS ${last_test})
- endif ()
- set (last_test "EXAMPLES_PAR-shared-ph5example")
+ if (last_test)
+ set_tests_properties (MPI_TEST_EXAMPLES-ph5example PROPERTIES DEPENDS ${last_test})
endif ()
+ set (last_test "MPI_TEST_EXAMPLES-ph5example")
endif ()
diff --git a/fortran/Makefile.am b/fortran/Makefile.am
index 38084b9..c07fa3e 100644
--- a/fortran/Makefile.am
+++ b/fortran/Makefile.am
@@ -22,14 +22,27 @@
include $(top_srcdir)/config/commence.am
-if BUILD_PARALLEL_CONDITIONAL
+if BUILD_TESTS_PARALLEL_CONDITIONAL
TESTPARALLEL_DIR=testpar
+else
+ TESTPARALLEL_DIR=
+endif
+if BUILD_TESTS_CONDITIONAL
+ TESTSERIAL_DIR=test
+else
+ TESTSERIAL_DIR=
endif
# Subdirectories in build order, not including examples directory
## Only recurse into subdirectories if HDF5 is configured to use Fortran.
if BUILD_FORTRAN_CONDITIONAL
- SUBDIRS=src test $(TESTPARALLEL_DIR)
+ SUBDIRS=src $(TESTSERIAL_DIR) $(TESTPARALLEL_DIR)
+
+# Test with just the native connector, with a single pass-through connector
+# and with a doubly-stacked pass-through.
+VOL_LIST = native "pass_through under_vol=0;under_info={}" \
+ "pass_through under_vol=505;under_info={under_vol=0;under_info={}}"
+
endif
# All directories that have Makefiles
diff --git a/fortran/examples/CMakeLists.txt b/fortran/examples/CMakeLists.txt
index 0c570c6..e8dddd3 100644
--- a/fortran/examples/CMakeLists.txt
+++ b/fortran/examples/CMakeLists.txt
@@ -35,56 +35,43 @@ set (F2003_examples
foreach (example ${examples})
add_executable (f90_ex_${example} ${HDF5_F90_EXAMPLES_SOURCE_DIR}/${example}.f90)
- target_include_directories (f90_ex_${example}
- PRIVATE
- "${CMAKE_Fortran_MODULE_DIRECTORY}/static;${HDF5_SRC_DIR};${HDF5_BINARY_DIR};${HDF5_F90_BINARY_DIR};${HDF5_F90_BINARY_DIR}/static"
- )
target_compile_options(f90_ex_${example}
PRIVATE
$<$<STREQUAL:"x${CMAKE_Fortran_SIMULATE_ID}","xMSVC">:${WIN_COMPILE_FLAGS}>
)
- target_link_libraries (f90_ex_${example}
- PRIVATE
- ${HDF5_F90_LIB_TARGET} ${HDF5_LIB_TARGET}
- )
# set_property(TARGET f90_ex_${example} APPEND PROPERTY
# LINK_FLAGS $<$<STREQUAL:"x${CMAKE_Fortran_SIMULATE_ID}","xMSVC">:"-SUBSYSTEM:CONSOLE">
# )
# set_property(TARGET f90_ex_${example} APPEND PROPERTY
-# LINK_FLAGS $<$<STREQUAL:"x${CMAKE_Fortran_SIMULATE_ID}","xMSVC">:>
+# LINK_FLAGS $<$<STREQUAL:"x${CMAKE_Fortran_SIMULATE_ID}","xMSVC">:${WIN_LINK_FLAGS}>
# )
if(MSVC)
set_property(TARGET f90_ex_${example} PROPERTY LINK_FLAGS "/SUBSYSTEM:CONSOLE ${WIN_LINK_FLAGS}")
endif()
- set_target_properties (f90_ex_${example} PROPERTIES
- LINKER_LANGUAGE Fortran
- FOLDER examples/fortran
- Fortran_MODULE_DIRECTORY ${CMAKE_Fortran_MODULE_DIRECTORY}/static
- )
- if (BUILD_SHARED_LIBS)
- add_executable (f90_ex_${example}-shared ${HDF5_F90_EXAMPLES_SOURCE_DIR}/${example}.f90)
- target_include_directories (f90_ex_${example}-shared
+ if (NOT BUILD_SHARED_LIBS)
+ target_include_directories (f90_ex_${example}
PRIVATE
- "${CMAKE_Fortran_MODULE_DIRECTORY}/shared;${HDF5_SRC_DIR};${HDF5_BINARY_DIR};${HDF5_F90_BINARY_DIR};${HDF5_F90_BINARY_DIR}/shared"
+ "${CMAKE_Fortran_MODULE_DIRECTORY}/static;${HDF5_SRC_DIR};${HDF5_BINARY_DIR};${HDF5_F90_BINARY_DIR};${HDF5_F90_BINARY_DIR}/static"
)
- target_compile_options(f90_ex_${example}-shared
+ target_link_libraries (f90_ex_${example}
PRIVATE
- $<$<STREQUAL:"x${CMAKE_Fortran_SIMULATE_ID}","xMSVC">:${WIN_COMPILE_FLAGS}>
+ ${HDF5_F90_LIB_TARGET} ${HDF5_LIB_TARGET}
+ )
+ set_target_properties (f90_ex_${example} PROPERTIES
+ LINKER_LANGUAGE Fortran
+ FOLDER examples/fortran
+ Fortran_MODULE_DIRECTORY ${CMAKE_Fortran_MODULE_DIRECTORY}/static
)
- target_link_libraries (f90_ex_${example}-shared
+ else ()
+ target_include_directories (f90_ex_${example}
+ PRIVATE
+ "${CMAKE_Fortran_MODULE_DIRECTORY}/shared;${HDF5_SRC_DIR};${HDF5_BINARY_DIR};${HDF5_F90_BINARY_DIR};${HDF5_F90_BINARY_DIR}/shared"
+ )
+ target_link_libraries (f90_ex_${example}
PRIVATE
${HDF5_F90_LIBSH_TARGET} ${HDF5_LIBSH_TARGET}
)
-# set_property(TARGET f90_ex_${example}-shared APPEND PROPERTY
-# LINK_FLAGS $<$<STREQUAL:"x${CMAKE_Fortran_SIMULATE_ID}","xMSVC">:"-SUBSYSTEM:CONSOLE">
-# )
-# set_property(TARGET f90_ex_${example}-shared APPEND PROPERTY
-# LINK_FLAGS $<$<STREQUAL:"x${CMAKE_Fortran_SIMULATE_ID}","xMSVC">:${WIN_LINK_FLAGS}>
-# )
- if(MSVC)
- set_property(TARGET f90_ex_${example}-shared PROPERTY LINK_FLAGS "/SUBSYSTEM:CONSOLE ${WIN_LINK_FLAGS}")
- endif()
- set_target_properties (f90_ex_${example}-shared PROPERTIES
+ set_target_properties (f90_ex_${example} PROPERTIES
LINKER_LANGUAGE Fortran
FOLDER examples/fortran
Fortran_MODULE_DIRECTORY ${CMAKE_Fortran_MODULE_DIRECTORY}/shared
@@ -94,18 +81,10 @@ endforeach ()
foreach (example ${F2003_examples})
add_executable (f03_ex_${example} ${HDF5_F90_EXAMPLES_SOURCE_DIR}/${example}.f90)
- target_include_directories (f03_ex_${example}
- PRIVATE
- "${CMAKE_Fortran_MODULE_DIRECTORY}/static;${HDF5_SRC_DIR};${HDF5_BINARY_DIR};${HDF5_F90_BINARY_DIR};${HDF5_F90_BINARY_DIR}/static"
- )
target_compile_options(f03_ex_${example}
PRIVATE
$<$<STREQUAL:"x${CMAKE_Fortran_SIMULATE_ID}","xMSVC">:${WIN_COMPILE_FLAGS}>
)
- target_link_libraries (f03_ex_${example}
- PRIVATE
- ${HDF5_F90_LIB_TARGET} ${HDF5_LIB_TARGET}
- )
# set_property(TARGET f03_ex_${example} APPEND PROPERTY
# LINK_FLAGS $<$<STREQUAL:"x${CMAKE_Fortran_SIMULATE_ID}","xMSVC">:"-SUBSYSTEM:CONSOLE">
# )
@@ -115,35 +94,30 @@ foreach (example ${F2003_examples})
if(MSVC)
set_property(TARGET f03_ex_${example} PROPERTY LINK_FLAGS "/SUBSYSTEM:CONSOLE ${WIN_LINK_FLAGS}")
endif()
- set_target_properties (f03_ex_${example} PROPERTIES
- LINKER_LANGUAGE Fortran
- FOLDER examples/fortran03
- Fortran_MODULE_DIRECTORY ${CMAKE_Fortran_MODULE_DIRECTORY}/static
- )
- if (BUILD_SHARED_LIBS)
- add_executable (f03_ex_${example}-shared ${HDF5_F90_EXAMPLES_SOURCE_DIR}/${example}.f90)
- target_include_directories (f03_ex_${example}-shared
+ if (NOT ONLY_SHARED_LIBS)
+ target_include_directories (f03_ex_${example}
PRIVATE
- "${CMAKE_Fortran_MODULE_DIRECTORY}/shared;${HDF5_SRC_DIR};${HDF5_BINARY_DIR};${HDF5_F90_BINARY_DIR};${HDF5_F90_BINARY_DIR}/shared"
+ "${CMAKE_Fortran_MODULE_DIRECTORY}/static;${HDF5_SRC_DIR};${HDF5_BINARY_DIR};${HDF5_F90_BINARY_DIR};${HDF5_F90_BINARY_DIR}/static"
)
- target_compile_options(f03_ex_${example}-shared
+ target_link_libraries (f03_ex_${example}
PRIVATE
- $<$<STREQUAL:"x${CMAKE_Fortran_SIMULATE_ID}","xMSVC">:${WIN_COMPILE_FLAGS}>
+ ${HDF5_F90_LIB_TARGET} ${HDF5_LIB_TARGET}
)
- target_link_libraries (f03_ex_${example}-shared
+ set_target_properties (f03_ex_${example} PROPERTIES
+ LINKER_LANGUAGE Fortran
+ FOLDER examples/fortran03
+ Fortran_MODULE_DIRECTORY ${CMAKE_Fortran_MODULE_DIRECTORY}/static
+ )
+ else ()
+ target_include_directories (f03_ex_${example}
+ PRIVATE
+ "${CMAKE_Fortran_MODULE_DIRECTORY}/shared;${HDF5_SRC_DIR};${HDF5_BINARY_DIR};${HDF5_F90_BINARY_DIR};${HDF5_F90_BINARY_DIR}/shared"
+ )
+ target_link_libraries (f03_ex_${example}
PRIVATE
${HDF5_F90_LIBSH_TARGET} ${HDF5_LIBSH_TARGET}
)
-# set_property(TARGET f03_ex_${example}-shared APPEND PROPERTY
-# LINK_FLAGS $<$<STREQUAL:"x${CMAKE_Fortran_SIMULATE_ID}","xMSVC">:"-SUBSYSTEM:CONSOLE">
-# )
-# set_property(TARGET f03_ex_${example}-shared APPEND PROPERTY
-# LINK_FLAGS $<$<STREQUAL:"x${CMAKE_Fortran_SIMULATE_ID}","xMSVC">:${WIN_LINK_FLAGS}>
-# )
- if(MSVC)
- set_property(TARGET f03_ex_${example}-shared PROPERTY LINK_FLAGS "/SUBSYSTEM:CONSOLE ${WIN_LINK_FLAGS}")
- endif()
- set_target_properties (f03_ex_${example}-shared PROPERTIES
+ set_target_properties (f03_ex_${example} PROPERTIES
LINKER_LANGUAGE Fortran
FOLDER examples/fortran03
Fortran_MODULE_DIRECTORY ${CMAKE_Fortran_MODULE_DIRECTORY}/shared
@@ -153,19 +127,10 @@ endforeach ()
if (H5_HAVE_PARALLEL AND MPI_Fortran_FOUND)
add_executable (f90_ex_ph5example ${HDF5_F90_EXAMPLES_SOURCE_DIR}/ph5example.f90)
- target_include_directories (f90_ex_ph5example
- PRIVATE
- "${CMAKE_Fortran_MODULE_DIRECTORY}/static;${HDF5_SRC_DIR};${HDF5_BINARY_DIR};${HDF5_F90_BINARY_DIR};${HDF5_F90_BINARY_DIR}/static;$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_Fortran_INCLUDE_DIRS}>"
- )
target_compile_options(f90_ex_ph5example
PRIVATE
$<$<STREQUAL:"x${CMAKE_Fortran_SIMULATE_ID}","xMSVC">:${WIN_COMPILE_FLAGS}>
)
- target_link_libraries (f90_ex_ph5example
- PRIVATE
- ${HDF5_F90_LIB_TARGET} ${HDF5_LIB_TARGET}
- $<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_Fortran_LIBRARIES}>
- )
# set_property(TARGET f90_ex_ph5example APPEND PROPERTY
# LINK_FLAGS $<$<STREQUAL:"x${CMAKE_Fortran_SIMULATE_ID}","xMSVC">:"-SUBSYSTEM:CONSOLE">
# )
@@ -175,36 +140,32 @@ if (H5_HAVE_PARALLEL AND MPI_Fortran_FOUND)
if(MSVC)
set_property(TARGET f90_ex_ph5example PROPERTY LINK_FLAGS "/SUBSYSTEM:CONSOLE ${WIN_LINK_FLAGS}")
endif()
- set_target_properties (f90_ex_ph5example PROPERTIES
- LINKER_LANGUAGE Fortran
- FOLDER examples/fortran
- Fortran_MODULE_DIRECTORY ${CMAKE_Fortran_MODULE_DIRECTORY}/static
- )
- if (BUILD_SHARED_LIBS)
- add_executable (f90_ex_ph5example-shared ${HDF5_F90_EXAMPLES_SOURCE_DIR}/ph5example.f90)
- target_include_directories (f90_ex_ph5example-shared
+ if (NOT ONLY_SHARED_LIBS)
+ target_include_directories (f90_ex_ph5example
PRIVATE
- "${CMAKE_Fortran_MODULE_DIRECTORY}/shared;${HDF5_SRC_DIR};${HDF5_BINARY_DIR};${HDF5_F90_BINARY_DIR};${HDF5_F90_BINARY_DIR}/shared;$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_Fortran_INCLUDE_DIRS}>"
+ "${CMAKE_Fortran_MODULE_DIRECTORY}/static;${HDF5_SRC_DIR};${HDF5_BINARY_DIR};${HDF5_F90_BINARY_DIR};${HDF5_F90_BINARY_DIR}/static;$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_Fortran_INCLUDE_DIRS}>"
)
- target_compile_options(f90_ex_ph5example-shared
+ target_link_libraries (f90_ex_ph5example
PRIVATE
- $<$<STREQUAL:"x${CMAKE_Fortran_SIMULATE_ID}","xMSVC">:${WIN_COMPILE_FLAGS}>
+ ${HDF5_F90_LIB_TARGET} ${HDF5_LIB_TARGET}
+ $<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_Fortran_LIBRARIES}>
+ )
+ set_target_properties (f90_ex_ph5example PROPERTIES
+ LINKER_LANGUAGE Fortran
+ FOLDER examples/fortran
+ Fortran_MODULE_DIRECTORY ${CMAKE_Fortran_MODULE_DIRECTORY}/static
+ )
+ else ()
+ target_include_directories (f90_ex_ph5example
+ PRIVATE
+ "${CMAKE_Fortran_MODULE_DIRECTORY}/shared;${HDF5_SRC_DIR};${HDF5_BINARY_DIR};${HDF5_F90_BINARY_DIR};${HDF5_F90_BINARY_DIR}/shared;$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_Fortran_INCLUDE_DIRS}>"
)
- target_link_libraries (f90_ex_ph5example-shared
+ target_link_libraries (f90_ex_ph5example
PRIVATE
${HDF5_F90_LIBSH_TARGET} ${HDF5_LIBSH_TARGET}
$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_Fortran_LIBRARIES}>
)
-# set_property(TARGET f90_ex_ph5example-shared APPEND PROPERTY
-# LINK_FLAGS $<$<STREQUAL:"x${CMAKE_Fortran_SIMULATE_ID}","xMSVC">:"-SUBSYSTEM:CONSOLE">
-# )
-# set_property(TARGET f90_ex_ph5example-shared APPEND PROPERTY
-# LINK_FLAGS $<$<STREQUAL:"x${CMAKE_Fortran_SIMULATE_ID}","xMSVC">:${WIN_LINK_FLAGS}>
-# )
- if(MSVC)
- set_property(TARGET f90_ex_ph5example-shared PROPERTY LINK_FLAGS "/SUBSYSTEM:CONSOLE ${WIN_LINK_FLAGS}")
- endif()
- set_target_properties (f90_ex_ph5example-shared PROPERTIES
+ set_target_properties (f90_ex_ph5example PROPERTIES
LINKER_LANGUAGE Fortran
FOLDER examples/fortran
Fortran_MODULE_DIRECTORY ${CMAKE_Fortran_MODULE_DIRECTORY}/shared
diff --git a/fortran/examples/CMakeTests.cmake b/fortran/examples/CMakeTests.cmake
index 323cf91..1ad606c 100644
--- a/fortran/examples/CMakeTests.cmake
+++ b/fortran/examples/CMakeTests.cmake
@@ -16,36 +16,7 @@
##############################################################################
##############################################################################
- # Remove any output file left over from previous test run
- add_test (
- NAME f90_ex-clear-objects
- COMMAND ${CMAKE_COMMAND}
- -E remove
- compound.h5
- copy1.h5
- copy2.h5
- dsetf.h5
- extend.h5
- FORTRAN.h5
- groupf.h5
- groupsf.h5
- h5_cmprss.h5
- mount1.h5
- mount2.h5
- sdsf.h5
- subset.h5
- SDScompound.h5
- test.h5
- )
- if (NOT "${last_test}" STREQUAL "")
- set_tests_properties (f90_ex-clear-objects PROPERTIES DEPENDS ${last_test})
- endif ()
- set (last_test "f90_ex-clear-objects")
- if (BUILD_SHARED_LIBS)
- add_test (
- NAME f90_ex-shared-clear-objects
- COMMAND ${CMAKE_COMMAND}
- -E remove
+ set (test_CLEANFILES
compound.h5
copy1.h5
copy2.h5
@@ -61,12 +32,18 @@
subset.h5
SDScompound.h5
test.h5
- )
- if (NOT "${last_test}" STREQUAL "")
- set_tests_properties (f90_ex-shared-clear-objects PROPERTIES DEPENDS ${last_test})
- endif ()
- set (last_test "f90_ex-shared-clear-objects")
+ )
+
+ # Remove any output file left over from previous test run
+ add_test (
+ NAME f90_ex-clear-objects
+ COMMAND ${CMAKE_COMMAND}
+ -E remove ${test_CLEANFILES}
+ )
+ if (last_test)
+ set_tests_properties (f90_ex-clear-objects PROPERTIES DEPENDS ${last_test})
endif ()
+ set (last_test "f90_ex-clear-objects")
foreach (example ${examples})
if (HDF5_ENABLE_USING_MEMCHECKER)
@@ -83,30 +60,10 @@ foreach (example ${examples})
-P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake"
)
endif ()
- if (NOT "${last_test}" STREQUAL "")
+ if (last_test)
set_tests_properties (f90_ex_${example} PROPERTIES DEPENDS ${last_test})
endif ()
set (last_test "f90_ex_${example}")
- if (BUILD_SHARED_LIBS)
- if (HDF5_ENABLE_USING_MEMCHECKER)
- add_test (NAME f90_ex-shared_${example} COMMAND $<TARGET_FILE:f90_ex_${example}-shared>)
- else ()
- add_test (NAME f90_ex-shared_${example} COMMAND "${CMAKE_COMMAND}"
- -D "TEST_PROGRAM=$<TARGET_FILE:f90_ex_${example}-shared>"
- -D "TEST_ARGS:STRING="
- -D "TEST_EXPECT=0"
- -D "TEST_SKIP_COMPARE=TRUE"
- -D "TEST_OUTPUT=f90_ex_${example}-shared.txt"
- #-D "TEST_REFERENCE=f90_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 (f90_ex-shared_${example} PROPERTIES DEPENDS ${last_test})
- endif ()
- set (last_test "f90_ex-shared_${example}")
- endif ()
endforeach ()
foreach (example ${F2003_examples})
@@ -124,35 +81,12 @@ foreach (example ${F2003_examples})
-P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake"
)
endif ()
- if (NOT "${last_test}" STREQUAL "")
+ if (last_test)
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-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 ()
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})
- 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})
- endif ()
+ 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})
endif ()
diff --git a/fortran/src/CMakeLists.txt b/fortran/src/CMakeLists.txt
index f71e820..b01e4d4 100644
--- a/fortran/src/CMakeLists.txt
+++ b/fortran/src/CMakeLists.txt
@@ -40,7 +40,7 @@ set (Fortran_COMPILER_ID CMAKE_Fortran_COMPILER_ID)
#-----------------------------------------------------------------------------
add_executable (H5_buildiface ${HDF5_F90_SRC_SOURCE_DIR}/H5_buildiface.F90)
-target_include_directories(H5_buildiface
+target_include_directories (H5_buildiface
PRIVATE
"${HDF5_BINARY_DIR};${HDF5_F90_BINARY_DIR}"
)
@@ -69,24 +69,28 @@ if (BUILD_SHARED_LIBS)
file (MAKE_DIRECTORY "${HDF5_F90_BINARY_DIR}/shared")
set (MODSH_BUILD_DIR ${CMAKE_Fortran_MODULE_DIRECTORY}/shared/${HDF_CFG_BUILD_TYPE})
endif ()
-file (MAKE_DIRECTORY "${HDF5_F90_BINARY_DIR}/static")
-set (MOD_BUILD_DIR ${CMAKE_Fortran_MODULE_DIRECTORY}/static/${HDF_CFG_BUILD_TYPE})
+if (NOT ONLY_SHARED_LIBS)
+ file (MAKE_DIRECTORY "${HDF5_F90_BINARY_DIR}/static")
+ set (MOD_BUILD_DIR ${CMAKE_Fortran_MODULE_DIRECTORY}/static/${HDF_CFG_BUILD_TYPE})
+endif ()
#-----------------------------------------------------------------------------
add_executable (H5match_types
${HDF5_F90_BINARY_DIR}/H5fort_type_defines.h
${HDF5_F90_SRC_SOURCE_DIR}/H5match_types.c
)
-target_include_directories(H5match_types PRIVATE "${HDF5_BINARY_DIR};${HDF5_SRC_DIR};${HDF5_F90_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>")
-add_custom_command (
- OUTPUT ${HDF5_F90_BINARY_DIR}/static/H5f90i_gen.h
- ${HDF5_F90_BINARY_DIR}/static/H5fortran_types.F90
- COMMAND $<TARGET_FILE:H5match_types>
- WORKING_DIRECTORY ${HDF5_F90_BINARY_DIR}/static
- DEPENDS H5match_types
-)
-set_source_files_properties (${HDF5_F90_BINARY_DIR}/static/H5f90i_gen.h PROPERTIES GENERATED TRUE)
-set_source_files_properties (${HDF5_F90_BINARY_DIR}/static/H5fortran_types.F90 PROPERTIES GENERATED TRUE)
+target_include_directories (H5match_types PRIVATE "${HDF5_BINARY_DIR};${HDF5_SRC_DIR};${HDF5_F90_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>")
+if (NOT ONLY_SHARED_LIBS)
+ add_custom_command (
+ OUTPUT ${HDF5_F90_BINARY_DIR}/static/H5f90i_gen.h
+ ${HDF5_F90_BINARY_DIR}/static/H5fortran_types.F90
+ COMMAND $<TARGET_FILE:H5match_types>
+ WORKING_DIRECTORY ${HDF5_F90_BINARY_DIR}/static
+ DEPENDS H5match_types
+ )
+ set_source_files_properties (${HDF5_F90_BINARY_DIR}/static/H5f90i_gen.h PROPERTIES GENERATED TRUE)
+ set_source_files_properties (${HDF5_F90_BINARY_DIR}/static/H5fortran_types.F90 PROPERTIES GENERATED TRUE)
+endif ()
if (BUILD_SHARED_LIBS)
add_custom_command (
OUTPUT ${HDF5_F90_BINARY_DIR}/shared/H5f90i_gen.h
@@ -131,24 +135,26 @@ set (f90CStub_C_SHHDRS
${HDF5_F90_BINARY_DIR}/shared/H5f90i_gen.h
)
-add_library (${HDF5_F90_C_LIB_TARGET} STATIC ${f90CStub_C_SOURCES} ${f90CStub_C_HDRS})
-target_include_directories(${HDF5_F90_C_LIB_TARGET}
- PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};${HDF5_F90_BINARY_DIR};${HDF5_F90_BINARY_DIR}/static;$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>"
- INTERFACE "$<INSTALL_INTERFACE:$<INSTALL_PREFIX>/include>"
-)
-TARGET_C_PROPERTIES (${HDF5_F90_C_LIB_TARGET} STATIC)
-target_link_libraries (${HDF5_F90_C_LIB_TARGET} PUBLIC ${HDF5_LIB_TARGET})
-set_global_variable (HDF5_LIBRARIES_TO_EXPORT "${HDF5_LIBRARIES_TO_EXPORT};${HDF5_F90_C_LIB_TARGET}")
-H5_SET_LIB_OPTIONS (${HDF5_F90_C_LIB_TARGET} ${HDF5_F90_C_LIB_NAME} STATIC 0)
-set_target_properties (${HDF5_F90_C_LIB_TARGET} PROPERTIES
- FOLDER libraries/fortran
- LINKER_LANGUAGE C
-)
-set (install_targets ${HDF5_F90_C_LIB_TARGET})
+if (NOT ONLY_SHARED_LIBS)
+ add_library (${HDF5_F90_C_LIB_TARGET} STATIC ${f90CStub_C_SOURCES} ${f90CStub_C_HDRS})
+ target_include_directories (${HDF5_F90_C_LIB_TARGET}
+ PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};${HDF5_F90_BINARY_DIR};${HDF5_F90_BINARY_DIR}/static;$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>"
+ INTERFACE "$<INSTALL_INTERFACE:$<INSTALL_PREFIX>/include>"
+ )
+ TARGET_C_PROPERTIES (${HDF5_F90_C_LIB_TARGET} STATIC)
+ target_link_libraries (${HDF5_F90_C_LIB_TARGET} PUBLIC ${HDF5_LIB_TARGET})
+ set_global_variable (HDF5_LIBRARIES_TO_EXPORT "${HDF5_LIBRARIES_TO_EXPORT};${HDF5_F90_C_LIB_TARGET}")
+ H5_SET_LIB_OPTIONS (${HDF5_F90_C_LIB_TARGET} ${HDF5_F90_C_LIB_NAME} STATIC 0)
+ set_target_properties (${HDF5_F90_C_LIB_TARGET} PROPERTIES
+ FOLDER libraries/fortran
+ LINKER_LANGUAGE C
+ )
+ set (install_targets ${HDF5_F90_C_LIB_TARGET})
+endif ()
if (BUILD_SHARED_LIBS)
add_library (${HDF5_F90_C_LIBSH_TARGET} SHARED ${f90CStub_C_SOURCES} ${f90CStub_C_SHHDRS})
- target_include_directories(${HDF5_F90_C_LIBSH_TARGET}
+ target_include_directories (${HDF5_F90_C_LIBSH_TARGET}
PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};${HDF5_F90_BINARY_DIR};${HDF5_F90_BINARY_DIR}/shared;$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>"
INTERFACE "$<INSTALL_INTERFACE:$<INSTALL_PREFIX>/include>"
)
@@ -174,17 +180,19 @@ set (f90_F_GEN_SOURCES
${HDF5_F90_SRC_SOURCE_DIR}/H5Dff.F90
${HDF5_F90_SRC_SOURCE_DIR}/H5Pff.F90
)
-add_custom_command (
- OUTPUT ${HDF5_F90_BINARY_DIR}/static/H5_gen.F90
- COMMAND $<TARGET_FILE:H5_buildiface>
- WORKING_DIRECTORY ${HDF5_F90_BINARY_DIR}/static
- DEPENDS ${f90_F_GEN_SOURCES}
- COMMENT "Generating the H5_gen.F90 file"
-)
-add_custom_target (H5gen ALL
- DEPENDS ${HDF5_F90_BINARY_DIR}/static/H5_gen.F90
-)
-set_source_files_properties (${HDF5_F90_BINARY_DIR}/static/H5_gen.F90 PROPERTIES GENERATED TRUE)
+if (NOT ONLY_SHARED_LIBS)
+ add_custom_command (
+ OUTPUT ${HDF5_F90_BINARY_DIR}/static/H5_gen.F90
+ COMMAND $<TARGET_FILE:H5_buildiface>
+ WORKING_DIRECTORY ${HDF5_F90_BINARY_DIR}/static
+ DEPENDS ${f90_F_GEN_SOURCES}
+ COMMENT "Generating the H5_gen.F90 file"
+ )
+ add_custom_target (H5gen ALL
+ DEPENDS ${HDF5_F90_BINARY_DIR}/static/H5_gen.F90
+ )
+ set_source_files_properties (${HDF5_F90_BINARY_DIR}/static/H5_gen.F90 PROPERTIES GENERATED TRUE)
+endif ()
if (BUILD_SHARED_LIBS)
add_custom_command (
@@ -217,21 +225,24 @@ set (f90_F_BASE_SOURCES
${HDF5_F90_SRC_SOURCE_DIR}/H5Rff.F90
${HDF5_F90_SRC_SOURCE_DIR}/H5Sff.F90
${HDF5_F90_SRC_SOURCE_DIR}/H5Tff.F90
+ ${HDF5_F90_SRC_SOURCE_DIR}/H5VLff.F90
${HDF5_F90_SRC_SOURCE_DIR}/H5Zff.F90
)
-set (f90_F_SOURCES
- # generated file
- ${HDF5_F90_BINARY_DIR}/static/H5fortran_types.F90
+if (NOT ONLY_SHARED_LIBS)
+ set (f90_F_SOURCES
+ # generated file
+ ${HDF5_F90_BINARY_DIR}/static/H5fortran_types.F90
- ${f90_F_BASE_SOURCES}
+ ${f90_F_BASE_SOURCES}
- # generated file
- ${HDF5_F90_BINARY_DIR}/static/H5_gen.F90
+ # generated file
+ ${HDF5_F90_BINARY_DIR}/static/H5_gen.F90
- # normal distribution
- ${HDF5_F90_SRC_SOURCE_DIR}/HDF5.F90
-)
+ # normal distribution
+ ${HDF5_F90_SRC_SOURCE_DIR}/HDF5.F90
+ )
+endif ()
if (BUILD_SHARED_LIBS)
set (f90_F_SOURCES_SHARED
# generated file
@@ -250,43 +261,45 @@ endif ()
#-----------------------------------------------------------------------------
# Add Main fortran library
#-----------------------------------------------------------------------------
-add_library (${HDF5_F90_LIB_TARGET} STATIC ${f90_F_SOURCES})
-target_include_directories (${HDF5_F90_LIB_TARGET}
- PRIVATE
- "${HDF5_F90_SRC_SOURCE_DIR};${CMAKE_Fortran_MODULE_DIRECTORY}/static;${HDF5_F90_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_Fortran_INCLUDE_DIRS}>"
- INTERFACE
- "$<INSTALL_INTERFACE:$<INSTALL_PREFIX>/include>"
-)
-target_compile_definitions(${HDF5_F90_LIB_TARGET}
- PRIVATE
- $<$<STREQUAL:"x${CMAKE_Fortran_SIMULATE_ID}","xMSVC">:HDF5F90_WINDOWS>
- $<$<STREQUAL:"x${CMAKE_Fortran_SIMULATE_ID}","xMSVC">:${WIN_COMPILE_FLAGS}>
-)
-target_link_libraries (${HDF5_F90_LIB_TARGET}
- PUBLIC
- ${HDF5_F90_C_LIB_TARGET}
- PRIVATE
- ${LINK_Fortran_LIBS}
- $<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_Fortran_LIBRARIES}>
-)
-#set_property(TARGET ${HDF5_F90_LIB_TARGET} APPEND PROPERTY
-# LINK_FLAGS $<$<STREQUAL:"x${CMAKE_Fortran_SIMULATE_ID}","xMSVC">:"-SUBSYSTEM:CONSOLE">
-#)
-#set_property(TARGET ${HDF5_F90_LIB_TARGET} APPEND PROPERTY
-# LINK_FLAGS $<$<STREQUAL:"x${CMAKE_Fortran_SIMULATE_ID}","xMSVC">:${WIN_LINK_FLAGS}>
-#)
-if(MSVC)
- set_property(TARGET ${HDF5_F90_LIB_TARGET} PROPERTY LINK_FLAGS "/SUBSYSTEM:CONSOLE ${WIN_LINK_FLAGS}")
-endif()
-set_target_properties (${HDF5_F90_LIB_TARGET} PROPERTIES
- FOLDER libraries/fortran
- LINKER_LANGUAGE Fortran
- Fortran_MODULE_DIRECTORY ${CMAKE_Fortran_MODULE_DIRECTORY}/static
-)
-H5_SET_LIB_OPTIONS (${HDF5_F90_LIB_TARGET} ${HDF5_F90_LIB_NAME} STATIC 0)
-set_global_variable (HDF5_LIBRARIES_TO_EXPORT "${HDF5_LIBRARIES_TO_EXPORT};${HDF5_F90_LIB_TARGET}")
-set (install_targets ${install_targets} ${HDF5_F90_LIB_TARGET})
-add_dependencies(${HDF5_F90_LIB_TARGET} H5gen)
+if (NOT ONLY_SHARED_LIBS)
+ add_library (${HDF5_F90_LIB_TARGET} STATIC ${f90_F_SOURCES})
+ target_include_directories (${HDF5_F90_LIB_TARGET}
+ PRIVATE
+ "${HDF5_F90_SRC_SOURCE_DIR};${CMAKE_Fortran_MODULE_DIRECTORY}/static;${HDF5_F90_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_Fortran_INCLUDE_DIRS}>"
+ INTERFACE
+ "$<INSTALL_INTERFACE:$<INSTALL_PREFIX>/include>"
+ )
+ target_compile_definitions(${HDF5_F90_LIB_TARGET}
+ PRIVATE
+ $<$<STREQUAL:"x${CMAKE_Fortran_SIMULATE_ID}","xMSVC">:HDF5F90_WINDOWS>
+ $<$<STREQUAL:"x${CMAKE_Fortran_SIMULATE_ID}","xMSVC">:${WIN_COMPILE_FLAGS}>
+ )
+ target_link_libraries (${HDF5_F90_LIB_TARGET}
+ PUBLIC
+ ${HDF5_F90_C_LIB_TARGET}
+ PRIVATE
+ ${LINK_Fortran_LIBS}
+ $<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_Fortran_LIBRARIES}>
+ )
+# set_property(TARGET ${HDF5_F90_LIB_TARGET} APPEND PROPERTY
+# LINK_FLAGS $<$<STREQUAL:"x${CMAKE_Fortran_SIMULATE_ID}","xMSVC">:"-SUBSYSTEM:CONSOLE">
+# )
+# set_property(TARGET ${HDF5_F90_LIB_TARGET} APPEND PROPERTY
+# LINK_FLAGS $<$<STREQUAL:"x${CMAKE_Fortran_SIMULATE_ID}","xMSVC">:${WIN_LINK_FLAGS}>
+# )
+ if(MSVC)
+ set_property(TARGET ${HDF5_F90_LIB_TARGET} PROPERTY LINK_FLAGS "/SUBSYSTEM:CONSOLE ${WIN_LINK_FLAGS}")
+ endif()
+ set_target_properties (${HDF5_F90_LIB_TARGET} PROPERTIES
+ FOLDER libraries/fortran
+ LINKER_LANGUAGE Fortran
+ Fortran_MODULE_DIRECTORY ${CMAKE_Fortran_MODULE_DIRECTORY}/static
+ )
+ H5_SET_LIB_OPTIONS (${HDF5_F90_LIB_TARGET} ${HDF5_F90_LIB_NAME} STATIC 0)
+ set_global_variable (HDF5_LIBRARIES_TO_EXPORT "${HDF5_LIBRARIES_TO_EXPORT};${HDF5_F90_LIB_TARGET}")
+ set (install_targets ${install_targets} ${HDF5_F90_LIB_TARGET})
+ add_dependencies(${HDF5_F90_LIB_TARGET} H5gen)
+endif ()
if (BUILD_SHARED_LIBS)
add_library (${HDF5_F90_LIBSH_TARGET} SHARED ${f90_F_SOURCES_SHARED})
@@ -351,35 +364,38 @@ install (
fortheaders
)
-set (mod_files
- ${MOD_BUILD_DIR}/h5fortran_types.mod
- ${MOD_BUILD_DIR}/hdf5.mod
- ${MOD_BUILD_DIR}/h5fortkit.mod
- ${MOD_BUILD_DIR}/h5global.mod
- ${MOD_BUILD_DIR}/h5a.mod
- ${MOD_BUILD_DIR}/h5d.mod
- ${MOD_BUILD_DIR}/h5e.mod
- ${MOD_BUILD_DIR}/h5f.mod
- ${MOD_BUILD_DIR}/h5g.mod
- ${MOD_BUILD_DIR}/h5i.mod
- ${MOD_BUILD_DIR}/h5l.mod
- ${MOD_BUILD_DIR}/h5lib.mod
- ${MOD_BUILD_DIR}/h5o.mod
- ${MOD_BUILD_DIR}/h5p.mod
- ${MOD_BUILD_DIR}/h5r.mod
- ${MOD_BUILD_DIR}/h5s.mod
- ${MOD_BUILD_DIR}/h5t.mod
- ${MOD_BUILD_DIR}/h5z.mod
- ${MOD_BUILD_DIR}/h5_gen.mod
-)
-install (
- FILES
- ${mod_files}
- DESTINATION
- ${HDF5_INSTALL_INCLUDE_DIR}/static
- COMPONENT
- fortheaders
-)
+if (NOT ONLY_SHARED_LIBS)
+ set (mod_files
+ ${MOD_BUILD_DIR}/h5fortran_types.mod
+ ${MOD_BUILD_DIR}/hdf5.mod
+ ${MOD_BUILD_DIR}/h5fortkit.mod
+ ${MOD_BUILD_DIR}/h5global.mod
+ ${MOD_BUILD_DIR}/h5a.mod
+ ${MOD_BUILD_DIR}/h5d.mod
+ ${MOD_BUILD_DIR}/h5e.mod
+ ${MOD_BUILD_DIR}/h5f.mod
+ ${MOD_BUILD_DIR}/h5g.mod
+ ${MOD_BUILD_DIR}/h5i.mod
+ ${MOD_BUILD_DIR}/h5l.mod
+ ${MOD_BUILD_DIR}/h5lib.mod
+ ${MOD_BUILD_DIR}/h5o.mod
+ ${MOD_BUILD_DIR}/h5p.mod
+ ${MOD_BUILD_DIR}/h5r.mod
+ ${MOD_BUILD_DIR}/h5s.mod
+ ${MOD_BUILD_DIR}/h5t.mod
+ ${MOD_BUILD_DIR}/h5vl.mod
+ ${MOD_BUILD_DIR}/h5z.mod
+ ${MOD_BUILD_DIR}/h5_gen.mod
+ )
+ install (
+ FILES
+ ${mod_files}
+ DESTINATION
+ ${HDF5_INSTALL_INCLUDE_DIR}/static
+ COMPONENT
+ fortheaders
+ )
+endif ()
if (BUILD_SHARED_LIBS)
set (modsh_files
@@ -400,6 +416,7 @@ if (BUILD_SHARED_LIBS)
${MODSH_BUILD_DIR}/h5r.mod
${MODSH_BUILD_DIR}/h5s.mod
${MODSH_BUILD_DIR}/h5t.mod
+ ${MODSH_BUILD_DIR}/h5vl.mod
${MODSH_BUILD_DIR}/h5z.mod
${MODSH_BUILD_DIR}/h5_gen.mod
)
@@ -421,8 +438,10 @@ if (HDF5_EXPORTED_TARGETS)
INSTALL_TARGET_PDB (${HDF5_F90_C_LIBSH_TARGET} ${HDF5_INSTALL_BIN_DIR} fortlibraries)
#INSTALL_TARGET_PDB (${HDF5_F90_LIBSH_TARGET} ${HDF5_INSTALL_BIN_DIR} fortlibraries)
endif ()
- INSTALL_TARGET_PDB (${HDF5_F90_C_LIB_TARGET} ${HDF5_INSTALL_BIN_DIR} fortlibraries)
- #INSTALL_TARGET_PDB (${HDF5_F90_LIB_TARGET} ${HDF5_INSTALL_BIN_DIR} fortlibraries)
+ if (NOT ONLY_SHARED_LIBS)
+ INSTALL_TARGET_PDB (${HDF5_F90_C_LIB_TARGET} ${HDF5_INSTALL_BIN_DIR} fortlibraries)
+ #INSTALL_TARGET_PDB (${HDF5_F90_LIB_TARGET} ${HDF5_INSTALL_BIN_DIR} fortlibraries)
+ endif ()
install (
TARGETS
@@ -436,3 +455,53 @@ if (HDF5_EXPORTED_TARGETS)
INCLUDES DESTINATION include
)
endif ()
+
+#-----------------------------------------------------------------------------
+# Create pkgconfig files
+#-----------------------------------------------------------------------------
+set (_PKG_CONFIG_PREFIX ${CMAKE_INSTALL_PREFIX})
+set (_PKG_CONFIG_EXEC_PREFIX \${prefix})
+set (_PKG_CONFIG_LIBDIR \${exec_prefix}/lib)
+set (_PKG_CONFIG_INCLUDEDIR \${prefix}/include)
+set (_PKG_CONFIG_LIBNAME "${HDF5_F90_LIB_CORENAME}")
+set (_PKG_CONFIG_VERSION "${HDF5_PACKAGE_VERSION}")
+
+set (_PKG_CONFIG_LIBS_PRIVATE)
+
+if (NOT ONLY_SHARED_LIBS)
+ set (_PKG_CONFIG_LIBS "${_PKG_CONFIG_LIBS} -l${HDF5_F90_LIB_CORENAME}")
+endif ()
+if (BUILD_SHARED_LIBS)
+ set (_PKG_CONFIG_SH_LIBS "${_PKG_CONFIG_SH_LIBS} -l${HDF5_F90_LIB_CORENAME}")
+endif ()
+
+set (_PKG_CONFIG_REQUIRES "${HDF5_LIB_CORENAME}")
+set (_PKG_CONFIG_REQUIRES_PRIVATE "${HDF5_LIB_CORENAME}")
+
+configure_file (
+ ${HDF_RESOURCES_DIR}/libhdf5.pc.in
+ ${HDF5_BINARY_DIR}/CMakeFiles/${HDF5_F90_LIB_CORENAME}-${HDF5_PACKAGE_VERSION}.pc
+ @ONLY
+)
+install (
+ FILES ${HDF5_BINARY_DIR}/CMakeFiles/${HDF5_F90_LIB_CORENAME}-${HDF5_PACKAGE_VERSION}.pc
+ DESTINATION ${HDF5_INSTALL_LIB_DIR}/pkgconfig
+ COMPONENT fortlibraries
+)
+
+if (NOT WIN32)
+ set (_PKG_CONFIG_COMPILER ${CMAKE_Fortran_COMPILER})
+ configure_file (
+ ${HDF_RESOURCES_DIR}/libh5cc.in
+ ${HDF5_BINARY_DIR}/CMakeFiles/h5fc
+ @ONLY
+ )
+ install (
+ FILES ${HDF5_BINARY_DIR}/CMakeFiles/h5fc
+ DESTINATION ${HDF5_INSTALL_BIN_DIR}
+ PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE
+ COMPONENT fortlibraries
+ )
+endif ()
+
+
diff --git a/fortran/src/H5Ff.c b/fortran/src/H5Ff.c
index a4e786e..12fb7ed 100644
--- a/fortran/src/H5Ff.c
+++ b/fortran/src/H5Ff.c
@@ -632,6 +632,40 @@ done:
return ret_value;
}
+/****if* H5Ff/h5fget_fileno_c
+ * NAME
+ * h5fget_fileno_c
+ * PURPOSE
+ * Call H5Fget_fileno to get file number
+ * INPUTS
+ * file_id - file identifier
+ * OUTPUTS
+ * fileno - file number for open file
+ * RETURNS
+ * 0 on success, -1 on failure
+ * AUTHOR
+ * Quincey Koziol
+ * Saturday, April 13, 2019
+ * SOURCE
+*/
+int_f
+h5fget_fileno_c(hid_t_f *file_id, int_f *fileno)
+/******/
+{
+ unsigned long fileno_c;
+ herr_t ret_value=0; /* Return value */
+
+ /*
+ * Call H5Fget_filesize function
+ */
+ if ((ret_value = H5Fget_fileno((hid_t)*file_id, &fileno_c)) < 0)
+ HGOTO_DONE(FAIL);
+ *fileno = (hsize_t_f)fileno_c;
+
+done:
+ return ret_value;
+}
+
/****if* H5Ff/h5fget_file_image_c
* NAME
* h5fget_file_image_c
diff --git a/fortran/src/H5Fff.F90 b/fortran/src/H5Fff.F90
index cc51f37..8574c06 100644
--- a/fortran/src/H5Fff.F90
+++ b/fortran/src/H5Fff.F90
@@ -591,7 +591,6 @@ CONTAINS
! is an HDF5 file
INTEGER, INTENT(OUT) :: hdferr ! Error code
!*****
- INTEGER(HID_T) :: access_prp_default
CHARACTER(LEN=LEN_TRIM(name)+1,KIND=C_CHAR) :: c_name
INTEGER(C_INT) :: flag ! "TRUE/FALSE/ERROR" flag from C routine
! to define status value.
@@ -886,6 +885,44 @@ CONTAINS
hdferr = h5fget_filesize_c(file_id, size)
END SUBROUTINE h5fget_filesize_f
+!****s* H5F/h5fget_fileno_f
+!
+! NAME
+! h5fget_fileno_f
+!
+! PURPOSE
+! Retrieves the file number of the HDF5 file.
+!
+! INPUTS
+! file_id - file identifier
+! OUTPUTS
+! fileno - file number
+! hdferr - Returns 0 if successful and -1 if fails
+!
+! AUTHOR
+! Quincey Koziol
+! April 13, 2019
+!
+! SOURCE
+ SUBROUTINE h5fget_fileno_f(file_id, fileno, hdferr)
+ IMPLICIT NONE
+ INTEGER(HID_T), INTENT(IN) :: file_id ! file identifier
+ INTEGER, INTENT(OUT) :: fileno ! File number
+ INTEGER, INTENT(OUT) :: hdferr ! Error code: 0 on success,
+ ! -1 if fail
+!*****
+ INTERFACE
+ INTEGER FUNCTION h5fget_fileno_c(file_id, fileno) &
+ BIND(C,NAME='h5fget_fileno_c')
+ IMPORT :: HID_T, HSIZE_T
+ IMPLICIT NONE
+ INTEGER(HID_T), INTENT(IN) :: file_id
+ INTEGER, INTENT(OUT) :: fileno
+ END FUNCTION h5fget_fileno_c
+ END INTERFACE
+ hdferr = h5fget_fileno_c(file_id, fileno)
+ END SUBROUTINE h5fget_fileno_f
+
!****s* H5F (F03)/h5fget_file_image_f_F03
!
! NAME
diff --git a/fortran/src/H5Pff.F90 b/fortran/src/H5Pff.F90
index 13a2953..0c0500d 100644
--- a/fortran/src/H5Pff.F90
+++ b/fortran/src/H5Pff.F90
@@ -9,7 +9,7 @@
! COPYRIGHT
! * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
! Copyright by The HDF Group. *
-! Copyright by the Board of Trustees of the University of Illinois. *S
+! 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 *
@@ -7929,7 +7929,7 @@ SUBROUTINE h5pget_virtual_filename_f(dcpl_id, index, name, hdferr, name_len)
INTERFACE
INTEGER(SIZE_T) FUNCTION h5pget_virtual_filename(dcpl_id, index, name, size) BIND(C, NAME='H5Pget_virtual_filename')
- IMPORT :: HID_T, SIZE_T, C_PTR, C_CHAR
+ IMPORT :: HID_T, SIZE_T, C_PTR
IMPLICIT NONE
INTEGER(HID_T) , INTENT(IN), VALUE :: dcpl_id
INTEGER(SIZE_T), INTENT(IN), VALUE :: index
@@ -7997,7 +7997,7 @@ SUBROUTINE h5pget_virtual_dsetname_f(dcpl_id, index, name, hdferr, name_len)
INTERFACE
INTEGER(SIZE_T) FUNCTION h5pget_virtual_dsetname(dcpl_id, index, name, size) BIND(C, NAME='H5Pget_virtual_dsetname')
- IMPORT :: HID_T, SIZE_T, C_PTR, C_CHAR
+ IMPORT :: HID_T, SIZE_T, C_PTR
IMPLICIT NONE
INTEGER(HID_T) , INTENT(IN), VALUE :: dcpl_id
INTEGER(SIZE_T), INTENT(IN), VALUE :: index
@@ -8018,7 +8018,6 @@ SUBROUTINE h5pget_virtual_dsetname_f(dcpl_id, index, name, hdferr, name_len)
ELSE
CALL HD5c2fstring(name,c_name,LEN(name))
ENDIF
-
ENDIF
END SUBROUTINE h5pget_virtual_dsetname_f
@@ -8115,5 +8114,97 @@ END SUBROUTINE h5pget_virtual_dsetname_f
END SUBROUTINE h5pset_dset_no_attrs_hint_f
+!****s* H5P/H5Pset_vol_f
+!
+! NAME
+! H5Pset_vol_f
+!
+! PURPOSE
+! Set the file VOL connector (VOL_ID) for a file access
+! property list (PLIST_ID)
+! INPUTS
+! plist_id - access property list identifier.
+! new_vol_id - VOL connector id.
+!
+! OUTPUTS
+! hdferr - error code:
+! 0 on success and -1 on failure
+!
+! OPTIONAL
+! new_vol_info - VOL connector info.
+!
+! AUTHOR
+! M.S. Breitenfeld
+! May 2019
+!
+! Fortran Interface:
+ SUBROUTINE h5pset_vol_f(plist_id, new_vol_id, hdferr, new_vol_info)
+ IMPLICIT NONE
+ INTEGER(HID_T) , INTENT(IN) :: plist_id
+ INTEGER(HID_T) , INTENT(IN) :: new_vol_id
+ INTEGER , INTENT(OUT) :: hdferr
+ TYPE(C_PTR) , OPTIONAL :: new_vol_info
+!*****
+
+ TYPE(C_PTR) :: new_vol_info_default
+
+ INTERFACE
+ INTEGER FUNCTION h5pset_vol(plist_id, new_vol_id, new_vol_info) BIND(C, NAME='H5Pset_vol')
+ IMPORT :: HID_T, C_PTR
+ IMPLICIT NONE
+ INTEGER(HID_T), INTENT(IN), VALUE :: plist_id
+ INTEGER(HID_T), INTENT(IN), VALUE :: new_vol_id
+ TYPE(C_PTR) , INTENT(IN), VALUE :: new_vol_info
+ END FUNCTION h5pset_vol
+ END INTERFACE
+
+ new_vol_info_default = C_NULL_PTR
+ IF(PRESENT(new_vol_info)) new_vol_info_default=new_vol_info
+
+ hdferr = INT(h5pset_vol(plist_id, new_vol_id, new_vol_info_default))
+
+ END SUBROUTINE h5pset_vol_f
+
+!****s* H5P/H5Pget_vol_id_f
+!
+! NAME
+! H5Pget_vol_id_f
+!
+! PURPOSE
+! Get the file VOL connector (VOL_ID) for a file access
+! property list (PLIST_ID)
+! INPUTS
+! plist_id - access property list identifier.
+!
+! OUTPUTS
+! vol_id - VOL connector id.
+! hdferr - error code:
+! 0 on success and -1 on failure
+!
+! AUTHOR
+! M.S. Breitenfeld
+! May 2019
+!
+! Fortran Interface:
+ SUBROUTINE h5pget_vol_id_f(plist_id, vol_id, hdferr)
+ IMPLICIT NONE
+ INTEGER(HID_T) , INTENT(IN) :: plist_id
+ INTEGER(HID_T) , INTENT(OUT) :: vol_id
+ INTEGER , INTENT(OUT) :: hdferr
+!*****
+
+ INTERFACE
+ INTEGER FUNCTION h5pget_vol_id(plist_id, vol_id) BIND(C, NAME='H5Pget_vol_id')
+ IMPORT :: HID_T, C_PTR
+ IMPLICIT NONE
+ INTEGER(HID_T), INTENT(IN), VALUE :: plist_id
+ INTEGER(HID_T), INTENT(OUT) :: vol_id
+ END FUNCTION h5pget_vol_id
+ END INTERFACE
+
+ hdferr = INT(h5pget_vol_id(plist_id, vol_id))
+
+ END SUBROUTINE h5pget_vol_id_f
+
END MODULE H5P
diff --git a/fortran/src/H5Sf.c b/fortran/src/H5Sf.c
index 2eae0d9..1031914 100644
--- a/fortran/src/H5Sf.c
+++ b/fortran/src/H5Sf.c
@@ -994,8 +994,6 @@ done:
return ret_value;
}
-
-#ifdef NEW_HYPERSLAB_API
/****if* H5Sf/h5scombine_hyperslab_c
* NAME
* h5scombine_hyperslab_c
@@ -1119,11 +1117,11 @@ h5scombine_select_c ( hid_t_f *space1_id , int_f *op, hid_t_f *space2_id, hid_t_
ret_value = 0;
return ret_value;
}
-/****if* H5Sf/h5sselect_select_c
+/****if* H5Sf/h5smodify_select_c
* NAME
- * h5sselect_select_c
+ * h5smodify_select_c
* PURPOSE
- * Call H5Sselect_ select
+ * Call H5Smodify_select
* INPUTS
* space1_id - identifier of the first dataspace to modify
* operator - defines how the new selection is combined
@@ -1139,7 +1137,7 @@ h5scombine_select_c ( hid_t_f *space1_id , int_f *op, hid_t_f *space2_id, hid_t_
*/
int_f
-h5sselect_select_c ( hid_t_f *space1_id , int_f *op, hid_t_f *space2_id)
+h5smodify_select_c ( hid_t_f *space1_id , int_f *op, hid_t_f *space2_id)
/******/
{
int ret_value = -1;
@@ -1151,11 +1149,11 @@ h5sselect_select_c ( hid_t_f *space1_id , int_f *op, hid_t_f *space2_id)
c_space1_id = (hid_t)*space1_id;
c_space2_id = (hid_t)*space2_id;
- if( H5Sselect_select(c_space1_id, c_op, c_space2_id)< 0) return ret_value;
+ if( H5Smodify_select(c_space1_id, c_op, c_space2_id)< 0) return ret_value;
ret_value = 0;
return ret_value;
}
-#endif /*NEW_HYPERSLAB_API*/
+
/****if* H5Sf/h5sget_select_type_c
* NAME
* h5sget_select_type_c
@@ -1310,7 +1308,7 @@ h5sdecode_c ( _fcd buf, hid_t_f *obj_id )
*/
int_f
-h5sencode_c (_fcd buf, hid_t_f *obj_id, size_t_f *nalloc )
+h5sencode_c (_fcd buf, hid_t_f *obj_id, size_t_f *nalloc, hid_t_f *fapl_id )
/******/
{
int ret_value = -1;
@@ -1323,7 +1321,7 @@ h5sencode_c (_fcd buf, hid_t_f *obj_id, size_t_f *nalloc )
if (*nalloc == 0) {
- if(H5Sencode((hid_t)*obj_id, c_buf, &c_size) < 0)
+ if(H5Sencode2((hid_t)*obj_id, c_buf, &c_size, (hid_t)*fapl_id) < 0)
return ret_value;
*nalloc = (size_t_f)c_size;
@@ -1341,7 +1339,7 @@ h5sencode_c (_fcd buf, hid_t_f *obj_id, size_t_f *nalloc )
/*
* Call H5Sencode function.
*/
- if(H5Sencode((hid_t)*obj_id, c_buf, &c_size) < 0){
+ if(H5Sencode2((hid_t)*obj_id, c_buf, &c_size, (hid_t)*fapl_id) < 0){
return ret_value;
}
diff --git a/fortran/src/H5Sff.F90 b/fortran/src/H5Sff.F90
index 3434fba..e6f8e4c 100644
--- a/fortran/src/H5Sff.F90
+++ b/fortran/src/H5Sff.F90
@@ -1506,7 +1506,7 @@ CONTAINS
! !$!****s* H5S/
! !$!
! !$! NAME
-! !$! h5sselect_select_f
+! !$! h5smodify_select_f
! !$!
! !$! PURPOSE
! !$! Refine a hyperslab selection with an operation
@@ -1543,7 +1543,7 @@ CONTAINS
! !$!
! ! SOURCE
-! SUBROUTINE h5sselect_select_f(space1_id, operator, space2_id, &
+! SUBROUTINE h5smodify_select_f(space1_id, operator, space2_id, &
! hdferr)
! IMPLICIT NONE
! INTEGER(HID_T), INTENT(INOUT) :: space1_id ! Dataspace identifier to
@@ -1563,22 +1563,22 @@ CONTAINS
! INTEGER, INTENT(OUT) :: hdferr ! Error code
! INTERFACE
-! INTEGER FUNCTION h5sselect_select_c(space1_id, operator, &
+! INTEGER FUNCTION h5smodify_select_c(space1_id, operator, &
! space2_id)
! USE H5GLOBAL
! !DEC$IF DEFINED(HDF5F90_WINDOWS)
-! !DEC$ATTRIBUTES C,reference,decorate,alias:'H5SSELECT_SELECT_C'::h5sselect_select_c
+! !DEC$ATTRIBUTES C,reference,decorate,alias:'H5SMODIFY_SELECT_C'::h5smodify_select_c
! !DEC$ENDIF
! INTEGER(HID_T), INTENT(INOUT) :: space1_id
! INTEGER(HID_T), INTENT(IN) :: space2_id
! INTEGER, INTENT(IN) :: operator
-! END FUNCTION h5sselect_select_c
+! END FUNCTION h5smodify_select_c
! END INTERFACE
-! hdferr = h5sselect_select_c(space1_id, operator, space2_id)
+! hdferr = h5smodify_select_c(space1_id, operator, space2_id)
! return
-! END SUBROUTINE h5sselect_select_f
+! END SUBROUTINE h5smodify_select_f
!
!****s* H5S/h5sget_select_type_f
@@ -1683,25 +1683,32 @@ CONTAINS
! M. Scot Breitenfeld
! March 26, 2008
! SOURCE
- SUBROUTINE h5sencode_f(obj_id, buf, nalloc, hdferr)
+ SUBROUTINE h5sencode_f(obj_id, buf, nalloc, hdferr, fapl_id)
IMPLICIT NONE
INTEGER(HID_T), INTENT(IN) :: obj_id
CHARACTER(LEN=*), INTENT(OUT) :: buf
INTEGER(SIZE_T), INTENT(INOUT) :: nalloc
INTEGER, INTENT(OUT) :: hdferr
+ INTEGER(HID_T), OPTIONAL, INTENT(IN) :: fapl_id ! File access property list
!*****
+ INTEGER(HID_T) :: fapl_id_default
INTERFACE
- INTEGER FUNCTION h5sencode_c(buf, obj_id, nalloc) BIND(C,NAME='h5sencode_c')
+ INTEGER FUNCTION h5sencode_c(buf, obj_id, nalloc, fapl_id_default) BIND(C,NAME='h5sencode_c')
IMPORT :: C_CHAR
IMPORT :: HID_T, SIZE_T
INTEGER(HID_T), INTENT(IN) :: obj_id
CHARACTER(KIND=C_CHAR), DIMENSION(*), INTENT(OUT) :: buf
INTEGER(SIZE_T), INTENT(INOUT) :: nalloc
+ INTEGER(HID_T) :: fapl_id_default
END FUNCTION h5sencode_c
END INTERFACE
- hdferr = h5sencode_c(buf, obj_id, nalloc)
+ fapl_id_default = H5P_DEFAULT_F
+
+ IF(PRESENT(fapl_id)) fapl_id_default = fapl_id
+
+ hdferr = h5sencode_c(buf, obj_id, nalloc, fapl_id_default)
END SUBROUTINE h5sencode_f
diff --git a/fortran/src/H5VLff.F90 b/fortran/src/H5VLff.F90
new file mode 100644
index 0000000..e21f38f
--- /dev/null
+++ b/fortran/src/H5VLff.F90
@@ -0,0 +1,315 @@
+!****h* ROBODoc/H5VL
+!
+! NAME
+! MODULE H5VL
+!
+! PURPOSE
+! This file contains Fortran interfaces for H5VL (VOL) functions.
+!
+! COPYRIGHT
+! * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+! 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. *
+! * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+!
+! NOTES
+! _____ __ __ _____ ____ _____ _______ _ _ _______
+! |_ _| \/ | __ \ / __ \| __ \__ __|/\ | \ | |__ __|
+! **** | | | \ / | |__) | | | | |__) | | | / \ | \| | | | ****
+! **** | | | |\/| | ___/| | | | _ / | | / /\ \ | . ` | | | ****
+! **** _| |_| | | | | | |__| | | \ \ | |/ ____ \| |\ | | | ****
+! |_____|_| |_|_| \____/|_| \_\ |_/_/ \_\_| \_| |_|
+!
+! If you add a new H5VL function you must add the function name to the
+! Windows dll file 'hdf5_fortrandll.def.in' in the fortran/src directory.
+! This is needed for Windows based operating systems.
+!
+!*****
+
+MODULE H5VL
+
+ USE, INTRINSIC :: ISO_C_BINDING, ONLY : C_PTR, C_FUNPTR, C_CHAR, C_INT64_T, C_INT
+ USE H5GLOBAL
+ USE H5fortkit
+
+ IMPLICIT NONE
+
+CONTAINS
+
+! H5VLregister_connector
+
+!
+!****s* H5VL/H5VLregister_connector_by_name_f
+!
+! NAME
+! H5VLregister_connector_by_name_f
+!
+! PURPOSE
+! Registers a new VOL connector as a member of the virtual object
+! layer class by name.
+!
+! INPUTS
+! name - Connector name
+! OUTPUTS
+! vol_id - VOL id
+! hdferr - Returns 0 if successful and -1 if fails
+! SOURCE
+
+ SUBROUTINE H5VLregister_connector_by_name_f(name, vol_id, hdferr, vipl_id)
+ IMPLICIT NONE
+ CHARACTER(LEN=*), INTENT(IN) :: name
+ INTEGER(HID_T), INTENT(OUT) :: vol_id
+ INTEGER, INTENT(OUT) :: hdferr
+ INTEGER(HID_T), OPTIONAL, INTENT(IN) :: vipl_id
+!*****
+ CHARACTER(LEN=LEN_TRIM(name)+1,KIND=C_CHAR) :: c_name
+ INTEGER(HID_T) :: vipl_id_default
+
+ INTERFACE
+ INTEGER(HID_T) FUNCTION H5VLregister_connector_by_name(name, vipl_id) &
+ BIND(C,NAME='H5VLregister_connector_by_name')
+ IMPORT :: C_CHAR
+ IMPORT :: HID_T
+ CHARACTER(KIND=C_CHAR), DIMENSION(*), INTENT(IN) :: name
+ INTEGER(HID_T), INTENT(IN), VALUE :: vipl_id
+ END FUNCTION H5VLregister_connector_by_name
+ END INTERFACE
+
+ vipl_id_default = H5P_DEFAULT_F
+ IF(PRESENT(vipl_id)) vipl_id_default = vipl_id
+
+ c_name = TRIM(name)//C_NULL_CHAR
+ vol_id = H5VLregister_connector_by_name(c_name, vipl_id_default)
+
+ hdferr = 0
+ IF(vol_id.LT.0) hdferr = H5I_INVALID_HID_F
+
+ END SUBROUTINE H5VLregister_connector_by_name_f
+
+ SUBROUTINE H5VLregister_connector_by_value_f(connector_value, vol_id, hdferr, vipl_id)
+ IMPLICIT NONE
+ INTEGER, INTENT(IN) :: connector_value
+ INTEGER(HID_T), INTENT(OUT) :: vol_id
+ INTEGER, INTENT(OUT) :: hdferr
+ INTEGER(HID_T), OPTIONAL, INTENT(IN) :: vipl_id
+!*****
+ INTEGER(HID_T) :: vipl_id_default
+
+ INTERFACE
+ INTEGER(HID_T) FUNCTION H5VLregister_connector_by_value(connector_value, vipl_id) &
+ BIND(C,NAME='H5VLregister_connector_by_value')
+ IMPORT :: HID_T
+ IMPORT :: C_INT
+ INTEGER(C_INT), VALUE :: connector_value
+ INTEGER(HID_T), INTENT(IN), VALUE :: vipl_id
+ END FUNCTION H5VLregister_connector_by_value
+ END INTERFACE
+
+ vipl_id_default = H5P_DEFAULT_F
+ IF(PRESENT(vipl_id)) vipl_id_default = vipl_id
+
+ vol_id = H5VLregister_connector_by_value(INT(connector_value,C_INT), vipl_id_default)
+
+ hdferr = 0
+ IF(vol_id.LT.0) hdferr = H5I_INVALID_HID_F
+
+ END SUBROUTINE H5VLregister_connector_by_value_f
+
+!
+!****s* H5VL/H5VLis_connector_registered_f
+!
+! NAME
+! H5VLis_connector_registered_f
+!
+! PURPOSE
+! Tests whether a VOL class has been registered or not.
+!
+! INPUTS
+! name - Connector name
+! OUTPUTS
+! registered - state of VOL class registration
+! hdferr - Returns 0 if successful and -1 if fails
+! SOURCE
+
+ SUBROUTINE H5VLis_connector_registered_f(name, registered, hdferr)
+ IMPLICIT NONE
+ CHARACTER(LEN=*), INTENT(IN) :: name
+ LOGICAL, INTENT(OUT) :: registered
+ INTEGER, INTENT(OUT) :: hdferr
+!*****
+ CHARACTER(LEN=LEN_TRIM(name)+1,KIND=C_CHAR) :: c_name
+ INTEGER(C_INT) :: registered_c
+
+ INTERFACE
+ INTEGER(C_INT) FUNCTION H5VLis_connector_registered(name) BIND(C,NAME='H5VLis_connector_registered')
+ IMPORT :: C_CHAR
+ IMPORT :: C_INT
+ CHARACTER(KIND=C_CHAR), DIMENSION(*), INTENT(IN) :: name
+ END FUNCTION H5VLis_connector_registered
+ END INTERFACE
+
+ c_name = TRIM(name)//C_NULL_CHAR
+ registered_c = H5VLis_connector_registered(c_name)
+
+ hdferr = 0
+ registered = .FALSE.
+ IF(registered_c .GT. 0) registered = .TRUE.
+ IF(registered_c .LT. 0) hdferr = INT(registered_c)
+
+ END SUBROUTINE H5VLis_connector_registered_f
+
+!
+!****s* H5VL/H5VLis_connector_registered_f
+!
+! NAME
+! H5VLis_connector_registered_f
+!
+! PURPOSE
+! Retrieves the ID for a registered VOL connector.
+!
+! INPUTS
+! name - Connector name
+! OUTPUTS
+! vol_id - Connector id
+! hdferr - Returns 0 if successful and -1 if fails
+! SOURCE
+
+ SUBROUTINE H5VLget_connector_id_f(name, vol_id, hdferr)
+ IMPLICIT NONE
+ CHARACTER(LEN=*), INTENT(IN) :: name
+ INTEGER(HID_T), INTENT(OUT) :: vol_id
+ INTEGER, INTENT(OUT) :: hdferr
+!*****
+ CHARACTER(LEN=LEN_TRIM(name)+1,KIND=C_CHAR) :: c_name
+
+ INTERFACE
+ INTEGER(HID_T) FUNCTION H5VLget_connector_id(name) BIND(C,NAME='H5VLget_connector_id')
+ IMPORT :: C_CHAR
+ IMPORT :: HID_T
+ CHARACTER(KIND=C_CHAR), DIMENSION(*), INTENT(IN) :: name
+ END FUNCTION H5VLget_connector_id
+ END INTERFACE
+
+ c_name = TRIM(name)//C_NULL_CHAR
+ vol_id = H5VLget_connector_id(c_name)
+
+ IF(vol_id.LT.0)THEN
+ hdferr = -1
+ vol_id = H5I_INVALID_HID_F
+ ENDIF
+
+ END SUBROUTINE H5VLget_connector_id_f
+
+ SUBROUTINE H5VLget_connector_name_f(obj_id, name, hdferr, name_len)
+ IMPLICIT NONE
+ INTEGER(HID_T), INTENT(IN) :: obj_id
+ CHARACTER(LEN=*), INTENT(OUT) :: name
+ INTEGER, INTENT(OUT) :: hdferr
+ INTEGER(SIZE_T), OPTIONAL :: name_len
+!*****
+ CHARACTER(LEN=1,KIND=C_CHAR), DIMENSION(1:LEN(name)+1), TARGET :: c_name
+ INTEGER(SIZE_T) :: l
+
+ INTERFACE
+ INTEGER(SIZE_T) FUNCTION H5VLget_connector_name(obj_id, name, size) BIND(C,NAME='H5VLget_connector_name')
+ IMPORT :: HID_T, SIZE_T, C_PTR, C_CHAR
+ IMPLICIT NONE
+ INTEGER(HID_T) , INTENT(IN), VALUE :: obj_id
+ CHARACTER(KIND=C_CHAR), DIMENSION(*), INTENT(OUT) :: name
+ ! TYPE(C_PTR), value :: name
+ INTEGER(SIZE_T), INTENT(IN), VALUE :: size
+ END FUNCTION H5VLget_connector_name
+ END INTERFACE
+
+ hdferr = 0
+ IF(PRESENT(name_len))THEN
+ c_name(1:1)(1:1) = C_NULL_CHAR
+ name_len = INT(H5VLget_connector_name(obj_id, c_name, 1_SIZE_T), SIZE_T)
+ IF(name_len.LT.0) hdferr = H5I_INVALID_HID_F
+ ELSE
+ l = INT(LEN(name)+1,SIZE_T)
+ IF(INT(H5VLget_connector_name(obj_id, c_name, l), SIZE_T).LT.0)THEN
+ hdferr = H5I_INVALID_HID_F
+ ELSE
+ CALL HD5c2fstring(name,c_name,LEN(name))
+ ENDIF
+ ENDIF
+
+ END SUBROUTINE H5VLget_connector_name_f
+
+!
+!
+!****s* H5VL/H5VLclose_f
+!
+! NAME
+! H5VLclose_f
+!
+! PURPOSE
+! Closes a VOL connector ID.
+!
+! INPUTS
+! vol_id - A valid identifier of the connectory to unregister.
+!
+! OUTPUTS
+! hdferr - Returns 0 if successful and -1 if fails
+! SOURCE
+
+ SUBROUTINE H5VLclose_f(vol_id, hdferr)
+ IMPLICIT NONE
+ INTEGER(HID_T), INTENT(IN) :: vol_id
+ INTEGER, INTENT(OUT) :: hdferr
+!*****
+
+ INTERFACE
+ INTEGER FUNCTION H5VLclose(vol_id) BIND(C, NAME='H5VLclose')
+ IMPORT :: HID_T
+ INTEGER(HID_T), INTENT(IN), VALUE :: vol_id
+ END FUNCTION H5VLclose
+ END INTERFACE
+
+ hdferr = INT(H5VLclose(vol_id))
+
+ END SUBROUTINE H5VLclose_f
+
+!
+!****s* H5VL/H5VLunregister_connector_f
+!
+! NAME
+! H5VLunregister_connector_f
+!
+! PURPOSE
+! Removes a VOL connector ID from the library.
+!
+! INPUTS
+! plugin_id - A valid identifier of the connector to unregister.
+!
+! OUTPUTS
+! hdferr - Returns 0 if successful and -1 if fails
+! SOURCE
+
+ SUBROUTINE H5VLunregister_connector_f(plugin_id, hdferr)
+ IMPLICIT NONE
+ INTEGER(HID_T), INTENT(IN) :: plugin_id
+ INTEGER, INTENT(OUT) :: hdferr
+!*****
+
+ INTERFACE
+ INTEGER FUNCTION H5VLunregister_connector(plugin_id) BIND(C, NAME='H5VLunregister_connector')
+ IMPORT :: HID_T
+ INTEGER(HID_T), INTENT(IN), VALUE :: plugin_id
+ END FUNCTION H5VLunregister_connector
+ END INTERFACE
+
+ hdferr = INT(H5VLunregister_connector(plugin_id))
+
+ END SUBROUTINE H5VLunregister_connector_f
+
+END MODULE H5VL
diff --git a/fortran/src/H5_f.c b/fortran/src/H5_f.c
index 69ba8b3..2d1c6e7 100644
--- a/fortran/src/H5_f.c
+++ b/fortran/src/H5_f.c
@@ -498,6 +498,16 @@ h5init_flags_c( int_f *h5d_flags, size_t_f *h5d_size_flags,
h5i_flags[4] = (int_f)H5I_DATASET;
h5i_flags[5] = (int_f)H5I_ATTR;
h5i_flags[6] = (int_f)H5I_BADID;
+ h5i_flags[7] = (int_f)H5I_UNINIT;
+ h5i_flags[8] = (int_f)H5I_VFL;
+ h5i_flags[9] = (int_f)H5I_VOL;
+ h5i_flags[10] = (int_f)H5I_GENPROP_CLS;
+ h5i_flags[11] = (int_f)H5I_GENPROP_LST;
+ h5i_flags[12] = (int_f)H5I_ERROR_CLASS;
+ h5i_flags[13] = (int_f)H5I_ERROR_MSG;
+ h5i_flags[14] = (int_f)H5I_ERROR_STACK;
+ h5i_flags[15] = (int_f)H5I_NTYPES;
+ h5i_flags[16] = (int_f)H5I_INVALID_HID;
/*
* H5L flags
*/
@@ -632,7 +642,6 @@ h5init_flags_c( int_f *h5d_flags, size_t_f *h5d_size_flags,
h5s_flags[15] = (int_f)H5S_SEL_POINTS;
h5s_flags[16] = (int_f)H5S_SEL_HYPERSLABS;
h5s_flags[17] = (int_f)H5S_SEL_ALL;
-
/*
* H5T flags
*/
@@ -671,7 +680,6 @@ h5init_flags_c( int_f *h5d_flags, size_t_f *h5d_size_flags,
h5t_flags[32] = (int_f)H5T_ARRAY;
h5t_flags[33] = (int_f)H5T_DIR_ASCEND;
h5t_flags[34] = (int_f)H5T_DIR_DESCEND;
-
/*
* H5Z flags
*/
@@ -695,10 +703,6 @@ h5init_flags_c( int_f *h5d_flags, size_t_f *h5d_size_flags,
h5z_flags[17] = (int_f)H5Z_SO_FLOAT_ESCALE;
h5z_flags[18] = (int_f)H5Z_SO_INT;
h5z_flags[19] = (int_f)H5Z_SO_INT_MINBITS_DEFAULT;
-/*
- * H5A flags
- */
-
/*
* H5 Generic flags introduced in version 1.8
diff --git a/fortran/src/H5_ff.F90 b/fortran/src/H5_ff.F90
index 84529e4..443be79 100644
--- a/fortran/src/H5_ff.F90
+++ b/fortran/src/H5_ff.F90
@@ -88,7 +88,7 @@ MODULE H5LIB
!
! H5I flags declaration
!
- INTEGER, PARAMETER :: H5I_FLAGS_LEN = 7
+ INTEGER, PARAMETER :: H5I_FLAGS_LEN = 17
INTEGER, DIMENSION(1:H5I_FLAGS_LEN) :: H5I_flags
!
! H5L flags declaration
@@ -129,6 +129,7 @@ MODULE H5LIB
!
INTEGER, PARAMETER :: H5T_FLAGS_LEN = 35
INTEGER, DIMENSION(1:H5T_FLAGS_LEN) :: H5T_flags
+
!
! H5Z flags declaration
!
@@ -443,13 +444,23 @@ CONTAINS
!
! H5I flags declaration
!
- H5I_FILE_F = H5I_flags(1)
- H5I_GROUP_F = H5I_flags(2)
- H5I_DATATYPE_F = H5I_flags(3)
- H5I_DATASPACE_F = H5I_flags(4)
- H5I_DATASET_F = H5I_flags(5)
- H5I_ATTR_F = H5I_flags(6)
- H5I_BADID_F = H5I_flags(7)
+ H5I_FILE_F = H5I_flags(1)
+ H5I_GROUP_F = H5I_flags(2)
+ H5I_DATATYPE_F = H5I_flags(3)
+ H5I_DATASPACE_F = H5I_flags(4)
+ H5I_DATASET_F = H5I_flags(5)
+ H5I_ATTR_F = H5I_flags(6)
+ H5I_BADID_F = H5I_flags(7)
+ H5I_UNINIT_F = H5I_flags(8)
+ H5I_VFL_F = H5I_flags(9)
+ H5I_VOL_F = H5I_flags(10)
+ H5I_GENPROP_CLS_F = H5I_flags(11)
+ H5I_GENPROP_LST_F = H5I_flags(12)
+ H5I_ERROR_CLASS_F = H5I_flags(13)
+ H5I_ERROR_MSG_F = H5I_flags(14)
+ H5I_ERROR_STACK_F = H5I_flags(15)
+ H5I_NTYPES_F = H5I_flags(16)
+ H5I_INVALID_HID_F = H5I_flags(17)
!
! H5L flags
!
diff --git a/fortran/src/H5f90global.F90 b/fortran/src/H5f90global.F90
index b705cc1..02e3bc3 100644
--- a/fortran/src/H5f90global.F90
+++ b/fortran/src/H5f90global.F90
@@ -435,15 +435,36 @@ MODULE H5GLOBAL
!DEC$ATTRIBUTES DLLEXPORT :: H5I_DATASET_F
!DEC$ATTRIBUTES DLLEXPORT :: H5I_ATTR_F
!DEC$ATTRIBUTES DLLEXPORT :: H5I_BADID_F
+ !DEC$ATTRIBUTES DLLEXPORT :: H5I_UNINIT_F
+ !DEC$ATTRIBUTES DLLEXPORT :: H5I_VFL_F
+ !DEC$ATTRIBUTES DLLEXPORT :: H5I_VOL_F
+ !DEC$ATTRIBUTES DLLEXPORT :: H5I_GENPROP_CLS_F
+ !DEC$ATTRIBUTES DLLEXPORT :: H5I_GENPROP_LST_F
+ !DEC$ATTRIBUTES DLLEXPORT :: H5I_ERROR_CLASS_F
+ !DEC$ATTRIBUTES DLLEXPORT :: H5I_ERROR_MSG_F
+ !DEC$ATTRIBUTES DLLEXPORT :: H5I_ERROR_STACK_F
+ !DEC$ATTRIBUTES DLLEXPORT :: H5I_NTYPES_F
+ !DEC$ATTRIBUTES DLLEXPORT :: H5I_INVALID_HID_F
!DEC$endif
- INTEGER :: H5I_FILE_F
- INTEGER :: H5I_GROUP_F
- INTEGER :: H5I_DATATYPE_F
- INTEGER :: H5I_DATASPACE_F
- INTEGER :: H5I_DATASET_F
- INTEGER :: H5I_ATTR_F
- INTEGER :: H5I_BADID_F
+ INTEGER :: H5I_FILE_F
+ INTEGER :: H5I_GROUP_F
+ INTEGER :: H5I_DATATYPE_F
+ INTEGER :: H5I_DATASPACE_F
+ INTEGER :: H5I_DATASET_F
+ INTEGER :: H5I_ATTR_F
+ INTEGER :: H5I_BADID_F
+ INTEGER :: H5I_UNINIT_F
+ INTEGER :: H5I_VFL_F
+ INTEGER :: H5I_VOL_F
+ INTEGER :: H5I_GENPROP_CLS_F
+ INTEGER :: H5I_GENPROP_LST_F
+ INTEGER :: H5I_ERROR_CLASS_F
+ INTEGER :: H5I_ERROR_MSG_F
+ INTEGER :: H5I_ERROR_STACK_F
+ INTEGER :: H5I_NTYPES_F
+ INTEGER :: H5I_INVALID_HID_F
+
!
! H5L flags declaration
!
diff --git a/fortran/src/H5f90proto.h b/fortran/src/H5f90proto.h
index 56b7f22..5faf4b4 100644
--- a/fortran/src/H5f90proto.h
+++ b/fortran/src/H5f90proto.h
@@ -91,6 +91,7 @@ H5_FCDLL int_f h5fget_file_image_c(hid_t_f *file_id, void *buf_ptr, size_t_f *bu
H5_FCDLL int_f h5fflush_c(hid_t_f *obj_id, int_f *scope);
H5_FCDLL int_f h5fget_name_c(hid_t_f *obj_id, size_t_f *size, _fcd buf, size_t_f *buflen);
H5_FCDLL int_f h5fget_filesize_c(hid_t_f *file_id, hsize_t_f *size);
+H5_FCDLL int_f h5fget_fileno_c(hid_t_f *file_id, int_f *fileno);
/*
* Functions from H5Sf.c
@@ -122,9 +123,9 @@ H5_FCDLL int_f h5sget_select_type_c( hid_t_f *space_id , int_f *op);
H5_FCDLL int_f h5sselect_elements_c( hid_t_f *space_id , int_f *op, size_t_f *nelements, hsize_t_f *coord);
H5_FCDLL int_f h5scombine_hyperslab_c( hid_t_f *space_id , int_f *op, hsize_t_f *start, hsize_t_f *count, hsize_t_f *stride, hsize_t_f *block, hid_t_f *hyper_id);
H5_FCDLL int_f h5scombine_select_c( hid_t_f *space1_id , int_f *op, hid_t_f *space2_id, hid_t_f *ds_id);
-H5_FCDLL int_f h5sselect_select_c( hid_t_f *space1_id , int_f *op, hid_t_f *space2_id);
+H5_FCDLL int_f h5smodify_select_c( hid_t_f *space1_id , int_f *op, hid_t_f *space2_id);
H5_FCDLL int_f h5sdecode_c( _fcd buf, hid_t_f *obj_id );
-H5_FCDLL int_f h5sencode_c(_fcd buf, hid_t_f *obj_id, size_t_f *nalloc );
+H5_FCDLL int_f h5sencode_c(_fcd buf, hid_t_f *obj_id, size_t_f *nalloc, hid_t_f *fapl_id );
H5_FCDLL int_f h5sextent_equal_c( hid_t_f * space1_id, hid_t_f *space2_id, hid_t_f *c_equal);
/*
diff --git a/fortran/src/HDF5.F90 b/fortran/src/HDF5.F90
index 0370224..fe38b7d 100644
--- a/fortran/src/HDF5.F90
+++ b/fortran/src/HDF5.F90
@@ -38,6 +38,7 @@ MODULE HDF5
USE H5O
USE H5P
USE H5R
+ USE H5VL
USE H5Z
USE H5_gen
USE H5LIB
diff --git a/fortran/src/Makefile.am b/fortran/src/Makefile.am
index 666f6cb..4009439 100644
--- a/fortran/src/Makefile.am
+++ b/fortran/src/Makefile.am
@@ -44,7 +44,7 @@ endif
libhdf5_fortran_la_SOURCES=H5f90global.F90 \
H5fortran_types.F90 H5_ff.F90 H5Aff.F90 H5Dff.F90 H5Eff.F90 \
H5Fff.F90 H5Gff.F90 H5Iff.F90 H5Lff.F90 H5Off.F90 H5Pff.F90 H5Rff.F90 H5Sff.F90 \
- H5Tff.F90 H5Zff.F90 H5_gen.F90 H5fortkit.F90 \
+ H5Tff.F90 H5VLff.F90 H5Zff.F90 H5_gen.F90 H5fortkit.F90 \
H5f90kit.c H5_f.c H5Af.c H5Df.c H5Ef.c H5Ff.c H5Gf.c \
H5If.c H5Lf.c H5Of.c H5Pf.c H5Rf.c H5Sf.c H5Tf.c H5Zf.c HDF5.F90
@@ -155,6 +155,7 @@ H5Pff.lo: $(srcdir)/H5Pff.F90 H5f90global.lo H5fortkit.lo
H5Rff.lo: $(srcdir)/H5Rff.F90 H5f90global.lo
H5Sff.lo: $(srcdir)/H5Sff.F90 H5f90global.lo
H5Tff.lo: $(srcdir)/H5Tff.F90 H5f90global.lo
+H5VLff.lo: $(srcdir)/H5VLff.F90 H5f90global.lo
H5Zff.lo: $(srcdir)/H5Zff.F90 H5f90global.lo
H5_gen.lo: H5_gen.F90 H5f90global.lo H5Aff.lo H5Dff.lo H5Pff.lo
HDF5.lo: $(srcdir)/HDF5.F90 H5f90global.lo H5_ff.lo H5Aff.lo \
diff --git a/fortran/src/hdf5_fortrandll.def.in b/fortran/src/hdf5_fortrandll.def.in
index a99efad..e31a582 100644
--- a/fortran/src/hdf5_fortrandll.def.in
+++ b/fortran/src/hdf5_fortrandll.def.in
@@ -98,6 +98,7 @@ H5F_mp_H5FGET_ACCESS_PLIST_F
H5F_mp_H5FIS_ACCESSIBLE_F
H5F_mp_H5FIS_HDF5_F
H5F_mp_H5FGET_NAME_F
+H5F_mp_H5FGET_FILENO_F
H5F_mp_H5FGET_FILESIZE_F
H5F_mp_H5FGET_FILE_IMAGE_F
H5F_mp_H5FGET_DSET_NO_ATTRS_HINT_F
@@ -334,6 +335,8 @@ 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
+H5P_mp_H5PSET_VOL_F
+H5P_mp_H5PGET_VOL_ID_F
; Parallel
@H5_NOPAREXP@H5P_mp_H5PSET_FAPL_MPIO_F
@H5_NOPAREXP@H5P_mp_H5PGET_FAPL_MPIO_F
@@ -451,6 +454,14 @@ H5T_mp_H5TGET_NATIVE_TYPE_F
H5T_mp_H5TCONVERT_F
H5T_mp_H5TENUM_INSERT_F90
H5T_mp_H5TENUM_INSERT_F03
+; H5VL
+H5VL_mp_H5VLREGISTER_CONNECTOR_BY_NAME_F
+H5VL_mp_H5VLREGISTER_CONNECTOR_BY_VALUE_F
+H5VL_mp_H5VLIS_CONNECTOR_REGISTERED_F
+H5VL_mp_H5VLGET_CONNECTOR_ID_F
+H5VL_mp_H5VLGET_CONNECTOR_NAME_F
+H5VL_mp_H5VLCLOSE_F
+H5VL_mp_H5VLUNREGISTER_CONNECTOR_F
; H5Z
H5Z_mp_H5ZUNREGISTER_F
H5Z_mp_H5ZFILTER_AVAIL_F
diff --git a/fortran/test/CMakeLists.txt b/fortran/test/CMakeLists.txt
index b862fcd..9c68860 100644
--- a/fortran/test/CMakeLists.txt
+++ b/fortran/test/CMakeLists.txt
@@ -7,7 +7,7 @@ project (HDF5_FORTRAN_TESTS C Fortran)
#-----------------------------------------------------------------------------
add_executable (H5_test_buildiface ${HDF5_F90_SRC_DIR}/test/H5_test_buildiface.F90)
-target_include_directories(H5_test_buildiface
+target_include_directories (H5_test_buildiface
PRIVATE
${HDF5_BINARY_DIR} ${HDF5_F90_BINARY_DIR}
)
@@ -31,35 +31,37 @@ set_target_properties (H5_test_buildiface PROPERTIES
Fortran_MODULE_DIRECTORY ${CMAKE_Fortran_MODULE_DIRECTORY}
)
-if (BUILD_SHARED_LIBS)
+if (NOT BUILD_SHARED_LIBS)
+ file (MAKE_DIRECTORY "${HDF5_FORTRAN_TESTS_BINARY_DIR}/static")
+ set (MOD_BUILD_DIR ${CMAKE_Fortran_MODULE_DIRECTORY}/static/${HDF_CFG_BUILD_TYPE})
+else ()
file (MAKE_DIRECTORY "${HDF5_FORTRAN_TESTS_BINARY_DIR}/shared")
set (MODSH_BUILD_DIR ${CMAKE_Fortran_MODULE_DIRECTORY}/shared/${HDF_CFG_BUILD_TYPE})
endif ()
-file (MAKE_DIRECTORY "${HDF5_FORTRAN_TESTS_BINARY_DIR}/static")
-set (MOD_BUILD_DIR ${CMAKE_Fortran_MODULE_DIRECTORY}/static/${HDF_CFG_BUILD_TYPE})
#-----------------------------------------------------------------------------
# Add Test Lib
#-----------------------------------------------------------------------------
-add_library (${HDF5_F90_C_TEST_LIB_TARGET} STATIC t.c)
-set_source_files_properties (t.c PROPERTIES LANGUAGE C)
-target_include_directories(${HDF5_F90_C_TEST_LIB_TARGET}
- PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};${HDF5_F90_BINARY_DIR};${HDF5_F90_BINARY_DIR}/static;$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>"
- INTERFACE "$<INSTALL_INTERFACE:$<INSTALL_PREFIX>/include>"
-)
-TARGET_C_PROPERTIES (${HDF5_F90_C_TEST_LIB_TARGET} STATIC)
-target_link_libraries (${HDF5_F90_C_TEST_LIB_TARGET} PRIVATE
- ${HDF5_F90_C_LIB_TARGET}
- ${HDF5_TEST_LIB_TARGET}
-)
-H5_SET_LIB_OPTIONS (${HDF5_F90_C_TEST_LIB_TARGET} ${HDF5_F90_C_TEST_LIB_NAME} STATIC 0)
-set_target_properties (${HDF5_F90_C_TEST_LIB_TARGET} PROPERTIES
- FOLDER libraries/test/fortran
- LINKER_LANGUAGE C
-)
-if (BUILD_SHARED_LIBS)
+if (NOT BUILD_SHARED_LIBS)
+ add_library (${HDF5_F90_C_TEST_LIB_TARGET} STATIC t.c)
+ set_source_files_properties (t.c PROPERTIES LANGUAGE C)
+ target_include_directories (${HDF5_F90_C_TEST_LIB_TARGET}
+ PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};${HDF5_F90_BINARY_DIR};${HDF5_F90_BINARY_DIR}/static;$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>"
+ INTERFACE "$<INSTALL_INTERFACE:$<INSTALL_PREFIX>/include>"
+ )
+ TARGET_C_PROPERTIES (${HDF5_F90_C_TEST_LIB_TARGET} STATIC)
+ target_link_libraries (${HDF5_F90_C_TEST_LIB_TARGET}
+ PRIVATE ${HDF5_F90_C_LIB_TARGET}
+ PUBLIC ${HDF5_TEST_LIB_TARGET}
+ )
+ H5_SET_LIB_OPTIONS (${HDF5_F90_C_TEST_LIB_TARGET} ${HDF5_F90_C_TEST_LIB_NAME} STATIC 0)
+ set_target_properties (${HDF5_F90_C_TEST_LIB_TARGET} PROPERTIES
+ FOLDER libraries/test/fortran
+ LINKER_LANGUAGE C
+ )
+else ()
add_library (${HDF5_F90_C_TEST_LIBSH_TARGET} SHARED t.c)
- target_include_directories(${HDF5_F90_C_TEST_LIBSH_TARGET}
+ target_include_directories (${HDF5_F90_C_TEST_LIBSH_TARGET}
PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};${HDF5_F90_BINARY_DIR};${HDF5_F90_BINARY_DIR}/shared;$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>"
INTERFACE "$<INSTALL_INTERFACE:$<INSTALL_PREFIX>/include>"
)
@@ -67,9 +69,9 @@ if (BUILD_SHARED_LIBS)
PUBLIC "H5_BUILT_AS_DYNAMIC_LIB"
)
TARGET_C_PROPERTIES (${HDF5_F90_C_TEST_LIBSH_TARGET} SHARED)
- target_link_libraries (${HDF5_F90_C_TEST_LIBSH_TARGET} PRIVATE
- ${HDF5_F90_C_LIBSH_TARGET}
- ${HDF5_TEST_LIBSH_TARGET}
+ target_link_libraries (${HDF5_F90_C_TEST_LIBSH_TARGET}
+ PRIVATE ${HDF5_F90_C_LIBSH_TARGET}
+ PUBLIC ${HDF5_TEST_LIBSH_TARGET}
)
H5_SET_LIB_OPTIONS (${HDF5_F90_C_TEST_LIBSH_TARGET} ${HDF5_F90_C_TEST_LIB_NAME} SHARED "F")
set_target_properties (${HDF5_F90_C_TEST_LIBSH_TARGET} PROPERTIES
@@ -78,19 +80,19 @@ if (BUILD_SHARED_LIBS)
)
endif ()
-add_custom_command (
- OUTPUT ${HDF5_FORTRAN_TESTS_BINARY_DIR}/static/tf_gen.F90
- COMMAND $<TARGET_FILE:H5_test_buildiface>
- WORKING_DIRECTORY ${HDF5_FORTRAN_TESTS_BINARY_DIR}/static
- DEPENDS H5_test_buildiface
- COMMENT "Generating the tf_gen.F90 file"
-)
-add_custom_target (H5testgen ALL
- DEPENDS ${HDF5_FORTRAN_TESTS_BINARY_DIR}/static/tf_gen.F90
-)
-set_source_files_properties (${HDF5_FORTRAN_TESTS_BINARY_DIR}/static/tf_gen.F90 PROPERTIES GENERATED TRUE)
-
-if (BUILD_SHARED_LIBS)
+if (NOT BUILD_SHARED_LIBS)
+ add_custom_command (
+ OUTPUT ${HDF5_FORTRAN_TESTS_BINARY_DIR}/static/tf_gen.F90
+ COMMAND $<TARGET_FILE:H5_test_buildiface>
+ WORKING_DIRECTORY ${HDF5_FORTRAN_TESTS_BINARY_DIR}/static
+ DEPENDS H5_test_buildiface
+ COMMENT "Generating the tf_gen.F90 file"
+ )
+ add_custom_target (H5testgen ALL
+ DEPENDS ${HDF5_FORTRAN_TESTS_BINARY_DIR}/static/tf_gen.F90
+ )
+ set_source_files_properties (${HDF5_FORTRAN_TESTS_BINARY_DIR}/static/tf_gen.F90 PROPERTIES GENERATED TRUE)
+else ()
add_custom_command (
OUTPUT ${HDF5_FORTRAN_TESTS_BINARY_DIR}/shared/tf_gen.F90
COMMAND $<TARGET_FILE:H5_test_buildiface>
@@ -104,15 +106,16 @@ if (BUILD_SHARED_LIBS)
set_source_files_properties (${HDF5_FORTRAN_TESTS_BINARY_DIR}/shared/tf_gen.F90 PROPERTIES GENERATED TRUE)
endif ()
-set (HDF5_F90_TF_SOURCES
- # generated files
- ${HDF5_FORTRAN_TESTS_BINARY_DIR}/static/tf_gen.F90
+if (NOT BUILD_SHARED_LIBS)
+ set (HDF5_F90_TF_SOURCES
+ # generated files
+ ${HDF5_FORTRAN_TESTS_BINARY_DIR}/static/tf_gen.F90
- # normal distribution
- tf.F90
-)
-set_source_files_properties (${HDF5_F90_TF_SOURCES} PROPERTIES LANGUAGE Fortran)
-if (BUILD_SHARED_LIBS)
+ # normal distribution
+ tf.F90
+ )
+ set_source_files_properties (${HDF5_F90_TF_SOURCES} PROPERTIES LANGUAGE Fortran)
+else ()
set (HDF5_F90_TF_SOURCES_SHARED
# generated file
${HDF5_FORTRAN_TESTS_BINARY_DIR}/shared/tf_gen.F90
@@ -123,40 +126,40 @@ if (BUILD_SHARED_LIBS)
set_source_files_properties (${HDF5_F90_TF_SOURCES_SHARED} PROPERTIES LANGUAGE Fortran)
endif ()
-add_library (${HDF5_F90_TEST_LIB_TARGET} STATIC ${HDF5_F90_TF_SOURCES})
-target_include_directories (${HDF5_F90_TEST_LIB_TARGET}
- PRIVATE
- "${CMAKE_Fortran_MODULE_DIRECTORY}/static;${HDF5_F90_BINARY_DIR};${HDF5_F90_BINARY_DIR}/static"
- INTERFACE
- "$<INSTALL_INTERFACE:$<INSTALL_PREFIX>/include>"
-)
-target_compile_definitions(${HDF5_F90_TEST_LIB_TARGET}
- PRIVATE
- $<$<STREQUAL:"x${CMAKE_Fortran_SIMULATE_ID}","xMSVC">:HDF5F90_WINDOWS>
- $<$<STREQUAL:"x${CMAKE_Fortran_SIMULATE_ID}","xMSVC">:${WIN_COMPILE_FLAGS}>
-)
-target_link_libraries (${HDF5_F90_TEST_LIB_TARGET}
- PUBLIC
- ${HDF5_F90_C_TEST_LIB_TARGET} ${HDF5_F90_LIB_TARGET} ${HDF5_LIB_TARGET}
-)
-#set_property(TARGET ${HDF5_F90_TEST_LIB_TARGET} APPEND PROPERTY
-# LINK_FLAGS $<$<STREQUAL:"x${CMAKE_Fortran_SIMULATE_ID}","xMSVC">:"-SUBSYSTEM:CONSOLE">
-#)
-#set_property(TARGET ${HDF5_F90_TEST_LIB_TARGET} APPEND PROPERTY
-# LINK_FLAGS $<$<STREQUAL:"x${CMAKE_Fortran_SIMULATE_ID}","xMSVC">:${WIN_LINK_FLAGS}>
-#)
-if(MSVC)
- set_property(TARGET ${HDF5_F90_TEST_LIB_TARGET} PROPERTY LINK_FLAGS "/SUBSYSTEM:CONSOLE ${WIN_LINK_FLAGS}")
-endif()
-set_target_properties (${HDF5_F90_TEST_LIB_TARGET} PROPERTIES
- FOLDER libraries/test/fortran
- LINKER_LANGUAGE Fortran
- Fortran_MODULE_DIRECTORY ${CMAKE_Fortran_MODULE_DIRECTORY}/static
-)
-H5_SET_LIB_OPTIONS (${HDF5_F90_TEST_LIB_TARGET} ${HDF5_F90_TEST_LIB_NAME} STATIC 0)
-add_dependencies(${HDF5_F90_TEST_LIB_TARGET} H5testgen)
-
-if (BUILD_SHARED_LIBS)
+if (NOT BUILD_SHARED_LIBS)
+ add_library (${HDF5_F90_TEST_LIB_TARGET} STATIC ${HDF5_F90_TF_SOURCES})
+ target_include_directories (${HDF5_F90_TEST_LIB_TARGET}
+ PRIVATE
+ "${CMAKE_Fortran_MODULE_DIRECTORY}/static;${HDF5_F90_BINARY_DIR};${HDF5_F90_BINARY_DIR}/static"
+ INTERFACE
+ "$<INSTALL_INTERFACE:$<INSTALL_PREFIX>/include>"
+ )
+ target_compile_definitions(${HDF5_F90_TEST_LIB_TARGET}
+ PRIVATE
+ $<$<STREQUAL:"x${CMAKE_Fortran_SIMULATE_ID}","xMSVC">:HDF5F90_WINDOWS>
+ $<$<STREQUAL:"x${CMAKE_Fortran_SIMULATE_ID}","xMSVC">:${WIN_COMPILE_FLAGS}>
+ )
+ target_link_libraries (${HDF5_F90_TEST_LIB_TARGET}
+ PUBLIC
+ ${HDF5_F90_C_TEST_LIB_TARGET} ${HDF5_F90_LIB_TARGET} ${HDF5_LIB_TARGET}
+ )
+# set_property(TARGET ${HDF5_F90_TEST_LIB_TARGET} APPEND PROPERTY
+# LINK_FLAGS $<$<STREQUAL:"x${CMAKE_Fortran_SIMULATE_ID}","xMSVC">:"-SUBSYSTEM:CONSOLE">
+# )
+# set_property(TARGET ${HDF5_F90_TEST_LIB_TARGET} APPEND PROPERTY
+# LINK_FLAGS $<$<STREQUAL:"x${CMAKE_Fortran_SIMULATE_ID}","xMSVC">:${WIN_LINK_FLAGS}>
+# )
+ if(MSVC)
+ set_property(TARGET ${HDF5_F90_TEST_LIB_TARGET} PROPERTY LINK_FLAGS "/SUBSYSTEM:CONSOLE ${WIN_LINK_FLAGS}")
+ endif()
+ set_target_properties (${HDF5_F90_TEST_LIB_TARGET} PROPERTIES
+ FOLDER libraries/test/fortran
+ LINKER_LANGUAGE Fortran
+ Fortran_MODULE_DIRECTORY ${CMAKE_Fortran_MODULE_DIRECTORY}/static
+ )
+ H5_SET_LIB_OPTIONS (${HDF5_F90_TEST_LIB_TARGET} ${HDF5_F90_TEST_LIB_NAME} STATIC 0)
+ add_dependencies(${HDF5_F90_TEST_LIB_TARGET} H5testgen)
+else ()
add_library (${HDF5_F90_TEST_LIBSH_TARGET} SHARED ${HDF5_F90_TF_SOURCES_SHARED})
target_include_directories (${HDF5_F90_TEST_LIBSH_TARGET}
PRIVATE
@@ -218,18 +221,10 @@ add_executable (testhdf5_fortran
tH5Z.F90
tHDF5.F90
)
-target_include_directories (testhdf5_fortran
- PRIVATE
- "${CMAKE_Fortran_MODULE_DIRECTORY}/static;${HDF5_F90_BINARY_DIR};${HDF5_F90_BINARY_DIR}/static"
-)
target_compile_options(testhdf5_fortran
PRIVATE
$<$<STREQUAL:"x${CMAKE_Fortran_SIMULATE_ID}","xMSVC">:${WIN_COMPILE_FLAGS}>
)
-target_link_libraries (testhdf5_fortran
- PRIVATE
- ${HDF5_F90_TEST_LIB_TARGET} ${HDF5_F90_LIB_TARGET} ${HDF5_LIB_TARGET} $<$<PLATFORM_ID:Windows>:ws2_32.lib>
-)
#set_property(TARGET testhdf5_fortran APPEND PROPERTY
# LINK_FLAGS $<$<STREQUAL:"x${CMAKE_Fortran_SIMULATE_ID}","xMSVC">:"-SUBSYSTEM:CONSOLE">
#)
@@ -239,58 +234,36 @@ target_link_libraries (testhdf5_fortran
if(MSVC)
set_property(TARGET testhdf5_fortran PROPERTY LINK_FLAGS "/SUBSYSTEM:CONSOLE ${WIN_LINK_FLAGS}")
endif()
-set_target_properties (testhdf5_fortran PROPERTIES
- LINKER_LANGUAGE Fortran
- FOLDER test/fortran
- Fortran_MODULE_DIRECTORY ${CMAKE_Fortran_MODULE_DIRECTORY}/static
-)
-add_dependencies (testhdf5_fortran ${HDF5_F90_TEST_LIB_TARGET})
-
-if (BUILD_SHARED_LIBS)
- add_executable (testhdf5_fortran-shared
- fortranlib_test.F90
- tH5A.F90
- tH5D.F90
- tH5E.F90
- tH5F.F90
- tH5G.F90
- tH5I.F90
- tH5P.F90
- tH5R.F90
- tH5S.F90
- tH5Sselect.F90
- tH5T.F90
- tH5VL.F90
- tH5Z.F90
- tHDF5.F90
- )
- target_include_directories (testhdf5_fortran-shared
+if (NOT BUILD_SHARED_LIBS)
+ target_include_directories (testhdf5_fortran
PRIVATE
- "${CMAKE_Fortran_MODULE_DIRECTORY}/shared;${HDF5_F90_BINARY_DIR};${HDF5_F90_BINARY_DIR}/shared"
+ "${CMAKE_Fortran_MODULE_DIRECTORY}/static;${HDF5_F90_BINARY_DIR};${HDF5_F90_BINARY_DIR}/static"
)
- target_compile_options(testhdf5_fortran-shared
+ target_link_libraries (testhdf5_fortran
PRIVATE
- $<$<STREQUAL:"x${CMAKE_Fortran_SIMULATE_ID}","xMSVC">:${WIN_COMPILE_FLAGS}>
+ ${HDF5_F90_TEST_LIB_TARGET} ${HDF5_F90_LIB_TARGET} ${HDF5_LIB_TARGET} $<$<PLATFORM_ID:Windows>:ws2_32.lib>
+ )
+ set_target_properties (testhdf5_fortran PROPERTIES
+ LINKER_LANGUAGE Fortran
+ FOLDER test/fortran
+ Fortran_MODULE_DIRECTORY ${CMAKE_Fortran_MODULE_DIRECTORY}/static
+ )
+ add_dependencies (testhdf5_fortran ${HDF5_F90_TEST_LIB_TARGET})
+else ()
+ target_include_directories (testhdf5_fortran
+ PRIVATE
+ "${CMAKE_Fortran_MODULE_DIRECTORY}/shared;${HDF5_F90_BINARY_DIR};${HDF5_F90_BINARY_DIR}/shared"
)
- target_link_libraries (testhdf5_fortran-shared
+ target_link_libraries (testhdf5_fortran
PRIVATE
${HDF5_F90_TEST_LIBSH_TARGET} ${HDF5_F90_LIBSH_TARGET} ${HDF5_LIBSH_TARGET} $<$<PLATFORM_ID:Windows>:ws2_32.lib>
)
-# set_property(TARGET testhdf5_fortran-shared APPEND PROPERTY
-# LINK_FLAGS $<$<STREQUAL:"x${CMAKE_Fortran_SIMULATE_ID}","xMSVC">:"-SUBSYSTEM:CONSOLE">
-# )
-# set_property(TARGET testhdf5_fortran-shared APPEND PROPERTY
-# LINK_FLAGS $<$<STREQUAL:"x${CMAKE_Fortran_SIMULATE_ID}","xMSVC">:${WIN_LINK_FLAGS}>
-# )
- if(MSVC)
- set_property(TARGET testhdf5_fortran-shared PROPERTY LINK_FLAGS "/SUBSYSTEM:CONSOLE ${WIN_LINK_FLAGS}")
- endif()
- set_target_properties (testhdf5_fortran-shared PROPERTIES
+ set_target_properties (testhdf5_fortran PROPERTIES
LINKER_LANGUAGE Fortran
FOLDER test/fortran
Fortran_MODULE_DIRECTORY ${CMAKE_Fortran_MODULE_DIRECTORY}/shared
)
- add_dependencies (testhdf5_fortran-shared ${HDF5_F90_TEST_LIBSH_TARGET})
+ add_dependencies (testhdf5_fortran ${HDF5_F90_TEST_LIBSH_TARGET})
endif ()
#-- Adding test for testhdf5_fortran_1_8
@@ -302,18 +275,10 @@ add_executable (testhdf5_fortran_1_8
tH5MISC_1_8.F90
tHDF5_1_8.F90
)
-target_include_directories (testhdf5_fortran_1_8
- PRIVATE
- "${CMAKE_Fortran_MODULE_DIRECTORY}/static;${HDF5_F90_BINARY_DIR};${HDF5_F90_BINARY_DIR}/static"
-)
target_compile_options(testhdf5_fortran_1_8
PRIVATE
$<$<STREQUAL:"x${CMAKE_Fortran_SIMULATE_ID}","xMSVC">:${WIN_COMPILE_FLAGS}>
)
-target_link_libraries (testhdf5_fortran_1_8
- PRIVATE
- ${HDF5_F90_TEST_LIB_TARGET} ${HDF5_F90_LIB_TARGET} ${HDF5_LIB_TARGET} $<$<PLATFORM_ID:Windows>:ws2_32.lib>
-)
#set_property(TARGET testhdf5_fortran_1_8 APPEND PROPERTY
# LINK_FLAGS $<$<STREQUAL:"x${CMAKE_Fortran_SIMULATE_ID}","xMSVC">:"-SUBSYSTEM:CONSOLE">
#)
@@ -323,49 +288,36 @@ target_link_libraries (testhdf5_fortran_1_8
if(MSVC)
set_property(TARGET testhdf5_fortran_1_8 PROPERTY LINK_FLAGS "/SUBSYSTEM:CONSOLE ${WIN_LINK_FLAGS}")
endif()
-set_target_properties (testhdf5_fortran_1_8 PROPERTIES
- LINKER_LANGUAGE Fortran
- FOLDER test/fortran
- Fortran_MODULE_DIRECTORY ${CMAKE_Fortran_MODULE_DIRECTORY}/static
-)
-add_dependencies (testhdf5_fortran_1_8 ${HDF5_F90_TEST_LIB_TARGET})
-
-if (BUILD_SHARED_LIBS)
- add_executable (testhdf5_fortran_1_8-shared
- fortranlib_test_1_8.F90
- tH5O.F90
- tH5A_1_8.F90
- tH5G_1_8.F90
- tH5MISC_1_8.F90
- tHDF5_1_8.F90
- )
- target_include_directories (testhdf5_fortran_1_8-shared
+if (NOT BUILD_SHARED_LIBS)
+ target_include_directories (testhdf5_fortran_1_8
PRIVATE
- "${CMAKE_Fortran_MODULE_DIRECTORY}/shared;${HDF5_F90_BINARY_DIR};${HDF5_F90_BINARY_DIR}/shared"
+ "${CMAKE_Fortran_MODULE_DIRECTORY}/static;${HDF5_F90_BINARY_DIR};${HDF5_F90_BINARY_DIR}/static"
)
- target_compile_options(testhdf5_fortran_1_8-shared
+ target_link_libraries (testhdf5_fortran_1_8
PRIVATE
- $<$<STREQUAL:"x${CMAKE_Fortran_SIMULATE_ID}","xMSVC">:${WIN_COMPILE_FLAGS}>
+ ${HDF5_F90_TEST_LIB_TARGET} ${HDF5_F90_LIB_TARGET} ${HDF5_LIB_TARGET} $<$<PLATFORM_ID:Windows>:ws2_32.lib>
+ )
+ set_target_properties (testhdf5_fortran_1_8 PROPERTIES
+ LINKER_LANGUAGE Fortran
+ FOLDER test/fortran
+ Fortran_MODULE_DIRECTORY ${CMAKE_Fortran_MODULE_DIRECTORY}/static
)
- target_link_libraries (testhdf5_fortran_1_8-shared
+ add_dependencies (testhdf5_fortran_1_8 ${HDF5_F90_TEST_LIB_TARGET})
+else ()
+ target_include_directories (testhdf5_fortran_1_8
+ PRIVATE
+ "${CMAKE_Fortran_MODULE_DIRECTORY}/shared;${HDF5_F90_BINARY_DIR};${HDF5_F90_BINARY_DIR}/shared"
+ )
+ target_link_libraries (testhdf5_fortran_1_8
PRIVATE
${HDF5_F90_TEST_LIBSH_TARGET} ${HDF5_F90_LIBSH_TARGET} ${HDF5_LIBSH_TARGET} $<$<PLATFORM_ID:Windows>:ws2_32.lib>
)
-# set_property(TARGET testhdf5_fortran_1_8-shared APPEND PROPERTY
-# LINK_FLAGS $<$<STREQUAL:"x${CMAKE_Fortran_SIMULATE_ID}","xMSVC">:"-SUBSYSTEM:CONSOLE">
-# )
-# set_property(TARGET testhdf5_fortran_1_8-shared APPEND PROPERTY
-# LINK_FLAGS $<$<STREQUAL:"x${CMAKE_Fortran_SIMULATE_ID}","xMSVC">:${WIN_LINK_FLAGS}>
-# )
- if(MSVC)
- set_property(TARGET testhdf5_fortran_1_8-shared PROPERTY LINK_FLAGS "/SUBSYSTEM:CONSOLE ${WIN_LINK_FLAGS}")
- endif()
- set_target_properties (testhdf5_fortran_1_8-shared PROPERTIES
+ set_target_properties (testhdf5_fortran_1_8 PROPERTIES
LINKER_LANGUAGE Fortran
FOLDER test/fortran
Fortran_MODULE_DIRECTORY ${CMAKE_Fortran_MODULE_DIRECTORY}/shared
)
- add_dependencies (testhdf5_fortran_1_8-shared ${HDF5_F90_TEST_LIBSH_TARGET})
+ add_dependencies (testhdf5_fortran_1_8 ${HDF5_F90_TEST_LIBSH_TARGET})
endif ()
#-- Adding test for fortranlib_test_F03
@@ -379,18 +331,10 @@ add_executable (fortranlib_test_F03
tH5T_F03.F90
tHDF5_F03.F90
)
-target_include_directories (fortranlib_test_F03
- PRIVATE
- "${CMAKE_Fortran_MODULE_DIRECTORY}/static;${HDF5_F90_BINARY_DIR};${HDF5_F90_BINARY_DIR}/static"
-)
target_compile_options(fortranlib_test_F03
PRIVATE
$<$<STREQUAL:"x${CMAKE_Fortran_SIMULATE_ID}","xMSVC">:${WIN_COMPILE_FLAGS}>
)
-target_link_libraries (fortranlib_test_F03
- PRIVATE
- ${HDF5_F90_TEST_LIB_TARGET} ${HDF5_F90_LIB_TARGET} ${HDF5_LIB_TARGET} $<$<PLATFORM_ID:Windows>:ws2_32.lib>
-)
#set_property(TARGET fortranlib_test_F03 APPEND PROPERTY
# LINK_FLAGS $<$<STREQUAL:"x${CMAKE_Fortran_SIMULATE_ID}","xMSVC">:"-SUBSYSTEM:CONSOLE">
#)
@@ -400,67 +344,44 @@ target_link_libraries (fortranlib_test_F03
if(MSVC)
set_property(TARGET fortranlib_test_F03 PROPERTY LINK_FLAGS "/SUBSYSTEM:CONSOLE ${WIN_LINK_FLAGS}")
endif()
-set_target_properties (fortranlib_test_F03 PROPERTIES
- LINKER_LANGUAGE Fortran
- FOLDER test/fortran
- Fortran_MODULE_DIRECTORY ${CMAKE_Fortran_MODULE_DIRECTORY}/static
-)
-add_dependencies (fortranlib_test_F03 ${HDF5_F90_TEST_LIB_TARGET})
-
-if (BUILD_SHARED_LIBS)
- add_executable (fortranlib_test_F03-shared
- fortranlib_test_F03.F90
- tH5E_F03.F90
- tH5F_F03.F90
- tH5L_F03.F90
- tH5O_F03.F90
- tH5P_F03.F90
- tH5T_F03.F90
- tHDF5_F03.F90
- )
- target_include_directories (fortranlib_test_F03-shared
+if (NOT BUILD_SHARED_LIBS)
+ target_include_directories (fortranlib_test_F03
PRIVATE
- "${CMAKE_Fortran_MODULE_DIRECTORY}/shared;${HDF5_F90_BINARY_DIR};${HDF5_F90_BINARY_DIR}/shared"
+ "${CMAKE_Fortran_MODULE_DIRECTORY}/static;${HDF5_F90_BINARY_DIR};${HDF5_F90_BINARY_DIR}/static"
)
- target_compile_options(fortranlib_test_F03-shared
+ target_link_libraries (fortranlib_test_F03
PRIVATE
- $<$<STREQUAL:"x${CMAKE_Fortran_SIMULATE_ID}","xMSVC">:${WIN_COMPILE_FLAGS}>
+ ${HDF5_F90_TEST_LIB_TARGET} ${HDF5_F90_LIB_TARGET} ${HDF5_LIB_TARGET} $<$<PLATFORM_ID:Windows>:ws2_32.lib>
+ )
+ set_target_properties (fortranlib_test_F03 PROPERTIES
+ LINKER_LANGUAGE Fortran
+ FOLDER test/fortran
+ Fortran_MODULE_DIRECTORY ${CMAKE_Fortran_MODULE_DIRECTORY}/static
+ )
+ add_dependencies (fortranlib_test_F03 ${HDF5_F90_TEST_LIB_TARGET})
+else ()
+ target_include_directories (fortranlib_test_F03
+ PRIVATE
+ "${CMAKE_Fortran_MODULE_DIRECTORY}/shared;${HDF5_F90_BINARY_DIR};${HDF5_F90_BINARY_DIR}/shared"
)
- target_link_libraries (fortranlib_test_F03-shared
+ target_link_libraries (fortranlib_test_F03
PRIVATE
${HDF5_F90_TEST_LIBSH_TARGET} ${HDF5_F90_LIBSH_TARGET} ${HDF5_LIBSH_TARGET} $<$<PLATFORM_ID:Windows>:ws2_32.lib>
)
-# set_property(TARGET fortranlib_test_F03-shared APPEND PROPERTY
-# LINK_FLAGS $<$<STREQUAL:"x${CMAKE_Fortran_SIMULATE_ID}","xMSVC">:"-SUBSYSTEM:CONSOLE">
-# )
-# set_property(TARGET fortranlib_test_F03-shared APPEND PROPERTY
-# LINK_FLAGS $<$<STREQUAL:"x${CMAKE_Fortran_SIMULATE_ID}","xMSVC">:${WIN_LINK_FLAGS}>
-# )
- if(MSVC)
- set_property(TARGET fortranlib_test_F03-shared PROPERTY LINK_FLAGS "/SUBSYSTEM:CONSOLE ${WIN_LINK_FLAGS}")
- endif()
- set_target_properties (fortranlib_test_F03-shared PROPERTIES
+ set_target_properties (fortranlib_test_F03 PROPERTIES
LINKER_LANGUAGE Fortran
FOLDER test/fortran
Fortran_MODULE_DIRECTORY ${CMAKE_Fortran_MODULE_DIRECTORY}/shared
)
- add_dependencies (fortranlib_test_F03-shared ${HDF5_F90_TEST_LIBSH_TARGET})
+ add_dependencies (fortranlib_test_F03 ${HDF5_F90_TEST_LIBSH_TARGET})
endif ()
#-- Adding test for fflush1
add_executable (fflush1 fflush1.F90)
-target_include_directories (fflush1
- PRIVATE
- ${CMAKE_Fortran_MODULE_DIRECTORY}/static
-)
target_compile_options(fflush1
PRIVATE
$<$<STREQUAL:"x${CMAKE_Fortran_SIMULATE_ID}","xMSVC">:${WIN_COMPILE_FLAGS}>
)
-target_link_libraries (fflush1
- PRIVATE
- ${HDF5_F90_LIB_TARGET} ${HDF5_F90_TEST_LIB_TARGET} ${HDF5_LIB_TARGET} $<$<PLATFORM_ID:Windows>:ws2_32.lib>
-)
#set_property(TARGET fflush1 APPEND PROPERTY
# LINK_FLAGS $<$<STREQUAL:"x${CMAKE_Fortran_SIMULATE_ID}","xMSVC">:"-SUBSYSTEM:CONSOLE">
#)
@@ -470,58 +391,44 @@ target_link_libraries (fflush1
if(MSVC)
set_property(TARGET fflush1 PROPERTY LINK_FLAGS "/SUBSYSTEM:CONSOLE ${WIN_LINK_FLAGS}")
endif()
-set_target_properties (fflush1 PROPERTIES
- LINKER_LANGUAGE Fortran
- FOLDER test/fortran
- Fortran_MODULE_DIRECTORY ${CMAKE_Fortran_MODULE_DIRECTORY}/static
-)
-add_dependencies (fflush1 ${HDF5_F90_TEST_LIB_TARGET})
-
-if (BUILD_SHARED_LIBS)
- add_executable (fflush1-shared fflush1.F90)
- target_include_directories (fflush1-shared
+if (NOT BUILD_SHARED_LIBS)
+ target_include_directories (fflush1
PRIVATE
- ${CMAKE_Fortran_MODULE_DIRECTORY}/shared
+ ${CMAKE_Fortran_MODULE_DIRECTORY}/static
)
- target_compile_options(fflush1-shared
+ target_link_libraries (fflush1
PRIVATE
- $<$<STREQUAL:"x${CMAKE_Fortran_SIMULATE_ID}","xMSVC">:${WIN_COMPILE_FLAGS}>
+ ${HDF5_F90_LIB_TARGET} ${HDF5_F90_TEST_LIB_TARGET} ${HDF5_LIB_TARGET} $<$<PLATFORM_ID:Windows>:ws2_32.lib>
+ )
+ set_target_properties (fflush1 PROPERTIES
+ LINKER_LANGUAGE Fortran
+ FOLDER test/fortran
+ Fortran_MODULE_DIRECTORY ${CMAKE_Fortran_MODULE_DIRECTORY}/static
)
- target_link_libraries (fflush1-shared
+ add_dependencies (fflush1 ${HDF5_F90_TEST_LIB_TARGET})
+else ()
+ target_include_directories (fflush1
+ PRIVATE
+ ${CMAKE_Fortran_MODULE_DIRECTORY}/shared
+ )
+ target_link_libraries (fflush1
PRIVATE
${HDF5_F90_LIBSH_TARGET} ${HDF5_F90_TEST_LIBSH_TARGET} ${HDF5_LIBSH_TARGET} $<$<PLATFORM_ID:Windows>:ws2_32.lib>
)
-# set_property(TARGET fflush1-shared APPEND PROPERTY
-# LINK_FLAGS $<$<STREQUAL:"x${CMAKE_Fortran_SIMULATE_ID}","xMSVC">:"-SUBSYSTEM:CONSOLE">
-# )
-# set_property(TARGET fflush1-shared APPEND PROPERTY
-# LINK_FLAGS $<$<STREQUAL:"x${CMAKE_Fortran_SIMULATE_ID}","xMSVC">:${WIN_LINK_FLAGS}>
-# )
- if(MSVC)
- set_property(TARGET fflush1-shared PROPERTY LINK_FLAGS "/SUBSYSTEM:CONSOLE ${WIN_LINK_FLAGS}")
- endif()
- set_target_properties (fflush1-shared PROPERTIES
+ set_target_properties (fflush1 PROPERTIES
LINKER_LANGUAGE Fortran
FOLDER test/fortran
Fortran_MODULE_DIRECTORY ${CMAKE_Fortran_MODULE_DIRECTORY}/shared
)
- add_dependencies (fflush1-shared ${HDF5_F90_TEST_LIBSH_TARGET})
+ add_dependencies (fflush1 ${HDF5_F90_TEST_LIBSH_TARGET})
endif ()
#-- Adding test for fflush2
add_executable (fflush2 fflush2.F90)
-target_include_directories (fflush2
- PRIVATE
- ${CMAKE_Fortran_MODULE_DIRECTORY}/static
-)
target_compile_options (fflush2
PRIVATE
$<$<STREQUAL:"x${CMAKE_Fortran_SIMULATE_ID}","xMSVC">:${WIN_COMPILE_FLAGS}>
)
-target_link_libraries (fflush2
- PRIVATE
- ${HDF5_F90_TEST_LIB_TARGET} ${HDF5_F90_LIB_TARGET} ${HDF5_LIB_TARGET} $<$<PLATFORM_ID:Windows>:ws2_32.lib>
-)
#set_property(TARGET fflush2 APPEND PROPERTY
# LINK_FLAGS $<$<STREQUAL:"x${CMAKE_Fortran_SIMULATE_ID}","xMSVC">:"-SUBSYSTEM:CONSOLE">
#)
@@ -531,42 +438,83 @@ target_link_libraries (fflush2
if(MSVC)
set_property(TARGET fflush2 PROPERTY LINK_FLAGS "/SUBSYSTEM:CONSOLE ${WIN_LINK_FLAGS}")
endif()
-set_target_properties (fflush2 PROPERTIES
- LINKER_LANGUAGE Fortran
- FOLDER test/fortran
- Fortran_MODULE_DIRECTORY ${CMAKE_Fortran_MODULE_DIRECTORY}/static
-)
-add_dependencies (fflush2 ${HDF5_F90_TEST_LIB_TARGET})
-
-if (BUILD_SHARED_LIBS)
- add_executable (fflush2-shared fflush2.F90)
- target_include_directories (fflush2-shared
+if (NOT BUILD_SHARED_LIBS)
+ target_include_directories (fflush2
PRIVATE
- ${CMAKE_Fortran_MODULE_DIRECTORY}/shared
+ ${CMAKE_Fortran_MODULE_DIRECTORY}/static
)
- target_compile_options(fflush2-shared
+ target_link_libraries (fflush2
PRIVATE
- $<$<STREQUAL:"x${CMAKE_Fortran_SIMULATE_ID}","xMSVC">:${WIN_COMPILE_FLAGS}>
+ ${HDF5_F90_TEST_LIB_TARGET} ${HDF5_F90_LIB_TARGET} ${HDF5_LIB_TARGET} $<$<PLATFORM_ID:Windows>:ws2_32.lib>
+ )
+ set_target_properties (fflush2 PROPERTIES
+ LINKER_LANGUAGE Fortran
+ FOLDER test/fortran
+ Fortran_MODULE_DIRECTORY ${CMAKE_Fortran_MODULE_DIRECTORY}/static
+ )
+ add_dependencies (fflush2 ${HDF5_F90_TEST_LIB_TARGET})
+else ()
+ target_include_directories (fflush2
+ PRIVATE
+ ${CMAKE_Fortran_MODULE_DIRECTORY}/shared
)
- target_link_libraries (fflush2-shared
+ target_link_libraries (fflush2
PRIVATE
${HDF5_F90_TEST_LIBSH_TARGET} ${HDF5_F90_LIBSH_TARGET} ${HDF5_LIBSH_TARGET} $<$<PLATFORM_ID:Windows>:ws2_32.lib>
)
-# set_property(TARGET fflush2-shared APPEND PROPERTY
-# LINK_FLAGS $<$<STREQUAL:"x${CMAKE_Fortran_SIMULATE_ID}","xMSVC">:"-SUBSYSTEM:CONSOLE">
-# )
-# set_property(TARGET fflush2-shared APPEND PROPERTY
-# LINK_FLAGS $<$<STREQUAL:"x${CMAKE_Fortran_SIMULATE_ID}","xMSVC">:${WIN_LINK_FLAGS}>
-# )
- if(MSVC)
- set_property(TARGET fflush2-shared PROPERTY LINK_FLAGS "/SUBSYSTEM:CONSOLE ${WIN_LINK_FLAGS}")
- endif()
- set_target_properties (fflush2-shared PROPERTIES
+ set_target_properties (fflush2 PROPERTIES
+ LINKER_LANGUAGE Fortran
+ FOLDER test/fortran
+ Fortran_MODULE_DIRECTORY ${CMAKE_Fortran_MODULE_DIRECTORY}/shared
+ )
+ add_dependencies (fflush2 ${HDF5_F90_TEST_LIBSH_TARGET})
+endif ()
+
+#-- Adding test for vol_connector
+add_executable (vol_connector vol_connector.F90)
+target_compile_options(vol_connector
+ PRIVATE
+ $<$<STREQUAL:"x${CMAKE_Fortran_SIMULATE_ID}","xMSVC">:${WIN_COMPILE_FLAGS}>
+)
+#set_property(TARGET vol_connector APPEND PROPERTY
+# LINK_FLAGS $<$<STREQUAL:"x${CMAKE_Fortran_SIMULATE_ID}","xMSVC">:"-SUBSYSTEM:CONSOLE">
+#)
+#set_property(TARGET vol_connector APPEND PROPERTY
+# LINK_FLAGS $<$<STREQUAL:"x${CMAKE_Fortran_SIMULATE_ID}","xMSVC">:${WIN_LINK_FLAGS}>
+#)
+if(MSVC)
+ set_property(TARGET vol_connector PROPERTY LINK_FLAGS "/SUBSYSTEM:CONSOLE ${WIN_LINK_FLAGS}")
+endif()
+if (NOT BUILD_SHARED_LIBS)
+ target_include_directories (vol_connector
+ PRIVATE
+ ${CMAKE_Fortran_MODULE_DIRECTORY}/static
+ )
+ target_link_libraries (vol_connector
+ PRIVATE
+ ${HDF5_F90_LIB_TARGET} ${HDF5_F90_TEST_LIB_TARGET} ${HDF5_LIB_TARGET} $<$<PLATFORM_ID:Windows>:ws2_32.lib>
+ )
+ set_target_properties (vol_connector PROPERTIES
+ LINKER_LANGUAGE Fortran
+ FOLDER test/fortran
+ Fortran_MODULE_DIRECTORY ${CMAKE_Fortran_MODULE_DIRECTORY}/static
+ )
+ add_dependencies (vol_connector ${HDF5_F90_TEST_LIB_TARGET})
+else ()
+ target_include_directories (vol_connector
+ PRIVATE
+ ${CMAKE_Fortran_MODULE_DIRECTORY}/shared
+ )
+ target_link_libraries (vol_connector
+ PRIVATE
+ ${HDF5_F90_LIBSH_TARGET} ${HDF5_F90_TEST_LIBSH_TARGET} ${HDF5_LIBSH_TARGET} $<$<PLATFORM_ID:Windows>:ws2_32.lib>
+ )
+ set_target_properties (vol_connector PROPERTIES
LINKER_LANGUAGE Fortran
FOLDER test/fortran
Fortran_MODULE_DIRECTORY ${CMAKE_Fortran_MODULE_DIRECTORY}/shared
)
- add_dependencies (fflush2-shared ${HDF5_F90_TEST_LIBSH_TARGET})
+ add_dependencies (vol_connector ${HDF5_F90_TEST_LIBSH_TARGET})
endif ()
include (CMakeTests.cmake)
diff --git a/fortran/test/CMakeTests.cmake b/fortran/test/CMakeTests.cmake
index 2824ef7..20fb7e3 100644
--- a/fortran/test/CMakeTests.cmake
+++ b/fortran/test/CMakeTests.cmake
@@ -15,50 +15,51 @@
### T E S T I N G ###
##############################################################################
##############################################################################
-if (BUILD_SHARED_LIBS)
- file (MAKE_DIRECTORY "${PROJECT_BINARY_DIR}/fshared")
-endif ()
+
+set (test_CLEANFILES
+ a.h5
+ b.h5
+ c.h5
+ d.h5
+ dsetf_F03.h5
+ enum1.h5
+ extern_1a.raw
+ extern_2a.raw
+ extern_3a.raw
+ extern_4a.raw
+ extren_raw.raw
+ get_info.h5
+ nbit.h5
+ t_array_F03.h5
+ t_bit_F03.h5
+ t_controlchar_F03.h5
+ t_enum_F03.h5
+ t_objref_F03.h5
+ t_opaque_F03.h5
+ t_regref_F03.h5
+ t_string_F03.h5
+ t_vlen_F03.h5
+ t_vlstring_F03.h5
+ t_vlstringrw_F03.h5
+ tarray1.h5
+ tarray2.h5
+ tarray3.h5
+ test_create.h5
+ tget_file_image.h5
+ th5o_ref.h5
+ titerate.h5
+ vds.h5
+ visit.h5
+)
# Remove any output file left over from previous test run
add_test (
NAME FORTRAN_testhdf5-clear-objects
COMMAND ${CMAKE_COMMAND}
-E remove
- a.h5
- b.h5
- c.h5
- d.h5
- dsetf_F03.h5
- enum1.h5
- extern_1a.raw
- extern_2a.raw
- extern_3a.raw
- extern_4a.raw
- extren_raw.raw
- get_info.h5
- nbit.h5
- t_array_F03.h5
- t_bit_F03.h5
- t_controlchar_F03.h5
- t_enum_F03.h5
- t_objref_F03.h5
- t_opaque_F03.h5
- t_regref_F03.h5
- t_string_F03.h5
- t_vlen_F03.h5
- t_vlstring_F03.h5
- t_vlstringrw_F03.h5
- tarray1.h5
- tarray2.h5
- tarray3.h5
- test_create.h5
- tget_file_image.h5
- th5o_ref.h5
- titerate.h5
- vds.h5
- visit.h5
+ ${test_CLEANFILES}
)
-if (NOT "${last_test}" STREQUAL "")
+if (last_test)
set_tests_properties (FORTRAN_testhdf5-clear-objects PROPERTIES DEPENDS ${last_test})
endif ()
set (last_test "FORTRAN_testhdf5-clear-objects")
@@ -122,6 +123,24 @@ 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)
+#-- Adding test for vol_connector
+if (HDF5_ENABLE_USING_MEMCHECKER)
+ add_test (NAME FORTRAN_vol_connector COMMAND $<TARGET_FILE:vol_connector>)
+else ()
+ add_test (NAME FORTRAN_vol_connector COMMAND "${CMAKE_COMMAND}"
+ -D "TEST_PROGRAM=$<TARGET_FILE:vol_connector>"
+ -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=vol_connector.txt"
+ #-D "TEST_REFERENCE=vol_connector.out"
+ -D "TEST_FOLDER=${PROJECT_BINARY_DIR}"
+ -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake"
+ )
+endif ()
+
#-- Adding test for fflush1
add_test (NAME FORTRAN_fflush1 COMMAND $<TARGET_FILE:fflush1>)
set_tests_properties (FORTRAN_fflush1 PROPERTIES DEPENDS FORTRAN_testhdf5-clear-objects)
@@ -129,114 +148,3 @@ set_tests_properties (FORTRAN_fflush1 PROPERTIES DEPENDS FORTRAN_testhdf5-clear-
#-- Adding test for fflush2
add_test (NAME FORTRAN_fflush2 COMMAND $<TARGET_FILE:fflush2>)
set_tests_properties (FORTRAN_fflush2 PROPERTIES DEPENDS FORTRAN_fflush1)
-
-if (BUILD_SHARED_LIBS)
- add_test (
- NAME FORTRAN_testhdf5-shared-clear-objects
- COMMAND ${CMAKE_COMMAND}
- -E remove
- a.h5
- b.h5
- c.h5
- d.h5
- dsetf_F03.h5
- enum1.h5
- extern_1a.raw
- extern_2a.raw
- extern_3a.raw
- extern_4a.raw
- extren_raw.raw
- get_info.h5
- nbit.h5
- t_array_F03.h5
- t_bit_F03.h5
- t_controlchar_F03.h5
- t_enum_F03.h5
- t_objref_F03.h5
- t_opaque_F03.h5
- t_regref_F03.h5
- t_string_F03.h5
- t_vlen_F03.h5
- t_vlstring_F03.h5
- t_vlstringrw_F03.h5
- tarray1.h5
- tarray2.h5
- tarray3.h5
- test_create.h5
- tget_file_image.h5
- th5o_ref.h5
- titerate.h5
- vds.h5
- visit.h5
- WORKING_DIRECTORY
- ${PROJECT_BINARY_DIR}/fshared
- )
- set_tests_properties (FORTRAN_testhdf5-shared-clear-objects PROPERTIES DEPENDS FORTRAN_testhdf5-clear-objects)
-
- if (HDF5_ENABLE_USING_MEMCHECKER)
- add_test (NAME FORTRAN_testhdf5_fortran-shared COMMAND $<TARGET_FILE:testhdf5_fortran-shared>)
- else ()
- add_test (NAME FORTRAN_testhdf5_fortran-shared COMMAND "${CMAKE_COMMAND}"
- -D "TEST_PROGRAM=$<TARGET_FILE:testhdf5_fortran-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=testhdf5_fortran.txt"
- #-D "TEST_REFERENCE=testhdf5_fortran.out"
- -D "TEST_FOLDER=${PROJECT_BINARY_DIR}/fshared"
- -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake"
- )
- endif ()
-# set_tests_properties (FORTRAN_testhdf5_fortran-shared PROPERTIES PASS_REGULAR_EXPRESSION "[ ]*0 error.s")
- set_tests_properties (FORTRAN_testhdf5_fortran-shared PROPERTIES DEPENDS "FORTRAN_testhdf5_fortran;FORTRAN_testhdf5-shared-clear-objects")
-
- #-- Adding test for testhdf5_fortran_1_8
- if (HDF5_ENABLE_USING_MEMCHECKER)
- add_test (NAME FORTRAN_testhdf5_fortran_1_8-shared COMMAND $<TARGET_FILE:testhdf5_fortran_1_8-shared>)
- else ()
- add_test (NAME FORTRAN_testhdf5_fortran_1_8-shared COMMAND "${CMAKE_COMMAND}"
- -D "TEST_PROGRAM=$<TARGET_FILE:testhdf5_fortran_1_8-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=testhdf5_fortran_1_8.txt"
- #-D "TEST_REFERENCE=testhdf5_fortran_1_8.out"
- -D "TEST_FOLDER=${PROJECT_BINARY_DIR}/fshared"
- -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake"
- )
- endif ()
-# set_tests_properties (FORTRAN_testhdf5_fortran_1_8-shared PROPERTIES PASS_REGULAR_EXPRESSION "[ ]*0 error.s")
- 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_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>)
- set_tests_properties (FORTRAN_fflush1-shared PROPERTIES DEPENDS FORTRAN_fflush2)
-
- #-- Adding test for fflush2
- add_test (NAME FORTRAN_fflush2-shared COMMAND $<TARGET_FILE:fflush2-shared>)
- set_tests_properties (FORTRAN_fflush2-shared PROPERTIES DEPENDS FORTRAN_fflush1-shared)
-endif ()
diff --git a/fortran/test/Makefile.am b/fortran/test/Makefile.am
index 8613cf9..f0d7f03 100644
--- a/fortran/test/Makefile.am
+++ b/fortran/test/Makefile.am
@@ -35,7 +35,7 @@ else
endif
# Our main targets, the tests themselves
-TEST_PROG=fortranlib_test fflush1 fflush2 fortranlib_test_1_8 fortranlib_test_F03
+TEST_PROG=fortranlib_test fflush1 fflush2 fortranlib_test_1_8 fortranlib_test_F03 vol_connector
check_PROGRAMS=$(TEST_PROG)
@@ -50,6 +50,7 @@ fortranlib_test_1_8_SOURCES = tH5O.F90 tH5A_1_8.F90 tH5G_1_8.F90 tH5MISC_1_8.F90
fortranlib_test_F03_SOURCES = tH5E_F03.F90 tH5F_F03.F90 tH5L_F03.F90 \
tH5O_F03.F90 tH5P_F03.F90 tH5T_F03.F90 tHDF5_F03.F90 fortranlib_test_F03.F90
+vol_connector_SOURCES=vol_connector.F90
fflush1_SOURCES=fflush1.F90
fflush2_SOURCES=fflush2.F90
diff --git a/fortran/test/tH5F.F90 b/fortran/test/tH5F.F90
index 2501996..b898c21 100644
--- a/fortran/test/tH5F.F90
+++ b/fortran/test/tH5F.F90
@@ -105,6 +105,10 @@ CONTAINS
INTEGER(SIZE_T) :: obj_count
INTEGER(HID_T) :: t1, t2, t3, t4
+ ! File numbers
+ INTEGER :: file_num1
+ INTEGER :: file_num2
+
!
!data buffers
!
@@ -287,6 +291,18 @@ CONTAINS
IF(obj_count.NE.2)THEN
total_error = total_error + 1
ENDIF
+
+ !
+ !Check file numbers
+ !
+ CALL h5fget_fileno_f(file1_id, file_num1, error)
+ CALL check("h5fget_fileno_f",error,total_error)
+ CALL h5fget_fileno_f(file2_id, file_num2, error)
+ CALL check("h5fget_fileno_f",error,total_error)
+ IF(file_num1 .EQ. file_num2) THEN
+ write(*,*) "file numbers aren't supposed to match"
+ END IF
+
!
!mount the second file under the first file's "/G" group.
!
@@ -431,6 +447,8 @@ CONTAINS
INTEGER, DIMENSION(4,6) :: dset_data, data_out
INTEGER(HSIZE_T), DIMENSION(2) :: data_dims
INTEGER(HSIZE_T) :: file_size
+ INTEGER :: file_num1
+ INTEGER :: file_num2
CHARACTER(LEN=80) :: file_name
INTEGER(SIZE_T) :: name_size
@@ -499,6 +517,17 @@ CONTAINS
CALL check("h5fget_filesize_f",error,total_error)
!
+ !Check file numbers
+ !
+ CALL h5fget_fileno_f(file_id, file_num1, error)
+ CALL check("h5fget_fileno_f",error,total_error)
+ CALL h5fget_fileno_f(reopen_id, file_num2, error)
+ CALL check("h5fget_fileno_f",error,total_error)
+ IF(file_num1 .NE. file_num2) THEN
+ write(*,*) "file numbers don't match"
+ END IF
+
+ !
!Open the dataset based on the reopen_id.
!
CALL h5dopen_f(reopen_id, dsetname, dset_id, error)
diff --git a/fortran/test/tH5MISC_1_8.F90 b/fortran/test/tH5MISC_1_8.F90
index 79fbf3e..b8c777c 100644
--- a/fortran/test/tH5MISC_1_8.F90
+++ b/fortran/test/tH5MISC_1_8.F90
@@ -189,8 +189,9 @@ SUBROUTINE test_h5s_encode(total_error)
INTEGER(hid_t) :: sid1, sid3! Dataspace ID
INTEGER(hid_t) :: decoded_sid1, decoded_sid3
+ INTEGER(hid_t) :: fapl ! File access property
INTEGER :: rank ! LOGICAL rank of dataspace
- INTEGER(size_t) :: sbuf_size=0, scalar_size=0
+ INTEGER(size_t) :: new_size = 0, old_size = 0, orig_size=0, scalar_size=0
! Make sure the size is large
CHARACTER(LEN=288) :: sbuf
@@ -228,18 +229,36 @@ SUBROUTINE test_h5s_encode(total_error)
! Encode simple data space in a buffer
- ! First find the buffer size
- CALL H5Sencode_f(sid1, sbuf, sbuf_size, error)
- CALL check("H5Sencode", error, total_error)
+ ! Find the buffer size without fapl
+ CALL H5Sencode_f(sid1, sbuf, orig_size, error)
+ CALL check("H5Sencode_f", error, total_error)
+ CALL verify("H5Sencode_f", INT(orig_size), 279, total_error)
+
+ ! Create file access property list
+ CALL h5pcreate_f(H5P_FILE_ACCESS_F, fapl, error)
+ CALL check("h5pcreate_f", error, total_error)
+
+ ! Find the buffer size with fapl (default old format)
+ CALL H5Sencode_f(sid1, sbuf, old_size, error, fapl)
+ CALL check("H5Sencode_f", error, total_error)
+ CALL verify("H5Sencode_f", INT(old_size), 279, total_error)
+ ! Set fapl to latest file format
+ CALL H5Pset_libver_bounds_f(fapl, H5F_LIBVER_LATEST_F, H5F_LIBVER_LATEST_F, error)
+ CALL check("H5Pset_libver_bounds_f",error, total_error)
- ! Try decoding bogus buffer
+ ! Find the buffer size with fapl set to latest format
+ CALL H5Sencode_f(sid1, sbuf, new_size, error, fapl)
+ CALL check("H5Sencode_f", error, total_error)
+ CALL verify("H5Sencode_f", INT(new_size), 101, total_error)
+ ! Try decoding bogus buffer
CALL H5Sdecode_f(sbuf, decoded_sid1, error)
CALL verify("H5Sdecode", error, -1, total_error)
- CALL H5Sencode_f(sid1, sbuf, sbuf_size, error)
- CALL check("H5Sencode", error, total_error)
+ ! Encode according to the latest file format
+ CALL H5Sencode_f(sid1, sbuf, new_size, error, fapl)
+ CALL check("H5Sencode_f", error, total_error)
! Decode from the dataspace buffer and return an object handle
CALL H5Sdecode_f(sbuf, decoded_sid1, error)
diff --git a/fortran/test/tH5O_F03.F90 b/fortran/test/tH5O_F03.F90
index d1a9ddb..78b6453 100644
--- a/fortran/test/tH5O_F03.F90
+++ b/fortran/test/tH5O_F03.F90
@@ -270,8 +270,6 @@ CONTAINS
! 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
diff --git a/fortran/test/vol_connector.F90 b/fortran/test/vol_connector.F90
new file mode 100644
index 0000000..aabb2b8
--- /dev/null
+++ b/fortran/test/vol_connector.F90
@@ -0,0 +1,284 @@
+!****h* root/fortran/test/vol_connector.F90
+!
+! NAME
+! vol_connector.F90
+!
+! FUNCTION
+!
+! Tests basic Fortran VOL plugin operations (registration, etc.).
+! Uses the null VOL connector (built with the testing code)
+! which is loaded as a dynamic plugin.
+!
+! COPYRIGHT
+! * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+! 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. *
+! * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+!
+!*****
+
+MODULE VOL_TMOD
+
+ USE HDF5
+ USE TH5_MISC
+ USE TH5_MISC_GEN
+ IMPLICIT NONE
+
+ INTEGER, PARAMETER :: NATIVE_VOL_CONNECTOR_VALUE = 0
+ CHARACTER(LEN=180) :: NATIVE_VOL_CONNECTOR_NAME
+
+CONTAINS
+
+ !-------------------------------------------------------------------------
+ ! Function: test_registration_by_name()
+ !
+ ! Purpose: Tests if we can load, register, and close a VOL
+ ! connector by name.
+ !
+ !-------------------------------------------------------------------------
+ !
+
+ SUBROUTINE test_registration_by_name(total_error)
+
+ IMPLICIT NONE
+
+ INTEGER, INTENT(INOUT) :: total_error
+ INTEGER :: error = 0
+
+ LOGICAL :: is_registered = .FALSE.
+ INTEGER(hid_t) :: vol_id = 0, vol_id_out = 1
+ CHARACTER(LEN=64) :: name
+ CHARACTER(LEN=1) :: name_null
+ INTEGER(SIZE_T) :: name_len
+ INTEGER(hid_t) :: file_id
+
+ ! The null VOL connector should not be registered at the start of the test
+ CALL H5VLis_connector_registered_f( "FAKE_VOL_CONNECTOR_NAME", is_registered, error)
+ CALL check("H5VLis_connector_registered_f",error,total_error)
+ CALL VERIFY("H5VLis_connector_registered_f", is_registered, .FALSE., total_error)
+
+ ! Register the connector by name
+ CALL H5VLregister_connector_by_name_f(NATIVE_VOL_CONNECTOR_NAME, vol_id, error)
+ CALL check("H5VLregister_connector_by_name_f",error,total_error)
+
+ ! The connector should be registered now
+ CALL H5VLis_connector_registered_f(NATIVE_VOL_CONNECTOR_NAME, is_registered, error)
+ CALL check("H5VLis_connector_registered_f",error,total_error)
+ CALL VERIFY("H5VLis_connector_registered_f", is_registered, .TRUE., total_error)
+
+ CALL H5VLget_connector_id_f(NATIVE_VOL_CONNECTOR_NAME, vol_id_out, error)
+ CALL check("H5VLget_connector_id_f",error,total_error)
+
+ CALL H5Fcreate_f("voltest.h5",H5F_ACC_TRUNC_F, file_id, error)
+ CALL check("H5F_create_f",error,total_error)
+
+ CALL H5VLget_connector_name_f(file_id, name, error, name_len)
+ CALL check("H5VLget_connector_name_f",error,total_error)
+ CALL VERIFY("H5VLget_connector_name_f", INT(name_len), LEN_TRIM(NATIVE_VOL_CONNECTOR_NAME), total_error)
+
+ CALL H5VLget_connector_name_f(file_id, name, error)
+ CALL check("H5VLget_connector_name_f",error,total_error)
+ CALL VERIFY("H5VLget_connector_name_f", TRIM(name), NATIVE_VOL_CONNECTOR_NAME, total_error)
+
+ CALL H5VLget_connector_name_f(file_id, name_null, error, name_len)
+ CALL check("H5VLget_connector_name_f",error,total_error)
+ CALL VERIFY("H5VLget_connector_name_f", INT(name_len), LEN_TRIM(NATIVE_VOL_CONNECTOR_NAME), total_error)
+
+ CALL H5VLget_connector_name_f(file_id, name_null, error)
+ CALL check("H5VLget_connector_name_f",error,total_error)
+ CALL VERIFY("H5VLget_connector_name_f", name_null, NATIVE_VOL_CONNECTOR_NAME(1:1), total_error)
+
+ CALL H5Fclose_f(file_id, error)
+ CALL check("H5Fclose_f",error,total_error)
+
+ CALL H5VLclose_f(vol_id_out, error)
+ CALL check("H5VLclose_f",error, total_error)
+
+ END SUBROUTINE test_registration_by_name
+
+ !-------------------------------------------------------------------------
+ ! Function: test_registration_by_value()
+ !
+ ! Purpose: Tests if we can load, register, and close a VOL
+ ! connector by value.
+ !
+ !-------------------------------------------------------------------------
+
+ SUBROUTINE test_registration_by_value(total_error)
+
+ IMPLICIT NONE
+
+ INTEGER, INTENT(INOUT) :: total_error
+ INTEGER :: error = 0
+
+ LOGICAL :: is_registered = .FALSE.
+ INTEGER(hid_t) :: vol_id = 0
+
+
+ ! The null VOL connector should not be registered at the start of the test
+ CALL H5VLis_connector_registered_f( "FAKE_VOL_CONNECTOR_NAME", is_registered, error)
+ CALL check("H5VLis_connector_registered_f",error,total_error)
+ CALL VERIFY("H5VLis_connector_registered_f", is_registered, .FALSE., total_error)
+
+ ! Register the connector by value
+ CALL H5VLregister_connector_by_value_f(NATIVE_VOL_CONNECTOR_VALUE, vol_id, error)
+ CALL check("H5VLregister_connector_by_value_f", error, total_error)
+
+ ! The connector should be registered now
+ CALL H5VLis_connector_registered_f(NATIVE_VOL_CONNECTOR_NAME, is_registered, error)
+ CALL check("H5VLis_connector_registered_f",error,total_error)
+ CALL VERIFY("H5VLis_connector_registered_f", is_registered, .TRUE., total_error)
+
+ END SUBROUTINE test_registration_by_value
+
+
+ !-------------------------------------------------------------------------
+ ! Function: test_registration_by_name()
+ !
+ ! Purpose: Tests if we can load, register, and close a VOL
+ ! connector by name.
+ !
+ !-------------------------------------------------------------------------
+ !
+
+ SUBROUTINE test_registration_by_fapl(total_error)
+
+ IMPLICIT NONE
+
+ INTEGER, INTENT(INOUT) :: total_error
+ INTEGER :: error = 0
+
+ LOGICAL :: is_registered = .FALSE.
+ INTEGER(hid_t) :: vol_id = 0, vol_id_out = 1
+ INTEGER(hid_t) :: file_id
+ INTEGER(hid_t) :: fapl_id
+ TYPE(C_PTR) :: f_ptr
+
+ CALL H5VLis_connector_registered_f( "FAKE_VOL_CONNECTOR_NAME", is_registered, error)
+
+ CALL check("H5VLis_connector_registered_f",error,total_error)
+ CALL VERIFY("H5VLis_connector_registered_f", is_registered, .FALSE., total_error)
+
+ ! The null VOL connector should not be registered at the start of the test
+ CALL H5VLis_connector_registered_f( "FAKE_VOL_CONNECTOR_NAME", is_registered, error)
+ CALL check("H5VLis_connector_registered_f",error,total_error)
+ CALL VERIFY("H5VLis_connector_registered_f", is_registered, .FALSE., total_error)
+
+ CALL H5VLregister_connector_by_name_f(NATIVE_VOL_CONNECTOR_NAME, vol_id, error)
+ CALL check("H5VLregister_connector_by_name_f",error,total_error)
+
+ ! The connector should be registered now
+ CALL H5VLis_connector_registered_f(NATIVE_VOL_CONNECTOR_NAME, is_registered, error)
+ CALL check("H5VLis_connector_registered_f",error,total_error)
+ CALL VERIFY("H5VLis_connector_registered_f", is_registered, .TRUE., total_error)
+
+ ! Register the connector
+ CALL H5Pcreate_f(H5P_FILE_ACCESS_F, fapl_id, error)
+ CALL check("H5Pcreate_f",error,total_error)
+
+ IF(TRIM(NATIVE_VOL_CONNECTOR_NAME) .EQ. "native")THEN
+ CALL H5Pset_vol_f(fapl_id, vol_id, error)
+ CALL check("H5Pset_vol_f",error,total_error)
+
+ CALL H5Pget_vol_id_f(fapl_id, vol_id_out, error)
+ CALL check("H5Pget_vol_id_f",error,total_error)
+ CALL VERIFY("H5Pget_vol_id_f", vol_id_out, vol_id, total_error)
+
+ f_ptr = C_NULL_PTR
+ CALL H5Pset_vol_f(fapl_id, vol_id, error, f_ptr)
+ CALL check("H5Pset_vol_f",error,total_error)
+
+ CALL H5Pget_vol_id_f(fapl_id, vol_id_out, error)
+ CALL check("H5Pget_vol_id_f",error,total_error)
+ CALL VERIFY("H5Pget_vol_id_f", vol_id_out, vol_id, total_error)
+ ENDIF
+
+ CALL H5VLget_connector_id_f(NATIVE_VOL_CONNECTOR_NAME, vol_id_out, error)
+ CALL check("H5VLget_connector_id_f",error,total_error)
+ CALL VERIFY("H5VLget_connector_id_f", vol_id_out, vol_id, total_error)
+ CALL H5Fcreate_f("voltest.h5",H5F_ACC_TRUNC_F, file_id, error, H5P_DEFAULT_F, fapl_id)
+
+ CALL check("H5F_create_f",error,total_error)
+
+ CALL H5VLclose_f(vol_id_out, error)
+ CALL check("H5VLclose_f",error, total_error)
+
+ CALL H5VLclose_f(vol_id, error)
+ CALL check("H5VLclose_f",error, total_error)
+
+ CALL H5Fclose_f(file_id, error)
+ CALL check("H5Fclose_f",error,total_error)
+
+ CALL H5Pclose_f(fapl_id, error)
+ CALL check("H5Pclose_f",error,total_error)
+
+ END SUBROUTINE test_registration_by_fapl
+
+
+END MODULE VOL_TMOD
+
+
+PROGRAM vol_connector
+
+ USE HDF5
+ USE VOL_TMOD
+
+ IMPLICIT NONE
+ INTEGER :: total_error = 0
+ INTEGER :: error
+ INTEGER :: ret_total_error
+ LOGICAL :: cleanup, status
+ CHARACTER(LEN=12) :: VOL_CONNECTOR_ENV
+ INTEGER :: LEN = 0
+
+ CALL h5open_f(error)
+ cleanup = .TRUE.
+ CALL h5_env_nocleanup_f(status)
+ IF(status) cleanup=.FALSE.
+
+ WRITE(*,'(18X,A)') '=============================='
+ WRITE(*,'(24X,A)') 'FORTRAN VOL tests'
+ WRITE(*,'(18X,A)') '=============================='
+
+ WRITE(*,'(A)') "Testing VOL connector plugin functionality."
+
+ ! Check to see if the VOL connector was set with an env variable
+ CALL GET_ENVIRONMENT_VARIABLE("HDF5_VOL_CONNECTOR", VOL_CONNECTOR_ENV, LEN)
+ IF(LEN.NE.0)THEN
+ NATIVE_VOL_CONNECTOR_NAME = TRIM(VOL_CONNECTOR_ENV)
+ ELSE
+ NATIVE_VOL_CONNECTOR_NAME = "native"
+ ENDIF
+
+ ret_total_error = 0
+ CALL test_registration_by_name(ret_total_error)
+ CALL write_test_status(ret_total_error, ' Testing VOL registration by name', total_error)
+
+ ret_total_error = 0
+ CALL test_registration_by_value(ret_total_error)
+ CALL write_test_status(ret_total_error, ' Testing VOL registration by value', total_error)
+
+ ret_total_error = 0
+ CALL test_registration_by_fapl(ret_total_error)
+ CALL write_test_status(ret_total_error, ' Testing VOL registration by fapl', total_error)
+
+ WRITE(*, fmt = '(/18X,A)') '============================================'
+ WRITE(*, fmt = '(19X, A)', advance='NO') ' FORTRAN VOL tests completed with '
+ WRITE(*, fmt = '(I4)', advance='NO') total_error
+ WRITE(*, fmt = '(A)' ) ' error(s) ! '
+ WRITE(*,'(18X,A)') '============================================'
+
+ CALL h5close_f(error)
+
+ ! if errors detected, exit with non-zero code.
+ IF (total_error .NE. 0) CALL h5_exit_f(1)
+
+END PROGRAM vol_connector
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/hl/Makefile.am b/hl/Makefile.am
index aee1f86..ded7aa0 100644
--- a/hl/Makefile.am
+++ b/hl/Makefile.am
@@ -31,11 +31,27 @@ endif
if BUILD_CXX_CONDITIONAL
CXX_DIR = c++
endif
+if BUILD_TESTS_CONDITIONAL
+ TEST_DIR = test
+else
+ TEST_DIR =
+endif
+if BUILD_TOOLS_CONDITIONAL
+ TOOLS_DIR = tools
+else
+ TOOLS_DIR =
+endif
## Don't recurse into any subdirectories if HDF5 is not configured to
## use the HL library
if BUILD_HDF5_HL_CONDITIONAL
- SUBDIRS=src test tools $(CXX_DIR) $(FORTRAN_DIR)
+ SUBDIRS=src $(TEST_DIR) $(TOOLS_DIR) $(CXX_DIR) $(FORTRAN_DIR)
+
+# Test with just the native connector, with a single pass-through connector
+# and with a doubly-stacked pass-through.
+VOL_LIST = native "pass_through under_vol=0;under_info={}" \
+ "pass_through under_vol=505;under_info={under_vol=0;under_info={}}"
+
endif
DIST_SUBDIRS=src test tools c++ fortran examples
diff --git a/hl/c++/Makefile.am b/hl/c++/Makefile.am
index 1968bf5..f9ea328 100644
--- a/hl/c++/Makefile.am
+++ b/hl/c++/Makefile.am
@@ -18,7 +18,13 @@
include $(top_srcdir)/config/commence.am
-SUBDIRS=src test
+if BUILD_TESTS_CONDITIONAL
+ TESTSERIAL_DIR =test
+else
+ TESTSERIAL_DIR=
+endif
+
+SUBDIRS=src $(TESTSERIAL_DIR)
DIST_SUBDIRS=src test examples
# Install examples
diff --git a/hl/c++/examples/CMakeLists.txt b/hl/c++/examples/CMakeLists.txt
index 8e64239..50e08e8 100644
--- a/hl/c++/examples/CMakeLists.txt
+++ b/hl/c++/examples/CMakeLists.txt
@@ -5,13 +5,22 @@ project (HDF5_HL_CPP_EXAMPLES CXX)
# Add in the examples for the Packet Table codes
# --------------------------------------------------------------------
add_executable (ptExampleFL ${HDF5_HL_CPP_EXAMPLES_SOURCE_DIR}/ptExampleFL.cpp)
-target_include_directories(ptExampleFL PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>")
-TARGET_C_PROPERTIES (ptExampleFL STATIC)
-target_link_libraries (ptExampleFL PRIVATE
- ${HDF5_HL_CPP_LIB_TARGET}
- ${HDF5_HL_LIB_TARGET}
- ${HDF5_LIB_TARGET}
-)
+target_include_directories (ptExampleFL PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>")
+if (NOT BUILD_SHARED_LIBS)
+ TARGET_C_PROPERTIES (ptExampleFL STATIC)
+ target_link_libraries (ptExampleFL PRIVATE
+ ${HDF5_HL_CPP_LIB_TARGET}
+ ${HDF5_HL_LIB_TARGET}
+ ${HDF5_LIB_TARGET}
+ )
+else ()
+ TARGET_C_PROPERTIES (ptExampleFL SHARED)
+ target_link_libraries (ptExampleFL PRIVATE
+ ${HDF5_HL_CPP_LIBSH_TARGET}
+ ${HDF5_HL_LIBSH_TARGET}
+ ${HDF5_LIBSH_TARGET}
+ )
+endif ()
set_target_properties (ptExampleFL PROPERTIES FOLDER examples/hl/cpp)
if (BUILD_TESTING)
diff --git a/hl/c++/src/CMakeLists.txt b/hl/c++/src/CMakeLists.txt
index 77419c6..eb83d8c 100644
--- a/hl/c++/src/CMakeLists.txt
+++ b/hl/c++/src/CMakeLists.txt
@@ -8,21 +8,23 @@ project (HDF5_HL_CPP_SRC CXX)
set (HDF5_HL_CPP_SOURCES ${HDF5_HL_CPP_SRC_SOURCE_DIR}/H5PacketTable.cpp)
set (HDF5_HL_CPP_HDRS ${HDF5_HL_CPP_SRC_SOURCE_DIR}/H5PacketTable.h)
-add_library (${HDF5_HL_CPP_LIB_TARGET} STATIC ${HDF5_HL_CPP_SOURCES})
-target_include_directories(${HDF5_HL_CPP_LIB_TARGET}
- PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>"
- INTERFACE "$<INSTALL_INTERFACE:$<INSTALL_PREFIX>/include>"
-)
-TARGET_C_PROPERTIES (${HDF5_HL_CPP_LIB_TARGET} STATIC)
-target_link_libraries (${HDF5_HL_CPP_LIB_TARGET} PUBLIC ${HDF5_HL_LIB_TARGET} ${HDF5_LIB_TARGET})
-set_global_variable (HDF5_LIBRARIES_TO_EXPORT "${HDF5_LIBRARIES_TO_EXPORT};${HDF5_HL_CPP_LIB_TARGET}")
-H5_SET_LIB_OPTIONS (${HDF5_HL_CPP_LIB_TARGET} ${HDF5_HL_CPP_LIB_NAME} STATIC 0)
-set_target_properties (${HDF5_HL_CPP_LIB_TARGET} PROPERTIES FOLDER libraries/hl)
-set (install_targets ${HDF5_HL_CPP_LIB_TARGET})
+if (NOT ONLY_SHARED_LIBS)
+ add_library (${HDF5_HL_CPP_LIB_TARGET} STATIC ${HDF5_HL_CPP_SOURCES})
+ target_include_directories (${HDF5_HL_CPP_LIB_TARGET}
+ PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>"
+ INTERFACE "$<INSTALL_INTERFACE:$<INSTALL_PREFIX>/include>"
+ )
+ TARGET_C_PROPERTIES (${HDF5_HL_CPP_LIB_TARGET} STATIC)
+ target_link_libraries (${HDF5_HL_CPP_LIB_TARGET} PUBLIC ${HDF5_HL_LIB_TARGET} ${HDF5_LIB_TARGET})
+ set_global_variable (HDF5_LIBRARIES_TO_EXPORT "${HDF5_LIBRARIES_TO_EXPORT};${HDF5_HL_CPP_LIB_TARGET}")
+ H5_SET_LIB_OPTIONS (${HDF5_HL_CPP_LIB_TARGET} ${HDF5_HL_CPP_LIB_NAME} STATIC 0)
+ set_target_properties (${HDF5_HL_CPP_LIB_TARGET} PROPERTIES FOLDER libraries/hl)
+ set (install_targets ${HDF5_HL_CPP_LIB_TARGET})
+endif ()
if (BUILD_SHARED_LIBS)
add_library (${HDF5_HL_CPP_LIBSH_TARGET} SHARED ${HDF5_HL_CPP_SOURCES})
- target_include_directories(${HDF5_HL_CPP_LIBSH_TARGET}
+ target_include_directories (${HDF5_HL_CPP_LIBSH_TARGET}
PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>"
INTERFACE "$<INSTALL_INTERFACE:$<INSTALL_PREFIX>/include>"
)
@@ -56,7 +58,9 @@ if (HDF5_EXPORTED_TARGETS)
if (BUILD_SHARED_LIBS)
INSTALL_TARGET_PDB (${HDF5_HL_CPP_LIBSH_TARGET} ${HDF5_INSTALL_BIN_DIR} hlcpplibraries)
endif ()
- INSTALL_TARGET_PDB (${HDF5_HL_CPP_LIB_TARGET} ${HDF5_INSTALL_BIN_DIR} hlcpplibraries)
+ if (NOT ONLY_SHARED_LIBS)
+ INSTALL_TARGET_PDB (${HDF5_HL_CPP_LIB_TARGET} ${HDF5_INSTALL_BIN_DIR} hlcpplibraries)
+ endif ()
install (
TARGETS
@@ -83,7 +87,9 @@ set (_PKG_CONFIG_VERSION "${HDF5_PACKAGE_VERSION}")
set (_PKG_CONFIG_LIBS_PRIVATE)
-set (_PKG_CONFIG_LIBS "${_PKG_CONFIG_LIBS} -l${HDF5_HL_CPP_LIB_CORENAME}")
+if (NOT ONLY_SHARED_LIBS)
+ set (_PKG_CONFIG_LIBS "${_PKG_CONFIG_LIBS} -l${HDF5_HL_CPP_LIB_CORENAME}")
+endif ()
if (BUILD_SHARED_LIBS)
set (_PKG_CONFIG_SH_LIBS "${_PKG_CONFIG_SH_LIBS} -l${HDF5_HL_CPP_LIB_CORENAME}")
endif ()
diff --git a/hl/c++/test/CMakeLists.txt b/hl/c++/test/CMakeLists.txt
index 68c049c..cfb24a8 100644
--- a/hl/c++/test/CMakeLists.txt
+++ b/hl/c++/test/CMakeLists.txt
@@ -2,15 +2,26 @@ cmake_minimum_required (VERSION 3.10)
project (HDF5_HL_CPP_TEST CXX)
add_executable (hl_ptableTest ${HDF5_HL_CPP_TEST_SOURCE_DIR}/ptableTest.cpp)
-target_include_directories(hl_ptableTest PRIVATE "${HDF5_HL_SRC_DIR}/test;${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>")
-TARGET_C_PROPERTIES (hl_ptableTest STATIC)
-target_link_libraries (hl_ptableTest PRIVATE
- ${HDF5_LIB_TARGET}
- ${HDF5_TEST_LIB_TARGET}
- ${HDF5_CPP_LIB_TARGET}
- ${HDF5_HL_LIB_TARGET}
- ${HDF5_HL_CPP_LIB_TARGET}
-)
+target_include_directories (hl_ptableTest PRIVATE "${HDF5_HL_SRC_DIR}/test;${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>")
+if (NOT BUILD_SHARED_LIBS)
+ TARGET_C_PROPERTIES (hl_ptableTest STATIC)
+ target_link_libraries (hl_ptableTest PRIVATE
+ ${HDF5_LIB_TARGET}
+ ${HDF5_TEST_LIB_TARGET}
+ ${HDF5_CPP_LIB_TARGET}
+ ${HDF5_HL_LIB_TARGET}
+ ${HDF5_HL_CPP_LIB_TARGET}
+ )
+else ()
+ TARGET_C_PROPERTIES (hl_ptableTest SHARED)
+ target_link_libraries (hl_ptableTest PRIVATE
+ ${HDF5_LIBSH_TARGET}
+ ${HDF5_TEST_LIBSH_TARGET}
+ ${HDF5_CPP_LIBSH_TARGET}
+ ${HDF5_HL_LIBSH_TARGET}
+ ${HDF5_HL_CPP_LIBSH_TARGET}
+ )
+endif ()
set_target_properties (hl_ptableTest PROPERTIES FOLDER test/hl/cpp)
include (CMakeTests.cmake)
diff --git a/hl/examples/CMakeLists.txt b/hl/examples/CMakeLists.txt
index 97c6de5..86c1770 100644
--- a/hl/examples/CMakeLists.txt
+++ b/hl/examples/CMakeLists.txt
@@ -28,9 +28,14 @@ set (examples
foreach (example ${examples})
add_executable (hl_ex_${example} ${HDF5_HL_EXAMPLES_SOURCE_DIR}/${example}.c)
- target_include_directories(hl_ex_${example} PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>")
- TARGET_C_PROPERTIES (hl_ex_${example} STATIC)
- target_link_libraries (hl_ex_${example} PRIVATE ${HDF5_HL_LIB_TARGET} ${HDF5_LIB_TARGET})
+ target_include_directories (hl_ex_${example} PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>")
+ if (NOT BUILD_SHARED_LIBS)
+ TARGET_C_PROPERTIES (hl_ex_${example} STATIC)
+ target_link_libraries (hl_ex_${example} PRIVATE ${HDF5_HL_LIB_TARGET} ${HDF5_LIB_TARGET})
+ else ()
+ TARGET_C_PROPERTIES (hl_ex_${example} SHARED)
+ target_link_libraries (hl_ex_${example} PRIVATE ${HDF5_HL_LIBSH_TARGET} ${HDF5_LIBSH_TARGET})
+ endif ()
set_target_properties (hl_ex_${example} PROPERTIES FOLDER examples/hl)
endforeach ()
diff --git a/hl/examples/CMakeTests.cmake b/hl/examples/CMakeTests.cmake
index 166fa7c..c1fd6c2 100644
--- a/hl/examples/CMakeTests.cmake
+++ b/hl/examples/CMakeTests.cmake
@@ -51,7 +51,7 @@ add_custom_target(hl_ex_ex_ds1_files ALL COMMENT "Copying files needed by hl_ex_
ex_table_12.h5
ex_ds1.h5
)
- if (NOT "${last_test}" STREQUAL "")
+ if (last_test)
set_tests_properties (HL_ex-clear-objects PROPERTIES DEPENDS ${last_test})
endif ()
set (last_test "HL_ex-clear-objects")
@@ -71,7 +71,7 @@ foreach (example ${examples})
-P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake"
)
endif ()
- if (NOT "${last_test}" STREQUAL "")
+ if (last_test)
set_tests_properties (HL_ex_${example} PROPERTIES DEPENDS ${last_test})
endif ()
set (last_test "HL_ex_${example}")
diff --git a/hl/fortran/Makefile.am b/hl/fortran/Makefile.am
index ad18a21..7d24770 100644
--- a/hl/fortran/Makefile.am
+++ b/hl/fortran/Makefile.am
@@ -23,7 +23,13 @@
include $(top_srcdir)/config/commence.am
-SUBDIRS=src test
+if BUILD_TESTS_CONDITIONAL
+ TESTSERIAL_DIR =test
+else
+ TESTSERIAL_DIR=
+endif
+
+SUBDIRS=src $(TESTSERIAL_DIR)
DIST_SUBDIRS=src test examples
# Install examples
diff --git a/hl/fortran/examples/CMakeLists.txt b/hl/fortran/examples/CMakeLists.txt
index 27971b2..e41b8fe 100644
--- a/hl/fortran/examples/CMakeLists.txt
+++ b/hl/fortran/examples/CMakeLists.txt
@@ -8,18 +8,10 @@ set (examples
foreach (example ${examples})
add_executable (hl_f90_ex_${example} ${HDF5_HL_F90_EXAMPLES_SOURCE_DIR}/${example}.f90)
- target_include_directories (hl_f90_ex_${example}
- PRIVATE
- "${CMAKE_Fortran_MODULE_DIRECTORY}/static;${HDF5_F90_BINARY_DIR};${HDF5_F90_SRC_DIR}/src"
- )
target_compile_options(hl_f90_ex_${example}
PRIVATE
$<$<STREQUAL:"x${CMAKE_Fortran_SIMULATE_ID}","xMSVC">:${WIN_COMPILE_FLAGS}>
)
- target_link_libraries (hl_f90_ex_${example}
- PRIVATE
- ${HDF5_HL_F90_LIB_TARGET} ${HDF5_F90_LIB_TARGET} ${HDF5_LIB_TARGET}
- )
# set_property(TARGET hl_f90_ex_${example} APPEND PROPERTY
# LINK_FLAGS $<$<STREQUAL:"x${CMAKE_Fortran_SIMULATE_ID}","xMSVC">:"-SUBSYSTEM:CONSOLE">
# )
@@ -29,11 +21,35 @@ foreach (example ${examples})
if(MSVC)
set_property(TARGET hl_f90_ex_${example} PROPERTY LINK_FLAGS "/SUBSYSTEM:CONSOLE ${WIN_LINK_FLAGS}")
endif()
- set_target_properties (hl_f90_ex_${example} PROPERTIES
- LINKER_LANGUAGE Fortran
- FOLDER examples/hl/fortran
- Fortran_MODULE_DIRECTORY ${CMAKE_Fortran_MODULE_DIRECTORY}/static
- )
+ if (NOT BUILD_SHARED_LIBS)
+ target_include_directories (hl_f90_ex_${example}
+ PRIVATE
+ "${CMAKE_Fortran_MODULE_DIRECTORY}/static;${HDF5_F90_BINARY_DIR};${HDF5_F90_SRC_DIR}/src"
+ )
+ target_link_libraries (hl_f90_ex_${example}
+ PRIVATE
+ ${HDF5_HL_F90_LIB_TARGET} ${HDF5_F90_LIB_TARGET} ${HDF5_LIB_TARGET}
+ )
+ set_target_properties (hl_f90_ex_${example} PROPERTIES
+ LINKER_LANGUAGE Fortran
+ FOLDER examples/hl/fortran
+ Fortran_MODULE_DIRECTORY ${CMAKE_Fortran_MODULE_DIRECTORY}/static
+ )
+ else ()
+ target_include_directories (hl_f90_ex_${example}
+ PRIVATE
+ "${CMAKE_Fortran_MODULE_DIRECTORY}/shared;${HDF5_F90_BINARY_DIR};${HDF5_F90_SRC_DIR}/src"
+ )
+ target_link_libraries (hl_f90_ex_${example}
+ PRIVATE
+ ${HDF5_HL_F90_LIBSH_TARGET} ${HDF5_F90_LIBSH_TARGET} ${HDF5_LIBSH_TARGET}
+ )
+ set_target_properties (hl_f90_ex_${example} PROPERTIES
+ LINKER_LANGUAGE Fortran
+ FOLDER examples/hl/fortran
+ Fortran_MODULE_DIRECTORY ${CMAKE_Fortran_MODULE_DIRECTORY}/shared
+ )
+ endif ()
endforeach ()
if (BUILD_TESTING)
diff --git a/hl/fortran/src/CMakeLists.txt b/hl/fortran/src/CMakeLists.txt
index 7ec3b63..a684088 100644
--- a/hl/fortran/src/CMakeLists.txt
+++ b/hl/fortran/src/CMakeLists.txt
@@ -16,7 +16,7 @@ endif ()
#-----------------------------------------------------------------------------
add_executable (H5HL_buildiface ${HDF5_HL_F90_SRC_SOURCE_DIR}/H5HL_buildiface.F90 )
-target_include_directories(H5HL_buildiface PRIVATE "${HDF5_BINARY_DIR};${HDF5_F90_BINARY_DIR}")
+target_include_directories (H5HL_buildiface PRIVATE "${HDF5_BINARY_DIR};${HDF5_F90_BINARY_DIR}")
if (WIN32 AND MSVC)
if (BUILD_SHARED_LIBS)
set_target_properties (H5HL_buildiface PROPERTIES COMPILE_FLAGS "/MT")
@@ -37,8 +37,10 @@ if (BUILD_SHARED_LIBS)
file (MAKE_DIRECTORY "${HDF5_HL_F90_BINARY_DIR}/shared")
set (MODSH_BUILD_DIR ${CMAKE_Fortran_MODULE_DIRECTORY}/shared/${HDF_CFG_BUILD_TYPE})
endif ()
-file (MAKE_DIRECTORY "${HDF5_HL_F90_BINARY_DIR}/static")
-set (MOD_BUILD_DIR ${CMAKE_Fortran_MODULE_DIRECTORY}/static/${HDF_CFG_BUILD_TYPE})
+if (NOT ONLY_SHARED_LIBS)
+ file (MAKE_DIRECTORY "${HDF5_HL_F90_BINARY_DIR}/static")
+ set (MOD_BUILD_DIR ${CMAKE_Fortran_MODULE_DIRECTORY}/static/${HDF_CFG_BUILD_TYPE})
+endif ()
#-----------------------------------------------------------------------------
# hl_f90CStub lib
@@ -54,24 +56,25 @@ set_source_files_properties (${HDF5_HL_F90_C_SOURCES} PROPERTIES LANGUAGE C)
set (HDF5_HL_F90_HEADERS ${HDF5_HL_F90_SRC_SOURCE_DIR}/H5LTf90proto.h)
-add_library (${HDF5_HL_F90_C_LIB_TARGET} STATIC ${HDF5_HL_F90_C_SOURCES} ${HDF5_HL_F90_HEADERS})
-target_include_directories(${HDF5_HL_F90_C_LIB_TARGET}
- PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};${HDF5_F90_BINARY_DIR}/static;$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>"
- INTERFACE "$<INSTALL_INTERFACE:$<INSTALL_PREFIX>/include>"
-)
-TARGET_C_PROPERTIES (${HDF5_HL_F90_C_LIB_TARGET} STATIC)
-target_link_libraries (${HDF5_HL_F90_C_LIB_TARGET} PUBLIC ${HDF5_F90_C_LIB_TARGET} ${HDF5_HL_LIB_TARGET})
-set_global_variable (HDF5_LIBRARIES_TO_EXPORT "${HDF5_LIBRARIES_TO_EXPORT};${HDF5_HL_F90_C_LIB_TARGET}")
-H5_SET_LIB_OPTIONS (${HDF5_HL_F90_C_LIB_TARGET} ${HDF5_HL_F90_C_LIB_NAME} STATIC 0)
-set_target_properties (${HDF5_HL_F90_C_LIB_TARGET} PROPERTIES
- FOLDER libraries/hl/fortran
- LINKER_LANGUAGE C
-)
-set (install_targets ${HDF5_HL_F90_C_LIB_TARGET})
-
+if (NOT ONLY_SHARED_LIBS)
+ add_library (${HDF5_HL_F90_C_LIB_TARGET} STATIC ${HDF5_HL_F90_C_SOURCES} ${HDF5_HL_F90_HEADERS})
+ target_include_directories (${HDF5_HL_F90_C_LIB_TARGET}
+ PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};${HDF5_F90_BINARY_DIR}/static;$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>"
+ INTERFACE "$<INSTALL_INTERFACE:$<INSTALL_PREFIX>/include>"
+ )
+ TARGET_C_PROPERTIES (${HDF5_HL_F90_C_LIB_TARGET} STATIC)
+ target_link_libraries (${HDF5_HL_F90_C_LIB_TARGET} PUBLIC ${HDF5_F90_C_LIB_TARGET} ${HDF5_HL_LIB_TARGET})
+ set_global_variable (HDF5_LIBRARIES_TO_EXPORT "${HDF5_LIBRARIES_TO_EXPORT};${HDF5_HL_F90_C_LIB_TARGET}")
+ H5_SET_LIB_OPTIONS (${HDF5_HL_F90_C_LIB_TARGET} ${HDF5_HL_F90_C_LIB_NAME} STATIC 0)
+ set_target_properties (${HDF5_HL_F90_C_LIB_TARGET} PROPERTIES
+ FOLDER libraries/hl/fortran
+ LINKER_LANGUAGE C
+ )
+ set (install_targets ${HDF5_HL_F90_C_LIB_TARGET})
+endif ()
if (BUILD_SHARED_LIBS)
add_library (${HDF5_HL_F90_C_LIBSH_TARGET} SHARED ${HDF5_HL_F90_C_SOURCES} ${HDF5_HL_F90_HEADERS})
- target_include_directories(${HDF5_HL_F90_C_LIBSH_TARGET}
+ target_include_directories (${HDF5_HL_F90_C_LIBSH_TARGET}
PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};${HDF5_F90_BINARY_DIR}/shared;$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>"
INTERFACE "$<INSTALL_INTERFACE:$<INSTALL_PREFIX>/include>"
)
@@ -99,21 +102,23 @@ set (HDF5_HL_F90_F_BASE_SOURCES
${HDF5_HL_F90_SRC_SOURCE_DIR}/H5IMff.F90
)
-add_custom_command (
- OUTPUT ${HDF5_HL_F90_BINARY_DIR}/static/H5LTff_gen.F90 ${HDF5_HL_F90_BINARY_DIR}/static/H5TBff_gen.F90
- COMMAND $<TARGET_FILE:H5HL_buildiface>
- WORKING_DIRECTORY ${HDF5_HL_F90_BINARY_DIR}/static
- DEPENDS ${HDF5_HL_F90_F_BASE_SOURCES}
- COMMENT "Generating the H5LTff_gen.F90, H5TBff_gen.F90 files"
-)
-add_custom_target (H5HLgen ALL
- DEPENDS ${HDF5_HL_F90_BINARY_DIR}/static/H5LTff_gen.F90 ${HDF5_HL_F90_BINARY_DIR}/static/H5TBff_gen.F90
-)
-set_source_files_properties (
- ${HDF5_HL_F90_BINARY_DIR}/static/H5LTff_gen.F90
- ${HDF5_HL_F90_BINARY_DIR}/static/H5TBff_gen.F90
- PROPERTIES GENERATED TRUE
-)
+if (NOT ONLY_SHARED_LIBS)
+ add_custom_command (
+ OUTPUT ${HDF5_HL_F90_BINARY_DIR}/static/H5LTff_gen.F90 ${HDF5_HL_F90_BINARY_DIR}/static/H5TBff_gen.F90
+ COMMAND $<TARGET_FILE:H5HL_buildiface>
+ WORKING_DIRECTORY ${HDF5_HL_F90_BINARY_DIR}/static
+ DEPENDS ${HDF5_HL_F90_F_BASE_SOURCES}
+ COMMENT "Generating the H5LTff_gen.F90, H5TBff_gen.F90 files"
+ )
+ add_custom_target (H5HLgen ALL
+ DEPENDS ${HDF5_HL_F90_BINARY_DIR}/static/H5LTff_gen.F90 ${HDF5_HL_F90_BINARY_DIR}/static/H5TBff_gen.F90
+ )
+ set_source_files_properties (
+ ${HDF5_HL_F90_BINARY_DIR}/static/H5LTff_gen.F90
+ ${HDF5_HL_F90_BINARY_DIR}/static/H5TBff_gen.F90
+ PROPERTIES GENERATED TRUE
+ )
+endif ()
if (BUILD_SHARED_LIBS)
add_custom_command (
OUTPUT ${HDF5_HL_F90_BINARY_DIR}/shared/H5LTff_gen.F90 ${HDF5_HL_F90_BINARY_DIR}/shared/H5TBff_gen.F90
@@ -132,15 +137,16 @@ if (BUILD_SHARED_LIBS)
)
endif ()
-set (HDF5_HL_F90_F_SOURCES
- ${HDF5_HL_F90_F_BASE_SOURCES}
-
- # generated files
- ${HDF5_HL_F90_BINARY_DIR}/static/H5LTff_gen.F90
- ${HDF5_HL_F90_BINARY_DIR}/static/H5TBff_gen.F90
-)
-set_source_files_properties (${HDF5_HL_F90_F_SOURCES} PROPERTIES LANGUAGE Fortran)
+if (NOT ONLY_SHARED_LIBS)
+ set (HDF5_HL_F90_F_SOURCES
+ ${HDF5_HL_F90_F_BASE_SOURCES}
+ # generated files
+ ${HDF5_HL_F90_BINARY_DIR}/static/H5LTff_gen.F90
+ ${HDF5_HL_F90_BINARY_DIR}/static/H5TBff_gen.F90
+ )
+ set_source_files_properties (${HDF5_HL_F90_F_SOURCES} PROPERTIES LANGUAGE Fortran)
+endif ()
if (BUILD_SHARED_LIBS)
set (HDF5_HL_F90_F_SOURCES_SHARED
${HDF5_HL_F90_F_BASE_SOURCES}
@@ -152,42 +158,43 @@ if (BUILD_SHARED_LIBS)
set_source_files_properties (${HDF5_HL_F90_F_SOURCES_SHARED} PROPERTIES LANGUAGE Fortran)
endif ()
-add_library (${HDF5_HL_F90_LIB_TARGET} STATIC ${HDF5_HL_F90_F_SOURCES})
-target_include_directories (${HDF5_HL_F90_LIB_TARGET}
- PRIVATE
- "${HDF5_F90_BINARY_DIR};${CMAKE_Fortran_MODULE_DIRECTORY}/static;$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_Fortran_INCLUDE_DIRS}>"
- INTERFACE
- "$<INSTALL_INTERFACE:$<INSTALL_PREFIX>/include>"
-)
-target_compile_definitions(${HDF5_HL_F90_LIB_TARGET}
- PUBLIC
- $<$<STREQUAL:"x${CMAKE_Fortran_SIMULATE_ID}","xMSVC">:HDF5F90_WINDOWS>
- PRIVATE
- $<$<STREQUAL:"x${CMAKE_Fortran_SIMULATE_ID}","xMSVC">:${WIN_COMPILE_FLAGS}>
-)
-target_link_libraries (${HDF5_HL_F90_LIB_TARGET}
- PUBLIC
- ${HDF5_HL_F90_C_LIB_TARGET} ${HDF5_F90_LIB_TARGET}
-)
-#set_property(TARGET ${HDF5_HL_F90_LIB_TARGET} APPEND PROPERTY
-# LINK_FLAGS $<$<STREQUAL:"x${CMAKE_Fortran_SIMULATE_ID}","xMSVC">:"-SUBSYSTEM:CONSOLE">
-#)
-#set_property(TARGET ${HDF5_HL_F90_LIB_TARGET} APPEND PROPERTY
-# LINK_FLAGS $<$<STREQUAL:"x${CMAKE_Fortran_SIMULATE_ID}","xMSVC">:${WIN_LINK_FLAGS}>
-#)
-if(MSVC)
- set_property(TARGET ${HDF5_HL_F90_LIB_TARGET} PROPERTY LINK_FLAGS "/SUBSYSTEM:CONSOLE ${WIN_LINK_FLAGS}")
-endif()
-set_target_properties (${HDF5_HL_F90_LIB_TARGET} PROPERTIES
- FOLDER libraries/hl/fortran
- LINKER_LANGUAGE Fortran
- Fortran_MODULE_DIRECTORY ${CMAKE_Fortran_MODULE_DIRECTORY}/static
-)
-H5_SET_LIB_OPTIONS (${HDF5_HL_F90_LIB_TARGET} ${HDF5_HL_F90_LIB_NAME} STATIC 0)
-set_global_variable (HDF5_LIBRARIES_TO_EXPORT "${HDF5_LIBRARIES_TO_EXPORT};${HDF5_HL_F90_LIB_TARGET}")
-set (install_targets ${install_targets} ${HDF5_HL_F90_LIB_TARGET})
-add_dependencies(${HDF5_HL_F90_LIB_TARGET} H5HLgen)
-
+if (NOT ONLY_SHARED_LIBS)
+ add_library (${HDF5_HL_F90_LIB_TARGET} STATIC ${HDF5_HL_F90_F_SOURCES})
+ target_include_directories (${HDF5_HL_F90_LIB_TARGET}
+ PRIVATE
+ "${HDF5_F90_BINARY_DIR};${CMAKE_Fortran_MODULE_DIRECTORY}/static;$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_Fortran_INCLUDE_DIRS}>"
+ INTERFACE
+ "$<INSTALL_INTERFACE:$<INSTALL_PREFIX>/include>"
+ )
+ target_compile_definitions(${HDF5_HL_F90_LIB_TARGET}
+ PUBLIC
+ $<$<STREQUAL:"x${CMAKE_Fortran_SIMULATE_ID}","xMSVC">:HDF5F90_WINDOWS>
+ PRIVATE
+ $<$<STREQUAL:"x${CMAKE_Fortran_SIMULATE_ID}","xMSVC">:${WIN_COMPILE_FLAGS}>
+ )
+ target_link_libraries (${HDF5_HL_F90_LIB_TARGET}
+ PUBLIC
+ ${HDF5_HL_F90_C_LIB_TARGET} ${HDF5_F90_LIB_TARGET}
+ )
+# set_property(TARGET ${HDF5_HL_F90_LIB_TARGET} APPEND PROPERTY
+# LINK_FLAGS $<$<STREQUAL:"x${CMAKE_Fortran_SIMULATE_ID}","xMSVC">:"-SUBSYSTEM:CONSOLE">
+# )
+# set_property(TARGET ${HDF5_HL_F90_LIB_TARGET} APPEND PROPERTY
+# LINK_FLAGS $<$<STREQUAL:"x${CMAKE_Fortran_SIMULATE_ID}","xMSVC">:${WIN_LINK_FLAGS}>
+# )
+ if(MSVC)
+ set_property(TARGET ${HDF5_HL_F90_LIB_TARGET} PROPERTY LINK_FLAGS "/SUBSYSTEM:CONSOLE ${WIN_LINK_FLAGS}")
+ endif()
+ set_target_properties (${HDF5_HL_F90_LIB_TARGET} PROPERTIES
+ FOLDER libraries/hl/fortran
+ LINKER_LANGUAGE Fortran
+ Fortran_MODULE_DIRECTORY ${CMAKE_Fortran_MODULE_DIRECTORY}/static
+ )
+ H5_SET_LIB_OPTIONS (${HDF5_HL_F90_LIB_TARGET} ${HDF5_HL_F90_LIB_NAME} STATIC 0)
+ set_global_variable (HDF5_LIBRARIES_TO_EXPORT "${HDF5_LIBRARIES_TO_EXPORT};${HDF5_HL_F90_LIB_TARGET}")
+ set (install_targets ${install_targets} ${HDF5_HL_F90_LIB_TARGET})
+ add_dependencies(${HDF5_HL_F90_LIB_TARGET} H5HLgen)
+endif ()
if (BUILD_SHARED_LIBS)
add_library (${HDF5_HL_F90_LIBSH_TARGET} SHARED ${HDF5_HL_F90_F_SOURCES_SHARED})
target_include_directories (${HDF5_HL_F90_LIBSH_TARGET}
@@ -240,24 +247,25 @@ endif ()
#-----------------------------------------------------------------------------
-set (mod_files
- ${MOD_BUILD_DIR}/h5ds.mod
- ${MOD_BUILD_DIR}/h5tb.mod
- ${MOD_BUILD_DIR}/h5tb_const.mod
- ${MOD_BUILD_DIR}/h5lt.mod
- ${MOD_BUILD_DIR}/h5lt_const.mod
- ${MOD_BUILD_DIR}/h5im.mod
-)
-
-install (
- FILES
- ${mod_files}
- DESTINATION
- ${HDF5_INSTALL_INCLUDE_DIR}/static
- COMPONENT
- fortheaders
-)
+if (NOT ONLY_SHARED_LIBS)
+ set (mod_files
+ ${MOD_BUILD_DIR}/h5ds.mod
+ ${MOD_BUILD_DIR}/h5tb.mod
+ ${MOD_BUILD_DIR}/h5tb_const.mod
+ ${MOD_BUILD_DIR}/h5lt.mod
+ ${MOD_BUILD_DIR}/h5lt_const.mod
+ ${MOD_BUILD_DIR}/h5im.mod
+ )
+ install (
+ FILES
+ ${mod_files}
+ DESTINATION
+ ${HDF5_INSTALL_INCLUDE_DIR}/static
+ COMPONENT
+ fortheaders
+ )
+endif ()
if (BUILD_SHARED_LIBS)
set (modsh_files
${MODSH_BUILD_DIR}/h5ds.mod
@@ -285,8 +293,10 @@ if (HDF5_EXPORTED_TARGETS)
INSTALL_TARGET_PDB (${HDF5_HL_F90_C_LIBSH_TARGET} ${HDF5_INSTALL_BIN_DIR} hlfortlibraries)
#INSTALL_TARGET_PDB (${HDF5_HL_F90_LIBSH_TARGET} ${HDF5_INSTALL_BIN_DIR} hlfortlibraries)
endif ()
- INSTALL_TARGET_PDB (${HDF5_HL_F90_C_LIB_TARGET} ${HDF5_INSTALL_BIN_DIR} hlfortlibraries)
- #INSTALL_TARGET_PDB (${HDF5_HL_F90_LIB_TARGET} ${HDF5_INSTALL_BIN_DIR} hlfortlibraries)
+ if (NOT ONLY_SHARED_LIBS)
+ INSTALL_TARGET_PDB (${HDF5_HL_F90_C_LIB_TARGET} ${HDF5_INSTALL_BIN_DIR} hlfortlibraries)
+ #INSTALL_TARGET_PDB (${HDF5_HL_F90_LIB_TARGET} ${HDF5_INSTALL_BIN_DIR} hlfortlibraries)
+ endif ()
install (
TARGETS
diff --git a/hl/fortran/src/H5DSff.F90 b/hl/fortran/src/H5DSff.F90
index 2dca479..5488bb2 100644
--- a/hl/fortran/src/H5DSff.F90
+++ b/hl/fortran/src/H5DSff.F90
@@ -304,7 +304,7 @@ CONTAINS
IMPLICIT NONE
INTEGER(hid_t), INTENT(in) :: did ! The dataset
INTEGER , INTENT(in) :: idx ! The dimension
- CHARACTER(KIND=C_CHAR), DIMENSION(*), INTENT(in) :: label ! The label
+ CHARACTER(KIND=C_CHAR), DIMENSION(*), INTENT(in) :: label ! The label
INTEGER(SIZE_T), INTENT(in) :: label_len ! Length of label
END FUNCTION H5DSset_label_c
END INTERFACE
@@ -337,11 +337,11 @@ CONTAINS
IMPLICIT NONE
- INTEGER(hid_t), INTENT(in) :: did ! The dataget
- INTEGER , INTENT(in) :: idx ! The dimension
- CHARACTER(LEN=*), INTENT(in) :: label ! The label
- INTEGER(size_t) , INTENT(inout) :: size ! The length of the label buffer
- INTEGER :: errcode ! Error code
+ INTEGER(hid_t), INTENT(in) :: did ! The dataget
+ INTEGER , INTENT(in) :: idx ! The dimension
+ CHARACTER(LEN=*), INTENT(INOUT) :: label ! The label
+ INTEGER(size_t) , INTENT(INOUT) :: size ! The length of the label buffer
+ INTEGER :: errcode ! Error code
INTEGER :: c_idx
INTERFACE
@@ -352,7 +352,7 @@ CONTAINS
IMPLICIT NONE
INTEGER(hid_t), INTENT(in) :: did ! The dataget
INTEGER , INTENT(in) :: idx ! The dimension
- CHARACTER(KIND=C_CHAR), DIMENSION(*), INTENT(in) :: label ! The label
+ CHARACTER(KIND=C_CHAR), DIMENSION(*), INTENT(INOUT) :: label ! The label
INTEGER(SIZE_T), INTENT(inout) :: size ! Length of label
END FUNCTION H5DSget_label_c
END INTERFACE
@@ -386,8 +386,8 @@ CONTAINS
IMPLICIT NONE
INTEGER(hid_t), INTENT(in) :: did ! The dataget
- CHARACTER(LEN=*), INTENT(out) :: name ! The name
- INTEGER(size_t) , INTENT(inout) :: size ! The length of the name buffer
+ CHARACTER(LEN=*), INTENT(INOUT) :: name ! The name
+ INTEGER(size_t) , INTENT(INOUT) :: size ! The length of the name buffer
INTEGER :: errcode ! Error code
INTERFACE
@@ -397,7 +397,7 @@ CONTAINS
IMPORT :: HID_T, SIZE_T
IMPLICIT NONE
INTEGER(hid_t), INTENT(in) :: did ! The dataget
- CHARACTER(KIND=C_CHAR), DIMENSION(*), INTENT(out) :: name ! The name
+ CHARACTER(KIND=C_CHAR), DIMENSION(*), INTENT(INOUT) :: name ! The name
INTEGER(SIZE_T), INTENT(inout) :: size ! Length of name
END FUNCTION H5DSget_scale_name_c
END INTERFACE
@@ -426,10 +426,10 @@ CONTAINS
SUBROUTINE H5DSget_num_scales_f( did, idx, num_scales, errcode)
IMPLICIT NONE
- INTEGER(hid_t), INTENT(in) :: did ! the dataset
- INTEGER , INTENT(in) :: idx ! the dimension of did to query
- INTEGER , INTENT(out) :: num_scales ! the number of Dimension Scales associated with did
- INTEGER :: errcode ! error code
+ INTEGER(hid_t), INTENT(in) :: did ! the dataset
+ INTEGER , INTENT(in) :: idx ! the dimension of did to query
+ INTEGER , INTENT(INOUT) :: num_scales ! the number of Dimension Scales associated with did
+ INTEGER :: errcode ! error code
INTEGER :: c_idx
INTERFACE
@@ -437,9 +437,9 @@ CONTAINS
BIND(C,NAME='h5dsget_num_scales_c')
IMPORT :: HID_T
IMPLICIT NONE
- INTEGER(hid_t), INTENT(in) :: did ! the dataset
- INTEGER , INTENT(in) :: idx ! the dimension of did to query
- INTEGER , INTENT(out) :: num_scales ! the number of Dimension Scales associated with did
+ INTEGER(hid_t), INTENT(in) :: did ! the dataset
+ INTEGER , INTENT(in) :: idx ! the dimension of did to query
+ INTEGER , INTENT(INOUT) :: num_scales ! the number of Dimension Scales associated with did
END FUNCTION H5DSget_num_scales_c
END INTERFACE
diff --git a/hl/fortran/src/H5HL_buildiface.F90 b/hl/fortran/src/H5HL_buildiface.F90
index dda8d56..1c5d9c8 100644
--- a/hl/fortran/src/H5HL_buildiface.F90
+++ b/hl/fortran/src/H5HL_buildiface.F90
@@ -293,7 +293,7 @@ PROGRAM H5HL_buildiface
WRITE(11,'(A)') ' CHARACTER(LEN=*), INTENT(IN) :: dset_name'
WRITE(11,'(A)') ' INTEGER(hid_t), INTENT(in) :: type_id'
WRITE(11,'(A)') ' INTEGER(hsize_t), DIMENSION(*), INTENT(in) :: dims'
- WRITE(11,'(A)') ' REAL(KIND='//TRIM(ADJUSTL(chr2))//'),INTENT(IN)'//TRIM(rank_dim_line(j))//', TARGET :: buf'
+ WRITE(11,'(A)') ' REAL(KIND='//TRIM(ADJUSTL(chr2))//'),INTENT(INOUT)'//TRIM(rank_dim_line(j))//', TARGET :: buf'
WRITE(11,'(A)') ' INTEGER :: errcode '
WRITE(11,'(A)') ' TYPE(C_PTR) :: f_ptr'
WRITE(11,'(A)') ' INTEGER(size_t) :: namelen'
@@ -354,7 +354,7 @@ PROGRAM H5HL_buildiface
WRITE(11,'(A)') ' INTEGER(hid_t) , INTENT(IN) :: loc_id'
WRITE(11,'(A)') ' CHARACTER(LEN=*), INTENT(IN) :: dset_name'
WRITE(11,'(A)') ' INTEGER(hsize_t), DIMENSION(*), INTENT(in) :: dims'
- WRITE(11,'(A)') ' REAL(KIND='//TRIM(ADJUSTL(chr2))//'),INTENT(IN)'//TRIM(rank_dim_line(j))//', TARGET :: buf'
+ WRITE(11,'(A)') ' REAL(KIND='//TRIM(ADJUSTL(chr2))//'),INTENT(INOUT)'//TRIM(rank_dim_line(j))//', TARGET :: buf'
WRITE(11,'(A)') ' INTEGER :: errcode '
WRITE(11,'(A)') ' TYPE(C_PTR) :: f_ptr'
WRITE(11,'(A)') ' INTEGER(size_t) :: namelen'
@@ -414,7 +414,7 @@ PROGRAM H5HL_buildiface
WRITE(11,'(A)') ' INTEGER(hid_t) , INTENT(IN) :: loc_id'
WRITE(11,'(A)') ' CHARACTER(LEN=*), INTENT(IN) :: dset_name'
WRITE(11,'(A)') ' INTEGER(hsize_t), DIMENSION(*), INTENT(in) :: dims'
- WRITE(11,'(A)') ' REAL(KIND='//TRIM(ADJUSTL(chr2))//'),INTENT(IN)'//TRIM(rank_dim_line(j))//', TARGET :: buf'
+ WRITE(11,'(A)') ' REAL(KIND='//TRIM(ADJUSTL(chr2))//'),INTENT(INOUT)'//TRIM(rank_dim_line(j))//', TARGET :: buf'
WRITE(11,'(A)') ' INTEGER :: errcode '
WRITE(11,'(A)') ' TYPE(C_PTR) :: f_ptr'
WRITE(11,'(A)') ' INTEGER(size_t) :: namelen'
@@ -510,7 +510,7 @@ PROGRAM H5HL_buildiface
WRITE(11,'(A)') ' CHARACTER(LEN=*), INTENT(IN) :: dset_name'
WRITE(11,'(A)') ' INTEGER(hsize_t), DIMENSION(*), INTENT(in) :: dims'
WRITE(11,'(A)') ' INTEGER(hid_t), INTENT(in) :: type_id'
- WRITE(11,'(A)') ' INTEGER(KIND='//TRIM(ADJUSTL(chr2))//'),INTENT(IN)'//TRIM(rank_dim_line(j))//', TARGET :: buf'
+ WRITE(11,'(A)') ' INTEGER(KIND='//TRIM(ADJUSTL(chr2))//'),INTENT(INOUT)'//TRIM(rank_dim_line(j))//', TARGET :: buf'
WRITE(11,'(A)') ' INTEGER :: errcode '
WRITE(11,'(A)') ' TYPE(C_PTR) :: f_ptr'
WRITE(11,'(A)') ' INTEGER(size_t) :: namelen'
@@ -540,7 +540,7 @@ PROGRAM H5HL_buildiface
WRITE(11,'(A)') ' INTEGER(hid_t) , INTENT(IN) :: loc_id'
WRITE(11,'(A)') ' CHARACTER(LEN=*), INTENT(IN) :: dset_name'
WRITE(11,'(A)') ' INTEGER(hsize_t), DIMENSION(*), INTENT(in) :: dims'
- WRITE(11,'(A)') ' INTEGER(KIND='//TRIM(ADJUSTL(chr2))//'),INTENT(IN)'//TRIM(rank_dim_line(j))//', TARGET :: buf'
+ WRITE(11,'(A)') ' INTEGER(KIND='//TRIM(ADJUSTL(chr2))//'),INTENT(INOUT)'//TRIM(rank_dim_line(j))//', TARGET :: buf'
WRITE(11,'(A)') ' INTEGER :: errcode '
WRITE(11,'(A)') ' TYPE(C_PTR) :: f_ptr'
WRITE(11,'(A)') ' INTEGER(size_t) :: namelen'
@@ -712,7 +712,7 @@ PROGRAM H5HL_buildiface
WRITE(11,'(A)') ' INTEGER(hsize_t), INTENT(in) :: start'
WRITE(11,'(A)') ' INTEGER(hsize_t), INTENT(in) :: nrecords'
WRITE(11,'(A)') ' INTEGER(size_t), INTENT(in) :: type_size'
- WRITE(11,'(A)') ' REAL(KIND='//TRIM(ADJUSTL(chr2))//'),INTENT(IN), DIMENSION(*), TARGET :: buf'
+ WRITE(11,'(A)') ' REAL(KIND='//TRIM(ADJUSTL(chr2))//'),INTENT(INOUT), DIMENSION(*), TARGET :: buf'
WRITE(11,'(A)') ' INTEGER :: errcode '
WRITE(11,'(A)') ' INTEGER(size_t) :: namelen'
WRITE(11,'(A)') ' INTEGER(size_t) :: namelen1'
@@ -778,7 +778,7 @@ PROGRAM H5HL_buildiface
WRITE(11,'(A)') ' INTEGER(hsize_t), INTENT(in) :: start'
WRITE(11,'(A)') ' INTEGER(hsize_t), INTENT(in) :: nrecords'
WRITE(11,'(A)') ' INTEGER(size_t), INTENT(in) :: type_size'
- WRITE(11,'(A)') ' REAL(KIND='//TRIM(ADJUSTL(chr2))//'),INTENT(IN), DIMENSION(*), TARGET :: buf'
+ WRITE(11,'(A)') ' REAL(KIND='//TRIM(ADJUSTL(chr2))//'),INTENT(INOUT), DIMENSION(*), TARGET :: buf'
WRITE(11,'(A)') ' INTEGER :: errcode '
WRITE(11,'(A)') ' INTEGER(size_t) :: namelen'
WRITE(11,'(A)') ' TYPE(C_PTR) :: f_ptr'
@@ -809,7 +809,7 @@ PROGRAM H5HL_buildiface
WRITE(11,'(A)') ' CHARACTER(LEN=*), INTENT(in) :: field_name'
WRITE(11,'(A)') ' INTEGER(hid_t), INTENT(in) :: field_type'
WRITE(11,'(A)') ' INTEGER, INTENT(in) :: field_index'
- WRITE(11,'(A)') ' REAL(KIND='//TRIM(ADJUSTL(chr2))//'), INTENT(in), DIMENSION(*), TARGET :: buf'
+ WRITE(11,'(A)') ' REAL(KIND='//TRIM(ADJUSTL(chr2))//'), INTENT(IN), DIMENSION(*), TARGET :: buf'
WRITE(11,'(A)') ' INTEGER(size_t) :: namelen'
WRITE(11,'(A)') ' INTEGER(size_t) :: namelen1'
WRITE(11,'(A)') ' INTEGER :: errcode'
diff --git a/hl/fortran/src/H5IMff.F90 b/hl/fortran/src/H5IMff.F90
index 6646828..ac4b794 100644
--- a/hl/fortran/src/H5IMff.F90
+++ b/hl/fortran/src/H5IMff.F90
@@ -539,7 +539,7 @@ CONTAINS
INTEGER, INTENT(in) :: pal_number ! palette number
INTEGER(hsize_t), DIMENSION(*), INTENT(inout) :: dims ! dimensions
INTEGER :: errcode ! error code
- INTEGER(size_t) :: namelen ! name length
+ INTEGER(size_t) :: namelen ! name length
INTERFACE
INTEGER FUNCTION h5imget_palette_info_c(loc_id,namelen,dset_name,pal_number,dims) &
@@ -551,7 +551,7 @@ CONTAINS
CHARACTER(KIND=C_CHAR), DIMENSION(*), INTENT(in) :: dset_name ! name of the dataset
INTEGER, INTENT(in) :: pal_number ! palette number
INTEGER(hsize_t), DIMENSION(*), INTENT(inout) :: dims ! dimensions
- INTEGER(size_t) :: namelen ! name length
+ INTEGER(size_t) :: namelen ! name length
END FUNCTION h5imget_palette_info_c
END INTERFACE
diff --git a/hl/fortran/src/H5TBff.F90 b/hl/fortran/src/H5TBff.F90
index 2575b24..40adf95 100644
--- a/hl/fortran/src/H5TBff.F90
+++ b/hl/fortran/src/H5TBff.F90
@@ -532,7 +532,7 @@ CONTAINS
INTEGER(hsize_t), INTENT(in) :: start ! start record
INTEGER(hsize_t), INTENT(in) :: nrecords ! records
INTEGER(size_t), INTENT(in) :: type_size ! type size
- INTEGER, INTENT(in), DIMENSION(*), TARGET :: buf ! data buffer
+ INTEGER, INTENT(INOUT), DIMENSION(*), TARGET :: buf ! data buffer
INTEGER :: errcode ! error code
INTEGER(size_t) :: namelen ! name length
INTEGER(size_t) :: namelen1
@@ -564,7 +564,7 @@ CONTAINS
INTEGER(hsize_t), INTENT(in) :: start ! start record
INTEGER(hsize_t), INTENT(in) :: nrecords ! records
INTEGER(size_t), INTENT(in) :: type_size ! type size
- CHARACTER(LEN=*), INTENT(in), DIMENSION(*), TARGET :: buf ! data buffer
+ CHARACTER(LEN=*), INTENT(INOUT), DIMENSION(*), TARGET :: buf ! data buffer
INTEGER :: errcode ! error code
INTEGER(size_t) :: namelen ! name length
INTEGER(size_t) :: namelen1 ! name length
@@ -687,7 +687,7 @@ CONTAINS
INTEGER(hsize_t), INTENT(in) :: start ! start record
INTEGER(hsize_t), INTENT(in) :: nrecords ! records
INTEGER(size_t), INTENT(in) :: type_size ! type size
- INTEGER, INTENT(in), DIMENSION(*), TARGET :: buf ! data buffer
+ INTEGER, INTENT(INOUT), DIMENSION(*), TARGET :: buf ! data buffer
INTEGER :: errcode ! error code
INTEGER(size_t) :: namelen ! name length
TYPE(C_PTR) :: f_ptr
@@ -716,7 +716,7 @@ CONTAINS
INTEGER(hsize_t), INTENT(in) :: start ! start record
INTEGER(hsize_t), INTENT(in) :: nrecords ! records
INTEGER(size_t), INTENT(in) :: type_size ! type size
- CHARACTER(LEN=*), INTENT(in), DIMENSION(*), TARGET :: buf ! data buffer
+ CHARACTER(LEN=*), INTENT(INOUT), DIMENSION(*), TARGET :: buf ! data buffer
INTEGER :: errcode ! error code
INTEGER(size_t) :: namelen ! name length
TYPE(C_PTR) :: f_ptr
@@ -939,10 +939,10 @@ CONTAINS
INTEGER(size_t), DIMENSION(nfields), INTENT(inout) :: field_offsets ! field offsets
INTEGER(size_t), INTENT(inout):: type_size ! type size
INTEGER :: errcode ! error code
- INTEGER, OPTIONAL :: maxlen_out ! maximum character len of the field names
+ INTEGER(size_t), OPTIONAL :: maxlen_out ! maximum character len of the field names
INTEGER(size_t) :: namelen ! name length
INTEGER(size_t), DIMENSION(nfields) :: namelen2 ! name lengths
- INTEGER(hsize_t) :: i ! general purpose integer
+ INTEGER(hsize_t) :: i ! general purpose integer
INTEGER(size_t) :: maxlen
INTEGER(size_t) :: c_maxlen_out
diff --git a/hl/fortran/test/CMakeLists.txt b/hl/fortran/test/CMakeLists.txt
index 923989d..c152142 100644
--- a/hl/fortran/test/CMakeLists.txt
+++ b/hl/fortran/test/CMakeLists.txt
@@ -13,18 +13,10 @@ set (H5_TESTS
macro (ADD_H5_FORTRAN_EXE file)
add_executable (hl_f90_${file} ${file}.F90)
- target_include_directories (hl_f90_${file}
- PRIVATE
- "${CMAKE_Fortran_MODULE_DIRECTORY}/static;${HDF5_F90_BINARY_DIR};${HDF5_F90_SRC_DIR}/src"
- )
target_compile_options(hl_f90_${file}
PRIVATE
$<$<STREQUAL:"x${CMAKE_Fortran_SIMULATE_ID}","xMSVC">:${WIN_COMPILE_FLAGS}>
)
- target_link_libraries (hl_f90_${file}
- PRIVATE
- ${HDF5_HL_F90_LIB_TARGET} ${HDF5_F90_LIB_TARGET} ${HDF5_F90_TEST_LIB_TARGET}
- )
# set_property(TARGET hl_f90_${file} APPEND PROPERTY
# LINK_FLAGS $<$<STREQUAL:"x${CMAKE_Fortran_SIMULATE_ID}","xMSVC">:"-SUBSYSTEM:CONSOLE">
# )
@@ -34,35 +26,30 @@ macro (ADD_H5_FORTRAN_EXE file)
if(MSVC)
set_property(TARGET hl_f90_${file} PROPERTY LINK_FLAGS "/SUBSYSTEM:CONSOLE ${WIN_LINK_FLAGS}")
endif()
- set_target_properties (hl_f90_${file} PROPERTIES
- LINKER_LANGUAGE Fortran
- FOLDER test/hl/fortran
- Fortran_MODULE_DIRECTORY ${CMAKE_Fortran_MODULE_DIRECTORY}/static
- )
- if (BUILD_SHARED_LIBS)
- add_executable (hl_f90_${file}-shared ${file}.F90)
- target_include_directories (hl_f90_${file}-shared
+ if (NOT BUILD_SHARED_LIBS)
+ target_include_directories (hl_f90_${file}
PRIVATE
- "${CMAKE_Fortran_MODULE_DIRECTORY}/shared;${HDF5_F90_BINARY_DIR};${HDF5_F90_SRC_DIR}/src"
+ "${CMAKE_Fortran_MODULE_DIRECTORY}/static;${HDF5_F90_BINARY_DIR};${HDF5_F90_SRC_DIR}/src"
)
- target_compile_options(hl_f90_${file}-shared
+ target_link_libraries (hl_f90_${file}
PRIVATE
- $<$<STREQUAL:"x${CMAKE_Fortran_SIMULATE_ID}","xMSVC">:${WIN_COMPILE_FLAGS}>
+ ${HDF5_HL_F90_LIB_TARGET} ${HDF5_F90_LIB_TARGET} ${HDF5_F90_TEST_LIB_TARGET}
+ )
+ set_target_properties (hl_f90_${file} PROPERTIES
+ LINKER_LANGUAGE Fortran
+ FOLDER test/hl/fortran
+ Fortran_MODULE_DIRECTORY ${CMAKE_Fortran_MODULE_DIRECTORY}/static
+ )
+ else ()
+ target_include_directories (hl_f90_${file}
+ PRIVATE
+ "${CMAKE_Fortran_MODULE_DIRECTORY}/shared;${HDF5_F90_BINARY_DIR};${HDF5_F90_SRC_DIR}/src"
)
- target_link_libraries (hl_f90_${file}-shared
+ target_link_libraries (hl_f90_${file}
PRIVATE
${HDF5_HL_F90_LIBSH_TARGET} ${HDF5_F90_LIBSH_TARGET} ${HDF5_F90_TEST_LIBSH_TARGET}
)
-# set_property(TARGET hl_f90_${file}-shared APPEND PROPERTY
-# LINK_FLAGS $<$<STREQUAL:"x${CMAKE_Fortran_SIMULATE_ID}","xMSVC">:"-SUBSYSTEM:CONSOLE">
-# )
-# set_property(TARGET hl_f90_${file}-shared APPEND PROPERTY
-# LINK_FLAGS $<$<STREQUAL:"x${CMAKE_Fortran_SIMULATE_ID}","xMSVC">:${WIN_LINK_FLAGS}>
-# )
- if(MSVC)
- set_property(TARGET hl_f90_${file}-shared PROPERTY LINK_FLAGS "/SUBSYSTEM:CONSOLE ${WIN_LINK_FLAGS}")
- endif()
- set_target_properties (hl_f90_${file}-shared PROPERTIES
+ set_target_properties (hl_f90_${file} PROPERTIES
LINKER_LANGUAGE Fortran
FOLDER test/hl/fortran
Fortran_MODULE_DIRECTORY ${CMAKE_Fortran_MODULE_DIRECTORY}/shared
@@ -70,8 +57,8 @@ macro (ADD_H5_FORTRAN_EXE file)
endif ()
endmacro ()
-foreach (test ${H5_TESTS})
- ADD_H5_FORTRAN_EXE(${test})
+foreach (h5_test ${H5_TESTS})
+ ADD_H5_FORTRAN_EXE(${h5_test})
endforeach ()
include (CMakeTests.cmake)
diff --git a/hl/fortran/test/CMakeTests.cmake b/hl/fortran/test/CMakeTests.cmake
index 04a49dc..2137d1a 100644
--- a/hl/fortran/test/CMakeTests.cmake
+++ b/hl/fortran/test/CMakeTests.cmake
@@ -16,6 +16,18 @@
##############################################################################
##############################################################################
+set (test_CLEANFILES
+ dsetf1.h5
+ dsetf2.h5
+ dsetf3.h5
+ dsetf4.h5
+ dsetf5.h5
+ f1img.h5
+ f1tab.h5
+ f2tab.h5
+ tstds.h5
+)
+
macro (ADD_H5_FORTRAN_TEST file)
if (HDF5_ENABLE_USING_MEMCHECKER)
add_test (NAME HL_FORTRAN_f90_${file} COMMAND $<TARGET_FILE:hl_f90_${file}>)
@@ -32,61 +44,15 @@ macro (ADD_H5_FORTRAN_TEST file)
)
endif ()
set_tests_properties (HL_FORTRAN_f90_${file} PROPERTIES DEPENDS HL_FORTRAN_test-clear-objects)
- if (BUILD_SHARED_LIBS)
- if (HDF5_ENABLE_USING_MEMCHECKER)
- add_test (NAME HL_FORTRAN_f90_${file}-shared COMMAND $<TARGET_FILE:hl_f90_${file}-shared>)
- else ()
- add_test (NAME HL_FORTRAN_f90_${file}-shared COMMAND "${CMAKE_COMMAND}"
- -D "TEST_PROGRAM=$<TARGET_FILE:hl_f90_${file}-shared>"
- -D "TEST_ARGS:STRING="
- -D "TEST_EXPECT=0"
- -D "TEST_SKIP_COMPARE=TRUE"
- -D "TEST_OUTPUT=hl_f90_${file}-shared.txt"
- #-D "TEST_REFERENCE=hl_f90_${file}-shared.out"
- -D "TEST_FOLDER=${PROJECT_BINARY_DIR}"
- -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake"
- )
- endif ()
- set_tests_properties (HL_FORTRAN_f90_${file}-shared PROPERTIES DEPENDS HL_FORTRAN_test-shared-clear-objects)
- endif ()
endmacro ()
# Remove any output file left over from previous test run
add_test (
NAME HL_FORTRAN_test-clear-objects
COMMAND ${CMAKE_COMMAND}
- -E remove
- dsetf1.h5
- dsetf2.h5
- dsetf3.h5
- dsetf4.h5
- dsetf5.h5
- f1img.h5
- f1tab.h5
- f2tab.h5
- tstds.h5
+ -E remove ${test_CLEANFILES}
)
-if (BUILD_SHARED_LIBS)
- add_test (
- NAME HL_FORTRAN_test-shared-clear-objects
- COMMAND ${CMAKE_COMMAND}
- -E remove
- dsetf1.h5
- dsetf2.h5
- dsetf3.h5
- dsetf4.h5
- dsetf5.h5
- f1img.h5
- f1tab.h5
- f2tab.h5
- tstds.h5
- )
- set_tests_properties (HL_FORTRAN_test-shared-clear-objects
- PROPERTIES DEPENDS "HL_FORTRAN_f90_tsttable;HL_FORTRAN_f90_tstimage;HL_FORTRAN_f90_tstlite;HL_FORTRAN_f90_tstds"
- )
-endif ()
-
-foreach (test ${H5_TESTS})
- ADD_H5_FORTRAN_TEST(${test})
+foreach (h5_test ${H5_TESTS})
+ ADD_H5_FORTRAN_TEST(${h5_test})
endforeach ()
diff --git a/hl/fortran/test/tstimage.F90 b/hl/fortran/test/tstimage.F90
index d6bd1e2..8586e68 100644
--- a/hl/fortran/test/tstimage.F90
+++ b/hl/fortran/test/tstimage.F90
@@ -62,7 +62,7 @@ character(len=4), parameter :: dsetname2 = "img2" ! dataset name
character(len=15), parameter :: il ="INTERLACE_PIXEL"! dataset name
integer(hid_t) :: file_id ! file identifier
integer(hsize_t), parameter :: width = 500 ! width of image
-integer(hsize_t), parameter :: height = 200 ! height of image
+integer(hsize_t), parameter :: height = 270 ! height of image
integer, parameter :: pal_entries = 9 ! palette number of entries
integer, dimension(width*height) :: buf1 ! data buffer
integer, dimension(width*height) :: bufr1 ! data buffer
diff --git a/hl/fortran/test/tsttable.F90 b/hl/fortran/test/tsttable.F90
index 38cfa86..840d33d 100644
--- a/hl/fortran/test/tsttable.F90
+++ b/hl/fortran/test/tsttable.F90
@@ -93,7 +93,7 @@ SUBROUTINE test_table1()
INTEGER(SIZE_T), DIMENSION(1:nfields) :: field_offsetr ! field offset
INTEGER(SIZE_T), DIMENSION(1:nfields) :: field_sizesr ! field sizes
INTEGER(SIZE_T) :: type_sizeout = 0 ! size of the datatype
- INTEGER :: maxlen = 0 ! max chararter length of a field name
+ INTEGER(SIZE_T) :: maxlen = 0 ! max character length of a field name
INTEGER :: Cs_sizeof_double = H5_SIZEOF_DOUBLE ! C's sizeof double
INTEGER :: SIZEOF_X
LOGICAL :: Exclude_double
diff --git a/hl/src/CMakeLists.txt b/hl/src/CMakeLists.txt
index bf0f6ff..7125403 100644
--- a/hl/src/CMakeLists.txt
+++ b/hl/src/CMakeLists.txt
@@ -32,21 +32,23 @@ 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>"
-)
-TARGET_C_PROPERTIES (${HDF5_HL_LIB_TARGET} STATIC)
-target_link_libraries (${HDF5_HL_LIB_TARGET} PUBLIC ${HDF5_LIB_TARGET})
-H5_SET_LIB_OPTIONS (${HDF5_HL_LIB_TARGET} ${HDF5_HL_LIB_NAME} STATIC 0)
-set_target_properties (${HDF5_HL_LIB_TARGET} PROPERTIES FOLDER libraries/hl)
-set_global_variable (HDF5_LIBRARIES_TO_EXPORT "${HDF5_LIBRARIES_TO_EXPORT};${HDF5_HL_LIB_TARGET}")
-set (install_targets ${HDF5_HL_LIB_TARGET})
+if (NOT ONLY_SHARED_LIBS)
+ 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>"
+ )
+ TARGET_C_PROPERTIES (${HDF5_HL_LIB_TARGET} STATIC)
+ target_link_libraries (${HDF5_HL_LIB_TARGET} PUBLIC ${HDF5_LIB_TARGET})
+ H5_SET_LIB_OPTIONS (${HDF5_HL_LIB_TARGET} ${HDF5_HL_LIB_NAME} STATIC 0)
+ set_target_properties (${HDF5_HL_LIB_TARGET} PROPERTIES FOLDER libraries/hl)
+ set_global_variable (HDF5_LIBRARIES_TO_EXPORT "${HDF5_LIBRARIES_TO_EXPORT};${HDF5_HL_LIB_TARGET}")
+ set (install_targets ${HDF5_HL_LIB_TARGET})
+endif ()
if (BUILD_SHARED_LIBS)
add_library (${HDF5_HL_LIBSH_TARGET} SHARED ${HL_SOURCES} ${HL_HEADERS} ${HL_PRIVATE_HEADERS})
- target_include_directories(${HDF5_HL_LIBSH_TARGET}
+ 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>"
)
@@ -80,7 +82,9 @@ if (HDF5_EXPORTED_TARGETS)
if (BUILD_SHARED_LIBS)
INSTALL_TARGET_PDB (${HDF5_HL_LIBSH_TARGET} ${HDF5_INSTALL_BIN_DIR} hllibraries)
endif ()
- INSTALL_TARGET_PDB (${HDF5_HL_LIB_TARGET} ${HDF5_INSTALL_BIN_DIR} hllibraries)
+ if (NOT ONLY_SHARED_LIBS)
+ INSTALL_TARGET_PDB (${HDF5_HL_LIB_TARGET} ${HDF5_INSTALL_BIN_DIR} hllibraries)
+ endif ()
install (
TARGETS
@@ -107,7 +111,9 @@ set (_PKG_CONFIG_VERSION "${HDF5_PACKAGE_VERSION}")
set (_PKG_CONFIG_LIBS_PRIVATE)
-set (_PKG_CONFIG_LIBS "${_PKG_CONFIG_LIBS} -l${HDF5_HL_LIB_CORENAME}")
+if (NOT ONLY_SHARED_LIBS)
+ set (_PKG_CONFIG_LIBS "${_PKG_CONFIG_LIBS} -l${HDF5_HL_LIB_CORENAME}")
+endif ()
if (BUILD_SHARED_LIBS)
set (_PKG_CONFIG_SH_LIBS "${_PKG_CONFIG_SH_LIBS} -l${HDF5_HL_LIB_CORENAME}")
endif ()
diff --git a/hl/src/H5LDprivate.h b/hl/src/H5LDprivate.h
index b52928b..203bcea 100644
--- a/hl/src/H5LDprivate.h
+++ b/hl/src/H5LDprivate.h
@@ -19,9 +19,9 @@
#include "H5LDpublic.h"
/* Store information for a field in <list_of_fields> for a compound data type */
-/*
+/*
* Note: This data structure is used by both H5LD.c and hl/tools/h5watch
- * This declaration is repeated in tools/lib/h5tools_str.c
+ * This declaration is repeated in tools/lib/h5tools_str.c
*/
typedef struct H5LD_memb_t {
size_t tot_offset;
@@ -30,7 +30,10 @@ typedef struct H5LD_memb_t {
char **names;
} H5LD_memb_t;
-/*
+#ifdef __cplusplus
+extern "C" {
+#endif
+/*
* Note that these two private routines are called by hl/tools/h5watch.
* Have considered the following options:
* 1) Repeat the coding in both H5LD.c and h5watch
@@ -40,8 +43,12 @@ typedef struct H5LD_memb_t {
* #2: these two routines are too specific to be made as public routines
* Decide to do #3 at this point of time after some discussion.
*/
-void H5LD_clean_vector(H5LD_memb_t *listv[]);
-int H5LD_construct_vector(char *fields, H5LD_memb_t *listv[], hid_t par_tid);
+H5_HLDLL void H5LD_clean_vector(H5LD_memb_t *listv[]);
+H5_HLDLL int H5LD_construct_vector(char *fields, H5LD_memb_t *listv[], hid_t par_tid);
+
+#ifdef __cplusplus
+}
+#endif
#endif /* end _H5LDprivate_H */
diff --git a/hl/src/H5LT.c b/hl/src/H5LT.c
index 0074d02..3ebca95 100644
--- a/hl/src/H5LT.c
+++ b/hl/src/H5LT.c
@@ -2264,7 +2264,7 @@ out:
*-------------------------------------------------------------------------
*/
static char*
-realloc_and_append(hbool_t _no_user_buf, size_t *len, char *buf, char *str_to_add)
+realloc_and_append(hbool_t _no_user_buf, size_t *len, char *buf, const char *str_to_add)
{
size_t size_str_to_add, size_str;
@@ -2360,7 +2360,6 @@ print_enum(hid_t type, char* str, size_t *str_len, hbool_t no_ubuf, size_t indt)
{
char **name = NULL; /*member names */
unsigned char *value = NULL; /*value array */
- unsigned char *copy = NULL; /*a pointer to value array */
int nmembs; /*number of members */
char tmp_str[TMP_LEN];
int nchars; /*number of output characters */
@@ -2418,17 +2417,15 @@ print_enum(hid_t type, char* str, size_t *str_len, hbool_t no_ubuf, size_t indt)
nchars = HDsnprintf(tmp_str, TMP_LEN, "\"%s\"", name[i]);
if(!(str = realloc_and_append(no_ubuf, str_len, str, tmp_str)))
goto out;
- HDsnprintf(tmp_str, TMP_LEN, "%*s ", MAX(0, 16 - nchars), "");
+ HDmemset(tmp_str, ' ', (size_t)MAX(3, 19 - nchars) + 1);
+ tmp_str[MAX(3, 19 - nchars)] = '\0';
if(!(str = realloc_and_append(no_ubuf, str_len, str, tmp_str)))
goto out;
- /*On SGI Altix(cobalt), wrong values were printed out with "value+i*dst_size"
- *strangely, unless use another pointer "copy".*/
- copy = value + (size_t)i * dst_size;
if (H5T_SGN_NONE == H5Tget_sign(native))
- HDsnprintf(tmp_str, TMP_LEN, "%u", *((unsigned int*)((void *)copy)));
+ HDsnprintf(tmp_str, TMP_LEN, "%u", *((unsigned int*)(value + (size_t)i * dst_size)));
else
- HDsnprintf(tmp_str, TMP_LEN, "%d", *((int*)((void *)copy)));
+ HDsnprintf(tmp_str, TMP_LEN, "%d", *((int*)(value + (size_t)i * dst_size)));
if(!(str = realloc_and_append(no_ubuf, str_len, str, tmp_str)))
goto out;
@@ -2450,8 +2447,12 @@ print_enum(hid_t type, char* str, size_t *str_len, hbool_t no_ubuf, size_t indt)
out:
if(0 == nmembs) {
- HDsnprintf(tmp_str, TMP_LEN, "\n%*s <empty>", (int)(indt + 4), "");
+ str = realloc_and_append(no_ubuf, str_len, str, "\n");
+ HDassert((indt + 4) < TMP_LEN);
+ HDmemset(tmp_str, ' ', (indt + 4) + 1);
+ tmp_str[(indt + 4)] = '\0';
str = realloc_and_append(no_ubuf, str_len, str, tmp_str);
+ str = realloc_and_append(no_ubuf, str_len, str, " <empty>");
} /* end if */
/* Release resources */
diff --git a/hl/test/CMakeLists.txt b/hl/test/CMakeLists.txt
index 238b5e1..2959c6c 100644
--- a/hl/test/CMakeLists.txt
+++ b/hl/test/CMakeLists.txt
@@ -17,29 +17,26 @@ configure_file (${HDF5_HL_TEST_SOURCE_DIR}/H5srcdir_str.h.in H5srcdir_str.h @ON
# --------------------------------------------------------------------
# Macro used to add a unit test
# --------------------------------------------------------------------
-MACRO (HL_ADD_EXE hl_name)
+macro (HL_ADD_EXE hl_name)
add_executable (hl_${hl_name} ${hl_name}.c)
- target_include_directories(hl_${hl_name} PRIVATE "${HDF5_TEST_SRC_DIR};${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>")
- TARGET_C_PROPERTIES (hl_${hl_name} STATIC)
- target_link_libraries (hl_${hl_name} PRIVATE
- ${HDF5_HL_LIB_TARGET}
- ${HDF5_TEST_LIB_TARGET}
- ${HDF5_LIB_TARGET}
- )
- set_target_properties (hl_${hl_name} PROPERTIES FOLDER test/hl)
-ENDMACRO ()
-
-MACRO (HL_ADD_SHEXE hl_name)
- add_executable (hl_${hl_name} ${hl_name}.c)
- target_include_directories(hl_${hl_name} PRIVATE "${HDF5_TEST_SRC_DIR};${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>")
- TARGET_C_PROPERTIES (hl_${hl_name} SHARED)
- target_link_libraries (hl_${hl_name} PRIVATE
- ${HDF5_HL_LIBSH_TARGET}
- ${HDF5_TEST_LIBSH_TARGET}
- ${HDF5_LIBSH_TARGET}
- )
+ target_include_directories (hl_${hl_name} PRIVATE "${HDF5_TEST_SRC_DIR};${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>")
+ if (NOT BUILD_SHARED_LIBS)
+ TARGET_C_PROPERTIES (hl_${hl_name} STATIC)
+ target_link_libraries (hl_${hl_name} PRIVATE
+ ${HDF5_HL_LIB_TARGET}
+ ${HDF5_TEST_LIB_TARGET}
+ ${HDF5_LIB_TARGET}
+ )
+ else ()
+ TARGET_C_PROPERTIES (hl_${hl_name} SHARED)
+ target_link_libraries (hl_${hl_name} PRIVATE
+ ${HDF5_HL_LIBSH_TARGET}
+ ${HDF5_TEST_LIBSH_TARGET}
+ ${HDF5_LIBSH_TARGET}
+ )
+ endif ()
set_target_properties (hl_${hl_name} PROPERTIES FOLDER test/hl)
-ENDMACRO ()
+endmacro ()
HL_ADD_EXE (test_lite)
HL_ADD_EXE (test_image)
@@ -52,22 +49,31 @@ HL_ADD_EXE (test_h5do_compat)
# test_packet has two source files
add_executable (hl_test_packet test_packet.c test_packet_vlen.c)
-target_include_directories(hl_test_packet PRIVATE "${HDF5_TEST_SRC_DIR};${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>")
-TARGET_C_PROPERTIES (hl_test_packet STATIC)
-target_link_libraries (hl_test_packet PRIVATE
- ${HDF5_HL_LIB_TARGET}
- ${HDF5_TEST_LIB_TARGET}
- ${HDF5_LIB_TARGET}
-)
+target_include_directories (hl_test_packet PRIVATE "${HDF5_TEST_SRC_DIR};${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>")
+if (NOT BUILD_SHARED_LIBS)
+ TARGET_C_PROPERTIES (hl_test_packet STATIC)
+ target_link_libraries (hl_test_packet PRIVATE
+ ${HDF5_HL_LIB_TARGET}
+ ${HDF5_TEST_LIB_TARGET}
+ ${HDF5_LIB_TARGET}
+ )
+else ()
+ TARGET_C_PROPERTIES (hl_test_packet SHARED)
+ target_link_libraries (hl_test_packet PRIVATE
+ ${HDF5_HL_LIBSH_TARGET}
+ ${HDF5_TEST_LIBSH_TARGET}
+ ${HDF5_LIBSH_TARGET}
+ )
+endif ()
set_target_properties (hl_test_packet PROPERTIES FOLDER test/hl)
# --------------------------------------------------------------------
# This executable is used to generate test files for the test_ds test.
# It should only be run during development when new test files are needed
# --------------------------------------------------------------------
-if (HDF5_BUILD_GENERATORS)
+if (HDF5_BUILD_GENERATORS AND NOT ONLY_SHARED_LIBS)
add_executable (hl_gen_test_ds gen_test_ds.c)
- target_include_directories(hl_gen_test_ds PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>")
+ target_include_directories (hl_gen_test_ds PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>")
TARGET_C_PROPERTIES (hl_gen_test_ds STATIC)
target_link_libraries (hl_gen_test_ds PRIVATE
${HDF5_HL_LIB_TARGET}
@@ -77,7 +83,7 @@ if (HDF5_BUILD_GENERATORS)
set_target_properties (hl_gen_test_ds PROPERTIES FOLDER test/hl/gen)
add_executable (hl_gen_test_ld gen_test_ld.c)
- target_include_directories(hl_gen_test_ld PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>")
+ target_include_directories (hl_gen_test_ld PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>")
TARGET_C_PROPERTIES (hl_gen_test_ld STATIC)
target_link_libraries (hl_gen_test_ld PRIVATE
${HDF5_HL_LIB_TARGET}
diff --git a/hl/test/CMakeTests.cmake b/hl/test/CMakeTests.cmake
index 4e945bc..477a165 100644
--- a/hl/test/CMakeTests.cmake
+++ b/hl/test/CMakeTests.cmake
@@ -61,7 +61,7 @@ macro (HL_ADD_TEST hl_name)
-P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake"
)
endif ()
- if (NOT "${last_test}" STREQUAL "")
+ if (last_test)
set_tests_properties (HL_${hl_name} PROPERTIES DEPENDS ${last_test}
ENVIRONMENT "srcdir=${HDF5_HL_TEST_BINARY_DIR}"
WORKING_DIRECTORY ${HDF5_HL_TEST_BINARY_DIR}
@@ -104,7 +104,7 @@ add_test (
testfl_packet_table_vlen.h5
test_table.h5
)
-if (NOT "${last_test}" STREQUAL "")
+if (last_test)
set_tests_properties (HL_test-clear-objects PROPERTIES DEPENDS ${last_test})
endif ()
set (last_test "HL_test-clear-objects")
diff --git a/hl/test/test_ds.c b/hl/test/test_ds.c
index 95178fc..d7af9e9 100644
--- a/hl/test/test_ds.c
+++ b/hl/test/test_ds.c
@@ -1138,7 +1138,7 @@ static int test_detachscales(void)
int rank3 = 3;
hsize_t dims[] = {1,2,3}; /*some bogus numbers, not important for the test*/
int *buf = NULL;
- char dname[10];
+ char dname[16];
int i;
/* This tests creates two three dimensional datasets; then it creates
diff --git a/hl/tools/gif2h5/CMakeLists.txt b/hl/tools/gif2h5/CMakeLists.txt
index a27ab18..14a5f5f 100644
--- a/hl/tools/gif2h5/CMakeLists.txt
+++ b/hl/tools/gif2h5/CMakeLists.txt
@@ -14,24 +14,58 @@ set (GIF2H5_SOURCES
)
#-- Add gif2hdf5 program
-add_executable (gif2h5 ${GIF2H5_SOURCES})
-target_include_directories(gif2h5 PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>")
-TARGET_C_PROPERTIES (gif2h5 STATIC)
-target_link_libraries (gif2h5 PRIVATE ${HDF5_HL_LIB_TARGET} ${HDF5_LIB_TARGET} ${HDF5_TOOLS_LIB_TARGET})
-set_target_properties (gif2h5 PROPERTIES FOLDER tools/hl)
-set_global_variable (HDF5_UTILS_TO_EXPORT "${HDF5_UTILS_TO_EXPORT};gif2h5")
+if (NOT ONLY_SHARED_LIBS)
+ add_executable (gif2h5 ${GIF2H5_SOURCES})
+ target_include_directories (gif2h5 PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>")
+ TARGET_C_PROPERTIES (gif2h5 STATIC)
+ target_link_libraries (gif2h5 PRIVATE ${HDF5_HL_LIB_TARGET} ${HDF5_LIB_TARGET} ${HDF5_TOOLS_LIB_TARGET})
+ set_target_properties (gif2h5 PROPERTIES FOLDER tools/hl)
+ set_global_variable (HDF5_UTILS_TO_EXPORT "${HDF5_UTILS_TO_EXPORT};gif2h5")
+ set (H5_DEP_EXECUTABLES
+ gif2h5
+ )
+endif ()
+
+if (BUILD_SHARED_LIBS)
+ add_executable (gif2h5-shared ${GIF2H5_SOURCES})
+ target_include_directories (gif2h5-shared PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>")
+ TARGET_C_PROPERTIES (gif2h5-shared SHARED)
+ target_link_libraries (gif2h5-shared PRIVATE ${HDF5_HL_LIBSH_TARGET} ${HDF5_LIBSH_TARGET} ${HDF5_TOOLS_LIBSH_TARGET})
+ set_target_properties (gif2h5-shared PROPERTIES FOLDER tools/hl)
+ set_global_variable (HDF5_UTILS_TO_EXPORT "${HDF5_UTILS_TO_EXPORT};gif2h5-shared")
+ set (H5_DEP_EXECUTABLES ${H5_DEP_EXECUTABLES}
+ gif2h5-shared
+ )
+endif ()
#-- Add h52gif program
set (hdf2gif_SOURCES
${HDF5_HL_TOOLS_GIF2H5_SOURCE_DIR}/hdf2gif.c
${HDF5_HL_TOOLS_GIF2H5_SOURCE_DIR}/hdfgifwr.c
)
-add_executable (h52gif ${hdf2gif_SOURCES})
-target_include_directories(h52gif PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>")
-TARGET_C_PROPERTIES (h52gif STATIC)
-target_link_libraries (h52gif PRIVATE ${HDF5_HL_LIB_TARGET} ${HDF5_LIB_TARGET} ${HDF5_TOOLS_LIB_TARGET})
-set_target_properties (h52gif PROPERTIES FOLDER tools/hl)
-set_global_variable (HDF5_UTILS_TO_EXPORT "${HDF5_UTILS_TO_EXPORT};h52gif")
+if (NOT ONLY_SHARED_LIBS)
+ add_executable (h52gif ${hdf2gif_SOURCES})
+ target_include_directories (h52gif PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>")
+ TARGET_C_PROPERTIES (h52gif STATIC)
+ target_link_libraries (h52gif PRIVATE ${HDF5_HL_LIB_TARGET} ${HDF5_LIB_TARGET} ${HDF5_TOOLS_LIB_TARGET})
+ set_target_properties (h52gif PROPERTIES FOLDER tools/hl)
+ set_global_variable (HDF5_UTILS_TO_EXPORT "${HDF5_UTILS_TO_EXPORT};h52gif")
+ set (H5_DEP_EXECUTABLES ${H5_DEP_EXECUTABLES}
+ h52gif
+ )
+endif ()
+
+if (BUILD_SHARED_LIBS)
+ add_executable (h52gif-shared ${hdf2gif_SOURCES})
+ target_include_directories (h52gif-shared PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>")
+ TARGET_C_PROPERTIES (h52gif-shared SHARED)
+ target_link_libraries (h52gif-shared PRIVATE ${HDF5_HL_LIBSH_TARGET} PRIVATE ${HDF5_LIBSH_TARGET} ${HDF5_TOOLS_LIBSH_TARGET})
+ set_target_properties (h52gif-shared PROPERTIES FOLDER tools/hl)
+ set_global_variable (HDF5_UTILS_TO_EXPORT "${HDF5_UTILS_TO_EXPORT};h52gif-shared")
+ set (H5_DEP_EXECUTABLES ${H5_DEP_EXECUTABLES}
+ h52gif-shared
+ )
+endif ()
if (BUILD_TESTING)
# --------------------------------------------------------------------
@@ -39,9 +73,9 @@ if (BUILD_TESTING)
# used in the CMake Build system as we rely on the test files that are
# shipped with HDF5 source archives
# --------------------------------------------------------------------
- if (HDF5_BUILD_GENERATORS)
+ if (HDF5_BUILD_GENERATORS AND NOT ONLY_SHARED_LIBS)
add_executable (hl_h52gifgentest ${HDF5_HL_TOOLS_GIF2H5_SOURCE_DIR}/h52gifgentst.c)
- target_include_directories(hl_h52gifgentest PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>")
+ target_include_directories (hl_h52gifgentest PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>")
TARGET_C_PROPERTIES (hl_h52gifgentest STATIC)
target_link_libraries (hl_h52gifgentest PRIVATE ${HDF5_HL_LIB_TARGET} ${HDF5_LIB_TARGET})
set_target_properties (hl_h52gifgentest PROPERTIES FOLDER generator/tools/hl)
@@ -58,8 +92,7 @@ endif ()
if (HDF5_EXPORTED_TARGETS)
install (
TARGETS
- gif2h5
- h52gif
+ ${H5_DEP_EXECUTABLES}
EXPORT
${HDF5_EXPORTED_TARGETS}
RUNTIME DESTINATION ${HDF5_INSTALL_BIN_DIR} COMPONENT hltoolsapplications
diff --git a/hl/tools/gif2h5/CMakeTests.cmake b/hl/tools/gif2h5/CMakeTests.cmake
index 61c004e..1cc989c 100644
--- a/hl/tools/gif2h5/CMakeTests.cmake
+++ b/hl/tools/gif2h5/CMakeTests.cmake
@@ -27,6 +27,12 @@ HDFTEST_COPY_FILE("${HDF5_HL_TOOLS_GIF2H5_SOURCE_DIR}/testfiles/h52giftst.h5" "$
HDFTEST_COPY_FILE("${HDF5_HL_TOOLS_GIF2H5_SOURCE_DIR}/testfiles/ex_image2.h5" "${PROJECT_BINARY_DIR}/testfiles/ex_image2.h5" "gif2h5_files")
add_custom_target(gif2h5_files ALL COMMENT "Copying files needed by gif2h5 tests" DEPENDS ${gif2h5_files_list})
+if (NOT BUILD_SHARED_LIBS)
+ set (tgt_ext "")
+else ()
+ set (tgt_ext "-shared")
+endif ()
+
# Remove any output file left over from previous test run
add_test (
NAME HL_TOOLS-clear-objects
@@ -38,19 +44,19 @@ add_test (
image24.gif
)
-add_test (NAME HL_TOOLS_gif2h5 COMMAND $<TARGET_FILE:gif2h5> testfiles/image1.gif image1.h5)
+add_test (NAME HL_TOOLS_gif2h5 COMMAND $<TARGET_FILE:gif2h5${tgt_ext}> testfiles/image1.gif image1.h5)
set_tests_properties (HL_TOOLS_gif2h5 PROPERTIES DEPENDS HL_TOOLS-clear-objects)
-add_test (NAME HL_TOOLS_h52gif COMMAND $<TARGET_FILE:h52gif> testfiles/h52giftst.h5 image1.gif -i image)
+add_test (NAME HL_TOOLS_h52gif COMMAND $<TARGET_FILE:h52gif${tgt_ext}> testfiles/h52giftst.h5 image1.gif -i image)
set_tests_properties (HL_TOOLS_h52gif PROPERTIES DEPENDS HL_TOOLS-clear-objects)
-add_test (NAME HL_TOOLS_h52gif_none COMMAND $<TARGET_FILE:h52gif> testfiles/h52giftst.h5 image.gif -i nosuch_image)
+add_test (NAME HL_TOOLS_h52gif_none COMMAND $<TARGET_FILE:h52gif${tgt_ext}> testfiles/h52giftst.h5 image.gif -i nosuch_image)
set_tests_properties (HL_TOOLS_h52gif_none PROPERTIES WILL_FAIL "true")
set_tests_properties (HL_TOOLS_h52gif_none PROPERTIES DEPENDS HL_TOOLS-clear-objects)
-#add_test (NAME HL_TOOLS_h52gifpal COMMAND $<TARGET_FILE:h52gif> testfiles/h52giftst.h5 image.gif -i palette)
+#add_test (NAME HL_TOOLS_h52gifpal COMMAND $<TARGET_FILE:h52gif${tgt_ext}> testfiles/h52giftst.h5 image.gif -i palette)
#set_tests_properties (HL_TOOLS_h52gifpal PROPERTIES WILL_FAIL "true")
-add_test (NAME HL_TOOLS_h52gif24bits COMMAND $<TARGET_FILE:h52gif> testfiles/ex_image2.h5 image24.gif -i image24bitpixel)
+add_test (NAME HL_TOOLS_h52gif24bits COMMAND $<TARGET_FILE:h52gif${tgt_ext}> testfiles/ex_image2.h5 image24.gif -i image24bitpixel)
set_tests_properties (HL_TOOLS_h52gif24bits PROPERTIES WILL_FAIL "true")
set_tests_properties (HL_TOOLS_h52gif24bits PROPERTIES DEPENDS HL_TOOLS-clear-objects)
diff --git a/hl/tools/gif2h5/Makefile.am b/hl/tools/gif2h5/Makefile.am
index d30d66a..9ffde58 100644
--- a/hl/tools/gif2h5/Makefile.am
+++ b/hl/tools/gif2h5/Makefile.am
@@ -23,11 +23,7 @@ AM_CPPFLAGS+=-I$(top_srcdir)/src -I$(top_srcdir)/tools/lib -I$(top_srcdir)/hl/sr
# These are our main targets, the tools
-TEST_SCRIPT=h52giftest.sh
-check_SCRIPTS=$(TEST_SCRIPT)
-
bin_PROGRAMS=gif2h5 h52gif
-noinst_PROGRAMS=h52gifgentst
# Add h52gif and gif2h5 specific linker flags here
h52gif_LDFLAGS = $(LT_STATIC_EXEC) $(AM_LDFLAGS)
@@ -37,12 +33,18 @@ gif2h5_SOURCES=gif2hdf.c gif2mem.c decompress.c gifread.c writehdf.c
h52gif_SOURCES=hdf2gif.c hdfgifwr.c
-h52gifgentst_SOURCES=h52gifgentst.c
# Programs all depend on the hdf5 library, the tools library, and the HL
# library.
LDADD=$(LIBH5_HL) $(LIBH5TOOLS) $(LIBHDF5)
+if BUILD_TESTS_CONDITIONAL
+ TEST_SCRIPT=h52giftest.sh
+ check_SCRIPTS=$(TEST_SCRIPT)
+ noinst_PROGRAMS=h52gifgentst
+ h52gifgentst_SOURCES=h52gifgentst.c
+endif
+
CHECK_CLEANFILES+=*.h5
CHECK_CLEANFILES+=*.gif
diff --git a/hl/tools/h5watch/CMakeLists.txt b/hl/tools/h5watch/CMakeLists.txt
index 1d1c341..b3d65f7 100644
--- a/hl/tools/h5watch/CMakeLists.txt
+++ b/hl/tools/h5watch/CMakeLists.txt
@@ -9,11 +9,22 @@ set (H5WATCH_SOURCES
)
#-- Add h5watch program
-add_executable (h5watch ${H5WATCH_SOURCES})
-target_include_directories(h5watch PRIVATE "${HDF5_TOOLS_DIR}/lib;${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>")
-TARGET_C_PROPERTIES (h5watch STATIC)
-target_link_libraries (h5watch PRIVATE ${HDF5_HL_LIB_TARGET} ${HDF5_LIB_TARGET} ${HDF5_TOOLS_LIB_TARGET})
-set_target_properties (h5watch PROPERTIES FOLDER tools/hl)
+if (NOT ONLY_SHARED_LIBS)
+ add_executable (h5watch ${H5WATCH_SOURCES})
+ target_include_directories (h5watch PRIVATE "${HDF5_TOOLS_DIR}/lib;${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>")
+ TARGET_C_PROPERTIES (h5watch STATIC)
+ target_link_libraries (h5watch PRIVATE ${HDF5_HL_LIB_TARGET} ${HDF5_LIB_TARGET} ${HDF5_TOOLS_LIB_TARGET})
+ set_target_properties (h5watch PROPERTIES FOLDER tools/hl)
+ set (H5_DEP_EXECUTABLES h5watch)
+endif ()
+if (BUILD_SHARED_LIBS)
+ add_executable (h5watch-shared ${H5WATCH_SOURCES})
+ target_include_directories (h5watch-shared PRIVATE "${HDF5_TOOLS_DIR}/lib;${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>")
+ TARGET_C_PROPERTIES (h5watch-shared SHARED)
+ target_link_libraries (h5watch-shared PRIVATE ${HDF5_HL_LIBSH_TARGET} ${HDF5_LIBSH_TARGET} ${HDF5_TOOLS_LIBSH_TARGET})
+ set_target_properties (h5watch-shared PROPERTIES FOLDER tools/hl)
+ set (H5_DEP_EXECUTABLES ${H5_DEP_EXECUTABLES} h5watch-shared)
+endif ()
if (BUILD_TESTING)
#-- Add swmr_check_compat_vfd program
@@ -21,9 +32,14 @@ if (BUILD_TESTING)
${HDF5_HL_TOOLS_H5WATCH_SOURCE_DIR}/swmr_check_compat_vfd.c
)
add_executable (hl_swmr_check_compat_vfd ${hl_swmr_check_compat_vfd_SOURCES})
- target_include_directories(hl_swmr_check_compat_vfd PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>")
- TARGET_C_PROPERTIES (hl_swmr_check_compat_vfd STATIC)
- target_link_libraries (hl_swmr_check_compat_vfd PRIVATE ${HDF5_LIB_TARGET})
+ target_include_directories (hl_swmr_check_compat_vfd PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>")
+ if (NOT ONLY_SHARED_LIBS)
+ TARGET_C_PROPERTIES (hl_swmr_check_compat_vfd STATIC)
+ target_link_libraries (hl_swmr_check_compat_vfd PRIVATE ${HDF5_LIB_TARGET})
+ else ()
+ TARGET_C_PROPERTIES (hl_swmr_check_compat_vfd SHARED)
+ target_link_libraries (hl_swmr_check_compat_vfd PRIVATE ${HDF5_LIBSH_TARGET})
+ endif ()
set_target_properties (hl_swmr_check_compat_vfd PROPERTIES FOLDER tools/hl)
#-- Add extend_dset program
@@ -31,15 +47,25 @@ if (BUILD_TESTING)
${HDF5_HL_TOOLS_H5WATCH_SOURCE_DIR}/extend_dset.c
)
add_executable (extend_dset ${extend_dset_SOURCES})
- target_include_directories(extend_dset PRIVATE "${HDF5_HL_SRC_DIR}/test;${HDF5_HL_SRC_DIR}/src;${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>")
- TARGET_C_PROPERTIES (extend_dset STATIC)
- target_link_libraries (extend_dset PRIVATE ${HDF5_HL_LIB_TARGET} ${HDF5_TEST_LIB_TARGET} ${HDF5_LIB_TARGET} ${HDF5_TOOLS_LIB_TARGET})
+ target_include_directories (extend_dset PRIVATE "${HDF5_HL_SRC_DIR}/test;${HDF5_HL_SRC_DIR}/src;${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>")
+ if (NOT ONLY_SHARED_LIBS)
+ TARGET_C_PROPERTIES (extend_dset STATIC)
+ target_link_libraries (extend_dset PRIVATE ${HDF5_HL_LIB_TARGET} ${HDF5_TEST_LIB_TARGET} ${HDF5_LIB_TARGET} ${HDF5_TOOLS_LIB_TARGET})
+ else ()
+ TARGET_C_PROPERTIES (extend_dset SHARED)
+ target_link_libraries (extend_dset PRIVATE ${HDF5_HL_LIBSH_TARGET} ${HDF5_TEST_LIBSH_TARGET} ${HDF5_LIBSH_TARGET} ${HDF5_TOOLS_LIBSH_TARGET})
+ endif ()
set_target_properties (extend_dset PROPERTIES FOLDER tools/hl)
add_executable (h5watchgentest ${HDF5_HL_TOOLS_H5WATCH_SOURCE_DIR}/h5watchgentest.c)
- target_include_directories(h5watchgentest PRIVATE "${HDF5_HL_SRC_DIR}/src;${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>")
- TARGET_C_PROPERTIES (h5watchgentest STATIC)
- target_link_libraries (h5watchgentest PRIVATE ${HDF5_HL_LIB_TARGET} ${HDF5_LIB_TARGET})
+ target_include_directories (h5watchgentest PRIVATE "${HDF5_HL_SRC_DIR}/src;${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>")
+ if (NOT ONLY_SHARED_LIBS)
+ TARGET_C_PROPERTIES (h5watchgentest STATIC)
+ target_link_libraries (h5watchgentest PRIVATE ${HDF5_HL_LIB_TARGET} ${HDF5_LIB_TARGET})
+ else ()
+ TARGET_C_PROPERTIES (h5watchgentest SHARED)
+ target_link_libraries (h5watchgentest PRIVATE ${HDF5_HL_LIBSH_TARGET} ${HDF5_LIBSH_TARGET})
+ endif ()
set_target_properties (h5watchgentest PROPERTIES FOLDER generator/tools/hl)
include (CMakeTests.cmake)
@@ -51,7 +77,7 @@ endif ()
if (HDF5_EXPORTED_TARGETS)
install (
TARGETS
- h5watch
+ ${H5_DEP_EXECUTABLES}
EXPORT
${HDF5_EXPORTED_TARGETS}
RUNTIME DESTINATION ${HDF5_INSTALL_BIN_DIR} COMPONENT hltoolsapplications
diff --git a/hl/tools/h5watch/CMakeTests.cmake b/hl/tools/h5watch/CMakeTests.cmake
index 13d5e47..fba8484 100644
--- a/hl/tools/h5watch/CMakeTests.cmake
+++ b/hl/tools/h5watch/CMakeTests.cmake
@@ -68,12 +68,18 @@ add_custom_target(H5WATCH_files ALL COMMENT "Copying files needed by H5WATCH tes
##############################################################################
##############################################################################
+ if (NOT BUILD_SHARED_LIBS)
+ set (tgt_ext "")
+ else ()
+ set (tgt_ext "-shared")
+ endif ()
+
macro (ADD_H5_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_PROGRAM=$<TARGET_FILE:h5watch${tgt_ext}>"
-D "TEST_ARGS:STRING=${ARGN}"
-D "TEST_FOLDER=${PROJECT_BINARY_DIR}/testfiles"
-D "TEST_OUTPUT=${resultfile}.out"
@@ -91,7 +97,7 @@ add_custom_target(H5WATCH_files ALL COMMENT "Copying files needed by H5WATCH tes
add_test (
NAME H5WATCH_ARGS-h5watch-${resultfile}
COMMAND "${CMAKE_COMMAND}"
- -D "TEST_PROGRAM=$<TARGET_FILE:h5watch>"
+ -D "TEST_PROGRAM=$<TARGET_FILE:h5watch${tgt_ext}>"
-D "TEST_ARGS:STRING=${ARGN}"
-D "TEST_FOLDER=${PROJECT_BINARY_DIR}/testfiles"
-D "TEST_OUTPUT=${resultfile}.out"
@@ -110,14 +116,13 @@ add_custom_target(H5WATCH_files ALL COMMENT "Copying files needed by H5WATCH tes
add_test (
NAME H5WATCH-${resultfile}-clear-objects
COMMAND ${CMAKE_COMMAND}
- -E remove
- ${resultfile}.h5
+ -E remove ${resultfile}.h5
)
set_tests_properties (H5WATCH-${resultfile}-clear-objects PROPERTIES WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles")
add_test (
NAME H5WATCH-${resultfile}
COMMAND "${CMAKE_COMMAND}"
- -D "TEST_PROGRAM=$<TARGET_FILE:h5watch>"
+ -D "TEST_PROGRAM=$<TARGET_FILE:h5watch${tgt_ext}>"
-D "TEST_ARGS:STRING=${ARGN}"
-D "TEST_FOLDER=${PROJECT_BINARY_DIR}/testfiles"
-D "TEST_OUTPUT=${resultfile}.out"
@@ -147,7 +152,7 @@ if (NOT SWMR_INCOMPAT)
-E remove
WATCH.h5
)
- if (NOT "${last_test}" STREQUAL "")
+ if (last_test)
set_tests_properties (H5WATCH-clearall-objects PROPERTIES DEPENDS ${last_test})
endif ()
set (last_test "H5WATCH-clearall-objects")
diff --git a/hl/tools/h5watch/Makefile.am b/hl/tools/h5watch/Makefile.am
index c60fceb..0bf265e 100644
--- a/hl/tools/h5watch/Makefile.am
+++ b/hl/tools/h5watch/Makefile.am
@@ -19,15 +19,12 @@
include $(top_srcdir)/config/commence.am
# Include src and tools/lib directories
-AM_CPPFLAGS+=-I$(top_srcdir)/src -I$(top_srcdir)/tools/lib -I$(top_srcdir)/hl/src -I$(top_srcdir)/hl/test
+AM_CPPFLAGS+=-I$(top_srcdir)/src -I$(top_srcdir)/tools/lib -I$(top_srcdir)/hl/src
# These are our main targets, the tools
-TEST_SCRIPT=testh5watch.sh
-check_SCRIPTS=$(TEST_SCRIPT)
-SCRIPT_DEPEND=swmr_check_compat_vfd$(EXEEXT) extend_dset$(EXEEXT) h5watch$(EXEEXT)
bin_PROGRAMS=h5watch
-noinst_PROGRAMS=swmr_check_compat_vfd h5watchgentest extend_dset
+noinst_PROGRAMS=swmr_check_compat_vfd
# Add h5watch specific linker flags here
h5watch_LDFLAGS = $(LT_STATIC_EXEC) $(AM_LDFLAGS)
@@ -36,13 +33,19 @@ h5watch_LDFLAGS = $(LT_STATIC_EXEC) $(AM_LDFLAGS)
# library.
LDADD=$(LIBH5_HL) $(LIBH5TOOLS) $(LIBHDF5)
-# Add extend_dset specific preprocessor flags here
-# (add the main test subdirectory to the include file path)
-extend_dset_CPPFLAGS=$(AM_CPPFLAGS) -I$(top_srcdir)/test
-# Add extend_dset specific library flags here
-# (add the main test library to the list of libraries)
-extend_dset_LDADD=$(LDADD) $(LIBH5TEST) $(LIBHDF5)
-
+if BUILD_TESTS_CONDITIONAL
+ AM_CPPFLAGS+=-I$(top_srcdir)/hl/test
+ TEST_SCRIPT=testh5watch.sh
+ check_SCRIPTS=$(TEST_SCRIPT)
+ SCRIPT_DEPEND=swmr_check_compat_vfd$(EXEEXT) extend_dset$(EXEEXT) h5watch$(EXEEXT)
+ noinst_PROGRAMS+=h5watchgentest extend_dset
+ # Add extend_dset specific preprocessor flags here
+ # (add the main test subdirectory to the include file path)
+ extend_dset_CPPFLAGS=$(AM_CPPFLAGS) -I$(top_srcdir)/test
+ # Add extend_dset specific library flags here
+ # (add the main test library to the list of libraries)
+ extend_dset_LDADD=$(LDADD) $(LIBH5TEST) $(LIBHDF5)
+endif
#
CHECK_CLEANFILES+=*.h5
DISTCLEANFILES=testh5watch.sh
diff --git a/java/CMakeLists.txt b/java/CMakeLists.txt
index ffc3b94..528b24f 100644
--- a/java/CMakeLists.txt
+++ b/java/CMakeLists.txt
@@ -11,8 +11,8 @@ include (${HDF_RESOURCES_DIR}/UseJava.cmake)
message (STATUS "JAVA: JAVA_HOME=$ENV{JAVA_HOME} JAVA_ROOT=$ENV{JAVA_ROOT}")
find_package (JNI)
-message ("JNI_LIBRARIES=${JNI_LIBRARIES}")
-message ("JNI_INCLUDE_DIRS=${JNI_INCLUDE_DIRS}")
+message (STATUS "JNI_LIBRARIES=${JNI_LIBRARIES}")
+message (STATUS "JNI_INCLUDE_DIRS=${JNI_INCLUDE_DIRS}")
if (WIN32)
diff --git a/java/Makefile.am b/java/Makefile.am
index 7d0e2f0..51398f2 100644
--- a/java/Makefile.am
+++ b/java/Makefile.am
@@ -23,13 +23,26 @@
include $(top_srcdir)/config/commence.am
+if BUILD_TESTS_CONDITIONAL
+ TESTSERIAL_DIR =test
+ TESTEXAMPLES_DIR =examples
+else
+ TESTSERIAL_DIR=
+ TESTEXAMPLES_DIR=
+endif
+
## Only recurse into subdirectories if the Java (JNI) interface is enabled.
if BUILD_JAVA_CONDITIONAL
# Mark this directory as part of the JNI API
JAVA_API=yes
-SUBDIRS=src test examples
+SUBDIRS=src $(TESTSERIAL_DIR) $(TESTEXAMPLES_DIR)
+
+# Test with just the native connector, with a single pass-through connector
+# and with a doubly-stacked pass-through.
+VOL_LIST = native "pass_through under_vol=0;under_info={}" \
+ "pass_through under_vol=505;under_info={under_vol=0;under_info={}}"
endif
diff --git a/java/examples/datasets/CMakeLists.txt b/java/examples/datasets/CMakeLists.txt
index 1375372..c327c86 100644
--- a/java/examples/datasets/CMakeLists.txt
+++ b/java/examples/datasets/CMakeLists.txt
@@ -71,7 +71,7 @@ foreach (HDFJAVA_JAR ${CMAKE_JAVA_INCLUDE_PATH})
set (CMAKE_JAVA_CLASSPATH "${CMAKE_JAVA_CLASSPATH}${CMAKE_JAVA_INCLUDE_FLAG_SEP}${HDFJAVA_JAR}")
endforeach ()
-MACRO (ADD_H5_TEST resultfile resultcode)
+macro (ADD_H5_TEST resultfile resultcode)
set (CMD_ARGS "-Dhdf.hdf5lib.H5.loadLibraryName=$<TARGET_PROPERTY:${HDF5_JAVA_JNI_LIB_TARGET},OUTPUT_NAME$<$<CONFIG:Debug>:_DEBUG>>;")
add_test (
NAME JAVA_datasets-${resultfile}
@@ -87,16 +87,15 @@ MACRO (ADD_H5_TEST resultfile resultcode)
-D "TEST_REFERENCE=datasets/${resultfile}.txt"
-P "${HDF_RESOURCES_DIR}/jrunTest.cmake"
)
- if (NOT "${last_test}" STREQUAL "")
+ if (last_test)
set_tests_properties (JAVA_datasets-${resultfile} PROPERTIES DEPENDS ${last_test})
endif ()
set (last_test "JAVA_datasets-${resultfile}")
-ENDMACRO ()
+endmacro ()
if (BUILD_TESTING)
-
foreach (example ${HDF_JAVA_EXAMPLES})
- if ("${example}" STREQUAL "H5Ex_D_External")
+ if (example STREQUAL "H5Ex_D_External")
add_test (
NAME JAVA_datasets-${example}-clear-objects
COMMAND ${CMAKE_COMMAND}
@@ -112,7 +111,7 @@ if (BUILD_TESTING)
${HDFJAVA_EXAMPLES_BINARY_DIR}/${example}.h5
)
endif ()
- if (NOT "${last_test}" STREQUAL "")
+ if (last_test)
set_tests_properties (JAVA_datasets-${example}-clear-objects PROPERTIES DEPENDS ${last_test})
endif ()
add_test (
diff --git a/java/examples/datatypes/CMakeLists.txt b/java/examples/datatypes/CMakeLists.txt
index 4a8b2a4..0fef370 100644
--- a/java/examples/datatypes/CMakeLists.txt
+++ b/java/examples/datatypes/CMakeLists.txt
@@ -72,7 +72,7 @@ MACRO (ADD_H5_TEST resultfile resultcode)
-D "TEST_REFERENCE=datatypes/${resultfile}.txt"
-P "${HDF_RESOURCES_DIR}/jrunTest.cmake"
)
- if (NOT "${last_test}" STREQUAL "")
+ if (last_test)
set_tests_properties (JAVA_datatypes-${resultfile} PROPERTIES DEPENDS ${last_test})
endif ()
set (last_test "JAVA_datatypes-${resultfile}")
@@ -86,7 +86,7 @@ if (BUILD_TESTING)
-E remove
${HDFJAVA_EXAMPLES_BINARY_DIR}/${example}.h5
)
- if (NOT "${last_test}" STREQUAL "")
+ if (last_test)
set_tests_properties (JAVA_datatypes-${example}-clear-objects PROPERTIES DEPENDS ${last_test})
endif ()
add_test (
diff --git a/java/examples/groups/CMakeLists.txt b/java/examples/groups/CMakeLists.txt
index 2c5d33b..b31a186 100644
--- a/java/examples/groups/CMakeLists.txt
+++ b/java/examples/groups/CMakeLists.txt
@@ -55,7 +55,7 @@ foreach (h5_file ${HDF_JAVA_TEST_FILES})
endforeach ()
add_custom_target(H5Ex_G_Visit_files ALL COMMENT "Copying files needed by H5Ex_G_Visit tests" DEPENDS ${H5Ex_G_Visit_files_list})
-MACRO (ADD_H5_TEST resultfile resultcode)
+macro (ADD_H5_TEST resultfile resultcode)
set (CMD_ARGS "-Dhdf.hdf5lib.H5.loadLibraryName=$<TARGET_PROPERTY:${HDF5_JAVA_JNI_LIB_TARGET},OUTPUT_NAME$<$<CONFIG:Debug>:_DEBUG>>;")
add_test (
NAME JAVA_groups-${resultfile}
@@ -71,16 +71,16 @@ MACRO (ADD_H5_TEST resultfile resultcode)
-D "TEST_REFERENCE=groups/${resultfile}.txt"
-P "${HDF_RESOURCES_DIR}/jrunTest.cmake"
)
- if (NOT "${last_test}" STREQUAL "")
+ if (last_test)
set_tests_properties (JAVA_groups-${resultfile} PROPERTIES DEPENDS ${last_test})
endif ()
set (last_test "JAVA_groups-${resultfile}")
-ENDMACRO ()
+endmacro ()
if (BUILD_TESTING)
foreach (example ${HDF_JAVA_EXAMPLES})
- if (NOT "${example}" STREQUAL "H5Ex_G_Iterate" AND NOT "${example}" STREQUAL "H5Ex_G_Visit")
- if ("${example}" STREQUAL "H5Ex_G_Compact")
+ if (NOT example STREQUAL "H5Ex_G_Iterate" AND NOT example STREQUAL "H5Ex_G_Visit")
+ if (example STREQUAL "H5Ex_G_Compact")
add_test (
NAME JAVA_groups-${example}-clear-h5s
COMMAND ${CMAKE_COMMAND}
@@ -96,7 +96,7 @@ if (BUILD_TESTING)
${HDFJAVA_EXAMPLES_BINARY_DIR}/${example}.h5
)
endif ()
- if (NOT "${last_test}" STREQUAL "")
+ if (last_test)
set_tests_properties (JAVA_groups-${example}-clear-h5s PROPERTIES DEPENDS ${last_test})
endif ()
set (last_test "JAVA_groups-${example}-clear-h5s")
@@ -108,7 +108,7 @@ if (BUILD_TESTING)
${HDFJAVA_EXAMPLES_SOURCE_DIR}/testfiles/examples.groups.${example}.txt
${HDFJAVA_EXAMPLES_GROUPS_BINARY_DIR}/${example}.txt
)
- if (NOT "${last_test}" STREQUAL "")
+ if (last_test)
set_tests_properties (JAVA_groups-${example}-copy-objects PROPERTIES DEPENDS ${last_test})
endif ()
set (last_test "JAVA_groups-${example}-copy-objects")
diff --git a/java/examples/intro/CMakeLists.txt b/java/examples/intro/CMakeLists.txt
index 8d56b86..8c94a09 100644
--- a/java/examples/intro/CMakeLists.txt
+++ b/java/examples/intro/CMakeLists.txt
@@ -73,7 +73,7 @@ MACRO (ADD_H5_TEST resultfile resultcode)
-D "TEST_REFERENCE=intro/${resultfile}.txt"
-P "${HDF_RESOURCES_DIR}/jrunTest.cmake"
)
- if (NOT "${last_test}" STREQUAL "")
+ if (last_test)
set_tests_properties (JAVA_intro-${resultfile} PROPERTIES DEPENDS ${last_test})
endif ()
set (last_test "JAVA_intro-${resultfile}")
@@ -88,7 +88,7 @@ if (BUILD_TESTING)
-E remove
${HDFJAVA_EXAMPLES_BINARY_DIR}/${example}.h5
)
- if (NOT "${last_test}" STREQUAL "")
+ if (last_test)
set_tests_properties (JAVA_intro-${example}-clear-objects PROPERTIES DEPENDS ${last_test})
endif ()
add_test (
diff --git a/java/src/hdf/hdf5lib/H5.java b/java/src/hdf/hdf5lib/H5.java
index 19ca83b..a1a8ede 100644
--- a/java/src/hdf/hdf5lib/H5.java
+++ b/java/src/hdf/hdf5lib/H5.java
@@ -212,7 +212,7 @@ import hdf.hdf5lib.structs.H5O_info_t;
* exception handlers to print out the HDF-5 error stack.
* <hr>
*
- * @version HDF5 1.11.4 <BR>
+ * @version HDF5 1.11.6 <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>
@@ -235,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, 11, 4 };
+ public final static int LIB_VERSION[] = { 1, 11, 6 };
public final static String H5PATH_PROPERTY_KEY = "hdf.hdf5lib.H5.hdf5lib";
@@ -2968,6 +2968,19 @@ public class H5 implements java.io.Serializable {
public synchronized static native int H5Fget_intent(long file_id) throws HDF5LibraryException;
/**
+ * H5Fget_fileno retrieves the "file number" for an open file.
+ *
+ * @param file_id
+ * IN: File identifier for a currently-open HDF5 file
+ *
+ * @return the unique file number for the file.
+ *
+ * @exception HDF5LibraryException
+ * - Error from the HDF-5 Library.
+ **/
+ public synchronized static native long H5Fget_fileno(long file_id) throws HDF5LibraryException;
+
+ /**
* H5Fget_mdc_hit_rate queries the metadata cache of the target file to obtain its hit rate (cache hits / (cache
* hits + cache misses)) since the last time hit rate statistics were reset.
*
@@ -3233,6 +3246,8 @@ public class H5 implements java.io.Serializable {
* @param file_id
* IN: Identifier of the target file.
*
+ * @return true if the file-level is set to create minimized dataset object headers, false if not.
+ *
* @exception HDF5LibraryException
* - Error from the HDF-5 Library.
**/
@@ -6998,6 +7013,8 @@ public class H5 implements java.io.Serializable {
* @param dcpl_id
* IN: Dataset creation property list
*
+ * @return true if the given dcpl is set to create minimized dataset object headers, false if not.
+ *
* @exception HDF5LibraryException
* - Error from the HDF-5 Library.
**/
diff --git a/java/src/hdf/hdf5lib/HDF5Constants.java b/java/src/hdf/hdf5lib/HDF5Constants.java
index a0c2ed6..cb5ed22 100644
--- a/java/src/hdf/hdf5lib/HDF5Constants.java
+++ b/java/src/hdf/hdf5lib/HDF5Constants.java
@@ -121,6 +121,7 @@ public class HDF5Constants {
public static final long H5E_CANTDEC = H5E_CANTDEC();
public static final long H5E_CANTDECODE = H5E_CANTDECODE();
public static final long H5E_CANTDELETE = H5E_CANTDELETE();
+ public static final long H5E_CANTDELETEFILE = H5E_CANTDELETEFILE();
public static final long H5E_CANTENCODE = H5E_CANTENCODE();
public static final long H5E_CANTFLUSH = H5E_CANTFLUSH();
public static final long H5E_CANTFREE = H5E_CANTFREE();
@@ -216,6 +217,7 @@ public class HDF5Constants {
public static final int H5F_LIBVER_EARLIEST = H5F_LIBVER_EARLIEST();
public static final int H5F_LIBVER_V18 = H5F_LIBVER_V18();
public static final int H5F_LIBVER_V110 = H5F_LIBVER_V110();
+ public static final int H5F_LIBVER_V112 = H5F_LIBVER_V112();
public static final int H5F_LIBVER_NBOUNDS = H5F_LIBVER_NBOUNDS();
public static final int H5F_LIBVER_LATEST = H5F_LIBVER_LATEST();
public static final int H5F_OBJ_ALL = H5F_OBJ_ALL();
@@ -373,6 +375,7 @@ public class HDF5Constants {
public static final long H5P_OBJECT_COPY = H5P_OBJECT_COPY();
public static final long H5P_LINK_CREATE = H5P_LINK_CREATE();
public static final long H5P_LINK_ACCESS = H5P_LINK_ACCESS();
+ public static final long H5P_VOL_INITIALIZE = H5P_VOL_INITIALIZE();
public static final long H5P_FILE_CREATE_DEFAULT = H5P_FILE_CREATE_DEFAULT();
public static final long H5P_FILE_ACCESS_DEFAULT = H5P_FILE_ACCESS_DEFAULT();
public static final long H5P_DATASET_CREATE_DEFAULT = H5P_DATASET_CREATE_DEFAULT();
@@ -388,6 +391,7 @@ public class HDF5Constants {
public static final long H5P_OBJECT_COPY_DEFAULT = H5P_OBJECT_COPY_DEFAULT();
public static final long H5P_LINK_CREATE_DEFAULT = H5P_LINK_CREATE_DEFAULT();
public static final long H5P_LINK_ACCESS_DEFAULT = H5P_LINK_ACCESS_DEFAULT();
+ public static final long H5P_VOL_INITIALIZE_DEFAULT = H5P_VOL_INITIALIZE_DEFAULT();
public static final int H5P_CRT_ORDER_TRACKED = H5P_CRT_ORDER_TRACKED();
public static final int H5P_CRT_ORDER_INDEXED = H5P_CRT_ORDER_INDEXED();
public static final long H5P_DEFAULT = H5P_DEFAULT();
@@ -860,6 +864,8 @@ public class HDF5Constants {
private static native final long H5E_CANTDELETE();
+ private static native final long H5E_CANTDELETEFILE();
+
private static native final long H5E_CANTENCODE();
private static native final long H5E_CANTFLUSH();
@@ -1049,6 +1055,8 @@ public class HDF5Constants {
private static native final int H5F_LIBVER_V110();
+ private static native final int H5F_LIBVER_V112();
+
private static native final int H5F_LIBVER_NBOUNDS();
private static native final int H5F_LIBVER_LATEST();
@@ -1349,6 +1357,8 @@ public class HDF5Constants {
private static native final long H5P_LINK_ACCESS();
+ private static native final long H5P_VOL_INITIALIZE();
+
private static native final long H5P_FILE_CREATE_DEFAULT();
private static native final long H5P_FILE_ACCESS_DEFAULT();
@@ -1379,6 +1389,8 @@ public class HDF5Constants {
private static native final long H5P_LINK_ACCESS_DEFAULT();
+ private static native final long H5P_VOL_INITIALIZE_DEFAULT();
+
private static native final int H5P_CRT_ORDER_TRACKED();
private static native final int H5P_CRT_ORDER_INDEXED();
diff --git a/java/src/hdf/hdf5lib/exceptions/HDF5LibraryException.java b/java/src/hdf/hdf5lib/exceptions/HDF5LibraryException.java
index 3a1361a..54acbdd 100644
--- a/java/src/hdf/hdf5lib/exceptions/HDF5LibraryException.java
+++ b/java/src/hdf/hdf5lib/exceptions/HDF5LibraryException.java
@@ -171,6 +171,9 @@ public class HDF5LibraryException extends HDF5Exception {
else if (err_code == HDF5Constants.H5E_MOUNT) {
return "file mount error";
}
+ else if (err_code == HDF5Constants.H5E_CANTDELETEFILE) {
+ return "Unable to delete file";
+ }
else if (err_code == HDF5Constants.H5E_SEEKERROR) {
return "seek failed";
}
@@ -262,7 +265,7 @@ public class HDF5LibraryException extends HDF5Exception {
return "unrecognized message";
}
else if (err_code == HDF5Constants.H5E_CANTDELETE) {
- return " Can't delete message";
+ return "Can't delete message";
}
else if (err_code == HDF5Constants.H5E_CANTOPENOBJ) {
return "Can't open object";
diff --git a/java/src/jni/CMakeLists.txt b/java/src/jni/CMakeLists.txt
index 00c2b34..a05921b 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
@@ -36,6 +49,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
@@ -50,7 +76,7 @@ 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}
+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)
diff --git a/java/src/jni/Makefile.am b/java/src/jni/Makefile.am
index 370b08b..1ec9b94 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 h5vlImp.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 \
+ h5vlImp.c h5zImp.c
# HDF5 Java (JNI) library depends on HDF5 Library.
libhdf5_java_la_LIBADD=$(LIBHDF5)
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 e88fa55..b9e320f 100644
--- a/java/src/jni/h5Constants.c
+++ b/java/src/jni/h5Constants.c
@@ -204,6 +204,8 @@ Java_hdf_hdf5lib_HDF5Constants_H5E_1CANTDECODE(JNIEnv *env, jclass cls) { return
JNIEXPORT jlong JNICALL
Java_hdf_hdf5lib_HDF5Constants_H5E_1CANTDELETE(JNIEnv *env, jclass cls) { return H5E_CANTDELETE; }
JNIEXPORT jlong JNICALL
+Java_hdf_hdf5lib_HDF5Constants_H5E_1CANTDELETEFILE(JNIEnv *env, jclass cls) { return H5E_CANTDELETEFILE; }
+JNIEXPORT jlong JNICALL
Java_hdf_hdf5lib_HDF5Constants_H5E_1CANTENCODE(JNIEnv *env, jclass cls) { return H5E_CANTENCODE; }
JNIEXPORT jlong JNICALL
Java_hdf_hdf5lib_HDF5Constants_H5E_1CANTFLUSH(JNIEnv *env, jclass cls) { return H5E_CANTFLUSH; }
@@ -401,6 +403,8 @@ Java_hdf_hdf5lib_HDF5Constants_H5F_1LIBVER_1V18(JNIEnv *env, jclass cls){return
JNIEXPORT jint JNICALL
Java_hdf_hdf5lib_HDF5Constants_H5F_1LIBVER_1V110(JNIEnv *env, jclass cls){return H5F_LIBVER_V110;}
JNIEXPORT jint JNICALL
+Java_hdf_hdf5lib_HDF5Constants_H5F_1LIBVER_1V112(JNIEnv *env, jclass cls){return H5F_LIBVER_V112;}
+JNIEXPORT jint JNICALL
Java_hdf_hdf5lib_HDF5Constants_H5F_1LIBVER_1NBOUNDS(JNIEnv *env, jclass cls){return H5F_LIBVER_NBOUNDS;}
JNIEXPORT jint JNICALL
Java_hdf_hdf5lib_HDF5Constants_H5F_1LIBVER_1LATEST(JNIEnv *env, jclass cls){return H5F_LIBVER_LATEST;}
@@ -729,6 +733,8 @@ Java_hdf_hdf5lib_HDF5Constants_H5P_1LINK_1CREATE(JNIEnv *env, jclass cls){return
JNIEXPORT jlong JNICALL
Java_hdf_hdf5lib_HDF5Constants_H5P_1LINK_1ACCESS(JNIEnv *env, jclass cls){return H5P_LINK_ACCESS;}
JNIEXPORT jlong JNICALL
+Java_hdf_hdf5lib_HDF5Constants_H5P_1VOL_1INITIALIZE(JNIEnv *env, jclass cls){return H5P_VOL_INITIALIZE;}
+JNIEXPORT jlong JNICALL
Java_hdf_hdf5lib_HDF5Constants_H5P_1FILE_1CREATE_1DEFAULT(JNIEnv *env, jclass cls){return H5P_FILE_CREATE_DEFAULT;}
JNIEXPORT jlong JNICALL
Java_hdf_hdf5lib_HDF5Constants_H5P_1FILE_1ACCESS_1DEFAULT(JNIEnv *env, jclass cls){return H5P_FILE_ACCESS_DEFAULT;}
@@ -758,6 +764,8 @@ JNIEXPORT jlong JNICALL
Java_hdf_hdf5lib_HDF5Constants_H5P_1LINK_1CREATE_1DEFAULT(JNIEnv *env, jclass cls){return H5P_LINK_CREATE_DEFAULT;}
JNIEXPORT jlong JNICALL
Java_hdf_hdf5lib_HDF5Constants_H5P_1LINK_1ACCESS_1DEFAULT(JNIEnv *env, jclass cls){return H5P_LINK_ACCESS_DEFAULT;}
+JNIEXPORT jlong JNICALL
+Java_hdf_hdf5lib_HDF5Constants_H5P_1VOL_1INITIALIZE_1DEFAULT(JNIEnv *env, jclass cls){return H5P_VOL_INITIALIZE_DEFAULT;}
JNIEXPORT jint JNICALL
Java_hdf_hdf5lib_HDF5Constants_H5P_1CRT_1ORDER_1TRACKED(JNIEnv *env, jclass cls){return H5P_CRT_ORDER_TRACKED;}
JNIEXPORT jint JNICALL
@@ -1260,7 +1268,7 @@ Java_hdf_hdf5lib_HDF5Constants_H5VL_1CAP_1FLAG_1THREADSAFE(JNIEnv *env, jclass c
JNIEXPORT jlong JNICALL
Java_hdf_hdf5lib_HDF5Constants_H5VL_1NATIVE(JNIEnv *env, jclass cls) { return H5VL_NATIVE; }
JNIEXPORT jobject JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5VL_1NATIVE_1NAME(JNIEnv *env, jclass cls) { return (jstring)ENVPTR->NewStringUTF(ENVPAR H5VL_NATIVE_NAME); }
+Java_hdf_hdf5lib_HDF5Constants_H5VL_1NATIVE_1NAME(JNIEnv *env, jclass cls) { return (jstring)ENVPTR->NewStringUTF(ENVONLY, H5VL_NATIVE_NAME); }
JNIEXPORT jint JNICALL
Java_hdf_hdf5lib_HDF5Constants_H5VL_1NATIVE_1VALUE(JNIEnv *env, jclass cls) { return H5VL_NATIVE_VALUE; }
JNIEXPORT jint JNICALL
diff --git a/java/src/jni/h5Imp.c b/java/src/jni/h5Imp.c
index 1ad6b17..f0dd691 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,28 +109,24 @@ 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 */
+ 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 e0ec4ca..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,28 +39,14 @@ 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);
@@ -64,90 +54,6 @@ static herr_t H5A_iterate_cb(hid_t g_id, const char *name, const H5A_info_t *inf
/* 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
@@ -159,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 */
@@ -184,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 */
@@ -209,39 +123,17 @@ 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;
+
+ UNUSED(clss);
- if (attr_id < 0)
- h5libraryError(env);
+ 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 */
-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: H5Aread
@@ -251,46 +143,48 @@ JNIEXPORT jint JNICALL
Java_hdf_hdf5lib_H5_H5Aread
(JNIEnv *env, jclass clss, jlong attr_id, jlong mem_type_id, jbyteArray buf, jboolean isCriticalPinning)
{
- herr_t status = -1;
- jbyte *buffP;
- jboolean isCopy;
- htri_t data_class;
-
- if (buf == NULL) {
- h5nullArgument( env,"H5Aread: buf is NULL");
- } /* end if */
- else if((data_class = H5Tdetect_class(mem_type_id, H5T_VLEN)) < 0) {
- h5JNIFatalError(env, "H5Aread: H5Tdetect_class() failed");
- } /* end else if */
- else if(data_class == 1) {
- h5badArgument(env, "H5Aread: buf does not support variable length type");
- } /* end else if */
+ 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 {
- /* recursive detect any vlen string in type (compound, array ...) */
- if((data_class = H5Tdetect_variable_str(mem_type_id)) < 0) {
- h5JNIFatalError(env, "H5Aread: H5Tdetect_variable_str() failed");
- } /* end if */
- else if(data_class == 1) {
- h5badArgument(env, "H5Aread: buf does not support variable length type");
- } /* end else if */
+ 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 {
- PIN_BYTE_ARRAY();
-
- if (buffP == NULL) {
- h5JNIFatalError(env, "H5Aread: buf not pinned");
- } /* end if */
- else {
- status = H5Aread((hid_t)attr_id, (hid_t)mem_type_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_H5Aread */
@@ -304,43 +198,48 @@ JNIEXPORT jint JNICALL
Java_hdf_hdf5lib_H5_H5Awrite
(JNIEnv *env, jclass clss, jlong attr_id, jlong mem_type_id, jbyteArray buf, jboolean isCriticalPinning)
{
- herr_t status = -1;
- jbyte *buffP;
- jboolean isCopy;
- htri_t data_class;
-
- if (buf == NULL) {
- h5nullArgument( env,"H5Awrite: buf is NULL");
- } /* end if */
- else if((data_class = H5Tdetect_class(mem_type_id, H5T_VLEN)) < 0) {
- h5JNIFatalError(env, "H5Awrite: H5Tdetect_class() failed");
- } /* end else if */
- else if(data_class == 1) {
- h5badArgument(env, "H5Awrite: buf does not support variable length type");
- } /* end else if */
+ 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 (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 {
- /* recursive detect any vlen string in type (compound, array ...) */
- if((data_class = H5Tdetect_variable_str(mem_type_id)) < 0) {
- h5JNIFatalError(env, "H5Awrite: H5Tdetect_variable_str() failed");
- } /* end if */
- else if(data_class == 1) {
- h5badArgument(env, "H5Awrite: buf does not support variable length type");
- } /* end else if */
- else {
- PIN_BYTE_ARRAY();
- if (buffP == NULL) {
- h5JNIFatalError(env, "H5Awrite: buf not pinned");
- } /* end if */
- else {
- status = H5Awrite((hid_t)attr_id, (hid_t)mem_type_id, buffP);
+ PIN_BYTE_ARRAY(ENVONLY, buf, writeBuf, &writeBufIsCopy, "H5Awrite: write buffer not pinned");
+ }
- UNPIN_BYTE_ARRAY(JNI_ABORT); /* no need to update buffer */
+ 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 */
- } /* end else */
- } /* end else */
+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);
+ }
+ }
return (jint)status;
} /* end Java_hdf_hdf5lib_H5_H5Awrite */
@@ -354,46 +253,48 @@ JNIEXPORT jint JNICALL
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;
- jshort *buffP;
- jboolean isCopy;
- htri_t data_class;
-
- if (buf == NULL) {
- h5nullArgument(env, "H5Aread_short: buf is NULL");
- } /* end if */
- else if((data_class = H5Tdetect_class(mem_type_id, H5T_VLEN)) < 0) {
- h5JNIFatalError(env, "H5Aread: H5Tdetect_class() failed");
- } /* end else if */
- else if(data_class == 1) {
- h5badArgument(env, "H5Aread_short: buf does not support variable length type");
- } /* end else if */
+ 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 (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 {
- /* recursive detect any vlen string in type (compound, array ...) */
- if((data_class = H5Tdetect_variable_str(mem_type_id)) < 0) {
- h5JNIFatalError(env, "H5Aread_short: H5Tdetect_variable_str() failed");
- } /* end if */
- else if(data_class == 1) {
- h5badArgument(env, "H5Aread_short: buf does not support variable length type");
- } /* end else 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 {
- PIN_SHORT_ARRAY();
- if (buffP == NULL) {
- h5JNIFatalError(env, "H5Aread_short: buf not pinned");
- } /* end if */
- else {
- status = H5Aread((hid_t)attr_id, (hid_t)mem_type_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_H5Aread_1short */
@@ -407,43 +308,48 @@ JNIEXPORT jint JNICALL
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;
- jshort *buffP;
- jboolean isCopy;
- htri_t data_class;
-
- if (buf == NULL ) {
- h5nullArgument(env, "H5Awrite_short: buf is NULL");
- } /* end if */
- else if((data_class = H5Tdetect_class(mem_type_id, H5T_VLEN)) < 0) {
- h5JNIFatalError(env, "H5Awrite_short: H5Tdetect_class() failed");
- } /* end else if */
- else if(data_class == 1) {
- h5badArgument(env, "H5Awrite_short: buf does not support variable length type");
- } /* end else 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 {
- /* recursive detect any vlen string in type (compound, array ...) */
- if((data_class = H5Tdetect_variable_str(mem_type_id)) < 0) {
- h5JNIFatalError(env, "H5Awrite_short: H5Tdetect_variable_str() failed");
- } /* end if */
- else if(data_class == 1) {
- h5badArgument(env, "H5Awrite_short: buf does not support variable length type");
- } /* end else if */
- else {
- PIN_SHORT_ARRAY();
- if (buffP == NULL) {
- h5JNIFatalError(env, "H5Awrite_short: buf not pinned");
- } /* end if */
- else {
- status = H5Awrite((hid_t)attr_id, (hid_t)mem_type_id, buffP);
+ PIN_SHORT_ARRAY(ENVONLY, buf, writeBuf, &writeBufIsCopy, "H5Awrite_short: write buffer not pinned");
+ }
- UNPIN_SHORT_ARRAY(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);
- } /* end else */
- } /* end else */
- } /* end else */
+done:
+ if (writeBuf) {
+ if (isCriticalPinning) {
+ UNPIN_ARRAY_CRITICAL(ENVONLY, buf, writeBuf, (status < 0) ? JNI_ABORT : 0);
+ }
+ else {
+ UNPIN_SHORT_ARRAY(ENVONLY, buf, writeBuf, (status < 0) ? JNI_ABORT : 0);
+ }
+ }
return (jint)status;
} /* end Java_hdf_hdf5lib_H5_H5Awrite_1short */
@@ -457,46 +363,48 @@ JNIEXPORT jint JNICALL
Java_hdf_hdf5lib_H5_H5Aread_1int
(JNIEnv *env, jclass clss, jlong attr_id, jlong mem_type_id, jintArray buf, jboolean isCriticalPinning)
{
- herr_t status = -1;
- jint *buffP;
- jboolean isCopy;
- htri_t data_class;
-
- if (buf == NULL) {
- h5nullArgument(env, "H5Aread_int: buf is NULL");
- } /* end if */
- else if((data_class = H5Tdetect_class(mem_type_id, H5T_VLEN)) < 0) {
- h5JNIFatalError(env, "H5Aread_int: H5Tdetect_class() failed");
- } /* end else if */
- else if(data_class == 1) {
- h5badArgument(env, "H5Aread_int: buf does not support variable length type");
- } /* end else if */
+ 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 {
- /* recursive detect any vlen string in type (compound, array ...) */
- if((data_class = H5Tdetect_variable_str(mem_type_id)) < 0) {
- h5JNIFatalError(env, "H5Aread_int: H5Tdetect_variable_str() failed");
- } /* end if */
- else if(data_class == 1) {
- h5badArgument(env, "H5Aread_int: buf does not support variable length type");
- } /* end else if */
+ 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 {
- PIN_INT_ARRAY();
- if (buffP == NULL) {
- h5JNIFatalError(env, "H5Aread_int: buf not pinned");
- } /* end if */
- else {
- status = H5Aread((hid_t)attr_id, (hid_t)mem_type_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_H5Aread_1int */
@@ -510,43 +418,48 @@ 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;
- jint *buffP;
- jboolean isCopy;
- htri_t data_class;
-
- if (buf == NULL) {
- h5nullArgument(env, "H5Awrite_int: buf is NULL");
- } /* end if */
- else if((data_class = H5Tdetect_class(mem_type_id, H5T_VLEN)) < 0) {
- h5JNIFatalError(env, "H5Awrite_int: H5Tdetect_class() failed");
- } /* end else if */
- else if(data_class == 1) {
- h5badArgument(env, "H5Awrite_int: buf does not support variable length type");
- } /* end else if */
+ 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");
+
+ /* 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_int: variable length type not supported");
+
+ if (isCriticalPinning) {
+ PIN_INT_ARRAY_CRITICAL(ENVONLY, buf, writeBuf, &writeBufIsCopy, "H5Awrite_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, "H5Awrite_int: H5Tdetect_variable_str() failed");
- } /* end if */
- else if(data_class == 1) {
- h5badArgument(env, "H5Awrite_int: buf does not support variable length type");
- } /* end else if */
- else {
- PIN_INT_ARRAY();
- if (buffP == NULL) {
- h5JNIFatalError(env, "H5Awrite_int: buf not pinned");
- } /* end if */
- else {
- status = H5Awrite((hid_t)attr_id, (hid_t)mem_type_id, buffP);
+ PIN_INT_ARRAY(ENVONLY, buf, writeBuf, &writeBufIsCopy, "H5Awrite_int: write buffer not pinned");
+ }
- UNPIN_INT_ARRAY(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);
- } /* end else */
- } /* end else */
- } /* 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 */
@@ -560,46 +473,48 @@ JNIEXPORT jint JNICALL
Java_hdf_hdf5lib_H5_H5Aread_1long
(JNIEnv *env, jclass clss, jlong attr_id, jlong mem_type_id, jlongArray buf, jboolean isCriticalPinning)
{
- herr_t status = -1;
- jlong *buffP;
- jboolean isCopy;
- htri_t data_class;
-
- if (buf == NULL) {
- h5nullArgument(env, "H5Aread_long: buf is NULL");
- } /* end if */
- else if((data_class = H5Tdetect_class(mem_type_id, H5T_VLEN)) < 0) {
- h5JNIFatalError(env, "H5Aread_long: H5Tdetect_class() failed");
- } /* end else if */
- else if(data_class == 1) {
- h5badArgument(env, "H5Aread_long: buf does not support variable length type");
- } /* end else if */
+ 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 {
- /* recursive detect any vlen string in type (compound, array ...) */
- if((data_class = H5Tdetect_variable_str(mem_type_id)) < 0) {
- h5JNIFatalError(env, "H5Aread_long: H5Tdetect_variable_str() failed");
- } /* end if */
- else if(data_class == 1) {
- h5badArgument(env, "H5Aread_long: buf does not support variable length type");
- } /* end else if */
+ 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 {
- PIN_LONG_ARRAY();
- if (buffP == NULL) {
- h5JNIFatalError(env, "H5Aread_long: buf not pinned");
- } /* end if */
- else {
- status = H5Aread((hid_t)attr_id, (hid_t)mem_type_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_H5Aread_1long */
@@ -613,42 +528,48 @@ JNIEXPORT jint JNICALL
Java_hdf_hdf5lib_H5_H5Awrite_1long
(JNIEnv *env, jclass clss, jlong attr_id, jlong mem_type_id, jlongArray buf, jboolean isCriticalPinning)
{
- herr_t status = -1;
- jlong *buffP;
- jboolean isCopy;
- htri_t data_class;
-
- if (buf == NULL) {
- h5nullArgument(env, "H5Awrite_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, "H5Awrite_long: buf does not support variable length type");
- } /* end else 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 {
- /* recursive detect any vlen string in type (compound, array ...) */
- if((data_class = H5Tdetect_variable_str(mem_type_id)) < 0) {
- h5JNIFatalError(env, "H5Awrite_long: H5Tdetect_variable_str() failed");
- } /* end if */
- else if(data_class == 1) {
- h5badArgument(env, "H5Awrite_long: buf does not support variable length type");
- } /* end else 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 {
- PIN_LONG_ARRAY();
- if (buffP == NULL) {
- h5JNIFatalError(env, "H5Awrite_long: buf not pinned");
- } /* end if */
- else {
- status = H5Awrite((hid_t)attr_id, (hid_t)mem_type_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_H5Awrite_1long */
@@ -662,46 +583,48 @@ JNIEXPORT jint JNICALL
Java_hdf_hdf5lib_H5_H5Aread_1float
(JNIEnv *env, jclass clss, jlong attr_id, jlong mem_type_id, jfloatArray buf, jboolean isCriticalPinning)
{
- herr_t status = -1;
- jfloat *buffP;
- jboolean isCopy;
- htri_t data_class;
-
- if (buf == NULL) {
- h5nullArgument(env, "H5Aread_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, "H5Aread_float: buf does not support variable length type");
- } /* end else if */
+ jboolean readBufIsCopy;
+ jfloat *readBuf = NULL;
+ htri_t data_class;
+ herr_t status = FAIL;
+
+ 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 {
- /* recursive detect any vlen string in type (compound, array ...) */
- if((data_class = H5Tdetect_variable_str(mem_type_id)) < 0) {
- h5JNIFatalError(env, "H5Aread_float: H5Tdetect_variable_str() failed");
- } /* end if */
- else if(data_class == 1) {
- h5badArgument(env, "H5Aread_float: buf does not support variable length type");
- } /* end else if */
+ 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 {
- PIN_FLOAT_ARRAY();
- if (buffP == NULL) {
- h5JNIFatalError(env, "H5Aread_float: buf not pinned");
- } /* end if */
- else {
- status = H5Aread((hid_t)attr_id, (hid_t)mem_type_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_H5Aread_1float */
@@ -715,42 +638,48 @@ JNIEXPORT jint JNICALL
Java_hdf_hdf5lib_H5_H5Awrite_1float
(JNIEnv *env, jclass clss, jlong attr_id, jlong mem_type_id, jfloatArray buf, jboolean isCriticalPinning)
{
- herr_t status = -1;
- jfloat *buffP;
- jboolean isCopy;
- htri_t data_class;
-
- if (buf == NULL) {
- h5nullArgument(env, "H5Awrite_float: buf is NULL");
- } /* end if */
- else if((data_class = H5Tdetect_class(mem_type_id, H5T_VLEN)) < 0) {
- h5JNIFatalError(env, "H5Awrite_float: H5Tdetect_class() failed");
- } /* end else if */
- else if(data_class == 1) {
- h5badArgument(env, "H5Awrite_float: buf does not support variable length type");
- } /* end else if */
+ 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 {
- /* recursive detect any vlen string in type (compound, array ...) */
- if((data_class = H5Tdetect_variable_str(mem_type_id)) < 0) {
- h5JNIFatalError(env, "H5Awrite_float: H5Tdetect_variable_str() failed");
- } /* end if */
- else if(data_class == 1) {
- h5badArgument(env, "H5Awrite_float: buf does not support variable length type");
- } /* end else if */
+ 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 {
- PIN_FLOAT_ARRAY();
- if (buffP == NULL) {
- h5JNIFatalError(env, "H5Awrite_float: buf not pinned");
- } /* end if */
- else {
- status = H5Awrite((hid_t)attr_id, (hid_t)mem_type_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_H5Awrite_1float */
@@ -764,46 +693,48 @@ 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;
- jdouble *buffP;
- jboolean isCopy;
- htri_t data_class;
-
- if (buf == NULL) {
- h5nullArgument(env, "H5Aread_double: buf is NULL");
- } /* end if */
- else if((data_class = H5Tdetect_class(mem_type_id, H5T_VLEN)) < 0) {
- h5JNIFatalError(env, "H5Aread_double: H5Tdetect_class() failed");
- } /* end else if */
- else if(data_class == 1) {
- h5badArgument(env, "H5Aread_double: buf does not support variable length type");
- } /* end else 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 {
- /* recursive detect any vlen string in type (compound, array ...) */
- if((data_class = H5Tdetect_variable_str(mem_type_id)) < 0) {
- h5JNIFatalError(env, "H5Aread_double: H5Tdetect_variable_str() failed");
- } /* end if */
- else if(data_class == 1) {
- h5badArgument(env, "H5Aread_double: buf does not support variable length type");
- } /* end else if */
+ 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 {
- PIN_DOUBLE_ARRAY();
- if (buffP == NULL) {
- h5JNIFatalError(env, "H5Aread_double: buf not pinned");
- } /* end if */
- else {
- status = H5Aread((hid_t)attr_id, (hid_t)mem_type_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_H5Aread_1double */
@@ -817,42 +748,48 @@ JNIEXPORT jint JNICALL
Java_hdf_hdf5lib_H5_H5Awrite_1double
(JNIEnv *env, jclass clss, jlong attr_id, jlong mem_type_id, jdoubleArray buf, jboolean isCriticalPinning)
{
- herr_t status = -1;
- jdouble *buffP;
- jboolean isCopy;
- htri_t data_class;
-
- if (buf == NULL) {
- h5nullArgument(env, "H5Awrite_double: buf is NULL");
- } /* end if */
- else if((data_class = H5Tdetect_class(mem_type_id, H5T_VLEN)) < 0) {
- h5JNIFatalError(env, "H5Awrite_double: H5Tdetect_class() failed");
- } /* end else if */
- else if(data_class == 1) {
- h5badArgument(env, "H5Awrite_double: buf does not support variable length type");
- } /* end else if */
+ 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 {
- /* recursive detect any vlen string in type (compound, array ...) */
- if((data_class = H5Tdetect_variable_str(mem_type_id)) < 0) {
- h5JNIFatalError(env, "H5Awrite_double: H5Tdetect_variable_str() failed");
- } /* end if */
- else if(data_class == 1) {
- h5badArgument(env, "H5Awrite_double: buf does not support variable length type");
- } /* end else if */
+ 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);
+ }
else {
- PIN_DOUBLE_ARRAY();
- if (buffP == NULL) {
- h5JNIFatalError(env, "H5Awrite_double: buf not pinned");
- } /* end if */
- else {
- status = H5Awrite((hid_t)attr_id, (hid_t)mem_type_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_H5Awrite_1double */
@@ -866,67 +803,58 @@ JNIEXPORT jint JNICALL
Java_hdf_hdf5lib_H5_H5Aread_1string
(JNIEnv *env, jclass clss, jlong attr_id, jlong mem_type_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, "H5Aread_string: buf is NULL");
- } /* end if */
- else if ((n = ENVPTR->GetArrayLength(ENVPAR j_buf)) <= 0) {
- h5nullArgument(env, "H5Aread_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, "H5Aread_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, "H5Aread_string: memory allocation failed.");
- } /* end if */
- else {
- status = H5Aread((hid_t)attr_id, (hid_t)mem_type_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, "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 */
@@ -940,52 +868,63 @@ JNIEXPORT jint JNICALL
Java_hdf_hdf5lib_H5_H5Awrite_1string
(JNIEnv *env, jclass clss, jlong attr_id, jlong mem_type_id, jobjectArray j_buf)
{
- herr_t status = -1;
- char *c_buf;
- jsize str_len;
- jsize i;
- jsize n;
-
- if (j_buf == NULL) {
- h5nullArgument(env, "H5Awrite_string: buf is NULL");
- } /* end if */
- else if ((n = ENVPTR->GetArrayLength(ENVPAR j_buf)) <= 0) {
- h5nullArgument(env, "H5Awrite_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, "H5Awrite_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);
+ 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 (utf8) {
- HDstrncpy(&c_buf[i * str_len], utf8, str_len);
- } /* end if */
+ 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);
- ENVPTR->ReleaseStringUTFChars(ENVPAR obj, utf8);
- ENVPTR->DeleteLocalRef(ENVPAR obj);
- } /* end if */
- } /* end for */
+ if (NULL == (c_buf = (char *) HDmalloc((size_t)n * str_len)))
+ H5_JNI_FATAL_ERROR(ENVONLY, "H5Awrite_string: memory allocation failed");
- status = H5Awrite((hid_t)attr_id, (hid_t)mem_type_id, c_buf);
+ 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 (c_buf)
- HDfree(c_buf);
- c_buf = NULL;
+ /*
+ * If the string object was NULL, skip it.
+ */
+ HDmemset(&c_buf[i * str_len], 0, str_len);
+ continue;
+ }
- if (status < 0) {
- h5libraryError(env);
- } /* end if */
- } /* end else */
- } /* end else */
+ /*
+ * 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 */
@@ -999,167 +938,201 @@ JNIEXPORT jint JNICALL
Java_hdf_hdf5lib_H5_H5AreadVL
(JNIEnv *env, jclass clss, jlong attr_id, jlong mem_type_id, jobjectArray buf)
{
- 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 */
- 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 = H5AreadVL_asstr(env, (hid_t)attr_id, (hid_t)mem_type_id, buf);
- }
- else if (isStr > 0) {
- status = H5AreadVL_str(env, (hid_t)attr_id, (hid_t)mem_type_id, 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
-H5AreadVL_asstr
+/*
+ * 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)
{
- 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;
+ jstring jstr;
+ jsize i, n;
+ char **strs = NULL;
+ herr_t status = FAIL;
- /* 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_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 */
-herr_t
-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)
{
- 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 */
+ 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;
- /*
- 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);
- */
+ HDmemset(&h5str, 0, sizeof(h5str_t));
+
+ /* Get size of string array */
+ 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 */
- HDfree(strs);
- } /* end else */
- } /* end else */
+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;
-} /* end H5AreadVL_str */
+}
/*
* Class: hdf_hdf5lib_H5
@@ -1170,139 +1143,224 @@ JNIEXPORT jint JNICALL
Java_hdf_hdf5lib_H5_H5AwriteVL
(JNIEnv *env, jclass clss, jlong attr_id, jlong mem_type_id, jobjectArray buf)
{
- 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 */
- 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 = H5AwriteVL_asstr(env, (hid_t)attr_id, (hid_t)mem_type_id, buf);
- }
- else if (isStr > 0) {
- status = H5AwriteVL_str(env, (hid_t)attr_id, (hid_t)mem_type_id, 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;
}
- } /* end else */
+ }
+ 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 */
-herr_t
+/*
+ * 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)
{
- herr_t status = -1;
- char **wdata;
- jsize size;
- jint i;
+ 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");
+ }
- size = ENVPTR->GetArrayLength(ENVPAR (jarray) buf);
+ 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")
- wdata = (char**)HDcalloc((size_t)size + 1, sizeof(char*));
- if (!wdata) {
- h5JNIFatalError(env, "H5AwriteVL_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);
- } /* 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);
+ 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(wdata[i]) {
- HDfree(wdata[i]);
- } /* end if */
- } /* end for */
- HDfree(wdata);
+ if (writeBuf[i])
+ HDfree(writeBuf[i]);
+ }
- if (status < 0)
- h5libraryError(env);
- } /* end else */
+ HDfree(writeBuf);
+ }
return (jint)status;
}
-herr_t
+/*
+ * 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)
{
- 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 */
- 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 */
- 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;
+ 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);
+ */
- HDfree(strs);
- } /* end else */
- } /* end else */
+ 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++) */
+
+ 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 H5AwriteVL_str */
@@ -1316,47 +1374,52 @@ JNIEXPORT jint JNICALL
Java_hdf_hdf5lib_H5_H5Aread_1reg_1ref
(JNIEnv *env, jclass clss, jlong attr_id, jlong mem_type_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 = -1;
- hid_t aid = (hid_t) attr_id;
- hid_t tid = (hid_t) mem_type_id;
+ UNUSED(clss);
- 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);
+ HDmemset(&h5str, 0, sizeof(h5str_t));
- if (ref_data == NULL) {
- h5JNIFatalError(env, "H5Aread_reg_ref: failed to allocate buff for read");
- return -1;
- } /* end if */
+ if ((n = ENVPTR->GetArrayLength(ENVONLY, buf)) < 0) {
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_TRUE);
+ H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Aread_reg_ref: buf length < 0");
+ }
- status = H5Aread(aid, tid, ref_data);
+ 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 < 0) {
- HDfree(ref_data);
- h5JNIFatalError(env, "H5Aread_reg_ref: failed to read data");
- return -1;
- } /* end if */
+ if ((status = H5Aread((hid_t)attr_id, (hid_t)mem_type_id, ref_data)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
- HDmemset(&h5str, 0, sizeof(h5str_t));
h5str_new(&h5str, 1024);
- for (i=0; i<n; i++) {
+
+ 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';
- h5str_sprintf(&h5str, aid, tid, ref_data[i], 0, 0);
- jstr = ENVPTR->NewStringUTF(ENVPAR h5str.s);
- ENVPTR->SetObjectArrayElement(ENVPAR buf, i, jstr);
+ 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 */
- 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_H5Aread_1reg_1ref */
@@ -1370,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;
+
+ UNUSED(clss);
- retVal = H5Aget_space((hid_t)attr_id);
- if (retVal < 0)
- h5libraryError(env);
+ if ((retVal = H5Aget_space((hid_t)attr_id)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+done:
return (jlong)retVal;
} /* end Java_hdf_hdf5lib_H5__1H5Aget_1space */
@@ -1388,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;
- retVal = H5Aget_type((hid_t)attr_id);
- if (retVal < 0)
- h5libraryError(env);
+ UNUSED(clss);
+ if ((retVal = H5Aget_type((hid_t)attr_id)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+done:
return (jlong)retVal;
} /* end Java_hdf_hdf5lib_H5__1H5Aget_1type */
@@ -1406,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 */
@@ -1446,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;
+
+ UNUSED(clss);
- retVal = H5Aget_num_attrs((hid_t)loc_id);
- if (retVal < 0)
- h5libraryError(env);
+ 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 */
@@ -1464,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 */
@@ -1489,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 */
@@ -1510,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
@@ -1538,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 */
@@ -1563,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 */
@@ -1589,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 */
@@ -1616,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 */
@@ -1644,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
@@ -1671,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 */
@@ -1698,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 */
@@ -1755,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;
- retVal = H5Aget_storage_size((hid_t)attr_id);
-/* probably returns '0' if fails--don't do an exception */
+ UNUSED(clss);
+
+ 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
@@ -1772,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 */
@@ -1801,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 */
@@ -1837,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 */
@@ -1873,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 */
@@ -1899,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 */
@@ -1926,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 */
/*
@@ -1950,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 */
@@ -1976,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 */
@@ -2044,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 (status < 0)
- h5libraryError(env);
- } /* end else */
+ 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 = 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 */
@@ -2073,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/h5dImp.c b/java/src/jni/h5dImp.c
index 79a5d0a..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;
- retVal = H5Dget_space((hid_t)dataset_id);
- if (retVal < 0)
- h5libraryError(env);
+ UNUSED(clss);
+ 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;
+
+ UNUSED(clss);
- retVal = H5Dget_type((hid_t)dataset_id);
- if (retVal < 0)
- h5libraryError(env);
+ 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);
+
+ if (NULL == buf)
+ H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Dvlen_reclaim: buffer is NULL");
+
+ PIN_BYTE_ARRAY(ENVONLY, buf, vlenBuf, &vlenBufIsCopy, "H5Dvlen_reclaim: buffer not pinned");
- ENVPTR->ReleaseByteArrayElements(ENVPAR buf, byteP, JNI_ABORT);
+ if ((status = H5Dvlen_reclaim((hid_t)type_id, (hid_t)space_id, (hid_t)xfer_plist_id, vlenBuf)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
- if (status < 0)
- h5libraryError(env);
- } /* end else */
- } /* end else */
+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,168 +1311,265 @@ 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;
+ htri_t isVlenStr = 0;
+ herr_t status = FAIL;
- if (buf == NULL) {
- h5nullArgument(env, "H5Dread_VLStrings: buf is NULL");
- } /* end if */
- else {
- isVlenStr = H5Tdetect_class((hid_t)mem_type_id, H5T_STRING);
+ UNUSED(clss);
+
+ if (NULL == buf)
+ H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Dread_VLStrings: read buffer is NULL");
- 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 */
+ if ((isVlenStr = H5Tdetect_class((hid_t)mem_type_id, H5T_STRING)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+ 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 */
-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)
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5DwriteVL
+ * Signature: (JJJJJ[Ljava/lang/String;)I
+ */
+JNIEXPORT jint JNICALL
+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)
{
- char **strs;
- jstring jstr;
- jint i;
- jint n;
- herr_t status = -1;
+ 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;
- n = ENVPTR->GetArrayLength(ENVPAR buf);
- strs =(char**)HDcalloc((size_t)n, sizeof(char*));
+ UNUSED(clss);
- 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);
+ if (NULL == buf)
+ H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5DwriteVL: write buffer is NULL");
- 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 */
+ if ((isStr = H5Tdetect_class((hid_t)mem_type_id, H5T_STRING)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
- /*
- 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 ((type_class = H5Tget_class((hid_t)mem_type_id)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
- HDfree(strs);
- } /* end else */
- } /* end else */
+ if (type_class == H5T_COMPOUND) {
+ unsigned i;
+ int num_members;
- return status;
-} /* end H5DreadVL_str */
+ 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 = 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 */
/*
- * Class: hdf_hdf5lib_H5
- * Method: H5DwriteVL
- * Signature: (JJJJJ[Ljava/lang/String;)I
+ * 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.
*/
-JNIEXPORT jint JNICALL
-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)
+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;
- htri_t isStr = 0;
- htri_t isVlenStr = 0;
- htri_t isComplex = 0;
+ 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");
+ }
- 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);
+ 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");
+
+ 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;
}
- 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);
+
+ length = ENVPTR->GetStringUTFLength(ENVONLY, obj);
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
+
+ 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 = 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]);
}
- } /* end else */
- return (jint)status;
-} /* end Java_hdf_hdf5lib_H5_H5Dwrite_1VL */
+ HDfree(writeBuf);
+ }
+
+ return status;
+} /* end H5DwriteVL_str */
-herr_t
+/*
+ * 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.
+ */
+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;
- hvl_t *wdata;
- jsize size;
- jint i;
- jint n;
+ 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);
+ }
+ }
- /* Get size of string array */
- n = ENVPTR->GetArrayLength(ENVPAR buf);
- wdata = (hvl_t*)HDcalloc((size_t)n, sizeof(hvl_t));
+ if ((n = ENVPTR->GetArrayLength(ENVONLY, buf)) < 0) {
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_TRUE);
+ H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5DwriteVL_asstr: buf length < 0");
+ }
- 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);
+ 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");
+
+ 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);
- if (utf8) {
- h5str_vlconvert(utf8, did, tid, wdata+i, 0);
- } /* end if */
+ /*
+ * If the string object was NULL, skip it.
+ */
+ HDmemset(&(((char *) writeBuf)[i * typeSize]), 0, typeSize);
+ continue;
+ }
- ENVPTR->ReleaseStringUTFChars(ENVPAR obj, utf8);
- ENVPTR->DeleteLocalRef(ENVPAR obj);
- } /* end if */
- } /* end for (i = 0; i < size; ++i) */
+ /*
+ * length = ENVPTR->GetStringUTFLength(ENVONLY, obj);
+ * CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
+ */
- status = H5Dwrite(did, tid, mem_sid, file_sid, xfer_plist_id, wdata);
+ PIN_JAVA_STRING(ENVONLY, obj, utf8, NULL, "H5DwriteVL_asstr: failed to pin string buffer");
- /* now free memory*/
- for (i = 0; i < n; i++) {
- if(wdata+i) {
- HDfree(wdata+i);
- } /* end if */
- } /* end for */
- HDfree(wdata);
+ /*
+ * 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, did, tid, &(((char *) writeBuf)[i * typeSize]), 0))
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
- if (status < 0)
- h5libraryError(env);
- } /* end else */
+ 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_asstr */
@@ -1440,79 +1584,28 @@ 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;
- htri_t isVlenStr=0;
-
- if (buf == NULL) {
- h5nullArgument(env, "H5Dwrite_VLStrings: buf is NULL");
- } /* end if */
- else {
- isVlenStr = H5Tis_variable_str((hid_t)mem_type_id);
-
- 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 */
+ htri_t isVlenStr = 0;
+ herr_t status = FAIL;
- return (jint)status;
-} /* end Java_hdf_hdf5lib_H5_H5Dwrite_1VLStrings */
+ UNUSED(clss);
-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;
+ if (NULL == buf)
+ H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Dwrite_VLStrings: write buffer is NULL");
- size = ENVPTR->GetArrayLength(ENVPAR (jarray) buf);
- wdata = (char**)HDmalloc((size_t)size * sizeof (char*));
+ if ((isVlenStr = H5Tis_variable_str((hid_t)mem_type_id)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
- if (!wdata) {
- h5JNIFatalError(env, "H5DwriteVL_str: cannot allocate buffer");
+ 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 {
- 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);
-
- if (status < 0)
- h5libraryError(env);
- } /* end else */
+ else
+ H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Dwrite_VLStrings: datatype is not variable length String");
- return status;
-} /* end H5DwriteVL_str */
+done:
+ return (jint)status;
+} /* end Java_hdf_hdf5lib_H5_H5Dwrite_1VLStrings */
/*
* Class: hdf_hdf5lib_H5
@@ -1525,49 +1618,52 @@ Java_hdf_hdf5lib_H5_H5Dread_1reg_1ref
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 = -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;
+ UNUSED(clss);
- 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);
+ HDmemset(&h5str, 0, sizeof(h5str_t));
- if (ref_data == NULL) {
- h5JNIFatalError(env, "H5Dread_reg_ref: failed to allocate buff for read");
- return -1;
- } /* end if */
+ if ((n = ENVPTR->GetArrayLength(ENVONLY, buf)) < 0) {
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_TRUE);
+ H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Dread_reg_ref: buf length < 0");
+ }
- status = H5Dread(did, tid, mem_sid, file_sid, xfer_plist_id, ref_data);
+ 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");
- if (status < 0) {
- HDfree(ref_data);
- h5JNIFatalError(env, "H5Dread_reg_ref: failed to read data");
- return -1;
- } /* end if */
+ 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);
- 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';
- h5str_sprintf(&h5str, did, tid, ref_data[i], 0, 0);
- 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 */
@@ -1582,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 */
@@ -1606,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 */
@@ -1630,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;
+
+ UNUSED(clss);
- 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);
+ 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 */
@@ -1650,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 */
@@ -1665,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;
+
+ UNUSED(clss);
- retVal = H5Dget_access_plist((hid_t)loc_id);
- if (retVal < 0)
- h5libraryError(env);
+ 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 */
@@ -1685,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 */
@@ -1701,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;
+
+ UNUSED(clss);
- if (H5Dvlen_get_buf_size((hid_t)dataset_id, (hid_t)type_id, (hid_t)space_id, &sz) < 0)
- h5libraryError(env);
+ if (H5Dvlen_get_buf_size((hid_t)dataset_id, (hid_t)type_id, (hid_t)space_id, &sz) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
- return (jlong)sz;
+done:
+ return (jlong)sz;
} /* end Java_hdf_hdf5lib_H5_H5Dvlen_1get_1buf_1size_1long */
/*
@@ -1718,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 */
/*
@@ -1772,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 */
/*
@@ -1884,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 */
@@ -1932,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;
}
/*
@@ -1945,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/h5eImp.c b/java/src/jni/h5eImp.c
index 9c80461..937323e 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 */
/********************/
@@ -73,16 +62,19 @@ static herr_t H5E_walk_cb(int nindx, const H5E_error2_t *info, void *cb_data);
*/
JNIEXPORT jboolean JNICALL
Java_hdf_hdf5lib_H5_H5Eauto_1is_1v2
- (JNIEnv *env, jclass cls, jlong stk_id)
+ (JNIEnv *env, jclass clss, jlong stk_id)
{
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(clss);
+
+ 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 */
@@ -93,22 +85,36 @@ Java_hdf_hdf5lib_H5_H5Eauto_1is_1v2
*/
JNIEXPORT jlong JNICALL
Java_hdf_hdf5lib_H5_H5Eregister_1class
- (JNIEnv *env, jclass cls, jstring cls_name, jstring lib_name, jstring version)
+ (JNIEnv *env, jclass clss, 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(clss);
+
+ 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 */
@@ -120,13 +126,18 @@ Java_hdf_hdf5lib_H5_H5Eregister_1class
*/
JNIEXPORT void JNICALL
Java_hdf_hdf5lib_H5_H5Eunregister_1class
- (JNIEnv *env, jclass cls, jlong cls_id)
+ (JNIEnv *env, jclass clss, 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(clss);
+
+ 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 */
/*
@@ -136,13 +147,18 @@ Java_hdf_hdf5lib_H5_H5Eunregister_1class
*/
JNIEXPORT void JNICALL
Java_hdf_hdf5lib_H5_H5Eclose_1msg
- (JNIEnv *env, jclass cls, jlong err_id)
+ (JNIEnv *env, jclass clss, 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(clss);
+
+ 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 */
/*
@@ -152,26 +168,27 @@ Java_hdf_hdf5lib_H5_H5Eclose_1msg
*/
JNIEXPORT jlong JNICALL
Java_hdf_hdf5lib_H5_H5Ecreate_1msg
- (JNIEnv *env, jclass cls, jlong err_id, jint msg_type, jstring err_msg)
+ (JNIEnv *env, jclass clss, 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(clss);
+
+ 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 */
@@ -183,14 +200,16 @@ Java_hdf_hdf5lib_H5_H5Ecreate_1msg
*/
JNIEXPORT jlong JNICALL
Java_hdf_hdf5lib_H5_H5Ecreate_1stack
- (JNIEnv *env, jclass cls)
+ (JNIEnv *env, jclass clss)
{
- hid_t ret_val = -1;
+ hid_t ret_val = H5I_INVALID_HID;
- ret_val = H5Ecreate_stack();
- if (ret_val < 0)
- h5libraryError(env);
+ UNUSED(clss);
+ if ((ret_val = H5Ecreate_stack()) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+done:
return (jlong)ret_val;
} /* end Java_hdf_hdf5lib_H5_H5Ecreate_1stack */
@@ -201,14 +220,16 @@ Java_hdf_hdf5lib_H5_H5Ecreate_1stack
*/
JNIEXPORT jlong JNICALL
Java_hdf_hdf5lib_H5_H5Eget_1current_1stack
- (JNIEnv *env, jclass cls)
+ (JNIEnv *env, jclass clss)
{
- hid_t ret_val = -1;
+ hid_t ret_val = H5I_INVALID_HID;
+
+ UNUSED(clss);
- 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 */
@@ -219,13 +240,18 @@ Java_hdf_hdf5lib_H5_H5Eget_1current_1stack
*/
JNIEXPORT void JNICALL
Java_hdf_hdf5lib_H5_H5Eclose_1stack
- (JNIEnv *env, jclass cls, jlong stk_id)
+ (JNIEnv *env, jclass clss, 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(clss);
+
+ 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 */
/*
@@ -235,22 +261,26 @@ Java_hdf_hdf5lib_H5_H5Eclose_1stack
*/
JNIEXPORT void JNICALL
Java_hdf_hdf5lib_H5_H5Eprint2
- (JNIEnv *env, jclass cls, jlong stk_id, jobject stream_obj)
+ (JNIEnv *env, jclass clss, 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(clss);
+
+ 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 */
/*
@@ -260,45 +290,38 @@ Java_hdf_hdf5lib_H5_H5Eprint2
*/
JNIEXPORT jstring JNICALL
Java_hdf_hdf5lib_H5_H5Eget_1class_1name
- (JNIEnv *env, jclass cls, jlong cls_id)
+ (JNIEnv *env, jclass clss, jlong cls_id)
{
- char *namePtr;
- jstring str = NULL;
- ssize_t buf_size;
+ jstring str = NULL;
+ ssize_t buf_size;
+ char *namePtr = NULL;
+
+ UNUSED(clss);
+
+ 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 */
@@ -309,13 +332,18 @@ Java_hdf_hdf5lib_H5_H5Eget_1class_1name
*/
JNIEXPORT void JNICALL
Java_hdf_hdf5lib_H5_H5Eset_1current_1stack
- (JNIEnv *env, jclass cls, jlong stk_id)
+ (JNIEnv *env, jclass clss, 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(clss);
+
+ 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 */
/*
@@ -325,13 +353,18 @@ Java_hdf_hdf5lib_H5_H5Eset_1current_1stack
*/
JNIEXPORT void JNICALL
Java_hdf_hdf5lib_H5_H5Epop
- (JNIEnv *env, jclass cls, jlong stk_id, jlong count)
+ (JNIEnv *env, jclass clss, 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(clss);
+
+ 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 */
/*
@@ -341,38 +374,46 @@ Java_hdf_hdf5lib_H5_H5Epop
*/
JNIEXPORT void JNICALL
Java_hdf_hdf5lib_H5_H5Epush2
- (JNIEnv *env, jclass cls, jlong stk_id, jstring filename, jstring funcname,
+ (JNIEnv *env, jclass clss, 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(clss);
+
+ 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 */
/*
@@ -382,13 +423,18 @@ Java_hdf_hdf5lib_H5_H5Epush2
*/
JNIEXPORT void JNICALL
Java_hdf_hdf5lib_H5_H5Eclear2
- (JNIEnv *env, jclass cls, jlong stk_id)
+ (JNIEnv *env, jclass clss, 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(clss);
+
+ 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 */
/*
@@ -398,59 +444,47 @@ Java_hdf_hdf5lib_H5_H5Eclear2
*/
JNIEXPORT jstring JNICALL
Java_hdf_hdf5lib_H5_H5Eget_1msg
- (JNIEnv *env, jclass cls, jlong msg_id, jintArray error_msg_type_list)
+ (JNIEnv *env, jclass clss, 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(clss);
+
+ 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 */
@@ -462,18 +496,19 @@ Java_hdf_hdf5lib_H5_H5Eget_1msg
*/
JNIEXPORT jlong JNICALL
Java_hdf_hdf5lib_H5_H5Eget_1num
- (JNIEnv *env, jclass cls, jlong stk_id)
+ (JNIEnv *env, jclass clss, jlong stk_id)
{
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(clss);
+
+ 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 */
@@ -537,17 +587,25 @@ H5E_walk_cb
*/
JNIEXPORT void JNICALL
Java_hdf_hdf5lib_H5_H5Ewalk2
- (JNIEnv *env, jclass cls, jlong stk_id, jlong direction, jobject callback_op, jobject op_data)
+ (JNIEnv *env, jclass clss, 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(clss);
+
+ 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 80adffb..4fd6807 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;
- retVal = H5Fflush((hid_t)object_id, (H5F_scope_t)scope );
- if (retVal < 0)
- h5libraryError(env);
+ UNUSED(clss);
+ 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 */
@@ -105,36 +118,31 @@ Java_hdf_hdf5lib_H5_H5Fflush
*/
JNIEXPORT jstring JNICALL
Java_hdf_hdf5lib_H5_H5Fget_1name
- (JNIEnv *env, jclass cls, jlong file_id)
+ (JNIEnv *env, jclass clss, 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(clss);
+
+ /* 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,24 +156,29 @@ JNIEXPORT jboolean JNICALL
Java_hdf_hdf5lib_H5_H5Fis_1hdf5
(JNIEnv *env, jclass clss, jstring name)
{
+ const char *fileName = NULL;
htri_t bval = JNI_FALSE;
+
+ UNUSED(clss);
+
#ifdef H5_NO_DEPRECATED_SYMBOLS
- h5unimplemented(env, "H5Fis_hdf5: not implemented");
-#else
- const char *fileName;
+ H5_UNIMPLEMENTED(ENVONLY, "H5Fis_hdf5: not implemented");
+#endif
- PIN_JAVA_STRING(name, fileName);
- if (fileName != NULL) {
- bval = H5Fis_hdf5(fileName);
+ if (NULL == name)
+ H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Fis_hdf5: file name is NULL");
- UNPIN_JAVA_STRING(name, fileName);
+ 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);
- if (bval > 0)
- bval = JNI_TRUE;
- else if (bval < 0)
- h5libraryError(env);
- }
-#endif
return (jboolean)bval;
} /* end Java_hdf_hdf5lib_H5_H5Fis_1hdf5 */
@@ -178,20 +191,24 @@ JNIEXPORT jboolean JNICALL
Java_hdf_hdf5lib_H5_H5Fis_1accessible
(JNIEnv *env, jclass clss, jstring name, jlong file_id)
{
+ const char *fileName = NULL;
htri_t bval = JNI_FALSE;
- const char *fileName;
- PIN_JAVA_STRING(name, fileName);
- if (fileName != NULL) {
- bval = H5Fis_accessible(fileName, (hid_t)file_id);
+ UNUSED(clss);
- UNPIN_JAVA_STRING(name, fileName);
+ if (NULL == name)
+ H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Fis_accessible: file name is NULL");
- if (bval > 0)
- bval = JNI_TRUE;
- else if (bval < 0)
- h5libraryError(env);
- }
+ PIN_JAVA_STRING(ENVONLY, name, fileName, NULL, "H5Fis_accessible: file name not pinned");
+
+ if ((bval = H5Fis_accessible(fileName, (hid_t)file_id)) < 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_1accessible */
@@ -205,12 +222,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 */
@@ -223,12 +242,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;
- retVal = H5Fget_access_plist((hid_t)file_id);
- if (retVal < 0)
- h5libraryError(env);
+ UNUSED(clss);
+ 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 */
@@ -239,18 +260,41 @@ Java_hdf_hdf5lib_H5__1H5Fget_1access_1plist
*/
JNIEXPORT jint JNICALL
Java_hdf_hdf5lib_H5_H5Fget_1intent
- (JNIEnv *env, jclass cls, jlong file_id)
+ (JNIEnv *env, jclass clss, jlong file_id)
{
unsigned intent = 0;
+ UNUSED(clss);
+
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 */
/*
* Class: hdf_hdf5lib_H5
+ * Method: H5Fget_fileno
+ * Signature: (J)J
+ */
+JNIEXPORT jlong JNICALL
+Java_hdf_hdf5lib_H5_H5Fget_1fileno
+ (JNIEnv *env, jclass clss, jlong file_id)
+{
+ unsigned long fileno = 0;
+
+ UNUSED(clss);
+
+ if (H5Fget_fileno((hid_t)file_id, &fileno) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+done:
+ return (jlong)fileno;
+} /* end Java_hdf_hdf5lib_H5_H5Fget_1fileno */
+
+/*
+ * Class: hdf_hdf5lib_H5
* Method: H5Fclose
* Signature: (J)I
*/
@@ -258,14 +302,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 */
@@ -278,18 +322,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 */
@@ -303,18 +351,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 */
@@ -326,13 +378,16 @@ Java_hdf_hdf5lib_H5_H5Funmount
*/
JNIEXPORT jlong JNICALL
Java_hdf_hdf5lib_H5_H5Fget_1freespace
- (JNIEnv *env, jclass cls, jlong file_id)
+ (JNIEnv *env, jclass clss, jlong file_id)
{
- hssize_t ret_val = H5Fget_freespace((hid_t)file_id);
+ hssize_t ret_val = -1;
+
+ UNUSED(clss);
- if (ret_val < 0)
- h5libraryError(env);
+ 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 */
@@ -345,12 +400,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;
- retVal = H5Freopen((hid_t)file_id);
- if (retVal < 0)
- h5libraryError(env);
+ UNUSED(clss);
+ if ((retVal = H5Freopen((hid_t)file_id)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+done:
return (jlong)retVal;
} /* end Java_hdf_hdf5lib_H5__1H5Freopen */
@@ -361,50 +418,43 @@ Java_hdf_hdf5lib_H5__1H5Freopen
*/
JNIEXPORT jlong JNICALL
Java_hdf_hdf5lib_H5_H5Fget_1obj_1ids
- (JNIEnv *env, jclass cls, jlong file_id, jint types, jlong maxObjs,
+ (JNIEnv *env, jclass clss, 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(clss);
+
+ 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 */
@@ -416,13 +466,16 @@ Java_hdf_hdf5lib_H5_H5Fget_1obj_1ids
*/
JNIEXPORT jlong JNICALL
Java_hdf_hdf5lib_H5_H5Fget_1obj_1count
- (JNIEnv *env, jclass cls, jlong file_id, jint types)
+ (JNIEnv *env, jclass clss, jlong file_id, jint types)
{
- ssize_t ret_val = H5Fget_obj_count((hid_t)file_id, (unsigned int)types);
+ ssize_t ret_val = -1;
+
+ UNUSED(clss);
- if (ret_val < 0)
- h5libraryError(env);
+ 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 */
@@ -437,9 +490,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 */
@@ -450,13 +506,16 @@ Java_hdf_hdf5lib_H5_H5Fget_1filesize
*/
JNIEXPORT jdouble JNICALL
Java_hdf_hdf5lib_H5_H5Fget_1mdc_1hit_1rate
- (JNIEnv *env, jclass cls, jlong file_id)
+ (JNIEnv *env, jclass clss, jlong file_id)
{
double rate = 0.0;
+ UNUSED(clss);
+
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 */
@@ -467,35 +526,39 @@ Java_hdf_hdf5lib_H5_H5Fget_1mdc_1hit_1rate
*/
JNIEXPORT jint JNICALL
Java_hdf_hdf5lib_H5_H5Fget_1mdc_1size
- (JNIEnv *env, jclass cls, jlong file_id, jlongArray metadata_cache)
+ (JNIEnv *env, jclass clss, 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(clss);
+
+ 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 */
@@ -509,31 +572,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 */
@@ -544,10 +612,15 @@ Java_hdf_hdf5lib_H5_H5Fget_1info
*/
JNIEXPORT void JNICALL
Java_hdf_hdf5lib_H5_H5Freset_1mdc_1hit_1rate_1stats
- (JNIEnv *env, jclass cls, jlong file_id)
+ (JNIEnv *env, jclass clss, jlong file_id)
{
+ UNUSED(clss);
+
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 */
/*
@@ -557,10 +630,15 @@ Java_hdf_hdf5lib_H5_H5Freset_1mdc_1hit_1rate_1stats
*/
JNIEXPORT void JNICALL
Java_hdf_hdf5lib_H5_H5Fclear_1elink_1file_1cache
- (JNIEnv *env, jclass cls, jlong file_id)
+ (JNIEnv *env, jclass clss, jlong file_id)
{
+ UNUSED(clss);
+
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 */
/*
@@ -570,10 +648,15 @@ Java_hdf_hdf5lib_H5_H5Fclear_1elink_1file_1cache
*/
JNIEXPORT void JNICALL
Java_hdf_hdf5lib_H5_H5Fstart_1swmr_1write
- (JNIEnv *env, jclass cls, jlong file_id)
+ (JNIEnv *env, jclass clss, jlong file_id)
{
+ UNUSED(clss);
+
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 */
/*
@@ -583,10 +666,15 @@ Java_hdf_hdf5lib_H5_H5Fstart_1swmr_1write
*/
JNIEXPORT void JNICALL
Java_hdf_hdf5lib_H5_H5Fstart_1mdc_1logging
- (JNIEnv *env, jclass cls, jlong file_id)
+ (JNIEnv *env, jclass clss, jlong file_id)
{
+ UNUSED(clss);
+
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 */
/*
@@ -596,10 +684,15 @@ Java_hdf_hdf5lib_H5_H5Fstart_1mdc_1logging
*/
JNIEXPORT void JNICALL
Java_hdf_hdf5lib_H5_H5Fstop_1mdc_1logging
- (JNIEnv *env, jclass cls, jlong file_id)
+ (JNIEnv *env, jclass clss, jlong file_id)
{
+ UNUSED(clss);
+
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 */
/*
@@ -609,34 +702,40 @@ Java_hdf_hdf5lib_H5_H5Fstop_1mdc_1logging
*/
JNIEXPORT void JNICALL
Java_hdf_hdf5lib_H5_H5Fget_1mdc_1logging_1status
- (JNIEnv *env, jclass cls, jlong file_id, jbooleanArray mdc_logging_status)
+ (JNIEnv *env, jclass clss, 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(clss);
+
+ if (NULL == mdc_logging_status)
+ H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Fget_mdc_logging_status: mdc_logging_status is NULL");
- 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 = 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 (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 */
/*
@@ -648,17 +747,18 @@ JNIEXPORT void JNICALL
Java_hdf_hdf5lib_H5_H5Fset_1dset_1no_1attrs_1hint
(JNIEnv *env, jclass clss, jlong file_id, jboolean minimize)
{
- herr_t retVal = -1;
- hbool_t minimize_val;
+ hbool_t minimize_val;
+ herr_t retVal = FAIL;
- if (minimize == JNI_TRUE)
- minimize_val = TRUE;
- else
- minimize_val = FALSE;
+ UNUSED(clss);
- retVal = H5Fset_dset_no_attrs_hint((hid_t)file_id, (hbool_t)minimize_val);
- if (retVal < 0)
- h5libraryError(env);
+ 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;
}
/*
@@ -670,17 +770,18 @@ JNIEXPORT jboolean JNICALL
Java_hdf_hdf5lib_H5_H5Fget_1dset_1no_1attrs_1hint
(JNIEnv *env, jclass clss, jlong file_id)
{
- hbool_t minimize = FALSE;
- jboolean bval = JNI_FALSE;
+ jboolean bval = JNI_FALSE;
+ hbool_t minimize = FALSE;
- if (H5Fget_dset_no_attrs_hint((hid_t)file_id, (hbool_t *)&minimize) < 0) {
- h5libraryError(env);
- }
- else {
- if (minimize == TRUE)
- bval = JNI_TRUE;
- } /* end else */
+ 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;
}
@@ -693,11 +794,15 @@ JNIEXPORT void JNICALL
Java_hdf_hdf5lib_H5_H5Fset_1libver_1bounds
(JNIEnv *env, jclass clss, jlong file_id, jint low, jint high)
{
- herr_t retVal = -1;
+ 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);
- retVal = H5Fset_libver_bounds((hid_t)file_id, (H5F_libver_t)low, (H5F_libver_t)high);
- if(retVal < 0)
- h5libraryError(env);
+done:
+ return;
} /* end Java_hdf_hdf5lib_H5_H5Fset_1libver_1bounds */
diff --git a/java/src/jni/h5fImp.h b/java/src/jni/h5fImp.h
index fe253f9..fc02c76 100644
--- a/java/src/jni/h5fImp.h
+++ b/java/src/jni/h5fImp.h
@@ -72,7 +72,7 @@ Java_hdf_hdf5lib_H5_H5Fis_1hdf5
* Signature: (Ljava/lang/String;J)Z
*/
JNIEXPORT jboolean JNICALL
-Java_hdf_hdf5lib_H5_H5Fis_1ccessible
+Java_hdf_hdf5lib_H5_H5Fis_1accessible
(JNIEnv*, jclass, jstring, jlong);
/*
@@ -104,6 +104,15 @@ Java_hdf_hdf5lib_H5_H5Fget_1intent
/*
* Class: hdf_hdf5lib_H5
+ * Method: H5Fget_fileno
+ * Signature: (J)J
+ */
+JNIEXPORT jlong JNICALL
+Java_hdf_hdf5lib_H5_H5Fget_1fileno
+ (JNIEnv*, jclass, jlong);
+
+/*
+ * Class: hdf_hdf5lib_H5
* Method: H5Fclose
* Signature: (J)I
*/
diff --git a/java/src/jni/h5gImp.c b/java/src/jni/h5gImp.c
index 42c042a..79b1b65 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;
- retVal = H5Gclose((hid_t)group_id);
- if (retVal < 0)
- h5libraryError(env);
+ UNUSED(clss);
+ 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 */
@@ -125,14 +148,16 @@ Java_hdf_hdf5lib_H5__1H5Gcreate2
*/
JNIEXPORT jlong JNICALL
Java_hdf_hdf5lib_H5__1H5Gcreate_1anon
- (JNIEnv *env, jclass cls, jlong loc_id, jlong gcpl_id, jlong gapl_id)
+ (JNIEnv *env, jclass clss, jlong loc_id, jlong gcpl_id, jlong gapl_id)
{
- hid_t group_id = -1;
+ hid_t group_id = H5I_INVALID_HID;
+
+ UNUSED(clss);
- 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 */
@@ -169,13 +198,16 @@ Java_hdf_hdf5lib_H5__1H5Gopen2
*/
JNIEXPORT jlong JNICALL
Java_hdf_hdf5lib_H5_H5Gget_1create_1plist
- (JNIEnv *env, jclass cls, jlong loc_id)
+ (JNIEnv *env, jclass clss, 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(clss);
+ 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 */
@@ -186,16 +218,20 @@ Java_hdf_hdf5lib_H5_H5Gget_1create_1plist
*/
JNIEXPORT jobject JNICALL
Java_hdf_hdf5lib_H5_H5Gget_1info
- (JNIEnv *env, jclass cls, jlong loc_id)
+ (JNIEnv *env, jclass clss, jlong loc_id)
{
- jobject obj = NULL;
H5G_info_t group_info;
+ jobject obj = NULL;
+
+ UNUSED(clss);
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 */
@@ -206,25 +242,32 @@ Java_hdf_hdf5lib_H5_H5Gget_1info
*/
JNIEXPORT jobject JNICALL
Java_hdf_hdf5lib_H5_H5Gget_1info_1by_1name
- (JNIEnv *env, jclass cls, jlong loc_id, jstring name, jlong lapl_id)
+ (JNIEnv *env, jclass clss, 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(clss);
- 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);
+ if (NULL == name)
+ H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Gget_info_by_name: group name is NULL");
- UNPIN_JAVA_STRING(name, gName);
+ PIN_JAVA_STRING(ENVONLY, name, grpName, NULL, "H5Gget_info_by_name: group name not pinned");
- if (ret_val < 0)
- h5libraryError(env);
- else
- obj = create_H5G_info_t(env, group_info);
+ if ((ret_val = H5Gget_info_by_name((hid_t)loc_id, grpName, &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_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 */
@@ -235,29 +278,36 @@ Java_hdf_hdf5lib_H5_H5Gget_1info_1by_1name
*/
JNIEXPORT jobject JNICALL
Java_hdf_hdf5lib_H5_H5Gget_1info_1by_1idx
- (JNIEnv *env, jclass cls, jlong loc_id, jstring name, jint index_type,
+ (JNIEnv *env, jclass clss, 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(clss);
+
+ 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/java/src/jni/h5pACPLImp.c b/java/src/jni/h5pACPLImp.c
new file mode 100644
index 0000000..f6c14e1
--- /dev/null
+++ b/java/src/jni/h5pACPLImp.c
@@ -0,0 +1,36 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * 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 "h5pACPLImp.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/h5pACPLImp.h b/java/src/jni/h5pACPLImp.h
new file mode 100644
index 0000000..194afc0
--- /dev/null
+++ b/java/src/jni/h5pACPLImp.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_H5PACPL
+#define _Included_hdf_hdf5lib_H5_H5PACPL
+
+#include <jni.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+#ifdef __cplusplus
+} /* 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..2160496
--- /dev/null
+++ b/java/src/jni/h5pFCPLImp.c
@@ -0,0 +1,572 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * 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: 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_INT_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..57fcae8
--- /dev/null
+++ b/java/src/jni/h5pFCPLImp.h
@@ -0,0 +1,207 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * 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: 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/java/src/jni/h5pGAPLImp.c b/java/src/jni/h5pGAPLImp.c
new file mode 100644
index 0000000..9540387
--- /dev/null
+++ b/java/src/jni/h5pGAPLImp.c
@@ -0,0 +1,36 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * 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 "h5pGAPLImp.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/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 ac21d1d..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,2027 +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: 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)
+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)
{
- 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 */
+ const char *cstr = NULL;
+ hid_t class_id = H5I_INVALID_HID;
- return bval;
-} /* end Java_hdf_hdf5lib_H5_H5Pget_1gc_1references */
+ UNUSED(clss);
-/*
- * 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 = -1;
+ create_callback = create_op;
+ close_callback = close_op;
+ copy_callback = copy_op;
- status = H5Pset_btree_ratios((hid_t)plist_id, (double)left,(double)middle, (double)right);
- if (status < 0)
- h5libraryError(env);
+ if (NULL == name)
+ H5_NULL_ARGUMENT_ERROR(ENVONLY, "_H5Pcreate_class: class name is NULL");
- return (jint)status;
-} /* end Java_hdf_hdf5lib_H5_H5Pset_1btree_1ratios */
+ PIN_JAVA_STRING(ENVONLY, name, cstr, NULL, "_H5Pcreate_class: class name not pinned");
-/*
- * 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 ((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);
- return (jint)status;
-} /* end Java_hdf_hdf5lib_H5_H5Pget_1btree_1ratios */
+done:
+ if (cstr)
+ UNPIN_JAVA_STRING(ENVONLY, name, cstr);
-/*
- * 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;
-
- retVal = H5Pset_small_data_block_size((hid_t)plist, (hsize_t)sz);
- if (retVal < 0)
- h5libraryError(env);
-
- 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)
-{
- htri_t bval = JNI_FALSE;
-
- bval = H5Pall_filters_avail((hid_t)dcpl_id);
- if (bval > 0)
- bval = JNI_TRUE;
- else if (bval < 0)
- h5libraryError(env);
-
- return (jboolean)bval;
-} /* end Java_hdf_hdf5lib_H5_H5Pall_1filters_1avail */
-
-/*
- * 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)
+Java_hdf_hdf5lib_H5__1H5Pcreate_1class_1nocb
+ (JNIEnv *env, jclass clss, jlong parent_class, jstring name)
{
- herr_t status = -1;
- jint *cd_valuesP;
- jboolean isCopy;
+ const char *cstr = NULL;
+ hid_t class_id = H5I_INVALID_HID;
- 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);
+ UNUSED(clss);
- ENVPTR->ReleaseIntArrayElements(ENVPAR cd_values, cd_valuesP, JNI_ABORT);
+ if (NULL == name)
+ H5_NULL_ARGUMENT_ERROR(ENVONLY, "_H5Pcreate_class_nocb: class name is NULL");
- if (status < 0)
- h5libraryError(env);
- } /* end else */
- } /* end else */
+ PIN_JAVA_STRING(ENVONLY, name, cstr, NULL, "_H5Pcreate_class_nocb: class name not pinned");
- return (jint)status;
-} /* end Java_hdf_hdf5lib_H5_H5Pmodify_1filter */
+ if ((class_id = H5Pcreate_class((hid_t)parent_class, cstr, NULL, NULL, NULL, NULL, NULL, NULL)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
-/*
- * 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 */
+done:
+ if (cstr)
+ UNPIN_JAVA_STRING(ENVONLY, name, cstr);
- 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 */
+ PIN_JAVA_STRING(ENVONLY, name, cstr, NULL, "H5Pregister2_nocb: property name not pinned");
- return (jint)status;
-} /* end Java_hdf_hdf5lib_H5_H5Pget_1fapl_1family */
-
-/*
- * 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
@@ -2154,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 */
@@ -2179,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 */
@@ -2206,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 */
@@ -2232,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 */
@@ -2249,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 */
@@ -2275,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;
+
+ UNUSED(clss);
- retVal = H5Pget_class_parent((hid_t)plid);
- if (retVal < 0)
- h5libraryError(env);
+ 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 */
@@ -2293,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;
- retVal = H5Pisa_class((hid_t)plid, (hid_t)pcls);
- if (retVal < 0)
- h5libraryError(env);
+ UNUSED(clss);
+ 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 */
@@ -2311,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 */
@@ -2337,2653 +592,193 @@ 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);
- return (jint)retVal;
-} /* end Java_hdf_hdf5lib_H5_H5Pequal */
-
-/*
- * Class: hdf_hdf5lib_H5
- * Method: H5Pcopy_prop
- * Signature: (JJLjava/lang/String;)I
- */
-JNIEXPORT jint JNICALL
-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;
-
- PIN_JAVA_STRING(name, cstr);
- if (cstr != NULL) {
- retVal = H5Pcopy_prop((hid_t)dst_plid, (hid_t)src_plid, cstr);
-
- UNPIN_JAVA_STRING(name, cstr);
-
- if (retVal < 0)
- h5libraryError(env);
- }
+ if ((retVal = H5Pequal((hid_t)plid1, (hid_t)plid2)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+done:
return (jint)retVal;
-} /* end Java_hdf_hdf5lib_H5_H5Pcopy_1prop */
+} /* end Java_hdf_hdf5lib_H5_H5Pequal */
/*
* Class: hdf_hdf5lib_H5
- * Method: H5Premove
- * Signature: (JLjava/lang/String;)I
+ * Method: H5Piterate
+ * Signature: (J[ILjava/lang/Object;Ljava/lang/Object;)I
*/
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Premove
- (JNIEnv *env, jclass clss, jlong 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;
-
- PIN_JAVA_STRING(name, cstr);
- if (cstr != NULL) {
- retVal = H5Premove((hid_t)plid, cstr);
-
- UNPIN_JAVA_STRING(name, cstr);
-
- if (retVal < 0)
- h5libraryError(env);
- }
+ cb_wrapper wrapper = { callback_op, op_data };
+ jboolean isCopy;
+ jint *theArray = NULL;
+ herr_t status = FAIL;
- 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;
+ UNUSED(clss);
- PIN_JAVA_STRING(name, cstr);
- if (cstr != NULL) {
- retVal = H5Punregister((hid_t)plid, cstr);
+ ENVPTR->GetJavaVM(ENVONLY, &jvm);
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
- UNPIN_JAVA_STRING(name, cstr);
+ 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");
- 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_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 */
+} /* end Java_hdf_hdf5lib_H5_H5Piterate */
/*
* Class: hdf_hdf5lib_H5
- * Method: H5Pset_link_creation_order
- * Signature: (JI)I
+ * Method: H5Pcopy_prop
+ * Signature: (JJLjava/lang/String;)I
*/
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Pset_1link_1creation_1order
- (JNIEnv *env, jclass clss, jlong gcpl_id, jint crt_order_flags)
+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_link_creation_order((hid_t)gcpl_id, (unsigned)crt_order_flags);
- if(retVal < 0)
- h5libraryError(env);
+ UNUSED(clss);
- return (jint)retVal;
-} /* end Java_hdf_hdf5lib_H5_H5Pset_1link_1creation_1order */
+ if (NULL == name)
+ H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Pcopy_prop: property name is NULL");
-/*
- * 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;
+ PIN_JAVA_STRING(ENVONLY, name, cstr, NULL, "H5Pcopy_prop: property name not pinned");
- if(H5Pget_attr_creation_order((hid_t)ocpl_id, &crt_order_flags) < 0)
- h5libraryError(env);
+ if ((retVal = H5Pcopy_prop((hid_t)dst_plid, (hid_t)src_plid, cstr)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
- return (jint)crt_order_flags;
-} /* end Java_hdf_hdf5lib_H5_H5Pget_1attr_1creation_1order */
-
-/*
- * 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 = -1;
-
- retVal = H5Pset_attr_creation_order((hid_t)ocpl_id, (unsigned)crt_order_flags);
- if(retVal < 0)
- h5libraryError(env);
+done:
+ if (cstr)
+ UNPIN_JAVA_STRING(ENVONLY, name, cstr);
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)
-{
- herr_t retVal = -1;
-
- 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;
-
- if(H5Pget_copy_object((hid_t)ocp_plist_id, &copy_options) < 0)
- h5libraryError(env);
-
- return (jint)copy_options;
-} /* end Java_hdf_hdf5lib_H5_H5Pget_1copy_1object */
-
-/*
- * 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;
-
- retVal = H5Pset_create_intermediate_group((hid_t)lcpl_id, (unsigned)crt_intermed_group);
- if(retVal < 0)
- h5libraryError(env);
-
- 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;
+ const char *cstr = NULL;
+ herr_t retVal = FAIL;
- /* 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 */
-
- 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
-
- return (jint)retVal;
-} /* end Java_hdf_hdf5lib_H5_H5Pget_1fapl_1direct */
+ PIN_JAVA_STRING(ENVONLY, name, cstr, NULL, "H5Punregister: property name not pinned");
-/*
- * 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;
-
- retVal = H5Pset_fapl_stdio((hid_t) fapl_id);
- if (retVal < 0)
- h5libraryError(env);
-
- return (jint)retVal;
-} /* end Java_hdf_hdf5lib_H5_H5Pset_1fapl_1stdio */
+ herr_t retVal = FAIL;
-/*
- * 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;
+ UNUSED(clss);
-#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 */
-
-/*
- * 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)
-{
- 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);
-
- if (retVal < 0)
- h5libraryError(env);
- }
-} /* 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 (H5Pset_meta_block_size((hid_t)plist, (hsize_t)sz) < 0)
- h5libraryError(env);
-} /* 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;
-
- 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);
-
- 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 */
-
-/*
- * 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 */
-
-/*
- * 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)
-{
- 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 */
-
- if (rdcc_nslotsArray != NULL) {
- ENVPTR->ReleaseLongArrayElements(ENVPAR rdcc_nslots, rdcc_nslotsArray, 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 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 (H5Pset_obj_track_times((hid_t)objplid, track) < 0)
- h5libraryError(env);
-} /* end Java_hdf_hdf5lib_H5_H5Pset_1obj_1track_1times */
-
-/*
- * 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;
-
- if (H5Pget_char_encoding((hid_t)acpl, &encoding) < 0)
- h5libraryError(env);
-
- return encoding;
-} /* end Java_hdf_hdf5lib_H5_H5Pget_1char_1encoding */
-
-/*
- * 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 */
-
-/*
- * 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)
-{
- 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);
-
- if (retVal < 0)
- h5libraryError(env);
- }
-} /* 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 */
-
-/*
- * 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;
-
- space_id = H5Pget_virtual_srcspace((hid_t)dcpl_id, (size_t)index);
- if (space_id < 0)
- h5libraryError(env);
-
- return (jlong)space_id;
-} /* end Java_hdf_hdf5lib_H5_H5Pget_1virtual_1srcspace */
-
-/*
- * 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 */
-
-/*
- * 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)
-{
- 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 */
-
-/*
- * 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 (H5Pget_virtual_view((hid_t)dapl_id, &virtual_view) < 0)
- h5libraryError(env);
-
- return (jint)virtual_view;
-} /* end Java_hdf_hdf5lib_H5_H5Pget_1virtual_1view */
-
-/*
- * 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 */
-
-/*
- * 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;
-
- if (H5Pget_virtual_printf_gap((hid_t)dapl_id, &gap_size) < 0)
- h5libraryError(env);
-
- return (jlong)gap_size;
-} /* end Java_hdf_hdf5lib_H5_H5Pget_1virtual_1printf_1gap */
+} /* end Java_hdf_hdf5lib_H5__1H5Pclose_1class */
-/*
- * 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_cls_create_cb
+ (hid_t prop_id, void *create_data)
{
- 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;
+ JNIEnv *cbenv = NULL;
+ jclass cls;
+ 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_cls_create_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, create_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 (status < 0)
- h5libraryError(env);
-
- return (jboolean)thepersist;
-} /* 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)
-{
- herr_t status = -1;
- hsize_t thethreshold;
-
- status = H5Pget_file_space_strategy((hid_t)fcpl_id, NULL, NULL, &thethreshold);
+ if (NULL == (mid = CBENVPTR->GetMethodID(CBENVONLY, cls, "callback", "(JLhdf/hdf5lib/callbacks/H5P_cls_create_func_t;)I")))
+ CHECK_JNI_EXCEPTION(CBENVONLY, JNI_FALSE);
- if (status < 0)
- h5libraryError(env);
+ status = CBENVPTR->CallIntMethod(CBENVONLY, create_callback, mid, prop_id, create_data);
+ CHECK_JNI_EXCEPTION(CBENVONLY, JNI_FALSE);
- 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 */
@@ -4991,966 +786,332 @@ static herr_t
H5P_cls_copy_cb
(hid_t new_prop_id, hid_t old_prop_id, void *copy_data)
{
- 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;
+ JNIEnv *cbenv = NULL;
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 */
+ jint status = -1;
-/*
- * 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;
+ 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");
+ }
- PIN_JAVA_STRING(location, lstr);
+ if (NULL == (cls = CBENVPTR->GetObjectClass(CBENVONLY, copy_callback)))
+ CHECK_JNI_EXCEPTION(CBENVONLY, JNI_FALSE);
- retVal = H5Pset_mdc_log_options((hid_t)fapl_id, (hbool_t)is_enabled, lstr, (hbool_t)start_on_access);
+ if (NULL == (mid = CBENVPTR->GetMethodID(CBENVONLY, cls, "callback", "(JJLhdf/hdf5lib/callbacks/H5P_cls_copy_func_t;)I")))
+ CHECK_JNI_EXCEPTION(CBENVONLY, JNI_FALSE);
- UNPIN_JAVA_STRING(location, lstr);
+ status = CBENVPTR->CallIntMethod(CBENVONLY, copy_callback, mid, new_prop_id, old_prop_id, copy_data);
+ CHECK_JNI_EXCEPTION(CBENVONLY, JNI_FALSE);
- if (retVal < 0) {
- h5libraryError(env);
- }
-} /* end Java_hdf_hdf5lib_H5_H5Pset_1mdc_1log_1options */
+done:
+ if (cbenv)
+ JVMPTR->DetachCurrentThread(JVMPAR);
-/*
- * 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 */
+ return (herr_t)status;
+} /* end H5P_cls_copy_cb */
static herr_t
-H5D_append_cb
- (hid_t dataset_id, hsize_t *cur_dims, void *cb_data)
+H5P_cls_close_cb
+ (hid_t prop_id, void *close_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;
+ JNIEnv *cbenv = NULL;
+ jclass cls;
+ jint status = -1;
- if(JVMPTR->AttachCurrentThread(JVMPAR2 (void**)&cbenv, NULL) != 0) {
- 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);
+ 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");
+ }
- return (herr_t)status;
-} /* end H5D_append_cb */
+ if (NULL == (cls = CBENVPTR->GetObjectClass(CBENVONLY, close_callback)))
+ CHECK_JNI_EXCEPTION(CBENVONLY, JNI_FALSE);
-/*
- * 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};
+ if (NULL == (mid = CBENVPTR->GetMethodID(CBENVONLY, cls, "callback", "(JLhdf/hdf5lib/callbacks/H5P_cls_close_func_t;)I")))
+ CHECK_JNI_EXCEPTION(CBENVONLY, JNI_FALSE);
- ENVPTR->GetJavaVM(ENVPAR &jvm);
+ status = CBENVPTR->CallIntMethod(CBENVONLY, close_callback, mid, prop_id, close_data);
+ CHECK_JNI_EXCEPTION(CBENVONLY, JNI_FALSE);
- 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);
+done:
+ if (cbenv)
+ JVMPTR->DetachCurrentThread(JVMPAR);
- if (status < 0)
- h5libraryError(env);
- } /* end else */
-} /* end Java_hdf_hdf5lib_H5_H5Pset_1append_1flush */
+ return (herr_t)status;
+} /* end H5P_cls_close_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_create_cb
+ (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_create_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, create_callback)))
+ CHECK_JNI_EXCEPTION(CBENVONLY, JNI_FALSE);
- UNPIN_JAVA_STRING(name, cstr);
+ if (NULL == (mid = CBENVPTR->GetMethodID(CBENVONLY, cls, "callback", "(Ljava/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, create_callback, mid, 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 */
static herr_t
-H5P_prp_copy_cb
- (const char *name, size_t size, void *value)
+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;
+ 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_set_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, set_callback)))
+ CHECK_JNI_EXCEPTION(CBENVONLY, JNI_FALSE);
- 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 */
+ if (NULL == (mid = CBENVPTR->GetMethodID(CBENVONLY, cls, "callback", "(JLjava/lang/String;J[B)I")))
+ CHECK_JNI_EXCEPTION(CBENVONLY, JNI_FALSE);
-static int
-H5P_prp_compare_cb
- (void *value1, void *value2, size_t size)
-{
- JNIEnv *cbenv;
- jint status = -1;
- jclass cls;
- jmethodID mid;
+ if (NULL == (str = CBENVPTR->NewStringUTF(CBENVONLY, name)))
+ CHECK_JNI_EXCEPTION(CBENVONLY, JNI_FALSE);
+
+ status = CBENVPTR->CallIntMethod(CBENVONLY, set_callback, mid, prop_id, 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 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 */
+} /* end H5P_prp_set_cb */
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;
+ jclass cls;
+ JNIEnv *cbenv = NULL;
+ jint status = -1;
- 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 (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");
+ }
-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;
+ if (NULL == (cls = CBENVPTR->GetObjectClass(CBENVONLY, get_callback)))
+ CHECK_JNI_EXCEPTION(CBENVONLY, JNI_FALSE);
+
+ if (NULL == (mid = CBENVPTR->GetMethodID(CBENVONLY, cls, "callback", "(JLjava/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, get_callback, mid, prop_id, 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 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_get_cb */
static herr_t
H5P_prp_delete_cb
(hid_t prop_id, 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_delete_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, delete_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", "(JLjava/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, delete_callback, mid, prop_id, 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_delete_cb */
static herr_t
-H5P_iterate_cb
- (hid_t prop_id, const char *name, void *cb_data)
+H5P_prp_copy_cb
+ (const char *name, size_t size, void *value)
{
- 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;
+ jclass cls;
+ JNIEnv *cbenv = NULL;
+ jint status = -1;
- /* 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); */
+ 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");
+ }
- return status;
-} /* end H5P_iterate_cb */
+ if (NULL == (cls = CBENVPTR->GetObjectClass(CBENVONLY, copy_callback)))
+ CHECK_JNI_EXCEPTION(CBENVONLY, JNI_FALSE);
-/*
- * 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 */
+ if (NULL == (mid = CBENVPTR->GetMethodID(CBENVONLY, cls, "callback", "(Ljava/lang/String;J[B)I")))
+ CHECK_JNI_EXCEPTION(CBENVONLY, JNI_FALSE);
- return (jint)status;
-} /* end Java_hdf_hdf5lib_H5_H5Piterate */
+ if (NULL == (str = CBENVPTR->NewStringUTF(CBENVONLY, name)))
+ CHECK_JNI_EXCEPTION(CBENVONLY, JNI_FALSE);
-/*
- * 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);
+ status = CBENVPTR->CallIntMethod(CBENVONLY, copy_callback, mid, str, size, value);
+ CHECK_JNI_EXCEPTION(CBENVONLY, JNI_FALSE);
- 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 */
+done:
+ if (cbenv)
+ JVMPTR->DetachCurrentThread(JVMPAR);
+ return (herr_t)status;
+} /* end H5P_prp_copy_cb */
-/*
- * 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)
+static int
+H5P_prp_compare_cb
+ (void *value1, void *value2, size_t size)
{
- 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);
+ jmethodID mid;
+ jclass cls;
+ JNIEnv *cbenv = NULL;
+ 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_prp_compare_cb: failed to attach current thread to JVM");
}
-} /* 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;
+ if (NULL == (cls = CBENVPTR->GetObjectClass(CBENVONLY, compare_callback)))
+ CHECK_JNI_EXCEPTION(CBENVONLY, JNI_FALSE);
- PIN_JAVA_STRING(prefix, aName);
- if (aName != NULL) {
- retVal = H5Pset_efile_prefix((hid_t)dapl_id, aName);
+ if (NULL == (mid = CBENVPTR->GetMethodID(CBENVONLY, cls, "callback", "([B[BJ)I")))
+ CHECK_JNI_EXCEPTION(CBENVONLY, JNI_FALSE);
- UNPIN_JAVA_STRING(prefix, aName);
+ status = CBENVPTR->CallIntMethod(CBENVONLY, compare_callback, mid, value1, value2, size);
+ CHECK_JNI_EXCEPTION(CBENVONLY, JNI_FALSE);
- if(retVal < 0)
- h5libraryError(env);
- }
-} /* end Java_hdf_hdf5lib_H5_H5Pset_1efile_1prefix */
+done:
+ if (cbenv)
+ JVMPTR->DetachCurrentThread(JVMPAR);
-/*
- * 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 */
+ return (herr_t)status;
+} /* end H5P_prp_compare_cb */
-/*
- * 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)
+static herr_t
+H5P_prp_close_cb
+ (const char *name, size_t size, void *value)
{
- herr_t retVal = -1;
- hbool_t evict_on_close_val;
+ jmethodID mid;
+ jstring str;
+ jclass cls;
+ JNIEnv *cbenv = NULL;
+ jint status = -1;
- if (evict_on_close == JNI_TRUE)
- evict_on_close_val = TRUE;
- else
- evict_on_close_val = FALSE;
+ 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");
+ }
- 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 */
+ if (NULL == (cls = CBENVPTR->GetObjectClass(CBENVONLY, close_callback)))
+ CHECK_JNI_EXCEPTION(CBENVONLY, JNI_FALSE);
-/*
- * 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 (NULL == (mid = CBENVPTR->GetMethodID(CBENVONLY, cls, "callback", "(Ljava/lang/String;J[B)I")))
+ CHECK_JNI_EXCEPTION(CBENVONLY, 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 */
+ if (NULL == (str = CBENVPTR->NewStringUTF(CBENVONLY, name)))
+ CHECK_JNI_EXCEPTION(CBENVONLY, JNI_FALSE);
- return bval;
-} /* end Java_hdf_hdf5lib_H5_H5Pget_1evict_1on_1close */
+ status = CBENVPTR->CallIntMethod(CBENVONLY, close_callback, mid, str, size, value);
+ CHECK_JNI_EXCEPTION(CBENVONLY, JNI_FALSE);
-/*
- * 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;
+done:
+ if (cbenv)
+ JVMPTR->DetachCurrentThread(JVMPAR);
- retVal = H5Pset_chunk_opts((hid_t)dcpl_id, (unsigned)opts);
- if (retVal < 0)
- h5libraryError(env);
-} /* end Java_hdf_hdf5lib_H5_H5Pset_1chunk_1opts */
+ return (herr_t)status;
+} /* end H5P_prp_close_cb */
-/*
- * 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)
+static herr_t
+H5P_iterate_cb
+ (hid_t prop_id, const char *name, void *cb_data)
{
- unsigned opts = 0;
-
- if (H5Pget_chunk_opts((hid_t)dcpl_id, opts) < 0)
- h5libraryError(env);
+ 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;
- return (jint)opts;
-} /* end Java_hdf_hdf5lib_H5_H5Pget_1chunk_1opts */
+ 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");
+ }
-/*
- * 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)
-{
- herr_t retVal = -1;
- hbool_t minimize_val;
+ if (NULL == (cls = CBENVPTR->GetObjectClass(CBENVONLY, visit_callback)))
+ CHECK_JNI_EXCEPTION(CBENVONLY, JNI_FALSE);
- if (minimize == JNI_TRUE)
- minimize_val = TRUE;
- else
- minimize_val = FALSE;
+ 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_dset_no_attrs_hint((hid_t)dcpl_id, (hbool_t)minimize_val);
- if (retVal < 0)
- h5libraryError(env);
-}
+ if (NULL == (str = CBENVPTR->NewStringUTF(CBENVONLY, name)))
+ CHECK_JNI_EXCEPTION(CBENVONLY, JNI_FALSE);
-/*
- * 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;
+ status = CBENVPTR->CallIntMethod(CBENVONLY, visit_callback, mid, prop_id, str, op_data);
+ CHECK_JNI_EXCEPTION(CBENVONLY, JNI_FALSE);
- if (H5Pget_dset_no_attrs_hint((hid_t)dcpl_id, (hbool_t *)&minimize) < 0) {
- h5libraryError(env);
- }
- else {
- if (minimize == TRUE)
- bval = JNI_TRUE;
- } /* end else */
+done:
+ if (cbenv)
+ JVMPTR->DetachCurrentThread(JVMPAR);
- return bval;
-}
+ 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 056c569..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,570 +51,74 @@ Java_hdf_hdf5lib_H5__1H5Pcopy
/*
* 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
+ * TODO: H5Pencode
*/
-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
- */
-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
@@ -707,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
*/
@@ -741,889 +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);
-
-/*
- * 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);
-
-
#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/java/src/jni/h5pLCPLImp.c b/java/src/jni/h5pLCPLImp.c
new file mode 100644
index 0000000..7c79796
--- /dev/null
+++ b/java/src/jni/h5pLCPLImp.c
@@ -0,0 +1,36 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * 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 "h5pLCPLImp.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/java/src/jni/h5pOCpyPLImp.h b/java/src/jni/h5pOCpyPLImp.h
new file mode 100644
index 0000000..f1dca58
--- /dev/null
+++ b/java/src/jni/h5pOCpyPLImp.h
@@ -0,0 +1,61 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * 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_H5POCpyPL
+#define _Included_hdf_hdf5lib_H5_H5POCpyPL
+
+#include <jni.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+/*
+ * 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);
+
+/*
+ * 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 */
+
+#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..eedd42e 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 */
@@ -1189,45 +1129,39 @@ Java_hdf_hdf5lib_H5_H5Sget_1select_1bounds
*/
JNIEXPORT jbyteArray JNICALL
Java_hdf_hdf5lib_H5_H5Sencode
- (JNIEnv *env, jclass cls, jlong obj_id)
+ (JNIEnv *env, jclass clss, 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(clss);
+
+ if (obj_id < 0)
+ H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Sencode: invalid object ID");
+
+ if ((status = H5Sencode2(obj_id, NULL, &buf_size, H5P_DEFAULT)) < 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 = H5Sencode2((hid_t) obj_id, bufPtr, &buf_size, H5P_DEFAULT)) < 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 */
@@ -1239,29 +1173,25 @@ Java_hdf_hdf5lib_H5_H5Sencode
*/
JNIEXPORT jlong JNICALL
Java_hdf_hdf5lib_H5_H5Sdecode
- (JNIEnv *env, jclass cls, jbyteArray buf)
+ (JNIEnv *env, jclass clss, 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(clss);
+
+ 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 */
@@ -1273,16 +1203,18 @@ Java_hdf_hdf5lib_H5_H5Sdecode
*/
JNIEXPORT jboolean JNICALL
Java_hdf_hdf5lib_H5_H5Sis_1regular_1hyperslab
- (JNIEnv *env, jclass cls, jlong obj_id)
+ (JNIEnv *env, jclass clss, jlong obj_id)
{
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(clss);
+ 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..460f12e 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,96 +1575,92 @@ 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 */
/*
* Class: hdf_hdf5lib_H5
- * Method: H5Tarray_get_dims2
+ * Method: H5Tget_array_dims2
* Signature: (J[J)I
*/
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..af83caa 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 */
/*
@@ -3019,70 +3453,64 @@ obj_info_max
*/
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)
+ (JNIEnv *env, jclass clss, 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(clss);
- 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/h5vlImp.c b/java/src/jni/h5vlImp.c
index 89ea703..92e456e 100644
--- a/java/src/jni/h5vlImp.c
+++ b/java/src/jni/h5vlImp.c
@@ -21,9 +21,9 @@
extern "C" {
#endif /* __cplusplus */
-#include "hdf5.h"
#include <jni.h>
#include <stdlib.h>
+#include "hdf5.h"
#include "h5jni.h"
#include "h5vlImp.h"
@@ -36,18 +36,22 @@ JNIEXPORT jlong JNICALL
Java_hdf_hdf5lib_H5_H5VLregister_1connector_1by_1name
(JNIEnv *env, jclass clss, jobject connector_name, jlong vipl_id)
{
- hid_t status = -1;
- const char *vlName;
+ const char *volName = NULL;
+ hid_t status = H5I_INVALID_HID;
- PIN_JAVA_STRING(connector_name, vlName);
- if (vlName != NULL) {
- status = H5VLregister_connector_by_name(vlName, (hid_t)vipl_id);
+ UNUSED(clss);
- UNPIN_JAVA_STRING(connector_name, vlName);
+ if (NULL == connector_name)
+ H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5VLregister_connector_by_name: VOL connector name is NULL");
- if (status < 0)
- h5libraryError(env);
- }
+ PIN_JAVA_STRING(ENVONLY, connector_name, volName, NULL, "H5VLregister_connector_by_name: VOL connector name not pinned");
+
+ if ((status = H5VLregister_connector_by_name(volName, (hid_t)vipl_id)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+done:
+ if (volName)
+ UNPIN_JAVA_STRING(ENVONLY, connector_name, volName);
return (jlong)status;
} /* end Java_hdf_hdf5lib_H5_H5VLregister_1connector_1by_1name */
@@ -61,11 +65,14 @@ JNIEXPORT jlong JNICALL
Java_hdf_hdf5lib_H5_H5VLregister_1connector_1by_1value
(JNIEnv *env, jclass clss, jint connector_value, jlong vipl_id)
{
- hid_t status = H5VLregister_connector_by_value((H5VL_class_value_t)connector_value, (hid_t)vipl_id);
+ hid_t status = H5I_INVALID_HID;
+
+ UNUSED(clss);
- if (status < 0)
- h5libraryError(env);
+ if ((status = H5VLregister_connector_by_value((H5VL_class_value_t)connector_value, (hid_t)vipl_id)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+done:
return (jlong)status;
} /* end Java_hdf_hdf5lib_H5_H5VLregister_1connector_1by_1value */
@@ -78,20 +85,24 @@ JNIEXPORT jboolean JNICALL
Java_hdf_hdf5lib_H5_H5VLis_1connector_1registered
(JNIEnv *env, jclass clss, jobject connector_name)
{
+ const char *volName = NULL;
htri_t bval = JNI_FALSE;
- const char *vlName;
- PIN_JAVA_STRING(connector_name, vlName);
- if (vlName != NULL) {
- bval = H5VLis_connector_registered(vlName);
+ UNUSED(clss);
- UNPIN_JAVA_STRING(connector_name, vlName);
+ if (NULL == connector_name)
+ H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5VLis_connector_registered: VOL connector name is NULL");
- if (bval > 0)
- bval = JNI_TRUE;
- else if (bval < 0)
- h5libraryError(env);
- }
+ PIN_JAVA_STRING(ENVONLY, connector_name, volName, NULL, "H5VLis_connector_registered: VOL connector name not pinned");
+
+ if ((bval = H5VLis_connector_registered(volName)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+ bval = (bval > 0) ? JNI_TRUE : JNI_FALSE;
+
+done:
+ if (volName)
+ UNPIN_JAVA_STRING(ENVONLY, connector_name, volName);
return (jboolean)bval;
} /* end Java_hdf_hdf5lib_H5_H5VLis_1connector_1registered */
@@ -105,18 +116,22 @@ JNIEXPORT jlong JNICALL
Java_hdf_hdf5lib_H5_H5VLget_1connector_1id
(JNIEnv *env, jclass clss, jobject connector_name)
{
- hid_t status = -1;
- const char *vlName;
+ const char *volName = NULL;
+ hid_t status = H5I_INVALID_HID;
- PIN_JAVA_STRING(connector_name, vlName);
- if (vlName != NULL) {
- status = H5VLget_connector_id(vlName);
+ UNUSED(clss);
- UNPIN_JAVA_STRING(connector_name, vlName);
+ if (NULL == connector_name)
+ H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5VLget_connector_id: VOL connector name is NULL");
- if (status < 0)
- h5libraryError(env);
- }
+ PIN_JAVA_STRING(ENVONLY, connector_name, volName, NULL, "H5VLget_connector_id: VOL connector name not pinned");
+
+ if ((status = H5VLget_connector_id(volName)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+done:
+ if (volName)
+ UNPIN_JAVA_STRING(ENVONLY, connector_name, volName);
return (jlong)status;
} /* end Java_hdf_hdf5lib_H5_H5VLget_1connector_1id */
@@ -131,41 +146,31 @@ JNIEXPORT jobject JNICALL
Java_hdf_hdf5lib_H5_H5VLget_1connector_1name
(JNIEnv *env, jclass clss, jlong object_id)
{
- char *vlName;
- ssize_t buf_size;
- ssize_t status;
+ ssize_t buf_size, status;
+ char *volName = NULL;
jstring str = NULL;
- /* get the length of the comment */
- buf_size = H5VLget_connector_name((hid_t)object_id, NULL, 0);
- if (buf_size < 0) {
- H5Eprint2(H5E_DEFAULT, NULL);
-
- h5badArgument(env, "H5VLget_connector_name: buf_size < 0");
- } /* end if */
- else if (buf_size > 0) {
- buf_size++; /* add extra space for the null terminator */
- vlName = (char *)HDmalloc(sizeof(char) * (size_t)buf_size);
- if (vlName == NULL) {
- /* exception -- out of memory */
- h5outOfMemory(env, "H5VLget_connector_name: malloc failed");
- } /* end if */
- else {
- status = H5VLget_connector_name((hid_t)object_id, vlName, (size_t)buf_size);
-
- if (status < 0) {
- h5libraryError(env);
- } /* end if */
- else {
- /* may throw OutOfMemoryError */
- str = ENVPTR->NewStringUTF(ENVPAR vlName);
- if (str == NULL) {
- h5JNIFatalError(env, "H5VLget_connector_name: return string not allocated");
- } /* end if */
- } /* end else */
- HDfree(vlName);
- }
- } /* end else if */
+ UNUSED(clss);
+
+ /* Get the length of the comment */
+ if ((buf_size = H5VLget_connector_name((hid_t)object_id, NULL, 0)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+ if (buf_size > 0) {
+ if (NULL == (volName = (char *) HDmalloc(sizeof(char) * (size_t)buf_size + 1)))
+ H5_JNI_FATAL_ERROR(ENVONLY, "H5VLget_connector_name: failed to allocated VOL connector name buffer");
+
+ if ((status = H5VLget_connector_name((hid_t)object_id, volName, (size_t)buf_size + 1)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+ volName[buf_size] = '\0';
+
+ if (NULL == (str = ENVPTR->NewStringUTF(ENVONLY, volName)))
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
+ }
+
+done:
+ if (volName)
+ HDfree(volName);
return (jstring)str;
} /* end Java_hdf_hdf5lib_H5_H5VLget_1connector_1name */
@@ -179,10 +184,15 @@ JNIEXPORT void JNICALL
Java_hdf_hdf5lib_H5_H5VLclose
(JNIEnv *env, jclass clss, jlong connector_id)
{
- herr_t retValue = H5VLclose((hid_t)connector_id);
+ herr_t retValue = FAIL;
+
+ UNUSED(clss);
+
+ if ((retValue = H5VLclose((hid_t)connector_id)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
- if (retValue < 0)
- h5libraryError(env);
+done:
+ return;
} /* end Java_hdf_hdf5lib_H5_H5VLclose */
/*
@@ -194,10 +204,15 @@ JNIEXPORT void JNICALL
Java_hdf_hdf5lib_H5_H5VLunregister_1connector
(JNIEnv *env, jclass clss, jlong connector_id)
{
- herr_t retValue = H5VLunregister_connector((hid_t)connector_id);
+ herr_t retValue = FAIL;
+
+ UNUSED(clss);
+
+ if ((retValue = H5VLunregister_connector((hid_t)connector_id)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
- if (retValue < 0)
- h5libraryError(env);
+done:
+ return;
} /* end Java_hdf_hdf5lib_H5_H5VLunregister_1connector */
diff --git a/java/src/jni/h5vlImp.h b/java/src/jni/h5vlImp.h
index af824a9..207efa5 100644
--- a/java/src/jni/h5vlImp.h
+++ b/java/src/jni/h5vlImp.h
@@ -44,7 +44,7 @@ Java_hdf_hdf5lib_H5_H5VLregister_1connector_1by_1value
* Signature: (Ljava/lang/String;)Z
*/
JNIEXPORT jboolean JNICALL
-Java_hdf_hdf5lib_H5_H5VLis_connector_registered
+Java_hdf_hdf5lib_H5_H5VLis_1connector_1registered
(JNIEnv *, jclass, jobject);
/*
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/TestH5.java b/java/test/TestH5.java
index 54603ca..d63ef01 100644
--- a/java/test/TestH5.java
+++ b/java/test/TestH5.java
@@ -162,7 +162,7 @@ public class TestH5 {
*/
@Test
public void testH5get_libversion() {
- int libversion[] = { 1, 11, 4 };
+ int libversion[] = { 1, 11, 6 };
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 = 11, relnum = 4;
+ int majnum = 1, minnum = 11, relnum = 6;
try {
H5.H5check_version(majnum, minnum, relnum);
diff --git a/java/test/TestH5A.java b/java/test/TestH5A.java
index 536364c..7d336e1 100644
--- a/java/test/TestH5A.java
+++ b/java/test/TestH5A.java
@@ -50,6 +50,7 @@ public class TestH5A {
long type_id = -1;
long space_id = -1;
long lapl_id = -1;
+ long aapl_id = -1;
private final void _deleteFile(String filename) {
File file = new File(filename);
@@ -90,8 +91,10 @@ public class TestH5A {
assertTrue("TestH5A.createH5file: _createDataset: ", H5did > 0);
space_id = H5.H5Screate(HDF5Constants.H5S_NULL);
assertTrue(space_id > 0);
- lapl_id = H5.H5Pcreate(HDF5Constants.H5P_ATTRIBUTE_ACCESS);
+ lapl_id = H5.H5Pcreate(HDF5Constants.H5P_LINK_ACCESS);
assertTrue(lapl_id > 0);
+ aapl_id = H5.H5Pcreate(HDF5Constants.H5P_ATTRIBUTE_ACCESS);
+ assertTrue(aapl_id > 0);
type_id = H5.H5Tenum_create(HDF5Constants.H5T_STD_I32LE);
assertTrue(type_id > 0);
int status = H5.H5Tenum_insert(type_id, "test", 1);
@@ -122,6 +125,8 @@ public class TestH5A {
try {H5.H5Sclose(space_id);} catch (Exception ex) {}
if (lapl_id > 0)
try {H5.H5Pclose(lapl_id);} catch (Exception ex) {}
+ if (aapl_id > 0)
+ try {H5.H5Pclose(aapl_id);} catch (Exception ex) {}
System.out.println();
}
@@ -194,7 +199,6 @@ public class TestH5A {
long n = 0;
long attr_id = -1;
long attribute_id = -1;
- long aapl_id = HDF5Constants.H5P_DEFAULT;
try {
attr_id = H5.H5Acreate(H5did, "file", type_id, space_id,
@@ -203,7 +207,7 @@ public class TestH5A {
// Opening the existing attribute, obj_name(Created by H5ACreate2)
// by index, attached to an object identifier.
attribute_id = H5.H5Aopen_by_idx(H5did, ".", HDF5Constants.H5_INDEX_CRT_ORDER, HDF5Constants.H5_ITER_INC,
- 0, HDF5Constants.H5P_DEFAULT, lapl_id);
+ 0, aapl_id, lapl_id);
assertTrue("testH5Aopen_by_idx: H5Aopen_by_idx", attribute_id >= 0);
@@ -258,7 +262,7 @@ public class TestH5A {
try {
attribute_id = H5.H5Acreate_by_name(H5fid, obj_name, attr_name,
type_id, space_id, HDF5Constants.H5P_DEFAULT,
- HDF5Constants.H5P_DEFAULT, lapl_id);
+ aapl_id, lapl_id);
assertTrue("testH5Acreate_by_name: H5Acreate_by_name",
attribute_id >= 0);
@@ -289,7 +293,7 @@ public class TestH5A {
boolean bool_val = false;
try {
- attr_id = H5.H5Acreate(loc_id, old_attr_name, type_id, space_id, HDF5Constants.H5P_DEFAULT, lapl_id);
+ attr_id = H5.H5Acreate(loc_id, old_attr_name, type_id, space_id, HDF5Constants.H5P_DEFAULT, aapl_id);
ret_val = H5.H5Arename(loc_id, old_attr_name, new_attr_name);
@@ -328,7 +332,7 @@ public class TestH5A {
try {
attr_id = H5.H5Acreate_by_name(loc_id, obj_name, old_attr_name,
- type_id, space_id, HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT, lapl_id);
+ type_id, space_id, HDF5Constants.H5P_DEFAULT, aapl_id, lapl_id);
ret_val = H5.H5Arename_by_name(loc_id, obj_name, old_attr_name,
new_attr_name, lapl_id);
@@ -369,7 +373,7 @@ public class TestH5A {
try {
attribute_id = H5.H5Acreate_by_name(H5fid, obj_name, attr_name,
type_id, space_id, HDF5Constants.H5P_DEFAULT,
- HDF5Constants.H5P_DEFAULT, lapl_id);
+ aapl_id, lapl_id);
assertTrue("testH5Aget_name: H5Acreate_by_name ", attribute_id > 0);
ret_name = H5.H5Aget_name(attribute_id);
assertEquals(ret_name, attr_name);
diff --git a/java/test/TestH5Edefault.java b/java/test/TestH5Edefault.java
index 591793f..ee2850b 100644
--- a/java/test/TestH5Edefault.java
+++ b/java/test/TestH5Edefault.java
@@ -243,7 +243,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/TestH5F.java b/java/test/TestH5F.java
index e4f9a30..869b45c 100644
--- a/java/test/TestH5F.java
+++ b/java/test/TestH5F.java
@@ -14,6 +14,7 @@
package test;
import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotEquals;
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;
@@ -32,6 +33,7 @@ import org.junit.rules.TestName;
public class TestH5F {
@Rule public TestName testname = new TestName();
private static final String H5_FILE = "testF.h5";
+ private static final String H5_FILE2 = "testF2.h5";
private static final int COUNT_OBJ_FILE = 1;
private static final int COUNT_OBJ_DATASET = 0;
@@ -94,28 +96,12 @@ public class TestH5F {
@Test(expected = HDF5LibraryException.class)
public void testH5Fget_create_plist_closed() throws Throwable {
- long fid = -1;
-
if (H5fid > 0) {
try {H5.H5Fclose(H5fid);} catch (Exception ex) {}
- H5fid = -1;
- }
-
- try {
- fid = H5.H5Fopen(H5_FILE, HDF5Constants.H5F_ACC_RDWR,
- HDF5Constants.H5P_DEFAULT);
- }
- catch (Throwable err) {
- fail("H5.H5Fopen: " + err);
- }
- try {
- H5.H5Fclose(fid);
- }
- catch (Exception ex) {
}
// it should fail because the file was closed.
- H5.H5Fget_create_plist(fid);
+ H5.H5Fget_create_plist(H5fid);
}
@Test
@@ -134,34 +120,17 @@ public class TestH5F {
@Test(expected = HDF5LibraryException.class)
public void testH5Fget_access_plist_closed() throws Throwable {
- long fid = -1;
-
if (H5fid > 0) {
try {H5.H5Fclose(H5fid);} catch (Exception ex) {}
- H5fid = -1;
- }
-
- try {
- fid = H5.H5Fopen(H5_FILE, HDF5Constants.H5F_ACC_RDWR,
- HDF5Constants.H5P_DEFAULT);
- }
- catch (Throwable err) {
- fail("H5.H5Fopen: " + err);
- }
- try {
- H5.H5Fclose(fid);
- }
- catch (Exception ex) {
}
// it should fail because the file was closed.
- H5.H5Fget_access_plist(fid);
+ H5.H5Fget_access_plist(H5fid);
}
@Test
public void testH5Fget_intent_rdwr() {
int intent = 0;
- long fid = -1;
if (H5fid > 0) {
try {H5.H5Fclose(H5fid);} catch (Exception ex) {}
@@ -169,31 +138,24 @@ public class TestH5F {
}
try {
- fid = H5.H5Fopen(H5_FILE, HDF5Constants.H5F_ACC_RDWR,
+ H5fid = H5.H5Fopen(H5_FILE, HDF5Constants.H5F_ACC_RDWR,
HDF5Constants.H5P_DEFAULT);
}
catch (Throwable err) {
fail("H5.H5Fopen: " + err);
}
try {
- intent = H5.H5Fget_intent(fid);
+ intent = H5.H5Fget_intent(H5fid);
}
catch (Throwable err) {
fail("H5.H5Fget_intent: " + err);
}
assertEquals(HDF5Constants.H5F_ACC_RDWR, intent);
-
- try {
- H5.H5Fclose(fid);
- }
- catch (Exception ex) {
- }
}
@Test
public void testH5Fget_intent_rdonly() {
int intent = 0;
- long fid = -1;
if (H5fid > 0) {
try {H5.H5Fclose(H5fid);} catch (Exception ex) {}
@@ -201,24 +163,76 @@ public class TestH5F {
}
try {
- fid = H5.H5Fopen(H5_FILE, HDF5Constants.H5F_ACC_RDONLY,
+ H5fid = H5.H5Fopen(H5_FILE, HDF5Constants.H5F_ACC_RDONLY,
HDF5Constants.H5P_DEFAULT);
}
catch (Throwable err) {
fail("H5.H5Fopen: " + err);
}
try {
- intent = H5.H5Fget_intent(fid);
+ intent = H5.H5Fget_intent(H5fid);
}
catch (Throwable err) {
fail("H5.H5Fget_intent: " + err);
}
assertEquals(HDF5Constants.H5F_ACC_RDONLY, intent);
+ }
+
+ @Test
+ public void testH5Fget_fileno_same() {
+ long fileno1 = 0;
+ long fileno2 = 0;
+ long fid1 = -1;
+ long fid2 = -1;
try {
- H5.H5Fclose(fid);
+ fid1 = H5.H5Fcreate(H5_FILE2, HDF5Constants.H5F_ACC_TRUNC,
+ HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT);
+ H5.H5Fflush(fid1, HDF5Constants.H5F_SCOPE_LOCAL);
+ assertTrue("H5Fcreate failed", fid1 > 0);
+ fid2 = H5.H5Fopen(H5_FILE2, HDF5Constants.H5F_ACC_RDWR,
+ HDF5Constants.H5P_DEFAULT);
+ assertTrue("H5Fopen failed", fid2 > 0);
+ fileno1 = H5.H5Fget_fileno(fid1);
+ assertTrue("H5Fget_fileno1="+fileno1, fileno1 > 0);
+ fileno2 = H5.H5Fget_fileno(fid2);
+ assertTrue("H5Fget_fileno2="+fileno2, fileno2 > 0);
+
+ assertEquals("fileno1["+fileno1+"]!=fileno2["+fileno2+"]", fileno1, fileno2);
+ }
+ catch (Throwable err) {
+ fail("testH5Fget_fileno_same: " + err);
+ }
+ finally {
+ H5.H5Fclose(fid1);
+ H5.H5Fclose(fid2);
+ }
+ }
+
+ @Test
+ public void testH5Fget_fileno_diff() {
+ long fileno1 = 0;
+ long fileno2 = 0;
+ long fid2 = -1;
+
+ try {
+ fid2 = H5.H5Fcreate(H5_FILE2, HDF5Constants.H5F_ACC_TRUNC,
+ HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT);
+ H5.H5Fflush(fid2, HDF5Constants.H5F_SCOPE_LOCAL);
+ assertTrue("H5Fcreate failed", fid2 > 0);
+
+ fileno1 = H5.H5Fget_fileno(H5fid);
+ assertTrue("H5Fget_fileno1="+fileno1, fileno1 > 0);
+ fileno2 = H5.H5Fget_fileno(fid2);
+ assertTrue("H5Fget_fileno2="+fileno2, fileno2 > 0);
+
+ assertNotEquals("fileno1["+fileno1+"]==fileno2["+fileno2+"]", fileno1, fileno2);
+ }
+ catch (Throwable err) {
+ fail("testH5Fget_fileno_diff: " + err);
}
- catch (Exception ex) {
+ finally {
+ H5.H5Fclose(fid2);
}
}
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 981f34e..e46ed48 100644
--- a/java/test/TestH5P.java
+++ b/java/test/TestH5P.java
@@ -214,7 +214,7 @@ public class TestH5P {
@Test(expected = HDF5FunctionArgumentException.class)
public void testH5Pset_libver_bounds_invalidhigh() throws Throwable {
- H5.H5Pset_libver_bounds(fapl_id, HDF5Constants.H5F_LIBVER_V110, HDF5Constants.H5F_LIBVER_V110+1);
+ H5.H5Pset_libver_bounds(fapl_id, HDF5Constants.H5F_LIBVER_V112, HDF5Constants.H5F_LIBVER_V112+1);
}
@Test
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/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-TestH5F.txt b/java/test/testfiles/JUnit-TestH5F.txt
index 16a423e..f79ac40 100644
--- a/java/test/testfiles/JUnit-TestH5F.txt
+++ b/java/test/testfiles/JUnit-TestH5F.txt
@@ -1,5 +1,7 @@
JUnit version 4.11
.testH5Fget_access_plist
+.testH5Fget_fileno_diff
+.testH5Fget_fileno_same
.testH5Fget_obj_ids
.testH5Fget_intent_rdwr
.testH5Fget_access_plist_closed
@@ -10,5 +12,5 @@ JUnit version 4.11
Time: XXXX
-OK (8 tests)
+OK (10 tests)
diff --git a/m4/ax_check_class.m4 b/m4/ax_check_class.m4
index 098aa77..e673c2d 100644
--- a/m4/ax_check_class.m4
+++ b/m4/ax_check_class.m4
@@ -1,5 +1,5 @@
# ===========================================================================
-# http://www.gnu.org/software/autoconf-archive/ax_check_class.html
+# https://www.gnu.org/software/autoconf-archive/ax_check_class.html
# ===========================================================================
#
# SYNOPSIS
@@ -36,7 +36,7 @@
# Public License for more details.
#
# You should have received a copy of the GNU General Public License along
-# with this program. If not, see <http://www.gnu.org/licenses/>.
+# with this program. If not, see <https://www.gnu.org/licenses/>.
#
# As a special exception, the respective Autoconf Macro's copyright owner
# gives unlimited permission to copy, distribute and modify the configure
@@ -51,83 +51,18 @@
# modified version of the Autoconf Macro, you may extend this special
# exception to the GPL to apply to your modified version as well.
-#serial 7
+#serial 12
AU_ALIAS([AC_CHECK_CLASS], [AX_CHECK_CLASS])
AC_DEFUN([AX_CHECK_CLASS],[
AC_REQUIRE([AX_PROG_JAVA])
ac_var_name=`echo $1 | sed 's/\./_/g'`
-dnl Normaly I'd use a AC_CACHE_CHECK here but since the variable name is
+dnl Normally I'd use a AC_CACHE_CHECK here but since the variable name is
dnl dynamic I need an extra level of extraction
AC_MSG_CHECKING([for $1 class])
AC_CACHE_VAL(ax_cv_class_$ac_var_name, [
-if test x$ac_cv_prog_uudecode_base64 = xyes; then
-dnl /**
-dnl * Test.java: used to test dynamicaly if a class exists.
-dnl */
-dnl public class Test
-dnl {
-dnl
-dnl public static void
-dnl main( String[] argv )
-dnl {
-dnl Class lib;
-dnl if (argv.length < 1)
-dnl {
-dnl System.err.println ("Missing argument");
-dnl System.exit (77);
-dnl }
-dnl try
-dnl {
-dnl lib = Class.forName (argv[0]);
-dnl }
-dnl catch (ClassNotFoundException e)
-dnl {
-dnl System.exit (1);
-dnl }
-dnl lib = null;
-dnl System.exit (0);
-dnl }
-dnl
-dnl }
-cat << \EOF > Test.uue
-begin-base64 644 Test.class
-yv66vgADAC0AKQcAAgEABFRlc3QHAAQBABBqYXZhL2xhbmcvT2JqZWN0AQAE
-bWFpbgEAFihbTGphdmEvbGFuZy9TdHJpbmc7KVYBAARDb2RlAQAPTGluZU51
-bWJlclRhYmxlDAAKAAsBAANlcnIBABVMamF2YS9pby9QcmludFN0cmVhbTsJ
-AA0ACQcADgEAEGphdmEvbGFuZy9TeXN0ZW0IABABABBNaXNzaW5nIGFyZ3Vt
-ZW50DAASABMBAAdwcmludGxuAQAVKExqYXZhL2xhbmcvU3RyaW5nOylWCgAV
-ABEHABYBABNqYXZhL2lvL1ByaW50U3RyZWFtDAAYABkBAARleGl0AQAEKEkp
-VgoADQAXDAAcAB0BAAdmb3JOYW1lAQAlKExqYXZhL2xhbmcvU3RyaW5nOylM
-amF2YS9sYW5nL0NsYXNzOwoAHwAbBwAgAQAPamF2YS9sYW5nL0NsYXNzBwAi
-AQAgamF2YS9sYW5nL0NsYXNzTm90Rm91bmRFeGNlcHRpb24BAAY8aW5pdD4B
-AAMoKVYMACMAJAoAAwAlAQAKU291cmNlRmlsZQEACVRlc3QuamF2YQAhAAEA
-AwAAAAAAAgAJAAUABgABAAcAAABtAAMAAwAAACkqvgSiABCyAAwSD7YAFBBN
-uAAaKgMyuAAeTKcACE0EuAAaAUwDuAAasQABABMAGgAdACEAAQAIAAAAKgAK
-AAAACgAAAAsABgANAA4ADgATABAAEwASAB4AFgAiABgAJAAZACgAGgABACMA
-JAABAAcAAAAhAAEAAQAAAAUqtwAmsQAAAAEACAAAAAoAAgAAAAQABAAEAAEA
-JwAAAAIAKA==
-====
-EOF
- if $UUDECODE Test.uue; then
- :
- else
- echo "configure: __oline__: uudecode had trouble decoding base 64 file 'Test.uue'" >&AS_MESSAGE_LOG_FD
- echo "configure: failed file was:" >&AS_MESSAGE_LOG_FD
- cat Test.uue >&AS_MESSAGE_LOG_FD
- ac_cv_prog_uudecode_base64=no
- fi
- rm -f Test.uue
- if AC_TRY_COMMAND($JAVA $JAVAFLAGS Test $1) >/dev/null 2>&1; then
- eval "ac_cv_class_$ac_var_name=yes"
- else
- eval "ac_cv_class_$ac_var_name=no"
- fi
- rm -f Test.class
-else
AX_TRY_COMPILE_JAVA([$1], , [eval "ac_cv_class_$ac_var_name=yes"],
[eval "ac_cv_class_$ac_var_name=no"])
-fi
eval "ac_var_val=$`eval echo ac_cv_class_$ac_var_name`"
eval "HAVE_$ac_var_name=$`echo ac_cv_class_$ac_var_val`"
HAVE_LAST_CLASS=$ac_var_val
@@ -137,7 +72,7 @@ else
ifelse([$3], , :, [$3])
fi
])
-dnl for some reason the above statment didn't fall though here?
+dnl for some reason the above statement didn't fall though here?
dnl do scripts have variable scoping?
eval "ac_var_val=$`eval echo ac_cv_class_$ac_var_name`"
AC_MSG_RESULT($ac_var_val)
diff --git a/m4/ax_check_classpath.m4 b/m4/ax_check_classpath.m4
index 3c9081a..e08a253 100644
--- a/m4/ax_check_classpath.m4
+++ b/m4/ax_check_classpath.m4
@@ -1,5 +1,5 @@
# ===========================================================================
-# http://www.gnu.org/software/autoconf-archive/ax_check_classpath.html
+# https://www.gnu.org/software/autoconf-archive/ax_check_classpath.html
# ===========================================================================
#
# SYNOPSIS
@@ -33,7 +33,7 @@
# Public License for more details.
#
# You should have received a copy of the GNU General Public License along
-# with this program. If not, see <http://www.gnu.org/licenses/>.
+# with this program. If not, see <https://www.gnu.org/licenses/>.
#
# As a special exception, the respective Autoconf Macro's copyright owner
# gives unlimited permission to copy, distribute and modify the configure
@@ -48,7 +48,7 @@
# modified version of the Autoconf Macro, you may extend this special
# exception to the GPL to apply to your modified version as well.
-#serial 5
+#serial 6
AU_ALIAS([AC_CHECK_CLASSPATH], [AX_CHECK_CLASSPATH])
AC_DEFUN([AX_CHECK_CLASSPATH],[
diff --git a/m4/ax_check_java_home.m4 b/m4/ax_check_java_home.m4
index cfe8f58..1d60387 100644
--- a/m4/ax_check_java_home.m4
+++ b/m4/ax_check_java_home.m4
@@ -1,5 +1,5 @@
# ===========================================================================
-# http://www.gnu.org/software/autoconf-archive/ax_check_java_home.html
+# https://www.gnu.org/software/autoconf-archive/ax_check_java_home.html
# ===========================================================================
#
# SYNOPSIS
@@ -28,7 +28,7 @@
# Public License for more details.
#
# You should have received a copy of the GNU General Public License along
-# with this program. If not, see <http://www.gnu.org/licenses/>.
+# with this program. If not, see <https://www.gnu.org/licenses/>.
#
# As a special exception, the respective Autoconf Macro's copyright owner
# gives unlimited permission to copy, distribute and modify the configure
@@ -43,7 +43,7 @@
# modified version of the Autoconf Macro, you may extend this special
# exception to the GPL to apply to your modified version as well.
-#serial 6
+#serial 7
AU_ALIAS([AC_CHECK_JAVA_HOME], [AX_CHECK_JAVA_HOME])
diff --git a/m4/ax_check_junit.m4 b/m4/ax_check_junit.m4
index 39b52d1..44dd70d 100644
--- a/m4/ax_check_junit.m4
+++ b/m4/ax_check_junit.m4
@@ -1,5 +1,5 @@
# ===========================================================================
-# http://www.gnu.org/software/autoconf-archive/ax_check_junit.html
+# https://www.gnu.org/software/autoconf-archive/ax_check_junit.html
# ===========================================================================
#
# SYNOPSIS
@@ -45,7 +45,7 @@
# and this notice are preserved. This file is offered as-is, without any
# warranty.
-#serial 5
+#serial 6
AU_ALIAS([AC_CHECK_JUNIT], [AX_CHECK_JUNIT])
AC_DEFUN([AX_CHECK_JUNIT],[
diff --git a/m4/ax_check_rqrd_class.m4 b/m4/ax_check_rqrd_class.m4
index 8f14241..baa041a 100644
--- a/m4/ax_check_rqrd_class.m4
+++ b/m4/ax_check_rqrd_class.m4
@@ -1,5 +1,5 @@
# ===========================================================================
-# http://www.gnu.org/software/autoconf-archive/ax_check_rqrd_class.html
+# https://www.gnu.org/software/autoconf-archive/ax_check_rqrd_class.html
# ===========================================================================
#
# SYNOPSIS
@@ -35,7 +35,7 @@
# Public License for more details.
#
# You should have received a copy of the GNU General Public License along
-# with this program. If not, see <http://www.gnu.org/licenses/>.
+# with this program. If not, see <https://www.gnu.org/licenses/>.
#
# As a special exception, the respective Autoconf Macro's copyright owner
# gives unlimited permission to copy, distribute and modify the configure
@@ -50,7 +50,7 @@
# modified version of the Autoconf Macro, you may extend this special
# exception to the GPL to apply to your modified version as well.
-#serial 5
+#serial 6
AU_ALIAS([AC_CHECK_RQRD_CLASS], [AX_CHECK_RQRD_CLASS])
AC_DEFUN([AX_CHECK_RQRD_CLASS],[
diff --git a/m4/ax_java_check_class.m4 b/m4/ax_java_check_class.m4
index 917638a..c9d60f7 100644
--- a/m4/ax_java_check_class.m4
+++ b/m4/ax_java_check_class.m4
@@ -1,5 +1,5 @@
# ===========================================================================
-# http://www.gnu.org/software/autoconf-archive/ax_java_check_class.html
+# https://www.gnu.org/software/autoconf-archive/ax_java_check_class.html
# ===========================================================================
#
# SYNOPSIS
@@ -15,7 +15,7 @@
#
# The macro tries to compile a minimal program importing <class>. Some
# newer compilers moan about the failure to use this but fail or produce a
-# class file anyway. All moaing is sunk to /dev/null since I only wanted
+# class file anyway. All moaning is sunk to /dev/null since I only wanted
# to know if the class could be imported. This is a recommended followup
# to AX_CHECK_JAVA_PLUGIN with classpath appropriately adjusted.
#
@@ -34,7 +34,7 @@
# Public License for more details.
#
# You should have received a copy of the GNU General Public License along
-# with this program. If not, see <http://www.gnu.org/licenses/>.
+# with this program. If not, see <https://www.gnu.org/licenses/>.
#
# As a special exception, the respective Autoconf Macro's copyright owner
# gives unlimited permission to copy, distribute and modify the configure
@@ -49,7 +49,7 @@
# modified version of the Autoconf Macro, you may extend this special
# exception to the GPL to apply to your modified version as well.
-#serial 9
+#serial 12
AU_ALIAS([DPS_JAVA_CHECK_CLASS], [AX_JAVA_CHECK_CLASS])
AC_DEFUN([AX_JAVA_CHECK_CLASS],[
diff --git a/m4/ax_java_options.m4 b/m4/ax_java_options.m4
index 36c10d9..722d788 100644
--- a/m4/ax_java_options.m4
+++ b/m4/ax_java_options.m4
@@ -1,5 +1,5 @@
# ===========================================================================
-# http://www.gnu.org/software/autoconf-archive/ax_java_options.html
+# https://www.gnu.org/software/autoconf-archive/ax_java_options.html
# ===========================================================================
#
# SYNOPSIS
@@ -27,7 +27,7 @@
# and this notice are preserved. This file is offered as-is, without any
# warranty.
-#serial 6
+#serial 7
AU_ALIAS([AC_JAVA_OPTIONS], [AX_JAVA_OPTIONS])
AC_DEFUN([AX_JAVA_OPTIONS],[
diff --git a/m4/ax_jni_include_dir.m4 b/m4/ax_jni_include_dir.m4
index becb33a..ae7a5f0 100644
--- a/m4/ax_jni_include_dir.m4
+++ b/m4/ax_jni_include_dir.m4
@@ -1,5 +1,5 @@
# ===========================================================================
-# http://www.gnu.org/software/autoconf-archive/ax_jni_include_dir.html
+# https://www.gnu.org/software/autoconf-archive/ax_jni_include_dir.html
# ===========================================================================
#
# SYNOPSIS
@@ -32,6 +32,10 @@
#
# - at the configure level, setenv JAVAC
#
+# This macro depends on AC_CANONICAL_HOST which requires that config.guess
+# and config.sub be distributed along with the source code. See autoconf
+# manual for details.
+#
# Note: This macro can work with the autoconf M4 macros for Java programs.
# This particular macro is not part of the original set of macros.
#
@@ -44,11 +48,13 @@
# and this notice are preserved. This file is offered as-is, without any
# warranty.
-#serial 11
+#serial 15
AU_ALIAS([AC_JNI_INCLUDE_DIR], [AX_JNI_INCLUDE_DIR])
AC_DEFUN([AX_JNI_INCLUDE_DIR],[
+AC_REQUIRE([AC_CANONICAL_HOST])
+
JNI_INCLUDE_DIRS=""
if test "x$JAVA_HOME" != x; then
@@ -66,14 +72,17 @@ else
fi
case "$host_os" in
- darwin*) # Apple JDK is at /System location and has headers symlinked elsewhere
- case "$_JTOPDIR" in
- /System/Library/Frameworks/JavaVM.framework/*)
- _JTOPDIR=`echo "$_JTOPDIR" | sed -e 's:/[[^/]]*$::'`
- _JINC="$_JTOPDIR/Headers";;
- *) _JINC="$_JTOPDIR/include";;
- esac;;
- *) _JINC="$_JTOPDIR/include";;
+ darwin*) # Apple Java headers are inside the Xcode bundle.
+ macos_version=$(sw_vers -productVersion | sed -n -e 's/^@<:@0-9@:>@*.\(@<:@0-9@:>@*\).@<:@0-9@:>@*/\1/p')
+ if @<:@ "$macos_version" -gt "7" @:>@; then
+ _JTOPDIR="$(xcrun --show-sdk-path)/System/Library/Frameworks/JavaVM.framework"
+ _JINC="$_JTOPDIR/Headers"
+ else
+ _JTOPDIR="/System/Library/Frameworks/JavaVM.framework"
+ _JINC="$_JTOPDIR/Headers"
+ fi
+ ;;
+ *) _JINC="$_JTOPDIR/include";;
esac
_AS_ECHO_LOG([_JTOPDIR=$_JTOPDIR])
_AS_ECHO_LOG([_JINC=$_JINC])
@@ -81,13 +90,21 @@ _AS_ECHO_LOG([_JINC=$_JINC])
# On Mac OS X 10.6.4, jni.h is a symlink:
# /System/Library/Frameworks/JavaVM.framework/Versions/Current/Headers/jni.h
# -> ../../CurrentJDK/Headers/jni.h.
-AC_CHECK_FILE([$_JINC/jni.h],
- [JNI_INCLUDE_DIRS="$JNI_INCLUDE_DIRS $_JINC"],
- [_JTOPDIR=`echo "$_JTOPDIR" | sed -e 's:/[[^/]]*$::'`
- AC_CHECK_FILE([$_JTOPDIR/include/jni.h],
- [JNI_INCLUDE_DIRS="$JNI_INCLUDE_DIRS $_JTOPDIR/include"],
- AC_MSG_ERROR([cannot find JDK header files]))
- ])
+AC_CACHE_CHECK(jni headers, ac_cv_jni_header_path,
+[
+ if test -f "$_JINC/jni.h"; then
+ ac_cv_jni_header_path="$_JINC"
+ JNI_INCLUDE_DIRS="$JNI_INCLUDE_DIRS $ac_cv_jni_header_path"
+ else
+ _JTOPDIR=`echo "$_JTOPDIR" | sed -e 's:/[[^/]]*$::'`
+ if test -f "$_JTOPDIR/include/jni.h"; then
+ ac_cv_jni_header_path="$_JTOPDIR/include"
+ JNI_INCLUDE_DIRS="$JNI_INCLUDE_DIRS $ac_cv_jni_header_path"
+ else
+ ac_cv_jni_header_path=none
+ fi
+ fi
+])
# get the likely subdirectories for system specific java includes
case "$host_os" in
@@ -102,13 +119,15 @@ cygwin*) _JNI_INC_SUBDIRS="win32";;
*) _JNI_INC_SUBDIRS="genunix";;
esac
-# add any subdirectories that are present
-for JINCSUBDIR in $_JNI_INC_SUBDIRS
-do
+if test "x$ac_cv_jni_header_path" != "xnone"; then
+ # add any subdirectories that are present
+ for JINCSUBDIR in $_JNI_INC_SUBDIRS
+ do
if test -d "$_JTOPDIR/include/$JINCSUBDIR"; then
JNI_INCLUDE_DIRS="$JNI_INCLUDE_DIRS $_JTOPDIR/include/$JINCSUBDIR"
fi
-done
+ done
+fi
])
# _ACJNI_FOLLOW_SYMLINKS <path>
diff --git a/m4/ax_prog_jar.m4 b/m4/ax_prog_jar.m4
index 3c60fca..d474912 100644
--- a/m4/ax_prog_jar.m4
+++ b/m4/ax_prog_jar.m4
@@ -1,5 +1,5 @@
# ===========================================================================
-# http://www.gnu.org/software/autoconf-archive/ax_prog_jar.html
+# https://www.gnu.org/software/autoconf-archive/ax_prog_jar.html
# ===========================================================================
#
# SYNOPSIS
@@ -37,7 +37,7 @@
# and this notice are preserved. This file is offered as-is, without any
# warranty.
-#serial 7
+#serial 8
AU_ALIAS([AC_PROG_JAR], [AX_PROG_JAR])
AC_DEFUN([AX_PROG_JAR],[
diff --git a/m4/ax_prog_java.m4 b/m4/ax_prog_java.m4
index 03961db..c2e6964 100644
--- a/m4/ax_prog_java.m4
+++ b/m4/ax_prog_java.m4
@@ -1,5 +1,5 @@
# ===========================================================================
-# http://www.gnu.org/software/autoconf-archive/ax_prog_java.html
+# https://www.gnu.org/software/autoconf-archive/ax_prog_java.html
# ===========================================================================
#
# SYNOPSIS
@@ -85,7 +85,7 @@
# Public License for more details.
#
# You should have received a copy of the GNU General Public License along
-# with this program. If not, see <http://www.gnu.org/licenses/>.
+# with this program. If not, see <https://www.gnu.org/licenses/>.
#
# As a special exception, the respective Autoconf Macro's copyright owner
# gives unlimited permission to copy, distribute and modify the configure
@@ -100,7 +100,7 @@
# modified version of the Autoconf Macro, you may extend this special
# exception to the GPL to apply to your modified version as well.
-#serial 9
+#serial 10
AU_ALIAS([AC_PROG_JAVA], [AX_PROG_JAVA])
AC_DEFUN([AX_PROG_JAVA],[
diff --git a/m4/ax_prog_java_cc.m4 b/m4/ax_prog_java_cc.m4
index 3df064f..ce9612d 100644
--- a/m4/ax_prog_java_cc.m4
+++ b/m4/ax_prog_java_cc.m4
@@ -1,5 +1,5 @@
# ===========================================================================
-# http://www.gnu.org/software/autoconf-archive/ax_prog_java_cc.html
+# https://www.gnu.org/software/autoconf-archive/ax_prog_java_cc.html
# ===========================================================================
#
# SYNOPSIS
@@ -56,7 +56,7 @@
# Public License for more details.
#
# You should have received a copy of the GNU General Public License along
-# with this program. If not, see <http://www.gnu.org/licenses/>.
+# with this program. If not, see <https://www.gnu.org/licenses/>.
#
# As a special exception, the respective Autoconf Macro's copyright owner
# gives unlimited permission to copy, distribute and modify the configure
@@ -71,7 +71,7 @@
# modified version of the Autoconf Macro, you may extend this special
# exception to the GPL to apply to your modified version as well.
-#serial 4
+#serial 5
# AX_PROG_JAVA_CC([COMPILER ...])
# --------------------------
diff --git a/m4/ax_prog_java_works.m4 b/m4/ax_prog_java_works.m4
index 54e132a..bc70526 100644
--- a/m4/ax_prog_java_works.m4
+++ b/m4/ax_prog_java_works.m4
@@ -1,5 +1,5 @@
# ===========================================================================
-# http://www.gnu.org/software/autoconf-archive/ax_prog_java_works.html
+# https://www.gnu.org/software/autoconf-archive/ax_prog_java_works.html
# ===========================================================================
#
# SYNOPSIS
@@ -32,7 +32,7 @@
# Public License for more details.
#
# You should have received a copy of the GNU General Public License along
-# with this program. If not, see <http://www.gnu.org/licenses/>.
+# with this program. If not, see <https://www.gnu.org/licenses/>.
#
# As a special exception, the respective Autoconf Macro's copyright owner
# gives unlimited permission to copy, distribute and modify the configure
@@ -47,57 +47,16 @@
# modified version of the Autoconf Macro, you may extend this special
# exception to the GPL to apply to your modified version as well.
-#serial 9
+#serial 11
AU_ALIAS([AC_PROG_JAVA_WORKS], [AX_PROG_JAVA_WORKS])
AC_DEFUN([AX_PROG_JAVA_WORKS], [
-AC_PATH_PROG(UUDECODE, uudecode, [no])
-if test x$UUDECODE != xno; then
-AC_CACHE_CHECK([if uudecode can decode base 64 file], ac_cv_prog_uudecode_base64, [
-dnl /**
-dnl * Test.java: used to test if java compiler works.
-dnl */
-dnl public class Test
-dnl {
-dnl
-dnl public static void
-dnl main( String[] argv )
-dnl {
-dnl System.exit (0);
-dnl }
-dnl
-dnl }
-cat << \EOF > Test.uue
-begin-base64 644 Test.class
-yv66vgADAC0AFQcAAgEABFRlc3QHAAQBABBqYXZhL2xhbmcvT2JqZWN0AQAE
-bWFpbgEAFihbTGphdmEvbGFuZy9TdHJpbmc7KVYBAARDb2RlAQAPTGluZU51
-bWJlclRhYmxlDAAKAAsBAARleGl0AQAEKEkpVgoADQAJBwAOAQAQamF2YS9s
-YW5nL1N5c3RlbQEABjxpbml0PgEAAygpVgwADwAQCgADABEBAApTb3VyY2VG
-aWxlAQAJVGVzdC5qYXZhACEAAQADAAAAAAACAAkABQAGAAEABwAAACEAAQAB
-AAAABQO4AAyxAAAAAQAIAAAACgACAAAACgAEAAsAAQAPABAAAQAHAAAAIQAB
-AAEAAAAFKrcAErEAAAABAAgAAAAKAAIAAAAEAAQABAABABMAAAACABQ=
-====
-EOF
-if $UUDECODE Test.uue; then
- ac_cv_prog_uudecode_base64=yes
-else
- echo "configure: __oline__: uudecode had trouble decoding base 64 file 'Test.uue'" >&AS_MESSAGE_LOG_FD
- echo "configure: failed file was:" >&AS_MESSAGE_LOG_FD
- cat Test.uue >&AS_MESSAGE_LOG_FD
- ac_cv_prog_uudecode_base64=no
-fi
-rm -f Test.uue])
-fi
-if test x$ac_cv_prog_uudecode_base64 != xyes; then
- rm -f Test.class
- AC_MSG_WARN([I have to compile Test.class from scratch])
if test x$ac_cv_prog_javac_works = xno; then
AC_MSG_ERROR([Cannot compile java source. $JAVAC does not work properly])
fi
if test x$ac_cv_prog_javac_works = x; then
AX_PROG_JAVAC
fi
-fi
AC_CACHE_CHECK(if $JAVA works, ac_cv_prog_java_works, [
JAVA_TEST=Test.java
CLASS_TEST=Test.class
@@ -111,7 +70,6 @@ public static void main (String args[]) {
} }
EOF
changequote([, ])dnl
-if test x$ac_cv_prog_uudecode_base64 != xyes; then
if AC_TRY_COMMAND($JAVAC $JAVACFLAGS $JAVA_TEST) && test -s $CLASS_TEST; then
:
else
@@ -119,7 +77,6 @@ if test x$ac_cv_prog_uudecode_base64 != xyes; then
cat $JAVA_TEST >&AS_MESSAGE_LOG_FD
AC_MSG_ERROR(The Java compiler $JAVAC failed (see config.log, check the CLASSPATH?))
fi
-fi
if AC_TRY_COMMAND($JAVA -classpath . $JAVAFLAGS $TEST) >/dev/null 2>&1; then
ac_cv_prog_java_works=yes
else
@@ -127,7 +84,7 @@ else
cat $JAVA_TEST >&AS_MESSAGE_LOG_FD
AC_MSG_ERROR(The Java VM $JAVA failed (see config.log, check the CLASSPATH?))
fi
-rm -fr $JAVA_TEST $CLASS_TEST Test.uue
+rm -f $JAVA_TEST $CLASS_TEST
])
AC_PROVIDE([$0])dnl
]
diff --git a/m4/ax_prog_javac.m4 b/m4/ax_prog_javac.m4
index d061243..8abb733 100644
--- a/m4/ax_prog_javac.m4
+++ b/m4/ax_prog_javac.m4
@@ -1,5 +1,5 @@
# ===========================================================================
-# http://www.gnu.org/software/autoconf-archive/ax_prog_javac.html
+# https://www.gnu.org/software/autoconf-archive/ax_prog_javac.html
# ===========================================================================
#
# SYNOPSIS
@@ -49,7 +49,7 @@
# Public License for more details.
#
# You should have received a copy of the GNU General Public License along
-# with this program. If not, see <http://www.gnu.org/licenses/>.
+# with this program. If not, see <https://www.gnu.org/licenses/>.
#
# As a special exception, the respective Autoconf Macro's copyright owner
# gives unlimited permission to copy, distribute and modify the configure
@@ -64,7 +64,7 @@
# modified version of the Autoconf Macro, you may extend this special
# exception to the GPL to apply to your modified version as well.
-#serial 7
+#serial 8
AU_ALIAS([AC_PROG_JAVAC], [AX_PROG_JAVAC])
AC_DEFUN([AX_PROG_JAVAC],[
diff --git a/m4/ax_prog_javac_works.m4 b/m4/ax_prog_javac_works.m4
index 7dfa1e3..9b48149 100644
--- a/m4/ax_prog_javac_works.m4
+++ b/m4/ax_prog_javac_works.m4
@@ -1,5 +1,5 @@
# ===========================================================================
-# http://www.gnu.org/software/autoconf-archive/ax_prog_javac_works.html
+# https://www.gnu.org/software/autoconf-archive/ax_prog_javac_works.html
# ===========================================================================
#
# SYNOPSIS
@@ -32,7 +32,7 @@
# Public License for more details.
#
# You should have received a copy of the GNU General Public License along
-# with this program. If not, see <http://www.gnu.org/licenses/>.
+# with this program. If not, see <https://www.gnu.org/licenses/>.
#
# As a special exception, the respective Autoconf Macro's copyright owner
# gives unlimited permission to copy, distribute and modify the configure
@@ -47,7 +47,7 @@
# modified version of the Autoconf Macro, you may extend this special
# exception to the GPL to apply to your modified version as well.
-#serial 6
+#serial 7
AU_ALIAS([AC_PROG_JAVAC_WORKS], [AX_PROG_JAVAC_WORKS])
AC_DEFUN([AX_PROG_JAVAC_WORKS],[
diff --git a/m4/ax_prog_javadoc.m4 b/m4/ax_prog_javadoc.m4
index bcb6045..b9fcea4 100644
--- a/m4/ax_prog_javadoc.m4
+++ b/m4/ax_prog_javadoc.m4
@@ -1,5 +1,5 @@
# ===========================================================================
-# http://www.gnu.org/software/autoconf-archive/ax_prog_javadoc.html
+# https://www.gnu.org/software/autoconf-archive/ax_prog_javadoc.html
# ===========================================================================
#
# SYNOPSIS
@@ -38,7 +38,7 @@
# and this notice are preserved. This file is offered as-is, without any
# warranty.
-#serial 8
+#serial 9
AU_ALIAS([AC_PROG_JAVADOC], [AX_PROG_JAVADOC])
AC_DEFUN([AX_PROG_JAVADOC],[
diff --git a/m4/ax_prog_javah.m4 b/m4/ax_prog_javah.m4
index cefc616..935ec89 100644
--- a/m4/ax_prog_javah.m4
+++ b/m4/ax_prog_javah.m4
@@ -1,5 +1,5 @@
# ===========================================================================
-# http://www.gnu.org/software/autoconf-archive/ax_prog_javah.html
+# https://www.gnu.org/software/autoconf-archive/ax_prog_javah.html
# ===========================================================================
#
# SYNOPSIS
@@ -21,7 +21,7 @@
# and this notice are preserved. This file is offered as-is, without any
# warranty.
-#serial 8
+#serial 11
AU_ALIAS([AC_PROG_JAVAH], [AX_PROG_JAVAH])
AC_DEFUN([AX_PROG_JAVAH],[
@@ -30,19 +30,19 @@ AC_REQUIRE([AC_PROG_CPP])dnl
AC_PATH_PROG(JAVAH,javah)
AS_IF([test -n "$ac_cv_path_JAVAH"],
[
- AC_TRY_CPP([#include <jni.h>],,[
+ AC_PREPROC_IFELSE([AC_LANG_SOURCE([[#include <jni.h>]])],[],[
ac_save_CPPFLAGS="$CPPFLAGS"
- _ACJAVAH_FOLLOW_SYMLINKS("$ac_cv_path_JAVAH")
+ _ACJAVAH_FOLLOW_SYMLINKS("$ac_cv_path_JAVAH")
ax_prog_javah_bin_dir=`AS_DIRNAME([$_ACJAVAH_FOLLOWED])`
ac_dir="`AS_DIRNAME([$ax_prog_javah_bin_dir])`/include"
AS_CASE([$build_os],
- [cygwin*],
+ [cygwin*|mingw*],
[ac_machdep=win32],
[ac_machdep=`AS_ECHO($build_os) | sed 's,[[-0-9]].*,,'`])
CPPFLAGS="$ac_save_CPPFLAGS -I$ac_dir -I$ac_dir/$ac_machdep"
- AC_TRY_CPP([#include <jni.h>],
- ac_save_CPPFLAGS="$CPPFLAGS",
- AC_MSG_WARN([unable to include <jni.h>]))
+ AC_PREPROC_IFELSE([AC_LANG_SOURCE([[#include <jni.h>]])],
+ [ac_save_CPPFLAGS="$CPPFLAGS"],
+ [AC_MSG_WARN([unable to include <jni.h>])])
CPPFLAGS="$ac_save_CPPFLAGS"])
])
])
diff --git a/m4/ax_try_compile_java.m4 b/m4/ax_try_compile_java.m4
index a8ed6b2..245c36c 100644
--- a/m4/ax_try_compile_java.m4
+++ b/m4/ax_try_compile_java.m4
@@ -1,5 +1,5 @@
# ===========================================================================
-# http://www.gnu.org/software/autoconf-archive/ax_try_compile_java.html
+# https://www.gnu.org/software/autoconf-archive/ax_try_compile_java.html
# ===========================================================================
#
# SYNOPSIS
@@ -29,7 +29,7 @@
# and this notice are preserved. This file is offered as-is, without any
# warranty.
-#serial 8
+#serial 10
AU_ALIAS([AC_TRY_COMPILE_JAVA], [AX_TRY_COMPILE_JAVA])
AC_DEFUN([AX_TRY_COMPILE_JAVA],[
@@ -48,8 +48,8 @@ dnl Don't remove the temporary files here, so they can be examined.
else
echo "configure: failed program was:" >&AS_MESSAGE_LOG_FD
cat Test.java >&AS_MESSAGE_LOG_FD
-ifelse([$4], , , [ rm -fr Test.java Test.class
+ifelse([$4], , , [ rm -f Test.java Test.class
$4
])dnl
fi
-rm -fr Test.java Test.class])
+rm -f Test.java Test.class])
diff --git a/m4/ax_try_run_java.m4 b/m4/ax_try_run_java.m4
index c680f03..2ebb86d 100644
--- a/m4/ax_try_run_java.m4
+++ b/m4/ax_try_run_java.m4
@@ -1,5 +1,5 @@
# ===========================================================================
-# http://www.gnu.org/software/autoconf-archive/ax_try_run_java.html
+# https://www.gnu.org/software/autoconf-archive/ax_try_run_java.html
# ===========================================================================
#
# SYNOPSIS
@@ -29,7 +29,7 @@
# and this notice are preserved. This file is offered as-is, without any
# warranty.
-#serial 2
+#serial 3
AU_ALIAS([AC_TRY_RUN_JAVA], [AX_TRY_RUN_JAVA])
AC_DEFUN([AX_TRY_RUN_JAVA],[
diff --git a/release_docs/HISTORY-1_10.txt b/release_docs/HISTORY-1_10.txt
index 9887a54..ad8beb2 100644
--- a/release_docs/HISTORY-1_10.txt
+++ b/release_docs/HISTORY-1_10.txt
@@ -3,6 +3,8 @@ 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
02. Release Information for hdf5-1.10.0-patch1
@@ -10,6 +12,1039 @@ 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
+================================================================================
+
+
+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
+
+- New Features
+- Bug Fixes since HDF5-1.10.2
+- Supported Platforms
+- Tested Configuration Features Summary
+- More Tested Platforms
+- Known Problems
+- CMake vs. Autotools installations
+
+
+New Features
+============
+
+ Library
+ -------
+ - Moved the H5DOread/write_chunk() API calls to H5Dread/write_chunk()
+
+ The functionality of the direct chunk I/O calls in the high-level
+ library has been moved to the H5D package in the main library. This
+ will allow using those functions without building the high-level
+ library. The parameters and functionality of the H5D calls are
+ identical to the H5DO calls.
+
+ The original H5DO high-level API calls have been retained, though
+ they are now just wrappers for the H5D calls. They are marked as
+ deprecated and are only available when the library is built with
+ deprecated functions. New code should use the H5D calls for this
+ reason.
+
+ As a part of this work, the following symbols from H5Dpublic.h are no
+ longer used:
+
+ H5D_XFER_DIRECT_CHUNK_WRITE_FLAG_NAME
+ H5D_XFER_DIRECT_CHUNK_WRITE_FILTERS_NAME
+ H5D_XFER_DIRECT_CHUNK_WRITE_OFFSET_NAME
+ H5D_XFER_DIRECT_CHUNK_WRITE_DATASIZE_NAME
+ H5D_XFER_DIRECT_CHUNK_READ_FLAG_NAME
+ H5D_XFER_DIRECT_CHUNK_READ_OFFSET_NAME
+ H5D_XFER_DIRECT_CHUNK_READ_FILTERS_NAME
+
+ And properties with these names are no longer stored in the dataset
+ transfer property lists. The symbols are still defined in H5Dpublic.h,
+ but only when the library is built with deprecated symbols.
+
+ (DER - 2018/05/04)
+
+ Configuration:
+ -------------
+ - Add missing USE_110_API_DEFAULT option.
+
+ Option USE_110_API_DEFAULT sets the default version of
+ versioned APIs. The bin/makevers perl script did not set
+ the maxidx variable correctly when the 1.10 branch was
+ created. This caused the versioning process to always use
+ the latest version of any API.
+
+ (ADB - 2018/08/17, HDFFV-10552)
+
+ - Added configuration checks for the following MPI functions:
+
+ MPI_Mprobe - Used for the Parallel Compression feature
+ MPI_Imrecv - Used for the Parallel Compression feature
+
+ MPI_Get_elements_x - Used for the "big Parallel I/O" feature
+ MPI_Type_size_x - Used for the "big Parallel I/O" feature
+
+ (JTH - 2018/08/02, HDFFV-10512)
+
+ - Added section to the libhdf5.settings file to indicate
+ the status of the Parallel Compression and "big Parallel I/O"
+ features.
+
+ (JTH - 2018/08/02, HDFFV-10512)
+
+ - Add option to execute swmr shell scripts from CMake.
+
+ Option TEST_SHELL_SCRIPTS redirects processing into a
+ separate ShellTests.cmake file for UNIX types. The tests
+ execute the shell scripts if a SH program is found.
+
+ (ADB - 2018/07/16)
+
+
+ C++ Library:
+ ------------
+ - New wrappers
+
+ Added the following items:
+
+ + Class DSetAccPropList for the dataset access property list.
+
+ + Wrapper for H5Dget_access_plist to class DataSet
+ // Gets the access property list of this dataset.
+ DSetAccPropList getAccessPlist() const;
+
+ + Wrappers for H5Pset_chunk_cache and H5Pget_chunk_cache to class DSetAccPropList
+ // Sets the raw data chunk cache parameters.
+ void setChunkCache(size_t rdcc_nslots, size_t rdcc_nbytes, double rdcc_w0)
+
+ // Retrieves the raw data chunk cache parameters.
+ void getChunkCache(size_t &rdcc_nslots, size_t &rdcc_nbytes, double &rdcc_w0)
+
+ + New operator!= to class DataType (HDFFV-10472)
+ // Determines whether two datatypes are not the same.
+ bool operator!=(const DataType& compared_type)
+
+ + Wrappers for H5Oget_info2, H5Oget_info_by_name2, and H5Oget_info_by_idx2
+ (HDFFV-10458)
+
+ // Retrieves information about an HDF5 object.
+ void getObjinfo(H5O_info_t& objinfo, unsigned fields = H5O_INFO_BASIC) const;
+
+ // Retrieves information about an HDF5 object, given its name.
+ void getObjinfo(const char* name, H5O_info_t& objinfo,
+ unsigned fields = H5O_INFO_BASIC,
+ const LinkAccPropList& lapl = LinkAccPropList::DEFAULT) const;
+ void getObjinfo(const H5std_string& name, H5O_info_t& objinfo,
+ unsigned fields = H5O_INFO_BASIC,
+ const LinkAccPropList& lapl = LinkAccPropList::DEFAULT) const;
+
+ // Retrieves information about an HDF5 object, given its index.
+ void getObjinfo(const char* grp_name, H5_index_t idx_type,
+ H5_iter_order_t order, hsize_t idx, H5O_info_t& objinfo,
+ unsigned fields = H5O_INFO_BASIC,
+ const LinkAccPropList& lapl = LinkAccPropList::DEFAULT) const;
+ void getObjinfo(const H5std_string& grp_name, H5_index_t idx_type,
+ H5_iter_order_t order, hsize_t idx, H5O_info_t& objinfo,
+ unsigned fields = H5O_INFO_BASIC,
+ const LinkAccPropList& lapl = LinkAccPropList::DEFAULT) const;
+
+ (BMR - 2018/07/22, HDFFV-10150, HDFFV-10458, HDFFV-1047)
+
+
+ Java Library:
+ ----------------
+ - 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)
+
+
+Bug Fixes since HDF5-1.10.2 release
+==================================
+
+ Library
+ -------
+ - Performance issue with H5Oget_info
+
+ H5Oget_info family of routines retrieves information for an object such
+ as object type, access time, number of attributes, and storage space etc.
+ Retrieving all such information regardless is an overkill and causes
+ performance issue when doing so for many objects.
+
+ Add an additional parameter "fields" to the the H5Oget_info family of routines
+ indicating the type of information to be retrieved. The same is done to
+ the H5Ovisit family of routines which recursively visits an object
+ returning object information in a callback function. Both sets of routines
+ are versioned and the corresponding compatibility macros are added.
+
+ The version 2 names of the two sets of routines are:
+ (1) H5Oget_info2, H5Oget_info_by_idx2, H5Oget_info_by_name2
+ (2) H5Ovisit2, H5Ovisit_by_name2
+
+ (VC - 2018/08/15, HDFFV-10180)
+
+ - Test failure due to metadata size in test/vds.c
+
+ The size of metadata from test_api_get_ex_dcpl() in test/vds.c is not as expected
+ because the latest format should be used when encoding the layout for VDS.
+
+ Set the latest format in a temporary fapl and pass the setting to the routines that
+ encode the dataset selection for VDS.
+
+ (VC - 2018/08/14 HDFFV-10469)
+
+ - Java HDF5LibraryException class
+
+ The error minor and major values would be lost after the
+ constructor executed.
+
+ Created two local class variables to hold the values obtained during
+ execution of the constructor. Refactored the class functions to retrieve
+ the class values rather then calling the native functions.
+ The native functions were renamed and called only during execution
+ of the constructor.
+ Added error checking to calling class constructors in JNI classes.
+
+ (ADB - 2018/08/06, HDFFV-10544)
+
+ - Added checks of the defined MPI_VERSION to guard against usage of
+ MPI-3 functions in the Parallel Compression and "big Parallel I/O"
+ features when HDF5 is built with MPI-2. Previously, the configure
+ step would pass but the build itself would fail when it could not
+ locate the MPI-3 functions used.
+
+ As a result of these new checks, HDF5 can again be built with MPI-2,
+ but the Parallel Compression feature will be disabled as it relies
+ on the MPI-3 functions used.
+
+ (JTH - 2018/08/02, HDFFV-10512)
+
+ - User's patches: CVEs
+
+ The following patches have been applied:
+
+ CVE-2018-11202 - NULL pointer dereference was discovered in
+ H5S_hyper_make_spans in H5Shyper.c (HDFFV-10476)
+ https://security-tracker.debian.org/tracker/CVE-2018-11202
+ https://cve.mitre.org/cgi-bin/cvename.cgi?name=3DCVE-2018-11202
+
+ CVE-2018-11203 - A division by zero was discovered in
+ H5D__btree_decode_key in H5Dbtree.c (HDFFV-10477)
+ https://security-tracker.debian.org/tracker/CVE-2018-11203
+ https://cve.mitre.org/cgi-bin/cvename.cgi?name=3DCVE-2018-11203
+
+ CVE-2018-11204 - A NULL pointer dereference was discovered in
+ H5O__chunk_deserialize in H5Ocache.c (HDFFV-10478)
+ https://security-tracker.debian.org/tracker/CVE-2018-11204
+ https://cve.mitre.org/cgi-bin/cvename.cgi?name=3DCVE-2018-11204
+
+ CVE-2018-11206 - An out of bound read was discovered in
+ H5O_fill_new_decode and H5O_fill_old_decode in H5Ofill.c
+ (HDFFV-10480)
+ https://security-tracker.debian.org/tracker/CVE-2018-11206
+ https://cve.mitre.org/cgi-bin/cvename.cgi?name=3DCVE-2018-11206
+
+ CVE-2018-11207 - A division by zero was discovered in
+ H5D__chunk_init in H5Dchunk.c (HDFFV-10481)
+ https://security-tracker.debian.org/tracker/CVE-2018-11207
+ https://cve.mitre.org/cgi-bin/cvename.cgi?name=3DCVE-2018-11207
+
+ (BMR - 2018/7/22, PR#s: 1134 and 1139,
+ HDFFV-10476, HDFFV-10477, HDFFV-10478, HDFFV-10480, HDFFV-10481)
+
+ - H5Adelete
+
+ H5Adelete failed when deleting the last "large" attribute that
+ is stored densely via fractal heap/v2 b-tree.
+
+ After removing the attribute, update the ainfo message. If the
+ number of attributes goes to zero, remove the message.
+
+ (VC - 2018/07/20, HDFFV-9277)
+
+ - A bug was discovered in the parallel library which caused partial
+ parallel reads of filtered datasets to return incorrect data. The
+ library used the incorrect dataspace for each chunk read, causing
+ the selection used in each chunk to be wrong.
+
+ The bug was not caught during testing because all of the current
+ tests which do parallel reads of filtered data read all of the data
+ using an H5S_ALL selection. Several tests were added which exercise
+ partial parallel reads.
+
+ (JTH - 2018/07/16, HDFFV-10467)
+
+ - A bug was discovered in the parallel library which caused parallel
+ writes of filtered datasets to trigger an assertion failure in the
+ file free space manager.
+
+ This occurred when the filter used caused chunks to repeatedly shrink
+ and grow over the course of several dataset writes. The previous chunk
+ information, such as the size of the chunk and the offset in the file,
+ was being cached and not updated after each write, causing the next write
+ to the chunk to retrieve the incorrect cached information and run into
+ issues when reallocating space in the file for the chunk.
+
+ (JTH - 2018/07/16, HDFFV-10509)
+
+ - A bug was discovered in the parallel library which caused the
+ H5D__mpio_array_gatherv() function to allocate too much memory.
+
+ When the function is called with the 'allgather' parameter set
+ to a non-true value, the function will receive data from all MPI
+ ranks and gather it to the single rank specied by the 'root'
+ parameter. However, the bug in the function caused memory for
+ the received data to be allocated on all MPI ranks, not just the
+ singular rank specified as the receiver. In some circumstances,
+ this would cause an application to fail due to the large amounts
+ of memory being allocated.
+
+ (JTH - 2018/07/16, HDFFV-10467)
+
+ - Error checks in h5stat and when decoding messages
+
+ h5stat exited with seg fault/core dumped when
+ errors are encountered in the internal library.
+
+ Add error checks and --enable-error-stack option to h5stat.
+ Add range checks when decoding messages: old fill value, old
+ layout and refcount.
+
+ (VC - 2018/07/11, HDFFV-10333)
+
+ - If an HDF5 file contains a malformed compound datatype with a
+ suitably large offset, the type conversion code can run off
+ the end of the type conversion buffer, causing a segmentation
+ fault.
+
+ This issue was reported to The HDF Group as issue #CVE-2017-17507.
+
+ NOTE: The HDF5 C library cannot produce such a file. This condition
+ should only occur in a corrupt (or deliberately altered) file
+ or a file created by third-party software.
+
+ THE HDF GROUP WILL NOT FIX THIS BUG AT THIS TIME
+
+ Fixing this problem would involve updating the publicly visible
+ H5T_conv_t function pointer typedef and versioning the API calls
+ which use it. We normally only modify the public API during
+ major releases, so this bug will not be fixed at this time.
+
+ (DER - 2018/02/26, HDFFV-10356)
+
+
+ Configuration
+ -------------
+ - Applied patches to address Cywin build issues
+
+ There were three issues for Cygwin builds:
+ - Shared libs were not built.
+ - The -std=c99 flag caused a SIG_SETMASK undeclared error.
+ - Undefined errors when buildbing test shared libraries.
+
+ Patches to address these issues were received and incorporated in this version.
+
+ (LRK - 2018/07/18, HDFFV-10475)
+
+ - The --enable-debug/production configure flags are listed as 'deprecated'
+ when they should really be listed as 'removed'.
+
+ In the autotools overhaul several years ago, we removed these flags and
+ implemented a new --enable-build-mode= flag. This was done because we
+ changed the semantics of the modes and didn't want users to silently
+ be exposed to them. The newer system is also more flexible and us to
+ add other modes (like 'clean').
+
+ The --enable-debug/production flags are now listed as removed.
+
+ (DER - 2018/05/31, HDFFV-10505)
+
+ - Moved the location of gcc attribute.
+
+ The gcc attribute(no_sanitize), named as the macro HDF_NO_UBSAN,
+ was located after the function name. Builds with GCC 7 did not
+ indicate any problem, but GCC 8 issued errors. Moved the
+ attribute before the function name, as required.
+
+ (ADB - 2018/05/22, HDFFV-10473)
+
+ - Reworked java test suite into individual JUnit tests.
+
+ Testing the whole suite of java unit tests in a single JUnit run
+ made it difficult to determine actual failures when tests would fail.
+ Running each file set of tests individually, allows individual failures
+ to be diagnosed easier. A side benefit is that tests for optional components
+ of the library can be disabled if not configured.
+
+ (ADB - 2018/05/16, HDFFV-9739)
+
+ - Converted CMake global commands ADD_DEFINITIONS and INCLUDE_DIRECTORIES
+ to use target_* type commands. This change modernizes the CMake usage
+ in the HDF5 library.
+
+ In addition, there is the intention to convert to generator expressions,
+ where possible. The exception is Fortran FLAGS on Windows Visual Studio.
+ The HDF macros TARGET_C_PROPERTIES and TARGET_FORTRAN_PROPERTIES have
+ been removed with this change in usage.
+
+ The additional language (C++ and Fortran) checks have also been localized
+ to only be checked when that language is enabled.
+
+ (ADB - 2018/05/08)
+
+
+ Performance
+ -------------
+ - Revamped internal use of DXPLs, improving performance
+
+ (QAK - 2018/05/20)
+
+
+ Fortran
+ --------
+ - Fixed issue with h5fget_obj_count_f and using a file id of H5F_OBJ_ALL_F not
+ returning the correct count.
+
+ (MSB - 2018/5/15, HDFFV-10405)
+
+
+ C++ APIs
+ --------
+ - Adding default arguments to existing functions
+
+ Added the following items:
+ + Two more property list arguments are added to H5Location::createDataSet:
+ const DSetAccPropList& dapl = DSetAccPropList::DEFAULT
+ const LinkCreatPropList& lcpl = LinkCreatPropList::DEFAULT
+
+ + One more property list argument is added to H5Location::openDataSet:
+ const DSetAccPropList& dapl = DSetAccPropList::DEFAULT
+
+ (BMR - 2018/07/21, PR# 1146)
+
+ - Improvement C++ documentation
+
+ Replaced the table in main page of the C++ documentation from mht to htm format
+ for portability.
+
+ (BMR - 2018/07/17, PR# 1141)
+
+
+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
+ (swallow/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 2.6.32 x86_64 PGI n y/y n y y y
+CentOS 7.2 Linux 2.6.32 x86_64 GNU y y/y y y y y
+CentOS 7.2 Linux 2.6.32 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 2.6.32 x86_64 PGI y y y n
+CentOS 7.2 Linux 2.6.32 x86_64 GNU y y y y
+CentOS 7.2 Linux 2.6.32 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.2%%%%
HDF5 version 1.10.2 released on 2018-03-29
diff --git a/release_docs/INSTALL_CMake.txt b/release_docs/INSTALL_CMake.txt
index 233c2cc..4bba5e8 100644
--- a/release_docs/INSTALL_CMake.txt
+++ b/release_docs/INSTALL_CMake.txt
@@ -651,7 +651,7 @@ HDF5_PACKAGE_EXTLIBS "CPACK - include external libraries"
HDF5_STRICT_FORMAT_CHECKS "Whether to perform strict file format checks" OFF
HDF_TEST_EXPRESS "Control testing framework (0-3)" "0"
HDF5_TEST_VFD "Execute tests with different VFDs" OFF
-HDF5_TEST_VOL "Execute tests with different VOL connectors" OFF
+HDF5_TEST_PASSTHROUGH_VOL "Execute tests with different passthrough VOL connectors" OFF
HDF5_USE_16_API_DEFAULT "Use the HDF5 1.6.x API by default" OFF
HDF5_USE_18_API_DEFAULT "Use the HDF5 1.8.x API by default" OFF
HDF5_USE_110_API_DEFAULT "Use the HDF5 1.10.x API by default" OFF
diff --git a/release_docs/README_HDF5_CMake b/release_docs/README_HDF5_CMake
new file mode 100644
index 0000000..a2e7dce
--- /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.11.4 HDF5 1.11.4 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.11.4/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.11.4/release_docs.
+
+
+
+
+
diff --git a/release_docs/README_HPC b/release_docs/README_HPC
index bdeab67..67a5d6c 100644
--- a/release_docs/README_HPC
+++ b/release_docs/README_HPC
@@ -1,79 +1,206 @@
-HDF5 version 1.11.4 currently under development
-
-HDF5 source tar files with the HPC prefix are intended for use on clusters where
-configuration and build steps will be done on a login node and executable and
-lib files that are built will be run on compute nodes.
-
-Note these differences from the regular CMake tar and zip files:
- - Test programs produced by this tar file will be run using batch scripts.
- - Serial and parallel HDF5options.cmake files, using parallel options by default.
-
-Note also that options are now available in HDF5 source to facilitate use of
-toolchain files for using cross compilers available on login nodes to compile
-HDF5 for compute nodes.
-
-Instructions to configure build and test HDF5 using CMake:
-
-1. The cmake version must be 3.10 or later (cmake --version).
-2. Load or switch modules and set CC, FC, CXX for compilers desired.
-3. run build-unix.sh to configure, build, test and package HDF5 with CMake.
-
-Contents:
-
-build-unix.sh Simple script for running CMake to configure, build,
- test, and package HDF5.
-CTestScript.cmake CMake script to configure, build, test and package
- HDF5.
-hdf5-<version> HDF5 source for <version>.
-HDF5config.cmake CMake script to configure, build, test and package
- HDF5.
-HDF5Examples Source for HDF5 Examples.
-HDF5options.cmake symlink to parallel or serial HDF5options.cmake files.
- Default is parallel file, which builds and tests both
- serial and parallel C and Fortran wrappers.
- To build serial only, C Fortran and C++ wrappers, delete
- The HDF5options.cmake link and run
- 'ln -s ser-HDF5options.cmake HDF5options.cmake' to switch.
-par-HDF5options.cmake Options file for HDF5 serial and parallel build and test.
-ser-HDF5options.cmake Options file for HDF5 serial only build and test.
-SZip.tar.gz Source for building SZip.
-ZLib.tar.gz Source for buildng Zlib.
-
-
-To cross compile with this HPC-CMake tar.gz HDF5 source file:
-On Cray XC40 haswell login node for knl compute nodes using CMake and Cray modules:
- 1. Uncomment line in HDF5options.txt to use a toolchain file - line 106 for
- config/toolchain/crayle.cmake.
- 2. Uncomment lines 110, 111, and 115 - 122 of HDF5options.cmake.
- Line 110 allows configuring to complete on the haswell node.
- Line 111 switches the compiler to build files for knl nodes.
- Lines 115 - 122 set up test files to use sbatch to run build tests
- in batch jobs on a knl compute node with 6 processes.
- 3. Compiler module may be the default PrgEnv-intel/6.0.4 to use
- intel/18.0.2 or other intel, PrgEnv-cray/6.0.4 to use cce/8.7.4,
- or PrgEnv-gnu/6.0.4 for GCC compilers. PrgEnv-pgi/6.0.4 is also
- available but has not been tested with this tar file.
- 4. These CMake options are set in config/toolchain/crayle.cmake:
- set(CMAKE_SYSTEM_NAME Linux)
- set(CMAKE_COMPILER_VENDOR "CrayLinuxEnvironment")
- set(CMAKE_C_COMPILER cc)
- set(CMAKE_CXX_COMPILER c++)
- set(CMAKE_Fortran_COMPILER ftn)
- set(CMAKE_CROSSCOMPILING_EMULATOR "")
-
- 5. 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
- a. 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 options.
- b. 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.
--
+************************************************************************
+* 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 f9b2362..647cb8f 100644
--- a/release_docs/RELEASE.txt
+++ b/release_docs/RELEASE.txt
@@ -1,4 +1,4 @@
- version 1.11.4 currently under development
+HDF5 version 1.11.6 currently under development
================================================================================
@@ -48,6 +48,36 @@ New Features
Configuration:
-------------
+ - Add option to build only shared libs
+
+ A request was made to prevent building static libraries and only build
+ shared. A new option was added to CMake, ONLY_SHARED_LIBS, which will
+ skip building static libraries. Certain utility functions will build with
+ static libs but are not published. Tests are adjusted to use the correct
+ libraries.
+
+ (ADB - 2019/06/12, HDFFV-10805)
+
+ - Add options to enable or disable building tools and tests
+
+ Configure options --enable-tests and --enable-tools were added for
+ autotools configure. These options are enabled by default, and can be
+ disabled with either --disable-tests (or tools) or --enable-tests=no
+ (or --enable-tools=no). Build time is reduced ~20% when tools are
+ disabled, 35% when tests are disabled, 45% when both are disabled.
+ Reenabling them after the initial build requires running configure
+ again with the option(s) enabled.
+
+ (LRK - 2019/06/12, HDFFV-9976)
+
+ - Change tools test that test the error stack
+
+ There are some use cases which can cause the error stack of tools to be
+ different then the expected. These tests now use grepTest.cmake, this was
+ changed to allow the error file to be searched for an expected string.
+
+ (ADB - 2019/04/15, HDFFV-10741)
+
- Keep stderr and stdout separate in tests
Changed test handling of output capture. Tests now keep the stderr
@@ -122,6 +152,14 @@ New Features
Library:
--------
+ - Improved the performance of virtual dataset I/O
+
+ Refactored the internal dataspace routines used by the virtual dataset
+ code to improve performance, especially when one of the selections
+ involved is very long and non-contiguous.
+
+ (NAF - 2019/05/31, HDFFV-10693)
+
- Allow pre-generated H5Tinit.c and H5make_libsettings.c to be used.
Rather than always running H5detect and generating H5Tinit.c and
@@ -135,6 +173,14 @@ New Features
(DER - 2018/12/08, HDFFV-10252)
+ - Added the ability to open files with UTF-8 file names on Windows.
+
+ The POSIX open(2) API call on Windows is limited to ASCII
+ file names. The library has been updated to convert incoming file
+ names to UTF-16 (via MultiByteToWideChar(CP_UTF8, ...) and use
+ _wopen() instead.
+
+ (DER - 2019/03/15, HDFFV-2714, HDFFV-3914, HDFFV-3895, HDFFV-8237, HDFFV-10413, HDFFV-10691)
Parallel Library:
-----------------
@@ -154,8 +200,8 @@ New Features
- Changed the default behavior in parallel when reading the same dataset in its entirely
(i.e. H5S_ALL dataset selection) which is being read by all the processes collectively.
The dataset mush 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
+ 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)
@@ -170,66 +216,34 @@ New Features
- 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,
+ - 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:
------------
- - New wrappers
-
- Added the following items:
-
- + Class DSetAccPropList for the dataset access property list.
-
- + Wrapper for H5Dget_access_plist to class DataSet
- // Gets the access property list of this dataset.
- DSetAccPropList getAccessPlist() const;
-
- + Wrappers for H5Pset_chunk_cache and H5Pget_chunk_cache to class DSetAccPropList
- // Sets the raw data chunk cache parameters.
- void setChunkCache(size_t rdcc_nslots, size_t rdcc_nbytes, double rdcc_w0)
+ - Added new wrapper for H5Ovisit2()
+ H5Object::visit()
- // Retrieves the raw data chunk cache parameters.
- void getChunkCache(size_t &rdcc_nslots, size_t &rdcc_nbytes, double &rdcc_w0)
+ (BMR - 2019/02/14, HDFFV-10532)
- + New operator!= to class DataType (HDFFV-10472)
- // Determines whether two datatypes are not the same.
- bool operator!=(const DataType& compared_type)
+ - Added new wrappers for H5Pset/get_create_intermediate_group()
+ LinkCreatPropList::setCreateIntermediateGroup()
+ LinkCreatPropList::getCreateIntermediateGroup()
- + Wrappers for H5Oget_info2, H5Oget_info_by_name2, and H5Oget_info_by_idx2
- (HDFFV-10458)
-
- // Retrieves information about an HDF5 object.
- void getObjinfo(H5O_info_t& objinfo, unsigned fields = H5O_INFO_BASIC) const;
-
- // Retrieves information about an HDF5 object, given its name.
- void getObjinfo(const char* name, H5O_info_t& objinfo,
- unsigned fields = H5O_INFO_BASIC,
- const LinkAccPropList& lapl = LinkAccPropList::DEFAULT) const;
- void getObjinfo(const H5std_string& name, H5O_info_t& objinfo,
- unsigned fields = H5O_INFO_BASIC,
- const LinkAccPropList& lapl = LinkAccPropList::DEFAULT) const;
-
- // Retrieves information about an HDF5 object, given its index.
- void getObjinfo(const char* grp_name, H5_index_t idx_type,
- H5_iter_order_t order, hsize_t idx, H5O_info_t& objinfo,
- unsigned fields = H5O_INFO_BASIC,
- const LinkAccPropList& lapl = LinkAccPropList::DEFAULT) const;
- void getObjinfo(const H5std_string& grp_name, H5_index_t idx_type,
- H5_iter_order_t order, hsize_t idx, H5O_info_t& objinfo,
- unsigned fields = H5O_INFO_BASIC,
- const LinkAccPropList& lapl = LinkAccPropList::DEFAULT) const;
-
- (BMR - 2018/07/22, HDFFV-10150, HDFFV-10458, HDFFV-1047)
+ (BMR - 2019/04/22, HDFFV-10622)
Java Library:
----------------
+ - Fix a failure in JUnit-TestH5P on 32-bit architectures
+
+ (JTH - 2019/04/30)
+
- Duplicate the data read/write functions of Datasets for Attributes.
Region references could not be displayed for attributes as they could
@@ -239,7 +253,6 @@ New Features
(ADB - 2018/12/12, HDFVIEW-4)
-
- Removed H5I_REFERENCE from the Java wrappers
This ID class was never used by the library and has been removed
@@ -250,7 +263,12 @@ New Features
Tools:
------
- -
+ - h5dump was fixed for 128-bit floats, but was missing a test.
+
+ New test greps for the first 15 numbers of the 128-bit value.
+
+ (ADB - 2019/06/23, HDFFV-9407)
+
High-Level APIs:
---------------
@@ -277,6 +295,57 @@ Bug Fixes since HDF5-1.10.3 release
Library
-------
+ - Fixed an issue where copying a version 1.8 dataset between files using
+ H5Ocopy fails due to an incompatible fill version
+
+ When using the HDF5 1.10.x H5Ocopy() API call to copy a version 1.8
+ dataset to a file created with both high and low library bounds set to
+ H5F_LIBVER_V18, the H5Ocopy() call will fail with the error stack indicating
+ that the fill value version is out of bounds.
+
+ This was fixed by changing the fill value message version to H5O_FILL_VERSION_3
+ (from H5O_FILL_VERSION_2) for H5F_LIBVER_V18.
+
+ (VC - 2019/6/14, HDFFV-10800)
+
+ - Fixed a bug that would cause an error or cause fill values to be
+ incorrectly read from a chunked dataset using the "single chunk" index if
+ the data was held in cache and there was no data on disk.
+
+ (NAF - 2019/03/06)
+
+ - Fixed a bug that could cause an error or cause fill values to be
+ incorrectly read from a dataset that was written to using H5Dwrite_chunk
+ if the dataset was not closed after writing.
+
+ (NAF - 2019/03/06, HDFFV-10716)
+
+ - Fixed memory leak in scale offset filter
+
+ In a special case where the MinBits is the same as the number of bits in
+ the datatype's precision, the filter's data buffer was not freed, causing
+ the memory usage to grow. In general the buffer was freed correctly. The
+ Minbits are the minimal number of bits to store the data values. Please
+ see the reference manual for H5Pset_scaleoffset for the detail.
+
+ (RL - 2019/3/4, HDFFV-10705)
+
+ - 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
@@ -300,8 +369,8 @@ Bug Fixes since HDF5-1.10.3 release
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
+ 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)
@@ -333,6 +402,18 @@ Bug Fixes since HDF5-1.10.3 release
(JTH - 2018/08/25, HDFFV-10501)
+ - When iterating over an old-style group (i.e., when not using the latest
+ file format) of size 0, a NULL pointer representing the empty links
+ table would be sent to qsort(3) for sorting, which is undefined behavior.
+
+ Iterating over an empty group is explicitly tested in the links test.
+ This has not caused any failures to date and was flagged by gcc's
+ -fsanitize=undefined.
+
+ The library no longer attempts to sort an empty array.
+
+ (DER - 2019/06/18, HDFFV-10829)
+
Java Library:
----------------
- JNI native library dependencies
@@ -378,10 +459,10 @@ Bug Fixes since HDF5-1.10.3 release
Fortran
--------
- 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
+ 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.
(LRK - 2019/01/04, HDFFV-10596)
@@ -392,7 +473,7 @@ Bug Fixes since HDF5-1.10.3 release
(MSB, 2018/12/04, HDFFV-10511)
- - Fixed issue with Fortran not returning h5o_info_t field values
+ - Fixed issue with Fortran not returning h5o_info_t field values
meta_size%attr%index_size and meta_size%attr%heap_size.
(MSB, 2018/1/8, HDFFV-10443)
@@ -675,10 +756,10 @@ Bug Fixes since HDF5-1.10.2 release
conversions from or to long double types, especially when special values
such as infinity or NAN were involved. In some cases the results differed
by extremely small amounts from those on other machines, while some other
- tests resulted in segmentation faults. These conversion tests with long
- double types have been disabled for ppc64 machines until the problems are
+ tests resulted in segmentation faults. These conversion tests with long
+ double types have been disabled for ppc64 machines until the problems are
better understood and can be properly addressed.
-
+
(SRL - 2019/01/07, TRILAB-98)
Supported Platforms
@@ -843,6 +924,10 @@ The following platforms are not supported but have been tested for this release.
Known Problems
==============
+ CMake files do not behave correctly with paths containing spaces.
+ Do not use spaces in paths because the required escaping for handling spaces
+ results in very complex and fragile build files.
+ ADB - 2019/05/07
At present, metadata cache images may not be generated by parallel
applications. Parallel applications can read files with metadata cache
diff --git a/release_docs/USING_CMake_Examples.txt b/release_docs/USING_CMake_Examples.txt
index d5fae39..ea352fe 100644
--- a/release_docs/USING_CMake_Examples.txt
+++ b/release_docs/USING_CMake_Examples.txt
@@ -22,7 +22,7 @@ I. Preconditions
1. We suggest you obtain the latest CMake for windows from the Kitware
web site. The HDF5 1.10.x product requires a minimum CMake version
- of 3.2.2.
+ of 3.10.2.
2. You have installed the HDF5 library built with CMake, by executing
the HDF Install Utility (the *.msi file in the binary package for
@@ -38,12 +38,16 @@ II. Building HDF5 Examples with CMake
Files in the HDF5 install directory:
HDF5Examples folder
+ CTestScript.cmake
HDF5_Examples.cmake
+ HDF5_Examples_options.cmake
Default installation process:
Create a directory to run the examples, i.e. \test_hdf5.
Copy HDF5Examples folder to this directory.
+ Copy CTestScript.cmake to this directory.
Copy HDF5_Examples.cmake to this directory.
+ Copy HDF5_Examples_options.cmake to this directory.
The default source folder is defined as "HDF5Examples". It can be changed
with the CTEST_SOURCE_NAME script option.
The default installation folder is defined for the platform.
@@ -54,8 +58,9 @@ Default installation process:
with the CTEST_CONFIGURATION_TYPE script option. Note that this must
be the same as the value used with the -C command line option.
The default build configuration is defined to build and use static libraries.
- Shared libraries can be used with the STATIC_ONLY script option set to "NO".
- Other options can be changed by editing the HDF5_Examples.cmake file.
+
+ Shared libraries and other options can be changed by editing the
+ HDF5_Examples_options.cmake file.
If the defaults are okay, execute from this directory:
ctest -S HDF5_Examples.cmake -C Release -V -O test.log
@@ -69,9 +74,16 @@ Default installation process:
========================================================================
-III. Other changes to the HDF5_Examples.cmake file
+III. Defaults in the HDF5_Examples_options.cmake file
========================================================================
-Line 45-48: uncomment to use a source tarball or zipfile;
- Add script option "TAR_SOURCE=MySource.tar".
+#### DEFAULT: ###
+#### BUILD_SHARED_LIBS:BOOL=OFF ###
+#### HDF_BUILD_C:BOOL=ON ###
+#### HDF_BUILD_CXX:BOOL=OFF ###
+#### HDF_BUILD_FORTRAN:BOOL=OFF ###
+#### HDF_BUILD_JAVA:BOOL=OFF ###
+#### BUILD_TESTING:BOOL=OFF ###
+#### HDF_ENABLE_PARALLEL:BOOL=OFF ###
+#### HDF_ENABLE_THREADSAFE:BOOL=OFF ###
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 6b105a9..4cf4965 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -533,6 +533,7 @@ set (H5S_SOURCES
${HDF5_SRC_DIR}/H5S.c
${HDF5_SRC_DIR}/H5Sall.c
${HDF5_SRC_DIR}/H5Sdbg.c
+ ${HDF5_SRC_DIR}/H5Sdeprec.c
${HDF5_SRC_DIR}/H5Shyper.c
${HDF5_SRC_DIR}/H5Smpio.c
${HDF5_SRC_DIR}/H5Snone.c
@@ -639,6 +640,8 @@ set (H5VL_SOURCES
${HDF5_SRC_DIR}/H5VLpassthru.c
)
set (H5VL_HDRS
+ ${HDF5_SRC_DIR}/H5VLconnector.h
+ ${HDF5_SRC_DIR}/H5VLconnector_passthru.h
${HDF5_SRC_DIR}/H5VLnative.h
${HDF5_SRC_DIR}/H5VLpassthru.h
${HDF5_SRC_DIR}/H5VLpublic.h
@@ -944,7 +947,7 @@ if (BUILD_SHARED_LIBS)
endif ()
if (LOCAL_BATCH_TEST)
- if ("${LOCAL_BATCH_SCRIPT_COMMAND}" STREQUAL "raybsub")
+ 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
@@ -966,7 +969,7 @@ 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}>")
+ target_include_directories (H5detect PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>")
target_compile_definitions(H5detect PUBLIC ${HDF_EXTRA_C_FLAGS} ${HDF_EXTRA_FLAGS})
TARGET_C_PROPERTIES (H5detect STATIC)
target_link_libraries (H5detect
@@ -1056,7 +1059,7 @@ else ()
endif ()
add_executable (H5make_libsettings ${HDF5_SRC_DIR}/H5make_libsettings.c)
-target_include_directories(H5make_libsettings PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>")
+target_include_directories (H5make_libsettings PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>")
target_compile_definitions(H5make_libsettings PUBLIC ${HDF_EXTRA_C_FLAGS} ${HDF_EXTRA_FLAGS})
TARGET_C_PROPERTIES (H5make_libsettings STATIC)
target_link_libraries (H5make_libsettings
@@ -1096,41 +1099,48 @@ 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}
- PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>"
- INTERFACE "$<INSTALL_INTERFACE:$<INSTALL_PREFIX>/include>"
-)
-target_compile_definitions(${HDF5_LIB_TARGET}
- PUBLIC
- ${HDF_EXTRA_C_FLAGS}
- ${HDF_EXTRA_FLAGS}
- $<IF:$<CONFIG:Debug>,DEBUG,NDEBUG>
- PRIVATE
- $<$<BOOL:${HDF5_ENABLE_TRACE}>:H5_DEBUG_API> # Enable tracing of the API
- $<$<BOOL:${HDF5_ENABLE_DEBUG_APIS}>:H5Z_DEBUG;H5T_DEBUG;H5ST_DEBUG;H5S_DEBUG;H5O_DEBUG;H5I_DEBUG;H5HL_DEBUG;H5F_DEBUG;H5D_DEBUG;H5B2_DEBUG;H5AC_DEBUG>
-)
-TARGET_C_PROPERTIES (${HDF5_LIB_TARGET} STATIC)
-target_link_libraries (${HDF5_LIB_TARGET}
- PRIVATE ${LINK_LIBS} ${LINK_COMP_LIBS} "$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_LIBRARIES}>"
- PUBLIC $<$<NOT:$<PLATFORM_ID:Windows>>:${CMAKE_DL_LIBS}>
-)
-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 (NOT ONLY_SHARED_LIBS)
+ 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}
+ PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>"
+ INTERFACE "$<INSTALL_INTERFACE:$<INSTALL_PREFIX>/include>"
+ )
+ target_compile_definitions(${HDF5_LIB_TARGET}
+ PUBLIC
+ ${HDF_EXTRA_C_FLAGS}
+ ${HDF_EXTRA_FLAGS}
+ $<IF:$<CONFIG:Debug>,DEBUG,NDEBUG>
+ PRIVATE
+ $<$<BOOL:${HDF5_ENABLE_TRACE}>:H5_DEBUG_API> # Enable tracing of the API
+ $<$<BOOL:${HDF5_ENABLE_DEBUG_APIS}>:H5Z_DEBUG;H5T_DEBUG;H5ST_DEBUG;H5S_DEBUG;H5O_DEBUG;H5I_DEBUG;H5HL_DEBUG;H5F_DEBUG;H5D_DEBUG;H5B2_DEBUG;H5AC_DEBUG>
+ )
+ TARGET_C_PROPERTIES (${HDF5_LIB_TARGET} STATIC)
+ target_link_libraries (${HDF5_LIB_TARGET}
+ PRIVATE ${LINK_LIBS} ${LINK_COMP_LIBS} "$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_LIBRARIES}>"
+ PUBLIC $<$<NOT:$<PLATFORM_ID:Windows>>:${CMAKE_DL_LIBS}>
+ )
+ if (NOT WIN32)
+ target_link_libraries (${HDF5_LIB_TARGET}
+ PRIVATE $<$<BOOL:${HDF5_ENABLE_THREADSAFE}>:Threads::Threads>
+ )
+ endif ()
+ 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})
+endif ()
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}
+ target_include_directories (${HDF5_LIBSH_TARGET}
PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>"
INTERFACE "$<INSTALL_INTERFACE:$<INSTALL_PREFIX>/include>"
)
@@ -1147,8 +1157,8 @@ if (BUILD_SHARED_LIBS)
)
TARGET_C_PROPERTIES (${HDF5_LIBSH_TARGET} SHARED)
target_link_libraries (${HDF5_LIBSH_TARGET}
- PRIVATE ${LINK_LIBS} ${LINK_COMP_LIBS} "$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_LIBRARIES}>"
- PUBLIC $<$<NOT:$<PLATFORM_ID:Windows>>:${CMAKE_DL_LIBS}> $<$<BOOL:${HDF5_ENABLE_THREADSAFE}>:Threads::Threads>
+ PRIVATE ${LINK_LIBS} ${LINK_COMP_LIBS} "$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_LIBRARIES}>" $<$<BOOL:${HDF5_ENABLE_THREADSAFE}>:Threads::Threads>
+ PUBLIC $<$<NOT:$<PLATFORM_ID:Windows>>:${CMAKE_DL_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")
@@ -1181,7 +1191,9 @@ if (HDF5_EXPORTED_TARGETS)
if (BUILD_SHARED_LIBS)
INSTALL_TARGET_PDB (${HDF5_LIBSH_TARGET} ${HDF5_INSTALL_BIN_DIR} libraries)
endif ()
- INSTALL_TARGET_PDB (${HDF5_LIB_TARGET} ${HDF5_INSTALL_BIN_DIR} libraries)
+ if (NOT ONLY_SHARED_LIBS)
+ INSTALL_TARGET_PDB (${HDF5_LIB_TARGET} ${HDF5_INSTALL_BIN_DIR} libraries)
+ endif ()
install (
TARGETS
@@ -1210,7 +1222,9 @@ foreach (libs ${LINK_LIBS} ${LINK_COMP_LIBS})
set (_PKG_CONFIG_LIBS_PRIVATE "${_PKG_CONFIG_LIBS_PRIVATE} -l${libs}")
endforeach ()
-set (_PKG_CONFIG_LIBS "${_PKG_CONFIG_LIBS} -l${HDF5_LIB_CORENAME}")
+if (NOT ONLY_SHARED_LIBS)
+ set (_PKG_CONFIG_LIBS "${_PKG_CONFIG_LIBS} -l${HDF5_LIB_CORENAME}")
+endif ()
if (BUILD_SHARED_LIBS)
set (_PKG_CONFIG_SH_LIBS "${_PKG_CONFIG_SH_LIBS} -l${HDF5_LIB_CORENAME}")
endif ()
diff --git a/src/H5.c b/src/H5.c
index bf4643c..104c9fd 100644
--- a/src/H5.c
+++ b/src/H5.c
@@ -214,7 +214,7 @@ H5_init_library(void)
*/
if(H5E_init() < 0)
HGOTO_ERROR(H5E_FUNC, H5E_CANTINIT, FAIL, "unable to initialize error interface")
- if(H5VL_init() < 0)
+ if(H5VL_init_phase1() < 0)
HGOTO_ERROR(H5E_FUNC, H5E_CANTINIT, FAIL, "unable to initialize vol interface")
if(H5P_init() < 0)
HGOTO_ERROR(H5E_FUNC, H5E_CANTINIT, FAIL, "unable to initialize property list interface")
@@ -229,6 +229,10 @@ H5_init_library(void)
if(H5FS_init() < 0)
HGOTO_ERROR(H5E_FUNC, H5E_CANTINIT, FAIL, "unable to initialize FS interface")
+ /* Finish initializing interfaces that depend on the interfaces above */
+ if(H5VL_init_phase2() < 0)
+ HGOTO_ERROR(H5E_FUNC, H5E_CANTINIT, FAIL, "unable to initialize vol interface")
+
/* Debugging? */
H5_debug_mask("-all");
H5_debug_mask(HDgetenv("HDF5_DEBUG"));
diff --git a/src/H5A.c b/src/H5A.c
index 9c3ad7e..abf8694 100644
--- a/src/H5A.c
+++ b/src/H5A.c
@@ -254,7 +254,6 @@ H5Acreate2(hid_t loc_id, const char *attr_name, hid_t type_id, hid_t space_id,
{
void *attr = NULL; /* Attribute created */
H5VL_object_t *vol_obj = NULL; /* Object token of loc_id */
- H5P_genplist_t *plist; /* Property list pointer */
H5VL_loc_params_t loc_params;
hid_t ret_value = H5I_INVALID_HID; /* Return value */
@@ -277,16 +276,6 @@ H5Acreate2(hid_t loc_id, const char *attr_name, hid_t type_id, hid_t space_id,
if(H5CX_set_apl(&aapl_id, H5P_CLS_AACC, loc_id, TRUE) < 0)
HGOTO_ERROR(H5E_ATTR, H5E_CANTSET, H5I_INVALID_HID, "can't set access property list info")
- /* Get the property list structure for the acpl */
- if(NULL == (plist = (H5P_genplist_t *)H5I_object(acpl_id)))
- HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID")
-
- /* Set creation properties */
- if(H5P_set(plist, H5VL_PROP_ATTR_TYPE_ID, &type_id) < 0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, H5I_INVALID_HID, "can't set property value for datatype id")
- if(H5P_set(plist, H5VL_PROP_ATTR_SPACE_ID, &space_id) < 0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, H5I_INVALID_HID, "can't set property value for space id")
-
/* Get the location object */
if(NULL == (vol_obj = H5VL_vol_object(loc_id)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "invalid location identifier")
@@ -296,7 +285,7 @@ H5Acreate2(hid_t loc_id, const char *attr_name, hid_t type_id, hid_t space_id,
loc_params.obj_type = H5I_get_type(loc_id);
/* Create the attribute */
- if(NULL == (attr = H5VL_attr_create(vol_obj, &loc_params, attr_name, acpl_id, aapl_id, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL)))
+ if(NULL == (attr = H5VL_attr_create(vol_obj, &loc_params, attr_name, type_id, space_id, acpl_id, aapl_id, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL)))
HGOTO_ERROR(H5E_ATTR, H5E_CANTINIT, H5I_INVALID_HID, "unable to create attribute")
/* Register the new attribute and get an ID for it */
@@ -350,7 +339,6 @@ H5Acreate_by_name(hid_t loc_id, const char *obj_name, const char *attr_name,
{
void *attr = NULL; /* attr token from VOL connector */
H5VL_object_t *vol_obj = NULL; /* object token of loc_id */
- H5P_genplist_t *plist; /* Property list pointer */
H5VL_loc_params_t loc_params;
hid_t ret_value = H5I_INVALID_HID; /* Return value */
@@ -380,16 +368,6 @@ H5Acreate_by_name(hid_t loc_id, const char *obj_name, const char *attr_name,
H5CX_set_lapl(lapl_id);
}
- /* Get the plist structure */
- if(NULL == (plist = (H5P_genplist_t *)H5I_object(acpl_id)))
- HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, H5I_INVALID_HID, "can't find object for ID")
-
- /* Set creation properties */
- if(H5P_set(plist, H5VL_PROP_ATTR_TYPE_ID, &type_id) < 0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, H5I_INVALID_HID, "can't set property value for datatype id")
- if(H5P_set(plist, H5VL_PROP_ATTR_SPACE_ID, &space_id) < 0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, H5I_INVALID_HID, "can't set property value for space id")
-
/* Set up location struct */
loc_params.type = H5VL_OBJECT_BY_NAME;
loc_params.obj_type = H5I_get_type(loc_id);
@@ -401,7 +379,7 @@ H5Acreate_by_name(hid_t loc_id, const char *obj_name, const char *attr_name,
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "invalid location identifier")
/* Create the attribute */
- if(NULL == (attr = H5VL_attr_create(vol_obj, &loc_params, attr_name, acpl_id, aapl_id, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL)))
+ if(NULL == (attr = H5VL_attr_create(vol_obj, &loc_params, attr_name, type_id, space_id, acpl_id, aapl_id, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL)))
HGOTO_ERROR(H5E_ATTR, H5E_CANTINIT, H5I_INVALID_HID, "unable to create attribute")
/* Register the new attribute and get an ID for it */
diff --git a/src/H5AC.c b/src/H5AC.c
index 440dfd8..dc88fd4 100644
--- a/src/H5AC.c
+++ b/src/H5AC.c
@@ -349,7 +349,7 @@ H5AC_create(const H5F_t *f, H5AC_cache_config_t *config_ptr, H5AC_cache_image_co
aux_ptr->sync_point_done = NULL;
aux_ptr->p0_image_len = 0;
- sprintf(prefix, "%d:", mpi_rank);
+ HDsprintf(prefix, "%d:", mpi_rank);
if(mpi_rank == 0) {
if(NULL == (aux_ptr->d_slist_ptr = H5SL_create(H5SL_TYPE_HADDR, NULL)))
diff --git a/src/H5Abtree2.c b/src/H5Abtree2.c
index 07da8e2..3377aa2 100644
--- a/src/H5Abtree2.c
+++ b/src/H5Abtree2.c
@@ -35,6 +35,7 @@
#include "H5private.h" /* Generic Functions */
#include "H5Apkg.h" /* Attributes */
#include "H5Eprivate.h" /* Error handling */
+#include "H5MMprivate.h" /* Memory management */
#include "H5SMprivate.h" /* Shared object header messages */
@@ -318,7 +319,7 @@ H5A__dense_btree2_name_encode(uint8_t *raw, const void *_nrecord, void H5_ATTR_U
FUNC_ENTER_STATIC_NOERR
/* Encode the record's fields */
- HDmemcpy(raw, nrecord->id.id, (size_t)H5O_FHEAP_ID_LEN);
+ H5MM_memcpy(raw, nrecord->id.id, (size_t)H5O_FHEAP_ID_LEN);
raw += H5O_FHEAP_ID_LEN;
*raw++ = nrecord->flags;
UINT32ENCODE(raw, nrecord->corder)
@@ -349,7 +350,7 @@ H5A__dense_btree2_name_decode(const uint8_t *raw, void *_nrecord, void H5_ATTR_U
FUNC_ENTER_STATIC_NOERR
/* Decode the record's fields */
- HDmemcpy(nrecord->id.id, raw, (size_t)H5O_FHEAP_ID_LEN);
+ H5MM_memcpy(nrecord->id.id, raw, (size_t)H5O_FHEAP_ID_LEN);
raw += H5O_FHEAP_ID_LEN;
nrecord->flags = *raw++;
UINT32DECODE(raw, nrecord->corder)
@@ -477,7 +478,7 @@ H5A__dense_btree2_corder_encode(uint8_t *raw, const void *_nrecord, void H5_ATTR
FUNC_ENTER_STATIC_NOERR
/* Encode the record's fields */
- HDmemcpy(raw, nrecord->id.id, (size_t)H5O_FHEAP_ID_LEN);
+ H5MM_memcpy(raw, nrecord->id.id, (size_t)H5O_FHEAP_ID_LEN);
raw += H5O_FHEAP_ID_LEN;
*raw++ = nrecord->flags;
UINT32ENCODE(raw, nrecord->corder)
@@ -507,7 +508,7 @@ H5A__dense_btree2_corder_decode(const uint8_t *raw, void *_nrecord, void H5_ATTR
FUNC_ENTER_STATIC_NOERR
/* Decode the record's fields */
- HDmemcpy(nrecord->id.id, raw, (size_t)H5O_FHEAP_ID_LEN);
+ H5MM_memcpy(nrecord->id.id, raw, (size_t)H5O_FHEAP_ID_LEN);
raw += H5O_FHEAP_ID_LEN;
nrecord->flags = *raw++;
UINT32DECODE(raw, nrecord->corder)
diff --git a/src/H5Adense.c b/src/H5Adense.c
index 021fa76..bddfe31 100644
--- a/src/H5Adense.c
+++ b/src/H5Adense.c
@@ -325,14 +325,11 @@ H5A__dense_fnd_cb(const H5A_t *attr, hbool_t *took_ownership, void *_user_attr)
*/
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 */
+ /* Free any dynamically allocated items */
+ if(old_attr->shared)
+ if(H5A__shared_free(old_attr) < 0)
+ HGOTO_ERROR(H5E_ATTR, H5E_CANTRELEASE, FAIL, "can't release attribute info")
old_attr = H5FL_FREE(H5A_t, old_attr);
} /* end if */
@@ -899,6 +896,7 @@ H5A__dense_rename(H5F_t *f, const H5O_ainfo_t *ainfo, const char *old_name,
H5HF_t *fheap = NULL; /* Fractal heap handle */
H5HF_t *shared_fheap = NULL; /* Fractal heap handle for shared header messages */
H5B2_t *bt2_name = NULL; /* v2 B-tree handle for name index */
+ H5B2_t *bt2_corder = NULL; /* v2 B-tree handle for creation order ndex */
H5A_t *attr_copy = NULL; /* Copy of attribute to rename */
htri_t attr_sharable; /* Flag indicating attributes are sharable */
htri_t shared_mesg; /* Should this message be stored in the Shared Message table? */
@@ -976,6 +974,33 @@ H5A__dense_rename(H5F_t *f, const H5O_ainfo_t *ainfo, const char *old_name,
if(H5A__set_version(f, attr_copy) < 0)
HGOTO_ERROR(H5E_ATTR, H5E_CANTSET, FAIL, "unable to update attribute version")
+ /* Need to remove the attribute from the creation order index v2 B-tree */
+ if(ainfo->index_corder) {
+ htri_t corder_attr_exists; /* Attribute exists in v2 B-tree */
+
+ /* Open the creation order index v2 B-tree */
+ HDassert(H5F_addr_defined(ainfo->corder_bt2_addr));
+ if(NULL == (bt2_corder = H5B2_open(f, ainfo->corder_bt2_addr, NULL)))
+ HGOTO_ERROR(H5E_ATTR, H5E_CANTOPENOBJ, FAIL, "unable to open v2 B-tree for creation index")
+
+ /* Set up the creation order to search for */
+ udata.corder = attr_copy->shared->crt_idx;
+
+ if((corder_attr_exists = H5B2_find(bt2_corder, &udata, NULL, NULL)) < 0)
+ HGOTO_ERROR(H5E_ATTR, H5E_NOTFOUND, FAIL, "can't search for attribute in name index")
+
+ if(corder_attr_exists) {
+ H5A_bt2_ud_rm_t rm_udata;
+
+ /* Set up the creation order in user data for the v2 B-tree 'record remove' callback */
+ rm_udata.common.corder = attr_copy->shared->crt_idx;
+
+ /* Remove the record from the creation order index v2 B-tree */
+ if(H5B2_remove(bt2_corder, &rm_udata, NULL, NULL) < 0)
+ HGOTO_ERROR(H5E_ATTR, H5E_CANTREMOVE, FAIL, "unable to remove attribute from creation order index v2 B-tree")
+ }
+ }
+
/* Insert renamed attribute back into dense storage */
/* (Possibly making it shared) */
if(H5A__dense_insert(f, ainfo, attr_copy) < 0)
@@ -1023,6 +1048,8 @@ done:
HDONE_ERROR(H5E_ATTR, H5E_CLOSEERROR, FAIL, "can't close fractal heap")
if(bt2_name && H5B2_close(bt2_name) < 0)
HDONE_ERROR(H5E_ATTR, H5E_CLOSEERROR, FAIL, "can't close v2 B-tree for name index")
+ if(bt2_corder && H5B2_close(bt2_corder) < 0)
+ HDONE_ERROR(H5E_ATTR, H5E_CLOSEERROR, FAIL, "can't close v2 B-tree for creation order index")
if(attr_copy)
H5O_msg_free(H5O_ATTR_ID, attr_copy);
diff --git a/src/H5Adeprec.c b/src/H5Adeprec.c
index b438cd2..8d0e33c 100644
--- a/src/H5Adeprec.c
+++ b/src/H5Adeprec.c
@@ -119,7 +119,6 @@ H5Acreate1(hid_t loc_id, const char *name, hid_t type_id, hid_t space_id,
void *attr = NULL; /* attr token from VOL connector */
H5VL_object_t *vol_obj = NULL; /* Object token of loc_id */
H5VL_loc_params_t loc_params;
- H5P_genplist_t *plist; /* Property list pointer */
hid_t ret_value = H5I_INVALID_HID; /* Return value */
FUNC_ENTER_API(H5I_INVALID_HID)
@@ -139,16 +138,6 @@ H5Acreate1(hid_t loc_id, const char *name, hid_t type_id, hid_t space_id,
if(H5P_DEFAULT == acpl_id)
acpl_id = H5P_ATTRIBUTE_CREATE_DEFAULT;
- /* Get the plist structure */
- if(NULL == (plist = (H5P_genplist_t *)H5I_object(acpl_id)))
- HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, H5I_INVALID_HID, "can't find object for ID")
-
- /* Set creation properties */
- if(H5P_set(plist, H5VL_PROP_ATTR_TYPE_ID, &type_id) < 0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, H5I_INVALID_HID, "can't set property value for datatype id")
- if(H5P_set(plist, H5VL_PROP_ATTR_SPACE_ID, &space_id) < 0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, H5I_INVALID_HID, "can't set property value for space id")
-
/* Set location parameters */
loc_params.type = H5VL_OBJECT_BY_SELF;
loc_params.obj_type = H5I_get_type(loc_id);
@@ -158,7 +147,7 @@ H5Acreate1(hid_t loc_id, const char *name, hid_t type_id, hid_t space_id,
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "invalid location identifier")
/* Create the attribute */
- if(NULL == (attr = H5VL_attr_create(vol_obj, &loc_params, name, acpl_id, H5P_DEFAULT, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL)))
+ if(NULL == (attr = H5VL_attr_create(vol_obj, &loc_params, name, type_id, space_id, acpl_id, H5P_DEFAULT, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL)))
HGOTO_ERROR(H5E_ATTR, H5E_CANTINIT, H5I_INVALID_HID, "unable to create attribute")
/* Register the new attribute and get an ID for it */
diff --git a/src/H5Aint.c b/src/H5Aint.c
index 6502fa4..808d9b3 100644
--- a/src/H5Aint.c
+++ b/src/H5Aint.c
@@ -108,6 +108,7 @@ static herr_t H5A__iterate_common(hid_t loc_id, H5_index_t idx_type,
const unsigned H5O_attr_ver_bounds[] = {
H5O_ATTR_VERSION_1, /* H5F_LIBVER_EARLIEST */
H5O_ATTR_VERSION_3, /* H5F_LIBVER_V18 */
+ H5O_ATTR_VERSION_3, /* H5F_LIBVER_V110 */
H5O_ATTR_VERSION_LATEST /* H5F_LIBVER_LATEST */
};
@@ -646,21 +647,21 @@ H5A__read(const H5A_t *attr, const H5T_t *mem_type, void *buf)
HGOTO_ERROR(H5E_ATTR, H5E_NOSPACE, FAIL, "memory allocation failed")
/* Copy the attribute data into the buffer for conversion */
- HDmemcpy(tconv_buf, attr->shared->data, (src_type_size * nelmts));
+ H5MM_memcpy(tconv_buf, attr->shared->data, (src_type_size * nelmts));
/* Perform datatype conversion. */
if(H5T_convert(tpath, src_id, dst_id, nelmts, (size_t)0, (size_t)0, tconv_buf, bkg_buf) < 0)
HGOTO_ERROR(H5E_ATTR, H5E_CANTENCODE, FAIL, "datatype conversion failed")
/* Copy the converted data into the user's buffer */
- HDmemcpy(buf, tconv_buf, (dst_type_size * nelmts));
+ H5MM_memcpy(buf, tconv_buf, (dst_type_size * nelmts));
} /* end if */
/* No type conversion necessary */
else {
HDassert(dst_type_size == src_type_size);
/* Copy the attribute data into the user's buffer */
- HDmemcpy(buf, attr->shared->data, (dst_type_size * nelmts));
+ H5MM_memcpy(buf, attr->shared->data, (dst_type_size * nelmts));
} /* end else */
} /* end else */
} /* end if */
@@ -747,7 +748,7 @@ H5A__write(H5A_t *attr, const H5T_t *mem_type, const void *buf)
HGOTO_ERROR(H5E_ATTR, H5E_CANTALLOC, FAIL, "memory allocation failed")
/* Copy the user's data into the buffer for conversion */
- HDmemcpy(tconv_buf, buf, (src_type_size * nelmts));
+ H5MM_memcpy(tconv_buf, buf, (src_type_size * nelmts));
/* Perform datatype conversion */
if(H5T_convert(tpath, src_id, dst_id, nelmts, (size_t)0, (size_t)0, tconv_buf, bkg_buf) < 0)
@@ -770,8 +771,8 @@ H5A__write(H5A_t *attr, const H5T_t *mem_type, const void *buf)
if(NULL == (attr->shared->data = H5FL_BLK_MALLOC(attr_buf, dst_type_size * nelmts)))
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed")
- /* Copy the attribute data into the user's buffer */
- HDmemcpy(attr->shared->data, buf, (dst_type_size * nelmts));
+ /* Copy the attribute data into the attribute data buffer */
+ H5MM_memcpy(attr->shared->data, buf, (dst_type_size * nelmts));
} /* end else */
/* Modify the attribute in the object header */
@@ -827,7 +828,7 @@ H5A__get_name(H5A_t *attr, size_t buf_size, char *buf)
/* Copy all/some of the name */
if(buf && copy_len > 0) {
- HDmemcpy(buf, attr->shared->name, copy_len);
+ H5MM_memcpy(buf, attr->shared->name, copy_len);
/* Terminate the string */
buf[copy_len]='\0';
@@ -1091,48 +1092,55 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5A__free
+ * Function: H5A__shared_free
*
- * Purpose: Frees all memory associated with an attribute, but does not
- * free the H5A_t structure (which should be done in H5T_close).
+ * Purpose: Cleans up the shared attribute data. This will free
+ * the attribute's shared structure as well.
+ *
+ * attr and attr->shared must not be NULL
*
* Return: SUCCEED/FAIL
*
- * Programmer: Quincey Koziol
- * Monday, November 15, 2004
+ * Programmer: Quincey Koziol
+ * Monday, November 15, 2004
*
*-------------------------------------------------------------------------
*/
herr_t
-H5A__free(H5A_t *attr)
+H5A__shared_free(H5A_t *attr)
{
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_PACKAGE
HDassert(attr);
+ HDassert(attr->shared);
- /* Free dynamically allocated items */
+ /* Free dynamically allocated items.
+ * When possible, keep trying to shut things down (via HDONE_ERROR).
+ */
if(attr->shared->name) {
H5MM_xfree(attr->shared->name);
attr->shared->name = NULL;
}
if(attr->shared->dt) {
if(H5T_close_real(attr->shared->dt) < 0)
- HGOTO_ERROR(H5E_ATTR, H5E_CANTRELEASE, FAIL, "can't release datatype info")
+ HDONE_ERROR(H5E_ATTR, H5E_CANTRELEASE, FAIL, "can't release datatype info")
attr->shared->dt = NULL;
}
if(attr->shared->ds) {
if(H5S_close(attr->shared->ds) < 0)
- HGOTO_ERROR(H5E_ATTR, H5E_CANTRELEASE, FAIL, "can't release dataspace info")
+ HDONE_ERROR(H5E_ATTR, H5E_CANTRELEASE, FAIL, "can't release dataspace info")
attr->shared->ds = NULL;
}
if(attr->shared->data)
attr->shared->data = H5FL_BLK_FREE(attr_buf, attr->shared->data);
-done:
+ /* Destroy shared attribute struct */
+ attr->shared = H5FL_FREE(H5A_shared_t, attr->shared);
+
FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5A__free() */
+} /* end H5A__shared_free() */
/*-------------------------------------------------------------------------
@@ -1196,11 +1204,9 @@ H5A__close(H5A_t *attr)
/* Reference count can be 0. It only happens when H5A__create fails. */
if(attr->shared->nrefs <= 1) {
/* Free dynamically allocated items */
- if(H5A__free(attr) < 0)
- HGOTO_ERROR(H5E_ATTR, H5E_CANTRELEASE, FAIL, "can't release attribute info")
-
- /* Destroy shared attribute struct */
- attr->shared = H5FL_FREE(H5A_shared_t, attr->shared);
+ if(attr->shared)
+ if(H5A__shared_free(attr) < 0)
+ HGOTO_ERROR(H5E_ATTR, H5E_CANTRELEASE, FAIL, "can't release attribute info")
} /* end if */
else {
/* There are other references to the shared part of the attribute.
@@ -2240,7 +2246,7 @@ H5A__attr_copy_file(const H5A_t *attr_src, H5F_t *file_dst, hbool_t *recompute_s
if(NULL == (buf = H5FL_BLK_MALLOC(attr_buf, buf_size)))
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation NULLed for raw data chunk")
- HDmemcpy(buf, attr_src->shared->data, attr_src->shared->data_size);
+ H5MM_memcpy(buf, attr_src->shared->data, attr_src->shared->data_size);
/* Allocate background memory */
if(H5T_path_bkg(tpath_src_mem) || H5T_path_bkg(tpath_mem_dst))
@@ -2251,7 +2257,7 @@ H5A__attr_copy_file(const H5A_t *attr_src, H5F_t *file_dst, hbool_t *recompute_s
if(H5T_convert(tpath_src_mem, tid_src, tid_mem, nelmts, (size_t)0, (size_t)0, buf, bkg_buf) < 0)
HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, NULL, "datatype conversion NULLed")
- HDmemcpy(reclaim_buf, buf, buf_size);
+ H5MM_memcpy(reclaim_buf, buf, buf_size);
/* Set background buffer to all zeros */
if(bkg_buf)
@@ -2261,14 +2267,14 @@ H5A__attr_copy_file(const H5A_t *attr_src, H5F_t *file_dst, hbool_t *recompute_s
if(H5T_convert(tpath_mem_dst, tid_mem, tid_dst, nelmts, (size_t)0, (size_t)0, buf, bkg_buf) < 0)
HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, NULL, "datatype conversion NULLed")
- HDmemcpy(attr_dst->shared->data, buf, attr_dst->shared->data_size);
+ H5MM_memcpy(attr_dst->shared->data, buf, attr_dst->shared->data_size);
if(H5D_vlen_reclaim(tid_mem, buf_space, reclaim_buf) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_BADITER, NULL, "unable to reclaim variable-length data")
} /* end if */
else {
HDassert(attr_dst->shared->data_size == attr_src->shared->data_size);
- HDmemcpy(attr_dst->shared->data, attr_src->shared->data, attr_src->shared->data_size);
+ H5MM_memcpy(attr_dst->shared->data, attr_src->shared->data, attr_src->shared->data_size);
} /* end else */
} /* end if(attr_src->shared->data) */
@@ -2395,9 +2401,13 @@ H5A__attr_post_copy_file(const H5O_loc_t *src_oloc, const H5A_t *attr_src,
/* Check for expanding references */
if(cpy_info->expand_ref) {
size_t ref_count;
+ size_t dst_dt_size; /* Destination datatype size */
+ /* Determine size of the destination datatype */
+ if(0 == (dst_dt_size = H5T_get_size(attr_dst->shared->dt)))
+ HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "unable to determine datatype size")
/* Determine # of reference elements to copy */
- ref_count = attr_dst->shared->data_size / H5T_get_size(attr_dst->shared->dt);
+ ref_count = attr_dst->shared->data_size / dst_dt_size;
/* Copy objects referenced in source buffer to destination file and set destination elements */
if(H5O_copy_expand_ref(file_src, attr_dst->shared->data, file_dst, attr_dst->shared->data, ref_count, H5T_get_ref_type(attr_dst->shared->dt), cpy_info) < 0)
diff --git a/src/H5Apkg.h b/src/H5Apkg.h
index 91061cd..f3870c0 100644
--- a/src/H5Apkg.h
+++ b/src/H5Apkg.h
@@ -196,7 +196,7 @@ H5_DLL H5A_t *H5A__copy(H5A_t *new_attr, const H5A_t *old_attr);
H5_DLL hid_t H5A__get_type(H5A_t *attr);
H5_DLL herr_t H5A__get_info(const H5A_t *attr, H5A_info_t *ainfo);
H5_DLL hid_t H5A__get_create_plist(H5A_t* attr);
-H5_DLL herr_t H5A__free(H5A_t *attr);
+H5_DLL herr_t H5A__shared_free(H5A_t *attr);
H5_DLL herr_t H5A__close(H5A_t *attr);
H5_DLL herr_t H5A__close_cb(H5VL_object_t *attr_vol_obj);
H5_DLL htri_t H5A__get_ainfo(H5F_t *f, H5O_t *oh, H5O_ainfo_t *ainfo);
diff --git a/src/H5B.c b/src/H5B.c
index 71b9020..2a34fae 100644
--- a/src/H5B.c
+++ b/src/H5B.c
@@ -107,6 +107,7 @@
#include "H5Eprivate.h" /* Error handling */
#include "H5Iprivate.h" /* IDs */
#include "H5MFprivate.h" /* File memory management */
+#include "H5MMprivate.h" /* Memory management */
#include "H5Pprivate.h" /* Property lists */
@@ -436,8 +437,8 @@ H5B__split(H5F_t *f, H5B_ins_ud_t *bt_ud, unsigned idx,
side = "LEFT";
else
side = "MIDDLE";
- fprintf(H5DEBUG(B), "H5B__split: %3u {%5.3f,%5.3f,%5.3f} %6s",
- shared->two_k, split_ratios[0], split_ratios[1], split_ratios[2], side);
+ HDfprintf(H5DEBUG(B), "H5B__split: %3u {%5.3f,%5.3f,%5.3f} %6s",
+ shared->two_k, split_ratios[0], split_ratios[1], split_ratios[2], side);
}
#endif
@@ -464,7 +465,7 @@ H5B__split(H5F_t *f, H5B_ins_ud_t *bt_ud, unsigned idx,
nright = shared->two_k - nleft;
#ifdef H5B_DEBUG
if(H5DEBUG(B))
- fprintf(H5DEBUG(B), " split %3d/%-3d\n", nleft, nright);
+ HDfprintf(H5DEBUG(B), " split %3d/%-3d\n", nleft, nright);
#endif
/*
@@ -484,10 +485,10 @@ H5B__split(H5F_t *f, H5B_ins_ud_t *bt_ud, unsigned idx,
*/
split_bt_ud->cache_flags = H5AC__DIRTIED_FLAG;
- HDmemcpy(split_bt_ud->bt->native,
+ H5MM_memcpy(split_bt_ud->bt->native,
bt_ud->bt->native + nleft * shared->type->sizeof_nkey,
(nright + 1) * shared->type->sizeof_nkey);
- HDmemcpy(split_bt_ud->bt->child,
+ H5MM_memcpy(split_bt_ud->bt->child,
&bt_ud->bt->child[nleft],
nright * sizeof(haddr_t));
@@ -612,9 +613,9 @@ H5B_insert(H5F_t *f, const H5B_class_t *type, haddr_t addr, void *udata)
/* update left and right keys */
if(!lt_key_changed)
- HDmemcpy(lt_key, H5B_NKEY(bt_ud.bt,shared,0), type->sizeof_nkey);
+ H5MM_memcpy(lt_key, H5B_NKEY(bt_ud.bt,shared,0), type->sizeof_nkey);
if(!rt_key_changed)
- HDmemcpy(rt_key, H5B_NKEY(split_bt_ud.bt,shared,split_bt_ud.bt->nchildren), type->sizeof_nkey);
+ H5MM_memcpy(rt_key, H5B_NKEY(split_bt_ud.bt,shared,split_bt_ud.bt->nchildren), type->sizeof_nkey);
/*
* Copy the old root node to some other file location and make the new root
@@ -657,11 +658,11 @@ H5B_insert(H5F_t *f, const H5B_class_t *type, haddr_t addr, void *udata)
new_root_bt->nchildren = 2;
new_root_bt->child[0] = bt_ud.addr;
- HDmemcpy(H5B_NKEY(new_root_bt, shared, 0), lt_key, shared->type->sizeof_nkey);
+ H5MM_memcpy(H5B_NKEY(new_root_bt, shared, 0), lt_key, shared->type->sizeof_nkey);
new_root_bt->child[1] = split_bt_ud.addr;
- HDmemcpy(H5B_NKEY(new_root_bt, shared, 1), md_key, shared->type->sizeof_nkey);
- HDmemcpy(H5B_NKEY(new_root_bt, shared, 2), rt_key, shared->type->sizeof_nkey);
+ H5MM_memcpy(H5B_NKEY(new_root_bt, shared, 1), md_key, shared->type->sizeof_nkey);
+ H5MM_memcpy(H5B_NKEY(new_root_bt, shared, 2), rt_key, shared->type->sizeof_nkey);
/* Insert the modified copy of the old root into the file again */
if(H5AC_insert_entry(f, H5AC_BT, addr, new_root_bt, H5AC__NO_FLAGS_SET) < 0)
@@ -726,9 +727,9 @@ H5B__insert_child(H5B_t *bt, unsigned *bt_flags, unsigned idx,
base = H5B_NKEY(bt, shared, (idx + 1));
if((idx + 1) == bt->nchildren) {
/* Make room for the new key */
- HDmemcpy(base + shared->type->sizeof_nkey, base,
+ H5MM_memcpy(base + shared->type->sizeof_nkey, base,
shared->type->sizeof_nkey); /* No overlap possible - memcpy() OK */
- HDmemcpy(base, md_key, shared->type->sizeof_nkey);
+ H5MM_memcpy(base, md_key, shared->type->sizeof_nkey);
/* The MD_KEY is the left key of the new node */
if(H5B_INS_RIGHT == anchor)
@@ -741,7 +742,7 @@ H5B__insert_child(H5B_t *bt, unsigned *bt_flags, unsigned idx,
/* Make room for the new key */
HDmemmove(base + shared->type->sizeof_nkey, base,
(bt->nchildren - idx) * shared->type->sizeof_nkey);
- HDmemcpy(base, md_key, shared->type->sizeof_nkey);
+ H5MM_memcpy(base, md_key, shared->type->sizeof_nkey);
/* The MD_KEY is the left key of the new node */
if(H5B_INS_RIGHT == anchor)
@@ -915,7 +916,7 @@ H5B__insert_helper(H5F_t *f, H5B_ins_ud_t *bt_ud, const H5B_class_t *type,
* node. This node is not empty (handled above).
*/
my_ins = H5B_INS_LEFT;
- HDmemcpy(md_key, H5B_NKEY(bt,shared,idx), type->sizeof_nkey);
+ H5MM_memcpy(md_key, H5B_NKEY(bt,shared,idx), type->sizeof_nkey);
if((type->new_node)(f, H5B_INS_LEFT, H5B_NKEY(bt, shared, idx), udata,
md_key, &new_child_bt_ud.addr/*out*/) < 0)
HGOTO_ERROR(H5E_BTREE, H5E_CANTINSERT, H5B_INS_ERROR, "can't insert minimum leaf node")
@@ -963,7 +964,7 @@ H5B__insert_helper(H5F_t *f, H5B_ins_ud_t *bt_ud, const H5B_class_t *type,
*/
idx = bt->nchildren - 1;
my_ins = H5B_INS_RIGHT;
- HDmemcpy(md_key, H5B_NKEY(bt, shared, idx + 1), type->sizeof_nkey);
+ H5MM_memcpy(md_key, H5B_NKEY(bt, shared, idx + 1), type->sizeof_nkey);
if((type->new_node)(f, H5B_INS_RIGHT, md_key, udata,
H5B_NKEY(bt, shared, idx + 1), &new_child_bt_ud.addr/*out*/) < 0)
HGOTO_ERROR(H5E_BTREE, H5E_CANTINSERT, H5B_INS_ERROR, "can't insert maximum leaf node")
@@ -1021,7 +1022,7 @@ H5B__insert_helper(H5F_t *f, H5B_ins_ud_t *bt_ud, const H5B_class_t *type,
*lt_key_changed = FALSE;
} /* end if */
else
- HDmemcpy(lt_key, H5B_NKEY(bt, shared, idx), type->sizeof_nkey);
+ H5MM_memcpy(lt_key, H5B_NKEY(bt, shared, idx), type->sizeof_nkey);
} /* end if */
if(*rt_key_changed) {
bt_ud->cache_flags |= H5AC__DIRTIED_FLAG;
@@ -1031,7 +1032,7 @@ H5B__insert_helper(H5F_t *f, H5B_ins_ud_t *bt_ud, const H5B_class_t *type,
*rt_key_changed = FALSE;
} /* end if */
else
- HDmemcpy(rt_key, H5B_NKEY(bt, shared, idx + 1), type->sizeof_nkey);
+ H5MM_memcpy(rt_key, H5B_NKEY(bt, shared, idx + 1), type->sizeof_nkey);
} /* end if */
/*
@@ -1080,7 +1081,7 @@ H5B__insert_helper(H5F_t *f, H5B_ins_ud_t *bt_ud, const H5B_class_t *type,
* by the left and right node).
*/
if(split_bt_ud->bt) {
- HDmemcpy(md_key, H5B_NKEY(split_bt_ud->bt, shared, 0), type->sizeof_nkey);
+ H5MM_memcpy(md_key, H5B_NKEY(split_bt_ud->bt, shared, 0), type->sizeof_nkey);
ret_value = H5B_INS_RIGHT;
#ifdef H5B_DEBUG
/*
@@ -1339,7 +1340,7 @@ H5B__remove_helper(H5F_t *f, haddr_t addr, const H5B_class_t *type, int level,
/* Don't propagate change out of this B-tree node */
*lt_key_changed = FALSE;
else
- HDmemcpy(lt_key, H5B_NKEY(bt, shared, idx), type->sizeof_nkey);
+ H5MM_memcpy(lt_key, H5B_NKEY(bt, shared, idx), type->sizeof_nkey);
} /* end if */
if(*rt_key_changed) {
HDassert(type->critical_key == H5B_RIGHT);
@@ -1348,7 +1349,7 @@ H5B__remove_helper(H5F_t *f, haddr_t addr, const H5B_class_t *type, int level,
/* Don't propagate change out of this B-tree node */
*rt_key_changed = FALSE;
else
- HDmemcpy(rt_key, H5B_NKEY(bt, shared, idx + 1), type->sizeof_nkey);
+ H5MM_memcpy(rt_key, H5B_NKEY(bt, shared, idx + 1), type->sizeof_nkey);
} /* end if */
/*
@@ -1383,7 +1384,7 @@ H5B__remove_helper(H5F_t *f, haddr_t addr, const H5B_class_t *type, int level,
* in its left neighbor, but only if it is not the critical
* key for the right-most child of the left neighbor */
if(type->critical_key == H5B_LEFT)
- HDmemcpy(H5B_NKEY(sibling, shared, sibling->nchildren),
+ H5MM_memcpy(H5B_NKEY(sibling, shared, sibling->nchildren),
H5B_NKEY(bt, shared, 1), type->sizeof_nkey);
sibling->right = bt->right;
@@ -1400,7 +1401,7 @@ H5B__remove_helper(H5F_t *f, haddr_t addr, const H5B_class_t *type, int level,
* its right neighbor, but only if it is not the critical
* key for the left-most child of the right neighbor */
if(type->critical_key == H5B_RIGHT)
- HDmemcpy(H5B_NKEY(sibling, shared, 0),
+ H5MM_memcpy(H5B_NKEY(sibling, shared, 0),
H5B_NKEY(bt, shared, 0), type->sizeof_nkey);
sibling->left = bt->left;
@@ -1442,7 +1443,7 @@ H5B__remove_helper(H5F_t *f, haddr_t addr, const H5B_class_t *type, int level,
/* Slide all keys down 1, update lt_key */
HDmemmove(H5B_NKEY(bt, shared, 0), H5B_NKEY(bt, shared, 1),
bt->nchildren * type->sizeof_nkey);
- HDmemcpy(lt_key, H5B_NKEY(bt, shared, 0), type->sizeof_nkey);
+ H5MM_memcpy(lt_key, H5B_NKEY(bt, shared, 0), type->sizeof_nkey);
*lt_key_changed = TRUE;
} else
/* Slide all but the leftmost 2 keys down, leaving the leftmost
@@ -1471,7 +1472,7 @@ H5B__remove_helper(H5F_t *f, haddr_t addr, const H5B_class_t *type, int level,
H5B_NKEY(bt, shared, bt->nchildren), type->sizeof_nkey);
else {
/* Just update rt_key */
- HDmemcpy(rt_key, H5B_NKEY(bt, shared, bt->nchildren - 1),
+ H5MM_memcpy(rt_key, H5B_NKEY(bt, shared, bt->nchildren - 1),
type->sizeof_nkey);
*rt_key_changed = TRUE;
} /* end else */
@@ -1516,7 +1517,7 @@ H5B__remove_helper(H5F_t *f, haddr_t addr, const H5B_class_t *type, int level,
if(NULL == (sibling = (H5B_t *)H5AC_protect(f, H5AC_BT, bt->left, &cache_udata, H5AC__NO_FLAGS_SET)))
HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, H5B_INS_ERROR, "unable to protect node")
- HDmemcpy(H5B_NKEY(sibling, shared, sibling->nchildren),
+ H5MM_memcpy(H5B_NKEY(sibling, shared, sibling->nchildren),
H5B_NKEY(bt, shared, 0), type->sizeof_nkey);
if(H5AC_unprotect(f, H5AC_BT, bt->left, sibling, H5AC__DIRTIED_FLAG) < 0)
@@ -1531,7 +1532,7 @@ H5B__remove_helper(H5F_t *f, haddr_t addr, const H5B_class_t *type, int level,
if(NULL == (sibling = (H5B_t *)H5AC_protect(f, H5AC_BT, bt->right, &cache_udata, H5AC__NO_FLAGS_SET)))
HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, H5B_INS_ERROR, "unable to protect node")
- HDmemcpy(H5B_NKEY(sibling, shared, 0),
+ H5MM_memcpy(H5B_NKEY(sibling, shared, 0),
H5B_NKEY(bt, shared, bt->nchildren), type->sizeof_nkey);
if(H5AC_unprotect(f, H5AC_BT, bt->right, sibling, H5AC__DIRTIED_FLAG) < 0)
@@ -1811,7 +1812,7 @@ H5B__copy(const H5B_t *old_bt)
HGOTO_ERROR(H5E_BTREE, H5E_CANTALLOC, NULL, "memory allocation failed for B-tree root node")
/* Copy the main structure */
- HDmemcpy(new_node, old_bt, sizeof(H5B_t));
+ H5MM_memcpy(new_node, old_bt, sizeof(H5B_t));
/* Reset cache info */
HDmemset(&new_node->cache_info, 0, sizeof(H5AC_info_t));
@@ -1821,8 +1822,8 @@ H5B__copy(const H5B_t *old_bt)
HGOTO_ERROR(H5E_BTREE, H5E_CANTALLOC, NULL, "memory allocation failed for B-tree root node")
/* Copy the other structures */
- HDmemcpy(new_node->native, old_bt->native, shared->sizeof_keys);
- HDmemcpy(new_node->child, old_bt->child, (sizeof(haddr_t) * shared->two_k));
+ H5MM_memcpy(new_node->native, old_bt->native, shared->sizeof_keys);
+ H5MM_memcpy(new_node->child, old_bt->child, (sizeof(haddr_t) * shared->two_k));
/* Increment the ref-count on the raw page */
H5UC_INC(new_node->rc_shared);
diff --git a/src/H5B2.c b/src/H5B2.c
index cf8e4a9..6b0d7a3 100644
--- a/src/H5B2.c
+++ b/src/H5B2.c
@@ -662,7 +662,7 @@ H5B2_find(H5B2_t *bt2, void *udata, H5B2_found_t op, void *op_data)
if(hdr->min_native_rec == NULL)
if(NULL == (hdr->min_native_rec = H5MM_malloc(hdr->cls->nrec_size)))
HGOTO_ERROR(H5E_BTREE, H5E_CANTALLOC, FAIL, "memory allocation failed for v2 B-tree min record info")
- HDmemcpy(hdr->min_native_rec, H5B2_LEAF_NREC(leaf, hdr, idx), hdr->cls->nrec_size);
+ H5MM_memcpy(hdr->min_native_rec, H5B2_LEAF_NREC(leaf, hdr, idx), hdr->cls->nrec_size);
} /* end if */
} /* end if */
if(idx == (unsigned)(leaf->nrec - 1)) {
@@ -670,7 +670,7 @@ H5B2_find(H5B2_t *bt2, void *udata, H5B2_found_t op, void *op_data)
if(hdr->max_native_rec == NULL)
if(NULL == (hdr->max_native_rec = H5MM_malloc(hdr->cls->nrec_size)))
HGOTO_ERROR(H5E_BTREE, H5E_CANTALLOC, FAIL, "memory allocation failed for v2 B-tree max record info")
- HDmemcpy(hdr->max_native_rec, H5B2_LEAF_NREC(leaf, hdr, idx), hdr->cls->nrec_size);
+ H5MM_memcpy(hdr->max_native_rec, H5B2_LEAF_NREC(leaf, hdr, idx), hdr->cls->nrec_size);
} /* end if */
} /* end if */
} /* end if */
@@ -1343,7 +1343,7 @@ H5B2_modify(H5B2_t *bt2, void *udata, H5B2_modify_t op, void *op_data)
if(hdr->min_native_rec == NULL)
if(NULL == (hdr->min_native_rec = H5MM_malloc(hdr->cls->nrec_size)))
HGOTO_ERROR(H5E_BTREE, H5E_CANTALLOC, FAIL, "memory allocation failed for v2 B-tree min record info")
- HDmemcpy(hdr->min_native_rec, H5B2_LEAF_NREC(leaf, hdr, idx), hdr->cls->nrec_size);
+ H5MM_memcpy(hdr->min_native_rec, H5B2_LEAF_NREC(leaf, hdr, idx), hdr->cls->nrec_size);
} /* end if */
} /* end if */
if(idx == (unsigned)(leaf->nrec - 1)) {
@@ -1351,7 +1351,7 @@ H5B2_modify(H5B2_t *bt2, void *udata, H5B2_modify_t op, void *op_data)
if(hdr->max_native_rec == NULL)
if(NULL == (hdr->max_native_rec = H5MM_malloc(hdr->cls->nrec_size)))
HGOTO_ERROR(H5E_BTREE, H5E_CANTALLOC, FAIL, "memory allocation failed for v2 B-tree max record info")
- HDmemcpy(hdr->max_native_rec, H5B2_LEAF_NREC(leaf, hdr, idx), hdr->cls->nrec_size);
+ H5MM_memcpy(hdr->max_native_rec, H5B2_LEAF_NREC(leaf, hdr, idx), hdr->cls->nrec_size);
} /* end if */
} /* end if */
} /* end if */
diff --git a/src/H5B2cache.c b/src/H5B2cache.c
index 2e1d37b..2a77bd5 100644
--- a/src/H5B2cache.c
+++ b/src/H5B2cache.c
@@ -391,7 +391,7 @@ H5B2__cache_hdr_serialize(const H5F_t *f, void *_image, size_t H5_ATTR_UNUSED le
HDassert(hdr);
/* Magic number */
- HDmemcpy(image, H5B2_HDR_MAGIC, (size_t)H5_SIZEOF_MAGIC);
+ H5MM_memcpy(image, H5B2_HDR_MAGIC, (size_t)H5_SIZEOF_MAGIC);
image += H5_SIZEOF_MAGIC;
/* Version # */
@@ -811,7 +811,7 @@ H5B2__cache_int_serialize(const H5F_t *f, void *_image, size_t H5_ATTR_UNUSED le
HDassert(internal->hdr);
/* Magic number */
- HDmemcpy(image, H5B2_INT_MAGIC, (size_t)H5_SIZEOF_MAGIC);
+ H5MM_memcpy(image, H5B2_INT_MAGIC, (size_t)H5_SIZEOF_MAGIC);
image += H5_SIZEOF_MAGIC;
/* Version # */
@@ -1212,7 +1212,7 @@ H5B2__cache_leaf_serialize(const H5F_t H5_ATTR_UNUSED *f, void *_image, size_t H
HDassert(leaf->hdr);
/* magic number */
- HDmemcpy(image, H5B2_LEAF_MAGIC, (size_t)H5_SIZEOF_MAGIC);
+ H5MM_memcpy(image, H5B2_LEAF_MAGIC, (size_t)H5_SIZEOF_MAGIC);
image += H5_SIZEOF_MAGIC;
/* version # */
diff --git a/src/H5B2int.c b/src/H5B2int.c
index b3f855f..9940cd7 100644
--- a/src/H5B2int.c
+++ b/src/H5B2int.c
@@ -35,6 +35,7 @@
#include "H5private.h" /* Generic Functions */
#include "H5B2pkg.h" /* v2 B-trees */
#include "H5Eprivate.h" /* Error handling */
+#include "H5MMprivate.h" /* Memory management */
#include "H5VMprivate.h" /* Vectors and arrays */
@@ -241,17 +242,17 @@ H5B2__split1(H5B2_hdr_t *hdr, uint16_t depth, H5B2_node_ptr_t *curr_node_ptr,
mid_record = old_node_nrec / 2;
/* Copy "upper half" of records to new child */
- HDmemcpy(H5B2_NAT_NREC(right_native, hdr, 0),
+ H5MM_memcpy(H5B2_NAT_NREC(right_native, hdr, 0),
H5B2_NAT_NREC(left_native, hdr, mid_record + (unsigned)1),
hdr->cls->nrec_size * (old_node_nrec - (mid_record + (unsigned)1)));
/* Copy "upper half" of node pointers, if the node is an internal node */
if(depth > 1)
- HDmemcpy(&(right_node_ptrs[0]), &(left_node_ptrs[mid_record + (unsigned)1]),
+ H5MM_memcpy(&(right_node_ptrs[0]), &(left_node_ptrs[mid_record + (unsigned)1]),
sizeof(H5B2_node_ptr_t) * (size_t)(old_node_nrec - mid_record));
/* Copy "middle" record to internal node */
- HDmemcpy(H5B2_INT_NREC(internal, hdr, idx), H5B2_NAT_NREC(left_native, hdr, mid_record), hdr->cls->nrec_size);
+ H5MM_memcpy(H5B2_INT_NREC(internal, hdr, idx), H5B2_NAT_NREC(left_native, hdr, mid_record), hdr->cls->nrec_size);
/* Mark nodes as dirty */
left_child_flags |= H5AC__DIRTIED_FLAG;
@@ -510,14 +511,14 @@ H5B2__redistribute2(H5B2_hdr_t *hdr, uint16_t depth, H5B2_internal_t *internal,
uint16_t move_nrec = (uint16_t)(*right_nrec - new_right_nrec); /* Number of records to move from right node to left */
/* Copy record from parent node down into left child */
- HDmemcpy(H5B2_NAT_NREC(left_native, hdr, *left_nrec), H5B2_INT_NREC(internal, hdr, idx), hdr->cls->nrec_size);
+ H5MM_memcpy(H5B2_NAT_NREC(left_native, hdr, *left_nrec), H5B2_INT_NREC(internal, hdr, idx), hdr->cls->nrec_size);
/* See if we need to move records from right node */
if(move_nrec > 1)
- HDmemcpy(H5B2_NAT_NREC(left_native, hdr, (*left_nrec + 1)), H5B2_NAT_NREC(right_native, hdr, 0), hdr->cls->nrec_size * (size_t)(move_nrec - 1));
+ H5MM_memcpy(H5B2_NAT_NREC(left_native, hdr, (*left_nrec + 1)), H5B2_NAT_NREC(right_native, hdr, 0), hdr->cls->nrec_size * (size_t)(move_nrec - 1));
/* Move record from right node into parent node */
- HDmemcpy(H5B2_INT_NREC(internal, hdr, idx), H5B2_NAT_NREC(right_native, hdr, (move_nrec - 1)), hdr->cls->nrec_size);
+ H5MM_memcpy(H5B2_INT_NREC(internal, hdr, idx), H5B2_NAT_NREC(right_native, hdr, (move_nrec - 1)), hdr->cls->nrec_size);
/* Slide records in right node down */
HDmemmove(H5B2_NAT_NREC(right_native, hdr, 0), H5B2_NAT_NREC(right_native, hdr, move_nrec), hdr->cls->nrec_size * new_right_nrec);
@@ -534,7 +535,7 @@ H5B2__redistribute2(H5B2_hdr_t *hdr, uint16_t depth, H5B2_internal_t *internal,
right_moved_nrec -= (hssize_t)moved_nrec;
/* Copy node pointers from right node to left */
- HDmemcpy(&(left_node_ptrs[*left_nrec + 1]), &(right_node_ptrs[0]), sizeof(H5B2_node_ptr_t) * move_nrec);
+ H5MM_memcpy(&(left_node_ptrs[*left_nrec + 1]), &(right_node_ptrs[0]), sizeof(H5B2_node_ptr_t) * move_nrec);
/* Slide node pointers in right node down */
HDmemmove(&(right_node_ptrs[0]), &(right_node_ptrs[move_nrec]), sizeof(H5B2_node_ptr_t) * (new_right_nrec + (unsigned)1));
@@ -569,14 +570,14 @@ H5B2__redistribute2(H5B2_hdr_t *hdr, uint16_t depth, H5B2_internal_t *internal,
hdr->cls->nrec_size * (*right_nrec));
/* Copy record from parent node down into right child */
- HDmemcpy(H5B2_NAT_NREC(right_native, hdr, (move_nrec - 1)), H5B2_INT_NREC(internal, hdr, idx), hdr->cls->nrec_size);
+ H5MM_memcpy(H5B2_NAT_NREC(right_native, hdr, (move_nrec - 1)), H5B2_INT_NREC(internal, hdr, idx), hdr->cls->nrec_size);
/* See if we need to move records from left node */
if(move_nrec > 1)
- HDmemcpy(H5B2_NAT_NREC(right_native, hdr, 0), H5B2_NAT_NREC(left_native, hdr, ((*left_nrec - move_nrec) + 1)), hdr->cls->nrec_size * (size_t)(move_nrec - 1));
+ H5MM_memcpy(H5B2_NAT_NREC(right_native, hdr, 0), H5B2_NAT_NREC(left_native, hdr, ((*left_nrec - move_nrec) + 1)), hdr->cls->nrec_size * (size_t)(move_nrec - 1));
/* Move record from left node into parent node */
- HDmemcpy(H5B2_INT_NREC(internal, hdr, idx), H5B2_NAT_NREC(left_native, hdr, (*left_nrec - move_nrec)), hdr->cls->nrec_size);
+ H5MM_memcpy(H5B2_INT_NREC(internal, hdr, idx), H5B2_NAT_NREC(left_native, hdr, (*left_nrec - move_nrec)), hdr->cls->nrec_size);
/* Handle node pointers, if we have an internal node */
if(depth > 1) {
@@ -587,7 +588,7 @@ H5B2__redistribute2(H5B2_hdr_t *hdr, uint16_t depth, H5B2_internal_t *internal,
HDmemmove(&(right_node_ptrs[move_nrec]), &(right_node_ptrs[0]), sizeof(H5B2_node_ptr_t) * (size_t)(*right_nrec + 1));
/* Copy node pointers from left node to right */
- HDmemcpy(&(right_node_ptrs[0]), &(left_node_ptrs[new_left_nrec + 1]), sizeof(H5B2_node_ptr_t) * move_nrec);
+ H5MM_memcpy(&(right_node_ptrs[0]), &(left_node_ptrs[new_left_nrec + 1]), sizeof(H5B2_node_ptr_t) * move_nrec);
/* Count the number of records being moved */
for(u = 0; u < move_nrec; u++)
@@ -775,16 +776,16 @@ H5B2__redistribute3(H5B2_hdr_t *hdr, uint16_t depth, H5B2_internal_t *internal,
uint16_t moved_middle_nrec = 0; /* Number of records moved into left node */
/* Move left parent record down to left node */
- HDmemcpy(H5B2_NAT_NREC(left_native, hdr, *left_nrec), H5B2_INT_NREC(internal, hdr, idx - 1), hdr->cls->nrec_size);
+ H5MM_memcpy(H5B2_NAT_NREC(left_native, hdr, *left_nrec), H5B2_INT_NREC(internal, hdr, idx - 1), hdr->cls->nrec_size);
/* Move records from middle node into left node */
if((new_left_nrec - 1) > *left_nrec) {
moved_middle_nrec = (uint16_t)(new_left_nrec - (*left_nrec + 1));
- HDmemcpy(H5B2_NAT_NREC(left_native, hdr, *left_nrec + 1), H5B2_NAT_NREC(middle_native, hdr, 0), hdr->cls->nrec_size * moved_middle_nrec);
+ H5MM_memcpy(H5B2_NAT_NREC(left_native, hdr, *left_nrec + 1), H5B2_NAT_NREC(middle_native, hdr, 0), hdr->cls->nrec_size * moved_middle_nrec);
} /* end if */
/* Move record from middle node up to parent node */
- HDmemcpy(H5B2_INT_NREC(internal, hdr, idx - 1), H5B2_NAT_NREC(middle_native, hdr, moved_middle_nrec), hdr->cls->nrec_size);
+ H5MM_memcpy(H5B2_INT_NREC(internal, hdr, idx - 1), H5B2_NAT_NREC(middle_native, hdr, moved_middle_nrec), hdr->cls->nrec_size);
moved_middle_nrec++;
/* Slide records in middle node down */
@@ -798,7 +799,7 @@ H5B2__redistribute3(H5B2_hdr_t *hdr, uint16_t depth, H5B2_internal_t *internal,
/* Move middle node pointers into left node */
move_nptrs = (unsigned)(new_left_nrec - *left_nrec);
- HDmemcpy(&(left_node_ptrs[*left_nrec + 1]), &(middle_node_ptrs[0]), sizeof(H5B2_node_ptr_t)*move_nptrs);
+ H5MM_memcpy(&(left_node_ptrs[*left_nrec + 1]), &(middle_node_ptrs[0]), sizeof(H5B2_node_ptr_t)*move_nptrs);
/* Count the number of records being moved into the left node */
for(u = 0, moved_nrec = 0; u < move_nptrs; u++)
@@ -832,14 +833,14 @@ H5B2__redistribute3(H5B2_hdr_t *hdr, uint16_t depth, H5B2_internal_t *internal,
HDmemmove(H5B2_NAT_NREC(right_native, hdr, right_nrec_move), H5B2_NAT_NREC(right_native, hdr, 0), hdr->cls->nrec_size * (*right_nrec));
/* Move right parent record down to right node */
- HDmemcpy(H5B2_NAT_NREC(right_native, hdr, right_nrec_move - 1), H5B2_INT_NREC(internal, hdr, idx), hdr->cls->nrec_size);
+ H5MM_memcpy(H5B2_NAT_NREC(right_native, hdr, right_nrec_move - 1), H5B2_INT_NREC(internal, hdr, idx), hdr->cls->nrec_size);
/* Move records from middle node into right node */
if(right_nrec_move > 1)
- HDmemcpy(H5B2_NAT_NREC(right_native, hdr, 0), H5B2_NAT_NREC(middle_native, hdr, ((curr_middle_nrec - right_nrec_move) + 1)), hdr->cls->nrec_size * (right_nrec_move - 1));
+ H5MM_memcpy(H5B2_NAT_NREC(right_native, hdr, 0), H5B2_NAT_NREC(middle_native, hdr, ((curr_middle_nrec - right_nrec_move) + 1)), hdr->cls->nrec_size * (right_nrec_move - 1));
/* Move record from middle node up to parent node */
- HDmemcpy(H5B2_INT_NREC(internal, hdr, idx), H5B2_NAT_NREC(middle_native, hdr, (curr_middle_nrec - right_nrec_move)), hdr->cls->nrec_size);
+ H5MM_memcpy(H5B2_INT_NREC(internal, hdr, idx), H5B2_NAT_NREC(middle_native, hdr, (curr_middle_nrec - right_nrec_move)), hdr->cls->nrec_size);
/* Move node pointers also if this is an internal node */
if(depth > 1) {
@@ -850,7 +851,7 @@ H5B2__redistribute3(H5B2_hdr_t *hdr, uint16_t depth, H5B2_internal_t *internal,
HDmemmove(&(right_node_ptrs[right_nrec_move]), &(right_node_ptrs[0]), sizeof(H5B2_node_ptr_t) * (size_t)(*right_nrec + 1));
/* Move middle node pointers into right node */
- HDmemcpy(&(right_node_ptrs[0]), &(middle_node_ptrs[(curr_middle_nrec - right_nrec_move) + 1]), sizeof(H5B2_node_ptr_t) * right_nrec_move);
+ H5MM_memcpy(&(right_node_ptrs[0]), &(middle_node_ptrs[(curr_middle_nrec - right_nrec_move) + 1]), sizeof(H5B2_node_ptr_t) * right_nrec_move);
/* Count the number of records being moved into the right node */
for(u = 0, moved_nrec = 0; u < right_nrec_move; u++)
@@ -881,14 +882,14 @@ H5B2__redistribute3(H5B2_hdr_t *hdr, uint16_t depth, H5B2_internal_t *internal,
HDmemmove(H5B2_NAT_NREC(middle_native, hdr, left_nrec_move), H5B2_NAT_NREC(middle_native, hdr, 0), hdr->cls->nrec_size * curr_middle_nrec);
/* Move left parent record down to middle node */
- HDmemcpy(H5B2_NAT_NREC(middle_native, hdr, left_nrec_move - 1), H5B2_INT_NREC(internal, hdr, idx - 1), hdr->cls->nrec_size);
+ H5MM_memcpy(H5B2_NAT_NREC(middle_native, hdr, left_nrec_move - 1), H5B2_INT_NREC(internal, hdr, idx - 1), hdr->cls->nrec_size);
/* Move left records to middle node */
if(left_nrec_move > 1)
HDmemmove(H5B2_NAT_NREC(middle_native, hdr, 0), H5B2_NAT_NREC(left_native, hdr, new_left_nrec + 1), hdr->cls->nrec_size * (left_nrec_move - 1));
/* Move left parent record up from left node */
- HDmemcpy(H5B2_INT_NREC(internal, hdr, idx - 1), H5B2_NAT_NREC(left_native, hdr, new_left_nrec), hdr->cls->nrec_size);
+ H5MM_memcpy(H5B2_INT_NREC(internal, hdr, idx - 1), H5B2_NAT_NREC(left_native, hdr, new_left_nrec), hdr->cls->nrec_size);
/* Move node pointers also if this is an internal node */
if(depth > 1) {
@@ -899,7 +900,7 @@ H5B2__redistribute3(H5B2_hdr_t *hdr, uint16_t depth, H5B2_internal_t *internal,
HDmemmove(&(middle_node_ptrs[left_nrec_move]), &(middle_node_ptrs[0]), sizeof(H5B2_node_ptr_t) * (size_t)(curr_middle_nrec + 1));
/* Move left node pointers into middle node */
- HDmemcpy(&(middle_node_ptrs[0]), &(left_node_ptrs[new_left_nrec + 1]), sizeof(H5B2_node_ptr_t) * left_nrec_move);
+ H5MM_memcpy(&(middle_node_ptrs[0]), &(left_node_ptrs[new_left_nrec + 1]), sizeof(H5B2_node_ptr_t) * left_nrec_move);
/* Count the number of records being moved into the left node */
for(u = 0, moved_nrec = 0; u < left_nrec_move; u++)
@@ -927,13 +928,13 @@ H5B2__redistribute3(H5B2_hdr_t *hdr, uint16_t depth, H5B2_internal_t *internal,
unsigned right_nrec_move = (unsigned)(*right_nrec - new_right_nrec); /* Number of records to move out of right node */
/* Move right parent record down to middle node */
- HDmemcpy(H5B2_NAT_NREC(middle_native, hdr, curr_middle_nrec), H5B2_INT_NREC(internal, hdr, idx), hdr->cls->nrec_size);
+ H5MM_memcpy(H5B2_NAT_NREC(middle_native, hdr, curr_middle_nrec), H5B2_INT_NREC(internal, hdr, idx), hdr->cls->nrec_size);
/* Move right records to middle node */
HDmemmove(H5B2_NAT_NREC(middle_native, hdr, (curr_middle_nrec + 1)), H5B2_NAT_NREC(right_native, hdr, 0), hdr->cls->nrec_size * (right_nrec_move - 1));
/* Move right parent record up from right node */
- HDmemcpy(H5B2_INT_NREC(internal, hdr, idx), H5B2_NAT_NREC(right_native, hdr, right_nrec_move - 1), hdr->cls->nrec_size);
+ H5MM_memcpy(H5B2_INT_NREC(internal, hdr, idx), H5B2_NAT_NREC(right_native, hdr, right_nrec_move - 1), hdr->cls->nrec_size);
/* Slide right records down */
HDmemmove(H5B2_NAT_NREC(right_native, hdr, 0), H5B2_NAT_NREC(right_native, hdr, right_nrec_move), hdr->cls->nrec_size * new_right_nrec);
@@ -944,7 +945,7 @@ H5B2__redistribute3(H5B2_hdr_t *hdr, uint16_t depth, H5B2_internal_t *internal,
unsigned u; /* Local index variable */
/* Move right node pointers into middle node */
- HDmemcpy(&(middle_node_ptrs[curr_middle_nrec + 1]), &(right_node_ptrs[0]), sizeof(H5B2_node_ptr_t) * right_nrec_move);
+ H5MM_memcpy(&(middle_node_ptrs[curr_middle_nrec + 1]), &(right_node_ptrs[0]), sizeof(H5B2_node_ptr_t) * right_nrec_move);
/* Count the number of records being moved into the right node */
for(u = 0, moved_nrec = 0; u < right_nrec_move; u++)
@@ -1113,14 +1114,14 @@ H5B2__merge2(H5B2_hdr_t *hdr, uint16_t depth, H5B2_node_ptr_t *curr_node_ptr,
/* Redistribute records into left node */
{
/* Copy record from parent node to proper location */
- HDmemcpy(H5B2_NAT_NREC(left_native, hdr, *left_nrec), H5B2_INT_NREC(internal, hdr, idx), hdr->cls->nrec_size);
+ H5MM_memcpy(H5B2_NAT_NREC(left_native, hdr, *left_nrec), H5B2_INT_NREC(internal, hdr, idx), hdr->cls->nrec_size);
/* Copy records from right node to left node */
- HDmemcpy(H5B2_NAT_NREC(left_native, hdr, *left_nrec + 1), H5B2_NAT_NREC(right_native, hdr, 0), hdr->cls->nrec_size * (*right_nrec));
+ H5MM_memcpy(H5B2_NAT_NREC(left_native, hdr, *left_nrec + 1), H5B2_NAT_NREC(right_native, hdr, 0), hdr->cls->nrec_size * (*right_nrec));
/* Copy node pointers from right node into left node */
if(depth > 1)
- HDmemcpy(&(left_node_ptrs[*left_nrec + 1]), &(right_node_ptrs[0]), sizeof(H5B2_node_ptr_t) * (size_t)(*right_nrec + 1));
+ H5MM_memcpy(&(left_node_ptrs[*left_nrec + 1]), &(right_node_ptrs[0]), sizeof(H5B2_node_ptr_t) * (size_t)(*right_nrec + 1));
/* Update flush dependencies for grandchildren, if using SWMR */
if(hdr->swmr_write && depth > 1)
@@ -1304,13 +1305,13 @@ H5B2__merge3(H5B2_hdr_t *hdr, uint16_t depth, H5B2_node_ptr_t *curr_node_ptr,
middle_moved_nrec = middle_nrec_move;
/* Copy record from parent node to proper location in left node */
- HDmemcpy(H5B2_NAT_NREC(left_native, hdr, *left_nrec), H5B2_INT_NREC(internal, hdr, idx - 1), hdr->cls->nrec_size);
+ H5MM_memcpy(H5B2_NAT_NREC(left_native, hdr, *left_nrec), H5B2_INT_NREC(internal, hdr, idx - 1), hdr->cls->nrec_size);
/* Copy records from middle node to left node */
- HDmemcpy(H5B2_NAT_NREC(left_native, hdr, *left_nrec + 1), H5B2_NAT_NREC(middle_native, hdr, 0), hdr->cls->nrec_size * (middle_nrec_move - 1));
+ H5MM_memcpy(H5B2_NAT_NREC(left_native, hdr, *left_nrec + 1), H5B2_NAT_NREC(middle_native, hdr, 0), hdr->cls->nrec_size * (middle_nrec_move - 1));
/* Copy record from middle node to proper location in parent node */
- HDmemcpy(H5B2_INT_NREC(internal, hdr, idx - 1), H5B2_NAT_NREC(middle_native, hdr, (middle_nrec_move - 1)), hdr->cls->nrec_size);
+ H5MM_memcpy(H5B2_INT_NREC(internal, hdr, idx - 1), H5B2_NAT_NREC(middle_native, hdr, (middle_nrec_move - 1)), hdr->cls->nrec_size);
/* Slide records in middle node down */
HDmemmove(H5B2_NAT_NREC(middle_native, hdr, 0), H5B2_NAT_NREC(middle_native, hdr, middle_nrec_move), hdr->cls->nrec_size * (*middle_nrec - middle_nrec_move));
@@ -1320,7 +1321,7 @@ H5B2__merge3(H5B2_hdr_t *hdr, uint16_t depth, H5B2_node_ptr_t *curr_node_ptr,
unsigned u; /* Local index variable */
/* Copy node pointers from middle node into left node */
- HDmemcpy(&(left_node_ptrs[*left_nrec + 1]), &(middle_node_ptrs[0]), sizeof(H5B2_node_ptr_t) * middle_nrec_move);
+ H5MM_memcpy(&(left_node_ptrs[*left_nrec + 1]), &(middle_node_ptrs[0]), sizeof(H5B2_node_ptr_t) * middle_nrec_move);
/* Count the number of records being moved into the left node */
for(u = 0; u < middle_nrec_move; u++)
@@ -1348,15 +1349,15 @@ H5B2__merge3(H5B2_hdr_t *hdr, uint16_t depth, H5B2_node_ptr_t *curr_node_ptr,
/* Redistribute records into middle node */
{
/* Copy record from parent node to proper location in middle node */
- HDmemcpy(H5B2_NAT_NREC(middle_native, hdr, *middle_nrec), H5B2_INT_NREC(internal, hdr, idx), hdr->cls->nrec_size);
+ H5MM_memcpy(H5B2_NAT_NREC(middle_native, hdr, *middle_nrec), H5B2_INT_NREC(internal, hdr, idx), hdr->cls->nrec_size);
/* Copy records from right node to middle node */
- HDmemcpy(H5B2_NAT_NREC(middle_native, hdr, *middle_nrec + 1), H5B2_NAT_NREC(right_native, hdr, 0), hdr->cls->nrec_size * (*right_nrec));
+ H5MM_memcpy(H5B2_NAT_NREC(middle_native, hdr, *middle_nrec + 1), H5B2_NAT_NREC(right_native, hdr, 0), hdr->cls->nrec_size * (*right_nrec));
/* Move node pointers also if this is an internal node */
if(depth > 1)
/* Copy node pointers from right node into middle node */
- HDmemcpy(&(middle_node_ptrs[*middle_nrec + 1]), &(right_node_ptrs[0]), sizeof(H5B2_node_ptr_t) * (size_t)(*right_nrec + 1));
+ H5MM_memcpy(&(middle_node_ptrs[*middle_nrec + 1]), &(right_node_ptrs[0]), sizeof(H5B2_node_ptr_t) * (size_t)(*right_nrec + 1));
/* Update flush dependencies for grandchildren, if using SWMR */
if(hdr->swmr_write && depth > 1)
@@ -1539,7 +1540,7 @@ H5B2__iterate_node(H5B2_hdr_t *hdr, uint16_t depth, const H5B2_node_ptr_t *curr_
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed for B-tree internal node pointers")
/* Copy the node pointers */
- HDmemcpy(node_ptrs, internal->node_ptrs, (sizeof(H5B2_node_ptr_t) * (size_t)(curr_node->node_nrec + 1)));
+ H5MM_memcpy(node_ptrs, internal->node_ptrs, (sizeof(H5B2_node_ptr_t) * (size_t)(curr_node->node_nrec + 1)));
} /* end if */
else {
H5B2_leaf_t *leaf; /* Pointer to leaf node */
@@ -1559,7 +1560,7 @@ H5B2__iterate_node(H5B2_hdr_t *hdr, uint16_t depth, const H5B2_node_ptr_t *curr_
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed for B-tree internal native keys")
/* Copy the native keys */
- HDmemcpy(native, node_native, (hdr->cls->nrec_size * curr_node->node_nrec));
+ H5MM_memcpy(native, node_native, (hdr->cls->nrec_size * curr_node->node_nrec));
/* Unlock the node */
if(H5AC_unprotect(hdr->f, curr_node_class, curr_node->addr, node, (unsigned)(hdr->swmr_write ? H5AC__PIN_ENTRY_FLAG : H5AC__NO_FLAGS_SET)) < 0)
diff --git a/src/H5B2leaf.c b/src/H5B2leaf.c
index 54d40ea..beca40c 100644
--- a/src/H5B2leaf.c
+++ b/src/H5B2leaf.c
@@ -412,7 +412,7 @@ H5B2__insert_leaf(H5B2_hdr_t *hdr, H5B2_node_ptr_t *curr_node_ptr,
if(hdr->min_native_rec == NULL)
if(NULL == (hdr->min_native_rec = H5MM_malloc(hdr->cls->nrec_size)))
HGOTO_ERROR(H5E_BTREE, H5E_CANTALLOC, FAIL, "memory allocation failed for v2 B-tree min record info")
- HDmemcpy(hdr->min_native_rec, H5B2_LEAF_NREC(leaf, hdr, idx), hdr->cls->nrec_size);
+ H5MM_memcpy(hdr->min_native_rec, H5B2_LEAF_NREC(leaf, hdr, idx), hdr->cls->nrec_size);
} /* end if */
} /* end if */
if(idx == (unsigned)(leaf->nrec - 1)) {
@@ -420,7 +420,7 @@ H5B2__insert_leaf(H5B2_hdr_t *hdr, H5B2_node_ptr_t *curr_node_ptr,
if(hdr->max_native_rec == NULL)
if(NULL == (hdr->max_native_rec = H5MM_malloc(hdr->cls->nrec_size)))
HGOTO_ERROR(H5E_BTREE, H5E_CANTALLOC, FAIL, "memory allocation failed for v2 B-tree max record info")
- HDmemcpy(hdr->max_native_rec, H5B2_LEAF_NREC(leaf, hdr, idx), hdr->cls->nrec_size);
+ H5MM_memcpy(hdr->max_native_rec, H5B2_LEAF_NREC(leaf, hdr, idx), hdr->cls->nrec_size);
} /* end if */
} /* end if */
} /* end if */
@@ -561,7 +561,7 @@ H5B2__update_leaf(H5B2_hdr_t *hdr, H5B2_node_ptr_t *curr_node_ptr,
if(hdr->min_native_rec == NULL)
if(NULL == (hdr->min_native_rec = H5MM_malloc(hdr->cls->nrec_size)))
HGOTO_ERROR(H5E_BTREE, H5E_CANTALLOC, FAIL, "memory allocation failed for v2 B-tree min record info")
- HDmemcpy(hdr->min_native_rec, H5B2_LEAF_NREC(leaf, hdr, idx), hdr->cls->nrec_size);
+ H5MM_memcpy(hdr->min_native_rec, H5B2_LEAF_NREC(leaf, hdr, idx), hdr->cls->nrec_size);
} /* end if */
} /* end if */
if(idx == (unsigned)(leaf->nrec - 1)) {
@@ -569,7 +569,7 @@ H5B2__update_leaf(H5B2_hdr_t *hdr, H5B2_node_ptr_t *curr_node_ptr,
if(hdr->max_native_rec == NULL)
if(NULL == (hdr->max_native_rec = H5MM_malloc(hdr->cls->nrec_size)))
HGOTO_ERROR(H5E_BTREE, H5E_CANTALLOC, FAIL, "memory allocation failed for v2 B-tree max record info")
- HDmemcpy(hdr->max_native_rec, H5B2_LEAF_NREC(leaf, hdr, idx), hdr->cls->nrec_size);
+ H5MM_memcpy(hdr->max_native_rec, H5B2_LEAF_NREC(leaf, hdr, idx), hdr->cls->nrec_size);
} /* end if */
} /* end if */
} /* end if */
@@ -664,9 +664,9 @@ H5B2__swap_leaf(H5B2_hdr_t *hdr, uint16_t depth, H5B2_internal_t *internal,
} /* end else */
/* Swap records (use disk page as temporary buffer) */
- HDmemcpy(hdr->page, H5B2_NAT_NREC(child_native, hdr, 0), hdr->cls->nrec_size);
- HDmemcpy(H5B2_NAT_NREC(child_native, hdr, 0), swap_loc, hdr->cls->nrec_size);
- HDmemcpy(swap_loc, hdr->page, hdr->cls->nrec_size);
+ H5MM_memcpy(hdr->page, H5B2_NAT_NREC(child_native, hdr, 0), hdr->cls->nrec_size);
+ H5MM_memcpy(H5B2_NAT_NREC(child_native, hdr, 0), swap_loc, hdr->cls->nrec_size);
+ H5MM_memcpy(swap_loc, hdr->page, hdr->cls->nrec_size);
/* Mark parent as dirty */
*internal_flags_ptr |= H5AC__DIRTIED_FLAG;
diff --git a/src/H5Bcache.c b/src/H5Bcache.c
index a0a75c8..c2c7a80 100644
--- a/src/H5Bcache.c
+++ b/src/H5Bcache.c
@@ -35,6 +35,7 @@
#include "H5private.h" /* Generic Functions */
#include "H5Bpkg.h" /* B-link trees */
#include "H5Eprivate.h" /* Error handling */
+#include "H5MMprivate.h" /* Memory management */
/****************/
@@ -304,7 +305,7 @@ H5B__cache_serialize(const H5F_t *f, void *_image, size_t H5_ATTR_UNUSED len,
HDassert(shared->type->encode);
/* magic number */
- HDmemcpy(image, H5B_MAGIC, (size_t)H5_SIZEOF_MAGIC);
+ H5MM_memcpy(image, H5B_MAGIC, (size_t)H5_SIZEOF_MAGIC);
image += 4;
/* node type and level */
diff --git a/src/H5Bdbg.c b/src/H5Bdbg.c
index c491783..665e826 100644
--- a/src/H5Bdbg.c
+++ b/src/H5Bdbg.c
@@ -193,13 +193,13 @@ H5B__assert(H5F_t *f, haddr_t addr, const H5B_class_t *type, void *udata)
FUNC_ENTER_PACKAGE
if(0 == ncalls++) {
- if(H5DEBUG(B))
- fprintf(H5DEBUG(B), "H5B: debugging B-trees (expensive)\n");
+ if(H5DEBUG(B))
+ HDfprintf(H5DEBUG(B), "H5B: debugging B-trees (expensive)\n");
} /* end if */
/* Get shared info for B-tree */
if(NULL == (rc_shared = (type->get_shared)(f, udata)))
- HGOTO_ERROR(H5E_BTREE, H5E_CANTGET, FAIL, "can't retrieve B-tree's shared ref. count object")
+ HGOTO_ERROR(H5E_BTREE, H5E_CANTGET, FAIL, "can't retrieve B-tree's shared ref. count object")
shared = (H5B_shared_t *)H5UC_GET_OBJ(rc_shared);
HDassert(shared);
diff --git a/src/H5C.c b/src/H5C.c
index c1d9d17..ad2f762 100644
--- a/src/H5C.c
+++ b/src/H5C.c
@@ -1483,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
@@ -2243,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 */
@@ -2286,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 */
@@ -2304,7 +2285,7 @@ H5C_protect(H5F_t * f,
if(NULL == (entry_ptr->image_ptr = H5MM_malloc(entry_ptr->size + H5C_IMAGE_EXTRA_SPACE)))
HGOTO_ERROR(H5E_CACHE, H5E_CANTALLOC, NULL, "memory allocation failed for on disk image buffer")
#if H5C_DO_MEMORY_SANITY_CHECKS
- HDmemcpy(((uint8_t *)entry_ptr->image_ptr) + entry_ptr->size, H5C_IMAGE_SANITY_VALUE, H5C_IMAGE_EXTRA_SPACE);
+ H5MM_memcpy(((uint8_t *)entry_ptr->image_ptr) + entry_ptr->size, H5C_IMAGE_SANITY_VALUE, H5C_IMAGE_EXTRA_SPACE);
#endif /* H5C_DO_MEMORY_SANITY_CHECKS */
if(0 == mpi_rank)
if(H5C__generate_image(f, cache_ptr, entry_ptr) < 0)
@@ -2601,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:
@@ -6071,7 +6042,7 @@ H5C__flush_single_entry(H5F_t *f, H5C_cache_entry_t *entry_ptr, unsigned flags)
if(NULL == (entry_ptr->image_ptr = H5MM_malloc(entry_ptr->size + H5C_IMAGE_EXTRA_SPACE)))
HGOTO_ERROR(H5E_CACHE, H5E_CANTALLOC, FAIL, "memory allocation failed for on disk image buffer")
#if H5C_DO_MEMORY_SANITY_CHECKS
- HDmemcpy(((uint8_t *)entry_ptr->image_ptr) + entry_ptr->size, H5C_IMAGE_SANITY_VALUE, H5C_IMAGE_EXTRA_SPACE);
+ H5MM_memcpy(((uint8_t *)entry_ptr->image_ptr) + entry_ptr->size, H5C_IMAGE_SANITY_VALUE, H5C_IMAGE_EXTRA_SPACE);
#endif /* H5C_DO_MEMORY_SANITY_CHECKS */
} /* end if */
@@ -6571,7 +6542,7 @@ H5C_load_entry(H5F_t * f,
if(NULL == (image = (uint8_t *)H5MM_malloc(len + H5C_IMAGE_EXTRA_SPACE)))
HGOTO_ERROR(H5E_CACHE, H5E_CANTALLOC, NULL, "memory allocation failed for on disk image buffer")
#if H5C_DO_MEMORY_SANITY_CHECKS
- HDmemcpy(image + len, H5C_IMAGE_SANITY_VALUE, H5C_IMAGE_EXTRA_SPACE);
+ H5MM_memcpy(image + len, H5C_IMAGE_SANITY_VALUE, H5C_IMAGE_EXTRA_SPACE);
#endif /* H5C_DO_MEMORY_SANITY_CHECKS */
#ifdef H5_HAVE_PARALLEL
@@ -6609,7 +6580,7 @@ H5C_load_entry(H5F_t * f,
HGOTO_ERROR(H5E_CACHE, H5E_CANTALLOC, NULL, "image null after H5MM_realloc()")
image = (uint8_t *)new_image;
#if H5C_DO_MEMORY_SANITY_CHECKS
- HDmemcpy(image + len, H5C_IMAGE_SANITY_VALUE, H5C_IMAGE_EXTRA_SPACE);
+ H5MM_memcpy(image + len, H5C_IMAGE_SANITY_VALUE, H5C_IMAGE_EXTRA_SPACE);
#endif /* H5C_DO_MEMORY_SANITY_CHECKS */
} /* end if */
@@ -6653,7 +6624,7 @@ H5C_load_entry(H5F_t * f,
HGOTO_ERROR(H5E_CACHE, H5E_CANTALLOC, NULL, "image null after H5MM_realloc()")
image = (uint8_t *)new_image;
#if H5C_DO_MEMORY_SANITY_CHECKS
- HDmemcpy(image + actual_len, H5C_IMAGE_SANITY_VALUE, H5C_IMAGE_EXTRA_SPACE);
+ H5MM_memcpy(image + actual_len, H5C_IMAGE_SANITY_VALUE, H5C_IMAGE_EXTRA_SPACE);
#endif /* H5C_DO_MEMORY_SANITY_CHECKS */
if(actual_len > len) {
@@ -8485,7 +8456,7 @@ H5C__serialize_single_entry(H5F_t *f, H5C_t *cache_ptr, H5C_cache_entry_t *entry
if(NULL == (entry_ptr->image_ptr = H5MM_malloc(entry_ptr->size + H5C_IMAGE_EXTRA_SPACE)) )
HGOTO_ERROR(H5E_CACHE, H5E_CANTALLOC, FAIL, "memory allocation failed for on disk image buffer")
#if H5C_DO_MEMORY_SANITY_CHECKS
- HDmemcpy(((uint8_t *)entry_ptr->image_ptr) + image_size, H5C_IMAGE_SANITY_VALUE, H5C_IMAGE_EXTRA_SPACE);
+ H5MM_memcpy(((uint8_t *)entry_ptr->image_ptr) + image_size, H5C_IMAGE_SANITY_VALUE, H5C_IMAGE_EXTRA_SPACE);
#endif /* H5C_DO_MEMORY_SANITY_CHECKS */
} /* end if */
@@ -8602,7 +8573,7 @@ H5C__generate_image(H5F_t *f, H5C_t *cache_ptr, H5C_cache_entry_t *entry_ptr)
if(NULL == (entry_ptr->image_ptr = H5MM_realloc(entry_ptr->image_ptr, new_len + H5C_IMAGE_EXTRA_SPACE)))
HGOTO_ERROR(H5E_CACHE, H5E_CANTALLOC, FAIL, "memory allocation failed for on disk image buffer")
#if H5C_DO_MEMORY_SANITY_CHECKS
- HDmemcpy(((uint8_t *)entry_ptr->image_ptr) + new_len, H5C_IMAGE_SANITY_VALUE, H5C_IMAGE_EXTRA_SPACE);
+ H5MM_memcpy(((uint8_t *)entry_ptr->image_ptr) + new_len, H5C_IMAGE_SANITY_VALUE, H5C_IMAGE_EXTRA_SPACE);
#endif /* H5C_DO_MEMORY_SANITY_CHECKS */
/* Update statistics for resizing the entry */
diff --git a/src/H5CX.c b/src/H5CX.c
index 3ad4649..2287805 100644
--- a/src/H5CX.c
+++ b/src/H5CX.c
@@ -53,7 +53,7 @@
* each thread individually. The association of contexts to threads will
* be handled by the pthread library.
*
- * In order for this macro to work, H5E__get_my_stack() must be preceeded
+ * In order for this macro to work, H5CX_get_my_context() must be preceeded
* by "H5CX_node_t *ctx =".
*/
#define H5CX_get_my_context() H5CX__get_context()
@@ -64,17 +64,22 @@
#define H5CX_get_my_context() (&H5CX_head_g)
#endif /* H5_HAVE_THREADSAFE */
+/* Common macro for the retrieving the pointer to a property list */
+#define H5CX_RETRIEVE_PLIST(PL, FAILVAL) \
+ /* Check if the property list is already available */ \
+ if(NULL == (*head)->ctx.PL) \
+ /* Get the property list pointer */ \
+ if(NULL == ((*head)->ctx.PL = (H5P_genplist_t *)H5I_object((*head)->ctx.H5_GLUE(PL,_id)))) \
+ HGOTO_ERROR(H5E_CONTEXT, H5E_BADTYPE, (FAILVAL), "can't get property list")
+
/* Common macro for the duplicated code to retrieve properties from a property list */
#define H5CX_RETRIEVE_PROP_COMMON(PL, DEF_PL, PROP_NAME, PROP_FIELD) \
/* Check for default property list */ \
if((*head)->ctx.H5_GLUE(PL,_id) == (DEF_PL)) \
- HDmemcpy(&(*head)->ctx.PROP_FIELD, &H5_GLUE3(H5CX_def_,PL,_cache).PROP_FIELD, sizeof(H5_GLUE3(H5CX_def_,PL,_cache).PROP_FIELD)); \
+ H5MM_memcpy(&(*head)->ctx.PROP_FIELD, &H5_GLUE3(H5CX_def_,PL,_cache).PROP_FIELD, sizeof(H5_GLUE3(H5CX_def_,PL,_cache).PROP_FIELD)); \
else { \
- /* Check if the property list is already available */ \
- if(NULL == (*head)->ctx.PL) \
- /* Get the dataset transfer property list pointer */ \
- if(NULL == ((*head)->ctx.PL = (H5P_genplist_t *)H5I_object((*head)->ctx.H5_GLUE(PL,_id)))) \
- HGOTO_ERROR(H5E_CONTEXT, H5E_BADTYPE, FAIL, "can't get default dataset transfer property list") \
+ /* Retrieve the property list */ \
+ H5CX_RETRIEVE_PLIST(PL, FAIL) \
\
/* Get the property */ \
if(H5P_get((*head)->ctx.PL, (PROP_NAME), &(*head)->ctx.PROP_FIELD) < 0) \
@@ -108,11 +113,8 @@
\
/* Check if property exists in DXPL */ \
if(!(*head)->ctx.H5_GLUE(PROP_FIELD,_set)) { \
- /* Check if the property list is already available */ \
- if(NULL == (*head)->ctx.dxpl) \
- /* Get the dataset transfer property list pointer */ \
- if(NULL == ((*head)->ctx.dxpl = (H5P_genplist_t *)H5I_object((*head)->ctx.dxpl_id))) \
- HGOTO_ERROR(H5E_CONTEXT, H5E_BADTYPE, FAIL, "can't get default dataset transfer property list") \
+ /* Retrieve the dataset transfer property list */ \
+ H5CX_RETRIEVE_PLIST(dxpl, FAIL) \
\
if((check_prop = H5P_exist_plist((*head)->ctx.dxpl, PROP_NAME)) < 0) \
HGOTO_ERROR(H5E_CONTEXT, H5E_CANTGET, FAIL, "error checking for property") \
@@ -129,15 +131,12 @@
/* Macro for the duplicated code to test and set properties for a property list */
#define H5CX_SET_PROP(PROP_NAME, PROP_FIELD) \
if((*head)->ctx.H5_GLUE(PROP_FIELD,_set)) { \
- /* Check if the property list is already available */ \
- if(NULL == (*head)->ctx.dxpl) \
- /* Get the dataset transfer property list pointer */ \
- if(NULL == ((*head)->ctx.dxpl = (H5P_genplist_t *)H5I_object((*head)->ctx.dxpl_id))) \
- HGOTO_ERROR(H5E_CONTEXT, H5E_BADTYPE, NULL, "can't get default dataset transfer property list") \
+ /* Retrieve the dataset transfer property list */ \
+ H5CX_RETRIEVE_PLIST(dxpl, NULL) \
\
- /* Set the chunk filter mask property */ \
+ /* Set the property */ \
if(H5P_set((*head)->ctx.dxpl, PROP_NAME, &(*head)->ctx.PROP_FIELD) < 0) \
- HGOTO_ERROR(H5E_CONTEXT, H5E_CANTSET, NULL, "error setting filter mask xfer property") \
+ HGOTO_ERROR(H5E_CONTEXT, H5E_CANTSET, NULL, "error setting data xfer property") \
} /* end if */
#endif /* H5_HAVE_PARALLEL */
@@ -175,7 +174,7 @@
* corresponding property in the property list to be set when the API
* context is popped, when returning from the API routine. Note that the
* naming of these fields, <foo> and <foo>_set, is important for the
-* H5CX_TEST_SET_PROP and H5CX_SET_PROP macros to work properly.
+ * H5CX_TEST_SET_PROP and H5CX_SET_PROP macros to work properly.
*/
typedef struct H5CX_t {
/* DXPL */
@@ -186,6 +185,18 @@ typedef struct H5CX_t {
hid_t lapl_id; /* LAPL ID for API operation */
H5P_genplist_t *lapl; /* Link Access Property List */
+ /* DCPL */
+ hid_t dcpl_id; /* DCPL ID for API operation */
+ H5P_genplist_t *dcpl; /* Dataset Creation Property List */
+
+ /* DAPL */
+ hid_t dapl_id; /* DAPL ID for API operation */
+ H5P_genplist_t *dapl; /* Dataset Access Property List */
+
+ /* FAPL */
+ hid_t fapl_id; /* FAPL ID for API operation */
+ H5P_genplist_t *fapl; /* File Access Property List */
+
/* Internal: Object tagging info */
haddr_t tag; /* Current object's tag (ohdr chunk #0 address) */
@@ -274,6 +285,22 @@ typedef struct H5CX_t {
size_t nlinks; /* Number of soft / UD links to traverse (H5L_ACS_NLINKS_NAME) */
hbool_t nlinks_valid; /* Whether number of soft / UD links to traverse is valid */
+ /* Cached DCPL properties */
+ hbool_t do_min_dset_ohdr; /* Whether to minimize dataset object header */
+ hbool_t do_min_dset_ohdr_valid; /* Whether minimize dataset object header flag is valid */
+
+ /* Cached DAPL properties */
+ char *extfile_prefix; /* Prefix for external file */
+ hbool_t extfile_prefix_valid; /* Whether the prefix for external file is valid */
+ char *vds_prefix; /* Prefix for VDS */
+ hbool_t vds_prefix_valid; /* Whether the prefix for VDS is valid */
+
+ /* Cached FAPL properties */
+ H5F_libver_t low_bound; /* low_bound property for H5Pset_libver_bounds() */
+ hbool_t low_bound_valid; /* Whether low_bound property is valid */
+ H5F_libver_t high_bound; /* high_bound property for H5Pset_libver_bounds */
+ hbool_t high_bound_valid; /* Whether high_bound property is valid */
+
/* Cached VOL settings */
H5VL_connector_prop_t vol_connector_prop; /* Property for VOL connector ID & info */
hbool_t vol_connector_prop_valid; /* Whether property for VOL connector ID & info is valid */
@@ -328,6 +355,25 @@ typedef struct H5CX_lapl_cache_t {
size_t nlinks; /* Number of soft / UD links to traverse (H5L_ACS_NLINKS_NAME) */
} H5CX_lapl_cache_t;
+/* Typedef for cached default dataset creation property list information */
+/* (Same as the cached DXPL struct, above, except for the default DCPL) */
+typedef struct H5CX_dcpl_cache_t {
+ hbool_t do_min_dset_ohdr; /* Whether to minimize dataset object header */
+} H5CX_dcpl_cache_t;
+
+/* Typedef for cached default dataset access property list information */
+/* (Same as the cached DXPL struct, above, except for the default DXPL) */
+typedef struct H5CX_dapl_cache_t {
+ char *extfile_prefix; /* Prefix for external file */
+ char *vds_prefix; /* Prefix for VDS */
+} H5CX_dapl_cache_t;
+
+/* Typedef for cached default file access property list information */
+/* (Same as the cached DXPL struct, above, except for the default DCPL) */
+typedef struct H5CX_fapl_cache_t {
+ H5F_libver_t low_bound; /* low_bound property for H5Pset_libver_bounds() */
+ H5F_libver_t high_bound; /* high_bound property for H5Pset_libver_bounds */
+} H5CX_fapl_cache_t;
/********************/
/* Local Prototypes */
@@ -361,9 +407,21 @@ static H5CX_dxpl_cache_t H5CX_def_dxpl_cache;
/* Define a "default" link access property list cache structure to use for default LAPLs */
static H5CX_lapl_cache_t H5CX_def_lapl_cache;
+/* Define a "default" dataset creation property list cache structure to use for default DCPLs */
+static H5CX_dcpl_cache_t H5CX_def_dcpl_cache;
+
+/* Define a "default" dataset access property list cache structure to use for default DAPLs */
+static H5CX_dapl_cache_t H5CX_def_dapl_cache;
+
+/* Define a "default" file access property list cache structure to use for default FAPLs */
+static H5CX_fapl_cache_t H5CX_def_fapl_cache;
+
/* Declare a static free list to manage H5CX_node_t structs */
H5FL_DEFINE_STATIC(H5CX_node_t);
+/* Declare a static free list to manage H5CX_state_t structs */
+H5FL_DEFINE_STATIC(H5CX_state_t);
+
/*--------------------------------------------------------------------------
@@ -381,6 +439,9 @@ H5CX__init_package(void)
{
H5P_genplist_t *dx_plist; /* Data transfer property list */
H5P_genplist_t *la_plist; /* Link access property list */
+ H5P_genplist_t *dc_plist; /* Dataset creation property list */
+ H5P_genplist_t *da_plist; /* Dataset access property list */
+ H5P_genplist_t *fa_plist; /* File access property list */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_STATIC
@@ -480,6 +541,53 @@ H5CX__init_package(void)
if(H5P_get(la_plist, H5L_ACS_NLINKS_NAME, &H5CX_def_lapl_cache.nlinks) < 0)
HGOTO_ERROR(H5E_CONTEXT, H5E_CANTGET, FAIL, "Can't retrieve number of soft / UD links to traverse")
+
+ /* Reset the "default DCPL cache" information */
+ HDmemset(&H5CX_def_dcpl_cache, 0, sizeof(H5CX_dcpl_cache_t));
+
+ /* Get the default DCPL cache information */
+
+ /* Get the default dataset creation property list */
+ if(NULL == (dc_plist = (H5P_genplist_t *)H5I_object(H5P_DATASET_CREATE_DEFAULT)))
+ HGOTO_ERROR(H5E_CONTEXT, H5E_BADTYPE, FAIL, "not a dataset create property list")
+
+ /* Get flag to indicate whether to minimize dataset object header */
+ if(H5P_get(dc_plist, H5D_CRT_MIN_DSET_HDR_SIZE_NAME, &H5CX_def_dcpl_cache.do_min_dset_ohdr) < 0)
+ HGOTO_ERROR(H5E_CONTEXT, H5E_CANTGET, FAIL, "Can't retrieve dataset minimize flag")
+
+ /* Reset the "default DAPL cache" information */
+ HDmemset(&H5CX_def_dapl_cache, 0, sizeof(H5CX_dapl_cache_t));
+
+ /* Get the default DAPL cache information */
+
+ /* Get the default dataset access property list */
+ if(NULL == (da_plist = (H5P_genplist_t *)H5I_object(H5P_DATASET_ACCESS_DEFAULT)))
+ HGOTO_ERROR(H5E_CONTEXT, H5E_BADTYPE, FAIL, "not a dataset create property list")
+
+ /* Get the prefix for the external file */
+ if(H5P_peek(da_plist, H5D_ACS_EFILE_PREFIX_NAME, &H5CX_def_dapl_cache.extfile_prefix) < 0)
+ HGOTO_ERROR(H5E_CONTEXT, H5E_CANTGET, FAIL, "Can't retrieve prefix for external file")
+
+ /* Get the prefix for the VDS file */
+ if(H5P_peek(da_plist, H5D_ACS_VDS_PREFIX_NAME, &H5CX_def_dapl_cache.vds_prefix) < 0)
+ HGOTO_ERROR(H5E_CONTEXT, H5E_CANTGET, FAIL, "Can't retrieve prefix for VDS")
+
+ /* Reset the "default FAPL cache" information */
+ HDmemset(&H5CX_def_fapl_cache, 0, sizeof(H5CX_fapl_cache_t));
+
+ /* Get the default FAPL cache information */
+
+ /* Get the default file access property list */
+ if(NULL == (fa_plist = (H5P_genplist_t *)H5I_object(H5P_FILE_ACCESS_DEFAULT)))
+ HGOTO_ERROR(H5E_CONTEXT, H5E_BADTYPE, FAIL, "not a dataset create property list")
+
+ /* Get low_bound */
+ if(H5P_get(fa_plist, H5F_ACS_LIBVER_LOW_BOUND_NAME, &H5CX_def_fapl_cache.low_bound) < 0)
+ HGOTO_ERROR(H5E_CONTEXT, H5E_CANTGET, FAIL, "Can't retrieve dataset minimize flag")
+
+ if(H5P_get(fa_plist, H5F_ACS_LIBVER_HIGH_BOUND_NAME, &H5CX_def_fapl_cache.high_bound) < 0)
+ HGOTO_ERROR(H5E_CONTEXT, H5E_CANTGET, FAIL, "Can't retrieve dataset minimize flag")
+
done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5CX__init_package() */
@@ -603,7 +711,10 @@ H5CX__push_common(H5CX_node_t *cnode)
/* Set non-zero context info */
cnode->ctx.dxpl_id = H5P_DATASET_XFER_DEFAULT;
+ cnode->ctx.dcpl_id = H5P_DATASET_CREATE_DEFAULT;
+ cnode->ctx.dapl_id = H5P_DATASET_ACCESS_DEFAULT;
cnode->ctx.lapl_id = H5P_LINK_ACCESS_DEFAULT;
+ cnode->ctx.fapl_id = H5P_FILE_ACCESS_DEFAULT;
cnode->ctx.tag = H5AC__INVALID_TAG;
cnode->ctx.ring = H5AC_RING_USER;
@@ -680,6 +791,217 @@ H5CX_push_special(void)
/*-------------------------------------------------------------------------
+ * Function: H5CX_retrieve_state
+ *
+ * Purpose: Retrieve the state of an API context, for later resumption.
+ *
+ * Note: This routine _only_ tracks the state of API context information
+ * set before the VOL callback is invoked, not values that are
+ * set internal to the library. It's main purpose is to provide
+ * API context state to VOL connectors.
+ *
+ * Return: Non-negative on success / Negative on failure
+ *
+ * Programmer: Quincey Koziol
+ * January 8, 2019
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5CX_retrieve_state(H5CX_state_t **api_state)
+{
+ 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(FAIL)
+
+ /* Sanity check */
+ HDassert(head && *head);
+ HDassert(api_state);
+
+ /* Allocate & clear API context state */
+ if(NULL == (*api_state = H5FL_CALLOC(H5CX_state_t)))
+ HGOTO_ERROR(H5E_CONTEXT, H5E_CANTALLOC, FAIL, "unable to allocate new API context state")
+
+ /* Check for non-default DXPL */
+ if(H5P_DATASET_XFER_DEFAULT != (*head)->ctx.dxpl_id) {
+ /* Retrieve the DXPL property list */
+ H5CX_RETRIEVE_PLIST(dxpl, FAIL)
+
+ /* Copy the DXPL ID */
+ if(((*api_state)->dxpl_id = H5P_copy_plist((H5P_genplist_t *)(*head)->ctx.dxpl, FALSE)) < 0)
+ HGOTO_ERROR(H5E_CONTEXT, H5E_CANTCOPY, FAIL, "can't copy property list")
+ } /* end if */
+ else
+ (*api_state)->dxpl_id = H5P_DATASET_XFER_DEFAULT;
+
+ /* Check for non-default LAPL */
+ if(H5P_LINK_ACCESS_DEFAULT != (*head)->ctx.lapl_id) {
+ /* Retrieve the LAPL property list */
+ H5CX_RETRIEVE_PLIST(lapl, FAIL)
+
+ /* Copy the LAPL ID */
+ if(((*api_state)->lapl_id = H5P_copy_plist((H5P_genplist_t *)(*head)->ctx.lapl, FALSE)) < 0)
+ HGOTO_ERROR(H5E_CONTEXT, H5E_CANTCOPY, FAIL, "can't copy property list")
+ } /* end if */
+ else
+ (*api_state)->lapl_id = H5P_LINK_ACCESS_DEFAULT;
+
+ /* Keep a reference to the current VOL wrapping context */
+ (*api_state)->vol_wrap_ctx = (*head)->ctx.vol_wrap_ctx;
+ if(NULL != (*api_state)->vol_wrap_ctx)
+ if(H5VL_inc_vol_wrapper((*api_state)->vol_wrap_ctx) < 0)
+ HGOTO_ERROR(H5E_CONTEXT, H5E_CANTINC, FAIL, "can't increment refcount on VOL wrapping context")
+
+ /* Keep a copy of the VOL connector property, if there is one */
+ if((*head)->ctx.vol_connector_prop_valid && (*head)->ctx.vol_connector_prop.connector_id > 0) {
+ /* Get the connector property */
+ H5MM_memcpy(&(*api_state)->vol_connector_prop, &(*head)->ctx.vol_connector_prop, sizeof(H5VL_connector_prop_t));
+
+ /* Check for actual VOL connector property */
+ if((*api_state)->vol_connector_prop.connector_id) {
+ /* Copy connector info, if it exists */
+ if((*api_state)->vol_connector_prop.connector_info) {
+ H5VL_class_t *connector; /* Pointer to connector */
+ void *new_connector_info = NULL; /* Copy of connector info */
+
+ /* Retrieve the connector for the ID */
+ if(NULL == (connector = (H5VL_class_t *)H5I_object((*api_state)->vol_connector_prop.connector_id)))
+ HGOTO_ERROR(H5E_CONTEXT, H5E_BADTYPE, FAIL, "not a VOL connector ID")
+
+ /* Allocate and copy connector info */
+ if(H5VL_copy_connector_info(connector, &new_connector_info, (*api_state)->vol_connector_prop.connector_info) < 0)
+ HGOTO_ERROR(H5E_CONTEXT, H5E_CANTCOPY, FAIL, "connector info copy failed")
+ (*api_state)->vol_connector_prop.connector_info = new_connector_info;
+ } /* end if */
+
+ /* Increment the refcount on the connector ID */
+ if(H5I_inc_ref((*api_state)->vol_connector_prop.connector_id, FALSE) < 0)
+ HGOTO_ERROR(H5E_CONTEXT, H5E_CANTINC, FAIL, "incrementing VOL connector ID failed")
+ } /* end if */
+ } /* end if */
+
+#ifdef H5_HAVE_PARALLEL
+ /* Save parallel I/O settings */
+ (*api_state)->coll_metadata_read = (*head)->ctx.coll_metadata_read;
+#endif /* H5_HAVE_PARALLEL */
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5CX_retrieve_state() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5CX_restore_state
+ *
+ * Purpose: Restore an API context, from a previously retrieved state.
+ *
+ * Note: This routine _only_ resets the state of API context information
+ * set before the VOL callback is invoked, not values that are
+ * set internal to the library. It's main purpose is to restore
+ * API context state from VOL connectors.
+ *
+ * Return: Non-negative on success / Negative on failure
+ *
+ * Programmer: Quincey Koziol
+ * January 9, 2019
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5CX_restore_state(const H5CX_state_t *api_state)
+{
+ 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);
+ HDassert(api_state);
+
+ /* Restore the DXPL info */
+ (*head)->ctx.dxpl_id = api_state->dxpl_id;
+ (*head)->ctx.dxpl = NULL;
+
+ /* Restore the LAPL info */
+ (*head)->ctx.lapl_id = api_state->lapl_id;
+ (*head)->ctx.lapl = NULL;
+
+ /* Restore the VOL wrapper context */
+ (*head)->ctx.vol_wrap_ctx = api_state->vol_wrap_ctx;
+
+ /* Restore the VOL connector info */
+ if(api_state->vol_connector_prop.connector_id) {
+ H5MM_memcpy(&(*head)->ctx.vol_connector_prop, &api_state->vol_connector_prop, sizeof(H5VL_connector_prop_t));
+ (*head)->ctx.vol_connector_prop_valid = TRUE;
+ } /* end if */
+
+#ifdef H5_HAVE_PARALLEL
+ /* Restore parallel I/O settings */
+ (*head)->ctx.coll_metadata_read = api_state->coll_metadata_read;
+#endif /* H5_HAVE_PARALLEL */
+
+ FUNC_LEAVE_NOAPI(SUCCEED)
+} /* end H5CX_restore_state() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5CX_free_state
+ *
+ * Purpose: Free a previously retrievedAPI context state
+ *
+ * Return: Non-negative on success / Negative on failure
+ *
+ * Programmer: Quincey Koziol
+ * January 9, 2019
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5CX_free_state(H5CX_state_t *api_state)
+{
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_NOAPI(FAIL)
+
+ /* Sanity check */
+ HDassert(api_state);
+
+ /* Release the DXPL */
+ if(api_state->dxpl_id != H5P_DATASET_XFER_DEFAULT)
+ if(H5I_dec_ref(api_state->dxpl_id) < 0)
+ HGOTO_ERROR(H5E_CONTEXT, H5E_CANTDEC, FAIL, "can't decrement refcount on DXPL")
+
+ /* Release the LAPL */
+ if(api_state->lapl_id != H5P_LINK_ACCESS_DEFAULT)
+ if(H5I_dec_ref(api_state->lapl_id) < 0)
+ HGOTO_ERROR(H5E_CONTEXT, H5E_CANTDEC, FAIL, "can't decrement refcount on LAPL")
+
+ /* Release the VOL wrapper context */
+ if(api_state->vol_wrap_ctx)
+ if(H5VL_dec_vol_wrapper(api_state->vol_wrap_ctx) < 0)
+ HGOTO_ERROR(H5E_CONTEXT, H5E_CANTDEC, FAIL, "can't decrement refcount on VOL wrapping context")
+
+ /* Release the VOL connector property, if it was set */
+ if(api_state->vol_connector_prop.connector_id) {
+ /* Clean up any VOL connector info */
+ if(api_state->vol_connector_prop.connector_info)
+ if(H5VL_free_connector_info(api_state->vol_connector_prop.connector_id, api_state->vol_connector_prop.connector_info) < 0)
+ HGOTO_ERROR(H5E_CONTEXT, H5E_CANTRELEASE, FAIL, "unable to release VOL connector info object")
+ /* Decrement connector ID */
+ if(H5I_dec_ref(api_state->vol_connector_prop.connector_id) < 0)
+ HDONE_ERROR(H5E_CONTEXT, H5E_CANTDEC, FAIL, "can't close VOL connector ID")
+ } /* end if */
+
+ /* Free the state */
+ api_state = H5FL_FREE(H5CX_state_t, api_state);
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5CX_free_state() */
+
+
+/*-------------------------------------------------------------------------
* Function: H5CX_is_def_dxpl
*
* Purpose: Checks if the API context is using the library's default DXPL
@@ -735,6 +1057,71 @@ H5CX_set_dxpl(hid_t dxpl_id)
/*-------------------------------------------------------------------------
+ * Function: H5CX_set_dcpl
+ *
+ * Purpose: Sets the DCPL for the current API call context.
+ *
+ * Return: <none>
+ *
+ * Programmer: Quincey Koziol
+ * March 6, 2019
+ *
+ *-------------------------------------------------------------------------
+ */
+void
+H5CX_set_dcpl(hid_t dcpl_id)
+{
+ 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);
+
+ /* Set the API context's DCPL to a new value */
+ (*head)->ctx.dcpl_id = dcpl_id;
+
+ FUNC_LEAVE_NOAPI_VOID
+} /* end H5CX_set_dcpl() */
+
+/*-------------------------------------------------------------------------
+ * Function: H5CX_set_libver_bounds
+ *
+ * Purpose: Sets the low/high bounds according to "f" for the current API call context.
+ * When "f" is NULL, the low/high bounds are set to latest format.
+ *
+ * Return: Non-negative on success / Negative on failure
+ *
+ * Programmer: Vailin Choi
+ * March 27, 2019
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5CX_set_libver_bounds(H5F_t *f)
+{
+ 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(FAIL)
+
+ /* Sanity check */
+ HDassert(head && *head);
+
+ /* Set the API context value */
+ (*head)->ctx.low_bound = (f == NULL) ? H5F_LIBVER_LATEST : H5F_LOW_BOUND(f);
+ (*head)->ctx.high_bound = (f == NULL) ? H5F_LIBVER_LATEST : H5F_HIGH_BOUND(f);
+
+ /* Mark the values as valid */
+ (*head)->ctx.low_bound_valid = TRUE;
+ (*head)->ctx.high_bound_valid = TRUE;
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5CX_set_libver_bounds() */
+
+
+/*-------------------------------------------------------------------------
* Function: H5CX_set_lapl
*
* Purpose: Sets the LAPL for the current API call context.
@@ -803,6 +1190,8 @@ H5CX_set_apl(hid_t *acspl_id, const H5P_libclass_t *libclass,
*acspl_id = *libclass->def_plist_id;
else {
htri_t is_lapl; /* Whether the access property list is (or is derived from) a link access property list */
+ htri_t is_dapl; /* Whether the access property list is (or is derived from) a dataset access property list */
+ htri_t is_fapl; /* Whether the access property list is (or is derived from) a file access property list */
#ifdef H5CX_DEBUG
/* Sanity check the access property list class */
@@ -816,10 +1205,22 @@ H5CX_set_apl(hid_t *acspl_id, const H5P_libclass_t *libclass,
else if(is_lapl)
(*head)->ctx.lapl_id = *acspl_id;
+ /* Check for dataset access property and set API context if so */
+ if((is_dapl = H5P_class_isa(*libclass->pclass, *H5P_CLS_DACC->pclass)) < 0)
+ HGOTO_ERROR(H5E_CONTEXT, H5E_CANTGET, FAIL, "can't check for dataset access class")
+ else if(is_dapl)
+ (*head)->ctx.dapl_id = *acspl_id;
+
+ /* Check for file access property and set API context if so */
+ if((is_fapl = H5P_class_isa(*libclass->pclass, *H5P_CLS_FACC->pclass)) < 0)
+ HGOTO_ERROR(H5E_CONTEXT, H5E_CANTGET, FAIL, "can't check for file access class")
+ else if(is_fapl)
+ (*head)->ctx.fapl_id = *acspl_id;
+
#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 */
@@ -893,6 +1294,7 @@ H5CX_set_loc(hid_t
#endif /* H5_HAVE_PARALLEL */
loc_id)
{
+#ifdef H5_HAVE_PARALLEL
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 */
@@ -901,7 +1303,6 @@ H5CX_set_loc(hid_t
/* Sanity check */
HDassert(head && *head);
-#ifdef H5_HAVE_PARALLEL
/* Set collective metadata read flag */
(*head)->ctx.coll_metadata_read = TRUE;
@@ -922,10 +1323,14 @@ H5CX_set_loc(hid_t
if(mpi_comm != MPI_COMM_NULL)
MPI_Barrier(mpi_comm);
} /* end if */
-#endif /* H5_HAVE_PARALLEL */
done:
FUNC_LEAVE_NOAPI(ret_value)
+#else /* H5_HAVE_PARALLEL */
+ FUNC_ENTER_NOAPI_NOINIT_NOERR
+
+ FUNC_LEAVE_NOAPI(SUCCEED)
+#endif /* H5_HAVE_PARALLEL */
} /* end H5CX_set_loc() */
@@ -987,7 +1392,7 @@ H5CX_set_vol_connector_prop(const H5VL_connector_prop_t *vol_connector_prop)
HDassert(head && *head);
/* Set the API context value */
- HDmemcpy(&(*head)->ctx.vol_connector_prop, vol_connector_prop, sizeof(H5VL_connector_prop_t));
+ H5MM_memcpy(&(*head)->ctx.vol_connector_prop, vol_connector_prop, sizeof(H5VL_connector_prop_t));
/* Mark the value as valid */
(*head)->ctx.vol_connector_prop_valid = TRUE;
@@ -1112,7 +1517,7 @@ H5CX_get_vol_connector_prop(H5VL_connector_prop_t *vol_connector_prop)
/* Check for value that was set */
if((*head)->ctx.vol_connector_prop_valid)
/* Get the value */
- HDmemcpy(vol_connector_prop, &(*head)->ctx.vol_connector_prop, sizeof(H5VL_connector_prop_t));
+ H5MM_memcpy(vol_connector_prop, &(*head)->ctx.vol_connector_prop, sizeof(H5VL_connector_prop_t));
else
HDmemset(vol_connector_prop, 0, sizeof(H5VL_connector_prop_t));
@@ -1343,7 +1748,7 @@ H5CX_get_btree_split_ratios(double split_ratio[3])
H5CX_RETRIEVE_PROP_VALID(dxpl, H5P_DATASET_XFER_DEFAULT, H5D_XFER_BTREE_SPLIT_RATIO_NAME, btree_split_ratio)
/* Get the B-tree split ratio values */
- HDmemcpy(split_ratio, &(*head)->ctx.btree_split_ratio, sizeof((*head)->ctx.btree_split_ratio));
+ H5MM_memcpy(split_ratio, &(*head)->ctx.btree_split_ratio, sizeof((*head)->ctx.btree_split_ratio));
done:
FUNC_LEAVE_NOAPI(ret_value)
@@ -2028,6 +2433,193 @@ done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5CX_get_nlinks() */
+/*-------------------------------------------------------------------------
+ * Function: H5CX_get_libver_bounds
+ *
+ * Purpose: Retrieves the low/high bounds for the current API call context.
+ *
+ * Return: Non-negative on success / Negative on failure
+ *
+ * Programmer: Vailin Choi
+ * March 27, 2019
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5CX_get_libver_bounds(H5F_libver_t *low_bound, H5F_libver_t *high_bound)
+{
+ 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(FAIL)
+
+ /* Sanity check */
+ HDassert(low_bound);
+ HDassert(high_bound);
+ HDassert(head && *head);
+ HDassert(H5P_DEFAULT != (*head)->ctx.fapl_id);
+
+ H5CX_RETRIEVE_PROP_VALID(fapl, H5P_FILE_ACCESS_DEFAULT, H5F_ACS_LIBVER_LOW_BOUND_NAME, low_bound)
+ H5CX_RETRIEVE_PROP_VALID(fapl, H5P_FILE_ACCESS_DEFAULT, H5F_ACS_LIBVER_HIGH_BOUND_NAME, high_bound)
+
+ /* Get the values */
+ *low_bound = (*head)->ctx.low_bound;
+ *high_bound = (*head)->ctx.high_bound;
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5CX_get_libver_bounds() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5CX_get_dset_min_ohdr_flag
+ *
+ * Purpose: Retrieves the flag that indicates whether the dataset object
+ * header should be minimized
+ *
+ * Return: Non-negative on success / Negative on failure
+ *
+ * Programmer: Quincey Koziol
+ * March 6, 2019
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5CX_get_dset_min_ohdr_flag(hbool_t *dset_min_ohdr_flag)
+{
+ 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(FAIL)
+
+ /* Sanity check */
+ HDassert(dset_min_ohdr_flag);
+ HDassert(head && *head);
+ HDassert(H5P_DEFAULT != (*head)->ctx.dcpl_id);
+
+ H5CX_RETRIEVE_PROP_VALID(dcpl, H5P_DATASET_CREATE_DEFAULT, H5D_CRT_MIN_DSET_HDR_SIZE_NAME, do_min_dset_ohdr)
+
+ /* Get the value */
+ *dset_min_ohdr_flag = (*head)->ctx.do_min_dset_ohdr;
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5CX_get_dset_min_ohdr_flag() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5CX_get_ext_file_prefix
+ *
+ * Purpose: Retrieves the prefix for external file
+ *
+ * Return: Non-negative on success / Negative on failure
+ *
+ * Programmer: Raymond Lu
+ * March 6, 2019
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5CX_get_ext_file_prefix(char **extfile_prefix)
+{
+ 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(FAIL)
+
+ /* Sanity check */
+ HDassert(extfile_prefix);
+ HDassert(head && *head);
+ HDassert(H5P_DEFAULT != (*head)->ctx.dapl_id);
+
+ /* Check if the value has been retrieved already */
+ if(!(*head)->ctx.extfile_prefix_valid) {
+ /* Check for default DAPL */
+ if((*head)->ctx.dapl_id == H5P_DATASET_ACCESS_DEFAULT)
+ (*head)->ctx.extfile_prefix = H5CX_def_dapl_cache.extfile_prefix;
+ else {
+ /* Check if the property list is already available */
+ if(NULL == (*head)->ctx.dapl)
+ /* Get the dataset access property list pointer */
+ if(NULL == ((*head)->ctx.dapl = (H5P_genplist_t *)H5I_object((*head)->ctx.dapl_id)))
+ HGOTO_ERROR(H5E_CONTEXT, H5E_BADTYPE, FAIL, "can't get default dataset access property list")
+
+ /* Get the prefix for the external file */
+ /* (Note: 'peek', not 'get' - if this turns out to be a problem, we may need
+ * to copy it and free this in the H5CX pop routine. -QAK)
+ */
+ if(H5P_peek((*head)->ctx.dapl, H5D_ACS_EFILE_PREFIX_NAME, &(*head)->ctx.extfile_prefix) < 0)
+ HGOTO_ERROR(H5E_CONTEXT, H5E_CANTGET, FAIL, "Can't retrieve external file prefix")
+ } /* end else */
+
+ /* Mark the value as valid */
+ (*head)->ctx.extfile_prefix_valid = TRUE;
+ } /* end if */
+
+ /* Get the value */
+ *extfile_prefix = (*head)->ctx.extfile_prefix;
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5CX_get_ext_file_prefix() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5CX_get_vds_prefix
+ *
+ * Purpose: Retrieves the prefix for VDS
+ *
+ * Return: Non-negative on success / Negative on failure
+ *
+ * Programmer: Raymond Lu
+ * March 6, 2019
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5CX_get_vds_prefix(char **vds_prefix)
+{
+ 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(FAIL)
+
+ /* Sanity check */
+ HDassert(vds_prefix);
+ HDassert(head && *head);
+ HDassert(H5P_DEFAULT != (*head)->ctx.dapl_id);
+
+ /* Check if the value has been retrieved already */
+ if(!(*head)->ctx.vds_prefix_valid) {
+ /* Check for default DAPL */
+ if((*head)->ctx.dapl_id == H5P_DATASET_ACCESS_DEFAULT)
+ (*head)->ctx.vds_prefix = H5CX_def_dapl_cache.vds_prefix;
+ else {
+ /* Check if the property list is already available */
+ if(NULL == (*head)->ctx.dapl)
+ /* Get the dataset access property list pointer */
+ if(NULL == ((*head)->ctx.dapl = (H5P_genplist_t *)H5I_object((*head)->ctx.dapl_id)))
+ HGOTO_ERROR(H5E_CONTEXT, H5E_BADTYPE, FAIL, "can't get default dataset access property list")
+
+ /* Get the prefix for the VDS */
+ /* (Note: 'peek', not 'get' - if this turns out to be a problem, we may need
+ * to copy it and free this in the H5CX pop routine. -QAK)
+ */
+ if(H5P_peek((*head)->ctx.dapl, H5D_ACS_VDS_PREFIX_NAME, &(*head)->ctx.vds_prefix) < 0)
+ HGOTO_ERROR(H5E_CONTEXT, H5E_CANTGET, FAIL, "Can't retrieve VDS prefix")
+ } /* end else */
+
+ /* Mark the value as valid */
+ (*head)->ctx.vds_prefix_valid = TRUE;
+ } /* end if */
+
+ /* Get the value */
+ *vds_prefix = (*head)->ctx.vds_prefix;
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5CX_get_vds_prefix() */
+
/*-------------------------------------------------------------------------
* Function: H5CX_set_tag
diff --git a/src/H5CXprivate.h b/src/H5CXprivate.h
index 04c6f55..91316e4 100644
--- a/src/H5CXprivate.h
+++ b/src/H5CXprivate.h
@@ -39,6 +39,19 @@
/* Library Private Typedefs */
/****************************/
+/* API context state */
+typedef struct H5CX_state_t {
+ hid_t dxpl_id; /* DXPL for operation */
+ hid_t lapl_id; /* LAPL for operation */
+ void *vol_wrap_ctx; /* VOL connector's "wrap context" for creating IDs */
+ H5VL_connector_prop_t vol_connector_prop; /* VOL connector property */
+
+#ifdef H5_HAVE_PARALLEL
+ /* Internal: Parallel I/O settings */
+ hbool_t coll_metadata_read; /* Whether to use collective I/O for metadata read */
+#endif /* H5_HAVE_PARALLEL */
+} H5CX_state_t;
+
/*****************************/
/* Library-private Variables */
@@ -57,9 +70,16 @@ H5_DLL herr_t H5CX_pop(void);
H5_DLL void H5CX_push_special(void);
H5_DLL hbool_t H5CX_is_def_dxpl(void);
+/* API context state routines */
+H5_DLL herr_t H5CX_retrieve_state(H5CX_state_t **api_state);
+H5_DLL herr_t H5CX_restore_state(const H5CX_state_t *api_state);
+H5_DLL herr_t H5CX_free_state(H5CX_state_t *api_state);
+
/* "Setter" routines for API context info */
H5_DLL void H5CX_set_dxpl(hid_t dxpl_id);
H5_DLL void H5CX_set_lapl(hid_t lapl_id);
+H5_DLL void H5CX_set_dcpl(hid_t dcpl_id);
+H5_DLL herr_t H5CX_set_libver_bounds(H5F_t *f);
H5_DLL herr_t H5CX_set_apl(hid_t *acspl_id, const H5P_libclass_t *libclass,
hid_t loc_id, hbool_t is_collective);
H5_DLL herr_t H5CX_set_loc(hid_t loc_id);
@@ -106,6 +126,16 @@ H5_DLL herr_t H5CX_get_dt_conv_cb(H5T_conv_cb_t *cb_struct);
/* "Getter" routines for LAPL properties cached in API context */
H5_DLL herr_t H5CX_get_nlinks(size_t *nlinks);
+/* "Getter" routines for DCPL properties cached in API context */
+H5_DLL herr_t H5CX_get_dset_min_ohdr_flag(hbool_t *dset_min_ohdr_flag);
+
+/* "Getter" routines for DAPL properties cached in API context */
+H5_DLL herr_t H5CX_get_ext_file_prefix(char **prefix_extfile);
+H5_DLL herr_t H5CX_get_vds_prefix(char **prefix_vds);
+
+/* "Getter" routines for FAPL properties cached in API context */
+H5_DLL herr_t H5CX_get_libver_bounds(H5F_libver_t *low_bound, H5F_libver_t *high_bound);
+
/* "Setter" routines for API context info */
H5_DLL void H5CX_set_tag(haddr_t tag);
H5_DLL void H5CX_set_ring(H5AC_ring_t ring);
diff --git a/src/H5Cimage.c b/src/H5Cimage.c
index bdab1a3..db44c7a 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,
@@ -2020,11 +2020,11 @@ H5C__decode_cache_image_entry(const H5F_t *f, const H5C_t *cache_ptr,
HGOTO_ERROR(H5E_CACHE, H5E_CANTALLOC, FAIL, "memory allocation failed for on disk image buffer")
#if H5C_DO_MEMORY_SANITY_CHECKS
- HDmemcpy(((uint8_t *)image_ptr) + size, H5C_IMAGE_SANITY_VALUE, H5C_IMAGE_EXTRA_SPACE);
+ H5MM_memcpy(((uint8_t *)image_ptr) + size, H5C_IMAGE_SANITY_VALUE, H5C_IMAGE_EXTRA_SPACE);
#endif /* H5C_DO_MEMORY_SANITY_CHECKS */
/* Copy the entry image from the cache image block */
- HDmemcpy(image_ptr, p, size);
+ H5MM_memcpy(image_ptr, p, size);
p += size;
/* Copy data into target */
@@ -2219,7 +2219,7 @@ H5C__encode_cache_image_header(const H5F_t *f, const H5C_t *cache_ptr,
p = *buf;
/* write signature */
- HDmemcpy(p, H5C__MDCI_BLOCK_SIGNATURE, (size_t)H5C__MDCI_BLOCK_SIGNATURE_LEN);
+ H5MM_memcpy(p, H5C__MDCI_BLOCK_SIGNATURE, (size_t)H5C__MDCI_BLOCK_SIGNATURE_LEN);
p += H5C__MDCI_BLOCK_SIGNATURE_LEN;
/* write version */
@@ -2355,7 +2355,7 @@ H5C__encode_cache_image_entry(H5F_t *f, H5C_t *cache_ptr, uint8_t **buf,
H5F_addr_encode(f, &p, ie_ptr->fd_parent_addrs[u]);
/* Copy entry image */
- HDmemcpy(p, ie_ptr->image_ptr, ie_ptr->size);
+ H5MM_memcpy(p, ie_ptr->image_ptr, ie_ptr->size);
p += ie_ptr->size;
/* Update buffer pointer */
@@ -3422,11 +3422,11 @@ H5C__reconstruct_cache_entry(const H5F_t *f, H5C_t *cache_ptr,
if(NULL == (pf_entry_ptr->image_ptr = H5MM_malloc(pf_entry_ptr->size + H5C_IMAGE_EXTRA_SPACE)))
HGOTO_ERROR(H5E_CACHE, H5E_CANTALLOC, NULL, "memory allocation failed for on disk image buffer")
#if H5C_DO_MEMORY_SANITY_CHECKS
- HDmemcpy(((uint8_t *)pf_entry_ptr->image_ptr) + size, H5C_IMAGE_SANITY_VALUE, H5C_IMAGE_EXTRA_SPACE);
+ H5MM_memcpy(((uint8_t *)pf_entry_ptr->image_ptr) + size, H5C_IMAGE_SANITY_VALUE, H5C_IMAGE_EXTRA_SPACE);
#endif /* H5C_DO_MEMORY_SANITY_CHECKS */
/* Copy the entry image from the cache image block */
- HDmemcpy(pf_entry_ptr->image_ptr, p, pf_entry_ptr->size);
+ H5MM_memcpy(pf_entry_ptr->image_ptr, p, pf_entry_ptr->size);
p += pf_entry_ptr->size;
/* Initialize the rest of the fields in the prefetched entry */
diff --git a/src/H5Clog_trace.c b/src/H5Clog_trace.c
index 7c1305c..713f333 100644
--- a/src/H5Clog_trace.c
+++ b/src/H5Clog_trace.c
@@ -41,7 +41,7 @@
/****************/
/* Max log message size */
-#define H5C_MAX_TRACE_LOG_MSG_SIZE 2048
+#define H5C_MAX_TRACE_LOG_MSG_SIZE 4096
/******************/
diff --git a/src/H5Cmpio.c b/src/H5Cmpio.c
index ecaed62..84ec16c 100644
--- a/src/H5Cmpio.c
+++ b/src/H5Cmpio.c
@@ -214,10 +214,10 @@ H5C_apply_candidate_list(H5F_t * f,
HDmemset(tbl_buf, 0, sizeof(tbl_buf));
- sprintf(&(tbl_buf[0]), "candidate list = ");
+ HDsprintf(&(tbl_buf[0]), "candidate list = ");
for(u = 0; u < num_candidates; u++)
- sprintf(&(tbl_buf[HDstrlen(tbl_buf)]), " 0x%llx", (long long)(*(candidates_list_ptr + u)));
- sprintf(&(tbl_buf[HDstrlen(tbl_buf)]), "\n");
+ HDsprintf(&(tbl_buf[HDstrlen(tbl_buf)]), " 0x%llx", (long long)(*(candidates_list_ptr + u)));
+ HDsprintf(&(tbl_buf[HDstrlen(tbl_buf)]), "\n");
HDfprintf(stdout, "%s", tbl_buf);
#endif /* H5C_APPLY_CANDIDATE_LIST__DEBUG */
@@ -280,10 +280,10 @@ H5C_apply_candidate_list(H5F_t * f,
#if H5C_APPLY_CANDIDATE_LIST__DEBUG
for ( i = 0; i < 1024; i++ )
tbl_buf[i] = '\0';
- sprintf(&(tbl_buf[0]), "candidate assignment table = ");
+ HDsprintf(&(tbl_buf[0]), "candidate assignment table = ");
for(i = 0; i <= mpi_size; i++)
- sprintf(&(tbl_buf[HDstrlen(tbl_buf)]), " %d", candidate_assignment_table[i]);
- sprintf(&(tbl_buf[HDstrlen(tbl_buf)]), "\n");
+ HDsprintf(&(tbl_buf[HDstrlen(tbl_buf)]), " %d", candidate_assignment_table[i]);
+ HDsprintf(&(tbl_buf[HDstrlen(tbl_buf)]), "\n");
HDfprintf(stdout, "%s", tbl_buf);
HDfprintf(stdout, "%s:%d: flush entries [%u, %u].\n",
diff --git a/src/H5D.c b/src/H5D.c
index fc350f2..a8cefd9 100644
--- a/src/H5D.c
+++ b/src/H5D.c
@@ -105,11 +105,10 @@ hid_t
H5Dcreate2(hid_t loc_id, const char *name, hid_t type_id, hid_t space_id,
hid_t lcpl_id, hid_t dcpl_id, hid_t dapl_id)
{
- void *dset = NULL; /* New dataset's info */
- H5VL_object_t *vol_obj = NULL; /* object token of loc_id */
+ void *dset = NULL; /* New dataset's info */
+ H5VL_object_t *vol_obj = NULL; /* object token of loc_id */
H5VL_loc_params_t loc_params;
- H5P_genplist_t *plist = NULL; /* Property list pointer */
- hid_t ret_value = H5I_INVALID_HID; /* Return value */
+ hid_t ret_value = H5I_INVALID_HID; /* Return value */
FUNC_ENTER_API(H5I_INVALID_HID)
H5TRACE7("i", "i*siiiii", loc_id, name, type_id, space_id, lcpl_id, dcpl_id,
@@ -135,32 +134,23 @@ H5Dcreate2(hid_t loc_id, const char *name, hid_t type_id, hid_t space_id,
if(TRUE != H5P_isa_class(dcpl_id, H5P_DATASET_CREATE))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "dcpl_id is not a dataset create property list ID")
+ /* Set the DCPL for the API context */
+ H5CX_set_dcpl(dcpl_id);
+
/* Verify access property list and set up collective metadata if appropriate */
if(H5CX_set_apl(&dapl_id, H5P_CLS_DACC, loc_id, TRUE) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, H5I_INVALID_HID, "can't set access property list info")
- /* Get the property list structure for the dcpl */
- if(NULL == (plist = (H5P_genplist_t *)H5I_object(dcpl_id)))
- HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, H5I_INVALID_HID, "can't find object for ID")
-
/* Get the location object */
if(NULL == (vol_obj = (H5VL_object_t *)H5I_object(loc_id)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "invalid location identifier")
- /* Set creation properties */
- if(H5P_set(plist, H5VL_PROP_DSET_TYPE_ID, &type_id) < 0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, H5I_INVALID_HID, "can't set property value for datatype id")
- if(H5P_set(plist, H5VL_PROP_DSET_SPACE_ID, &space_id) < 0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, H5I_INVALID_HID, "can't set property value for space id")
- if(H5P_set(plist, H5VL_PROP_DSET_LCPL_ID, &lcpl_id) < 0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, H5I_INVALID_HID, "can't set property value for lcpl id")
-
/* Set location parameters */
loc_params.type = H5VL_OBJECT_BY_SELF;
loc_params.obj_type = H5I_get_type(loc_id);
/* Create the dataset */
- if(NULL == (dset = H5VL_dataset_create(vol_obj, &loc_params, name, dcpl_id, dapl_id, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL)))
+ if(NULL == (dset = H5VL_dataset_create(vol_obj, &loc_params, name, lcpl_id, type_id, space_id, dcpl_id, dapl_id, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL)))
HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, H5I_INVALID_HID, "unable to create dataset")
/* Get an atom for the dataset */
@@ -213,9 +203,8 @@ H5Dcreate_anon(hid_t loc_id, hid_t type_id, hid_t space_id, hid_t dcpl_id,
hid_t dapl_id)
{
void *dset = NULL; /* dset token from VOL connector */
- H5VL_object_t *vol_obj = NULL; /* object token of loc_id */
+ H5VL_object_t *vol_obj = NULL; /* object token of loc_id */
H5VL_loc_params_t loc_params;
- H5P_genplist_t *plist; /* Property list pointer */
hid_t ret_value = H5I_INVALID_HID; /* Return value */
FUNC_ENTER_API(H5I_INVALID_HID)
@@ -228,6 +217,9 @@ H5Dcreate_anon(hid_t loc_id, hid_t type_id, hid_t space_id, hid_t dcpl_id,
if(TRUE != H5P_isa_class(dcpl_id, H5P_DATASET_CREATE))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not dataset create property list ID")
+ /* Set the DCPL for the API context */
+ H5CX_set_dcpl(dcpl_id);
+
/* Verify access property list and set up collective metadata if appropriate */
if(H5CX_set_apl(&dapl_id, H5P_CLS_DACC, loc_id, TRUE) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, H5I_INVALID_HID, "can't set access property list info")
@@ -236,22 +228,12 @@ H5Dcreate_anon(hid_t loc_id, hid_t type_id, hid_t space_id, hid_t dcpl_id,
if(NULL == (vol_obj = (H5VL_object_t *)H5I_object(loc_id)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "invalid location identifier")
- /* Get the plist structure */
- if(NULL == (plist = (H5P_genplist_t *)H5I_object(dcpl_id)))
- HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, H5I_INVALID_HID, "can't find object for ID")
-
- /* set creation properties */
- if(H5P_set(plist, H5VL_PROP_DSET_TYPE_ID, &type_id) < 0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, H5I_INVALID_HID, "can't set property value for datatype id")
- if(H5P_set(plist, H5VL_PROP_DSET_SPACE_ID, &space_id) < 0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, H5I_INVALID_HID, "can't set property value for space id")
-
/* Set location parameters */
loc_params.type = H5VL_OBJECT_BY_SELF;
loc_params.obj_type = H5I_get_type(loc_id);
/* Create the dataset */
- if(NULL == (dset = H5VL_dataset_create(vol_obj, &loc_params, NULL, dcpl_id, dapl_id, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL)))
+ if(NULL == (dset = H5VL_dataset_create(vol_obj, &loc_params, NULL, H5P_LINK_CREATE_DEFAULT, type_id, space_id, dcpl_id, dapl_id, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL)))
HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, H5I_INVALID_HID, "unable to create dataset")
/* Get an atom for the dataset */
@@ -455,7 +437,7 @@ H5Dget_type(hid_t dset_id)
if(NULL == (vol_obj = (H5VL_object_t *)H5I_object_verify(dset_id, H5I_DATASET)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "invalid dataset identifier")
- /* get the datatype */
+ /* Get the datatype */
if(H5VL_dataset_get(vol_obj, H5VL_DATASET_GET_TYPE, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, &ret_value) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, H5I_INVALID_HID, "unable to get datatype")
diff --git a/src/H5Dbtree.c b/src/H5Dbtree.c
index b61aed4..c13c36a 100644
--- a/src/H5Dbtree.c
+++ b/src/H5Dbtree.c
@@ -39,6 +39,7 @@
#include "H5FLprivate.h" /* Free Lists */
#include "H5Iprivate.h" /* IDs */
#include "H5MFprivate.h" /* File space management */
+#include "H5MMprivate.h" /* Memory management */
#include "H5Oprivate.h" /* Object headers */
#include "H5Sprivate.h" /* Dataspaces */
#include "H5VMprivate.h" /* Vector and array functions */
@@ -847,7 +848,7 @@ H5D__btree_shared_create(const H5F_t *f, H5O_storage_chunk_t *store,
/* Set up the "local" information for this dataset's chunks */
if(NULL == (my_layout = H5FL_MALLOC(H5O_layout_chunk_t)))
HGOTO_ERROR(H5E_DATASET, H5E_CANTALLOC, FAIL, "can't allocate chunk layout")
- HDmemcpy(my_layout, layout, sizeof(H5O_layout_chunk_t));
+ H5MM_memcpy(my_layout, layout, sizeof(H5O_layout_chunk_t));
shared->udata = my_layout;
/* Make shared B-tree info reference counted */
@@ -1087,7 +1088,7 @@ H5D__btree_idx_iterate_cb(H5F_t H5_ATTR_UNUSED *f, const void *_lt_key,
HDcompile_assert(sizeof(chunk_rec.filter_mask) == sizeof(lt_key->filter_mask));
/* Compose generic chunk record for callback */
- HDmemcpy(&chunk_rec, lt_key, sizeof(*lt_key));
+ H5MM_memcpy(&chunk_rec, lt_key, sizeof(*lt_key));
chunk_rec.chunk_addr = addr;
/* Make "generic chunk" callback */
diff --git a/src/H5Dbtree2.c b/src/H5Dbtree2.c
index b32f395..d25e0f0 100644
--- a/src/H5Dbtree2.c
+++ b/src/H5Dbtree2.c
@@ -32,6 +32,7 @@
#include "H5Dpkg.h" /* Datasets */
#include "H5FLprivate.h" /* Free Lists */
#include "H5MFprivate.h" /* File space management */
+#include "H5MMprivate.h" /* Memory management */
#include "H5VMprivate.h" /* Vector and array functions */
@@ -248,7 +249,7 @@ H5D__bt2_crt_context(void *_udata)
/* Set up the "local" information for this dataset's chunk dimension sizes */
if(NULL == (my_dim = (uint32_t *)H5FL_BLK_MALLOC(chunk_dim, H5O_LAYOUT_NDIMS * sizeof(uint32_t))))
HGOTO_ERROR(H5E_DATASET, H5E_CANTALLOC, NULL, "can't allocate chunk dims")
- HDmemcpy(my_dim, udata->dim, H5O_LAYOUT_NDIMS * sizeof(uint32_t));
+ H5MM_memcpy(my_dim, udata->dim, H5O_LAYOUT_NDIMS * sizeof(uint32_t));
ctx->dim = my_dim;
/*
diff --git a/src/H5Dchunk.c b/src/H5Dchunk.c
index e165569..a8dc398 100644
--- a/src/H5Dchunk.c
+++ b/src/H5Dchunk.c
@@ -276,6 +276,8 @@ static hbool_t H5D__chunk_cinfo_cache_found(const H5D_chunk_cached_t *last,
static herr_t H5D__free_chunk_info(void *item, void *key, void *opdata);
static herr_t H5D__create_chunk_map_single(H5D_chunk_map_t *fm,
const H5D_io_info_t *io_info);
+static herr_t H5D__create_chunk_file_map_all(H5D_chunk_map_t *fm,
+ const H5D_io_info_t *io_info);
static herr_t H5D__create_chunk_file_map_hyper(H5D_chunk_map_t *fm,
const H5D_io_info_t *io_info);
static herr_t H5D__create_chunk_mem_map_hyper(const H5D_chunk_map_t *fm);
@@ -313,6 +315,7 @@ const H5D_layout_ops_t H5D_LOPS_CHUNK[1] = {{
H5D__chunk_construct,
H5D__chunk_init,
H5D__chunk_is_space_alloc,
+ H5D__chunk_is_data_cached,
H5D__chunk_io_init,
H5D__chunk_read,
H5D__chunk_write,
@@ -340,6 +343,7 @@ const H5D_layout_ops_t H5D_LOPS_NONEXISTENT[1] = {{
NULL,
NULL,
NULL,
+ NULL,
#ifdef H5_HAVE_PARALLEL
NULL,
NULL,
@@ -394,10 +398,13 @@ H5D__chunk_direct_write(const H5D_t *dset, uint32_t filters, hsize_t *offset,
FUNC_ENTER_PACKAGE_TAG(dset->oloc.addr)
+ /* Sanity checks */
+ HDassert(layout->type == H5D_CHUNKED);
+
io_info.dset = dset;
/* Allocate dataspace and initialize it if it hasn't been. */
- if(!(*layout->ops->is_space_alloc)(&layout->storage))
+ if(!H5D__chunk_is_space_alloc(&layout->storage))
/* Allocate storage */
if(H5D__alloc_storage(&io_info, H5D_ALLOC_WRITE, FALSE, NULL) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to initialize storage")
@@ -435,13 +442,17 @@ H5D__chunk_direct_write(const H5D_t *dset, uint32_t filters, hsize_t *offset,
if(0 == idx_info.pline->nused && H5F_addr_defined(old_chunk.offset))
/* If there are no filters and we are overwriting the chunk we can just set values */
need_insert = FALSE;
- else
+ else {
/* Otherwise, create the chunk it if it doesn't exist, or reallocate the chunk
* if its size has changed.
*/
if(H5D__chunk_file_alloc(&idx_info, &old_chunk, &udata.chunk_block, &need_insert, scaled) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTALLOC, FAIL, "unable to allocate chunk")
+ /* Cache the new chunk information */
+ H5D__chunk_cinfo_cache_update(&dset->shared->cache.chunk.last, &udata);
+ } /* end else */
+
/* Make sure the address of the chunk is returned. */
if(!H5F_addr_defined(udata.chunk_block.offset))
HGOTO_ERROR(H5E_DATASET, H5E_BADVALUE, FAIL, "chunk address isn't defined")
@@ -506,7 +517,8 @@ H5D__chunk_direct_read(const H5D_t *dset, hsize_t *offset, uint32_t* filters,
*filters = 0;
/* Allocate dataspace and initialize it if it hasn't been. */
- if(!(*layout->ops->is_space_alloc)(&layout->storage))
+ if(!H5D__chunk_is_space_alloc(&layout->storage)
+ && !H5D__chunk_is_data_cached(dset->shared))
HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "storage is not initialized")
/* Calculate the index of this chunk */
@@ -695,15 +707,18 @@ 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])
layout->max_chunks[u] = H5S_UNLIMITED;
else
+ {
+ /* Sanity check */
+ if(layout->dim[u] == 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_BADVALUE, FAIL, "dimension size must be > 0, dim = %u ", u)
+
layout->max_chunks[u] = ((max_dims[u] + layout->dim[u]) - 1) / layout->dim[u];
+ }
/* Accumulate the # of chunks */
layout->nchunks *= layout->chunks[u];
@@ -1019,6 +1034,30 @@ H5D__chunk_is_space_alloc(const H5O_storage_t *storage)
/*-------------------------------------------------------------------------
+ * Function: H5D__chunk_is_data_cached
+ *
+ * Purpose: Query if raw data is cached for dataset
+ *
+ * Return: Non-negative on success/Negative on failure
+ *
+ * Programmer: Neil Fortner
+ * Wednessday, March 6, 2016
+ *
+ *-------------------------------------------------------------------------
+ */
+hbool_t
+H5D__chunk_is_data_cached(const H5D_shared_t *shared_dset)
+{
+ FUNC_ENTER_PACKAGE_NOERR
+
+ /* Sanity checks */
+ HDassert(shared_dset);
+
+ FUNC_LEAVE_NOAPI(shared_dset->cache.chunk.nused > 0)
+} /* end H5D__chunk_is_data_cached() */
+
+
+/*-------------------------------------------------------------------------
* Function: H5D__chunk_io_init
*
* Purpose: Performs initialization before any sort of I/O on the raw data
@@ -1044,7 +1083,6 @@ H5D__chunk_io_init(const H5D_io_info_t *io_info, const H5D_type_info_t *type_inf
hbool_t iter_init = FALSE; /* Selection iteration info has been initialized */
unsigned f_ndims; /* The number of dimensions of the file's dataspace */
int sm_ndims; /* The number of dimensions of the memory buffer's dataspace (signed) */
- H5SL_node_t *curr_node; /* Current node in skip list */
char bogus; /* "bogus" buffer to pass to selection iterator */
unsigned u; /* Local index variable */
herr_t ret_value = SUCCEED; /* Return value */
@@ -1073,21 +1111,19 @@ H5D__chunk_io_init(const H5D_io_info_t *io_info, const H5D_type_info_t *type_inf
if((file_space_normalized = H5S_hyper_normalize_offset((H5S_t *)file_space, old_offset)) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, FAIL, "unable to normalize selection")
- /* Decide the number of chunks in each dimension*/
- for(u = 0; u < f_ndims; u++) {
+ /* Decide the number of chunks in each dimension */
+ for(u = 0; u < f_ndims; u++)
/* Keep the size of the chunk dimensions as hsize_t for various routines */
fm->chunk_dim[u] = fm->layout->u.chunk.dim[u];
- } /* end for */
#ifdef H5_HAVE_PARALLEL
/* Calculate total chunk in file map*/
fm->select_chunk = NULL;
if(io_info->using_mpi_vfd) {
H5_CHECK_OVERFLOW(fm->layout->u.chunk.nchunks, hsize_t, size_t);
- if(fm->layout->u.chunk.nchunks) {
+ if(fm->layout->u.chunk.nchunks)
if(NULL == (fm->select_chunk = (H5D_chunk_info_t **)H5MM_calloc((size_t)fm->layout->u.chunk.nchunks * sizeof(H5D_chunk_info_t *))))
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "can't allocate chunk info")
- }
} /* end if */
#endif /* H5_HAVE_PARALLEL */
@@ -1129,10 +1165,9 @@ H5D__chunk_io_init(const H5D_io_info_t *io_info, const H5D_type_info_t *type_inf
HDassert(fm->single_space);
/* Allocate the single chunk information */
- if(NULL == dataset->shared->cache.chunk.single_chunk_info) {
+ if(NULL == dataset->shared->cache.chunk.single_chunk_info)
if(NULL == (dataset->shared->cache.chunk.single_chunk_info = H5FL_MALLOC(H5D_chunk_info_t)))
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "can't allocate chunk info")
- } /* end if */
fm->single_chunk_info = dataset->shared->cache.chunk.single_chunk_info;
HDassert(fm->single_chunk_info);
@@ -1147,10 +1182,9 @@ H5D__chunk_io_init(const H5D_io_info_t *io_info, const H5D_type_info_t *type_inf
hbool_t sel_hyper_flag; /* Whether file selection is a hyperslab */
/* Initialize skip list for chunk selections */
- if(NULL == dataset->shared->cache.chunk.sel_chunks) {
+ if(NULL == dataset->shared->cache.chunk.sel_chunks)
if(NULL == (dataset->shared->cache.chunk.sel_chunks = H5SL_create(H5SL_TYPE_HSIZE, NULL)))
HGOTO_ERROR(H5E_DATASET, H5E_CANTCREATE, FAIL, "can't create skip list for chunk selections")
- } /* end if */
fm->sel_chunks = dataset->shared->cache.chunk.sel_chunks;
HDassert(fm->sel_chunks);
@@ -1172,25 +1206,17 @@ H5D__chunk_io_init(const H5D_io_info_t *io_info, const H5D_type_info_t *type_inf
/* Check if file selection is a not a hyperslab selection */
if(sel_hyper_flag) {
/* Build the file selection for each chunk */
- if(H5D__create_chunk_file_map_hyper(fm, io_info) < 0)
- HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to create file chunk selections")
-
- /* Clean file chunks' hyperslab span "scratch" information */
- curr_node = H5SL_first(fm->sel_chunks);
- while(curr_node) {
- H5D_chunk_info_t *chunk_info; /* Pointer chunk information */
-
- /* Get pointer to chunk's information */
- chunk_info = (H5D_chunk_info_t *)H5SL_item(curr_node);
- HDassert(chunk_info);
-
- /* Clean hyperslab span's "scratch" information */
- if(H5S_hyper_reset_scratch(chunk_info->fspace) < 0)
- HGOTO_ERROR(H5E_DATASET, H5E_CANTFREE, FAIL, "unable to reset span scratch info")
+ if(H5S_SEL_ALL == fm->fsel_type) {
+ if(H5D__create_chunk_file_map_all(fm, io_info) < 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to create file chunk selections")
+ } /* end if */
+ else {
+ /* Sanity check */
+ HDassert(fm->fsel_type == H5S_SEL_HYPERSLABS);
- /* Get the next chunk node in the skip list */
- curr_node = H5SL_next(curr_node);
- } /* end while */
+ if(H5D__create_chunk_file_map_hyper(fm, io_info) < 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to create file chunk selections")
+ } /* end else */
} /* end if */
else {
H5S_sel_iter_op_t iter_op; /* Operator for iteration */
@@ -1245,15 +1271,14 @@ H5D__chunk_io_init(const H5D_io_info_t *io_info, const H5D_type_info_t *type_inf
fm->mchunk_tmpl = tmp_mspace;
/* Create temporary datatypes for selection iteration */
- if(!file_type) {
+ if(!file_type)
if(NULL == (file_type = H5T_copy(dataset->shared->type, H5T_COPY_ALL)))
HGOTO_ERROR(H5E_DATATYPE, H5E_CANTCOPY, FAIL, "unable to copy file datatype")
- } /* end if */
/* Create selection iterator for memory selection */
if(0 == (elmt_size = H5T_get_size(mem_type)))
HGOTO_ERROR(H5E_DATATYPE, H5E_BADSIZE, FAIL, "datatype size invalid")
- if(H5S_select_iter_init(&(fm->mem_iter), mem_space, elmt_size) < 0)
+ if(H5S_select_iter_init(&(fm->mem_iter), mem_space, elmt_size, 0) < 0)
HGOTO_ERROR(H5E_DATASPACE, H5E_CANTINIT, FAIL, "unable to initialize selection iterator")
iter_init = TRUE; /* Selection iteration info has been initialized */
@@ -1263,26 +1288,6 @@ H5D__chunk_io_init(const H5D_io_info_t *io_info, const H5D_type_info_t *type_inf
/* Spaces aren't the same shape, iterate over the memory selection directly */
if(H5S_select_iterate(&bogus, file_type, file_space, &iter_op, fm) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to create memory chunk selections")
-
- /* Clean up hyperslab stuff, if necessary */
- if(fm->msel_type != H5S_SEL_POINTS) {
- /* Clean memory chunks' hyperslab span "scratch" information */
- curr_node = H5SL_first(fm->sel_chunks);
- while(curr_node) {
- H5D_chunk_info_t *chunk_info; /* Pointer chunk information */
-
- /* Get pointer to chunk's information */
- chunk_info = (H5D_chunk_info_t *)H5SL_item(curr_node);
- HDassert(chunk_info);
-
- /* Clean hyperslab span's "scratch" information */
- if(H5S_hyper_reset_scratch(chunk_info->mspace) < 0)
- HGOTO_ERROR(H5E_DATASET, H5E_CANTFREE, FAIL, "unable to reset span scratch info")
-
- /* Get the next chunk node in the skip list */
- curr_node = H5SL_next(curr_node);
- } /* end while */
- } /* end if */
} /* end else */
} /* end else */
@@ -1538,9 +1543,214 @@ done:
/*-------------------------------------------------------------------------
+ * Function: H5D__create_chunk_file_map_all
+ *
+ * Purpose: Create all chunk selections in file, for an "all" selection.
+ *
+ * Return: Non-negative on success/Negative on failure
+ *
+ * Programmer: Quincey Koziol
+ * Monday, January 21, 2019
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5D__create_chunk_file_map_all(H5D_chunk_map_t *fm, const H5D_io_info_t
+#ifndef H5_HAVE_PARALLEL
+ H5_ATTR_UNUSED
+#endif /* H5_HAVE_PARALLEL */
+ *io_info)
+{
+ H5S_t *tmp_fchunk = NULL; /* Temporary file dataspace */
+ hsize_t file_dims[H5S_MAX_RANK]; /* File dataspace dims */
+ hsize_t sel_points; /* Number of elements in file selection */
+ hsize_t zeros[H5S_MAX_RANK]; /* All zero vector (for start parameter to setting hyperslab on partial chunks) */
+ hsize_t coords[H5S_MAX_RANK]; /* Current coordinates of chunk */
+ hsize_t end[H5S_MAX_RANK]; /* Final coordinates of chunk */
+ hsize_t scaled[H5S_MAX_RANK]; /* Scaled coordinates for this chunk */
+ hsize_t chunk_index; /* "Index" of chunk */
+ hsize_t curr_partial_clip[H5S_MAX_RANK]; /* Current partial dimension sizes to clip against */
+ hsize_t partial_dim_size[H5S_MAX_RANK]; /* Size of a partial dimension */
+ hbool_t is_partial_dim[H5S_MAX_RANK]; /* Whether a dimension is currently a partial chunk */
+ unsigned num_partial_dims; /* Current number of partial dimensions */
+ unsigned u; /* Local index variable */
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_STATIC
+
+ /* Sanity check */
+ HDassert(fm->f_ndims > 0);
+
+ /* Get number of elements selected in file */
+ sel_points = fm->nelmts;
+
+ /* Get dataspace dimensions */
+ if(H5S_get_simple_extent_dims(fm->file_space, file_dims, NULL) < 0)
+ HGOTO_ERROR(H5E_DATASPACE, H5E_CANTGET, FAIL, "can't get file selection bound info")
+
+ /* Set initial chunk location, partial dimensions, etc */
+ num_partial_dims = 0;
+ HDmemset(zeros, 0, sizeof(zeros));
+ 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)
+
+ /* Set up start / end coordinates for first chunk */
+ scaled[u] = 0;
+ coords[u] = 0;
+ end[u] = fm->chunk_dim[u] - 1;
+
+ /* Iniitialize partial chunk dimension information */
+ partial_dim_size[u] = file_dims[u] % fm->chunk_dim[u];
+ if(file_dims[u] < fm->chunk_dim[u]) {
+ curr_partial_clip[u] = partial_dim_size[u];
+ is_partial_dim[u] = TRUE;
+ num_partial_dims++;
+ } /* end if */
+ else {
+ curr_partial_clip[u] = fm->chunk_dim[u];
+ is_partial_dim[u] = FALSE;
+ } /* end else */
+ } /* end for */
+
+ /* Set the index of this chunk */
+ chunk_index = 0;
+
+ /* Create "temporary" chunk for selection operations (copy file space) */
+ if(NULL == (tmp_fchunk = H5S_create_simple(fm->f_ndims, fm->chunk_dim, NULL)))
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTCREATE, FAIL, "unable to create dataspace for chunk")
+
+ /* Iterate through each chunk in the dataset */
+ while(sel_points) {
+ H5D_chunk_info_t *new_chunk_info; /* chunk information to insert into skip list */
+ hssize_t schunk_points; /* Number of elements in chunk selection */
+
+ /* Add temporary chunk to the list of chunks */
+
+ /* Allocate the file & memory chunk information */
+ if(NULL == (new_chunk_info = H5FL_MALLOC(H5D_chunk_info_t)))
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTALLOC, FAIL, "can't allocate chunk info")
+
+ /* Initialize the chunk information */
+
+ /* Set the chunk index */
+ new_chunk_info->index = chunk_index;
+
+#ifdef H5_HAVE_PARALLEL
+ /* Store chunk selection information, for multi-chunk I/O */
+ if(io_info->using_mpi_vfd)
+ fm->select_chunk[chunk_index] = new_chunk_info;
+#endif /* H5_HAVE_PARALLEL */
+
+ /* Set the file chunk dataspace */
+ if(NULL == (new_chunk_info->fspace = H5S_copy(tmp_fchunk, TRUE, FALSE)))
+ HGOTO_ERROR(H5E_DATASPACE, H5E_CANTCOPY, FAIL, "unable to copy chunk dataspace")
+ new_chunk_info->fspace_shared = FALSE;
+
+ /* If there are partial dimensions for this chunk, set the hyperslab for them */
+ if(num_partial_dims > 0)
+ if(H5S_select_hyperslab(new_chunk_info->fspace, H5S_SELECT_SET, zeros, NULL, curr_partial_clip, NULL) < 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTSELECT, FAIL, "can't create chunk selection")
+
+ /* Set the memory chunk dataspace */
+ new_chunk_info->mspace = NULL;
+ new_chunk_info->mspace_shared = FALSE;
+
+ /* Copy the chunk's scaled coordinates */
+ H5MM_memcpy(new_chunk_info->scaled, scaled, sizeof(hsize_t) * fm->f_ndims);
+ new_chunk_info->scaled[fm->f_ndims] = 0;
+
+ /* Insert the new chunk into the skip list */
+ if(H5SL_insert(fm->sel_chunks, new_chunk_info, &new_chunk_info->index) < 0) {
+ H5D__free_chunk_info(new_chunk_info, NULL, NULL);
+ HGOTO_ERROR(H5E_DATASPACE, H5E_CANTINSERT, FAIL, "can't insert chunk into skip list")
+ } /* end if */
+
+ /* Get number of elements selected in chunk */
+ if((schunk_points = H5S_GET_SELECT_NPOINTS(new_chunk_info->fspace)) < 0)
+ HGOTO_ERROR(H5E_DATASPACE, H5E_CANTGET, FAIL, "can't get file selection # of elements")
+ H5_CHECKED_ASSIGN(new_chunk_info->chunk_points, uint32_t, schunk_points, hssize_t);
+
+ /* Decrement # of points left in file selection */
+ sel_points -= (hsize_t)schunk_points;
+
+ /* Advance to next chunk if we are not done */
+ if(sel_points > 0) {
+ int curr_dim; /* Current dimension to increment */
+
+ /* Increment chunk index */
+ chunk_index++;
+
+ /* Set current increment dimension */
+ curr_dim = (int)fm->f_ndims - 1;
+
+ /* Increment chunk location in fastest changing dimension */
+ coords[curr_dim] += fm->chunk_dim[curr_dim];
+ scaled[curr_dim]++;
+ end[curr_dim] += fm->chunk_dim[curr_dim];
+
+ /* Bring chunk location back into bounds, if necessary */
+ if(coords[curr_dim] >= file_dims[curr_dim]) {
+ do {
+ /* Reset current dimension's location to 0 */
+ coords[curr_dim] = 0;
+ scaled[curr_dim] = 0;
+ end[curr_dim] = fm->chunk_dim[curr_dim] - 1;
+
+ /* Check for previous partial chunk in this dimension */
+ if(is_partial_dim[curr_dim] && end[curr_dim] < file_dims[curr_dim]) {
+ /* Sanity check */
+ HDassert(num_partial_dims > 0);
+
+ /* Reset partial chunk information for this dimension */
+ curr_partial_clip[curr_dim] = fm->chunk_dim[curr_dim];
+ is_partial_dim[curr_dim] = FALSE;
+ num_partial_dims--;
+ } /* end if */
+
+ /* Decrement current dimension */
+ curr_dim--;
+
+ /* Check for valid current dim */
+ if(curr_dim >= 0) {
+ /* Increment chunk location in current dimension */
+ coords[curr_dim] += fm->chunk_dim[curr_dim];
+ scaled[curr_dim]++;
+ end[curr_dim] = (coords[curr_dim] + fm->chunk_dim[curr_dim]) - 1;
+ } /* end if */
+ } while(curr_dim >= 0 && (coords[curr_dim] >= file_dims[curr_dim]));
+ } /* end if */
+
+ /* Check for valid current dim */
+ if(curr_dim >= 0) {
+ /* Check for partial chunk in this dimension */
+ if(!is_partial_dim[curr_dim] && file_dims[curr_dim] <= end[curr_dim]) {
+ /* Set partial chunk information for this dimension */
+ curr_partial_clip[curr_dim] = partial_dim_size[curr_dim];
+ is_partial_dim[curr_dim] = TRUE;
+ num_partial_dims++;
+
+ /* Sanity check */
+ HDassert(num_partial_dims <= fm->f_ndims);
+ } /* end if */
+ } /* end if */
+ } /* end if */
+ } /* end while */
+
+done:
+ /* Clean up */
+ if(tmp_fchunk && H5S_close(tmp_fchunk) < 0)
+ HDONE_ERROR(H5E_DATASET, H5E_CANTRELEASE, FAIL, "can't release temporary dataspace")
+
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5D__create_chunk_file_map_all() */
+
+
+/*-------------------------------------------------------------------------
* Function: H5D__create_chunk_file_map_hyper
*
- * Purpose: Create all chunk selections in file.
+ * Purpose: Create all chunk selections in file, for a hyperslab selection.
*
* Return: Non-negative on success/Negative on failure
*
@@ -1556,8 +1766,9 @@ H5D__create_chunk_file_map_hyper(H5D_chunk_map_t *fm, const H5D_io_info_t
#endif /* H5_HAVE_PARALLEL */
*io_info)
{
- hsize_t sel_start[H5O_LAYOUT_NDIMS]; /* Offset of low bound of file selection */
- hsize_t sel_end[H5O_LAYOUT_NDIMS]; /* Offset of high bound of file selection */
+ H5S_t *tmp_fchunk = NULL; /* Temporary file dataspace */
+ hsize_t sel_start[H5O_LAYOUT_NDIMS]; /* Offset of low bound of file selection */
+ hsize_t sel_end[H5O_LAYOUT_NDIMS]; /* Offset of high bound of file selection */
hsize_t sel_points; /* Number of elements in file selection */
hsize_t start_coords[H5O_LAYOUT_NDIMS]; /* Starting coordinates of selection */
hsize_t coords[H5O_LAYOUT_NDIMS]; /* Current coordinates of chunk */
@@ -1572,7 +1783,7 @@ H5D__create_chunk_file_map_hyper(H5D_chunk_map_t *fm, const H5D_io_info_t
FUNC_ENTER_STATIC
/* Sanity check */
- HDassert(fm->f_ndims>0);
+ HDassert(fm->f_ndims > 0);
/* Get number of elements selected in file */
sel_points = fm->nelmts;
@@ -1596,53 +1807,36 @@ H5D__create_chunk_file_map_hyper(H5D_chunk_map_t *fm, const H5D_io_info_t
/* Iterate through each chunk in the dataset */
while(sel_points) {
- /* Check for intersection of temporary chunk and file selection */
+ /* Check for intersection of current chunk and file selection */
/* (Casting away const OK - QAK) */
if(TRUE == H5S_hyper_intersect_block((H5S_t *)fm->file_space, coords, end)) {
- H5S_t *tmp_fchunk; /* Temporary file dataspace */
H5D_chunk_info_t *new_chunk_info; /* chunk information to insert into skip list */
hssize_t schunk_points; /* Number of elements in chunk selection */
- /* Create "temporary" chunk for selection operations (copy file space) */
- if(NULL == (tmp_fchunk = H5S_copy(fm->file_space, TRUE, FALSE)))
- HGOTO_ERROR(H5E_DATASPACE, H5E_CANTCOPY, FAIL, "unable to copy memory space")
-
- /* Make certain selections are stored in span tree form (not "optimized hyperslab" or "all") */
- if(H5S_hyper_convert(tmp_fchunk) < 0) {
- (void)H5S_close(tmp_fchunk);
- HGOTO_ERROR(H5E_DATASPACE, H5E_CANTINIT, FAIL, "unable to convert selection to span trees")
- } /* end if */
-
- /* "AND" temporary chunk and current chunk */
- if(H5S_select_hyperslab(tmp_fchunk,H5S_SELECT_AND,coords,NULL,fm->chunk_dim,NULL) < 0) {
- (void)H5S_close(tmp_fchunk);
- HGOTO_ERROR(H5E_DATASPACE, H5E_CANTSELECT, FAIL, "can't create chunk selection")
- } /* end if */
+ /* Create dataspace for chunk, 'AND'ing the overall selection with
+ * the current chunk.
+ */
+ if(H5S_combine_hyperslab(fm->file_space, H5S_SELECT_AND, coords, NULL, fm->chunk_dim, NULL, &tmp_fchunk) < 0)
+ HGOTO_ERROR(H5E_DATASPACE, H5E_CANTCOPY, FAIL, "unable to combine file space selection with chunk block")
/* Resize chunk's dataspace dimensions to size of chunk */
- if(H5S_set_extent_real(tmp_fchunk,fm->chunk_dim) < 0) {
- (void)H5S_close(tmp_fchunk);
- HGOTO_ERROR(H5E_DATASPACE, H5E_CANTSELECT, FAIL, "can't adjust chunk dimensions")
- } /* end if */
+ if(H5S_set_extent_real(tmp_fchunk, fm->chunk_dim) < 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTSELECT, FAIL, "can't adjust chunk dimensions")
/* Move selection back to have correct offset in chunk */
- if(H5S_SELECT_ADJUST_U(tmp_fchunk, coords) < 0) {
- (void)H5S_close(tmp_fchunk);
- HGOTO_ERROR(H5E_DATASPACE, H5E_CANTSELECT, FAIL, "can't adjust chunk selection")
- }
+ if(H5S_SELECT_ADJUST_U(tmp_fchunk, coords) < 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTSELECT, FAIL, "can't adjust chunk selection")
/* Add temporary chunk to the list of chunks */
/* Allocate the file & memory chunk information */
- if (NULL==(new_chunk_info = H5FL_MALLOC(H5D_chunk_info_t))) {
- (void)H5S_close(tmp_fchunk);
- HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "can't allocate chunk info")
- } /* end if */
+ if(NULL == (new_chunk_info = H5FL_MALLOC(H5D_chunk_info_t)))
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTALLOC, FAIL, "can't allocate chunk info")
/* Initialize the chunk information */
/* Set the chunk index */
- new_chunk_info->index=chunk_index;
+ new_chunk_info->index = chunk_index;
#ifdef H5_HAVE_PARALLEL
/* Store chunk selection information, for multi-chunk I/O */
@@ -1653,18 +1847,16 @@ H5D__create_chunk_file_map_hyper(H5D_chunk_map_t *fm, const H5D_io_info_t
/* Set the file chunk dataspace */
new_chunk_info->fspace = tmp_fchunk;
new_chunk_info->fspace_shared = FALSE;
+ tmp_fchunk = NULL;
/* Set the memory chunk dataspace */
- new_chunk_info->mspace=NULL;
+ new_chunk_info->mspace = NULL;
new_chunk_info->mspace_shared = FALSE;
/* Copy the chunk's scaled coordinates */
- HDmemcpy(new_chunk_info->scaled, scaled, sizeof(hsize_t) * fm->f_ndims);
+ H5MM_memcpy(new_chunk_info->scaled, scaled, sizeof(hsize_t) * fm->f_ndims);
new_chunk_info->scaled[fm->f_ndims] = 0;
- /* Copy the chunk's scaled coordinates */
- HDmemcpy(new_chunk_info->scaled, scaled, sizeof(hsize_t) * fm->f_ndims);
-
/* Insert the new chunk into the skip list */
if(H5SL_insert(fm->sel_chunks, new_chunk_info, &new_chunk_info->index) < 0) {
H5D__free_chunk_info(new_chunk_info, NULL, NULL);
@@ -1672,7 +1864,7 @@ H5D__create_chunk_file_map_hyper(H5D_chunk_map_t *fm, const H5D_io_info_t
} /* end if */
/* Get number of elements selected in chunk */
- if((schunk_points = H5S_GET_SELECT_NPOINTS(tmp_fchunk)) < 0)
+ if((schunk_points = H5S_GET_SELECT_NPOINTS(new_chunk_info->fspace)) < 0)
HGOTO_ERROR(H5E_DATASPACE, H5E_CANTGET, FAIL, "can't get file selection # of elements")
H5_CHECKED_ASSIGN(new_chunk_info->chunk_points, uint32_t, schunk_points, hssize_t);
@@ -1688,12 +1880,11 @@ H5D__create_chunk_file_map_hyper(H5D_chunk_map_t *fm, const H5D_io_info_t
chunk_index++;
/* Set current increment dimension */
- curr_dim=(int)fm->f_ndims-1;
+ curr_dim = (int)fm->f_ndims - 1;
/* Increment chunk location in fastest changing dimension */
- H5_CHECK_OVERFLOW(fm->chunk_dim[curr_dim],hsize_t,hssize_t);
- coords[curr_dim]+=fm->chunk_dim[curr_dim];
- end[curr_dim]+=fm->chunk_dim[curr_dim];
+ coords[curr_dim] += fm->chunk_dim[curr_dim];
+ end[curr_dim] += fm->chunk_dim[curr_dim];
scaled[curr_dim]++;
/* Bring chunk location back into bounds, if necessary */
@@ -1707,11 +1898,14 @@ H5D__create_chunk_file_map_hyper(H5D_chunk_map_t *fm, const H5D_io_info_t
/* Decrement current dimension */
curr_dim--;
- /* Increment chunk location in current dimension */
- scaled[curr_dim]++;
- coords[curr_dim] += fm->chunk_dim[curr_dim];
- end[curr_dim] = (coords[curr_dim] + fm->chunk_dim[curr_dim]) - 1;
- } while(coords[curr_dim] > sel_end[curr_dim]);
+ /* Check for valid current dim */
+ if(curr_dim >= 0) {
+ /* Increment chunk location in current dimension */
+ scaled[curr_dim]++;
+ coords[curr_dim] += fm->chunk_dim[curr_dim];
+ end[curr_dim] = (coords[curr_dim] + fm->chunk_dim[curr_dim]) - 1;
+ } /* end if */
+ } while(curr_dim >= 0 && (coords[curr_dim] > sel_end[curr_dim]));
/* Re-calculate the index of this chunk */
chunk_index = H5VM_array_offset_pre(fm->f_ndims, fm->layout->u.chunk.down_chunks, scaled);
@@ -1719,6 +1913,11 @@ H5D__create_chunk_file_map_hyper(H5D_chunk_map_t *fm, const H5D_io_info_t
} /* end while */
done:
+ /* Clean up on failure */
+ if(ret_value < 0)
+ if(tmp_fchunk && H5S_close(tmp_fchunk) < 0)
+ HDONE_ERROR(H5E_DATASET, H5E_CANTRELEASE, FAIL, "can't release temporary dataspace")
+
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5D__create_chunk_file_map_hyper() */
@@ -1742,13 +1941,13 @@ done:
static herr_t
H5D__create_chunk_mem_map_hyper(const H5D_chunk_map_t *fm)
{
+ H5D_chunk_info_t *chunk_info; /* Pointer to chunk information */
H5SL_node_t *curr_node; /* Current node in skip list */
- hsize_t file_sel_start[H5O_LAYOUT_NDIMS]; /* Offset of low bound of file selection */
- hsize_t file_sel_end[H5O_LAYOUT_NDIMS]; /* Offset of high bound of file selection */
- hsize_t mem_sel_start[H5O_LAYOUT_NDIMS]; /* Offset of low bound of file selection */
- hsize_t mem_sel_end[H5O_LAYOUT_NDIMS]; /* Offset of high bound of file selection */
- hssize_t adjust[H5O_LAYOUT_NDIMS]; /* Adjustment to make to all file chunks */
- hssize_t chunk_adjust[H5O_LAYOUT_NDIMS]; /* Adjustment to make to a particular chunk */
+ hsize_t file_sel_start[H5S_MAX_RANK]; /* Offset of low bound of file selection */
+ hsize_t file_sel_end[H5S_MAX_RANK]; /* Offset of high bound of file selection */
+ hsize_t mem_sel_start[H5S_MAX_RANK]; /* Offset of low bound of file selection */
+ hsize_t mem_sel_end[H5S_MAX_RANK]; /* Offset of high bound of file selection */
+ hssize_t adjust[H5S_MAX_RANK]; /* Adjustment to make to all file chunks */
unsigned u; /* Local index variable */
herr_t ret_value = SUCCEED; /* Return value */
@@ -1759,10 +1958,8 @@ H5D__create_chunk_mem_map_hyper(const H5D_chunk_map_t *fm)
/* Check for all I/O going to a single chunk */
if(H5SL_count(fm->sel_chunks)==1) {
- H5D_chunk_info_t *chunk_info; /* Pointer to chunk information */
-
/* Get the node */
- curr_node=H5SL_first(fm->sel_chunks);
+ curr_node = H5SL_first(fm->sel_chunks);
/* Get pointer to chunk's information */
chunk_info = (H5D_chunk_info_t *)H5SL_item(curr_node);
@@ -1785,54 +1982,74 @@ H5D__create_chunk_mem_map_hyper(const H5D_chunk_map_t *fm)
HGOTO_ERROR(H5E_DATASPACE, H5E_CANTGET, FAIL, "can't get file selection bound info")
/* Calculate the adjustment for memory selection from file selection */
- HDassert(fm->m_ndims==fm->f_ndims);
- for(u=0; u<fm->f_ndims; u++) {
- H5_CHECK_OVERFLOW(file_sel_start[u],hsize_t,hssize_t);
- H5_CHECK_OVERFLOW(mem_sel_start[u],hsize_t,hssize_t);
- adjust[u]=(hssize_t)file_sel_start[u]-(hssize_t)mem_sel_start[u];
+ HDassert(fm->m_ndims == fm->f_ndims);
+ for(u = 0; u < fm->f_ndims; u++) {
+ H5_CHECK_OVERFLOW(file_sel_start[u], hsize_t, hssize_t);
+ H5_CHECK_OVERFLOW(mem_sel_start[u], hsize_t, hssize_t);
+ adjust[u] = (hssize_t)file_sel_start[u] - (hssize_t)mem_sel_start[u];
} /* end for */
/* Iterate over each chunk in the chunk list */
- curr_node=H5SL_first(fm->sel_chunks);
+ curr_node = H5SL_first(fm->sel_chunks);
while(curr_node) {
- H5D_chunk_info_t *chunk_info; /* Pointer to chunk information */
+ hsize_t coords[H5S_MAX_RANK]; /* Current coordinates of chunk */
+ hssize_t chunk_adjust[H5S_MAX_RANK]; /* Adjustment to make to a particular chunk */
+ H5S_sel_type chunk_sel_type; /* Chunk's selection type */
/* Get pointer to chunk's information */
chunk_info = (H5D_chunk_info_t *)H5SL_item(curr_node);
HDassert(chunk_info);
+ /* Compute the chunk coordinates from the scaled coordinates */
+ for(u = 0; u < fm->f_ndims; u++)
+ coords[u] = chunk_info->scaled[u] * fm->layout->u.chunk.dim[u];
+
/* Copy the information */
/* Copy the memory dataspace */
if((chunk_info->mspace = H5S_copy(fm->mem_space, TRUE, FALSE)) == NULL)
HGOTO_ERROR(H5E_DATASPACE, H5E_CANTCOPY, FAIL, "unable to copy memory space")
- /* Release the current selection */
- if(H5S_SELECT_RELEASE(chunk_info->mspace) < 0)
- HGOTO_ERROR(H5E_DATASPACE, H5E_CANTRELEASE, FAIL, "unable to release selection")
+ /* Get the chunk's selection type */
+ if((chunk_sel_type = H5S_GET_SELECT_TYPE(chunk_info->fspace)) < H5S_SEL_NONE)
+ HGOTO_ERROR(H5E_DATASET, H5E_BADSELECT, FAIL, "unable to get type of selection")
+
+ /* Set memory selection for "all" chunk selections */
+ if(H5S_SEL_ALL == chunk_sel_type) {
+ /* Adjust the chunk coordinates */
+ for(u = 0; u < fm->f_ndims; u++)
+ coords[u] -= adjust[u];
- /* Copy the file chunk's selection */
- if(H5S_select_copy(chunk_info->mspace,chunk_info->fspace,FALSE) < 0)
- HGOTO_ERROR(H5E_DATASPACE, H5E_CANTCOPY, FAIL, "unable to copy selection")
+ /* Set to same shape as chunk */
+ if(H5S_select_hyperslab(chunk_info->mspace, H5S_SELECT_SET, coords, NULL, fm->chunk_dim, NULL) < 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTSELECT, FAIL, "can't create chunk memory selection")
+ } /* end if */
+ else {
+ /* Sanity check */
+ HDassert(H5S_SEL_HYPERSLABS == chunk_sel_type);
- /* Compute the adjustment for this chunk */
- for(u = 0; u < fm->f_ndims; u++) {
- hsize_t coords[H5O_LAYOUT_NDIMS]; /* Current coordinates of chunk */
+ /* Release the current selection */
+ if(H5S_SELECT_RELEASE(chunk_info->mspace) < 0)
+ HGOTO_ERROR(H5E_DATASPACE, H5E_CANTRELEASE, FAIL, "unable to release selection")
- /* Compute the chunk coordinates from the scaled coordinates */
- coords[u] = chunk_info->scaled[u] * fm->layout->u.chunk.dim[u];
+ /* Copy the file chunk's selection */
+ if(H5S_select_copy(chunk_info->mspace, chunk_info->fspace, FALSE) < 0)
+ HGOTO_ERROR(H5E_DATASPACE, H5E_CANTCOPY, FAIL, "unable to copy selection")
- /* Compensate for the chunk offset */
- H5_CHECK_OVERFLOW(coords[u], hsize_t, hssize_t);
- chunk_adjust[u] = adjust[u] - (hssize_t)coords[u]; /*lint !e771 The adjust array will always be initialized */
- } /* end for */
+ /* Compute the adjustment for this chunk */
+ for(u = 0; u < fm->f_ndims; u++) {
+ /* Compensate for the chunk offset */
+ H5_CHECK_OVERFLOW(coords[u], hsize_t, hssize_t);
+ chunk_adjust[u] = adjust[u] - (hssize_t)coords[u]; /*lint !e771 The adjust array will always be initialized */
+ } /* end for */
- /* Adjust the selection */
- if(H5S_hyper_adjust_s(chunk_info->mspace, chunk_adjust) < 0)
- HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, FAIL, "unable to adjust selection")
+ /* Adjust the selection */
+ if(H5S_hyper_adjust_s(chunk_info->mspace, chunk_adjust) < 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, FAIL, "unable to adjust selection")
+ } /* end else */
/* Get the next chunk node in the skip list */
- curr_node=H5SL_next(curr_node);
+ curr_node = H5SL_next(curr_node);
} /* end while */
} /* end else */
@@ -1920,9 +2137,9 @@ H5D__chunk_file_cb(void H5_ATTR_UNUSED *elem, const H5T_t H5_ATTR_UNUSED *type,
chunk_info->chunk_points = 0;
/* Set the chunk's scaled coordinates */
- HDmemcpy(chunk_info->scaled, scaled, sizeof(hsize_t) * fm->f_ndims);
+ H5MM_memcpy(chunk_info->scaled, scaled, sizeof(hsize_t) * fm->f_ndims);
chunk_info->scaled[fm->f_ndims] = 0;
- HDmemcpy(chunk_info->scaled, scaled, sizeof(hsize_t) * fm->f_ndims);
+ H5MM_memcpy(chunk_info->scaled, scaled, sizeof(hsize_t) * fm->f_ndims);
/* Insert the new chunk into the skip list */
if(H5SL_insert(fm->sel_chunks,chunk_info,&chunk_info->index) < 0) {
@@ -1976,7 +2193,7 @@ H5D__chunk_mem_cb(void H5_ATTR_UNUSED *elem, const H5T_t H5_ATTR_UNUSED *type, u
{
H5D_chunk_map_t *fm = (H5D_chunk_map_t *)_fm; /* File<->memory chunk mapping info */
H5D_chunk_info_t *chunk_info; /* Chunk information for current chunk */
- hsize_t coords_in_mem[H5O_LAYOUT_NDIMS]; /* Coordinates of element in memory */
+ hsize_t coords_in_mem[H5S_MAX_RANK]; /* Coordinates of element in memory */
hsize_t chunk_index; /* Chunk index */
herr_t ret_value = SUCCEED; /* Return value */
@@ -2001,11 +2218,10 @@ H5D__chunk_mem_cb(void H5_ATTR_UNUSED *elem, const H5T_t H5_ATTR_UNUSED *type, u
HGOTO_ERROR(H5E_DATASPACE, H5E_NOTFOUND, H5_ITER_ERROR, "can't locate chunk in skip list")
/* Check if the chunk already has a memory space */
- if(NULL == chunk_info->mspace) {
+ if(NULL == chunk_info->mspace)
/* Copy the template memory chunk dataspace */
if(NULL == (chunk_info->mspace = H5S_copy(fm->mchunk_tmpl, FALSE, FALSE)))
HGOTO_ERROR(H5E_DATASPACE, H5E_CANTCOPY, H5_ITER_ERROR, "unable to copy file space")
- } /* end else */
/* Update the "last chunk seen" information */
fm->last_index = chunk_index;
@@ -2164,11 +2380,11 @@ H5D__chunk_read(H5D_io_info_t *io_info, const H5D_type_info_t *type_info,
HDassert(fm);
/* Set up "nonexistent" I/O info object */
- HDmemcpy(&nonexistent_io_info, io_info, sizeof(nonexistent_io_info));
+ H5MM_memcpy(&nonexistent_io_info, io_info, sizeof(nonexistent_io_info));
nonexistent_io_info.layout_ops = *H5D_LOPS_NONEXISTENT;
/* Set up contiguous I/O info object */
- HDmemcpy(&ctg_io_info, io_info, sizeof(ctg_io_info));
+ H5MM_memcpy(&ctg_io_info, io_info, sizeof(ctg_io_info));
ctg_io_info.store = &ctg_store;
ctg_io_info.layout_ops = *H5D_LOPS_CONTIG;
@@ -2176,7 +2392,7 @@ H5D__chunk_read(H5D_io_info_t *io_info, const H5D_type_info_t *type_info,
H5_CHECKED_ASSIGN(ctg_store.contig.dset_size, hsize_t, io_info->dset->shared->layout.u.chunk.size, uint32_t);
/* Set up compact I/O info object */
- HDmemcpy(&cpt_io_info, io_info, sizeof(cpt_io_info));
+ H5MM_memcpy(&cpt_io_info, io_info, sizeof(cpt_io_info));
cpt_io_info.store = &cpt_store;
cpt_io_info.layout_ops = *H5D_LOPS_COMPACT;
@@ -2314,7 +2530,7 @@ H5D__chunk_write(H5D_io_info_t *io_info, const H5D_type_info_t *type_info,
HDassert(fm);
/* Set up contiguous I/O info object */
- HDmemcpy(&ctg_io_info, io_info, sizeof(ctg_io_info));
+ H5MM_memcpy(&ctg_io_info, io_info, sizeof(ctg_io_info));
ctg_io_info.store = &ctg_store;
ctg_io_info.layout_ops = *H5D_LOPS_CONTIG;
@@ -2322,7 +2538,7 @@ H5D__chunk_write(H5D_io_info_t *io_info, const H5D_type_info_t *type_info,
H5_CHECKED_ASSIGN(ctg_store.contig.dset_size, hsize_t, io_info->dset->shared->layout.u.chunk.size, uint32_t);
/* Set up compact I/O info object */
- HDmemcpy(&cpt_io_info, io_info, sizeof(cpt_io_info));
+ H5MM_memcpy(&cpt_io_info, io_info, sizeof(cpt_io_info));
cpt_io_info.store = &cpt_store;
cpt_io_info.layout_ops = *H5D_LOPS_COMPACT;
@@ -2677,7 +2893,7 @@ H5D__chunk_cinfo_cache_update(H5D_chunk_cached_t *last, const H5D_chunk_ud_t *ud
HDassert(udata->common.scaled);
/* Stored the information to cache */
- HDmemcpy(last->scaled, udata->common.scaled, sizeof(hsize_t) * udata->common.layout->ndims);
+ H5MM_memcpy(last->scaled, udata->common.scaled, sizeof(hsize_t) * udata->common.layout->ndims);
last->addr = udata->chunk_block.offset;
H5_CHECKED_ASSIGN(last->nbytes, uint32_t, udata->chunk_block.length, hsize_t);
last->chunk_idx = udata->chunk_idx;
@@ -2914,9 +3130,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;
@@ -2925,25 +3138,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.
*
@@ -3056,7 +3262,7 @@ H5D__chunk_flush_entry(const H5D_t *dset, H5D_rdcc_ent_t *ent, hbool_t reset)
*/
if(NULL == (buf = H5MM_malloc(alloc)))
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed for pipeline")
- HDmemcpy(buf, ent->chunk, alloc);
+ H5MM_memcpy(buf, ent->chunk, alloc);
} /* end if */
else {
/*
@@ -3469,7 +3675,7 @@ H5D__chunk_lock(const H5D_io_info_t *io_info, H5D_chunk_ud_t *udata,
*/
if(NULL == (chunk = H5D__chunk_mem_alloc(chunk_size, pline)))
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed for raw data chunk")
- HDmemcpy(chunk, ent->chunk, chunk_size);
+ H5MM_memcpy(chunk, ent->chunk, chunk_size);
ent->chunk = (uint8_t *)H5D__chunk_mem_xfree(ent->chunk, old_pline);
ent->chunk = (uint8_t *)chunk;
chunk = NULL;
@@ -3495,7 +3701,7 @@ H5D__chunk_lock(const H5D_io_info_t *io_info, H5D_chunk_ud_t *udata,
*/
if(NULL == (chunk = H5D__chunk_mem_alloc(chunk_size, pline)))
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed for raw data chunk")
- HDmemcpy(chunk, ent->chunk, chunk_size);
+ H5MM_memcpy(chunk, ent->chunk, chunk_size);
ent->chunk = (uint8_t *)H5D__chunk_mem_xfree(ent->chunk, old_pline);
ent->chunk = (uint8_t *)chunk;
@@ -3624,7 +3830,7 @@ H5D__chunk_lock(const H5D_io_info_t *io_info, H5D_chunk_ud_t *udata,
(void)H5D__chunk_mem_xfree(tmp_chunk, old_pline);
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed for raw data chunk")
} /* end if */
- HDmemcpy(chunk, tmp_chunk, chunk_size);
+ H5MM_memcpy(chunk, tmp_chunk, chunk_size);
(void)H5D__chunk_mem_xfree(tmp_chunk, old_pline);
} /* end if */
} /* end if */
@@ -3705,7 +3911,7 @@ H5D__chunk_lock(const H5D_io_info_t *io_info, H5D_chunk_ud_t *udata,
ent->chunk_block.offset = chunk_addr;
ent->chunk_block.length = chunk_alloc;
ent->chunk_idx = udata->chunk_idx;
- HDmemcpy(ent->scaled, udata->common.scaled, sizeof(hsize_t) * layout->u.chunk.ndims);
+ H5MM_memcpy(ent->scaled, udata->common.scaled, sizeof(hsize_t) * layout->u.chunk.ndims);
H5_CHECKED_ASSIGN(ent->rd_count, uint32_t, chunk_size, size_t);
H5_CHECKED_ASSIGN(ent->wr_count, uint32_t, chunk_size, size_t);
ent->chunk = (uint8_t *)chunk;
@@ -3833,7 +4039,7 @@ H5D__chunk_unlock(const H5D_io_info_t *io_info, const H5D_chunk_ud_t *udata,
fake_ent.edge_chunk_state = H5D_RDCC_DISABLE_FILTERS;
if(udata->new_unfilt_chunk)
fake_ent.edge_chunk_state |= H5D_RDCC_NEWLY_DISABLED_FILTERS;
- HDmemcpy(fake_ent.scaled, udata->common.scaled, sizeof(hsize_t) * layout->u.chunk.ndims);
+ H5MM_memcpy(fake_ent.scaled, udata->common.scaled, sizeof(hsize_t) * layout->u.chunk.ndims);
HDassert(layout->u.chunk.size > 0);
fake_ent.chunk_idx = udata->chunk_idx;
fake_ent.chunk_block.offset = udata->chunk_block.offset;
@@ -4120,7 +4326,7 @@ H5D__chunk_allocate(const H5D_io_info_t *io_info, hbool_t full_overwrite, hsize_
if(has_unfilt_edge_chunks) {
if(NULL == (unfilt_fill_buf = H5D__chunk_mem_alloc(orig_chunk_size, &def_pline)))
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed for raw data chunk")
- HDmemcpy(unfilt_fill_buf, fb_info.fill_buf, orig_chunk_size);
+ H5MM_memcpy(unfilt_fill_buf, fb_info.fill_buf, orig_chunk_size);
} /* end if */
/* Retrieve filter settings from API context */
@@ -4838,12 +5044,12 @@ H5D__chunk_prune_fill(H5D_chunk_it_ud1_t *udata, hbool_t new_unfilt_chunk)
HGOTO_ERROR(H5E_DATASET, H5E_CANTALLOC, FAIL, "can't allocate chunk selection iterator")
/* Create a selection iterator for scattering the elements to memory buffer */
- if(H5S_select_iter_init(chunk_iter, udata->chunk_space, layout->u.chunk.dim[rank]) < 0)
+ if(H5S_select_iter_init(chunk_iter, udata->chunk_space, layout->u.chunk.dim[rank], 0) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to initialize chunk selection information")
chunk_iter_init = TRUE;
/* Scatter the data into memory */
- if(H5D__scatter_mem(udata->fb_info.fill_buf, udata->chunk_space, chunk_iter, (size_t)sel_nelmts, chunk/*out*/) < 0)
+ if(H5D__scatter_mem(udata->fb_info.fill_buf, chunk_iter, (size_t)sel_nelmts, chunk/*out*/) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_WRITEERROR, FAIL, "scatter failed")
@@ -5654,7 +5860,7 @@ H5D__chunk_copy_cb(const H5D_chunk_rec_t *chunk_rec, void *_udata)
if(udata->chunk_in_cache && udata->chunk) {
HDassert(!H5F_addr_defined(chunk_rec->chunk_addr));
- HDmemcpy(buf, udata->chunk, nbytes);
+ H5MM_memcpy(buf, udata->chunk, nbytes);
udata->chunk = NULL;
}
else {
@@ -5688,7 +5894,7 @@ H5D__chunk_copy_cb(const H5D_chunk_rec_t *chunk_rec, void *_udata)
HDassert(H5F_addr_defined(ent->chunk_block.offset));
H5_CHECKED_ASSIGN(nbytes, size_t, shared_fo->layout.u.chunk.size, uint32_t);
- HDmemcpy(buf, ent->chunk, nbytes);
+ H5MM_memcpy(buf, ent->chunk, nbytes);
}
else {
/* read chunk data from the source file */
@@ -5722,7 +5928,7 @@ H5D__chunk_copy_cb(const H5D_chunk_rec_t *chunk_rec, void *_udata)
HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, H5_ITER_ERROR, "datatype conversion failed")
/* Copy into another buffer, to reclaim memory later */
- HDmemcpy(reclaim_buf, buf, reclaim_buf_size);
+ H5MM_memcpy(reclaim_buf, buf, reclaim_buf_size);
/* Set background buffer to all zeros */
HDmemset(bkg, 0, buf_size);
@@ -5753,7 +5959,7 @@ H5D__chunk_copy_cb(const H5D_chunk_rec_t *chunk_rec, void *_udata)
} /* end if */
/* After fix ref, copy the new reference elements to the buffer to write out */
- HDmemcpy(buf, bkg, buf_size);
+ H5MM_memcpy(buf, bkg, buf_size);
} /* end if */
/* Set up destination chunk callback information for insertion */
@@ -6053,7 +6259,7 @@ H5D__chunk_copy(H5F_t *f_src, H5O_storage_chunk_t *storage_src,
for(ent = shared_fo->cache.chunk.head; ent; ent = next) {
if(!H5F_addr_defined(ent->chunk_block.offset)) {
- HDmemcpy(chunk_rec.scaled, ent->scaled, sizeof(chunk_rec.scaled));
+ H5MM_memcpy(chunk_rec.scaled, ent->scaled, sizeof(chunk_rec.scaled));
udata.chunk = ent->chunk;
udata.chunk_in_cache = TRUE;
if(H5D__chunk_copy_cb(&chunk_rec, &udata) < 0)
@@ -6303,15 +6509,16 @@ H5D__chunk_stats(const H5D_t *dset, hbool_t headers)
HGOTO_DONE(SUCCEED)
if (headers) {
- fprintf(H5DEBUG(AC), "H5D: raw data cache statistics\n");
- fprintf(H5DEBUG(AC), " %-18s %8s %8s %8s %8s+%-8s\n",
+ HDfprintf(H5DEBUG(AC), "H5D: raw data cache statistics\n");
+ HDfprintf(H5DEBUG(AC), " %-18s %8s %8s %8s %8s+%-8s\n",
"Layer", "Hits", "Misses", "MissRate", "Inits", "Flushes");
- fprintf(H5DEBUG(AC), " %-18s %8s %8s %8s %8s-%-8s\n",
+ HDfprintf(H5DEBUG(AC), " %-18s %8s %8s %8s %8s-%-8s\n",
"-----", "----", "------", "--------", "-----", "-------");
}
#ifdef H5AC_DEBUG
- if (H5DEBUG(AC)) headers = TRUE;
+ if (H5DEBUG(AC))
+ headers = TRUE;
#endif
if (headers) {
@@ -6322,12 +6529,12 @@ H5D__chunk_stats(const H5D_t *dset, hbool_t headers)
miss_rate = 0.0;
}
if (miss_rate > 100) {
- sprintf(ascii, "%7d%%", (int) (miss_rate + 0.5));
+ HDsprintf(ascii, "%7d%%", (int) (miss_rate + 0.5));
} else {
- sprintf(ascii, "%7.2f%%", miss_rate);
+ HDsprintf(ascii, "%7.2f%%", miss_rate);
}
- fprintf(H5DEBUG(AC), " %-18s %8u %8u %7s %8d+%-9ld\n",
+ HDfprintf(H5DEBUG(AC), " %-18s %8u %8u %7s %8d+%-9ld\n",
"raw data chunks", rdcc->stats.nhits, rdcc->stats.nmisses, ascii,
rdcc->stats.ninits, (long)(rdcc->stats.nflushes)-(long)(rdcc->stats.ninits));
}
diff --git a/src/H5Dcompact.c b/src/H5Dcompact.c
index c0c2a80..29401f8 100644
--- a/src/H5Dcompact.c
+++ b/src/H5Dcompact.c
@@ -80,6 +80,7 @@ const H5D_layout_ops_t H5D_LOPS_COMPACT[1] = {{
H5D__compact_construct,
NULL,
H5D__compact_is_space_alloc,
+ NULL,
H5D__compact_io_init,
H5D__contig_read,
H5D__contig_write,
@@ -528,7 +529,7 @@ H5D__compact_copy(H5F_t *f_src, H5O_storage_compact_t *_storage_src, H5F_t *f_ds
if(NULL == (buf = H5FL_BLK_MALLOC(type_conv, buf_size)))
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed")
- HDmemcpy(buf, storage_src->buf, storage_src->size);
+ H5MM_memcpy(buf, storage_src->buf, storage_src->size);
/* allocate temporary bkg buff for data conversion */
if(NULL == (bkg = H5FL_BLK_MALLOC(type_conv, buf_size)))
@@ -539,7 +540,7 @@ H5D__compact_copy(H5F_t *f_src, H5O_storage_compact_t *_storage_src, H5F_t *f_ds
HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "datatype conversion failed")
/* Copy into another buffer, to reclaim memory later */
- HDmemcpy(reclaim_buf, buf, buf_size);
+ H5MM_memcpy(reclaim_buf, buf, buf_size);
/* Set background buffer to all zeros */
HDmemset(bkg, 0, buf_size);
@@ -548,7 +549,7 @@ H5D__compact_copy(H5F_t *f_src, H5O_storage_compact_t *_storage_src, H5F_t *f_ds
if(H5T_convert(tpath_mem_dst, tid_mem, tid_dst, nelmts, (size_t)0, (size_t)0, buf, bkg) < 0)
HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "datatype conversion failed")
- HDmemcpy(storage_dst->buf, buf, storage_dst->size);
+ H5MM_memcpy(storage_dst->buf, buf, storage_dst->size);
if(H5D_vlen_reclaim(tid_mem, buf_space, reclaim_buf) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_BADITER, FAIL, "unable to reclaim variable-length data")
@@ -558,9 +559,14 @@ H5D__compact_copy(H5F_t *f_src, H5O_storage_compact_t *_storage_src, H5F_t *f_ds
/* Check for expanding references */
if(cpy_info->expand_ref) {
size_t ref_count;
+ size_t src_dt_size; /* Source datatype size */
+
+ /* Determine largest datatype size */
+ if(0 == (src_dt_size = H5T_get_size(dt_src)))
+ HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "unable to determine datatype size")
/* Determine # of reference elements to copy */
- ref_count = storage_src->size / H5T_get_size(dt_src);
+ ref_count = storage_src->size / src_dt_size;
/* Copy objects referenced in source buffer to destination file and set destination elements */
if(H5O_copy_expand_ref(f_src, storage_src->buf, f_dst,
@@ -573,11 +579,11 @@ H5D__compact_copy(H5F_t *f_src, H5O_storage_compact_t *_storage_src, H5F_t *f_ds
} /* end if */
else
/* Type conversion not necessary */
- HDmemcpy(storage_dst->buf, storage_src->buf, storage_src->size);
+ H5MM_memcpy(storage_dst->buf, storage_src->buf, storage_src->size);
} /* end if */
else
/* Type conversion not necessary */
- HDmemcpy(storage_dst->buf, storage_src->buf, storage_src->size);
+ H5MM_memcpy(storage_dst->buf, storage_src->buf, storage_src->size);
/* Mark destination buffer as dirty */
storage_dst->dirty = TRUE;
diff --git a/src/H5Dcontig.c b/src/H5Dcontig.c
index ad12ba0..8733633 100644
--- a/src/H5Dcontig.c
+++ b/src/H5Dcontig.c
@@ -40,6 +40,7 @@
#include "H5FLprivate.h" /* Free Lists */
#include "H5Iprivate.h" /* IDs */
#include "H5MFprivate.h" /* File memory management */
+#include "H5MMprivate.h" /* Memory management */
#include "H5FOprivate.h" /* File objects */
#include "H5Oprivate.h" /* Object headers */
#include "H5Pprivate.h" /* Property lists */
@@ -118,6 +119,7 @@ const H5D_layout_ops_t H5D_LOPS_CONTIG[1] = {{
H5D__contig_construct,
H5D__contig_init,
H5D__contig_is_space_alloc,
+ H5D__contig_is_data_cached,
H5D__contig_io_init,
H5D__contig_read,
H5D__contig_write,
@@ -538,6 +540,30 @@ H5D__contig_is_space_alloc(const H5O_storage_t *storage)
/*-------------------------------------------------------------------------
+ * Function: H5D__contig_is_data_cached
+ *
+ * Purpose: Query if raw data is cached for dataset
+ *
+ * Return: Non-negative on success/Negative on failure
+ *
+ * Programmer: Neil Fortner
+ * Wednessday, March 6, 2016
+ *
+ *-------------------------------------------------------------------------
+ */
+hbool_t
+H5D__contig_is_data_cached(const H5D_shared_t *shared_dset)
+{
+ FUNC_ENTER_PACKAGE_NOERR
+
+ /* Sanity checks */
+ HDassert(shared_dset);
+
+ FUNC_LEAVE_NOAPI(shared_dset->cache.contig.sieve_size > 0)
+} /* end H5D__contig_is_data_cached() */
+
+
+/*-------------------------------------------------------------------------
* Function: H5D__contig_io_init
*
* Purpose: Performs initialization before any sort of I/O on the raw data
@@ -751,15 +777,10 @@ H5D__contig_readvv_sieve_cb(hsize_t dst_off, hsize_t src_off, size_t len,
HGOTO_ERROR(H5E_DATASET, H5E_READERROR, FAIL, "block read failed")
/* Grab the data out of the buffer (must be first piece of data in buffer ) */
- HDmemcpy(buf, dset_contig->sieve_buf, len);
+ H5MM_memcpy(buf, dset_contig->sieve_buf, len);
/* Reset sieve buffer dirty flag */
dset_contig->sieve_dirty = FALSE;
-
- /* Stash local copies of these value */
- sieve_start = dset_contig->sieve_loc;
- sieve_size = dset_contig->sieve_size;
- sieve_end = sieve_start+sieve_size;
} /* end else */
} /* end if */
else {
@@ -771,7 +792,7 @@ H5D__contig_readvv_sieve_cb(hsize_t dst_off, hsize_t src_off, size_t len,
unsigned char *base_sieve_buf = dset_contig->sieve_buf + (addr - sieve_start);
/* Grab the data out of the buffer */
- HDmemcpy(buf, base_sieve_buf, len);
+ H5MM_memcpy(buf, base_sieve_buf, len);
} /* end if */
/* Entire request is not within this data sieve buffer */
else {
@@ -825,17 +846,12 @@ H5D__contig_readvv_sieve_cb(hsize_t dst_off, hsize_t src_off, size_t len,
min = MIN3(rel_eoa - dset_contig->sieve_loc, max_data, dset_contig->sieve_buf_size);
H5_CHECKED_ASSIGN(dset_contig->sieve_size, size_t, min, hsize_t);
- /* Update local copies of sieve information */
- sieve_start = dset_contig->sieve_loc;
- sieve_size = dset_contig->sieve_size;
- sieve_end = sieve_start + sieve_size;
-
/* Read the new sieve buffer */
if(H5F_block_read(file, H5FD_MEM_DRAW, dset_contig->sieve_loc, dset_contig->sieve_size, dset_contig->sieve_buf) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_READERROR, FAIL, "block read failed")
/* Grab the data out of the buffer (must be first piece of data in buffer ) */
- HDmemcpy(buf, dset_contig->sieve_buf, len);
+ H5MM_memcpy(buf, dset_contig->sieve_buf, len);
/* Reset sieve buffer dirty flag */
dset_contig->sieve_dirty = FALSE;
@@ -1033,7 +1049,7 @@ H5D__contig_writevv_sieve_cb(hsize_t dst_off, hsize_t src_off, size_t len,
} /* end if */
/* Grab the data out of the buffer (must be first piece of data in buffer ) */
- HDmemcpy(dset_contig->sieve_buf, buf, len);
+ H5MM_memcpy(dset_contig->sieve_buf, buf, len);
/* Set sieve buffer dirty flag */
dset_contig->sieve_dirty = TRUE;
@@ -1053,7 +1069,7 @@ H5D__contig_writevv_sieve_cb(hsize_t dst_off, hsize_t src_off, size_t len,
unsigned char *base_sieve_buf = dset_contig->sieve_buf + (addr - sieve_start);
/* Put the data into the sieve buffer */
- HDmemcpy(base_sieve_buf, buf, len);
+ H5MM_memcpy(base_sieve_buf, buf, len);
/* Set sieve buffer dirty flag */
dset_contig->sieve_dirty = TRUE;
@@ -1096,7 +1112,7 @@ H5D__contig_writevv_sieve_cb(hsize_t dst_off, hsize_t src_off, size_t len,
HDmemmove(dset_contig->sieve_buf + len, dset_contig->sieve_buf, dset_contig->sieve_size);
/* Copy in new information (must be first in sieve buffer) */
- HDmemcpy(dset_contig->sieve_buf, buf, len);
+ H5MM_memcpy(dset_contig->sieve_buf, buf, len);
/* Adjust sieve location */
dset_contig->sieve_loc = addr;
@@ -1105,16 +1121,11 @@ H5D__contig_writevv_sieve_cb(hsize_t dst_off, hsize_t src_off, size_t len,
/* Append to existing sieve buffer */
else {
/* Copy in new information */
- HDmemcpy(dset_contig->sieve_buf + sieve_size, buf, len);
+ H5MM_memcpy(dset_contig->sieve_buf + sieve_size, buf, len);
} /* end else */
/* Adjust sieve size */
dset_contig->sieve_size += len;
-
- /* Update local copies of sieve information */
- sieve_start = dset_contig->sieve_loc;
- sieve_size = dset_contig->sieve_size;
- sieve_end = sieve_start + sieve_size;
} /* end if */
/* Can't add the new data onto the existing sieve buffer */
else {
@@ -1146,11 +1157,6 @@ H5D__contig_writevv_sieve_cb(hsize_t dst_off, hsize_t src_off, size_t len,
min = MIN3(rel_eoa - dset_contig->sieve_loc, max_data, dset_contig->sieve_buf_size);
H5_CHECKED_ASSIGN(dset_contig->sieve_size, size_t, min, hsize_t);
- /* Update local copies of sieve information */
- sieve_start = dset_contig->sieve_loc;
- sieve_size = dset_contig->sieve_size;
- sieve_end = sieve_start + sieve_size;
-
/* Check if there is any point in reading the data from the file */
if(dset_contig->sieve_size > len) {
/* Read the new sieve buffer */
@@ -1159,7 +1165,7 @@ H5D__contig_writevv_sieve_cb(hsize_t dst_off, hsize_t src_off, size_t len,
} /* end if */
/* Grab the data out of the buffer (must be first piece of data in buffer ) */
- HDmemcpy(dset_contig->sieve_buf, buf, len);
+ H5MM_memcpy(dset_contig->sieve_buf, buf, len);
/* Set sieve buffer dirty flag */
dset_contig->sieve_dirty = TRUE;
@@ -1514,7 +1520,7 @@ H5D__contig_copy(H5F_t *f_src, const H5O_storage_contig_t *storage_src,
if(try_sieve && (addr_src >= sieve_start) && ((addr_src + src_nbytes -1) < sieve_end)) {
unsigned char *base_sieve_buf = shared_fo->cache.contig.sieve_buf + (addr_src - sieve_start);
- HDmemcpy(buf, base_sieve_buf, src_nbytes);
+ H5MM_memcpy(buf, base_sieve_buf, src_nbytes);
} else
/* Read raw data from source file */
if(H5F_block_read(f_src, H5FD_MEM_DRAW, addr_src, src_nbytes, buf) < 0)
@@ -1527,7 +1533,7 @@ H5D__contig_copy(H5F_t *f_src, const H5O_storage_contig_t *storage_src,
HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "datatype conversion failed")
/* Copy into another buffer, to reclaim memory later */
- HDmemcpy(reclaim_buf, buf, mem_nbytes);
+ H5MM_memcpy(reclaim_buf, buf, mem_nbytes);
/* Set background buffer to all zeros */
HDmemset(bkg, 0, buf_size);
@@ -1553,7 +1559,7 @@ H5D__contig_copy(H5F_t *f_src, const H5O_storage_contig_t *storage_src,
HGOTO_ERROR(H5E_DATASET, H5E_CANTCOPY, FAIL, "unable to copy reference attribute")
/* After fix ref, copy the new reference elements to the buffer to write out */
- HDmemcpy(buf, bkg, buf_size);
+ H5MM_memcpy(buf, bkg, buf_size);
} /* end if */
else
/* Reset value to zero */
diff --git a/src/H5Ddeprec.c b/src/H5Ddeprec.c
index 76827b4..6380bee 100644
--- a/src/H5Ddeprec.c
+++ b/src/H5Ddeprec.c
@@ -116,7 +116,6 @@ H5Dcreate1(hid_t loc_id, const char *name, hid_t type_id, hid_t space_id,
void *dset = NULL; /* dset token from VOL connector */
H5VL_object_t *vol_obj = NULL; /* object token of loc_id */
H5VL_loc_params_t loc_params;
- H5P_genplist_t *plist; /* Property list pointer */
hid_t lcpl_id = H5P_LINK_CREATE_DEFAULT;
hid_t dapl_id = H5P_DEFAULT; /* DAPL used by library */
hid_t ret_value = H5I_INVALID_HID; /* Return value */
@@ -136,22 +135,13 @@ H5Dcreate1(hid_t loc_id, const char *name, hid_t type_id, hid_t space_id,
if(TRUE != H5P_isa_class(dcpl_id, H5P_DATASET_CREATE))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not dataset create property list ID")
+ /* Set the DCPL for the API context */
+ H5CX_set_dcpl(dcpl_id);
+
/* Verify access property list and set up collective metadata if appropriate */
if(H5CX_set_apl(&dapl_id, H5P_CLS_DACC, loc_id, TRUE) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, H5I_INVALID_HID, "can't set access property list info")
- /* Get the plist structure */
- if(NULL == (plist = (H5P_genplist_t *)H5I_object(dcpl_id)))
- HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, H5I_INVALID_HID, "can't find object for ID")
-
- /* set creation properties */
- if(H5P_set(plist, H5VL_PROP_DSET_TYPE_ID, &type_id) < 0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, H5I_INVALID_HID, "can't set property value for datatype id")
- if(H5P_set(plist, H5VL_PROP_DSET_SPACE_ID, &space_id) < 0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, H5I_INVALID_HID, "can't set property value for space id")
- if(H5P_set(plist, H5VL_PROP_DSET_LCPL_ID, &lcpl_id) < 0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, H5I_INVALID_HID, "can't set property value for lcpl id")
-
/* Set location parameters */
loc_params.type = H5VL_OBJECT_BY_SELF;
loc_params.obj_type = H5I_get_type(loc_id);
@@ -161,7 +151,7 @@ H5Dcreate1(hid_t loc_id, const char *name, hid_t type_id, hid_t space_id,
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "invalid location identifier")
/* Create the dataset through the VOL */
- if(NULL == (dset = H5VL_dataset_create(vol_obj, &loc_params, name, dcpl_id, H5P_DATASET_ACCESS_DEFAULT, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL)))
+ if(NULL == (dset = H5VL_dataset_create(vol_obj, &loc_params, name, lcpl_id, type_id, space_id, dcpl_id, H5P_DATASET_ACCESS_DEFAULT, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL)))
HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, H5I_INVALID_HID, "unable to create dataset")
/* Get an atom for the dataset */
diff --git a/src/H5Dearray.c b/src/H5Dearray.c
index a20145a..b23ac46 100644
--- a/src/H5Dearray.c
+++ b/src/H5Dearray.c
@@ -37,6 +37,7 @@
#include "H5EAprivate.h" /* Extensible arrays */
#include "H5FLprivate.h" /* Free Lists */
#include "H5MFprivate.h" /* File space management */
+#include "H5MMprivate.h" /* Memory management */
#include "H5VMprivate.h" /* Vector functions */
@@ -437,7 +438,7 @@ H5D__earray_debug(FILE *stream, int indent, int fwidth, hsize_t idx,
HDassert(elmt);
/* Print element */
- sprintf(temp_str, "Element #%llu:", (unsigned long long)idx);
+ HDsprintf(temp_str, "Element #%llu:", (unsigned long long)idx);
HDfprintf(stream, "%*s%-*s %a\n", indent, "", fwidth, temp_str,
*(const haddr_t *)elmt);
@@ -596,7 +597,7 @@ H5D__earray_filt_debug(FILE *stream, int indent, int fwidth, hsize_t idx,
HDassert(elmt);
/* Print element */
- sprintf(temp_str, "Element #%llu:", (unsigned long long)idx);
+ HDsprintf(temp_str, "Element #%llu:", (unsigned long long)idx);
HDfprintf(stream, "%*s%-*s {%a, %u, %0x}\n", indent, "", fwidth, temp_str,
elmt->addr, elmt->nbytes, elmt->filter_mask);
@@ -1197,11 +1198,11 @@ H5D__earray_idx_resize(H5O_layout_chunk_t *layout)
hsize_t swizzled_max_chunks[H5O_LAYOUT_NDIMS]; /* Swizzled form of max # of chunks in each dimension */
/* Get the swizzled chunk dimensions */
- HDmemcpy(layout->u.earray.swizzled_dim, layout->dim, (layout->ndims - 1) * sizeof(layout->dim[0]));
+ H5MM_memcpy(layout->u.earray.swizzled_dim, layout->dim, (layout->ndims - 1) * sizeof(layout->dim[0]));
H5VM_swizzle_coords(uint32_t, layout->u.earray.swizzled_dim, layout->u.earray.unlim_dim);
/* Get the swizzled number of chunks in each dimension */
- HDmemcpy(swizzled_chunks, layout->chunks, (layout->ndims - 1) * sizeof(swizzled_chunks[0]));
+ H5MM_memcpy(swizzled_chunks, layout->chunks, (layout->ndims - 1) * sizeof(swizzled_chunks[0]));
H5VM_swizzle_coords(hsize_t, swizzled_chunks, layout->u.earray.unlim_dim);
/* Get the swizzled "down" sizes for each dimension */
@@ -1209,7 +1210,7 @@ H5D__earray_idx_resize(H5O_layout_chunk_t *layout)
HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, FAIL, "can't compute swizzled 'down' chunk size value")
/* Get the swizzled max number of chunks in each dimension */
- HDmemcpy(swizzled_max_chunks, layout->max_chunks, (layout->ndims - 1) * sizeof(swizzled_max_chunks[0]));
+ H5MM_memcpy(swizzled_max_chunks, layout->max_chunks, (layout->ndims - 1) * sizeof(swizzled_max_chunks[0]));
H5VM_swizzle_coords(hsize_t, swizzled_max_chunks, layout->u.earray.unlim_dim);
/* Get the swizzled max "down" sizes for each dimension */
diff --git a/src/H5Defl.c b/src/H5Defl.c
index b2f9b29..91caa61 100644
--- a/src/H5Defl.c
+++ b/src/H5Defl.c
@@ -91,6 +91,7 @@ const H5D_layout_ops_t H5D_LOPS_EFL[1] = {{
H5D__efl_construct,
NULL,
H5D__efl_is_space_alloc,
+ NULL,
H5D__efl_io_init,
H5D__contig_read,
H5D__contig_write,
@@ -226,7 +227,7 @@ H5D__efl_io_init(const H5D_io_info_t *io_info, const H5D_type_info_t H5_ATTR_UNU
{
FUNC_ENTER_STATIC_NOERR
- HDmemcpy(&io_info->store->efl, &(io_info->dset->shared->dcpl_cache.efl), sizeof(H5O_efl_t));
+ H5MM_memcpy(&io_info->store->efl, &(io_info->dset->shared->dcpl_cache.efl), sizeof(H5O_efl_t));
FUNC_LEAVE_NOAPI(SUCCEED)
} /* end H5D__efl_io_init() */
@@ -476,7 +477,6 @@ H5D__efl_readvv(const H5D_io_info_t *io_info,
HDassert(io_info->u.rbuf);
HDassert(io_info->dset);
HDassert(io_info->dset->shared);
- HDassert(io_info->dset->shared->extfile_prefix);
HDassert(dset_curr_seq);
HDassert(dset_len_arr);
HDassert(dset_off_arr);
@@ -560,7 +560,6 @@ H5D__efl_writevv(const H5D_io_info_t *io_info,
HDassert(io_info->u.wbuf);
HDassert(io_info->dset);
HDassert(io_info->dset->shared);
- HDassert(io_info->dset->shared->extfile_prefix);
HDassert(dset_curr_seq);
HDassert(dset_len_arr);
HDassert(dset_off_arr);
diff --git a/src/H5Dfarray.c b/src/H5Dfarray.c
index 372ae26..2d85e3b 100644
--- a/src/H5Dfarray.c
+++ b/src/H5Dfarray.c
@@ -434,7 +434,7 @@ H5D__farray_debug(FILE *stream, int indent, int fwidth, hsize_t idx,
HDassert(elmt);
/* Print element */
- sprintf(temp_str, "Element #%llu:", (unsigned long long)idx);
+ HDsprintf(temp_str, "Element #%llu:", (unsigned long long)idx);
HDfprintf(stream, "%*s%-*s %a\n", indent, "", fwidth, temp_str,
*(const haddr_t *)elmt);
@@ -699,7 +699,7 @@ H5D__farray_filt_debug(FILE *stream, int indent, int fwidth, hsize_t idx,
HDassert(elmt);
/* Print element */
- sprintf(temp_str, "Element #%llu:", (unsigned long long)idx);
+ HDsprintf(temp_str, "Element #%llu:", (unsigned long long)idx);
HDfprintf(stream, "%*s%-*s {%a, %u, %0x}\n", indent, "", fwidth, temp_str,
elmt->addr, elmt->nbytes, elmt->filter_mask);
diff --git a/src/H5Dfill.c b/src/H5Dfill.c
index 619f699..3ccee90 100644
--- a/src/H5Dfill.c
+++ b/src/H5Dfill.c
@@ -38,6 +38,7 @@
#include "H5Eprivate.h" /* Error handling */
#include "H5FLprivate.h" /* Free Lists */
#include "H5Iprivate.h" /* IDs */
+#include "H5MMprivate.h" /* Memory management */
#include "H5VMprivate.h" /* Vector and array functions */
#include "H5WBprivate.h" /* Wrapped Buffers */
@@ -275,12 +276,12 @@ H5D__fill(const void *fill, const H5T_t *fill_type, void *buf,
HGOTO_ERROR(H5E_DATASET, H5E_CANTALLOC, FAIL, "can't allocate memory selection iterator")
/* Create a selection iterator for scattering the elements to memory buffer */
- if(H5S_select_iter_init(mem_iter, space, dst_type_size) < 0)
+ if(H5S_select_iter_init(mem_iter, space, dst_type_size, 0) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to initialize memory selection information")
mem_iter_init = TRUE;
/* Scatter the data into memory */
- if(H5D__scatter_mem(tmp_buf, space, mem_iter, (size_t)nelmts, buf/*out*/) < 0)
+ if(H5D__scatter_mem(tmp_buf, mem_iter, (size_t)nelmts, buf/*out*/) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_READERROR, FAIL, "scatter failed")
} /* end if */
else {
@@ -300,7 +301,7 @@ H5D__fill(const void *fill, const H5T_t *fill_type, void *buf,
HGOTO_ERROR(H5E_DATASET, H5E_NOSPACE, FAIL, "can't get actual buffer")
/* Copy the user's data into the buffer for conversion */
- HDmemcpy(elem_ptr, fill, src_type_size);
+ H5MM_memcpy(elem_ptr, fill, src_type_size);
/* If there's no VL type of data, do conversion first then fill the data into
* the memory buffer. */
@@ -577,7 +578,7 @@ H5D__fill_refill_vl(H5D_fill_buf_info_t *fb_info, size_t nelmts)
HDassert(fb_info->fill_buf);
/* Make a copy of the (disk-based) fill value into the buffer */
- HDmemcpy(fb_info->fill_buf, fb_info->fill->buf, fb_info->file_elmt_size);
+ H5MM_memcpy(fb_info->fill_buf, fb_info->fill->buf, fb_info->file_elmt_size);
/* Reset first element of background buffer, if necessary */
if(H5T_path_bkg(fb_info->fill_to_mem_tpath))
@@ -603,7 +604,7 @@ H5D__fill_refill_vl(H5D_fill_buf_info_t *fb_info, size_t nelmts)
if(!buf)
HGOTO_ERROR(H5E_DATASET, H5E_CANTALLOC, FAIL, "memory allocation failed for temporary fill buffer")
- HDmemcpy(buf, fb_info->fill_buf, fb_info->fill_buf_size);
+ H5MM_memcpy(buf, fb_info->fill_buf, fb_info->fill_buf_size);
/* Type convert the dataset buffer, to copy any VL components */
if(H5T_convert(fb_info->mem_to_dset_tpath, fb_info->mem_tid, fb_info->file_tid, nelmts, (size_t)0, (size_t)0, fb_info->fill_buf, fb_info->bkg_buf) < 0)
diff --git a/src/H5Dint.c b/src/H5Dint.c
index 7eb1aaf..cd120d0 100644
--- a/src/H5Dint.c
+++ b/src/H5Dint.c
@@ -54,7 +54,7 @@ static herr_t H5D__init_type(H5F_t *file, const H5D_t *dset, hid_t type_id, cons
static herr_t H5D__cache_dataspace_info(const H5D_t *dset);
static herr_t H5D__init_space(H5F_t *file, const H5D_t *dset, const H5S_t *space);
static herr_t H5D__update_oh_info(H5F_t *file, H5D_t *dset, hid_t dapl_id);
-static herr_t H5D__build_file_prefix(const H5D_t *dset, hid_t dapl_id, const char *prefix_type, char **file_prefix);
+static herr_t H5D__build_file_prefix(const H5D_t *dset, H5F_prefix_open_t prefix_type, char **file_prefix);
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[]);
@@ -112,6 +112,10 @@ static const H5I_class_t H5I_DATASET_CLS[1] = {{
/* Flag indicating "top" of interface has been initialized */
static hbool_t H5D_top_package_initialize_s = FALSE;
+/* Prefixes of VDS and external file from the environment variables
+ * HDF5_EXTFILE_PREFIX and HDF5_VDS_PREFIX */
+const static char *H5D_prefix_ext_env = NULL;
+const static char *H5D_prefix_vds_env = NULL;
/*-------------------------------------------------------------------------
@@ -188,6 +192,10 @@ H5D__init_package(void)
/* Mark "top" of interface as initialized, too */
H5D_top_package_initialize_s = TRUE;
+ /* Retrieve the prefixes of VDS and external file from the environment variable */
+ H5D_prefix_vds_env = HDgetenv("HDF5_VDS_PREFIX");
+ H5D_prefix_ext_env = HDgetenv("HDF5_EXTFILE_PREFIX");
+
done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5D__init_package() */
@@ -470,7 +478,7 @@ H5D__new(hid_t dcpl_id, hbool_t creating, hbool_t vl_type)
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed")
/* Copy the default dataset information */
- HDmemcpy(new_dset, &H5D_def_dset, sizeof(H5D_shared_t));
+ H5MM_memcpy(new_dset, &H5D_def_dset, sizeof(H5D_shared_t));
/* If we are using the default dataset creation property list, during creation
* don't bother to copy it, just increment the reference count
@@ -678,7 +686,6 @@ done:
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_NOAPI_NOINIT;
@@ -687,11 +694,9 @@ H5D__use_minimized_dset_headers(H5F_t *file, H5D_t *dset, hbool_t *minimize)
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")
+ /* Get the dataset object header minimize flag for this call */
+ if(H5CX_get_dset_min_ohdr_flag(minimize) < 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get dataset object header minimize flag from API context")
if(FALSE == *minimize)
*minimize = H5F_get_min_dset_ohdr(file);
@@ -774,7 +779,7 @@ H5D__calculate_minimum_header_size(H5F_t *file, H5D_t *dset, H5O_t *ohdr)
/* Shallow copy the fill value property */
/* guards against shared component modification */
- HDmemcpy(&old_fill_prop, fill_prop, sizeof(old_fill_prop));
+ H5MM_memcpy(&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")
@@ -1000,7 +1005,7 @@ H5D__update_oh_info(H5F_t *file, H5D_t *dset, hid_t dapl_id)
/* Shallow copy the fill value property */
/* (we only want to make certain that the shared component isn't modified) */
- HDmemcpy(&old_fill_prop, fill_prop, sizeof(old_fill_prop));
+ H5MM_memcpy(&old_fill_prop, fill_prop, sizeof(old_fill_prop));
/* Reset shared component info */
H5O_msg_reset_share(H5O_FILL_ID, &old_fill_prop);
@@ -1083,15 +1088,13 @@ done:
*--------------------------------------------------------------------------
*/
static herr_t
-H5D__build_file_prefix(const H5D_t *dset, hid_t dapl_id, const char *prefix_type,
- char **file_prefix /*out*/)
+H5D__build_file_prefix(const H5D_t *dset, H5F_prefix_open_t prefix_type, char **file_prefix /*out*/)
{
char *prefix = NULL; /* prefix used to look for the file */
char *filepath = NULL; /* absolute path of directory the HDF5 file is in */
size_t filepath_len; /* length of file path */
size_t prefix_len; /* length of prefix */
size_t file_prefix_len; /* length of expanded prefix */
- H5P_genplist_t *plist = NULL; /* Property list pointer */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_STATIC
@@ -1105,20 +1108,22 @@ H5D__build_file_prefix(const H5D_t *dset, hid_t dapl_id, const char *prefix_type
/* XXX: Future thread-safety note - getenv is not required
* to be reentrant.
*/
- if(HDstrcmp(prefix_type, H5D_ACS_VDS_PREFIX_NAME) == 0)
- prefix = HDgetenv("HDF5_VDS_PREFIX");
- else if(HDstrcmp(prefix_type, H5D_ACS_EFILE_PREFIX_NAME) == 0)
- prefix = HDgetenv("HDF5_EXTFILE_PREFIX");
- else
- HGOTO_ERROR(H5E_PLIST, H5E_BADTYPE, FAIL, "prefix name is not sensible")
-
- if(prefix == NULL || *prefix == '\0') {
- /* Set prefix to value of prefix_type property */
- if(NULL == (plist = H5P_object_verify(dapl_id, H5P_DATASET_ACCESS)))
- HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID")
- if(H5P_peek(plist, prefix_type, &prefix) < 0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get file prefix")
- } /* end if */
+ if(H5F_PREFIX_VDS == prefix_type) {
+ prefix = (char *)H5D_prefix_vds_env;
+
+ if(prefix == NULL || *prefix == '\0') {
+ if(H5CX_get_vds_prefix(&prefix) < 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get the prefix for vds file")
+ }
+ } else if(H5F_PREFIX_EFILE == prefix_type) {
+ prefix = (char *)H5D_prefix_ext_env;
+
+ if(prefix == NULL || *prefix == '\0') {
+ if(H5CX_get_ext_file_prefix(&prefix) < 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get the prefix for the external file")
+ }
+ } else
+ HGOTO_ERROR(H5E_DATASET, H5E_BADTYPE, FAIL, "prefix name is not sensible")
/* Prefix has to be checked for NULL / empty string again because the
* code above might have updated it.
@@ -1127,8 +1132,7 @@ H5D__build_file_prefix(const H5D_t *dset, hid_t dapl_id, const char *prefix_type
/* filename is interpreted as relative to the current directory,
* does not need to be expanded
*/
- if(NULL == (*file_prefix = (char *)H5MM_strdup("")))
- HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed")
+ *file_prefix = NULL;
} /* end if */
else {
if(HDstrncmp(prefix, "${ORIGIN}", HDstrlen("${ORIGIN}")) == 0) {
@@ -1326,11 +1330,11 @@ H5D__create(H5F_t *file, hid_t type_id, const H5S_t *space, hid_t dcpl_id,
HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, NULL, "unable to set up flush append property")
/* Set the external file prefix */
- if(H5D__build_file_prefix(new_dset, dapl_id, H5D_ACS_EFILE_PREFIX_NAME, &new_dset->shared->extfile_prefix) < 0)
+ if(H5D__build_file_prefix(new_dset, H5F_PREFIX_EFILE, &new_dset->shared->extfile_prefix) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, NULL, "unable to initialize external file prefix")
/* Set the VDS file prefix */
- if(H5D__build_file_prefix(new_dset, dapl_id, H5D_ACS_VDS_PREFIX_NAME, &new_dset->shared->vds_prefix) < 0)
+ if(H5D__build_file_prefix(new_dset, H5F_PREFIX_VDS, &new_dset->shared->vds_prefix) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, NULL, "unable to initialize VDS prefix")
/* Add the dataset to the list of opened objects in the file */
@@ -1485,11 +1489,11 @@ H5D_open(const H5G_loc_t *loc, hid_t dapl_id)
HGOTO_ERROR(H5E_DATASET, H5E_CANTCOPY, NULL, "can't copy path")
/* Get the external file prefix */
- if(H5D__build_file_prefix(dataset, dapl_id, H5D_ACS_EFILE_PREFIX_NAME, &extfile_prefix) < 0)
+ if(H5D__build_file_prefix(dataset, H5F_PREFIX_EFILE, &extfile_prefix) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, NULL, "unable to initialize external file prefix")
/* Get the VDS prefix */
- if(H5D__build_file_prefix(dataset, dapl_id, H5D_ACS_VDS_PREFIX_NAME, &vds_prefix) < 0)
+ if(H5D__build_file_prefix(dataset, H5F_PREFIX_VDS, &vds_prefix) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, NULL, "unable to initialize VDS prefix")
/* Check if dataset was already open */
@@ -1533,8 +1537,13 @@ H5D_open(const H5G_loc_t *loc, hid_t dapl_id)
/* Check whether the external file prefix of the already open dataset
* matches the new external file prefix
*/
- if(HDstrcmp(extfile_prefix, dataset->shared->extfile_prefix) != 0)
- HGOTO_ERROR(H5E_DATASET, H5E_CANTOPENOBJ, NULL, "new external file prefix does not match external file prefix of already open dataset")
+ if(extfile_prefix && dataset->shared->extfile_prefix) {
+ if(HDstrcmp(extfile_prefix, dataset->shared->extfile_prefix) != 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTOPENOBJ, NULL, "new external file prefix does not match external file prefix of already open dataset")
+ } else {
+ if(extfile_prefix || dataset->shared->extfile_prefix)
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTOPENOBJ, NULL, "new external file prefix does not match external file prefix of already open dataset")
+ }
/* Check if the object has been opened through the top file yet */
if(H5FO_top_count(dataset->oloc.file, dataset->oloc.addr) == 0) {
@@ -1642,7 +1651,7 @@ H5D__append_flush_setup(H5D_t *dset, hid_t dapl_id)
dset->shared->append_flush.ndims = info.ndims;
dset->shared->append_flush.func = info.func;
dset->shared->append_flush.udata = info.udata;
- HDmemcpy(dset->shared->append_flush.boundary, info.boundary, sizeof(info.boundary));
+ H5MM_memcpy(dset->shared->append_flush.boundary, info.boundary, sizeof(info.boundary));
} /* end if */
} /* end if */
} /* end if */
@@ -2192,30 +2201,6 @@ H5D_nameof(const H5D_t *dataset)
/*-------------------------------------------------------------------------
- * Function: H5D_typeof
- *
- * Purpose: Returns a pointer to the dataset's datatype. The datatype
- * is not copied.
- *
- * Return: Success: Ptr to the dataset's datatype, uncopied.
- * Failure: NULL
- *-------------------------------------------------------------------------
- */
-H5T_t *
-H5D_typeof(const H5D_t *dset)
-{
- /* Use FUNC_ENTER_NOAPI_NOINIT_NOERR here to avoid performance issues */
- FUNC_ENTER_NOAPI_NOINIT_NOERR
-
- HDassert(dset);
- HDassert(dset->shared);
- HDassert(dset->shared->type);
-
- FUNC_LEAVE_NOAPI(dset->shared->type)
-} /* end H5D_typeof() */
-
-
-/*-------------------------------------------------------------------------
* Function: H5D__alloc_storage
*
* Purpose: Allocate storage for the raw data of a dataset.
@@ -2778,7 +2763,7 @@ H5D__set_extent(H5D_t *dset, const hsize_t *size)
/* Keep the current dataspace dimensions for later */
HDcompile_assert(sizeof(curr_dims) == sizeof(dset->shared->curr_dims));
- HDmemcpy(curr_dims, dset->shared->curr_dims, H5S_MAX_RANK * sizeof(curr_dims[0]));
+ H5MM_memcpy(curr_dims, dset->shared->curr_dims, H5S_MAX_RANK * sizeof(curr_dims[0]));
/* Modify the size of the dataspace */
if((changed = H5S_set_extent(dset->shared->space, size)) < 0)
@@ -2872,7 +2857,7 @@ H5D__set_extent(H5D_t *dset, const hsize_t *size)
dset->shared->layout.storage.u.virt.list[u].virtual_space_status = H5O_VIRTUAL_STATUS_CORRECT;
/* Patch sub-source datasets */
- for(v = 0; v < dset->shared->layout.storage.u.virt.list[u].sub_dset_nalloc; v++)
+ for(v = 0; v < dset->shared->layout.storage.u.virt.list[u].sub_dset_nused; v++)
if(H5S_set_extent(dset->shared->layout.storage.u.virt.list[u].sub_dset[v].virtual_select, size) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to modify size of dataspace")
} /* end for */
@@ -2898,7 +2883,8 @@ H5D__set_extent(H5D_t *dset, const hsize_t *size)
*-------------------------------------------------------------------------
*/
if(H5D_CHUNKED == dset->shared->layout.type) {
- if(shrink && (*dset->shared->layout.ops->is_space_alloc)(&dset->shared->layout.storage))
+ if(shrink && ((*dset->shared->layout.ops->is_space_alloc)(&dset->shared->layout.storage)
+ || (dset->shared->layout.ops->is_data_cached && (*dset->shared->layout.ops->is_data_cached)(dset->shared))))
/* Remove excess chunks */
if(H5D__chunk_prune_by_extent(dset, curr_dims) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_WRITEERROR, FAIL, "unable to remove chunks")
@@ -3062,7 +3048,7 @@ H5D__format_convert(H5D_t *dataset)
idx_info.storage = &dataset->shared->layout.storage.u.chunk;
/* Copy the current layout info to the new layout */
- HDmemcpy(newlayout, &dataset->shared->layout, sizeof(H5O_layout_t));
+ H5MM_memcpy(newlayout, &dataset->shared->layout, sizeof(H5O_layout_t));
/* Set up info for version 1 B-tree in the new layout */
newlayout->version = H5O_LAYOUT_VERSION_3;
@@ -3113,7 +3099,7 @@ H5D__format_convert(H5D_t *dataset)
HGOTO_ERROR(H5E_DATASET, H5E_CANTFREE, FAIL, "unable to release chunk index info")
/* Copy the new layout to the dataset's layout */
- HDmemcpy(&dataset->shared->layout, newlayout, sizeof(H5O_layout_t));
+ H5MM_memcpy(&dataset->shared->layout, newlayout, sizeof(H5O_layout_t));
break;
diff --git a/src/H5Dio.c b/src/H5Dio.c
index 2f87e38..9343b80 100644
--- a/src/H5Dio.c
+++ b/src/H5Dio.c
@@ -518,7 +518,8 @@ H5D__read(H5D_t *dataset, hid_t mem_type_id, const H5S_t *mem_space,
* has been overwritten. So just proceed in reading.
*/
if(nelmts > 0 && dataset->shared->dcpl_cache.efl.nused == 0 &&
- !(*dataset->shared->layout.ops->is_space_alloc)(&dataset->shared->layout.storage)) {
+ !(*dataset->shared->layout.ops->is_space_alloc)(&dataset->shared->layout.storage) &&
+ !(dataset->shared->layout.ops->is_data_cached && (*dataset->shared->layout.ops->is_data_cached)(dataset->shared))) {
H5D_fill_value_t fill_status; /* Whether/How the fill value is defined */
/* Retrieve dataset's fill-value properties */
@@ -550,6 +551,7 @@ H5D__read(H5D_t *dataset, hid_t mem_type_id, const H5S_t *mem_space,
/* Sanity check that space is allocated, if there are elements */
if(nelmts > 0)
HDassert((*dataset->shared->layout.ops->is_space_alloc)(&dataset->shared->layout.storage)
+ || (dataset->shared->layout.ops->is_data_cached && (*dataset->shared->layout.ops->is_data_cached)(dataset->shared))
|| dataset->shared->dcpl_cache.efl.nused > 0
|| dataset->shared->layout.type == H5D_COMPACT);
diff --git a/src/H5Dlayout.c b/src/H5Dlayout.c
index 494d2c8..fb28489 100644
--- a/src/H5Dlayout.c
+++ b/src/H5Dlayout.c
@@ -50,6 +50,7 @@
const unsigned H5O_layout_ver_bounds[] = {
H5O_LAYOUT_VERSION_1, /* H5F_LIBVER_EARLIEST */
H5O_LAYOUT_VERSION_3, /* H5F_LIBVER_V18 */ /* H5O_LAYOUT_VERSION_DEFAULT */
+ H5O_LAYOUT_VERSION_4, /* H5F_LIBVER_V110 */
H5O_LAYOUT_VERSION_LATEST /* H5F_LIBVER_LATEST */
};
diff --git a/src/H5Dmpio.c b/src/H5Dmpio.c
index f5da33d..467b1b7 100644
--- a/src/H5Dmpio.c
+++ b/src/H5Dmpio.c
@@ -800,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")
@@ -1423,7 +1427,7 @@ H5D__link_chunk_filtered_collective_io(H5D_io_info_t *io_info, const H5D_type_in
for (i = 0, offset = 0; i < (size_t) mpi_rank; i++)
offset += num_chunks_selected_array[i];
- HDmemcpy(chunk_list, &collective_chunk_list[offset], num_chunks_selected_array[mpi_rank] * sizeof(H5D_filtered_collective_io_info_t));
+ H5MM_memcpy(chunk_list, &collective_chunk_list[offset], num_chunks_selected_array[mpi_rank] * sizeof(H5D_filtered_collective_io_info_t));
/* Create single MPI type encompassing each selection in the dataspace */
if (H5D__mpio_filtered_collective_write_type(chunk_list, chunk_list_num_entries,
@@ -1549,7 +1553,7 @@ if(H5DEBUG(D))
HGOTO_ERROR(H5E_DATASET, H5E_CANTRECV, FAIL, "unable to obtain MPIO mode")
/* Set up contiguous I/O info object */
- HDmemcpy(&ctg_io_info, io_info, sizeof(ctg_io_info));
+ H5MM_memcpy(&ctg_io_info, io_info, sizeof(ctg_io_info));
ctg_io_info.store = &ctg_store;
ctg_io_info.layout_ops = *H5D_LOPS_CONTIG;
@@ -1557,7 +1561,7 @@ if(H5DEBUG(D))
ctg_store.contig.dset_size = (hsize_t)io_info->dset->shared->layout.u.chunk.size;
/* Set up compact I/O info object */
- HDmemcpy(&cpt_io_info, io_info, sizeof(cpt_io_info));
+ H5MM_memcpy(&cpt_io_info, io_info, sizeof(cpt_io_info));
cpt_io_info.store = &cpt_store;
cpt_io_info.layout_ops = *H5D_LOPS_COMPACT;
@@ -1784,7 +1788,7 @@ H5D__multi_chunk_filtered_collective_io(H5D_io_info_t *io_info, const H5D_type_i
HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "couldn't construct filtered I/O info list")
/* Set up contiguous I/O info object */
- HDmemcpy(&ctg_io_info, io_info, sizeof(ctg_io_info));
+ H5MM_memcpy(&ctg_io_info, io_info, sizeof(ctg_io_info));
ctg_io_info.store = &ctg_store;
ctg_io_info.layout_ops = *H5D_LOPS_CONTIG;
@@ -1889,7 +1893,7 @@ H5D__multi_chunk_filtered_collective_io(H5D_io_info_t *io_info, const H5D_type_i
/* Collect the new chunk info back to the local copy, since only the record in the
* collective array gets updated by the chunk re-allocation */
- HDmemcpy(&chunk_list[i].chunk_states.new_chunk, &collective_chunk_list[offset].chunk_states.new_chunk, sizeof(chunk_list[i].chunk_states.new_chunk));
+ H5MM_memcpy(&chunk_list[i].chunk_states.new_chunk, &collective_chunk_list[offset].chunk_states.new_chunk, sizeof(chunk_list[i].chunk_states.new_chunk));
H5_CHECKED_ASSIGN(mpi_type_count, int, chunk_list[i].chunk_states.new_chunk.length, hsize_t);
@@ -2313,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 */
@@ -2513,8 +2517,8 @@ H5D__obtain_mpio_mode(H5D_io_info_t* io_info, H5D_chunk_map_t *fm,
/* merge buffer io_mode info and chunk addr into one */
- HDmemcpy(mergebuf, assign_io_mode, total_chunks);
- HDmemcpy(tempbuf, chunk_addr, sizeof(haddr_t) * total_chunks);
+ H5MM_memcpy(mergebuf, assign_io_mode, total_chunks);
+ H5MM_memcpy(tempbuf, chunk_addr, sizeof(haddr_t) * total_chunks);
H5MM_free(nproc_per_chunk);
} /* end if */
@@ -2523,8 +2527,8 @@ H5D__obtain_mpio_mode(H5D_io_info_t* io_info, H5D_chunk_map_t *fm,
if(MPI_SUCCESS != (mpi_code = MPI_Bcast(mergebuf, ((sizeof(haddr_t) + 1) * total_chunks), MPI_BYTE, root, comm)))
HMPI_GOTO_ERROR(FAIL, "MPI_BCast failed", mpi_code)
- HDmemcpy(assign_io_mode, mergebuf, total_chunks);
- HDmemcpy(chunk_addr, tempbuf, sizeof(haddr_t) * total_chunks);
+ H5MM_memcpy(assign_io_mode, mergebuf, total_chunks);
+ H5MM_memcpy(chunk_addr, tempbuf, sizeof(haddr_t) * total_chunks);
#ifdef H5_HAVE_INSTRUMENTED_LIBRARY
{
@@ -2626,7 +2630,7 @@ H5D__construct_filtered_io_info_list(const H5D_io_info_t *io_info, const H5D_typ
local_info_array[i].async_info.receive_buffer_array = NULL;
local_info_array[i].async_info.receive_requests_array = NULL;
- HDmemcpy(local_info_array[i].scaled, chunk_info->scaled, sizeof(chunk_info->scaled));
+ H5MM_memcpy(local_info_array[i].scaled, chunk_info->scaled, sizeof(chunk_info->scaled));
if ((select_npoints = H5S_GET_SELECT_NPOINTS(chunk_info->mspace)) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTCOUNT, FAIL, "dataspace is invalid")
@@ -2738,6 +2742,9 @@ H5D__chunk_redistribute_shared_chunks(const H5D_io_info_t *io_info, const H5D_ty
if ((mpi_size = H5F_mpi_get_size(io_info->dset->oloc.file)) < 0)
HGOTO_ERROR(H5E_IO, H5E_MPI, FAIL, "unable to obtain mpi size")
+ /* Set to latest format for encoding dataspace */
+ H5CX_set_libver_bounds(NULL);
+
if (*local_chunk_array_num_entries)
if (NULL == (send_requests = (MPI_Request *) H5MM_malloc(*local_chunk_array_num_entries * sizeof(MPI_Request))))
HGOTO_ERROR(H5E_DATASET, H5E_CANTALLOC, FAIL, "couldn't allocate send requests buffer")
@@ -2799,8 +2806,9 @@ H5D__chunk_redistribute_shared_chunks(const H5D_io_info_t *io_info, const H5D_ty
/* Sort the new list in order of previous owner so that each original owner of a chunk
* entry gets that entry back, with the possibly newly-modified "new_owner" field
*/
- HDqsort(shared_chunks_info_array, shared_chunks_info_array_num_entries,
- sizeof(H5D_filtered_collective_io_info_t), H5D__cmp_filtered_collective_io_info_entry_owner);
+ if(shared_chunks_info_array_num_entries > 1)
+ HDqsort(shared_chunks_info_array, shared_chunks_info_array_num_entries,
+ sizeof(H5D_filtered_collective_io_info_t), H5D__cmp_filtered_collective_io_info_entry_owner);
send_displacements[0] = 0;
for (i = 1; i < (size_t) mpi_size; i++)
@@ -2837,45 +2845,45 @@ H5D__chunk_redistribute_shared_chunks(const H5D_io_info_t *io_info, const H5D_ty
size_t mod_data_size;
/* Look up the chunk and get its file and memory dataspaces */
- if (NULL == (chunk_info = (H5D_chunk_info_t *) H5SL_search(fm->sel_chunks, &chunk_entry->index)))
+ if(NULL == (chunk_info = (H5D_chunk_info_t *) H5SL_search(fm->sel_chunks, &chunk_entry->index)))
HGOTO_ERROR(H5E_DATASPACE, H5E_NOTFOUND, FAIL, "can't locate chunk in skip list")
/* Determine size of serialized chunk file dataspace, plus the size of
* the data being written
*/
- if (H5S_encode(chunk_info->fspace, &mod_data_p, &mod_data_size) < 0)
+ if(H5S_encode(chunk_info->fspace, &mod_data_p, &mod_data_size) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTENCODE, FAIL, "unable to get encoded dataspace size")
- if ((iter_nelmts = H5S_GET_SELECT_NPOINTS(chunk_info->mspace)) < 0)
+ if((iter_nelmts = H5S_GET_SELECT_NPOINTS(chunk_info->mspace)) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTCOUNT, FAIL, "dataspace is invalid")
mod_data_size += (size_t) iter_nelmts * type_info->src_type_size;
- if (NULL == (mod_data[num_send_requests] = (unsigned char *) H5MM_malloc(mod_data_size)))
+ if(NULL == (mod_data[num_send_requests] = (unsigned char *) H5MM_malloc(mod_data_size)))
HGOTO_ERROR(H5E_DATASET, H5E_CANTALLOC, FAIL, "couldn't allocate chunk modification send buffer")
/* Serialize the chunk's file dataspace into the buffer */
mod_data_p = mod_data[num_send_requests];
- if (H5S_encode(chunk_info->fspace, &mod_data_p, &mod_data_size) < 0)
+ if(H5S_encode(chunk_info->fspace, &mod_data_p, &mod_data_size) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTENCODE, FAIL, "unable to encode dataspace")
/* Initialize iterator for memory selection */
- if (H5S_select_iter_init(mem_iter, chunk_info->mspace, type_info->src_type_size) < 0)
+ if(H5S_select_iter_init(mem_iter, chunk_info->mspace, type_info->src_type_size, 0) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to initialize memory selection information")
mem_iter_init = TRUE;
/* Collect the modification data into the buffer */
- if(!H5D__gather_mem(io_info->u.wbuf, chunk_info->mspace, mem_iter, (size_t)iter_nelmts, mod_data_p))
+ if(0 == H5D__gather_mem(io_info->u.wbuf, mem_iter, (size_t)iter_nelmts, mod_data_p))
HGOTO_ERROR(H5E_IO, H5E_CANTGATHER, FAIL, "couldn't gather from write buffer")
/* Send modification data to new owner */
H5_CHECK_OVERFLOW(mod_data_size, size_t, int)
H5_CHECK_OVERFLOW(chunk_entry->index, hsize_t, int)
- if (MPI_SUCCESS != (mpi_code = MPI_Isend(mod_data[num_send_requests], (int) mod_data_size, MPI_BYTE,
+ if(MPI_SUCCESS != (mpi_code = MPI_Isend(mod_data[num_send_requests], (int) mod_data_size, MPI_BYTE,
chunk_entry->owners.new_owner, (int) chunk_entry->index, io_info->comm, &send_requests[num_send_requests])))
HMPI_GOTO_ERROR(FAIL, "MPI_Isend failed", mpi_code)
- if (mem_iter_init && H5S_SELECT_ITER_RELEASE(mem_iter) < 0)
+ if(mem_iter_init && H5S_SELECT_ITER_RELEASE(mem_iter) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTFREE, FAIL, "couldn't release memory selection iterator")
mem_iter_init = FALSE;
@@ -3044,11 +3052,11 @@ H5D__mpio_filtered_collective_write_type(H5D_filtered_collective_io_info_t *chun
} /* end if */
done:
- if (write_buf_array)
+ if(write_buf_array)
H5MM_free(write_buf_array);
- if (file_offset_array)
+ if(file_offset_array)
H5MM_free(file_offset_array);
- if (length_array)
+ if(length_array)
H5MM_free(length_array);
FUNC_LEAVE_NOAPI(ret_value)
@@ -3166,7 +3174,7 @@ H5D__filtered_collective_chunk_entry_io(H5D_filtered_collective_io_info_t *chunk
if (NULL == (mem_iter = (H5S_sel_iter_t *) H5MM_malloc(sizeof(H5S_sel_iter_t))))
HGOTO_ERROR(H5E_DATASET, H5E_CANTALLOC, FAIL, "couldn't allocate memory iterator")
- if (H5S_select_iter_init(mem_iter, chunk_info->mspace, type_info->src_type_size) < 0)
+ if(H5S_select_iter_init(mem_iter, chunk_info->mspace, type_info->src_type_size, 0) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to initialize memory selection information")
mem_iter_init = TRUE;
@@ -3176,99 +3184,99 @@ H5D__filtered_collective_chunk_entry_io(H5D_filtered_collective_io_info_t *chunk
* from the current process, then apply any modifications from other processes. Finally,
* filter the newly-updated chunk.
*/
- switch (io_info->op_type) {
+ switch(io_info->op_type) {
case H5D_IO_OP_READ:
- if (NULL == (file_iter = (H5S_sel_iter_t *) H5MM_malloc(sizeof(H5S_sel_iter_t))))
+ if(NULL == (file_iter = (H5S_sel_iter_t *) H5MM_malloc(sizeof(H5S_sel_iter_t))))
HGOTO_ERROR(H5E_DATASET, H5E_CANTALLOC, FAIL, "couldn't allocate file iterator")
- if (H5S_select_iter_init(file_iter, chunk_info->fspace, type_info->src_type_size) < 0)
+ if(H5S_select_iter_init(file_iter, chunk_info->fspace, type_info->src_type_size, 0) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to initialize memory selection information")
file_iter_init = TRUE;
- if ((iter_nelmts = H5S_GET_SELECT_NPOINTS(chunk_info->fspace)) < 0)
+ if((iter_nelmts = H5S_GET_SELECT_NPOINTS(chunk_info->fspace)) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTCOUNT, FAIL, "dataspace is invalid")
- if (NULL == (tmp_gath_buf = H5MM_malloc((hsize_t) iter_nelmts * type_info->src_type_size)))
+ if(NULL == (tmp_gath_buf = H5MM_malloc((hsize_t) iter_nelmts * type_info->src_type_size)))
HGOTO_ERROR(H5E_DATASET, H5E_CANTALLOC, FAIL, "couldn't allocate temporary gather buffer")
- if (!H5D__gather_mem(chunk_entry->buf, chunk_info->fspace, file_iter, (size_t) iter_nelmts, tmp_gath_buf))
+ if(!H5D__gather_mem(chunk_entry->buf, file_iter, (size_t) iter_nelmts, tmp_gath_buf))
HGOTO_ERROR(H5E_IO, H5E_READERROR, FAIL, "couldn't gather from chunk buffer")
- if ((iter_nelmts = H5S_GET_SELECT_NPOINTS(chunk_info->mspace)) < 0)
+ if((iter_nelmts = H5S_GET_SELECT_NPOINTS(chunk_info->mspace)) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTCOUNT, FAIL, "dataspace is invalid")
- if (H5D__scatter_mem(tmp_gath_buf, chunk_info->mspace, mem_iter, (size_t) iter_nelmts, io_info->u.rbuf) < 0)
- HGOTO_ERROR(H5E_DATASET, H5E_READERROR, FAIL, "couldn't scatter to read buffer")
+ if(H5D__scatter_mem(tmp_gath_buf, mem_iter, (size_t) iter_nelmts, io_info->u.rbuf) < 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_READERROR, FAIL, "couldn't scatter to read buffer")
break;
case H5D_IO_OP_WRITE:
- if ((iter_nelmts = H5S_GET_SELECT_NPOINTS(chunk_info->mspace)) < 0)
+ if((iter_nelmts = H5S_GET_SELECT_NPOINTS(chunk_info->mspace)) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTCOUNT, FAIL, "dataspace is invalid")
- if (NULL == (tmp_gath_buf = H5MM_malloc((hsize_t) iter_nelmts * type_info->src_type_size)))
+ if(NULL == (tmp_gath_buf = H5MM_malloc((hsize_t) iter_nelmts * type_info->src_type_size)))
HGOTO_ERROR(H5E_DATASET, H5E_CANTALLOC, FAIL, "couldn't allocate temporary gather buffer")
/* Gather modification data from the application write buffer into a temporary buffer */
- if(!H5D__gather_mem(io_info->u.wbuf, chunk_info->mspace, mem_iter, (size_t) iter_nelmts, tmp_gath_buf))
+ if(0 == H5D__gather_mem(io_info->u.wbuf, mem_iter, (size_t) iter_nelmts, tmp_gath_buf))
HGOTO_ERROR(H5E_IO, H5E_WRITEERROR, FAIL, "couldn't gather from write buffer")
- if (H5S_SELECT_ITER_RELEASE(mem_iter) < 0)
+ if(H5S_SELECT_ITER_RELEASE(mem_iter) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTFREE, FAIL, "couldn't release selection iterator")
mem_iter_init = FALSE;
/* Initialize iterator for file selection */
- if (H5S_select_iter_init(mem_iter, chunk_info->fspace, type_info->dst_type_size) < 0)
+ if(H5S_select_iter_init(mem_iter, chunk_info->fspace, type_info->dst_type_size, 0) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to initialize file selection information")
mem_iter_init = TRUE;
- if ((iter_nelmts = H5S_GET_SELECT_NPOINTS(chunk_info->fspace)) < 0)
+ if((iter_nelmts = H5S_GET_SELECT_NPOINTS(chunk_info->fspace)) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTCOUNT, FAIL, "dataspace is invalid")
/* Scatter the owner's modification data into the chunk data buffer according to
* the file space.
*/
- if(H5D__scatter_mem(tmp_gath_buf, chunk_info->fspace, mem_iter, (size_t) iter_nelmts, chunk_entry->buf) < 0)
+ if(H5D__scatter_mem(tmp_gath_buf, mem_iter, (size_t) iter_nelmts, chunk_entry->buf) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_READERROR, FAIL, "couldn't scatter to chunk data buffer")
- if (H5S_SELECT_ITER_RELEASE(mem_iter) < 0)
+ if(H5S_SELECT_ITER_RELEASE(mem_iter) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTFREE, FAIL, "couldn't release selection iterator")
mem_iter_init = FALSE;
- if (MPI_SUCCESS != (mpi_code = MPI_Waitall(chunk_entry->async_info.num_receive_requests,
+ if(MPI_SUCCESS != (mpi_code = MPI_Waitall(chunk_entry->async_info.num_receive_requests,
chunk_entry->async_info.receive_requests_array, MPI_STATUSES_IGNORE)))
HMPI_GOTO_ERROR(FAIL, "MPI_Waitall failed", mpi_code)
/* For each asynchronous receive call previously posted, receive the chunk modification
* buffer from another rank and update the chunk data
*/
- for (i = 0; i < (size_t) chunk_entry->async_info.num_receive_requests; i++) {
+ for(i = 0; i < (size_t) chunk_entry->async_info.num_receive_requests; i++) {
const unsigned char *mod_data_p;
/* Decode the process' chunk file dataspace */
mod_data_p = chunk_entry->async_info.receive_buffer_array[i];
- if (NULL == (dataspace = H5S_decode(&mod_data_p)))
+ if(NULL == (dataspace = H5S_decode(&mod_data_p)))
HGOTO_ERROR(H5E_DATASET, H5E_CANTDECODE, FAIL, "unable to decode dataspace")
- if (H5S_select_iter_init(mem_iter, dataspace, type_info->dst_type_size) < 0)
+ if(H5S_select_iter_init(mem_iter, dataspace, type_info->dst_type_size, 0) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to initialize memory selection information")
mem_iter_init = TRUE;
- if ((iter_nelmts = H5S_GET_SELECT_NPOINTS(dataspace)) < 0)
+ if((iter_nelmts = H5S_GET_SELECT_NPOINTS(dataspace)) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTCOUNT, FAIL, "dataspace is invalid")
/* Update the chunk data with the received modification data */
- if(H5D__scatter_mem(mod_data_p, dataspace, mem_iter, (size_t) iter_nelmts, chunk_entry->buf) < 0)
+ if(H5D__scatter_mem(mod_data_p, mem_iter, (size_t) iter_nelmts, chunk_entry->buf) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_WRITEERROR, FAIL, "couldn't scatter to write buffer")
- if (H5S_SELECT_ITER_RELEASE(mem_iter) < 0)
+ if(H5S_SELECT_ITER_RELEASE(mem_iter) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTFREE, FAIL, "couldn't release selection iterator")
mem_iter_init = FALSE;
- if (dataspace) {
- if (H5S_close(dataspace) < 0)
+ if(dataspace) {
+ if(H5S_close(dataspace) < 0)
HGOTO_ERROR(H5E_DATASPACE, H5E_CANTFREE, FAIL, "can't close dataspace")
dataspace = NULL;
- }
+ } /* end if */
H5MM_free(chunk_entry->async_info.receive_buffer_array[i]);
} /* end for */
diff --git a/src/H5Dpkg.h b/src/H5Dpkg.h
index 2767aa1..db67101 100644
--- a/src/H5Dpkg.h
+++ b/src/H5Dpkg.h
@@ -113,12 +113,14 @@ typedef struct H5D_type_info_t {
/* Forward declaration of structs used below */
struct H5D_io_info_t;
struct H5D_chunk_map_t;
+typedef struct H5D_shared_t H5D_shared_t;
/* Function pointers for I/O on particular types of dataset layouts */
typedef herr_t (*H5D_layout_construct_func_t)(H5F_t *f, H5D_t *dset);
typedef herr_t (*H5D_layout_init_func_t)(H5F_t *f, const H5D_t *dset,
hid_t dapl_id);
typedef hbool_t (*H5D_layout_is_space_alloc_func_t)(const H5O_storage_t *storage);
+typedef hbool_t (*H5D_layout_is_data_cached_func_t)(const H5D_shared_t *shared_dset);
typedef herr_t (*H5D_layout_io_init_func_t)(const struct H5D_io_info_t *io_info,
const H5D_type_info_t *type_info,
hsize_t nelmts, const H5S_t *file_space, const H5S_t *mem_space,
@@ -144,6 +146,7 @@ typedef struct H5D_layout_ops_t {
H5D_layout_construct_func_t construct; /* Layout constructor for new datasets */
H5D_layout_init_func_t init; /* Layout initializer for dataset */
H5D_layout_is_space_alloc_func_t is_space_alloc; /* Query routine to determine if storage is allocated */
+ H5D_layout_is_data_cached_func_t is_data_cached; /* Query routine to determine if any raw data is cached. If routine is not present then the layout type never caches raw data. */
H5D_layout_io_init_func_t io_init; /* I/O initialization routine */
H5D_layout_read_func_t ser_read; /* High-level I/O routine for reading data in serial */
H5D_layout_write_func_t ser_write; /* High-level I/O routine for writing data in serial */
@@ -429,7 +432,7 @@ typedef struct H5D_rdcdc_t {
* created once for a given dataset. Thus, if a dataset is opened twice,
* there will be two IDs and two H5D_t structs, both sharing one H5D_shared_t.
*/
-typedef struct H5D_shared_t {
+struct H5D_shared_t {
size_t fo_count; /* Reference count */
hbool_t closing; /* Flag to indicate dataset is closing */
hid_t type_id; /* ID for dataset's datatype */
@@ -459,7 +462,7 @@ typedef struct H5D_shared_t {
H5D_append_flush_t append_flush; /* Append flush property information */
char *extfile_prefix; /* expanded external file prefix */
char *vds_prefix; /* expanded vds prefix */
-} H5D_shared_t;
+};
struct H5D_t {
H5O_loc_t oloc; /* Object header location */
@@ -591,10 +594,10 @@ H5_DLL herr_t H5D__select_write(const H5D_io_info_t *io_info,
hsize_t nelmts, const H5S_t *file_space, const H5S_t *mem_space);
/* Functions that perform scatter-gather serial I/O operations */
-H5_DLL herr_t H5D__scatter_mem(const void *_tscat_buf, const H5S_t *space,
- H5S_sel_iter_t *iter, size_t nelmts, void *_buf);
-H5_DLL size_t H5D__gather_mem(const void *_buf, const H5S_t *space,
- H5S_sel_iter_t *iter, size_t nelmts, void *_tgath_buf/*out*/);
+H5_DLL herr_t H5D__scatter_mem(const void *_tscat_buf, H5S_sel_iter_t *iter,
+ size_t nelmts, void *_buf);
+H5_DLL size_t H5D__gather_mem(const void *_buf, H5S_sel_iter_t *iter,
+ size_t nelmts, void *_tgath_buf/*out*/);
H5_DLL herr_t H5D__scatgath_read(const H5D_io_info_t *io_info,
const H5D_type_info_t *type_info,
hsize_t nelmts, const H5S_t *file_space, const H5S_t *mem_space);
@@ -618,6 +621,7 @@ H5_DLL herr_t H5D__layout_oh_write(const H5D_t *dataset, H5O_t *oh, unsigned upd
/* Functions that operate on contiguous storage */
H5_DLL herr_t H5D__contig_alloc(H5F_t *f, H5O_storage_contig_t *storage);
H5_DLL hbool_t H5D__contig_is_space_alloc(const H5O_storage_t *storage);
+H5_DLL hbool_t H5D__contig_is_data_cached(const H5D_shared_t *shared_dset);
H5_DLL herr_t H5D__contig_fill(const H5D_io_info_t *io_info);
H5_DLL herr_t H5D__contig_read(H5D_io_info_t *io_info, const H5D_type_info_t *type_info,
hsize_t nelmts, const H5S_t *file_space, const H5S_t *mem_space,
@@ -636,6 +640,7 @@ H5_DLL htri_t H5D__chunk_cacheable(const H5D_io_info_t *io_info, haddr_t caddr,
H5_DLL herr_t H5D__chunk_create(const H5D_t *dset /*in,out*/);
H5_DLL herr_t H5D__chunk_set_info(const H5D_t *dset);
H5_DLL hbool_t H5D__chunk_is_space_alloc(const H5O_storage_t *storage);
+H5_DLL hbool_t H5D__chunk_is_data_cached(const H5D_shared_t *shared_dset);
H5_DLL herr_t H5D__chunk_lookup(const H5D_t *dset, const hsize_t *scaled,
H5D_chunk_ud_t *udata);
H5_DLL herr_t H5D__chunk_allocated(const H5D_t *dset, hsize_t *nbytes);
diff --git a/src/H5Dprivate.h b/src/H5Dprivate.h
index 6fb7889..bc44d2a 100644
--- a/src/H5Dprivate.h
+++ b/src/H5Dprivate.h
@@ -166,7 +166,6 @@ H5_DLL herr_t H5D_mult_refresh_close(hid_t dset_id);
H5_DLL herr_t H5D_mult_refresh_reopen(H5D_t *dataset);
H5_DLL H5O_loc_t *H5D_oloc(H5D_t *dataset);
H5_DLL H5G_name_t *H5D_nameof(const H5D_t *dataset);
-H5_DLL H5T_t *H5D_typeof(const H5D_t *dset);
H5_DLL herr_t H5D_flush_all(const H5F_t *f);
H5_DLL hid_t H5D_get_create_plist(const H5D_t *dset);
H5_DLL hid_t H5D_get_access_plist(const H5D_t *dset);
diff --git a/src/H5Dscatgath.c b/src/H5Dscatgath.c
index 266f5f5..cdf9da2 100644
--- a/src/H5Dscatgath.c
+++ b/src/H5Dscatgath.c
@@ -27,6 +27,7 @@
#include "H5Eprivate.h" /* Error handling */
#include "H5FLprivate.h" /* Free Lists */
#include "H5Iprivate.h" /* IDs */
+#include "H5MMprivate.h" /* Memory management */
/****************/
@@ -43,13 +44,11 @@
/* Local Prototypes */
/********************/
static herr_t H5D__scatter_file(const H5D_io_info_t *io_info,
- const H5S_t *file_space, H5S_sel_iter_t *file_iter, size_t nelmts,
- const void *buf);
+ H5S_sel_iter_t *file_iter, size_t nelmts, const void *buf);
static size_t H5D__gather_file(const H5D_io_info_t *io_info,
- const H5S_t *file_space, H5S_sel_iter_t *file_iter, size_t nelmts,
- void *buf);
-static herr_t H5D__compound_opt_read(size_t nelmts, const H5S_t *mem_space,
- H5S_sel_iter_t *iter, const H5D_type_info_t *type_info, void *user_buf/*out*/);
+ H5S_sel_iter_t *file_iter, size_t nelmts, void *buf);
+static herr_t H5D__compound_opt_read(size_t nelmts, H5S_sel_iter_t *iter,
+ const H5D_type_info_t *type_info, void *user_buf/*out*/);
static herr_t H5D__compound_opt_write(size_t nelmts, const H5D_type_info_t *type_info);
@@ -90,9 +89,8 @@ H5FL_SEQ_EXTERN(hsize_t);
*-------------------------------------------------------------------------
*/
static herr_t
-H5D__scatter_file(const H5D_io_info_t *_io_info,
- const H5S_t *space, H5S_sel_iter_t *iter, size_t nelmts,
- const void *_buf)
+H5D__scatter_file(const H5D_io_info_t *_io_info, H5S_sel_iter_t *iter,
+ size_t nelmts, const void *_buf)
{
H5D_io_info_t tmp_io_info; /* Temporary I/O info object */
hsize_t *off = NULL; /* Pointer to sequence offsets */
@@ -111,13 +109,12 @@ H5D__scatter_file(const H5D_io_info_t *_io_info,
/* Check args */
HDassert(_io_info);
- HDassert(space);
HDassert(iter);
HDassert(nelmts > 0);
HDassert(_buf);
/* Set up temporary I/O info object */
- HDmemcpy(&tmp_io_info, _io_info, sizeof(*_io_info));
+ H5MM_memcpy(&tmp_io_info, _io_info, sizeof(*_io_info));
tmp_io_info.op_type = H5D_IO_OP_WRITE;
tmp_io_info.u.wbuf = _buf;
@@ -138,7 +135,7 @@ H5D__scatter_file(const H5D_io_info_t *_io_info,
/* Loop until all elements are written */
while(nelmts > 0) {
/* Get list of sequences for selection to write */
- if(H5S_SELECT_GET_SEQ_LIST(space, H5S_GET_SEQ_LIST_SORTED, iter, vec_size, nelmts, &nseq, &nelem, off, len) < 0)
+ if(H5S_SELECT_ITER_GET_SEQ_LIST(iter, vec_size, nelmts, &nseq, &nelem, off, len) < 0)
HGOTO_ERROR(H5E_INTERNAL, H5E_UNSUPPORTED, FAIL, "sequence length generation failed")
/* Reset the current sequence information */
@@ -191,9 +188,8 @@ done:
*-------------------------------------------------------------------------
*/
static size_t
-H5D__gather_file(const H5D_io_info_t *_io_info,
- const H5S_t *space, H5S_sel_iter_t *iter, size_t nelmts,
- void *_buf/*out*/)
+H5D__gather_file(const H5D_io_info_t *_io_info, H5S_sel_iter_t *iter,
+ size_t nelmts, void *_buf/*out*/)
{
H5D_io_info_t tmp_io_info; /* Temporary I/O info object */
hsize_t *off = NULL; /* Pointer to sequence offsets */
@@ -214,13 +210,12 @@ H5D__gather_file(const H5D_io_info_t *_io_info,
HDassert(_io_info);
HDassert(_io_info->dset);
HDassert(_io_info->store);
- HDassert(space);
HDassert(iter);
HDassert(nelmts > 0);
HDassert(_buf);
/* Set up temporary I/O info object */
- HDmemcpy(&tmp_io_info, _io_info, sizeof(*_io_info));
+ H5MM_memcpy(&tmp_io_info, _io_info, sizeof(*_io_info));
tmp_io_info.op_type = H5D_IO_OP_READ;
tmp_io_info.u.rbuf = _buf;
@@ -241,7 +236,7 @@ H5D__gather_file(const H5D_io_info_t *_io_info,
/* Loop until all elements are read */
while(nelmts > 0) {
/* Get list of sequences for selection to read */
- if(H5S_SELECT_GET_SEQ_LIST(space, H5S_GET_SEQ_LIST_SORTED, iter, vec_size, nelmts, &nseq, &nelem, off, len) < 0)
+ if(H5S_SELECT_ITER_GET_SEQ_LIST(iter, vec_size, nelmts, &nseq, &nelem, off, len) < 0)
HGOTO_ERROR(H5E_INTERNAL, H5E_UNSUPPORTED, 0, "sequence length generation failed")
/* Reset the current sequence information */
@@ -288,8 +283,8 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5D__scatter_mem (const void *_tscat_buf, const H5S_t *space,
- H5S_sel_iter_t *iter, size_t nelmts, void *_buf/*out*/)
+H5D__scatter_mem(const void *_tscat_buf, H5S_sel_iter_t *iter, size_t nelmts,
+ void *_buf/*out*/)
{
uint8_t *buf = (uint8_t *)_buf; /* Get local copies for address arithmetic */
const uint8_t *tscat_buf = (const uint8_t *)_tscat_buf;
@@ -307,7 +302,6 @@ H5D__scatter_mem (const void *_tscat_buf, const H5S_t *space,
/* Check args */
HDassert(tscat_buf);
- HDassert(space);
HDassert(iter);
HDassert(nelmts > 0);
HDassert(buf);
@@ -329,7 +323,7 @@ H5D__scatter_mem (const void *_tscat_buf, const H5S_t *space,
/* Loop until all elements are written */
while(nelmts > 0) {
/* Get list of sequences for selection to write */
- if(H5S_SELECT_GET_SEQ_LIST(space, 0, iter, vec_size, nelmts, &nseq, &nelem, off, len) < 0)
+ if(H5S_SELECT_ITER_GET_SEQ_LIST(iter, vec_size, nelmts, &nseq, &nelem, off, len) < 0)
HGOTO_ERROR (H5E_INTERNAL, H5E_UNSUPPORTED, 0, "sequence length generation failed")
/* Loop, while sequences left to process */
@@ -337,7 +331,7 @@ H5D__scatter_mem (const void *_tscat_buf, const H5S_t *space,
/* Get the number of bytes in sequence */
curr_len = len[curr_seq];
- HDmemcpy(buf + off[curr_seq], tscat_buf, curr_len);
+ H5MM_memcpy(buf + off[curr_seq], tscat_buf, curr_len);
/* Advance offset in destination buffer */
tscat_buf += curr_len;
@@ -376,8 +370,8 @@ done:
*-------------------------------------------------------------------------
*/
size_t
-H5D__gather_mem(const void *_buf, const H5S_t *space,
- H5S_sel_iter_t *iter, size_t nelmts, void *_tgath_buf/*out*/)
+H5D__gather_mem(const void *_buf, H5S_sel_iter_t *iter, size_t nelmts,
+ void *_tgath_buf/*out*/)
{
const uint8_t *buf = (const uint8_t *)_buf; /* Get local copies for address arithmetic */
uint8_t *tgath_buf = (uint8_t *)_tgath_buf;
@@ -395,7 +389,6 @@ H5D__gather_mem(const void *_buf, const H5S_t *space,
/* Check args */
HDassert(buf);
- HDassert(space);
HDassert(iter);
HDassert(nelmts > 0);
HDassert(tgath_buf);
@@ -417,7 +410,7 @@ H5D__gather_mem(const void *_buf, const H5S_t *space,
/* Loop until all elements are written */
while(nelmts > 0) {
/* Get list of sequences for selection to write */
- if(H5S_SELECT_GET_SEQ_LIST(space, 0, iter, vec_size, nelmts, &nseq, &nelem, off, len) < 0)
+ if(H5S_SELECT_ITER_GET_SEQ_LIST(iter, vec_size, nelmts, &nseq, &nelem, off, len) < 0)
HGOTO_ERROR (H5E_INTERNAL, H5E_UNSUPPORTED, 0, "sequence length generation failed")
/* Loop, while sequences left to process */
@@ -425,7 +418,7 @@ H5D__gather_mem(const void *_buf, const H5S_t *space,
/* Get the number of bytes in sequence */
curr_len = len[curr_seq];
- HDmemcpy(tgath_buf, buf + off[curr_seq], curr_len);
+ H5MM_memcpy(tgath_buf, buf + off[curr_seq], curr_len);
/* Advance offset in gather buffer */
tgath_buf += curr_len;
@@ -495,13 +488,13 @@ H5D__scatgath_read(const H5D_io_info_t *io_info, const H5D_type_info_t *type_inf
HGOTO_ERROR(H5E_DATASET, H5E_CANTALLOC, FAIL, "can't allocate file iterator")
/* Figure out the strip mine size. */
- if(H5S_select_iter_init(file_iter, file_space, type_info->src_type_size) < 0)
+ if(H5S_select_iter_init(file_iter, file_space, type_info->src_type_size, H5S_SEL_ITER_GET_SEQ_LIST_SORTED) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to initialize file selection information")
file_iter_init = TRUE; /*file selection iteration info has been initialized */
- if(H5S_select_iter_init(mem_iter, mem_space, type_info->dst_type_size) < 0)
+ if(H5S_select_iter_init(mem_iter, mem_space, type_info->dst_type_size, 0) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to initialize memory selection information")
mem_iter_init = TRUE; /*file selection iteration info has been initialized */
- if(H5S_select_iter_init(bkg_iter, mem_space, type_info->dst_type_size) < 0)
+ if(H5S_select_iter_init(bkg_iter, mem_space, type_info->dst_type_size, 0) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to initialize background selection information")
bkg_iter_init = TRUE; /*file selection iteration info has been initialized */
@@ -522,7 +515,7 @@ H5D__scatgath_read(const H5D_io_info_t *io_info, const H5D_type_info_t *type_inf
/*
* Gather data
*/
- n = H5D__gather_file(io_info, file_space, file_iter, smine_nelmts, type_info->tconv_buf/*out*/);
+ n = H5D__gather_file(io_info, file_iter, smine_nelmts, type_info->tconv_buf/*out*/);
if(n != smine_nelmts)
HGOTO_ERROR(H5E_IO, H5E_READERROR, FAIL, "file gather failed")
@@ -531,12 +524,12 @@ H5D__scatgath_read(const H5D_io_info_t *io_info, const H5D_type_info_t *type_inf
* bypass the rest of steps.
*/
if(type_info->cmpd_subset && H5T_SUBSET_FALSE != type_info->cmpd_subset->subset) {
- if(H5D__compound_opt_read(smine_nelmts, mem_space, mem_iter, type_info, buf /*out*/) < 0)
+ if(H5D__compound_opt_read(smine_nelmts, mem_iter, type_info, buf /*out*/) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "datatype conversion failed")
} /* end if */
else {
if(H5T_BKG_YES == type_info->need_bkg) {
- n = H5D__gather_mem(buf, mem_space, bkg_iter, smine_nelmts, type_info->bkg_buf/*out*/);
+ n = H5D__gather_mem(buf, bkg_iter, smine_nelmts, type_info->bkg_buf/*out*/);
if(n != smine_nelmts)
HGOTO_ERROR(H5E_IO, H5E_READERROR, FAIL, "mem gather failed")
} /* end if */
@@ -562,7 +555,7 @@ H5D__scatgath_read(const H5D_io_info_t *io_info, const H5D_type_info_t *type_inf
}
/* Scatter the data into memory */
- if(H5D__scatter_mem(type_info->tconv_buf, mem_space, mem_iter, smine_nelmts, buf/*out*/) < 0)
+ if(H5D__scatter_mem(type_info->tconv_buf, mem_iter, smine_nelmts, buf/*out*/) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_READERROR, FAIL, "scatter failed")
} /* end else */
} /* end for */
@@ -635,13 +628,13 @@ H5D__scatgath_write(const H5D_io_info_t *io_info, const H5D_type_info_t *type_in
HGOTO_ERROR(H5E_DATASET, H5E_CANTALLOC, FAIL, "can't allocate file iterator")
/* Figure out the strip mine size. */
- if(H5S_select_iter_init(file_iter, file_space, type_info->dst_type_size) < 0)
+ if(H5S_select_iter_init(file_iter, file_space, type_info->dst_type_size, H5S_SEL_ITER_GET_SEQ_LIST_SORTED) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to initialize file selection information")
file_iter_init = TRUE; /*file selection iteration info has been initialized */
- if(H5S_select_iter_init(mem_iter, mem_space, type_info->src_type_size) < 0)
+ if(H5S_select_iter_init(mem_iter, mem_space, type_info->src_type_size, 0) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to initialize memory selection information")
mem_iter_init = TRUE; /*file selection iteration info has been initialized */
- if(H5S_select_iter_init(bkg_iter, file_space, type_info->dst_type_size) < 0)
+ if(H5S_select_iter_init(bkg_iter, file_space, type_info->dst_type_size, H5S_SEL_ITER_GET_SEQ_LIST_SORTED) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to initialize background selection information")
bkg_iter_init = TRUE; /*file selection iteration info has been initialized */
@@ -658,7 +651,7 @@ H5D__scatgath_write(const H5D_io_info_t *io_info, const H5D_type_info_t *type_in
* buffer. Also gather data from the file into the background buffer
* if necessary.
*/
- n = H5D__gather_mem(buf, mem_space, mem_iter, smine_nelmts, type_info->tconv_buf/*out*/);
+ n = H5D__gather_mem(buf, mem_iter, smine_nelmts, type_info->tconv_buf/*out*/);
if(n != smine_nelmts)
HGOTO_ERROR(H5E_IO, H5E_WRITEERROR, FAIL, "mem gather failed")
@@ -675,7 +668,7 @@ H5D__scatgath_write(const H5D_io_info_t *io_info, const H5D_type_info_t *type_in
} /* end if */
else {
if(H5T_BKG_YES == type_info->need_bkg) {
- n = H5D__gather_file(io_info, file_space, bkg_iter, smine_nelmts, type_info->bkg_buf/*out*/);
+ n = H5D__gather_file(io_info, bkg_iter, smine_nelmts, type_info->bkg_buf/*out*/);
if(n != smine_nelmts)
HGOTO_ERROR(H5E_IO, H5E_READERROR, FAIL, "file gather failed")
} /* end if */
@@ -705,7 +698,7 @@ H5D__scatgath_write(const H5D_io_info_t *io_info, const H5D_type_info_t *type_in
/*
* Scatter the data out to the file.
*/
- if(H5D__scatter_file(io_info, file_space, file_iter, smine_nelmts, type_info->tconv_buf) < 0)
+ if(H5D__scatter_file(io_info, file_iter, smine_nelmts, type_info->tconv_buf) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_WRITEERROR, FAIL, "scatter failed")
} /* end for */
@@ -761,7 +754,7 @@ done:
*-------------------------------------------------------------------------
*/
static herr_t
-H5D__compound_opt_read(size_t nelmts, const H5S_t *space, H5S_sel_iter_t *iter,
+H5D__compound_opt_read(size_t nelmts, H5S_sel_iter_t *iter,
const H5D_type_info_t *type_info, void *user_buf/*out*/)
{
uint8_t *ubuf = (uint8_t *)user_buf; /* Cast for pointer arithmetic */
@@ -777,7 +770,6 @@ H5D__compound_opt_read(size_t nelmts, const H5S_t *space, H5S_sel_iter_t *iter,
/* Check args */
HDassert(nelmts > 0);
- HDassert(space);
HDassert(iter);
HDassert(type_info);
HDassert(type_info->cmpd_subset);
@@ -814,7 +806,7 @@ H5D__compound_opt_read(size_t nelmts, const H5S_t *space, H5S_sel_iter_t *iter,
size_t elmtno; /* Element counter */
/* Get list of sequences for selection to write */
- if(H5S_SELECT_GET_SEQ_LIST(space, 0, iter, vec_size, nelmts, &nseq, &elmtno, off, len) < 0)
+ if(H5S_SELECT_ITER_GET_SEQ_LIST(iter, vec_size, nelmts, &nseq, &elmtno, off, len) < 0)
HGOTO_ERROR(H5E_INTERNAL, H5E_UNSUPPORTED, 0, "sequence length generation failed")
/* Loop, while sequences left to process */
@@ -981,7 +973,7 @@ H5Dscatter(H5D_scatter_func_t op, void *op_data, hid_t type_id,
HGOTO_ERROR(H5E_DATASET, H5E_CANTALLOC, FAIL, "can't allocate selection iterator")
/* Initialize selection iterator */
- if(H5S_select_iter_init(iter, dst_space, type_size) < 0)
+ if(H5S_select_iter_init(iter, dst_space, type_size, 0) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to initialize selection iterator information")
iter_init = TRUE;
@@ -1005,7 +997,7 @@ H5Dscatter(H5D_scatter_func_t op, void *op_data, hid_t type_id,
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "callback returned more elements than in selection")
/* Scatter data */
- if(H5D__scatter_mem(src_buf, dst_space, iter, nelmts_scatter, dst_buf) < 0)
+ if(H5D__scatter_mem(src_buf, iter, nelmts_scatter, dst_buf) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTCOPY, FAIL, "scatter failed")
nelmts -= (hssize_t)nelmts_scatter;
@@ -1091,14 +1083,14 @@ H5Dgather(hid_t src_space_id, const void *src_buf, hid_t type_id,
HGOTO_ERROR(H5E_DATASET, H5E_CANTALLOC, FAIL, "can't allocate selection iterator")
/* Initialize selection iterator */
- if(H5S_select_iter_init(iter, src_space, type_size) < 0)
+ if(H5S_select_iter_init(iter, src_space, type_size, 0) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to initialize selection iterator information")
iter_init = TRUE;
/* Loop until all data has been scattered */
while(nelmts > 0) {
/* Gather data */
- if(0 == (nelmts_gathered = H5D__gather_mem(src_buf, src_space, iter, MIN(dst_buf_nelmts, (size_t)nelmts), dst_buf)))
+ if(0 == (nelmts_gathered = H5D__gather_mem(src_buf, iter, MIN(dst_buf_nelmts, (size_t)nelmts), dst_buf)))
HGOTO_ERROR(H5E_IO, H5E_CANTCOPY, FAIL, "gather failed")
HDassert(nelmts_gathered == MIN(dst_buf_nelmts, (size_t)nelmts));
diff --git a/src/H5Dselect.c b/src/H5Dselect.c
index 0ec3423..a843d93 100644
--- a/src/H5Dselect.c
+++ b/src/H5Dselect.c
@@ -175,12 +175,12 @@ H5D__select_io(const H5D_io_info_t *io_info, size_t elmt_size,
HGOTO_ERROR(H5E_DATASET, H5E_CANTALLOC, FAIL, "can't allocate file iterator")
/* Initialize file iterator */
- if(H5S_select_iter_init(file_iter, file_space, elmt_size) < 0)
+ if(H5S_select_iter_init(file_iter, file_space, elmt_size, H5S_SEL_ITER_GET_SEQ_LIST_SORTED) < 0)
HGOTO_ERROR(H5E_DATASPACE, H5E_CANTINIT, FAIL, "unable to initialize selection iterator")
file_iter_init = 1; /* File selection iteration info has been initialized */
/* Initialize memory iterator */
- if(H5S_select_iter_init(mem_iter, mem_space, elmt_size) < 0)
+ if(H5S_select_iter_init(mem_iter, mem_space, elmt_size, 0) < 0)
HGOTO_ERROR(H5E_DATASPACE, H5E_CANTINIT, FAIL, "unable to initialize selection iterator")
mem_iter_init = 1; /* Memory selection iteration info has been initialized */
@@ -193,7 +193,7 @@ H5D__select_io(const H5D_io_info_t *io_info, size_t elmt_size,
/* Check if more file sequences are needed */
if(curr_file_seq >= file_nseq) {
/* Get sequences for file selection */
- if(H5S_SELECT_GET_SEQ_LIST(file_space, H5S_GET_SEQ_LIST_SORTED, file_iter, vec_size, nelmts, &file_nseq, &file_nelem, file_off, file_len) < 0)
+ if(H5S_SELECT_ITER_GET_SEQ_LIST(file_iter, vec_size, nelmts, &file_nseq, &file_nelem, file_off, file_len) < 0)
HGOTO_ERROR(H5E_INTERNAL, H5E_UNSUPPORTED, FAIL, "sequence length generation failed")
/* Start at the beginning of the sequences again */
@@ -203,7 +203,7 @@ H5D__select_io(const H5D_io_info_t *io_info, size_t elmt_size,
/* Check if more memory sequences are needed */
if(curr_mem_seq >= mem_nseq) {
/* Get sequences for memory selection */
- if(H5S_SELECT_GET_SEQ_LIST(mem_space, 0, mem_iter, vec_size, nelmts, &mem_nseq, &mem_nelem, mem_off, mem_len) < 0)
+ if(H5S_SELECT_ITER_GET_SEQ_LIST(mem_iter, vec_size, nelmts, &mem_nseq, &mem_nelem, mem_off, mem_len) < 0)
HGOTO_ERROR(H5E_INTERNAL, H5E_UNSUPPORTED, FAIL, "sequence length generation failed")
/* Start at the beginning of the sequences again */
@@ -227,6 +227,8 @@ H5D__select_io(const H5D_io_info_t *io_info, size_t elmt_size,
/* Decrement number of elements left to process */
HDassert(((size_t)tmp_file_len % elmt_size) == 0);
+ if(elmt_size == 0)
+ HGOTO_ERROR(H5E_DATASPACE, H5E_BADVALUE, FAIL, "Resulted in division by zero")
nelmts -= ((size_t)tmp_file_len / elmt_size);
} /* end while */
} /* end else */
diff --git a/src/H5Dvirtual.c b/src/H5Dvirtual.c
index 8c78feb..61e67f9 100644
--- a/src/H5Dvirtual.c
+++ b/src/H5Dvirtual.c
@@ -35,6 +35,13 @@
* until the virtual dataset is closed.
*/
+/*
+ * Note: H5S_select_project_intersection has been updated to no longer require
+ * that the source and source intersect spaces have the same extent. This file
+ * should therefore be updated to remove code that ensures this condition, which
+ * should improve both maintainability and performance.
+ */
+
/****************/
/* Module Setup */
/****************/
@@ -79,6 +86,7 @@
/********************/
/* Layout operation callbacks */
+static hbool_t H5D__virtual_is_data_cached(const H5D_shared_t *shared_dset);
static herr_t H5D__virtual_read(H5D_io_info_t *io_info, const H5D_type_info_t
*type_info, hsize_t nelmts, const H5S_t *file_space, const H5S_t *mem_space,
H5D_chunk_map_t *fm);
@@ -122,6 +130,7 @@ const H5D_layout_ops_t H5D_LOPS_VIRTUAL[1] = {{
NULL,
H5D__virtual_init,
H5D__virtual_is_space_alloc,
+ H5D__virtual_is_data_cached,
NULL,
H5D__virtual_read,
H5D__virtual_write,
@@ -425,11 +434,13 @@ H5D__virtual_store_layout(H5F_t *f, H5O_layout_t *layout)
/* Sanity checking */
HDassert(f);
HDassert(layout);
+ HDassert(layout->storage.u.virt.serial_list_hobjid.addr == HADDR_UNDEF);
/* Create block if # of used entries > 0 */
+ if(layout->storage.u.virt.list_nused > 0) {
- if((layout->storage.u.virt.serial_list_hobjid.addr == HADDR_UNDEF)
- && (layout->storage.u.virt.list_nused > 0)) {
+ /* Set the low/high bounds according to 'f' for the API context */
+ H5CX_set_libver_bounds(f);
/* Allocate array for caching results of strlen */
if(NULL == (str_size = (size_t *)H5MM_malloc(2 * layout->storage.u.virt.list_nused * sizeof(size_t))))
@@ -492,11 +503,11 @@ H5D__virtual_store_layout(H5F_t *f, H5O_layout_t *layout)
/* Encode each entry */
for(i = 0; i < layout->storage.u.virt.list_nused; i++) {
/* Source file name */
- HDmemcpy((char *)heap_block_p, layout->storage.u.virt.list[i].source_file_name, str_size[2 * i]);
+ H5MM_memcpy((char *)heap_block_p, layout->storage.u.virt.list[i].source_file_name, str_size[2 * i]);
heap_block_p += str_size[2 * i];
/* Source dataset name */
- HDmemcpy((char *)heap_block_p, layout->storage.u.virt.list[i].source_dset_name, str_size[(2 * i) + 1]);
+ H5MM_memcpy((char *)heap_block_p, layout->storage.u.virt.list[i].source_dset_name, str_size[(2 * i) + 1]);
heap_block_p += str_size[(2 * i) + 1];
/* Source selection */
@@ -1129,7 +1140,7 @@ H5D__virtual_str_append(const char *src, size_t src_len, char **p, char **buf,
/* Copy string to *p. Note that since src in not NULL terminated, we must
* use memcpy */
- (void)HDmemcpy(*p, src, src_len);
+ (void)H5MM_memcpy(*p, src, src_len);
/* Advance *p */
*p += src_len;
@@ -2268,6 +2279,54 @@ H5D__virtual_is_space_alloc(const H5O_storage_t H5_ATTR_UNUSED *storage)
/*-------------------------------------------------------------------------
+ * Function: H5D__virtual_is_data_cached
+ *
+ * Purpose: Query if raw data is cached for dataset
+ *
+ * Return: Non-negative on success/Negative on failure
+ *
+ * Programmer: Neil Fortner
+ * Wednessday, March 6, 2016
+ *
+ *-------------------------------------------------------------------------
+ */
+static hbool_t
+H5D__virtual_is_data_cached(const H5D_shared_t *shared_dset)
+{
+ const H5O_storage_virtual_t *storage; /* Convenience pointer */
+ size_t i, j; /* Local index variables */
+ hbool_t ret_value = FALSE; /* Return value */
+
+ FUNC_ENTER_PACKAGE_NOERR
+
+ /* Sanity checks */
+ HDassert(shared_dset);
+ storage = &shared_dset->layout.storage.u.virt;
+
+ /* Iterate over mappings */
+ for(i = 0; i < storage->list_nused; i++)
+ /* Check for "printf" source dataset resolution */
+ if(storage->list[i].psfn_nsubs || storage->list[i].psdn_nsubs) {
+ /* Iterate over sub-source dsets */
+ for(j = storage->list[i].sub_dset_io_start; j < storage->list[i].sub_dset_io_end; j++)
+ /* Check for cahced data in source dset */
+ if(storage->list[i].sub_dset[j].dset
+ && storage->list[i].sub_dset[j].dset->shared->layout.ops->is_data_cached
+ && storage->list[i].sub_dset[j].dset->shared->layout.ops->is_data_cached(storage->list[i].sub_dset[j].dset->shared))
+ HGOTO_DONE(TRUE);
+ } /* end if */
+ else
+ if(storage->list[i].source_dset.dset
+ && storage->list[i].source_dset.dset->shared->layout.ops->is_data_cached
+ && storage->list[i].source_dset.dset->shared->layout.ops->is_data_cached(storage->list[i].source_dset.dset->shared))
+ HGOTO_DONE(TRUE);
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5D__virtual_is_data_cached() */
+
+
+/*-------------------------------------------------------------------------
* Function: H5D__virtual_pre_io
*
* Purpose: Project all virtual mappings onto mem_space, with the
@@ -3030,7 +3089,7 @@ H5D__virtual_refresh_source_dset(H5D_t **dset)
/* Discard the identifier & replace the dataset */
if(NULL == (vol_obj = (H5VL_object_t *)H5I_remove(temp_id)))
HGOTO_ERROR(H5E_DATASET, H5E_CANTREMOVE, FAIL, "can't unregister source dataset ID")
- if(NULL == (*dset = (H5D_t *)H5VL_object_data(vol_obj)))
+ if(NULL == (*dset = (H5D_t *)H5VL_object_unwrap(vol_obj)))
HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't retrieve library object from VOL object")
vol_obj->data = NULL;
diff --git a/src/H5E.c b/src/H5E.c
index 06ae806..07eaf18 100644
--- a/src/H5E.c
+++ b/src/H5E.c
@@ -866,7 +866,7 @@ H5Eget_msg(hid_t msg_id, H5E_type_t *type, char *msg_str, size_t size)
H5E_msg_t *msg; /* Pointer to error message */
ssize_t ret_value = -1; /* Return value */
- FUNC_ENTER_API((-1))
+ FUNC_ENTER_API_NOCLEAR((-1))
H5TRACE4("Zs", "i*Et*sz", msg_id, type, msg_str, size);
/* Get the message object */
@@ -1386,7 +1386,7 @@ H5Epush2(hid_t err_stack, const char *file, const char *func, unsigned line,
*/
/* Format the description */
- va_start(ap, fmt);
+ HDva_start(ap, fmt);
va_started = TRUE;
#ifdef H5_HAVE_VASPRINTF
@@ -1402,8 +1402,8 @@ H5Epush2(hid_t err_stack, const char *file, const char *func, unsigned line,
/* If the description doesn't fit into the initial buffer size, allocate more space and try again */
while((desc_len = HDvsnprintf(tmp, (size_t)tmp_len, fmt, ap)) > (tmp_len - 1)) {
/* shutdown & restart the va_list */
- va_end(ap);
- va_start(ap, fmt);
+ HDva_end(ap);
+ HDva_start(ap, fmt);
/* Release the previous description, it's too small */
H5MM_xfree(tmp);
@@ -1421,7 +1421,7 @@ H5Epush2(hid_t err_stack, const char *file, const char *func, unsigned line,
done:
if(va_started)
- va_end(ap);
+ HDva_end(ap);
#ifdef H5_HAVE_VASPRINTF
/* Memory was allocated with HDvasprintf so it needs to be freed
* with HDfree
diff --git a/src/H5EA.c b/src/H5EA.c
index 9ceb144..d0bf474 100644
--- a/src/H5EA.c
+++ b/src/H5EA.c
@@ -46,6 +46,7 @@
#include "H5Eprivate.h" /* Error handling */
#include "H5EApkg.h" /* Extensible Arrays */
#include "H5FLprivate.h" /* Free Lists */
+#include "H5MMprivate.h" /* Memory management */
#include "H5VMprivate.h" /* Vector functions */
@@ -693,7 +694,7 @@ H5EA_set(const H5EA_t *ea, hsize_t idx, const void *elmt))
HDassert(thing_unprot_func);
/* Set element in thing's element buffer */
- HDmemcpy(thing_elmt_buf + (hdr->cparam.cls->nat_elmt_size * thing_elmt_idx), elmt, hdr->cparam.cls->nat_elmt_size);
+ H5MM_memcpy(thing_elmt_buf + (hdr->cparam.cls->nat_elmt_size * thing_elmt_idx), elmt, hdr->cparam.cls->nat_elmt_size);
thing_cache_flags |= H5AC__DIRTIED_FLAG;
/* Update max. element set in array, if appropriate */
@@ -765,7 +766,7 @@ H5EA_get(const H5EA_t *ea, hsize_t idx, void *elmt))
} /* end if */
else
/* Get element from thing's element buffer */
- HDmemcpy(elmt, thing_elmt_buf + (hdr->cparam.cls->nat_elmt_size * thing_elmt_idx), hdr->cparam.cls->nat_elmt_size);
+ H5MM_memcpy(elmt, thing_elmt_buf + (hdr->cparam.cls->nat_elmt_size * thing_elmt_idx), hdr->cparam.cls->nat_elmt_size);
} /* end else */
CATCH
diff --git a/src/H5EAcache.c b/src/H5EAcache.c
index 8138991..da67e6b 100644
--- a/src/H5EAcache.c
+++ b/src/H5EAcache.c
@@ -41,6 +41,7 @@
#include "H5Eprivate.h" /* Error handling */
#include "H5EApkg.h" /* Extensible Arrays */
#include "H5MFprivate.h" /* File memory management */
+#include "H5MMprivate.h" /* Memory management */
#include "H5VMprivate.h" /* Vectors and arrays */
#include "H5WBprivate.h" /* Wrapped Buffers */
@@ -479,7 +480,7 @@ H5EA__cache_hdr_serialize(const H5F_t *f, void *_image, size_t H5_ATTR_UNUSED le
HDassert(hdr);
/* Magic number */
- HDmemcpy(image, H5EA_HDR_MAGIC, (size_t)H5_SIZEOF_MAGIC);
+ H5MM_memcpy(image, H5EA_HDR_MAGIC, (size_t)H5_SIZEOF_MAGIC);
image += H5_SIZEOF_MAGIC;
/* Version # */
@@ -867,7 +868,7 @@ H5EA__cache_iblock_serialize(const H5F_t *f, void *_image, size_t H5_ATTR_UNUSED
/* Get temporary pointer to serialized info */
/* Magic number */
- HDmemcpy(image, H5EA_IBLOCK_MAGIC, (size_t)H5_SIZEOF_MAGIC);
+ H5MM_memcpy(image, H5EA_IBLOCK_MAGIC, (size_t)H5_SIZEOF_MAGIC);
image += H5_SIZEOF_MAGIC;
/* Version # */
@@ -1179,7 +1180,7 @@ H5EA__cache_sblock_deserialize(const void *_image, size_t len,
size_t tot_page_init_size = sblock->ndblks * sblock->dblk_page_init_size; /* Compute total size of 'page init' buffer */
/* Retrieve the 'page init' bitmasks */
- HDmemcpy(sblock->page_init, image, tot_page_init_size);
+ H5MM_memcpy(sblock->page_init, image, tot_page_init_size);
image += tot_page_init_size;
} /* end if */
@@ -1276,7 +1277,7 @@ H5EA__cache_sblock_serialize(const H5F_t *f, void *_image, size_t H5_ATTR_UNUSED
HDassert(sblock->hdr);
/* Magic number */
- HDmemcpy(image, H5EA_SBLOCK_MAGIC, (size_t)H5_SIZEOF_MAGIC);
+ H5MM_memcpy(image, H5EA_SBLOCK_MAGIC, (size_t)H5_SIZEOF_MAGIC);
image += H5_SIZEOF_MAGIC;
/* Version # */
@@ -1298,7 +1299,7 @@ H5EA__cache_sblock_serialize(const H5F_t *f, void *_image, size_t H5_ATTR_UNUSED
size_t tot_page_init_size = sblock->ndblks * sblock->dblk_page_init_size; /* Compute total size of 'page init' buffer */
/* Store the 'page init' bitmasks */
- HDmemcpy(image, sblock->page_init, tot_page_init_size);
+ H5MM_memcpy(image, sblock->page_init, tot_page_init_size);
image += tot_page_init_size;
} /* end if */
@@ -1690,7 +1691,7 @@ H5EA__cache_dblock_serialize(const H5F_t *f, void *_image, size_t H5_ATTR_UNUSED
HDassert(dblock->hdr);
/* Magic number */
- HDmemcpy(image, H5EA_DBLOCK_MAGIC, (size_t)H5_SIZEOF_MAGIC);
+ H5MM_memcpy(image, H5EA_DBLOCK_MAGIC, (size_t)H5_SIZEOF_MAGIC);
image += H5_SIZEOF_MAGIC;
/* Version # */
diff --git a/src/H5EAdbg.c b/src/H5EAdbg.c
index 1a2b973..3d6c2ed 100644
--- a/src/H5EAdbg.c
+++ b/src/H5EAdbg.c
@@ -264,7 +264,7 @@ H5EA__iblock_debug(H5F_t *f, haddr_t H5_ATTR_UNUSED addr, FILE *stream, int inde
HDfprintf(stream, "%*sData Block Addresses in Index Block:\n", indent, "");
for(u = 0; u < iblock->ndblk_addrs; u++) {
/* Print address */
- sprintf(temp_str, "Address #%u:", u);
+ HDsprintf(temp_str, "Address #%u:", u);
HDfprintf(stream, "%*s%-*s %a\n", (indent + 3), "", MAX(0, (fwidth - 3)),
temp_str,
iblock->dblk_addrs[u]);
@@ -280,7 +280,7 @@ H5EA__iblock_debug(H5F_t *f, haddr_t H5_ATTR_UNUSED addr, FILE *stream, int inde
HDfprintf(stream, "%*sSuper Block Addresses in Index Block:\n", indent, "");
for(u = 0; u < iblock->nsblk_addrs; u++) {
/* Print address */
- sprintf(temp_str, "Address #%u:", u);
+ HDsprintf(temp_str, "Address #%u:", u);
HDfprintf(stream, "%*s%-*s %a\n", (indent + 3), "", MAX(0, (fwidth - 3)),
temp_str,
iblock->sblk_addrs[u]);
@@ -371,7 +371,7 @@ H5EA__sblock_debug(H5F_t *f, haddr_t addr, FILE *stream, int indent,
HDfprintf(stream, "%*sData Block Addresses in Super Block:\n", indent, "");
for(u = 0; u < sblock->ndblks; u++) {
/* Print address */
- sprintf(temp_str, "Address #%u:", u);
+ HDsprintf(temp_str, "Address #%u:", u);
HDfprintf(stream, "%*s%-*s %a\n", (indent + 3), "", MAX(0, (fwidth - 3)),
temp_str,
sblock->dblk_addrs[u]);
diff --git a/src/H5EAhdr.c b/src/H5EAhdr.c
index 62a23b8..18d642f 100644
--- a/src/H5EAhdr.c
+++ b/src/H5EAhdr.c
@@ -41,6 +41,7 @@
#include "H5Eprivate.h" /* Error handling */
#include "H5EApkg.h" /* Extensible Arrays */
#include "H5MFprivate.h" /* File memory management */
+#include "H5MMprivate.h" /* Memory management */
#include "H5VMprivate.h" /* Vectors and arrays */
@@ -407,7 +408,7 @@ H5EA__hdr_create(H5F_t *f, const H5EA_create_t *cparam, void *ctx_udata))
hdr->idx_blk_addr = HADDR_UNDEF;
/* Set the creation parameters for the array */
- HDmemcpy(&hdr->cparam, cparam, sizeof(hdr->cparam));
+ H5MM_memcpy(&hdr->cparam, cparam, sizeof(hdr->cparam));
/* Finish initializing extensible array header */
if(H5EA__hdr_init(hdr, ctx_udata) < 0)
diff --git a/src/H5EAstat.c b/src/H5EAstat.c
index 72c4d14..509d3f8 100644
--- a/src/H5EAstat.c
+++ b/src/H5EAstat.c
@@ -40,6 +40,7 @@
#include "H5private.h" /* Generic Functions */
#include "H5Eprivate.h" /* Error handling */
#include "H5EApkg.h" /* Extensible Arrays */
+#include "H5MMprivate.h" /* Memory management */
/****************/
@@ -108,7 +109,7 @@ HDfprintf(stderr, "%s: Called\n", FUNC);
HDassert(stats);
/* Copy extensible array statistics */
- HDmemcpy(stats, &ea->hdr->stats, sizeof(ea->hdr->stats));
+ H5MM_memcpy(stats, &ea->hdr->stats, sizeof(ea->hdr->stats));
END_FUNC(PRIV) /* end H5EA_get_stats() */
diff --git a/src/H5EAtest.c b/src/H5EAtest.c
index 7c02e16..814e64f 100644
--- a/src/H5EAtest.c
+++ b/src/H5EAtest.c
@@ -336,7 +336,7 @@ H5EA__test_debug(FILE *stream, int indent, int fwidth, hsize_t idx,
HDassert(elmt);
/* Print element */
- sprintf(temp_str, "Element #%llu:", (unsigned long long)idx);
+ HDsprintf(temp_str, "Element #%llu:", (unsigned long long)idx);
HDfprintf(stream, "%*s%-*s %llu\n", indent, "", fwidth, temp_str,
(unsigned long long)*(const uint64_t *)elmt);
diff --git a/src/H5Eint.c b/src/H5Eint.c
index 66653ca..e76db82 100644
--- a/src/H5Eint.c
+++ b/src/H5Eint.c
@@ -704,7 +704,7 @@ H5E_printf_stack(H5E_t *estack, const char *file, const char *func, unsigned lin
*/
/* Start the variable-argument parsing */
- va_start(ap, fmt);
+ HDva_start(ap, fmt);
va_started = TRUE;
#ifdef H5_HAVE_VASPRINTF
@@ -720,8 +720,8 @@ H5E_printf_stack(H5E_t *estack, const char *file, const char *func, unsigned lin
/* If the description doesn't fit into the initial buffer size, allocate more space and try again */
while((desc_len = HDvsnprintf(tmp, (size_t)tmp_len, fmt, ap)) > (tmp_len - 1)) {
/* shutdown & restart the va_list */
- va_end(ap);
- va_start(ap, fmt);
+ HDva_end(ap);
+ HDva_start(ap, fmt);
/* Release the previous description, it's too small */
H5MM_xfree(tmp);
@@ -739,7 +739,7 @@ H5E_printf_stack(H5E_t *estack, const char *file, const char *func, unsigned lin
done:
if(va_started)
- va_end(ap);
+ HDva_end(ap);
#ifdef H5_HAVE_VASPRINTF
/* Memory was allocated with HDvasprintf so it needs to be freed
* with HDfree
@@ -883,11 +883,11 @@ H5E__clear_entries(H5E_t *estack, size_t nentries)
/* Release strings */
if(error->func_name)
- H5MM_xfree((void *)error->func_name); /* Casting away const OK - QAK */
+ error->func_name = (const char *) H5MM_xfree((void *)error->func_name); /* Casting away const OK - QAK */
if(error->file_name)
- H5MM_xfree((void *)error->file_name); /* Casting away const OK - QAK */
+ error->file_name = (const char *) H5MM_xfree((void *)error->file_name); /* Casting away const OK - QAK */
if(error->desc)
- H5MM_xfree((void *)error->desc); /* Casting away const OK - QAK */
+ error->desc = (const char *) H5MM_xfree((void *)error->desc); /* Casting away const OK - QAK */
} /* end for */
/* Decrement number of errors on stack */
diff --git a/src/H5F.c b/src/H5F.c
index 9df8140..d216cd2 100644
--- a/src/H5F.c
+++ b/src/H5F.c
@@ -560,20 +560,21 @@ done:
*
* Purpose: Check if the file can be opened with the given fapl.
*
- * Return: TRUE/FALSE/FAIL
+ * Return: Succeed: TRUE/FALSE
+ * Failure: FAIL (includes file does not exist)
*
*-------------------------------------------------------------------------
*/
htri_t
-H5Fis_accessible(const char *name, hid_t fapl_id)
+H5Fis_accessible(const char *filename, hid_t fapl_id)
{
htri_t ret_value; /* Return value */
FUNC_ENTER_API(FAIL)
- H5TRACE2("t", "*si", name, fapl_id);
+ H5TRACE2("t", "*si", filename, fapl_id);
/* Check args */
- if(!name || !*name)
+ if(!filename || !*filename)
HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, FAIL, "no file name specified")
/* Check the file access property list */
@@ -584,7 +585,7 @@ H5Fis_accessible(const char *name, hid_t fapl_id)
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not file access property list")
/* Check if file is accessible */
- if(H5VL_file_specific(NULL, H5VL_FILE_IS_ACCESSIBLE, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, fapl_id, name, &ret_value) < 0)
+ if(H5VL_file_specific(NULL, H5VL_FILE_IS_ACCESSIBLE, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, fapl_id, filename, &ret_value) < 0)
HGOTO_ERROR(H5E_FILE, H5E_NOTHDF5, FAIL, "unable to determine if file is accessible as HDF5")
done:
@@ -838,6 +839,68 @@ done:
/*-------------------------------------------------------------------------
+ * Function: H5Fdelete
+ *
+ * Purpose: Deletes an HDF5 file.
+ *
+ * Return: SUCCEED/FAIL
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5Fdelete(const char *filename, hid_t fapl_id)
+{
+ H5P_genplist_t *plist; /* Property list pointer */
+ H5VL_connector_prop_t connector_prop; /* Property for VOL connector ID & info */
+ htri_t is_hdf5 = FAIL;
+ herr_t ret_value = SUCCEED;
+
+ FUNC_ENTER_API(FAIL)
+ H5TRACE2("e", "*si", filename, fapl_id);
+
+ /* Check args */
+ if(!filename || !*filename)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, FAIL, "no file name specified")
+
+ /* Check the file access property list */
+ if(H5P_DEFAULT == fapl_id)
+ fapl_id = H5P_FILE_ACCESS_DEFAULT;
+ else
+ if(TRUE != H5P_isa_class(fapl_id, H5P_FILE_ACCESS))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file access property list")
+
+ /* Verify access property list and set up collective metadata if appropriate */
+ if(H5CX_set_apl(&fapl_id, H5P_CLS_FACC, H5I_INVALID_HID, TRUE) < 0)
+ HGOTO_ERROR(H5E_FILE, H5E_CANTSET, H5I_INVALID_HID, "can't set access property list info")
+
+ /* Get the VOL info from the fapl */
+ if(NULL == (plist = (H5P_genplist_t *)H5I_object_verify(fapl_id, H5I_GENPROP_LST)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not a property list")
+ if(H5P_peek(plist, H5F_ACS_VOL_CONN_NAME, &connector_prop) < 0)
+ HGOTO_ERROR(H5E_FILE, H5E_CANTGET, H5I_INVALID_HID, "can't get VOL connector info")
+
+ /* Stash a copy of the "top-level" connector property, before any pass-through
+ * connectors modify or unwrap it.
+ */
+ if(H5CX_set_vol_connector_prop(&connector_prop) < 0)
+ HGOTO_ERROR(H5E_FILE, H5E_CANTSET, H5I_INVALID_HID, "can't set VOL connector info in API context")
+
+ /* Make sure this is HDF5 storage for this VOL connector */
+ if(H5VL_file_specific(NULL, H5VL_FILE_IS_ACCESSIBLE, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, fapl_id, filename, &is_hdf5) < 0)
+ HGOTO_ERROR(H5E_FILE, H5E_NOTHDF5, FAIL, "unable to determine if file is accessible as HDF5")
+ if(!is_hdf5)
+ HGOTO_ERROR(H5E_FILE, H5E_NOTHDF5, FAIL, "not an HDF5 file")
+
+ /* Delete the file */
+ if(H5VL_file_specific(NULL, H5VL_FILE_DELETE, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, fapl_id, filename, &ret_value) < 0)
+ HGOTO_ERROR(H5E_FILE, H5E_CANTDELETEFILE, FAIL, "unable to delete the file")
+
+done:
+ FUNC_LEAVE_API(ret_value)
+} /* end H5Fdelete() */
+
+
+/*-------------------------------------------------------------------------
* Function: H5Freopen
*
* Purpose: Reopen a file. The new file handle which is returned points
@@ -921,6 +984,42 @@ done:
/*-------------------------------------------------------------------------
+ * Function: H5Fget_fileno
+ *
+ * Purpose: Public API to retrieve the file's 'file number' that uniquely
+ * identifies each open file.
+ *
+ * Return: SUCCEED/FAIL
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5Fget_fileno(hid_t file_id, unsigned long *fileno)
+{
+ herr_t ret_value = SUCCEED;
+
+ FUNC_ENTER_API(FAIL)
+ H5TRACE2("e", "i*Ul", file_id, fileno);
+
+ /* If no fileno pointer was passed in, exit quietly */
+ if(fileno) {
+ H5VL_object_t *vol_obj; /* File info */
+
+ /* Get the internal file structure */
+ if(NULL == (vol_obj = (H5VL_object_t *)H5I_object(file_id)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid file identifier")
+
+ /* Get the flags */
+ if((ret_value = H5VL_file_get(vol_obj, H5VL_FILE_GET_FILENO, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, fileno)) < 0)
+ HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "unable to get file's 'file number'")
+ } /* end if */
+
+done:
+ FUNC_LEAVE_API(ret_value)
+} /* end H5Fget_fileno() */
+
+
+/*-------------------------------------------------------------------------
* Function: H5Fget_freespace
*
* Purpose: Retrieves the amount of free space in the file.
diff --git a/src/H5FA.c b/src/H5FA.c
index 61aaa53..8c86193 100644
--- a/src/H5FA.c
+++ b/src/H5FA.c
@@ -41,6 +41,7 @@
#include "H5Eprivate.h" /* Error handling */
#include "H5FApkg.h" /* Fixed Arrays */
#include "H5FLprivate.h" /* Free Lists */
+#include "H5MMprivate.h" /* Memory management */
#include "H5VMprivate.h" /* Vector functions */
@@ -371,7 +372,7 @@ H5FA_set(const H5FA_t *fa, hsize_t idx, const void *elmt))
/* Check for paging data block */
if(!dblock->npages) {
/* Set element in data block */
- HDmemcpy(((uint8_t *)dblock->elmts) + (hdr->cparam.cls->nat_elmt_size * idx), elmt, hdr->cparam.cls->nat_elmt_size);
+ H5MM_memcpy(((uint8_t *)dblock->elmts) + (hdr->cparam.cls->nat_elmt_size * idx), elmt, hdr->cparam.cls->nat_elmt_size);
dblock_cache_flags |= H5AC__DIRTIED_FLAG;
} /* end if */
else { /* paging */
@@ -410,7 +411,7 @@ H5FA_set(const H5FA_t *fa, hsize_t idx, const void *elmt))
H5E_THROW(H5E_CANTPROTECT, "unable to protect fixed array data block page, address = %llu", (unsigned long long)dblk_page_addr)
/* Set the element in the data block page */
- HDmemcpy(((uint8_t *)dblk_page->elmts) + (hdr->cparam.cls->nat_elmt_size * elmt_idx), elmt, hdr->cparam.cls->nat_elmt_size);
+ H5MM_memcpy(((uint8_t *)dblk_page->elmts) + (hdr->cparam.cls->nat_elmt_size * elmt_idx), elmt, hdr->cparam.cls->nat_elmt_size);
dblk_page_cache_flags |= H5AC__DIRTIED_FLAG;
} /* end else */
@@ -474,7 +475,7 @@ H5FA_get(const H5FA_t *fa, hsize_t idx, void *elmt))
/* Check for paged data block */
if(!dblock->npages)
/* Retrieve element from data block */
- HDmemcpy(elmt, ((uint8_t *)dblock->elmts) + (hdr->cparam.cls->nat_elmt_size * idx), hdr->cparam.cls->nat_elmt_size);
+ H5MM_memcpy(elmt, ((uint8_t *)dblock->elmts) + (hdr->cparam.cls->nat_elmt_size * idx), hdr->cparam.cls->nat_elmt_size);
else { /* paging */
size_t page_idx; /* Index of page within data block */
@@ -512,7 +513,7 @@ H5FA_get(const H5FA_t *fa, hsize_t idx, void *elmt))
H5E_THROW(H5E_CANTPROTECT, "unable to protect fixed array data block page, address = %llu", (unsigned long long)dblk_page_addr)
/* Retrieve element from data block */
- HDmemcpy(elmt, ((uint8_t *)dblk_page->elmts) + (hdr->cparam.cls->nat_elmt_size * elmt_idx), hdr->cparam.cls->nat_elmt_size);
+ H5MM_memcpy(elmt, ((uint8_t *)dblk_page->elmts) + (hdr->cparam.cls->nat_elmt_size * elmt_idx), hdr->cparam.cls->nat_elmt_size);
} /* end else */
} /* end else */
} /* end else */
diff --git a/src/H5FAcache.c b/src/H5FAcache.c
index 1f199e9..f440efe 100644
--- a/src/H5FAcache.c
+++ b/src/H5FAcache.c
@@ -41,6 +41,7 @@
#include "H5Eprivate.h" /* Error handling */
#include "H5FApkg.h" /* Fixed Arrays */
#include "H5MFprivate.h" /* File memory management */
+#include "H5MMprivate.h" /* Memory management */
#include "H5VMprivate.h" /* Vectors and arrays */
#include "H5WBprivate.h" /* Wrapped Buffers */
@@ -409,7 +410,7 @@ H5FA__cache_hdr_serialize(const H5F_t *f, void *_image, size_t H5_ATTR_UNUSED le
HDassert(hdr);
/* Magic number */
- HDmemcpy(image, H5FA_HDR_MAGIC, (size_t)H5_SIZEOF_MAGIC);
+ H5MM_memcpy(image, H5FA_HDR_MAGIC, (size_t)H5_SIZEOF_MAGIC);
image += H5_SIZEOF_MAGIC;
/* Version # */
@@ -693,7 +694,7 @@ H5FA__cache_dblock_deserialize(const void *_image, size_t len,
/* Page initialization flags */
if(dblock->npages > 0) {
- HDmemcpy(dblock->dblk_page_init, image, dblock->dblk_page_init_size);
+ H5MM_memcpy(dblock->dblk_page_init, image, dblock->dblk_page_init_size);
image += dblock->dblk_page_init_size;
} /* end if */
@@ -797,7 +798,7 @@ H5FA__cache_dblock_serialize(const H5F_t *f, void *_image, size_t H5_ATTR_UNUSED
HDassert(dblock->hdr);
/* Magic number */
- HDmemcpy(image, H5FA_DBLOCK_MAGIC, (size_t)H5_SIZEOF_MAGIC);
+ H5MM_memcpy(image, H5FA_DBLOCK_MAGIC, (size_t)H5_SIZEOF_MAGIC);
image += H5_SIZEOF_MAGIC;
/* Version # */
@@ -812,7 +813,7 @@ H5FA__cache_dblock_serialize(const H5F_t *f, void *_image, size_t H5_ATTR_UNUSED
/* Page init flags */
if(dblock->npages > 0) {
/* Store the 'page init' bitmasks */
- HDmemcpy(image, dblock->dblk_page_init, dblock->dblk_page_init_size);
+ H5MM_memcpy(image, dblock->dblk_page_init, dblock->dblk_page_init_size);
image += dblock->dblk_page_init_size;
} /* end if */
diff --git a/src/H5FAhdr.c b/src/H5FAhdr.c
index 2e3db0b..8f29b83 100644
--- a/src/H5FAhdr.c
+++ b/src/H5FAhdr.c
@@ -39,6 +39,7 @@
#include "H5Eprivate.h" /* Error handling */
#include "H5FApkg.h" /* Fixed Arrays */
#include "H5MFprivate.h" /* File memory management */
+#include "H5MMprivate.h" /* Memory management */
/****************/
@@ -207,7 +208,7 @@ H5FA__hdr_create(H5F_t *f, const H5FA_create_t *cparam, void *ctx_udata))
hdr->dblk_addr = HADDR_UNDEF;
/* Set the creation parameters for the array */
- HDmemcpy(&hdr->cparam, cparam, sizeof(hdr->cparam));
+ H5MM_memcpy(&hdr->cparam, cparam, sizeof(hdr->cparam));
/* Finish initializing fixed array header */
if(H5FA__hdr_init(hdr, ctx_udata) < 0)
diff --git a/src/H5FAstat.c b/src/H5FAstat.c
index 3c06855..49a56a9 100644
--- a/src/H5FAstat.c
+++ b/src/H5FAstat.c
@@ -38,6 +38,7 @@
#include "H5private.h" /* Generic Functions */
#include "H5Eprivate.h" /* Error handling */
#include "H5FApkg.h" /* Fixed Arrays */
+#include "H5MMprivate.h" /* Memory management */
/****************/
@@ -105,7 +106,7 @@ HDfprintf(stderr, "%s: Called\n", FUNC);
HDassert(stats);
/* Copy fixed array statistics */
- HDmemcpy(stats, &fa->hdr->stats, sizeof(fa->hdr->stats));
+ H5MM_memcpy(stats, &fa->hdr->stats, sizeof(fa->hdr->stats));
END_FUNC(PRIV) /* end H5FA_get_stats() */
diff --git a/src/H5FAtest.c b/src/H5FAtest.c
index 27cd8b7..e55d408 100644
--- a/src/H5FAtest.c
+++ b/src/H5FAtest.c
@@ -315,7 +315,7 @@ H5FA__test_debug(FILE *stream, int indent, int fwidth, hsize_t idx,
HDassert(elmt);
/* Print element */
- sprintf(temp_str, "Element #%llu:", (unsigned long long)idx);
+ HDsprintf(temp_str, "Element #%llu:", (unsigned long long)idx);
HDfprintf(stream, "%*s%-*s %llu\n", indent, "", fwidth, temp_str,
(unsigned long long)*(const uint64_t *)elmt);
diff --git a/src/H5FD.c b/src/H5FD.c
index 5585f37..61969b6 100644
--- a/src/H5FD.c
+++ b/src/H5FD.c
@@ -293,7 +293,7 @@ H5FD_register(const void *_cls, size_t size, hbool_t app_ref)
/* Copy the class structure so the caller can reuse or free it */
if(NULL == (saved = (H5FD_class_t *)H5MM_malloc(size)))
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, H5I_INVALID_HID, "memory allocation failed for file driver class struct")
- HDmemcpy(saved, cls, size);
+ H5MM_memcpy(saved, cls, size);
/* Create the new class ID */
if((ret_value = H5I_register(H5I_VFL, saved, app_ref)) < 0)
@@ -1367,7 +1367,7 @@ H5FD_get_fs_type_map(const H5FD_t *file, H5FD_mem_t *type_map)
} /* end if */
else
/* Copy class's default free space type mapping */
- HDmemcpy(type_map, file->cls->fl_map, sizeof(file->cls->fl_map));
+ H5MM_memcpy(type_map, file->cls->fl_map, sizeof(file->cls->fl_map));
done:
FUNC_LEAVE_NOAPI(ret_value)
diff --git a/src/H5FDcore.c b/src/H5FDcore.c
index d1a17cd..6db8af6 100644
--- a/src/H5FDcore.c
+++ b/src/H5FDcore.c
@@ -848,7 +848,7 @@ H5FD__core_open(const char *name, unsigned flags, hid_t fapl_id, haddr_t maxaddr
HGOTO_ERROR(H5E_FILE, H5E_CANTCOPY, NULL, "image_memcpy callback failed")
} /* end if */
else
- HDmemcpy(file->mem, file_image_info.buffer, size);
+ H5MM_memcpy(file->mem, file_image_info.buffer, size);
} /* end if */
/* Read in existing data from the file if there is no image */
else {
@@ -1300,7 +1300,7 @@ H5FD__core_read(H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type, hid_t H5_ATTR_UNU
nbytes = MIN(size,(size_t)(file->eof-addr));
#endif /* NDEBUG */
- HDmemcpy(buf, file->mem + addr, nbytes);
+ H5MM_memcpy(buf, file->mem + addr, nbytes);
size -= nbytes;
addr += nbytes;
buf = (char *)buf + nbytes;
@@ -1386,7 +1386,7 @@ H5FD__core_write(H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type, hid_t H5_ATTR_UN
}
/* Write from BUF to memory */
- HDmemcpy(file->mem + addr, buf, size);
+ H5MM_memcpy(file->mem + addr, buf, size);
/* Mark memory buffer as modified */
file->dirty = TRUE;
diff --git a/src/H5FDdirect.c b/src/H5FDdirect.c
index 10c368a..33a0ef4 100644
--- a/src/H5FDdirect.c
+++ b/src/H5FDdirect.c
@@ -422,7 +422,7 @@ H5FD_direct_fapl_copy(const void *_old_fa)
HDassert(new_fa);
/* Copy the general information */
- HDmemcpy(new_fa, old_fa, sizeof(H5FD_direct_fapl_t));
+ H5MM_memcpy(new_fa, old_fa, sizeof(H5FD_direct_fapl_t));
FUNC_LEAVE_NOAPI(new_fa)
} /* end H5FD_direct_fapl_copy() */
@@ -976,12 +976,12 @@ H5FD_direct_read(H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type, hid_t H5_ATTR_UN
* next section of data. */
p2 = (unsigned char*)copy_buf + copy_offset;
if((copy_size + copy_offset) <= alloc_size) {
- HDmemcpy(buf, p2, copy_size);
+ H5MM_memcpy(buf, p2, copy_size);
buf = (unsigned char *)buf + copy_size;
copy_size = 0;
} /* end if */
else {
- HDmemcpy(buf, p2, alloc_size - copy_offset);
+ H5MM_memcpy(buf, p2, alloc_size - copy_offset);
buf = (unsigned char*)buf + alloc_size - copy_offset;
copy_size -= alloc_size - copy_offset;
copy_offset = 0;
@@ -1189,11 +1189,11 @@ H5FD_direct_write(H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type, hid_t H5_ATTR_U
*/
p1 = (unsigned char *)copy_buf + copy_offset;
if((copy_size + copy_offset) <= alloc_size) {
- HDmemcpy(p1, p3, copy_size);
+ H5MM_memcpy(p1, p3, copy_size);
copy_size = 0;
} /* end if */
else {
- HDmemcpy(p1, p3, alloc_size - copy_offset);
+ H5MM_memcpy(p1, p3, alloc_size - copy_offset);
p3 = (const unsigned char *)p3 + (alloc_size - copy_offset);
copy_size -= alloc_size - copy_offset;
copy_offset = 0;
diff --git a/src/H5FDfamily.c b/src/H5FDfamily.c
index 4d40cf3..c8893f9 100644
--- a/src/H5FDfamily.c
+++ b/src/H5FDfamily.c
@@ -411,7 +411,7 @@ H5FD_family_fapl_copy(const void *_old_fa)
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed")
/* Copy the fields of the structure */
- HDmemcpy(new_fa, old_fa, sizeof(H5FD_family_fapl_t));
+ H5MM_memcpy(new_fa, old_fa, sizeof(H5FD_family_fapl_t));
/* Deep copy the property list objects in the structure */
if(old_fa->memb_fapl_id==H5P_FILE_ACCESS_DEFAULT) {
@@ -715,7 +715,7 @@ H5FD_family_open(const char *name, unsigned flags, hid_t fapl_id,
(0==file->nmembs ? flags : t_flags), file->memb_fapl_id, HADDR_UNDEF);
} H5E_END_TRY;
if (!file->memb[file->nmembs]) {
- if (0==file->nmembs)
+ if (0 == file->nmembs)
HGOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, NULL, "unable to open member file")
H5E_clear_stack(NULL);
break;
@@ -723,7 +723,7 @@ H5FD_family_open(const char *name, unsigned flags, hid_t fapl_id,
file->nmembs++;
}
- /* If the file is reopened and there's only one member file existing, this file maybe
+ /* If the file is reopened and there's only one member file existing, this file may be
* smaller than the size specified through H5Pset_fapl_family(). Update the actual
* member size.
*/
diff --git a/src/H5FDlog.c b/src/H5FDlog.c
index 655d7d3..06a0e61 100644
--- a/src/H5FDlog.c
+++ b/src/H5FDlog.c
@@ -405,7 +405,7 @@ H5FD_log_fapl_copy(const void *_old_fa)
HGOTO_ERROR(H5E_FILE, H5E_CANTALLOC, NULL, "unable to allocate log file FAPL")
/* Copy the general information */
- HDmemcpy(new_fa, old_fa, sizeof(H5FD_log_fapl_t));
+ H5MM_memcpy(new_fa, old_fa, sizeof(H5FD_log_fapl_t));
/* Deep copy the log file name */
if(old_fa->logfile != NULL)
diff --git a/src/H5FDmpio.c b/src/H5FDmpio.c
index 614c7ba..50b5676 100644
--- a/src/H5FDmpio.c
+++ b/src/H5FDmpio.c
@@ -764,7 +764,7 @@ if(H5FD_mpio_Debug[(int)'t'])
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed")
/* Copy the general information */
- HDmemcpy(new_fa, old_fa, sizeof(H5FD_mpio_fapl_t));
+ H5MM_memcpy(new_fa, old_fa, sizeof(H5FD_mpio_fapl_t));
/* Duplicate communicator and Info object. */
if(H5FD_mpi_comm_info_dup(old_fa->comm, old_fa->info, &new_fa->comm, &new_fa->info) < 0)
diff --git a/src/H5FDmulti.c b/src/H5FDmulti.c
index fac0909..6cfef55 100644
--- a/src/H5FDmulti.c
+++ b/src/H5FDmulti.c
@@ -981,8 +981,7 @@ H5FD_multi_fapl_free(void *_fa)
*-------------------------------------------------------------------------
*/
static H5FD_t *
-H5FD_multi_open(const char *name, unsigned flags, hid_t fapl_id,
- haddr_t maxaddr)
+H5FD_multi_open(const char *name, unsigned flags, hid_t fapl_id, haddr_t maxaddr)
{
H5FD_multi_t *file=NULL;
hid_t close_fapl=-1;
@@ -996,7 +995,7 @@ H5FD_multi_open(const char *name, unsigned flags, hid_t fapl_id,
/* Check arguments */
if (!name || !*name)
H5Epush_ret(func, H5E_ERR_CLS, H5E_ARGS, H5E_BADVALUE, "invalid file name", NULL)
- if (0==maxaddr || HADDR_UNDEF==maxaddr)
+ if (0 == maxaddr || HADDR_UNDEF == maxaddr)
H5Epush_ret(func, H5E_ERR_CLS, H5E_ARGS, H5E_BADRANGE, "bogus maxaddr", NULL)
/*
@@ -1007,41 +1006,41 @@ H5FD_multi_open(const char *name, unsigned flags, hid_t fapl_id,
*/
if(NULL == (file = (H5FD_multi_t *)calloc((size_t)1, sizeof(H5FD_multi_t))))
H5Epush_ret(func, H5E_ERR_CLS, H5E_RESOURCE, H5E_NOSPACE, "memory allocation failed", NULL)
- if(H5P_FILE_ACCESS_DEFAULT==fapl_id || H5FD_MULTI!=H5Pget_driver(fapl_id)) {
+ if(H5P_FILE_ACCESS_DEFAULT == fapl_id || H5FD_MULTI != H5Pget_driver(fapl_id)) {
close_fapl = fapl_id = H5Pcreate(H5P_FILE_ACCESS);
- if(H5Pset_fapl_multi(fapl_id, NULL, NULL, NULL, NULL, TRUE)<0)
+ if(H5Pset_fapl_multi(fapl_id, NULL, NULL, NULL, NULL, TRUE) < 0)
H5Epush_goto(func, H5E_ERR_CLS, H5E_FILE, H5E_CANTSET, "can't set property value", error)
}
fa = (const H5FD_multi_fapl_t *)H5Pget_driver_info(fapl_id);
assert(fa);
ALL_MEMBERS(mt) {
- file->fa.memb_map[mt] = fa->memb_map[mt];
- file->fa.memb_addr[mt] = fa->memb_addr[mt];
- if (fa->memb_fapl[mt]>=0)
- H5Iinc_ref(fa->memb_fapl[mt]);
+ file->fa.memb_map[mt] = fa->memb_map[mt];
+ file->fa.memb_addr[mt] = fa->memb_addr[mt];
+ if (fa->memb_fapl[mt] >= 0)
+ H5Iinc_ref(fa->memb_fapl[mt]);
file->fa.memb_fapl[mt] = fa->memb_fapl[mt];
- if (fa->memb_name[mt])
- file->fa.memb_name[mt] = my_strdup(fa->memb_name[mt]);
- else
- file->fa.memb_name[mt] = NULL;
+ if (fa->memb_name[mt])
+ file->fa.memb_name[mt] = my_strdup(fa->memb_name[mt]);
+ else
+ file->fa.memb_name[mt] = NULL;
} END_MEMBERS;
file->fa.relax = fa->relax;
file->flags = flags;
file->name = my_strdup(name);
- if (close_fapl>=0)
- if(H5Pclose(close_fapl)<0)
+ if (close_fapl >= 0)
+ if(H5Pclose(close_fapl) < 0)
H5Epush_goto(func, H5E_ERR_CLS, H5E_FILE, H5E_CANTCLOSEOBJ, "can't close property list", error)
/* Compute derived properties and open member files */
- if (compute_next(file)<0)
+ if (compute_next(file) < 0)
H5Epush_goto(func, H5E_ERR_CLS, H5E_INTERNAL, H5E_BADVALUE, "compute_next() failed", error);
- if (open_members(file)<0)
+ if (open_members(file) < 0)
H5Epush_goto(func, H5E_ERR_CLS, H5E_INTERNAL, H5E_BADVALUE, "open_members() failed", error);
/* We must have opened at least the superblock file */
- if (H5FD_MEM_DEFAULT==(m=file->fa.memb_map[H5FD_MEM_SUPER]))
+ if (H5FD_MEM_DEFAULT == (m = file->fa.memb_map[H5FD_MEM_SUPER]))
m = H5FD_MEM_SUPER;
- if (NULL==file->memb[m])
+ if (NULL == file->memb[m])
goto error;
return (H5FD_t*)file;
@@ -1049,13 +1048,14 @@ H5FD_multi_open(const char *name, unsigned flags, hid_t fapl_id,
error:
/* Cleanup and fail */
if (file) {
- ALL_MEMBERS(mt) {
- if (file->memb[mt]) (void)H5FDclose(file->memb[mt]);
- if (file->fa.memb_fapl[mt]>=0) (void)H5Idec_ref(file->fa.memb_fapl[mt]);
- if (file->fa.memb_name[mt]) free(file->fa.memb_name[mt]);
- } END_MEMBERS;
- if (file->name) free(file->name);
- free(file);
+ ALL_MEMBERS(mt) {
+ if (file->memb[mt]) (void)H5FDclose(file->memb[mt]);
+ if (file->fa.memb_fapl[mt] >= 0) (void)H5Idec_ref(file->fa.memb_fapl[mt]);
+ if (file->fa.memb_name[mt]) free(file->fa.memb_name[mt]);
+ } END_MEMBERS;
+ if (file->name)
+ free(file->name);
+ free(file);
}
return NULL;
}
diff --git a/src/H5FL.c b/src/H5FL.c
index 89a580a..a662713 100644
--- a/src/H5FL.c
+++ b/src/H5FL.c
@@ -642,7 +642,7 @@ H5FL__reg_term(void)
tmp = H5FL_reg_gc_head.first->next;
#ifdef H5FL_DEBUG
-printf("%s: head->name = %s, head->allocated = %d\n", FUNC, H5FL_reg_gc_head.first->list->name, (int)H5FL_reg_gc_head.first->list->allocated);
+HDprintf("%s: head->name = %s, head->allocated = %d\n", FUNC, H5FL_reg_gc_head.first->list->name, (int)H5FL_reg_gc_head.first->list->allocated);
#endif /* H5FL_DEBUG */
/* Check if the list has allocations outstanding */
if(H5FL_reg_gc_head.first->list->allocated > 0) {
@@ -1142,7 +1142,7 @@ H5FL_blk_realloc(H5FL_blk_head_t *head, void *block, size_t new_size H5FL_TRACK_
if((ret_value=H5FL_blk_malloc(head,new_size H5FL_TRACK_INFO_INT))==NULL)
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed for block")
blk_size=MIN(new_size,temp->size);
- HDmemcpy(ret_value,block,blk_size);
+ H5MM_memcpy(ret_value,block,blk_size);
H5FL_blk_free(head,block);
} /* end if */
else {
@@ -1312,7 +1312,7 @@ H5FL__blk_term(void)
tmp = H5FL_blk_gc_head.first->next;
#ifdef H5FL_DEBUG
-printf("%s: head->name = %s, head->allocated = %d\n", FUNC, H5FL_blk_gc_head.first->pq->name, (int)H5FL_blk_gc_head.first->pq->allocated);
+HDprintf("%s: head->name = %s, head->allocated = %d\n", FUNC, H5FL_blk_gc_head.first->pq->name, (int)H5FL_blk_gc_head.first->pq->allocated);
#endif /* H5FL_DEBUG */
/* Check if the list has allocations outstanding */
@@ -1630,7 +1630,7 @@ H5FL_arr_realloc(H5FL_arr_head_t *head, void * obj, size_t new_elem)
/* Copy the appropriate amount of elements */
blk_size = head->list_arr[MIN(temp->nelem, new_elem)].size;
- HDmemcpy(ret_value, obj, blk_size);
+ H5MM_memcpy(ret_value, obj, blk_size);
/* Free the old block */
H5FL_arr_free(head, obj);
@@ -1780,7 +1780,7 @@ H5FL__arr_term(void)
/* Check if the list has allocations outstanding */
#ifdef H5FL_DEBUG
-printf("%s: head->name = %s, head->allocated = %d\n", FUNC, H5FL_arr_gc_head.first->list->name, (int)H5FL_arr_gc_head.first->list->allocated);
+HDprintf("%s: head->name = %s, head->allocated = %d\n", FUNC, H5FL_arr_gc_head.first->list->name, (int)H5FL_arr_gc_head.first->list->allocated);
#endif /* H5FL_DEBUG */
if(H5FL_arr_gc_head.first->list->allocated > 0) {
/* Add free list to the list of nodes with allocations open still */
@@ -2408,7 +2408,7 @@ H5FL__fac_term_all(void)
tmp = H5FL_fac_gc_head.first->next;
#ifdef H5FL_DEBUG
-printf("%s: head->size = %d, head->allocated = %d\n", FUNC, (int)H5FL_fac_gc_head.first->list->size, (int)H5FL_fac_gc_head.first->list->allocated);
+HDprintf("%s: head->size = %d, head->allocated = %d\n", FUNC, (int)H5FL_fac_gc_head.first->list->size, (int)H5FL_fac_gc_head.first->list->allocated);
#endif /* H5FL_DEBUG */
/* The list cannot have any allocations outstanding */
diff --git a/src/H5FS.c b/src/H5FS.c
index 8fee634..dbcb6b5 100644
--- a/src/H5FS.c
+++ b/src/H5FS.c
@@ -36,6 +36,7 @@
#include "H5Eprivate.h" /* Error handling */
#include "H5FSpkg.h" /* File free space */
#include "H5MFprivate.h" /* File memory management */
+#include "H5MMprivate.h" /* Memory management */
/****************/
@@ -615,7 +616,7 @@ H5FS__new(const H5F_t *f, uint16_t nclasses, const H5FS_section_class_t *classes
HDassert(u == classes[u]->type);
/* Copy the class information into the free space manager */
- HDmemcpy(&fspace->sect_cls[u], classes[u], sizeof(H5FS_section_class_t));
+ H5MM_memcpy(&fspace->sect_cls[u], classes[u], sizeof(H5FS_section_class_t));
/* Call the class initialization routine, if there is one */
if(fspace->sect_cls[u].init_cls)
diff --git a/src/H5FScache.c b/src/H5FScache.c
index ac0874e..7525a9a 100644
--- a/src/H5FScache.c
+++ b/src/H5FScache.c
@@ -38,6 +38,7 @@
#include "H5Fprivate.h" /* File */
#include "H5FSpkg.h" /* File free space */
#include "H5MFprivate.h" /* File memory management */
+#include "H5MMprivate.h" /* Memory management */
#include "H5VMprivate.h" /* Vectors and arrays */
#include "H5WBprivate.h" /* Wrapped Buffers */
@@ -707,7 +708,7 @@ H5FS__cache_hdr_serialize(const H5F_t *f, void *_image, size_t len,
(fspace->alloc_sect_size == (size_t)fspace->sect_size)));
/* Magic number */
- HDmemcpy(image, H5FS_HDR_MAGIC, (size_t)H5_SIZEOF_MAGIC);
+ H5MM_memcpy(image, H5FS_HDR_MAGIC, (size_t)H5_SIZEOF_MAGIC);
image += H5_SIZEOF_MAGIC;
/* Version # */
@@ -1265,7 +1266,7 @@ H5FS__cache_sinfo_serialize(const H5F_t *f, void *_image, size_t len,
HDassert(fspace->sect_cls);
/* Magic number */
- HDmemcpy(image, H5FS_SINFO_MAGIC, (size_t)H5_SIZEOF_MAGIC);
+ H5MM_memcpy(image, H5FS_SINFO_MAGIC, (size_t)H5_SIZEOF_MAGIC);
image += H5_SIZEOF_MAGIC;
/* Version # */
diff --git a/src/H5Faccum.c b/src/H5Faccum.c
index 0b33f8e..8d7852b 100644
--- a/src/H5Faccum.c
+++ b/src/H5Faccum.c
@@ -38,6 +38,7 @@
#include "H5Eprivate.h" /* Error handling */
#include "H5Fpkg.h" /* File access */
#include "H5FDprivate.h" /* File drivers */
+#include "H5MMprivate.h" /* Memory management */
#include "H5VMprivate.h" /* Vectors and arrays */
@@ -198,7 +199,7 @@ H5F__accum_read(H5F_t *f, H5FD_mem_t map_type, haddr_t addr,
} /* end if */
/* Copy the data out of the buffer */
- HDmemcpy(buf, accum->buf + (addr - new_addr), size);
+ H5MM_memcpy(buf, accum->buf + (addr - new_addr), size);
/* Adjust the accumulator address & size */
accum->loc = new_addr;
@@ -250,7 +251,7 @@ H5F__accum_read(H5F_t *f, H5FD_mem_t map_type, haddr_t addr,
} /* end else */
/* Copy the dirty region to buffer */
- HDmemcpy((unsigned char *)buf + buf_off, (unsigned char *)accum->buf + accum->dirty_off + dirty_off, overlap_size);
+ H5MM_memcpy((unsigned char *)buf + buf_off, (unsigned char *)accum->buf + accum->dirty_off + dirty_off, overlap_size);
} /* end if */
} /* end else */
} /* end if */
@@ -457,7 +458,7 @@ H5F__accum_write(H5F_t *f, H5FD_mem_t map_type, haddr_t addr,
HDmemmove(accum->buf + size, accum->buf, accum->size);
/* Copy the new metadata at the front */
- HDmemcpy(accum->buf, buf, size);
+ H5MM_memcpy(accum->buf, buf, size);
/* Set the new size & location of the metadata accumulator */
accum->loc = addr;
@@ -479,7 +480,7 @@ H5F__accum_write(H5F_t *f, H5FD_mem_t map_type, haddr_t addr,
HGOTO_ERROR(H5E_IO, H5E_CANTRESIZE, FAIL, "can't adjust metadata accumulator")
/* Copy the new metadata to the end */
- HDmemcpy(accum->buf + accum->size, buf, size);
+ H5MM_memcpy(accum->buf + accum->size, buf, size);
/* Adjust the dirty region and mark accumulator dirty */
if(accum->dirty)
@@ -502,7 +503,7 @@ H5F__accum_write(H5F_t *f, H5FD_mem_t map_type, haddr_t addr,
size_t dirty_off = (size_t)(addr - accum->loc);
/* Copy the new metadata to the proper location within the accumulator */
- HDmemcpy(accum->buf + dirty_off, buf, size);
+ H5MM_memcpy(accum->buf + dirty_off, buf, size);
/* Adjust the dirty region and mark accumulator dirty */
if(accum->dirty) {
@@ -545,7 +546,7 @@ H5F__accum_write(H5F_t *f, H5FD_mem_t map_type, haddr_t addr,
HDmemmove(accum->buf + size, accum->buf + old_offset, (accum->size - old_offset));
/* Copy the new metadata at the front */
- HDmemcpy(accum->buf, buf, size);
+ H5MM_memcpy(accum->buf, buf, size);
/* Set the new size & location of the metadata accumulator */
accum->loc = addr;
@@ -582,7 +583,7 @@ H5F__accum_write(H5F_t *f, H5FD_mem_t map_type, haddr_t addr,
dirty_off = (size_t)(addr - accum->loc);
/* Copy the new metadata to the end */
- HDmemcpy(accum->buf + dirty_off, buf, size);
+ H5MM_memcpy(accum->buf + dirty_off, buf, size);
/* Set the new size of the metadata accumulator */
accum->size += add_size;
@@ -625,7 +626,7 @@ H5F__accum_write(H5F_t *f, H5FD_mem_t map_type, haddr_t addr,
} /* end if */
/* Copy the new metadata to the buffer */
- HDmemcpy(accum->buf, buf, size);
+ H5MM_memcpy(accum->buf, buf, size);
/* Set the new size & location of the metadata accumulator */
accum->loc = addr;
@@ -688,7 +689,7 @@ H5F__accum_write(H5F_t *f, H5FD_mem_t map_type, haddr_t addr,
accum->size = size;
/* Store the piece of metadata in the accumulator */
- HDmemcpy(accum->buf, buf, size);
+ H5MM_memcpy(accum->buf, buf, size);
/* Adjust the dirty region and mark accumulator dirty */
accum->dirty_off = 0;
@@ -721,7 +722,7 @@ H5F__accum_write(H5F_t *f, H5FD_mem_t map_type, haddr_t addr,
accum->size = size;
/* Store the piece of metadata in the accumulator */
- HDmemcpy(accum->buf, buf, size);
+ H5MM_memcpy(accum->buf, buf, size);
/* Adjust the dirty region and mark accumulator dirty */
accum->dirty_off = 0;
diff --git a/src/H5Fint.c b/src/H5Fint.c
index dd8774a..bb092f3 100644
--- a/src/H5Fint.c
+++ b/src/H5Fint.c
@@ -509,6 +509,7 @@ H5F__get_objects_cb(void *obj_ptr, hid_t obj_id, void *key)
case H5I_ERROR_CLASS:
case H5I_ERROR_MSG:
case H5I_ERROR_STACK:
+ case H5I_SPACE_SEL_ITER:
case H5I_NTYPES:
default:
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5_ITER_ERROR, "unknown or invalid data object")
@@ -853,7 +854,7 @@ htri_t
H5F__is_hdf5(const char *name, hid_t fapl_id)
{
H5FD_t *file = NULL; /* Low-level file struct */
- haddr_t sig_addr; /* Addess of hdf5 file signature */
+ haddr_t sig_addr = HADDR_UNDEF; /* Addess of hdf5 file signature */
htri_t ret_value = FAIL; /* Return value */
FUNC_ENTER_PACKAGE
@@ -863,7 +864,7 @@ H5F__is_hdf5(const char *name, hid_t fapl_id)
* should work with arbitrary VFDs, unlike H5Fis_hdf5().
*/
if(NULL == (file = H5FD_open(name, H5F_ACC_RDONLY, fapl_id, HADDR_UNDEF)))
- HGOTO_ERROR(H5E_IO, H5E_CANTINIT, FAIL, "unable to open file")
+ HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, FAIL, "unable to open file")
/* The file is an hdf5 file if the hdf5 file signature can be found */
if(H5FD_locate_signature(file, &sig_addr) < 0)
@@ -874,7 +875,7 @@ done:
/* Close the file */
if(file)
if(H5FD_close(file) < 0 && TRUE == ret_value)
- HDONE_ERROR(H5E_IO, H5E_CANTCLOSEFILE, FAIL, "unable to close file")
+ HDONE_ERROR(H5E_FILE, H5E_CANTCLOSEFILE, FAIL, "unable to close file")
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5F__is_hdf5() */
@@ -1362,19 +1363,10 @@ H5F__dest(H5F_t *f, hbool_t flush)
HDONE_ERROR(H5E_FILE, H5E_CANTDEC, FAIL, "can't close property list")
/* Clean up the cached VOL connector ID & info */
- if(f->shared->vol_info) {
- H5VL_class_t *connector; /* Pointer to connector */
-
- /* Retrieve the connector for the ID */
- if(NULL == (connector = (H5VL_class_t *)H5I_object(f->shared->vol_id)))
- /* Push error, but keep going*/
- HDONE_ERROR(H5E_FILE, H5E_BADTYPE, FAIL, "not a VOL connector ID")
-
- /* Free the connector info */
- if(H5VL_free_connector_info(connector, f->shared->vol_info) < 0)
+ if(f->shared->vol_info)
+ if(H5VL_free_connector_info(f->shared->vol_id, f->shared->vol_info) < 0)
/* Push error, but keep going*/
HDONE_ERROR(H5E_FILE, H5E_CANTRELEASE, FAIL, "unable to release VOL connector info object")
- } /* end if */
if(f->shared->vol_id > 0)
if(H5I_dec_ref(f->shared->vol_id) < 0)
/* Push error, but keep going*/
@@ -3261,7 +3253,7 @@ H5F_get_metadata_read_retry_info(H5F_t *file, H5F_retry_info_t *info)
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed")
/* Copy the information */
- HDmemcpy(info->retries[j], file->shared->retries[i], tot_size);
+ H5MM_memcpy(info->retries[j], file->shared->retries[i], tot_size);
}
/* Increment location in info->retries[] array */
@@ -3343,7 +3335,7 @@ H5F__start_swmr_write(H5F_t *f)
HGOTO_ERROR(H5E_FILE, H5E_BADVALUE, FAIL, "file superblock version - should be at least 3")
/* Check for correct file format version */
- if((f->shared->low_bound != H5F_LIBVER_V110) || (f->shared->high_bound != H5F_LIBVER_V110))
+ if((f->shared->low_bound < H5F_LIBVER_V110) || (f->shared->high_bound < H5F_LIBVER_V110))
HGOTO_ERROR(H5E_FILE, H5E_BADVALUE, FAIL, "file format version does not support SWMR - needs to be 1.10 or greater")
/* Should not be marked for SWMR writing mode already */
@@ -3626,6 +3618,7 @@ H5F__get_file(void *obj, H5I_type_t type)
case H5I_ERROR_CLASS:
case H5I_ERROR_MSG:
case H5I_ERROR_STACK:
+ case H5I_SPACE_SEL_ITER:
case H5I_NTYPES:
default:
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a file or file object")
diff --git a/src/H5Fmpi.c b/src/H5Fmpi.c
index 6ddbfbb..5bbd717 100644
--- a/src/H5Fmpi.c
+++ b/src/H5Fmpi.c
@@ -94,7 +94,7 @@ H5F_get_mpi_handle(const H5F_t *f, MPI_File **f_handle)
FUNC_ENTER_NOAPI(FAIL)
- assert(f && f->shared);
+ HDassert(f && f->shared);
/* Dispatch to driver */
if ((ret_value = H5FD_get_vfd_handle(f->shared->lf, fapl, (void **)f_handle)) < 0)
diff --git a/src/H5Fprivate.h b/src/H5Fprivate.h
index 5f7a1b2..e9b6c32 100644
--- a/src/H5Fprivate.h
+++ b/src/H5Fprivate.h
@@ -28,6 +28,7 @@ typedef struct H5F_t H5F_t;
#include "H5FDpublic.h" /* File drivers */
/* Private headers needed by this file */
+#include "H5MMprivate.h" /* Memory management */
#ifdef H5_HAVE_PARALLEL
#include "H5Pprivate.h" /* Property lists */
#endif /* H5_HAVE_PARALLEL */
@@ -134,7 +135,7 @@ typedef struct H5F_t H5F_t;
\
HDcompile_assert(sizeof(double) == 8); \
HDcompile_assert(sizeof(double) == sizeof(uint64_t)); \
- HDmemcpy(&_n, &n, sizeof(double)); \
+ H5MM_memcpy(&_n, &n, sizeof(double)); \
for(_u = 0; _u < sizeof(uint64_t); _u++, _n >>= 8) \
*_p++ = (uint8_t)(_n & 0xff); \
(p) = (uint8_t *)(p) + 8; \
@@ -159,16 +160,16 @@ typedef struct H5F_t H5F_t;
(i) |= (uint16_t)((*(p) & 0xff) << 8); (p)++; \
}
-# define INT32DECODE(p, i) { \
- (i) = ((int32_t)(*(p) & (unsigned)0xff)); (p)++; \
- (i) |= ((int32_t)(*(p) & (unsigned)0xff) << 8); (p)++; \
- (i) |= ((int32_t)(*(p) & (unsigned)0xff) << 16); (p)++; \
- (i) |= ((int32_t)(((*(p) & (unsigned)0xff) << 24) | \
- ((*(p) & (unsigned)0x80) ? (unsigned)(~0xffffffff) : (unsigned)0x0))); (p)++; \
+# define INT32DECODE(p, i) { \
+ (i) = ((int32_t)(*(p) & 0xff)); (p)++; \
+ (i) |= ((int32_t)(*(p) & 0xff) << 8); (p)++; \
+ (i) |= ((int32_t)(*(p) & 0xff) << 16); (p)++; \
+ (i) |= ((int32_t)(((*(p) & (unsigned)0xff) << 24) | \
+ ((*(p) & 0x80) ? ~0xffffffffULL : 0x0ULL))); (p)++; \
}
-# define UINT32DECODE(p, i) { \
- (i) = (uint32_t)(*(p) & 0xff); (p)++; \
+# define UINT32DECODE(p, i) { \
+ (i) = (uint32_t)(*(p) & 0xff); (p)++; \
(i) |= ((uint32_t)(*(p) & 0xff) << 8); (p)++; \
(i) |= ((uint32_t)(*(p) & 0xff) << 16); (p)++; \
(i) |= ((uint32_t)(*(p) & 0xff) << 24); (p)++; \
@@ -240,7 +241,7 @@ typedef struct H5F_t H5F_t;
(p) += 8; \
for(_u = 0; _u < sizeof(uint64_t); _u++) \
_n = (_n << 8) | *(--p); \
- HDmemcpy(&(n), &_n, sizeof(double)); \
+ H5MM_memcpy(&(n), &_n, sizeof(double)); \
(p) += 8; \
}
@@ -701,8 +702,9 @@ typedef enum H5F_mem_page_t {
/* Type of prefix for opening prefixed files */
typedef enum H5F_prefix_open_t {
- H5F_PREFIX_VDS, /* Virtual dataset prefix */
- H5F_PREFIX_ELINK /* External link prefix */
+ H5F_PREFIX_VDS = 0, /* Virtual dataset prefix */
+ H5F_PREFIX_ELINK = 1, /* External link prefix */
+ H5F_PREFIX_EFILE = 2 /* External file prefix */
} H5F_prefix_open_t;
diff --git a/src/H5Fpublic.h b/src/H5Fpublic.h
index 9f1ed01..dd794e4 100644
--- a/src/H5Fpublic.h
+++ b/src/H5Fpublic.h
@@ -178,11 +178,12 @@ typedef enum H5F_libver_t {
H5F_LIBVER_ERROR = -1,
H5F_LIBVER_EARLIEST = 0, /* Use the earliest possible format for storing objects */
H5F_LIBVER_V18 = 1, /* Use the latest v18 format for storing objects */
- H5F_LIBVER_V110 = 2, /* Use the latest v10 format for storing objects */
+ H5F_LIBVER_V110 = 2, /* Use the latest v110 format for storing objects */
+ H5F_LIBVER_V112 = 3, /* Use the latest v112 format for storing objects */
H5F_LIBVER_NBOUNDS
} H5F_libver_t;
-#define H5F_LIBVER_LATEST H5F_LIBVER_V110
+#define H5F_LIBVER_LATEST H5F_LIBVER_V112
/* File space handling strategy */
typedef enum H5F_fspace_strategy_t {
@@ -232,9 +233,11 @@ H5_DLL hid_t H5Fopen(const char *filename, unsigned flags,
H5_DLL hid_t H5Freopen(hid_t file_id);
H5_DLL herr_t H5Fflush(hid_t object_id, H5F_scope_t scope);
H5_DLL herr_t H5Fclose(hid_t file_id);
+H5_DLL herr_t H5Fdelete(const char *filename, hid_t fapl_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_fileno(hid_t file_id, unsigned long *fileno);
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);
diff --git a/src/H5Fsuper.c b/src/H5Fsuper.c
index 489cc21..ef52844 100644
--- a/src/H5Fsuper.c
+++ b/src/H5Fsuper.c
@@ -76,6 +76,7 @@ H5FL_DEFINE(H5F_super_t);
static const unsigned HDF5_superblock_ver_bounds[] = {
HDF5_SUPERBLOCK_VERSION_DEF, /* H5F_LIBVER_EARLIEST */
HDF5_SUPERBLOCK_VERSION_2, /* H5F_LIBVER_V18 */
+ HDF5_SUPERBLOCK_VERSION_3, /* H5F_LIBVER_V110 */
HDF5_SUPERBLOCK_VERSION_LATEST /* H5F_LIBVER_LATEST */
};
@@ -512,15 +513,12 @@ H5F__super_read(H5F_t *f, H5P_genplist_t *fa_plist, hbool_t initial_read)
#endif /* H5_HAVE_PARALLEL */
/* Check if superblock address is different from base address and adjust
- * base address and "end of address" address if so.
+ * base address and "end of file" address if so.
*/
if(!H5F_addr_eq(super_addr, sblock->base_addr)) {
- /* Check if the superblock moved earlier in the file */
- if(H5F_addr_lt(super_addr, sblock->base_addr))
- udata.stored_eof -= (sblock->base_addr - super_addr);
- else
- /* The superblock moved later in the file */
- udata.stored_eof += (super_addr - sblock->base_addr);
+ /* If the superblock moved in the file, adjust the EOF */
+ /* (Handles moving earlier & later) */
+ udata.stored_eof -= (sblock->base_addr - super_addr);
/* Adjust base address for offsets of the HDF5 data in the file */
sblock->base_addr = super_addr;
@@ -555,7 +553,7 @@ H5F__super_read(H5F_t *f, H5P_genplist_t *fa_plist, hbool_t initial_read)
/* Set the B-tree internal node values, etc */
if(H5P_set(c_plist, H5F_CRT_BTREE_RANK_NAME, udata.btree_k) < 0)
HGOTO_ERROR(H5E_FILE, H5E_CANTSET, FAIL, "unable to set rank for btree internal nodes")
- HDmemcpy(sblock->btree_k, udata.btree_k, sizeof(unsigned) * (size_t)H5B_NUM_BTREE_ID);
+ H5MM_memcpy(sblock->btree_k, udata.btree_k, sizeof(unsigned) * (size_t)H5B_NUM_BTREE_ID);
} /* end if */
else {
/* Get the (default) B-tree internal node values, etc */
diff --git a/src/H5Fsuper_cache.c b/src/H5Fsuper_cache.c
index 361f8a1..125d6cf 100644
--- a/src/H5Fsuper_cache.c
+++ b/src/H5Fsuper_cache.c
@@ -269,7 +269,7 @@ H5F__drvrinfo_prefix_decode(H5O_drvinfo_t *drvrinfo, char *drv_name,
/* Driver name and/or version */
if(drv_name) {
- HDmemcpy(drv_name, (const char *)image, (size_t)8);
+ H5MM_memcpy(drv_name, (const char *)image, (size_t)8);
drv_name[8] = '\0';
image += 8; /* advance past name/version */
} /* end if */
@@ -682,7 +682,7 @@ H5F__cache_superblock_serialize(const H5F_t *f, void *_image, size_t H5_ATTR_UNU
HDassert(sblock->cache_info.flush_me_last);
/* Encode the common portion of the file superblock for all versions */
- HDmemcpy(image, H5F_SIGNATURE, (size_t)H5F_SIGNATURE_LEN);
+ H5MM_memcpy(image, H5F_SIGNATURE, (size_t)H5F_SIGNATURE_LEN);
image += H5F_SIGNATURE_LEN;
*image++ = (uint8_t)sblock->super_vers;
diff --git a/src/H5G.c b/src/H5G.c
index 20df130..fdf613c 100644
--- a/src/H5G.c
+++ b/src/H5G.c
@@ -320,7 +320,6 @@ H5Gcreate2(hid_t loc_id, const char *name, hid_t lcpl_id, hid_t gcpl_id,
void *grp = NULL; /* Structure for new group */
H5VL_object_t *vol_obj = NULL; /* object token of loc_id */
H5VL_loc_params_t loc_params;
- H5P_genplist_t *plist; /* Property list pointer */
hid_t ret_value = H5I_INVALID_HID; /* Return value */
FUNC_ENTER_API(H5I_INVALID_HID)
@@ -350,12 +349,6 @@ H5Gcreate2(hid_t loc_id, const char *name, hid_t lcpl_id, hid_t gcpl_id,
if(H5CX_set_apl(&gapl_id, H5P_CLS_GACC, loc_id, TRUE) < 0)
HGOTO_ERROR(H5E_SYM, H5E_CANTSET, H5I_INVALID_HID, "can't set access property list info")
- /* Get the gcpl structure and set the link properties on it */
- if(NULL == (plist = (H5P_genplist_t *)H5I_object(gcpl_id)))
- HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, H5I_INVALID_HID, "can't find object for ID")
- if(H5P_set(plist, H5VL_PROP_GRP_LCPL_ID, &lcpl_id) < 0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, H5I_INVALID_HID, "can't set property value for lcpl id")
-
/* Get the location object */
if(NULL == (vol_obj = (H5VL_object_t *)H5I_object(loc_id)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "invalid location identifier")
@@ -365,7 +358,7 @@ H5Gcreate2(hid_t loc_id, const char *name, hid_t lcpl_id, hid_t gcpl_id,
loc_params.obj_type = H5I_get_type(loc_id);
/* Create the group */
- if(NULL == (grp = H5VL_group_create(vol_obj, &loc_params, name, gcpl_id, gapl_id, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL)))
+ if(NULL == (grp = H5VL_group_create(vol_obj, &loc_params, name, lcpl_id, gcpl_id, gapl_id, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL)))
HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, H5I_INVALID_HID, "unable to create group")
/* Get an atom for the group */
@@ -444,7 +437,7 @@ H5Gcreate_anon(hid_t loc_id, hid_t gcpl_id, hid_t gapl_id)
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "invalid location identifier")
/* Create the group */
- if(NULL == (grp = H5VL_group_create(vol_obj, &loc_params, NULL, gcpl_id, gapl_id, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL)))
+ if(NULL == (grp = H5VL_group_create(vol_obj, &loc_params, NULL, H5P_LINK_CREATE_DEFAULT, gcpl_id, gapl_id, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL)))
HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, H5I_INVALID_HID, "unable to create group")
/* Get an atom for the group */
diff --git a/src/H5Gbtree2.c b/src/H5Gbtree2.c
index 721d591..71e0b2d 100644
--- a/src/H5Gbtree2.c
+++ b/src/H5Gbtree2.c
@@ -35,6 +35,7 @@
#include "H5private.h" /* Generic Functions */
#include "H5Eprivate.h" /* Error handling */
#include "H5Gpkg.h" /* Groups */
+#include "H5MMprivate.h" /* Memory management */
/****************/
@@ -206,7 +207,7 @@ H5G_dense_btree2_name_store(void *_nrecord, const void *_udata)
/* Copy user information info native record */
nrecord->hash = udata->common.name_hash;
- HDmemcpy(nrecord->id, udata->id, (size_t)H5G_DENSE_FHEAP_ID_LEN);
+ H5MM_memcpy(nrecord->id, udata->id, (size_t)H5G_DENSE_FHEAP_ID_LEN);
FUNC_LEAVE_NOAPI(SUCCEED)
} /* H5G_dense_btree2_name_store() */
@@ -305,7 +306,7 @@ H5G_dense_btree2_name_encode(uint8_t *raw, const void *_nrecord, void H5_ATTR_UN
/* Encode the record's fields */
UINT32ENCODE(raw, nrecord->hash)
- HDmemcpy(raw, nrecord->id, (size_t)H5G_DENSE_FHEAP_ID_LEN);
+ H5MM_memcpy(raw, nrecord->id, (size_t)H5G_DENSE_FHEAP_ID_LEN);
FUNC_LEAVE_NOAPI(SUCCEED)
} /* H5G_dense_btree2_name_encode() */
@@ -333,7 +334,7 @@ H5G_dense_btree2_name_decode(const uint8_t *raw, void *_nrecord, void H5_ATTR_UN
/* Decode the record's fields */
UINT32DECODE(raw, nrecord->hash)
- HDmemcpy(nrecord->id, raw, (size_t)H5G_DENSE_FHEAP_ID_LEN);
+ H5MM_memcpy(nrecord->id, raw, (size_t)H5G_DENSE_FHEAP_ID_LEN);
FUNC_LEAVE_NOAPI(SUCCEED)
} /* H5G_dense_btree2_name_decode() */
@@ -393,7 +394,7 @@ H5G_dense_btree2_corder_store(void *_nrecord, const void *_udata)
/* Copy user information info native record */
nrecord->corder = udata->common.corder;
- HDmemcpy(nrecord->id, udata->id, (size_t)H5G_DENSE_FHEAP_ID_LEN);
+ H5MM_memcpy(nrecord->id, udata->id, (size_t)H5G_DENSE_FHEAP_ID_LEN);
FUNC_LEAVE_NOAPI(SUCCEED)
} /* H5G_dense_btree2_corder_store() */
@@ -469,7 +470,7 @@ H5G_dense_btree2_corder_encode(uint8_t *raw, const void *_nrecord, void H5_ATTR_
/* Encode the record's fields */
INT64ENCODE(raw, nrecord->corder)
- HDmemcpy(raw, nrecord->id, (size_t)H5G_DENSE_FHEAP_ID_LEN);
+ H5MM_memcpy(raw, nrecord->id, (size_t)H5G_DENSE_FHEAP_ID_LEN);
FUNC_LEAVE_NOAPI(SUCCEED)
} /* H5G_dense_btree2_corder_encode() */
@@ -497,7 +498,7 @@ H5G_dense_btree2_corder_decode(const uint8_t *raw, void *_nrecord, void H5_ATTR_
/* Decode the record's fields */
INT64DECODE(raw, nrecord->corder)
- HDmemcpy(nrecord->id, raw, (size_t)H5G_DENSE_FHEAP_ID_LEN);
+ H5MM_memcpy(nrecord->id, raw, (size_t)H5G_DENSE_FHEAP_ID_LEN);
FUNC_LEAVE_NOAPI(SUCCEED)
} /* H5G_dense_btree2_corder_decode() */
diff --git a/src/H5Gcache.c b/src/H5Gcache.c
index b447cad..0ffdc53 100644
--- a/src/H5Gcache.c
+++ b/src/H5Gcache.c
@@ -36,6 +36,7 @@
#include "H5Eprivate.h" /* Error handling */
#include "H5Gpkg.h" /* Groups */
#include "H5MFprivate.h" /* File memory management */
+#include "H5MMprivate.h" /* Memory management */
#include "H5WBprivate.h" /* Wrapped Buffers */
@@ -287,7 +288,7 @@ H5G__cache_node_serialize(const H5F_t *f, void *_image, size_t len,
HDassert(len == sym->node_size);
/* magic number */
- HDmemcpy(image, H5G_NODE_MAGIC, (size_t)H5_SIZEOF_MAGIC);
+ H5MM_memcpy(image, H5G_NODE_MAGIC, (size_t)H5_SIZEOF_MAGIC);
image += H5_SIZEOF_MAGIC;
/* version number */
diff --git a/src/H5Gdeprec.c b/src/H5Gdeprec.c
index cb03b5e..95627d2 100644
--- a/src/H5Gdeprec.c
+++ b/src/H5Gdeprec.c
@@ -172,7 +172,6 @@ H5Gcreate1(hid_t loc_id, const char *name, size_t size_hint)
void *grp = NULL; /* New group created */
H5VL_object_t *vol_obj; /* Object token of loc_id */
H5VL_loc_params_t loc_params;
- H5P_genplist_t *plist; /* Property list pointer */
hid_t tmp_gcpl = H5I_INVALID_HID; /* Temporary group creation property list */
hid_t lcpl_id = H5P_LINK_CREATE_DEFAULT;
hid_t ret_value = H5I_INVALID_HID; /* Return value */
@@ -217,14 +216,6 @@ H5Gcreate1(hid_t loc_id, const char *name, size_t size_hint)
if(H5CX_set_loc(loc_id) < 0)
HGOTO_ERROR(H5E_SYM, H5E_CANTSET, H5I_INVALID_HID, "can't set collective metadata read info")
- /* Get the plist structure */
- if(NULL == (plist = (H5P_genplist_t *)H5I_object(tmp_gcpl)))
- HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, H5I_INVALID_HID, "can't find object for ID")
-
- /* get creation properties */
- if(H5P_set(plist, H5VL_PROP_GRP_LCPL_ID, &lcpl_id) < 0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, H5I_INVALID_HID, "can't get property value for lcpl id")
-
/* Set location parameters */
loc_params.type = H5VL_OBJECT_BY_SELF;
loc_params.obj_type = H5I_get_type(loc_id);
@@ -234,7 +225,7 @@ H5Gcreate1(hid_t loc_id, const char *name, size_t size_hint)
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "invalid location identifier")
/* Create the group */
- if(NULL == (grp = H5VL_group_create(vol_obj, &loc_params, name, tmp_gcpl, H5P_GROUP_ACCESS_DEFAULT, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL)))
+ if(NULL == (grp = H5VL_group_create(vol_obj, &loc_params, name, lcpl_id, tmp_gcpl, H5P_GROUP_ACCESS_DEFAULT, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL)))
HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, H5I_INVALID_HID, "unable to create group")
/* Get an atom for the group */
@@ -323,7 +314,6 @@ herr_t
H5Glink(hid_t cur_loc_id, H5G_link_t type, const char *cur_name, const char *new_name)
{
hid_t lcpl_id = H5P_LINK_CREATE_DEFAULT;
- H5P_genplist_t *plist; /* Property list pointer */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(FAIL)
@@ -339,10 +329,6 @@ H5Glink(hid_t cur_loc_id, H5G_link_t type, const char *cur_name, const char *new
if(H5CX_set_loc(cur_loc_id) < 0)
HGOTO_ERROR(H5E_SYM, H5E_CANTSET, FAIL, "can't set collective metadata read info")
- /* Get the plist structure */
- if(NULL == (plist = (H5P_genplist_t *)H5I_object(lcpl_id)))
- HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID")
-
/* Create link */
if(type == H5L_TYPE_HARD) {
H5VL_object_t *vol_obj; /* Object token of loc_id */
@@ -363,18 +349,12 @@ H5Glink(hid_t cur_loc_id, H5G_link_t type, const char *cur_name, const char *new
if(NULL == (vol_obj = (H5VL_object_t *)H5I_object(cur_loc_id)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier")
- /* set creation properties */
- if(H5P_set(plist, H5VL_PROP_LINK_TARGET, &vol_obj->data) < 0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't set property value for target")
- if(H5P_set(plist, H5VL_PROP_LINK_TARGET_LOC_PARAMS, &loc_params1) < 0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't set property value for target loc params")
-
/* Construct a temporary VOL object */
tmp_vol_obj.data = NULL;
tmp_vol_obj.connector = vol_obj->connector;
/* Create the link through the VOL */
- if(H5VL_link_create(H5VL_LINK_CREATE_HARD, &tmp_vol_obj, &loc_params2, lcpl_id, H5P_DEFAULT, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0)
+ if(H5VL_link_create(H5VL_LINK_CREATE_HARD, &tmp_vol_obj, &loc_params2, lcpl_id, H5P_DEFAULT, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, vol_obj->data, loc_params1) < 0)
HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to create link")
} /* end if */
else if(type == H5L_TYPE_SOFT) {
@@ -390,12 +370,8 @@ H5Glink(hid_t cur_loc_id, H5G_link_t type, const char *cur_name, const char *new
if(NULL == (vol_obj = (H5VL_object_t *)H5I_object(cur_loc_id)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier")
- /* set creation properties */
- if(H5P_set(plist, H5VL_PROP_LINK_TARGET_NAME, &cur_name) < 0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get property value for target name")
-
/* Create the link through the VOL */
- if(H5VL_link_create(H5VL_LINK_CREATE_SOFT, vol_obj, &loc_params, lcpl_id, H5P_DEFAULT, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0)
+ if(H5VL_link_create(H5VL_LINK_CREATE_SOFT, vol_obj, &loc_params, lcpl_id, H5P_DEFAULT, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, cur_name) < 0)
HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to create link")
} /* end else-if */
else
@@ -419,7 +395,6 @@ H5Glink2(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 = H5P_LINK_CREATE_DEFAULT;
- H5P_genplist_t *plist; /* Property list pointer */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(FAIL)
@@ -435,10 +410,6 @@ H5Glink2(hid_t cur_loc_id, const char *cur_name, H5G_link_t type,
if(H5CX_set_loc(cur_loc_id) < 0)
HGOTO_ERROR(H5E_SYM, H5E_CANTSET, FAIL, "can't set collective metadata read info")
- /* Get the plist structure */
- if(NULL == (plist = (H5P_genplist_t *)H5I_object(lcpl_id)))
- HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID")
-
/* Create the appropriate kind of link */
if(type == H5L_TYPE_HARD) {
H5VL_object_t *vol_obj1; /* Object token of loc_id */
@@ -462,14 +433,8 @@ H5Glink2(hid_t cur_loc_id, const char *cur_name, H5G_link_t type,
if(NULL == (vol_obj2 = (H5VL_object_t *)H5I_object(new_loc_id)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier")
- /* set creation properties */
- if(H5P_set(plist, H5VL_PROP_LINK_TARGET, &vol_obj1->data) < 0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't set property value for target id")
- if(H5P_set(plist, H5VL_PROP_LINK_TARGET_LOC_PARAMS, &loc_params1) < 0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't set property value for target name")
-
/* Create the link through the VOL */
- if(H5VL_link_create(H5VL_LINK_CREATE_HARD, vol_obj2, &loc_params2, lcpl_id, H5P_DEFAULT, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0)
+ if(H5VL_link_create(H5VL_LINK_CREATE_HARD, vol_obj2, &loc_params2, lcpl_id, H5P_DEFAULT, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, vol_obj1->data, loc_params1) < 0)
HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to create link")
} /* end if */
else if(type == H5L_TYPE_SOFT) {
@@ -490,12 +455,8 @@ H5Glink2(hid_t cur_loc_id, const char *cur_name, H5G_link_t type,
if(NULL == (vol_obj = (H5VL_object_t *)H5I_object(new_loc_id)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier")
- /* set creation properties */
- if(H5P_set(plist, H5VL_PROP_LINK_TARGET_NAME, &cur_name) < 0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get property value for target name")
-
/* Create the link through the VOL */
- if(H5VL_link_create(H5VL_LINK_CREATE_SOFT, vol_obj, &loc_params, lcpl_id, H5P_DEFAULT, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0)
+ if(H5VL_link_create(H5VL_LINK_CREATE_SOFT, vol_obj, &loc_params, lcpl_id, H5P_DEFAULT, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, cur_name) < 0)
HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to create link")
} /* end else-if */
else
diff --git a/src/H5Gent.c b/src/H5Gent.c
index baee35c..19aef10 100644
--- a/src/H5Gent.c
+++ b/src/H5Gent.c
@@ -32,6 +32,7 @@
#include "H5FLprivate.h" /* Free Lists */
#include "H5Gpkg.h" /* Groups */
#include "H5HLprivate.h" /* Local Heaps */
+#include "H5MMprivate.h" /* Memory management */
/****************/
@@ -331,7 +332,7 @@ H5G__ent_copy(H5G_entry_t *dst, const H5G_entry_t *src, H5_copy_depth_t depth)
HDassert(depth == H5_COPY_SHALLOW || depth == H5_COPY_DEEP);
/* Copy the top level information */
- HDmemcpy(dst, src, sizeof(H5G_entry_t));
+ H5MM_memcpy(dst, src, sizeof(H5G_entry_t));
/* Deep copy the names */
if(depth == H5_COPY_DEEP) {
diff --git a/src/H5Glink.c b/src/H5Glink.c
index 82a2dcf..04ccbc5 100644
--- a/src/H5Glink.c
+++ b/src/H5Glink.c
@@ -402,15 +402,14 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5G__link_sort_table
+ * Function: H5G__link_sort_table
*
* Purpose: Sort table containing a list of links for a group
*
- * Return: Success: Non-negative
- * Failure: Negative
+ * Return: SUCCEED/FAIL
*
- * Programmer: Quincey Koziol
- * Nov 20, 2006
+ * Programmer: Quincey Koziol
+ * Nov 20, 2006
*
*-------------------------------------------------------------------------
*/
@@ -418,11 +417,20 @@ herr_t
H5G__link_sort_table(H5G_link_table_t *ltable, H5_index_t idx_type,
H5_iter_order_t order)
{
+ herr_t ret_value = SUCCEED;
+
FUNC_ENTER_PACKAGE_NOERR
/* Sanity check */
HDassert(ltable);
+ /* Can't sort when empty since the links table will be NULL */
+ if(0 == ltable->nlinks)
+ HGOTO_DONE(ret_value);
+
+ /* This should never be NULL if the number of links is non-zero */
+ HDassert(ltable->lnks);
+
/* Pick appropriate sorting routine */
if(idx_type == H5_INDEX_NAME) {
if(order == H5_ITER_INC)
@@ -442,6 +450,7 @@ H5G__link_sort_table(H5G_link_table_t *ltable, H5_index_t idx_type,
HDassert(order == H5_ITER_NATIVE);
} /* end else */
+done:
FUNC_LEAVE_NOAPI(SUCCEED)
} /* end H5G__link_sort_table() */
diff --git a/src/H5Gloc.c b/src/H5Gloc.c
index 5724031..e47d3be 100644
--- a/src/H5Gloc.c
+++ b/src/H5Gloc.c
@@ -226,7 +226,10 @@ H5G_loc_real(void *obj, H5I_type_t type, H5G_loc_t *loc)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "unable to get group location of a virtual file driver (VFD)")
case H5I_VOL:
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "unable to get group location of a virtual object layer (VOL) driver")
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "unable to get group location of a virtual object layer (VOL) connector")
+
+ case H5I_SPACE_SEL_ITER:
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "unable to get group location of a dataspace selection iterator")
case H5I_UNINIT:
case H5I_BADID:
diff --git a/src/H5Gname.c b/src/H5Gname.c
index 2aece2b..16c1ca7 100644
--- a/src/H5Gname.c
+++ b/src/H5Gname.c
@@ -522,7 +522,7 @@ H5G_name_copy(H5G_name_t *dst, const H5G_name_t *src, H5_copy_depth_t depth)
HDassert(depth == H5_COPY_SHALLOW || depth == H5_COPY_DEEP);
/* Copy the top level information */
- HDmemcpy(dst, src, sizeof(H5G_name_t));
+ H5MM_memcpy(dst, src, sizeof(H5G_name_t));
/* Deep copy the names */
if(depth == H5_COPY_DEEP) {
@@ -828,6 +828,7 @@ H5G_name_replace_cb(void *obj_ptr, hid_t obj_id, void *key)
case H5I_ERROR_CLASS:
case H5I_ERROR_MSG:
case H5I_ERROR_STACK:
+ case H5I_SPACE_SEL_ITER:
case H5I_NTYPES:
default:
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "unknown data object")
diff --git a/src/H5Gnode.c b/src/H5Gnode.c
index 72b3633..b79b7d2 100644
--- a/src/H5Gnode.c
+++ b/src/H5Gnode.c
@@ -672,7 +672,7 @@ H5G__node_insert(H5F_t *f, haddr_t addr, void H5_ATTR_UNUSED *_lt_key,
if(NULL == (snrt = (H5G_node_t *)H5AC_protect(f, H5AC_SNODE, *new_node_p, f, H5AC__NO_FLAGS_SET)))
HGOTO_ERROR(H5E_SYM, H5E_CANTLOAD, H5B_INS_ERROR, "unable to split symbol table node")
- HDmemcpy(snrt->entry, sn->entry + H5F_SYM_LEAF_K(f),
+ H5MM_memcpy(snrt->entry, sn->entry + H5F_SYM_LEAF_K(f),
H5F_SYM_LEAF_K(f) * sizeof(H5G_entry_t));
snrt->nsyms = H5F_SYM_LEAF_K(f);
snrt_flags |= H5AC__DIRTIED_FLAG;
@@ -1262,7 +1262,7 @@ H5G__node_copy(H5F_t *f, const void H5_ATTR_UNUSED *_lt_key, haddr_t addr,
char *link_name; /* Pointer to value of soft link */
/* Make a temporary copy, so that it will not change the info in the cache */
- HDmemcpy(&tmp_src_ent, src_ent, sizeof(H5G_entry_t));
+ H5MM_memcpy(&tmp_src_ent, src_ent, sizeof(H5G_entry_t));
/* Set up group location for soft link to start in */
H5G_name_reset(&grp_path);
diff --git a/src/H5Gtest.c b/src/H5Gtest.c
index af6acb3..0b431b1 100644
--- a/src/H5Gtest.c
+++ b/src/H5Gtest.c
@@ -616,6 +616,7 @@ H5G__user_path_test(hid_t obj_id, char *user_path, size_t *user_path_len, unsign
case H5I_ERROR_CLASS:
case H5I_ERROR_MSG:
case H5I_ERROR_STACK:
+ case H5I_SPACE_SEL_ITER:
case H5I_NTYPES:
default:
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "unknown data object type")
diff --git a/src/H5Gtraverse.c b/src/H5Gtraverse.c
index d029bea..492b5b9 100644
--- a/src/H5Gtraverse.c
+++ b/src/H5Gtraverse.c
@@ -555,7 +555,7 @@ H5G__traverse_real(const H5G_loc_t *_loc, const char *name, unsigned target,
* Copy the component name into a null-terminated buffer so
* we can pass it down to the other symbol table functions.
*/
- HDmemcpy(comp, name, nchars);
+ H5MM_memcpy(comp, name, nchars);
comp[nchars] = '\0';
/*
@@ -670,7 +670,7 @@ H5G__traverse_real(const H5G_loc_t *_loc, const char *name, unsigned target,
/* Only keep the creation order information from the parent
* group's link info
*/
- HDmemcpy(&tmp_linfo, &def_linfo, sizeof(H5O_linfo_t));
+ H5MM_memcpy(&tmp_linfo, &def_linfo, sizeof(H5O_linfo_t));
tmp_linfo.track_corder = par_linfo.track_corder;
tmp_linfo.index_corder = par_linfo.index_corder;
linfo = &tmp_linfo;
diff --git a/src/H5HF.c b/src/H5HF.c
index 3df7e7b..5d52ca4 100644
--- a/src/H5HF.c
+++ b/src/H5HF.c
@@ -42,6 +42,8 @@
#include "H5FOprivate.h" /* File objects */
#include "H5HFpkg.h" /* Fractal heaps */
#include "H5MFprivate.h" /* File memory management */
+#include "H5MMprivate.h" /* Memory management */
+
/****************/
/* Local Macros */
@@ -104,7 +106,7 @@ H5HF_op_read(const void *obj, size_t obj_len, void *op_data)
FUNC_ENTER_NOAPI_NOINIT_NOERR
/* Perform "read", using memcpy() */
- HDmemcpy(op_data, obj, obj_len);
+ H5MM_memcpy(op_data, obj, obj_len);
FUNC_LEAVE_NOAPI(SUCCEED)
} /* end H5HF_op_read() */
@@ -129,7 +131,7 @@ H5HF_op_write(const void *obj, size_t obj_len, void *op_data)
FUNC_ENTER_NOAPI_NOINIT_NOERR
/* Perform "write", using memcpy() */
- HDmemcpy((void *)obj, op_data, obj_len); /* Casting away const OK -QAK */
+ H5MM_memcpy((void *)obj, op_data, obj_len); /* Casting away const OK -QAK */
FUNC_LEAVE_NOAPI(SUCCEED)
} /* end H5HF_op_write() */
diff --git a/src/H5HFcache.c b/src/H5HFcache.c
index 0c5d3aa..2d1c1f2 100644
--- a/src/H5HFcache.c
+++ b/src/H5HFcache.c
@@ -772,7 +772,7 @@ H5HF__cache_hdr_serialize(const H5F_t *f, void *_image, size_t len,
hdr->f = f;
/* Magic number */
- HDmemcpy(image, H5HF_HDR_MAGIC, (size_t)H5_SIZEOF_MAGIC);
+ H5MM_memcpy(image, H5HF_HDR_MAGIC, (size_t)H5_SIZEOF_MAGIC);
image += H5_SIZEOF_MAGIC;
/* Version # */
@@ -1362,7 +1362,7 @@ H5HF__cache_iblock_serialize(const H5F_t *f, void *_image, size_t len,
hdr->f = f;
/* Magic number */
- HDmemcpy(image, H5HF_IBLOCK_MAGIC, (size_t)H5_SIZEOF_MAGIC);
+ H5MM_memcpy(image, H5HF_IBLOCK_MAGIC, (size_t)H5_SIZEOF_MAGIC);
image += H5_SIZEOF_MAGIC;
/* Version # */
@@ -1677,7 +1677,7 @@ H5HF__cache_dblock_verify_chksum(const void *_image, size_t len, void *_udata)
/* Set up parameters for filter pipeline */
nbytes = len;
filter_mask = udata->filter_mask;
- HDmemcpy(read_buf, image, len);
+ H5MM_memcpy(read_buf, image, len);
/* Push direct block data through I/O filter pipeline */
if(H5Z_pipeline(&(hdr->pline), H5Z_FLAG_REVERSE, &filter_mask, H5Z_ENABLE_EDC, filter_cb, &nbytes, &len, &read_buf) < 0)
@@ -1724,7 +1724,7 @@ H5HF__cache_dblock_verify_chksum(const void *_image, size_t len, void *_udata)
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed")
/* Copy un-filtered data into block's buffer */
- HDmemcpy(udata->dblk, read_buf, len);
+ H5MM_memcpy(udata->dblk, read_buf, len);
} /* end if */
done:
@@ -1829,7 +1829,7 @@ H5HF__cache_dblock_deserialize(const void *_image, size_t len, void *_udata,
HGOTO_ERROR(H5E_HEAP, H5E_NOSPACE, NULL, "memory allocation failed for pipeline buffer")
/* Copy compressed image into buffer */
- HDmemcpy(read_buf, image, len);
+ H5MM_memcpy(read_buf, image, len);
/* Push direct block data through I/O filter pipeline */
nbytes = len;
@@ -1841,7 +1841,7 @@ H5HF__cache_dblock_deserialize(const void *_image, size_t len, void *_udata,
HDassert(nbytes == dblock->size);
/* Copy un-filtered data into block's buffer */
- HDmemcpy(dblock->blk, read_buf, dblock->size);
+ H5MM_memcpy(dblock->blk, read_buf, dblock->size);
} /* end if */
} /* end if */
else {
@@ -1856,7 +1856,7 @@ H5HF__cache_dblock_deserialize(const void *_image, size_t len, void *_udata,
/* Copy image to dblock->blk */
HDassert(dblock->size == len);
- HDmemcpy(dblock->blk, image, dblock->size);
+ H5MM_memcpy(dblock->blk, image, dblock->size);
} /* end else */
/* Start decoding direct block */
@@ -2146,7 +2146,7 @@ H5HF__cache_dblock_pre_serialize(H5F_t *f, void *_thing,
image = dblock->blk;
/* Magic number */
- HDmemcpy(image, H5HF_DBLOCK_MAGIC, (size_t)H5_SIZEOF_MAGIC);
+ H5MM_memcpy(image, H5HF_DBLOCK_MAGIC, (size_t)H5_SIZEOF_MAGIC);
image += H5_SIZEOF_MAGIC;
/* Version # */
@@ -2201,7 +2201,7 @@ H5HF__cache_dblock_pre_serialize(H5F_t *f, void *_thing,
HGOTO_ERROR(H5E_HEAP, H5E_NOSPACE, FAIL, "memory allocation failed for pipeline buffer")
/* Copy the direct block's image into the buffer to compress */
- HDmemcpy(write_buf, dblock->blk, write_size);
+ H5MM_memcpy(write_buf, dblock->blk, write_size);
/* Push direct block data through I/O filter pipeline */
nbytes = write_size;
@@ -2460,7 +2460,7 @@ H5HF__cache_dblock_serialize(const H5F_t *f, void *image, size_t len,
HDassert(dblock->write_size == len);
/* Copy the image from *(dblock->write_buf) to *image */
- HDmemcpy(image, dblock->write_buf, dblock->write_size);
+ H5MM_memcpy(image, dblock->write_buf, dblock->write_size);
/* Free *(dblock->write_buf) if it was allocated by the
* pre-serialize function
diff --git a/src/H5HFdbg.c b/src/H5HFdbg.c
index fc437dc..22de0c4 100644
--- a/src/H5HFdbg.c
+++ b/src/H5HFdbg.c
@@ -483,7 +483,7 @@ H5HF_dblock_debug_cb(H5FS_section_info_t *_sect, void *_udata)
/* Flag overlaps */
if (overlap)
- fprintf(udata->stream, "***THAT FREE BLOCK OVERLAPPED A PREVIOUS ONE!\n");
+ HDfprintf(udata->stream, "***THAT FREE BLOCK OVERLAPPED A PREVIOUS ONE!\n");
else
udata->amount_free += len;
} /* end if */
diff --git a/src/H5HFhdr.c b/src/H5HFhdr.c
index b014017..5750a03 100644
--- a/src/H5HFhdr.c
+++ b/src/H5HFhdr.c
@@ -36,6 +36,7 @@
#include "H5Eprivate.h" /* Error handling */
#include "H5HFpkg.h" /* Fractal heaps */
#include "H5MFprivate.h" /* File memory management */
+#include "H5MMprivate.h" /* Memory management */
#include "H5VMprivate.h" /* Vectors and arrays */
/****************/
@@ -387,7 +388,7 @@ H5HF_hdr_create(H5F_t *f, const H5HF_create_t *cparam)
/* Set the creation parameters for the heap */
hdr->max_man_size = cparam->max_man_size;
hdr->checksum_dblocks = cparam->checksum_dblocks;
- HDmemcpy(&(hdr->man_dtable.cparam), &(cparam->managed), sizeof(H5HF_dtable_cparam_t));
+ H5MM_memcpy(&(hdr->man_dtable.cparam), &(cparam->managed), sizeof(H5HF_dtable_cparam_t));
/* Set root table address to indicate that the heap is empty currently */
hdr->man_dtable.table_addr = HADDR_UNDEF;
diff --git a/src/H5HFhuge.c b/src/H5HFhuge.c
index 6e475ad..d496d62 100644
--- a/src/H5HFhuge.c
+++ b/src/H5HFhuge.c
@@ -355,7 +355,7 @@ HDfprintf(stderr, "%s: obj_size = %Zu\n", FUNC, obj_size);
write_size = obj_size;
if(NULL == (write_buf = H5MM_malloc(write_size)))
HGOTO_ERROR(H5E_HEAP, H5E_NOSPACE, FAIL, "memory allocation failed for pipeline buffer")
- HDmemcpy(write_buf, obj, write_size);
+ H5MM_memcpy(write_buf, obj, write_size);
/* Push direct block data through I/O filter pipeline */
nbytes = write_size;
@@ -794,7 +794,7 @@ H5HF__huge_op_real(H5HF_hdr_t *hdr, const uint8_t *id, hbool_t is_read,
/* Copy object to user's buffer if there's filters on heap data */
/* (if there's no filters, the object was read directly into the user's buffer) */
if(hdr->filter_len > 0)
- HDmemcpy(op_data, read_buf, (size_t)obj_size);
+ H5MM_memcpy(op_data, read_buf, (size_t)obj_size);
} /* end if */
else {
/* Call the user's 'op' callback */
diff --git a/src/H5HFman.c b/src/H5HFman.c
index 7f90f49..e5b5cb8 100644
--- a/src/H5HFman.c
+++ b/src/H5HFman.c
@@ -183,7 +183,7 @@ H5HF__man_insert(H5HF_hdr_t *hdr, size_t obj_size, const void *obj, void *_id)
p = dblock->blk + blk_off;
/* Copy the object's data into the heap */
- HDmemcpy(p, obj, obj_size);
+ H5MM_memcpy(p, obj, obj_size);
p += obj_size;
/* Sanity check */
diff --git a/src/H5HFsection.c b/src/H5HFsection.c
index 36e966e..f5ac8e5 100644
--- a/src/H5HFsection.c
+++ b/src/H5HFsection.c
@@ -3082,7 +3082,7 @@ H5HF__sect_indirect_reduce_row(H5HF_hdr_t *hdr, H5HF_free_section_t *row_sect,
HGOTO_ERROR(H5E_HEAP, H5E_CANTALLOC, FAIL, "allocation failed for row section pointer array")
/* Transfer row sections between current & peer sections */
- HDmemcpy(&peer_sect->u.indirect.dir_rows[0],
+ H5MM_memcpy(&peer_sect->u.indirect.dir_rows[0],
&sect->u.indirect.dir_rows[0],
(sizeof(H5HF_free_section_t *) * peer_dir_nrows));
HDmemmove(&sect->u.indirect.dir_rows[0],
@@ -3321,7 +3321,7 @@ H5HF__sect_indirect_reduce(H5HF_hdr_t *hdr, H5HF_free_section_t *sect,
HGOTO_ERROR(H5E_HEAP, H5E_CANTALLOC, FAIL, "allocation failed for indirect section pointer array")
/* Transfer child indirect sections between current & peer sections */
- HDmemcpy(&peer_sect->u.indirect.indir_ents[0],
+ H5MM_memcpy(&peer_sect->u.indirect.indir_ents[0],
&sect->u.indirect.indir_ents[sect->u.indirect.indir_nents - peer_nentries],
(sizeof(H5HF_free_section_t *) * peer_nentries));
sect->u.indirect.indir_nents -= (peer_nentries + 1); /* Transferred blocks, plus child entry */
@@ -3636,7 +3636,7 @@ H5HF__sect_indirect_merge_row(H5HF_hdr_t *hdr, H5HF_free_section_t *row_sect1,
sect1->u.indirect.dir_rows = new_dir_rows;
/* Transfer the second section's rows to first section */
- HDmemcpy(&sect1->u.indirect.dir_rows[sect1->u.indirect.dir_nrows],
+ H5MM_memcpy(&sect1->u.indirect.dir_rows[sect1->u.indirect.dir_nrows],
&sect2->u.indirect.dir_rows[src_row2],
(sizeof(H5HF_free_section_t *) * nrows_moved2));
@@ -3682,7 +3682,7 @@ H5HF__sect_indirect_merge_row(H5HF_hdr_t *hdr, H5HF_free_section_t *row_sect1,
sect1->u.indirect.indir_ents = new_indir_ents;
/* Transfer the second section's entries to first section */
- HDmemcpy(&sect1->u.indirect.indir_ents[sect1->u.indirect.indir_nents],
+ H5MM_memcpy(&sect1->u.indirect.indir_ents[sect1->u.indirect.indir_nents],
&sect2->u.indirect.indir_ents[0],
(sizeof(H5HF_free_section_t *) * sect2->u.indirect.indir_nents));
} /* end else */
diff --git a/src/H5HFtest.c b/src/H5HFtest.c
index 1b1f688..6f174bb 100644
--- a/src/H5HFtest.c
+++ b/src/H5HFtest.c
@@ -32,6 +32,8 @@
#include "H5private.h" /* Generic Functions */
#include "H5Eprivate.h" /* Error handling */
#include "H5HFpkg.h" /* Fractal heaps */
+#include "H5MMprivate.h" /* Memory management */
+
/****************/
/* Local Macros */
@@ -100,7 +102,7 @@ H5HF_get_cparam_test(const H5HF_t *fh, H5HF_create_t *cparam)
else
H5_CHECKED_ASSIGN(cparam->id_len, uint16_t, fh->hdr->id_len, unsigned);
cparam->max_man_size = fh->hdr->max_man_size;
- HDmemcpy(&(cparam->managed), &(fh->hdr->man_dtable.cparam), sizeof(H5HF_dtable_cparam_t));
+ H5MM_memcpy(&(cparam->managed), &(fh->hdr->man_dtable.cparam), sizeof(H5HF_dtable_cparam_t));
H5O_msg_copy(H5O_PLINE_ID, &(fh->hdr->pline), &(cparam->pline));
FUNC_LEAVE_NOAPI(SUCCEED)
diff --git a/src/H5HFtiny.c b/src/H5HFtiny.c
index 5cf1c08..0c27180 100644
--- a/src/H5HFtiny.c
+++ b/src/H5HFtiny.c
@@ -35,6 +35,7 @@
#include "H5private.h" /* Generic Functions */
#include "H5Eprivate.h" /* Error handling */
#include "H5HFpkg.h" /* Fractal heaps */
+#include "H5MMprivate.h" /* Memory management */
/****************/
@@ -176,7 +177,7 @@ HDfprintf(stderr, "%s: obj_size = %Zu\n", FUNC, obj_size);
*id++ = enc_obj_size & H5HF_TINY_MASK_EXT_2;
} /* end else */
- HDmemcpy(id, obj, obj_size);
+ H5MM_memcpy(id, obj, obj_size);
HDmemset(id + obj_size, 0, (hdr->id_len - ((size_t)1 + (size_t)hdr->tiny_len_extended + obj_size)));
/* Update statistics about heap */
diff --git a/src/H5HG.c b/src/H5HG.c
index df1c82d..231294b 100644
--- a/src/H5HG.c
+++ b/src/H5HG.c
@@ -168,7 +168,7 @@ H5HG__create(H5F_t *f, size_t size)
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, HADDR_UNDEF, "memory allocation failed")
/* Initialize the header */
- HDmemcpy(heap->chunk, H5HG_MAGIC, (size_t)H5_SIZEOF_MAGIC);
+ H5MM_memcpy(heap->chunk, H5HG_MAGIC, (size_t)H5_SIZEOF_MAGIC);
p = heap->chunk + H5_SIZEOF_MAGIC;
*p++ = H5HG_VERSION;
*p++ = 0; /*reserved*/
@@ -553,7 +553,7 @@ H5HG_insert(H5F_t *f, size_t size, void *obj, H5HG_t *hobj/*out*/)
/* Copy data into the heap */
if(size > 0) {
- HDmemcpy(heap->obj[idx].begin + H5HG_SIZEOF_OBJHDR(f), obj, size);
+ H5MM_memcpy(heap->obj[idx].begin + H5HG_SIZEOF_OBJHDR(f), obj, size);
#ifdef OLD_WAY
/* Don't bother zeroing out the rest of the info in the heap -QAK */
HDmemset(heap->obj[idx].begin + H5HG_SIZEOF_OBJHDR(f) + size, 0,
@@ -618,7 +618,7 @@ H5HG_read(H5F_t *f, H5HG_t *hobj, void *object/*out*/, size_t *buf_size)
/* Allocate a buffer for the object read in, if the user didn't give one */
if(!object && NULL == (object = H5MM_malloc(size)))
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed")
- HDmemcpy(object, p, size);
+ H5MM_memcpy(object, p, size);
/*
* Advance the heap in the CWFS list. We might have done this already
diff --git a/src/H5HGcache.c b/src/H5HGcache.c
index beaea7b..29e88df 100644
--- a/src/H5HGcache.c
+++ b/src/H5HGcache.c
@@ -271,7 +271,7 @@ H5HG__cache_heap_deserialize(const void *_image, size_t len, void *_udata,
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed")
/* Copy the image buffer into the newly allocate chunk */
- HDmemcpy(heap->chunk, _image, len);
+ H5MM_memcpy(heap->chunk, _image, len);
/* Deserialize the heap's header */
if(H5HG__hdr_deserialize(heap, (const uint8_t *)heap->chunk, f) < 0)
@@ -448,7 +448,7 @@ H5HG__cache_heap_serialize(const H5F_t *f, void *image, size_t len,
HDassert(heap->chunk);
/* copy the image into the buffer */
- HDmemcpy(image, heap->chunk, len);
+ H5MM_memcpy(image, heap->chunk, len);
FUNC_LEAVE_NOAPI(SUCCEED)
} /* end H5HG__cache_heap_serialize() */
diff --git a/src/H5HL.c b/src/H5HL.c
index 735077c..f290294 100644
--- a/src/H5HL.c
+++ b/src/H5HL.c
@@ -725,7 +725,7 @@ H5HL_insert(H5F_t *f, H5HL_t *heap, size_t buf_size, const void *buf))
} /* end if */
/* Copy the data into the heap */
- HDmemcpy(heap->dblk_image + offset, buf, buf_size);
+ H5MM_memcpy(heap->dblk_image + offset, buf, buf_size);
/* Set return value */
ret_value = offset;
diff --git a/src/H5HLcache.c b/src/H5HLcache.c
index 926f787..8b04b47 100644
--- a/src/H5HLcache.c
+++ b/src/H5HLcache.c
@@ -36,6 +36,7 @@
#include "H5Eprivate.h" /* Error handling */
#include "H5HLpkg.h" /* Local Heaps */
#include "H5MFprivate.h" /* File memory management */
+#include "H5MMprivate.h" /* Memory management */
#include "H5WBprivate.h" /* Wrapped Buffers */
@@ -464,7 +465,7 @@ H5HL__cache_prefix_deserialize(const void *_image, size_t len, void *_udata,
image = ((const uint8_t *)_image) + heap->prfx_size;
/* Copy the heap data from the speculative read buffer */
- HDmemcpy(heap->dblk_image, image, heap->dblk_size);
+ H5MM_memcpy(heap->dblk_image, image, heap->dblk_size);
/* Build free list */
if(H5HL__fl_deserialize(heap) < 0)
@@ -587,7 +588,7 @@ H5HL__cache_prefix_serialize(const H5F_t *f, void *_image, size_t len,
heap->free_block = heap->freelist ? heap->freelist->offset : H5HL_FREE_NULL;
/* Serialize the heap prefix */
- HDmemcpy(image, H5HL_MAGIC, (size_t)H5_SIZEOF_MAGIC);
+ H5MM_memcpy(image, H5HL_MAGIC, (size_t)H5_SIZEOF_MAGIC);
image += H5_SIZEOF_MAGIC;
*image++ = H5HL_VERSION;
*image++ = 0; /*reserved*/
@@ -615,7 +616,7 @@ H5HL__cache_prefix_serialize(const H5F_t *f, void *_image, size_t len,
H5HL__fl_serialize(heap);
/* Copy the heap data block into the cache image */
- HDmemcpy(image, heap->dblk_image, heap->dblk_size);
+ H5MM_memcpy(image, heap->dblk_image, heap->dblk_size);
/* Sanity check */
HDassert((size_t)(image - (uint8_t *)_image) + heap->dblk_size == len);
@@ -756,7 +757,7 @@ H5HL__cache_datablock_deserialize(const void *image, size_t len, void *_udata,
HGOTO_ERROR(H5E_HEAP, H5E_CANTALLOC, NULL, "can't allocate data block image buffer");
/* copy the datablock from the read buffer */
- HDmemcpy(heap->dblk_image, image, len);
+ H5MM_memcpy(heap->dblk_image, image, len);
/* Build free list */
if(FAIL == H5HL__fl_deserialize(heap))
@@ -851,7 +852,7 @@ H5HL__cache_datablock_serialize(const H5F_t *f, void *image, size_t len,
H5HL__fl_serialize(heap);
/* Copy the heap's data block into the cache's image */
- HDmemcpy(image, heap->dblk_image, heap->dblk_size);
+ H5MM_memcpy(image, heap->dblk_image, heap->dblk_size);
FUNC_LEAVE_NOAPI(SUCCEED)
} /* end H5HL__cache_datablock_serialize() */
diff --git a/src/H5I.c b/src/H5I.c
index ca9ff61..cdc849b 100644
--- a/src/H5I.c
+++ b/src/H5I.c
@@ -355,6 +355,9 @@ H5Itype_exists(H5I_type_t type)
FUNC_ENTER_API(FAIL)
H5TRACE1("t", "It", type);
+ if(H5I_IS_LIB_TYPE(type))
+ HGOTO_ERROR(H5E_ATOM, H5E_BADGROUP, FAIL, "cannot call public function on library type")
+
if (type <= H5I_BADID || type >= H5I_next_type)
HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, FAIL, "invalid type number")
@@ -1131,7 +1134,7 @@ done:
*
*-------------------------------------------------------------------------
*/
-void *
+static void *
H5I__remove_verify(hid_t id, H5I_type_t id_type)
{
void * ret_value = NULL; /*return value */
@@ -1940,6 +1943,8 @@ H5I__iterate_pub_cb(void H5_ATTR_UNUSED *obj, hid_t id, void *_udata)
ret_value = H5_ITER_STOP; /* terminate iteration early */
else if(cb_ret_val < 0)
ret_value = H5_ITER_ERROR; /* indicate failure (which terminates iteration) */
+ else
+ ret_value = H5_ITER_CONT; /* continue iteration */
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5I__iterate_pub_cb() */
@@ -2166,7 +2171,6 @@ H5Iget_name(hid_t id, char *name/*out*/, size_t size)
{
H5VL_object_t *vol_obj; /* Object token of loc_id */
H5VL_loc_params_t loc_params;
- H5G_loc_t loc; /* Object location */
ssize_t ret_value; /* Return value */
FUNC_ENTER_API((-1))
@@ -2181,7 +2185,7 @@ H5Iget_name(hid_t id, char *name/*out*/, size_t size)
loc_params.obj_type = H5I_get_type(id);
/* Retrieve object's name */
- if(H5VL_object_get(vol_obj, &loc_params, H5VL_ID_GET_NAME, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, &ret_value, name, size) < 0)
+ if(H5VL_object_get(vol_obj, &loc_params, H5VL_OBJECT_GET_NAME, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, &ret_value, name, size) < 0)
HGOTO_ERROR(H5E_ATOM, H5E_CANTGET, (-1), "can't retrieve object name")
done:
@@ -2379,6 +2383,7 @@ H5I__id_dump_cb(void *_item, void H5_ATTR_UNUSED *_key, void *_udata)
case H5I_ERROR_CLASS:
case H5I_ERROR_MSG:
case H5I_ERROR_STACK:
+ case H5I_SPACE_SEL_ITER:
case H5I_NTYPES:
default:
break; /* Other types of IDs are not stored in files */
diff --git a/src/H5Ipublic.h b/src/H5Ipublic.h
index 56873ec..def785f 100644
--- a/src/H5Ipublic.h
+++ b/src/H5Ipublic.h
@@ -46,6 +46,7 @@ typedef enum H5I_type_t {
H5I_ERROR_CLASS, /* type ID for error classes */
H5I_ERROR_MSG, /* type ID for error messages */
H5I_ERROR_STACK, /* type ID for error stacks */
+ H5I_SPACE_SEL_ITER, /* type ID for dataspace selection iterator */
H5I_NTYPES /* number of library types, MUST BE LAST! */
} H5I_type_t;
diff --git a/src/H5L.c b/src/H5L.c
index 1f45740..98976a6 100644
--- a/src/H5L.c
+++ b/src/H5L.c
@@ -449,7 +449,6 @@ H5Lcreate_soft(const char *link_target, hid_t link_loc_id, const char *link_name
{
H5VL_object_t *vol_obj = NULL; /* object token of loc_id */
H5VL_loc_params_t loc_params;
- H5P_genplist_t *plist = NULL; /* Property list pointer */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(FAIL)
@@ -483,20 +482,12 @@ H5Lcreate_soft(const char *link_target, hid_t link_loc_id, const char *link_name
if(NULL == (vol_obj = (H5VL_object_t *)H5VL_vol_object(link_loc_id)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier")
- /* Get the plist structure */
- if(NULL == (plist = (H5P_genplist_t *)H5I_object(lcpl_id)))
- HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID")
-
- /* set creation properties */
- if(H5P_set(plist, H5VL_PROP_LINK_TARGET_NAME, &link_target) < 0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get property value for target name")
-
/* Verify access property list and set up collective metadata if appropriate */
if(H5CX_set_apl(&lapl_id, H5P_CLS_LACC, link_loc_id, TRUE) < 0)
HGOTO_ERROR(H5E_LINK, H5E_CANTSET, FAIL, "can't set access property list info")
/* Create the link */
- if(H5VL_link_create(H5VL_LINK_CREATE_SOFT, vol_obj, &loc_params, lcpl_id, lapl_id, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0)
+ if(H5VL_link_create(H5VL_LINK_CREATE_SOFT, vol_obj, &loc_params, lcpl_id, lapl_id, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, link_target) < 0)
HGOTO_ERROR(H5E_LINK, H5E_CANTCREATE, FAIL, "unable to create soft link")
done:
@@ -529,7 +520,6 @@ H5Lcreate_hard(hid_t cur_loc_id, const char *cur_name,
H5VL_object_t tmp_vol_obj; /* Temporary object token of */
H5VL_loc_params_t loc_params1;
H5VL_loc_params_t loc_params2;
- H5P_genplist_t *plist; /* Property list pointer */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(FAIL)
@@ -583,22 +573,12 @@ H5Lcreate_hard(hid_t cur_loc_id, const char *cur_name,
if(vol_obj1->connector->cls->value != vol_obj2->connector->cls->value)
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "Objects are accessed through different VOL connectors and can't be linked")
- /* Get the link creation plist structure */
- if(NULL == (plist = (H5P_genplist_t *)H5I_object(lcpl_id)))
- HGOTO_ERROR(H5E_LINK, H5E_BADATOM, FAIL, "can't find object for ID")
-
- /* Set creation properties */
- if(H5P_set(plist, H5VL_PROP_LINK_TARGET, (vol_obj1 ? &(vol_obj1->data) : NULL)) < 0)
- HGOTO_ERROR(H5E_LINK, H5E_CANTGET, FAIL, "can't set property value for target id")
- if(H5P_set(plist, H5VL_PROP_LINK_TARGET_LOC_PARAMS, &loc_params1) < 0)
- HGOTO_ERROR(H5E_LINK, H5E_CANTGET, FAIL, "can't set property value for target name")
-
/* Construct a temporary VOL object */
tmp_vol_obj.data = (vol_obj2 ? (vol_obj2->data) : NULL);
tmp_vol_obj.connector = (vol_obj1 != NULL ? vol_obj1->connector : vol_obj2->connector);
/* Create the link */
- if(H5VL_link_create(H5VL_LINK_CREATE_HARD, &tmp_vol_obj, &loc_params2, lcpl_id, lapl_id, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0)
+ if(H5VL_link_create(H5VL_LINK_CREATE_HARD, &tmp_vol_obj, &loc_params2, lcpl_id, lapl_id, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, (vol_obj1 ? vol_obj1->data : NULL), loc_params1) < 0)
HGOTO_ERROR(H5E_LINK, H5E_CANTCREATE, FAIL, "unable to create hard link")
done:
@@ -636,7 +616,6 @@ H5Lcreate_ud(hid_t link_loc_id, const char *link_name, H5L_type_t link_type,
{
H5VL_object_t *vol_obj = NULL; /* Object token of loc_id */
H5VL_loc_params_t loc_params;
- H5P_genplist_t *plist; /* Property list pointer */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(FAIL)
@@ -668,20 +647,8 @@ H5Lcreate_ud(hid_t link_loc_id, const char *link_name, H5L_type_t link_type,
if(NULL == (vol_obj = (H5VL_object_t *)H5I_object(link_loc_id)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier")
- /* Get the plist structure */
- if(NULL == (plist = (H5P_genplist_t *)H5I_object(lcpl_id)))
- HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID")
-
- /* set creation properties */
- if(H5P_set(plist, H5VL_PROP_LINK_TYPE, &link_type) < 0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get property value from plist")
- if(H5P_set(plist, H5VL_PROP_LINK_UDATA, &udata) < 0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get property value from plist")
- if(H5P_set(plist, H5VL_PROP_LINK_UDATA_SIZE, &udata_size) < 0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get property value from plist")
-
/* Create external link */
- if(H5VL_link_create(H5VL_LINK_CREATE_UD, vol_obj, &loc_params, lcpl_id, lapl_id, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0)
+ if(H5VL_link_create(H5VL_LINK_CREATE_UD, vol_obj, &loc_params, lcpl_id, lapl_id, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, (int)link_type, udata, udata_size) < 0)
HGOTO_ERROR(H5E_LINK, H5E_CANTINIT, FAIL, "unable to create link")
done:
@@ -1676,7 +1643,7 @@ H5L_register(const H5L_class_t *cls)
} /* end if */
/* Copy link class info into table */
- HDmemcpy(H5L_table_g + i, cls, sizeof(H5L_class_t));
+ H5MM_memcpy(H5L_table_g + i, cls, sizeof(H5L_class_t));
done:
FUNC_LEAVE_NOAPI(ret_value)
@@ -2217,7 +2184,7 @@ H5L__create_ud(const H5G_loc_t *link_loc, const char *link_name,
/* Fill in UD link-specific information in the link struct*/
if(ud_data_size > 0) {
lnk.u.ud.udata = H5MM_malloc((size_t)ud_data_size);
- HDmemcpy(lnk.u.ud.udata, ud_data, (size_t) ud_data_size);
+ H5MM_memcpy(lnk.u.ud.udata, ud_data, (size_t) ud_data_size);
} /* end if */
else
lnk.u.ud.udata = NULL;
diff --git a/src/H5Lexternal.c b/src/H5Lexternal.c
index 0f3296f..3c4ffcc 100644
--- a/src/H5Lexternal.c
+++ b/src/H5Lexternal.c
@@ -306,7 +306,7 @@ H5L__extern_query(const char H5_ATTR_UNUSED * link_name, const void *_udata, siz
buf_size = udata_size;
/* Copy the udata verbatim up to buf_size */
- HDmemcpy(buf, udata, buf_size);
+ H5MM_memcpy(buf, udata, buf_size);
} /* end if */
/* Set return value */
@@ -349,7 +349,6 @@ H5Lcreate_external(const char *file_name, const char *obj_name,
size_t file_name_len; /* Length of file name string */
size_t norm_obj_name_len; /* Length of normalized object name string */
uint8_t *p; /* Pointer into external link buffer */
- H5P_genplist_t *plist; /* Property list pointer */
H5L_type_t link_type = H5L_TYPE_EXTERNAL;
herr_t ret_value = SUCCEED; /* Return value */
@@ -400,20 +399,8 @@ H5Lcreate_external(const char *file_name, const char *obj_name,
if(NULL == (vol_obj = (H5VL_object_t *)H5I_object(link_loc_id)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid object identifier")
- /* Get the plist structure */
- if(NULL == (plist = (H5P_genplist_t *)H5I_object(lcpl_id)))
- HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID")
-
- /* Set creation properties */
- if(H5P_set(plist, H5VL_PROP_LINK_TYPE, &link_type) < 0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get property value from plist")
- if(H5P_set(plist, H5VL_PROP_LINK_UDATA, &ext_link_buf) < 0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get property value from plist")
- if(H5P_set(plist, H5VL_PROP_LINK_UDATA_SIZE, &buf_size) < 0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get property value from plist")
-
/* Create an external link */
- if(H5VL_link_create(H5VL_LINK_CREATE_UD, vol_obj, &loc_params, lcpl_id, lapl_id, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0)
+ if(H5VL_link_create(H5VL_LINK_CREATE_UD, vol_obj, &loc_params, lcpl_id, lapl_id, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, (int)link_type, ext_link_buf, buf_size) < 0)
HGOTO_ERROR(H5E_LINK, H5E_CANTINIT, FAIL, "unable to create external link")
done:
diff --git a/src/H5MM.c b/src/H5MM.c
index 866dfbe..85d82a9 100644
--- a/src/H5MM.c
+++ b/src/H5MM.c
@@ -274,7 +274,7 @@ H5MM_malloc(size_t size)
#if defined H5_MEMORY_ALLOC_SANITY_CHECK
/* Initialize block list head singleton */
if(!H5MM_init_s) {
- HDmemcpy(H5MM_block_head_s.sig, H5MM_block_signature_s, H5MM_SIG_SIZE);
+ H5MM_memcpy(H5MM_block_head_s.sig, H5MM_block_signature_s, H5MM_SIG_SIZE);
H5MM_block_head_s.next = &H5MM_block_head_s;
H5MM_block_head_s.prev = &H5MM_block_head_s;
H5MM_block_head_s.u.info.size = SIZET_MAX;
@@ -291,15 +291,15 @@ H5MM_malloc(size_t size)
if(NULL != (block = (H5MM_block_t *)HDmalloc(alloc_size))) {
/* Set up block */
- HDmemcpy(block->sig, H5MM_block_signature_s, H5MM_SIG_SIZE);
+ H5MM_memcpy(block->sig, H5MM_block_signature_s, H5MM_SIG_SIZE);
block->next = H5MM_block_head_s.next;
H5MM_block_head_s.next = block;
block->next->prev = block;
block->prev = &H5MM_block_head_s;
block->u.info.size = size;
block->u.info.in_use = TRUE;
- HDmemcpy(block->b, H5MM_block_head_guard_s, H5MM_HEAD_GUARD_SIZE);
- HDmemcpy(block->b + H5MM_HEAD_GUARD_SIZE + size, H5MM_block_tail_guard_s, H5MM_TAIL_GUARD_SIZE);
+ H5MM_memcpy(block->b, H5MM_block_head_guard_s, H5MM_HEAD_GUARD_SIZE);
+ H5MM_memcpy(block->b + H5MM_HEAD_GUARD_SIZE + size, H5MM_block_tail_guard_s, H5MM_TAIL_GUARD_SIZE);
/* Update statistics */
H5MM_total_alloc_bytes_s += size;
@@ -417,7 +417,7 @@ H5MM_realloc(void *mem, size_t size)
H5MM__sanity_check(mem);
ret_value = H5MM_malloc(size);
- HDmemcpy(ret_value, mem, MIN(size, old_size));
+ H5MM_memcpy(ret_value, mem, MIN(size, old_size));
H5MM_xfree(mem);
} /* end if */
else
@@ -564,3 +564,39 @@ H5MM_xfree(void *mem)
FUNC_LEAVE_NOAPI(NULL)
} /* end H5MM_xfree() */
+
+/*-------------------------------------------------------------------------
+ * Function: H5MM_memcpy
+ *
+ * Purpose: Like memcpy(3) but with sanity checks on the parameters,
+ * particularly buffer overlap.
+ *
+ * Return: Success: pointer to dest
+ * Failure: NULL
+ *
+ * Programmer: Dana Robinson
+ * Spring 2019
+ *
+ *-------------------------------------------------------------------------
+ */
+void *
+H5MM_memcpy(void *dest, const void *src, size_t n)
+{
+ void *ret = NULL;
+
+ /* Use FUNC_ENTER_NOAPI_NOINIT_NOERR here to avoid performance issues */
+ FUNC_ENTER_NOAPI_NOINIT_NOERR
+
+ HDassert(dest);
+ HDassert(src);
+
+ /* Check for buffer overlap */
+ HDassert((char *)dest >= (const char *)src + n || (const char *)src >= (char *)dest + n);
+
+ /* Copy */
+ ret = HDmemcpy(dest, src, n);
+
+ FUNC_LEAVE_NOAPI(ret)
+
+} /* end H5MM_memcpy() */
+
diff --git a/src/H5MMprivate.h b/src/H5MMprivate.h
index 0524601..2053215 100644
--- a/src/H5MMprivate.h
+++ b/src/H5MMprivate.h
@@ -45,6 +45,7 @@ H5_DLL void *H5MM_realloc(void *mem, size_t size);
H5_DLL char *H5MM_xstrdup(const char *s);
H5_DLL char *H5MM_strdup(const char *s);
H5_DLL void *H5MM_xfree(void *mem);
+H5_DLL void *H5MM_memcpy(void *dest, const void *src, size_t n);
#if defined H5_MEMORY_ALLOC_SANITY_CHECK
H5_DLL void H5MM_sanity_check_all(void);
H5_DLL void H5MM_final_sanity_check(void);
diff --git a/src/H5O.c b/src/H5O.c
index 4e2f603..093d429 100644
--- a/src/H5O.c
+++ b/src/H5O.c
@@ -314,7 +314,6 @@ H5Olink(hid_t obj_id, hid_t new_loc_id, const char *new_name, hid_t lcpl_id,
H5VL_object_t tmp_vol_obj; /* Temporary object token of */
H5VL_loc_params_t loc_params1;
H5VL_loc_params_t loc_params2;
- H5P_genplist_t *plist; /* Property list pointer */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(FAIL)
@@ -363,22 +362,12 @@ H5Olink(hid_t obj_id, hid_t new_loc_id, const char *new_name, hid_t lcpl_id,
if (vol_obj1->connector->cls->value != vol_obj2->connector->cls->value)
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "Objects are accessed through different VOL connectors and can't be linked")
- /* Get the plist structure */
- if(NULL == (plist = (H5P_genplist_t *)H5I_object(lcpl_id)))
- HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID")
-
- /* set creation properties */
- if(H5P_set(plist, H5VL_PROP_LINK_TARGET, &vol_obj1->data) < 0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't set property value for target id")
- if(H5P_set(plist, H5VL_PROP_LINK_TARGET_LOC_PARAMS, &loc_params1) < 0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't set property value for target id")
-
/* Construct a temporary VOL object */
tmp_vol_obj.data = vol_obj2->data;
tmp_vol_obj.connector = (vol_obj1 != NULL ? vol_obj1->connector : vol_obj2->connector);
/* Create a link to the object */
- if(H5VL_link_create(H5VL_LINK_CREATE_HARD, &tmp_vol_obj, &loc_params2, lcpl_id, lapl_id, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0)
+ if(H5VL_link_create(H5VL_LINK_CREATE_HARD, &tmp_vol_obj, &loc_params2, lcpl_id, lapl_id, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, vol_obj1->data, loc_params1) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_CANTCREATE, FAIL, "unable to create link")
done:
@@ -1113,6 +1102,7 @@ H5Oclose(hid_t object_id)
case H5I_ERROR_CLASS:
case H5I_ERROR_MSG:
case H5I_ERROR_STACK:
+ case H5I_SPACE_SEL_ITER:
case H5I_NTYPES:
default:
HGOTO_ERROR(H5E_ARGS, H5E_CANTRELEASE, FAIL, "not a valid file object ID (dataset, group, or datatype)")
diff --git a/src/H5Oalloc.c b/src/H5Oalloc.c
index 23dd928..c1f90cb 100644
--- a/src/H5Oalloc.c
+++ b/src/H5Oalloc.c
@@ -36,6 +36,7 @@
#include "H5Eprivate.h" /* Error handling */
#include "H5FLprivate.h" /* Free lists */
#include "H5MFprivate.h" /* File memory management */
+#include "H5MMprivate.h" /* Memory management */
#include "H5Opkg.h" /* Object headers */
/****************/
@@ -949,7 +950,7 @@ H5O__alloc_chunk(H5F_t *f, H5O_t *oh, size_t size, size_t found_null,
* # at the beginning of the chunk image.
*/
if(oh->version > H5O_VERSION_1) {
- HDmemcpy(p, H5O_CHK_MAGIC, (size_t)H5_SIZEOF_MAGIC);
+ H5MM_memcpy(p, H5O_CHK_MAGIC, (size_t)H5_SIZEOF_MAGIC);
p += H5_SIZEOF_MAGIC;
} /* end if */
@@ -988,7 +989,7 @@ H5O__alloc_chunk(H5F_t *f, H5O_t *oh, size_t size, size_t found_null,
HDassert(curr_msg->type->id != H5O_CONT_ID);
/* Copy the raw data */
- HDmemcpy(p, curr_msg->raw - (size_t)H5O_SIZEOF_MSGHDR_OH(oh),
+ H5MM_memcpy(p, curr_msg->raw - (size_t)H5O_SIZEOF_MSGHDR_OH(oh),
curr_msg->raw_size + (size_t)H5O_SIZEOF_MSGHDR_OH(oh));
/* Update the message info */
@@ -1044,7 +1045,7 @@ H5O__alloc_chunk(H5F_t *f, H5O_t *oh, size_t size, size_t found_null,
null_msg->chunkno = oh->mesg[found_msg->msgno].chunkno;
/* Copy the message to move (& its prefix) to its new location */
- HDmemcpy(p, oh->mesg[found_msg->msgno].raw - H5O_SIZEOF_MSGHDR_OH(oh),
+ H5MM_memcpy(p, oh->mesg[found_msg->msgno].raw - H5O_SIZEOF_MSGHDR_OH(oh),
oh->mesg[found_msg->msgno].raw_size + (size_t)H5O_SIZEOF_MSGHDR_OH(oh));
/* Switch moved message to point to new location */
@@ -1519,7 +1520,7 @@ H5O__move_cont(H5F_t *f, H5O_t *oh, unsigned cont_u)
move_size = curr_msg->raw_size + (size_t)H5O_SIZEOF_MSGHDR_OH(oh);
/* Move message out of deleted chunk */
- HDmemcpy(move_start, curr_msg->raw - H5O_SIZEOF_MSGHDR_OH(oh), move_size);
+ H5MM_memcpy(move_start, curr_msg->raw - H5O_SIZEOF_MSGHDR_OH(oh), move_size);
curr_msg->raw = move_start + H5O_SIZEOF_MSGHDR_OH(oh);
curr_msg->chunkno = cont_chunkno;
chk_dirtied = TRUE;
@@ -1791,7 +1792,7 @@ H5O__move_msgs_forward(H5F_t *f, H5O_t *oh)
} /* end if */
/* Copy raw data for non-null message to new chunk */
- HDmemcpy(null_msg->raw - H5O_SIZEOF_MSGHDR_OH(oh), curr_msg->raw - H5O_SIZEOF_MSGHDR_OH(oh), curr_msg->raw_size + (size_t)H5O_SIZEOF_MSGHDR_OH(oh));
+ H5MM_memcpy(null_msg->raw - H5O_SIZEOF_MSGHDR_OH(oh), curr_msg->raw - H5O_SIZEOF_MSGHDR_OH(oh), curr_msg->raw_size + (size_t)H5O_SIZEOF_MSGHDR_OH(oh));
/* Point non-null message at null message's space */
curr_msg->chunkno = null_msg->chunkno;
diff --git a/src/H5Oattr.c b/src/H5Oattr.c
index c420046..f685a00c 100644
--- a/src/H5Oattr.c
+++ b/src/H5Oattr.c
@@ -200,7 +200,7 @@ H5O_attr_decode(H5F_t *f, H5O_t *open_oh, unsigned H5_ATTR_UNUSED mesg_flags,
* What's actually shared, though, is only the extent.
*/
if(NULL == (attr->shared->ds = H5FL_CALLOC(H5S_t)))
- HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed")
+ HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed")
/* Decode attribute's dataspace extent */
if((extent = (H5S_extent_t *)(H5O_MSG_SDSPACE->decode)(f, open_oh,
@@ -208,7 +208,7 @@ H5O_attr_decode(H5F_t *f, H5O_t *open_oh, unsigned H5_ATTR_UNUSED mesg_flags,
HGOTO_ERROR(H5E_ATTR, H5E_CANTDECODE, NULL, "can't decode attribute dataspace")
/* Copy the extent information to the dataspace */
- HDmemcpy(&(attr->shared->ds->extent), extent, sizeof(H5S_extent_t));
+ H5MM_memcpy(&(attr->shared->ds->extent), extent, sizeof(H5S_extent_t));
/* Release temporary extent information */
extent = H5FL_FREE(H5S_extent_t, extent);
@@ -240,7 +240,7 @@ H5O_attr_decode(H5F_t *f, H5O_t *open_oh, unsigned H5_ATTR_UNUSED mesg_flags,
if(attr->shared->data_size) {
if(NULL == (attr->shared->data = H5FL_BLK_MALLOC(attr_buf, attr->shared->data_size)))
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed")
- HDmemcpy(attr->shared->data, p, attr->shared->data_size);
+ H5MM_memcpy(attr->shared->data, p, attr->shared->data_size);
} /* end if */
/* Increment the reference count for this object header message in cache(compact
@@ -253,15 +253,11 @@ H5O_attr_decode(H5F_t *f, H5O_t *open_oh, unsigned H5_ATTR_UNUSED mesg_flags,
done:
if(NULL == ret_value)
if(attr) {
- if(attr->shared) {
- /* Free any dynamically allocated items */
- if(H5A__free(attr) < 0)
+ /* Free any dynamically allocated items */
+ if(attr->shared)
+ if(H5A__shared_free(attr) < 0)
HDONE_ERROR(H5E_ATTR, H5E_CANTRELEASE, NULL, "can't release attribute info")
- /* Destroy shared attribute struct */
- attr->shared = H5FL_FREE(H5A_shared_t, attr->shared);
- } /* end if */
-
attr = H5FL_FREE(H5A_t, attr);
} /* end if */
@@ -336,7 +332,7 @@ H5O_attr_encode(H5F_t *f, uint8_t *p, const void *mesg)
*p++ = attr->shared->encoding;
/* Write the name including null terminator */
- HDmemcpy(p, attr->shared->name, name_len);
+ H5MM_memcpy(p, attr->shared->name, name_len);
if(attr->shared->version < H5O_ATTR_VERSION_2) {
/* Pad to the correct number of bytes */
HDmemset(p + name_len, 0, H5O_ALIGN_OLD(name_len) - name_len);
@@ -369,7 +365,7 @@ H5O_attr_encode(H5F_t *f, uint8_t *p, const void *mesg)
/* Store attribute data. If there's no data, store 0 as fill value. */
if(attr->shared->data)
- HDmemcpy(p, attr->shared->data, attr->shared->data_size);
+ H5MM_memcpy(p, attr->shared->data, attr->shared->data_size);
else
HDmemset(p, 0, attr->shared->data_size);
diff --git a/src/H5Oattribute.c b/src/H5Oattribute.c
index 6e135c5..57ec9b8 100644
--- a/src/H5Oattribute.c
+++ b/src/H5Oattribute.c
@@ -862,7 +862,7 @@ H5O__attr_write_cb(H5O_t *oh, H5O_mesg_t *mesg/*in,out*/,
/* (Needs to occur before updating the shared message, or the hash
* value on the old & new messages will be the same) */
- HDmemcpy(((H5A_t *)mesg->native)->shared->data, udata->attr->shared->data, udata->attr->shared->data_size);
+ H5MM_memcpy(((H5A_t *)mesg->native)->shared->data, udata->attr->shared->data, udata->attr->shared->data_size);
} /* end if */
/* Mark the message as modified */
diff --git a/src/H5Ocache.c b/src/H5Ocache.c
index 578cff0..683d155 100644
--- a/src/H5Ocache.c
+++ b/src/H5Ocache.c
@@ -36,6 +36,7 @@
#include "H5Eprivate.h" /* Error handling */
#include "H5FLprivate.h" /* Free lists */
#include "H5MFprivate.h" /* File memory management */
+#include "H5MMprivate.h" /* Memory management */
#include "H5Opkg.h" /* Object headers */
#include "H5WBprivate.h" /* Wrapped Buffers */
@@ -542,7 +543,7 @@ H5O__cache_serialize(const H5F_t *f, void *image, size_t len, void *_thing)
* Can we rework things so that the object header and the cache
* share a buffer?
*/
- HDmemcpy(image, oh->chunk[0].image, len);
+ H5MM_memcpy(image, oh->chunk[0].image, len);
done:
FUNC_LEAVE_NOAPI(ret_value)
@@ -900,7 +901,7 @@ H5O__cache_chk_serialize(const H5F_t *f, void *image, size_t len, void *_thing)
/* copy the chunk into the image -- this is potentially expensive.
* Can we rework things so that the chunk and the cache share a buffer?
*/
- HDmemcpy(image, chk_proxy->oh->chunk[chk_proxy->chunkno].image, len);
+ H5MM_memcpy(image, chk_proxy->oh->chunk[chk_proxy->chunkno].image, len);
done:
FUNC_LEAVE_NOAPI(ret_value)
@@ -1352,7 +1353,7 @@ H5O__chunk_deserialize(H5O_t *oh, haddr_t addr, size_t len, const uint8_t *image
oh->chunk[chunkno].chunk_proxy = NULL;
/* Copy disk image into chunk's image */
- HDmemcpy(oh->chunk[chunkno].image, image, oh->chunk[chunkno].size);
+ H5MM_memcpy(oh->chunk[chunkno].image, image, oh->chunk[chunkno].size);
/* Point into chunk image to decode */
chunk_image = oh->chunk[chunkno].image;
diff --git a/src/H5Ocopy.c b/src/H5Ocopy.c
index a3d4884..9578f95 100644
--- a/src/H5Ocopy.c
+++ b/src/H5Ocopy.c
@@ -732,7 +732,7 @@ H5O__copy_header_real(const H5O_loc_t *oloc_src, H5O_loc_t *oloc_dst /*out*/,
* header. This will be written when the header is flushed to disk.
*/
if(oh_dst->version > H5O_VERSION_1)
- HDmemcpy(current_pos, H5O_HDR_MAGIC, (size_t)H5_SIZEOF_MAGIC);
+ H5MM_memcpy(current_pos, H5O_HDR_MAGIC, (size_t)H5_SIZEOF_MAGIC);
current_pos += H5O_SIZEOF_HDR(oh_dst) - H5O_SIZEOF_CHKSUM_OH(oh_dst);
/* Loop through destination messages, updating their "raw" info */
@@ -755,7 +755,7 @@ H5O__copy_header_real(const H5O_loc_t *oloc_src, H5O_loc_t *oloc_dst /*out*/,
/* Copy each message that wasn't dirtied above */
if(!mesg_dst->dirty)
/* Copy the message header plus the message's raw data. */
- HDmemcpy(current_pos, mesg_src->raw - msghdr_size, msghdr_size + mesg_src->raw_size);
+ H5MM_memcpy(current_pos, mesg_src->raw - msghdr_size, msghdr_size + mesg_src->raw_size);
/* Set message's raw pointer to destination chunk's new "image" */
mesg_dst->raw = current_pos + msghdr_size;
diff --git a/src/H5Odrvinfo.c b/src/H5Odrvinfo.c
index 159c950..eb678e4 100644
--- a/src/H5Odrvinfo.c
+++ b/src/H5Odrvinfo.c
@@ -101,7 +101,7 @@ H5O_drvinfo_decode(H5F_t H5_ATTR_UNUSED *f, H5O_t H5_ATTR_UNUSED *open_oh,
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed for driver info message")
/* Retrieve driver name */
- HDmemcpy(mesg->name, p, 8);
+ H5MM_memcpy(mesg->name, p, 8);
mesg->name[8] = '\0';
p += 8;
@@ -116,7 +116,7 @@ H5O_drvinfo_decode(H5F_t H5_ATTR_UNUSED *f, H5O_t H5_ATTR_UNUSED *open_oh,
} /* end if */
/* Copy encoded driver info into buffer */
- HDmemcpy(mesg->buf, p, mesg->len);
+ H5MM_memcpy(mesg->buf, p, mesg->len);
/* Set return value */
ret_value = (void *)mesg;
@@ -152,11 +152,11 @@ H5O_drvinfo_encode(H5F_t H5_ATTR_UNUSED *f, hbool_t H5_ATTR_UNUSED disable_share
/* Store version, driver name, buffer length, & encoded buffer */
*p++ = H5O_DRVINFO_VERSION;
- HDmemcpy(p, mesg->name, 8);
+ H5MM_memcpy(p, mesg->name, 8);
p += 8;
HDassert(mesg->len <= 65535);
UINT16ENCODE(p, mesg->len);
- HDmemcpy(p, mesg->buf, mesg->len);
+ H5MM_memcpy(p, mesg->buf, mesg->len);
FUNC_LEAVE_NOAPI(SUCCEED)
} /* end H5O_drvinfo_encode() */
@@ -200,7 +200,7 @@ H5O_drvinfo_copy(const void *_mesg, void *_dest)
dest = (H5O_drvinfo_t *)H5MM_xfree(dest);
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed")
} /* end if */
- HDmemcpy(dest->buf, mesg->buf, mesg->len);
+ H5MM_memcpy(dest->buf, mesg->buf, mesg->len);
/* Set return value */
ret_value = dest;
diff --git a/src/H5Odtype.c b/src/H5Odtype.c
index 28970d1..39d8bac 100644
--- a/src/H5Odtype.c
+++ b/src/H5Odtype.c
@@ -250,7 +250,7 @@ H5O_dtype_decode_helper(H5F_t *f, unsigned *ioflags/*in,out*/, const uint8_t **p
HDassert(0 == (z & 0x7)); /*must be aligned*/
if(NULL == (dt->shared->u.opaque.tag = (char *)H5MM_malloc(z + 1)))
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed")
- HDmemcpy(dt->shared->u.opaque.tag, *pp, z);
+ H5MM_memcpy(dt->shared->u.opaque.tag, *pp, z);
dt->shared->u.opaque.tag[z] = '\0';
*pp += z;
break;
@@ -483,7 +483,7 @@ H5O_dtype_decode_helper(H5F_t *f, unsigned *ioflags/*in,out*/, const uint8_t **p
} /* end for */
/* Values */
- HDmemcpy(dt->shared->u.enumer.value, *pp,
+ H5MM_memcpy(dt->shared->u.enumer.value, *pp,
dt->shared->u.enumer.nmembs * dt->shared->parent->shared->size);
*pp += dt->shared->u.enumer.nmembs * dt->shared->parent->shared->size;
break;
@@ -882,7 +882,7 @@ H5O_dtype_encode_helper(const H5F_t *f, uint8_t **pp, const H5T_t *dt)
z = HDstrlen(dt->shared->u.opaque.tag);
aligned = (z + 7) & (H5T_OPAQUE_TAG_MAX - 8);
flags = (unsigned)(flags | aligned);
- HDmemcpy(*pp, dt->shared->u.opaque.tag, MIN(z,aligned));
+ H5MM_memcpy(*pp, dt->shared->u.opaque.tag, MIN(z,aligned));
for(n = MIN(z, aligned); n < aligned; n++)
(*pp)[n] = 0;
*pp += aligned;
@@ -997,7 +997,7 @@ H5O_dtype_encode_helper(const H5F_t *f, uint8_t **pp, const H5T_t *dt)
} /* end for */
/* Values */
- HDmemcpy(*pp, dt->shared->u.enumer.value, dt->shared->u.enumer.nmembs * dt->shared->parent->shared->size);
+ H5MM_memcpy(*pp, dt->shared->u.enumer.value, dt->shared->u.enumer.nmembs * dt->shared->parent->shared->size);
*pp += dt->shared->u.enumer.nmembs * dt->shared->parent->shared->size;
break;
diff --git a/src/H5Oefl.c b/src/H5Oefl.c
index 6a81a46..b18d819 100644
--- a/src/H5Oefl.c
+++ b/src/H5Oefl.c
@@ -461,7 +461,7 @@ H5O__efl_copy_file(H5F_t H5_ATTR_UNUSED *file_src, void *mesg_src, H5F_t *file_d
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed")
/* Copy the "top level" information */
- HDmemcpy(efl_dst, efl_src, sizeof(H5O_efl_t));
+ H5MM_memcpy(efl_dst, efl_src, sizeof(H5O_efl_t));
/* Determine size needed for destination heap */
heap_size = H5HL_ALIGN(1); /* "empty" name */
@@ -488,7 +488,7 @@ H5O__efl_copy_file(H5F_t H5_ATTR_UNUSED *file_src, void *mesg_src, H5F_t *file_d
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed")
/* copy content from the source. Need to update later */
- HDmemcpy(efl_dst->slot, efl_src->slot, size);
+ H5MM_memcpy(efl_dst->slot, efl_src->slot, size);
} /* end if */
/* copy the name from the source */
diff --git a/src/H5Ofill.c b/src/H5Ofill.c
index 125da36..53abff3 100644
--- a/src/H5Ofill.c
+++ b/src/H5Ofill.c
@@ -156,7 +156,8 @@ const H5O_msg_class_t H5O_MSG_FILL_NEW[1] = {{
/* Format version bounds for fill value */
const unsigned H5O_fill_ver_bounds[] = {
H5O_FILL_VERSION_1, /* H5F_LIBVER_EARLIEST */
- H5O_FILL_VERSION_2, /* H5F_LIBVER_V18 */
+ H5O_FILL_VERSION_3, /* H5F_LIBVER_V18 */
+ H5O_FILL_VERSION_3, /* H5F_LIBVER_V110 */
H5O_FILL_VERSION_LATEST /* H5F_LIBVER_LATEST */
};
@@ -232,7 +233,7 @@ H5O_fill_new_decode(H5F_t H5_ATTR_UNUSED *f, H5O_t H5_ATTR_UNUSED *open_oh,
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "destination buffer too small")
if(NULL == (fill->buf = H5MM_malloc((size_t)fill->size)))
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed for fill value")
- HDmemcpy(fill->buf, p, (size_t)fill->size);
+ H5MM_memcpy(fill->buf, p, (size_t)fill->size);
} /* end if */
} /* end if */
else
@@ -270,7 +271,7 @@ H5O_fill_new_decode(H5F_t H5_ATTR_UNUSED *f, H5O_t H5_ATTR_UNUSED *open_oh,
H5_CHECK_OVERFLOW(fill->size, ssize_t, size_t);
if(NULL == (fill->buf = H5MM_malloc((size_t)fill->size)))
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed for fill value")
- HDmemcpy(fill->buf, p, (size_t)fill->size);
+ H5MM_memcpy(fill->buf, p, (size_t)fill->size);
/* Set the "defined" flag */
fill->fill_defined = TRUE;
@@ -353,7 +354,7 @@ H5O_fill_old_decode(H5F_t *f, H5O_t *open_oh,
if(NULL == (fill->buf = H5MM_malloc((size_t)fill->size)))
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed for fill value")
- HDmemcpy(fill->buf, p, (size_t)fill->size);
+ H5MM_memcpy(fill->buf, p, (size_t)fill->size);
fill->fill_defined = TRUE;
} /* end if */
else
@@ -420,7 +421,7 @@ H5O_fill_new_encode(H5F_t H5_ATTR_UNUSED *f, uint8_t *p, const void *_fill)
if(fill->size > 0)
if(fill->buf) {
H5_CHECK_OVERFLOW(fill->size, ssize_t, size_t);
- HDmemcpy(p, fill->buf, (size_t)fill->size);
+ H5MM_memcpy(p, fill->buf, (size_t)fill->size);
} /* end if */
} /* end if */
} /* end if */
@@ -459,7 +460,7 @@ H5O_fill_new_encode(H5F_t H5_ATTR_UNUSED *f, uint8_t *p, const void *_fill)
/* Encode the fill value */
HDassert(fill->buf);
H5_CHECK_OVERFLOW(fill->size, ssize_t, size_t);
- HDmemcpy(p, fill->buf, (size_t)fill->size);
+ H5MM_memcpy(p, fill->buf, (size_t)fill->size);
} /* end if */
else {
/* Flags */
@@ -499,7 +500,7 @@ H5O_fill_old_encode(H5F_t H5_ATTR_UNUSED *f, uint8_t *p, const void *_fill)
UINT32ENCODE(p, fill->size);
if(fill->buf)
- HDmemcpy(p, fill->buf, (size_t)fill->size);
+ H5MM_memcpy(p, fill->buf, (size_t)fill->size);
FUNC_LEAVE_NOAPI(SUCCEED)
} /* end H5O_fill_old_encode() */
@@ -551,7 +552,7 @@ H5O_fill_copy(const void *_src, void *_dst)
H5_CHECK_OVERFLOW(src->size, ssize_t, size_t);
if(NULL == (dst->buf = H5MM_malloc((size_t)src->size)))
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed for fill value")
- HDmemcpy(dst->buf, src->buf, (size_t)src->size);
+ H5MM_memcpy(dst->buf, src->buf, (size_t)src->size);
/* Check for needing to convert/copy fill value */
if(src->type) {
@@ -890,40 +891,40 @@ H5O__fill_debug(H5F_t H5_ATTR_UNUSED *f, const void *_fill, FILE *stream,
HDfprintf(stream, "%*s%-*s ", indent, "", fwidth, "Space Allocation Time:");
switch(fill->alloc_time) {
case H5D_ALLOC_TIME_EARLY:
- fprintf(stream,"Early\n");
+ HDfprintf(stream,"Early\n");
break;
case H5D_ALLOC_TIME_LATE:
- fprintf(stream,"Late\n");
+ HDfprintf(stream,"Late\n");
break;
case H5D_ALLOC_TIME_INCR:
- fprintf(stream,"Incremental\n");
+ HDfprintf(stream,"Incremental\n");
break;
case H5D_ALLOC_TIME_DEFAULT:
case H5D_ALLOC_TIME_ERROR:
default:
- fprintf(stream,"Unknown!\n");
+ HDfprintf(stream,"Unknown!\n");
break;
} /* end switch */
HDfprintf(stream, "%*s%-*s ", indent, "", fwidth, "Fill Time:");
switch(fill->fill_time) {
case H5D_FILL_TIME_ALLOC:
- fprintf(stream,"On Allocation\n");
+ HDfprintf(stream,"On Allocation\n");
break;
case H5D_FILL_TIME_NEVER:
- fprintf(stream,"Never\n");
+ HDfprintf(stream,"Never\n");
break;
case H5D_FILL_TIME_IFSET:
- fprintf(stream,"If Set\n");
+ HDfprintf(stream,"If Set\n");
break;
case H5D_FILL_TIME_ERROR:
default:
- fprintf(stream,"Unknown!\n");
+ HDfprintf(stream,"Unknown!\n");
break;
} /* end switch */
@@ -931,20 +932,20 @@ H5O__fill_debug(H5F_t H5_ATTR_UNUSED *f, const void *_fill, FILE *stream,
H5P_is_fill_value_defined((const H5O_fill_t *)fill, &fill_status);
switch(fill_status) {
case H5D_FILL_VALUE_UNDEFINED:
- fprintf(stream,"Undefined\n");
+ HDfprintf(stream,"Undefined\n");
break;
case H5D_FILL_VALUE_DEFAULT:
- fprintf(stream,"Default\n");
+ HDfprintf(stream,"Default\n");
break;
case H5D_FILL_VALUE_USER_DEFINED:
- fprintf(stream,"User Defined\n");
+ HDfprintf(stream,"User Defined\n");
break;
case H5D_FILL_VALUE_ERROR:
default:
- fprintf(stream,"Unknown!\n");
+ HDfprintf(stream,"Unknown!\n");
break;
} /* end switch */
@@ -1025,7 +1026,7 @@ H5O_fill_convert(H5O_fill_t *fill, H5T_t *dset_type, hbool_t *fill_changed)
else {
if(NULL == (buf = H5MM_malloc(H5T_get_size(dset_type))))
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed for type conversion")
- HDmemcpy(buf, fill->buf, H5T_get_size(fill->type));
+ H5MM_memcpy(buf, fill->buf, H5T_get_size(fill->type));
} /* end else */
/* Use CALLOC here to clear the buffer in case later the library thinks there's
diff --git a/src/H5Oflush.c b/src/H5Oflush.c
index da9d1d0..f5ede4a 100644
--- a/src/H5Oflush.c
+++ b/src/H5Oflush.c
@@ -491,6 +491,7 @@ H5O_refresh_metadata_reopen(hid_t oid, H5G_loc_t *obj_loc, H5VL_t *vol_connector
case H5I_ERROR_CLASS:
case H5I_ERROR_MSG:
case H5I_ERROR_STACK:
+ case H5I_SPACE_SEL_ITER:
case H5I_NTYPES:
default:
HGOTO_ERROR(H5E_OHDR, H5E_BADTYPE, FAIL, "not a valid file object ID (dataset, group, or datatype)")
diff --git a/src/H5Oint.c b/src/H5Oint.c
index d3a409c..45a8046 100644
--- a/src/H5Oint.c
+++ b/src/H5Oint.c
@@ -38,9 +38,7 @@
#include "H5Iprivate.h" /* IDs */
#include "H5Lprivate.h" /* Links */
#include "H5MFprivate.h" /* File memory management */
-#ifdef H5O_ENABLE_BOGUS
#include "H5MMprivate.h" /* Memory management */
-#endif /* H5O_ENABLE_BOGUS */
#include "H5Opkg.h" /* Object headers */
#include "H5VLprivate.h" /* Virtual Object Layer */
@@ -132,6 +130,7 @@ const H5O_msg_class_t *const H5O_msg_class_g[] = {
const unsigned H5O_obj_ver_bounds[] = {
H5O_VERSION_1, /* H5F_LIBVER_EARLIEST */
H5O_VERSION_2, /* H5F_LIBVER_V18 */
+ H5O_VERSION_2, /* H5F_LIBVER_V110 */
H5O_VERSION_LATEST /* H5F_LIBVER_LATEST */
};
@@ -496,7 +495,7 @@ H5O__apply_ohdr(H5F_t *f, H5O_t *oh, hid_t ocpl_id, size_t size_hint, size_t ini
/* Put magic # for object header in first chunk */
if(H5O_VERSION_1 < oh->version)
- HDmemcpy(oh->chunk[0].image, H5O_HDR_MAGIC, (size_t)H5_SIZEOF_MAGIC);
+ H5MM_memcpy(oh->chunk[0].image, H5O_HDR_MAGIC, (size_t)H5_SIZEOF_MAGIC);
/* Create the message list */
oh->nmesgs = 1;
@@ -1849,6 +1848,7 @@ H5O_get_loc(hid_t object_id)
case H5I_ERROR_CLASS:
case H5I_ERROR_MSG:
case H5I_ERROR_STACK:
+ case H5I_SPACE_SEL_ITER:
case H5I_NTYPES:
default:
HGOTO_ERROR(H5E_OHDR, H5E_BADTYPE, NULL, "invalid object type")
@@ -1921,7 +1921,7 @@ H5O_loc_copy(H5O_loc_t *dst, H5O_loc_t *src, H5_copy_depth_t depth)
HDassert(depth == H5_COPY_SHALLOW || depth == H5_COPY_DEEP);
/* Copy the top level information */
- HDmemcpy(dst, src, sizeof(H5O_loc_t));
+ H5MM_memcpy(dst, src, sizeof(H5O_loc_t));
/* Deep copy the names */
if(depth == H5_COPY_DEEP) {
diff --git a/src/H5Olayout.c b/src/H5Olayout.c
index 317654a..25cae05 100644
--- a/src/H5Olayout.c
+++ b/src/H5Olayout.c
@@ -189,7 +189,7 @@ H5O__layout_decode(H5F_t *f, H5O_t H5_ATTR_UNUSED *open_oh,
if(mesg->storage.u.compact.size > 0) {
if(NULL == (mesg->storage.u.compact.buf = H5MM_malloc(mesg->storage.u.compact.size)))
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed for compact data buffer")
- HDmemcpy(mesg->storage.u.compact.buf, p, mesg->storage.u.compact.size);
+ H5MM_memcpy(mesg->storage.u.compact.buf, p, mesg->storage.u.compact.size);
p += mesg->storage.u.compact.size;
} /* end if */
} /* end if */
@@ -210,7 +210,7 @@ H5O__layout_decode(H5F_t *f, H5O_t H5_ATTR_UNUSED *open_oh,
HGOTO_ERROR(H5E_OHDR, H5E_CANTALLOC, NULL, "memory allocation failed for compact data buffer")
/* Compact data */
- HDmemcpy(mesg->storage.u.compact.buf, p, mesg->storage.u.compact.size);
+ H5MM_memcpy(mesg->storage.u.compact.buf, p, mesg->storage.u.compact.size);
p += mesg->storage.u.compact.size;
} /* end if */
@@ -425,14 +425,14 @@ H5O__layout_decode(H5F_t *f, H5O_t H5_ATTR_UNUSED *open_oh,
tmp_size = HDstrlen((const char *)heap_block_p) + 1;
if(NULL == (mesg->storage.u.virt.list[i].source_file_name = (char *)H5MM_malloc(tmp_size)))
HGOTO_ERROR(H5E_OHDR, H5E_RESOURCE, NULL, "unable to allocate memory for source file name")
- (void)HDmemcpy(mesg->storage.u.virt.list[i].source_file_name, heap_block_p, tmp_size);
+ (void)H5MM_memcpy(mesg->storage.u.virt.list[i].source_file_name, heap_block_p, tmp_size);
heap_block_p += tmp_size;
/* Source dataset name */
tmp_size = HDstrlen((const char *)heap_block_p) + 1;
if(NULL == (mesg->storage.u.virt.list[i].source_dset_name = (char *)H5MM_malloc(tmp_size)))
HGOTO_ERROR(H5E_OHDR, H5E_RESOURCE, NULL, "unable to allocate memory for source dataset name")
- (void)HDmemcpy(mesg->storage.u.virt.list[i].source_dset_name, heap_block_p, tmp_size);
+ (void)H5MM_memcpy(mesg->storage.u.virt.list[i].source_dset_name, heap_block_p, tmp_size);
heap_block_p += tmp_size;
/* Source selection */
@@ -581,7 +581,7 @@ H5O__layout_encode(H5F_t *f, hbool_t H5_ATTR_UNUSED disable_shared, uint8_t *p,
/* Raw data */
if(mesg->storage.u.compact.size > 0) {
if(mesg->storage.u.compact.buf)
- HDmemcpy(p, mesg->storage.u.compact.buf, mesg->storage.u.compact.size);
+ H5MM_memcpy(p, mesg->storage.u.compact.buf, mesg->storage.u.compact.size);
else
HDmemset(p, 0, mesg->storage.u.compact.size);
p += mesg->storage.u.compact.size;
@@ -750,7 +750,7 @@ H5O__layout_copy(const void *_mesg, void *_dest)
HGOTO_ERROR(H5E_OHDR, H5E_NOSPACE, NULL, "unable to allocate memory for compact dataset")
/* Copy over the raw data */
- HDmemcpy(dest->storage.u.compact.buf, mesg->storage.u.compact.buf, dest->storage.u.compact.size);
+ H5MM_memcpy(dest->storage.u.compact.buf, mesg->storage.u.compact.buf, dest->storage.u.compact.size);
} /* end if */
else
HDassert(dest->storage.u.compact.buf == NULL);
@@ -1047,7 +1047,8 @@ H5O__layout_copy_file(H5F_t *file_src, void *mesg_src, H5F_t *file_dst,
layout_dst->storage.u.contig.size = H5S_extent_nelem(udata->src_space_extent) *
H5T_get_size(udata->src_dtype);
- if(H5D__contig_is_space_alloc(&layout_src->storage)) {
+ if(H5D__contig_is_space_alloc(&layout_src->storage)
+ || (cpy_info->shared_fo && H5D__contig_is_data_cached((const H5D_shared_t *)cpy_info->shared_fo))) {
/* copy contiguous raw data */
if(H5D__contig_copy(file_src, &layout_src->storage.u.contig, file_dst, &layout_dst->storage.u.contig, udata->src_dtype, cpy_info) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_CANTCOPY, NULL, "unable to copy contiguous storage")
@@ -1056,7 +1057,8 @@ H5O__layout_copy_file(H5F_t *file_src, void *mesg_src, H5F_t *file_dst,
break;
case H5D_CHUNKED:
- if(H5D__chunk_is_space_alloc(&layout_src->storage)) {
+ if(H5D__chunk_is_space_alloc(&layout_src->storage)
+ || (cpy_info->shared_fo && H5D__chunk_is_data_cached((const H5D_shared_t *)cpy_info->shared_fo))) {
/* Create chunked layout */
if(H5D__chunk_copy(file_src, &layout_src->storage.u.chunk, &layout_src->u.chunk, file_dst, &layout_dst->storage.u.chunk, udata->src_space_extent, udata->src_dtype, udata->common.src_pline, cpy_info) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_CANTCOPY, NULL, "unable to copy chunked storage")
diff --git a/src/H5Olink.c b/src/H5Olink.c
index 55e1aee..4bd952b 100644
--- a/src/H5Olink.c
+++ b/src/H5Olink.c
@@ -202,7 +202,7 @@ H5O__link_decode(H5F_t *f, H5O_t H5_ATTR_UNUSED *open_oh,
/* Get the link's name */
if(NULL == (lnk->name = (char *)H5MM_malloc(len + 1)))
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed")
- HDmemcpy(lnk->name, p, len);
+ H5MM_memcpy(lnk->name, p, len);
lnk->name[len] = '\0';
p += len;
@@ -220,7 +220,7 @@ H5O__link_decode(H5F_t *f, H5O_t H5_ATTR_UNUSED *open_oh,
HGOTO_ERROR(H5E_OHDR, H5E_CANTLOAD, NULL, "invalid link length")
if(NULL == (lnk->u.soft.name = (char *)H5MM_malloc((size_t)len + 1)))
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed")
- HDmemcpy(lnk->u.soft.name, p, len);
+ H5MM_memcpy(lnk->u.soft.name, p, len);
lnk->u.soft.name[len] = '\0';
p += len;
break;
@@ -240,7 +240,7 @@ H5O__link_decode(H5F_t *f, H5O_t H5_ATTR_UNUSED *open_oh,
{
if(NULL == (lnk->u.ud.udata = H5MM_malloc((size_t)len)))
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed")
- HDmemcpy(lnk->u.ud.udata, p, len);
+ H5MM_memcpy(lnk->u.ud.udata, p, len);
p += len;
}
else
@@ -349,7 +349,7 @@ H5O_link_encode(H5F_t *f, hbool_t H5_ATTR_UNUSED disable_shared, uint8_t *p, con
} /* end switch */
/* Store the link's name */
- HDmemcpy(p, lnk->name, (size_t)len);
+ H5MM_memcpy(p, lnk->name, (size_t)len);
p += len;
/* Store the appropriate information for each type of link */
@@ -364,7 +364,7 @@ H5O_link_encode(H5F_t *f, hbool_t H5_ATTR_UNUSED disable_shared, uint8_t *p, con
len = (uint16_t)HDstrlen(lnk->u.soft.name);
HDassert(len > 0);
UINT16ENCODE(p, len)
- HDmemcpy(p, lnk->u.soft.name, (size_t)len);
+ H5MM_memcpy(p, lnk->u.soft.name, (size_t)len);
p += len;
break;
@@ -380,7 +380,7 @@ H5O_link_encode(H5F_t *f, hbool_t H5_ATTR_UNUSED disable_shared, uint8_t *p, con
UINT16ENCODE(p, len)
if(len > 0)
{
- HDmemcpy(p, lnk->u.ud.udata, (size_t)len);
+ H5MM_memcpy(p, lnk->u.ud.udata, (size_t)len);
p+=len;
}
break;
@@ -437,7 +437,7 @@ H5O_link_copy(const void *_mesg, void *_dest)
if(lnk->u.ud.size > 0) {
if(NULL == (dest->u.ud.udata = H5MM_malloc(lnk->u.ud.size)))
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed")
- HDmemcpy(dest->u.ud.udata, lnk->u.ud.udata, lnk->u.ud.size);
+ H5MM_memcpy(dest->u.ud.udata, lnk->u.ud.udata, lnk->u.ud.size);
} /* end if */
} /* end if */
diff --git a/src/H5Omtime.c b/src/H5Omtime.c
index 172f9ab..fbf7613 100644
--- a/src/H5Omtime.c
+++ b/src/H5Omtime.c
@@ -289,7 +289,7 @@ H5O_mtime_encode(H5F_t H5_ATTR_UNUSED *f, hbool_t H5_ATTR_UNUSED disable_shared,
/* encode */
tm = HDgmtime(mesg);
- sprintf((char*)p, "%04d%02d%02d%02d%02d%02d",
+ HDsprintf((char*)p, "%04d%02d%02d%02d%02d%02d",
1900+tm->tm_year, 1+tm->tm_mon, tm->tm_mday,
tm->tm_hour, tm->tm_min, tm->tm_sec);
diff --git a/src/H5Oname.c b/src/H5Oname.c
index a710944..1f20f10 100644
--- a/src/H5Oname.c
+++ b/src/H5Oname.c
@@ -297,7 +297,7 @@ H5O__name_debug(H5F_t H5_ATTR_UNUSED *f, const void *_mesg, FILE *stream,
HDassert(indent >= 0);
HDassert(fwidth >= 0);
- fprintf(stream, "%*s%-*s `%s'\n", indent, "", fwidth,
+ HDfprintf(stream, "%*s%-*s `%s'\n", indent, "", fwidth,
"Name:",
mesg->s);
diff --git a/src/H5Opkg.h b/src/H5Opkg.h
index 668f4f0..4afa452 100644
--- a/src/H5Opkg.h
+++ b/src/H5Opkg.h
@@ -134,9 +134,9 @@
) : 0)) \
)
#define H5O_SIZEOF_MSGHDR_OH(O) \
- H5O_SIZEOF_MSGHDR_VERS((O)->version, (O)->flags & H5O_HDR_ATTR_CRT_ORDER_TRACKED)
+ (unsigned)H5O_SIZEOF_MSGHDR_VERS((O)->version, (O)->flags & H5O_HDR_ATTR_CRT_ORDER_TRACKED)
#define H5O_SIZEOF_MSGHDR_F(F, C) \
- H5O_SIZEOF_MSGHDR_VERS(MAX((H5F_STORE_MSG_CRT_IDX(F) ? H5O_VERSION_LATEST : H5O_VERSION_1), (uint8_t)H5O_obj_ver_bounds[H5F_LOW_BOUND(F)]), (C))
+ (unsigned)H5O_SIZEOF_MSGHDR_VERS(MAX((H5F_STORE_MSG_CRT_IDX(F) ? H5O_VERSION_LATEST : H5O_VERSION_1), (uint8_t)H5O_obj_ver_bounds[H5F_LOW_BOUND(F)]), (C))
/*
* Size of chunk "header" for each chunk
diff --git a/src/H5Opline.c b/src/H5Opline.c
index 1fae1b8..609f2eb 100644
--- a/src/H5Opline.c
+++ b/src/H5Opline.c
@@ -93,6 +93,7 @@ const H5O_msg_class_t H5O_MSG_PLINE[1] = {{
const unsigned H5O_pline_ver_bounds[] = {
H5O_PLINE_VERSION_1, /* H5F_LIBVER_EARLIEST */
H5O_PLINE_VERSION_2, /* H5F_LIBVER_V18 */
+ H5O_PLINE_VERSION_2, /* H5F_LIBVER_V110 */
H5O_PLINE_VERSION_LATEST /* H5F_LIBVER_LATEST */
};
@@ -318,7 +319,7 @@ H5O_pline_encode(H5F_t H5_ATTR_UNUSED *f, uint8_t *p/*out*/, const void *mesg)
/* Encode name, if there is one to encode */
if(name_length > 0) {
/* Store name, with null terminator */
- HDmemcpy(p, name, name_length);
+ H5MM_memcpy(p, name, name_length);
p += name_length;
/* Pad out name to alignment, in older versions */
@@ -409,7 +410,7 @@ H5O_pline_copy(const void *_src, void *_dst/*out*/)
if(NULL == (dst->filter[i].cd_values = (unsigned *)H5MM_malloc(src->filter[i].cd_nelmts* sizeof(unsigned))))
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed")
- HDmemcpy(dst->filter[i].cd_values, src->filter[i].cd_values,
+ H5MM_memcpy(dst->filter[i].cd_values, src->filter[i].cd_values,
src->filter[i].cd_nelmts * sizeof(unsigned));
} /* end if */
else
diff --git a/src/H5Osdspace.c b/src/H5Osdspace.c
index 74fa72e..b7f70d1 100644
--- a/src/H5Osdspace.c
+++ b/src/H5Osdspace.c
@@ -189,7 +189,7 @@ H5O__sdspace_decode(H5F_t *f, H5O_t H5_ATTR_UNUSED *open_oh,
done:
if(!ret_value && sdim) {
- H5S_extent_release(sdim);
+ H5S__extent_release(sdim);
sdim = H5FL_FREE(H5S_extent_t, sdim);
} /* end if */
@@ -310,7 +310,7 @@ H5O_sdspace_copy(const void *_mesg, void *_dest)
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed")
/* Copy extent information */
- if(H5S_extent_copy_real(dest, mesg, TRUE) < 0)
+ if(H5S__extent_copy_real(dest, mesg, TRUE) < 0)
HGOTO_ERROR(H5E_DATASPACE, H5E_CANTCOPY, NULL, "can't copy extent")
/* Set return value */
@@ -391,7 +391,7 @@ H5O__sdspace_reset(void *_mesg)
FUNC_ENTER_STATIC_NOERR
- H5S_extent_release(mesg);
+ H5S__extent_release(mesg);
FUNC_LEAVE_NOAPI(SUCCEED)
} /* end H5O__sdspace_reset() */
@@ -470,7 +470,7 @@ H5O_sdspace_pre_copy_file(H5F_t H5_ATTR_UNUSED *file_src, const void *mesg_src,
HGOTO_ERROR(H5E_DATASPACE, H5E_NOSPACE, FAIL, "dataspace extent allocation failed")
/* Create a copy of the dataspace extent */
- if(H5S_extent_copy_real(udata->src_space_extent, src_space_extent, TRUE) < 0)
+ if(H5S__extent_copy_real(udata->src_space_extent, src_space_extent, TRUE) < 0)
HGOTO_ERROR(H5E_DATASPACE, H5E_CANTCOPY, FAIL, "can't copy extent")
} /* end if */
diff --git a/src/H5Oshared.c b/src/H5Oshared.c
index 4fc0488..67ca76f 100644
--- a/src/H5Oshared.c
+++ b/src/H5Oshared.c
@@ -39,6 +39,7 @@
#include "H5Fprivate.h" /* File access */
#include "H5Gprivate.h" /* Groups */
#include "H5HFprivate.h" /* Fractal heap */
+#include "H5MMprivate.h" /* Memory management */
#include "H5Opkg.h" /* Object headers */
#include "H5SMprivate.h" /* Shared object header messages */
#include "H5WBprivate.h" /* Wrapped Buffers */
@@ -358,7 +359,7 @@ H5O__shared_decode(H5F_t *f, H5O_t *open_oh, unsigned *ioflags, const uint8_t *b
*/
if(sh_mesg.type == H5O_SHARE_TYPE_SOHM) {
HDassert(version >= H5O_SHARED_VERSION_3);
- HDmemcpy(&sh_mesg.u.heap_id, buf, sizeof(sh_mesg.u.heap_id));
+ H5MM_memcpy(&sh_mesg.u.heap_id, buf, sizeof(sh_mesg.u.heap_id));
} /* end if */
else {
/* The H5O_COMMITTED_FLAG should be set if this message
@@ -426,7 +427,7 @@ H5O__shared_encode(const H5F_t *f, uint8_t *buf/*out*/, const H5O_shared_t *sh_m
* object header that holds it.
*/
if(sh_mesg->type == H5O_SHARE_TYPE_SOHM)
- HDmemcpy(buf, &(sh_mesg->u.heap_id), sizeof(sh_mesg->u.heap_id));
+ H5MM_memcpy(buf, &(sh_mesg->u.heap_id), sizeof(sh_mesg->u.heap_id));
else
H5F_addr_encode(f, &buf, sh_mesg->u.loc.oh_addr);
diff --git a/src/H5P.c b/src/H5P.c
index 72d7ae8..09ff7f0 100644
--- a/src/H5P.c
+++ b/src/H5P.c
@@ -817,14 +817,17 @@ done:
/*--------------------------------------------------------------------------
NAME
- H5Pencode
+ H5Pencode2
PURPOSE
- Routine to convert the property values in a property list into a binary buffer
+ Routine to convert the property values in a property list into a binary buffer.
+ The encoding of property values will be done according to the file format
+ setting in fapl_id.
USAGE
- herr_t H5Pencode(plist_id, buf, nalloc)
+ herr_t H5Pencode(plist_id, buf, nalloc, fapl_id)
hid_t plist_id; IN: Identifier to property list to encode
void *buf: OUT: buffer to gold the encoded plist
size_t *nalloc; IN/OUT: size of buffer needed to encode plist
+ hid_t fapl_id; IN: File access property list ID
RETURNS
Returns non-negative on success, negative on failure.
DESCRIPTION
@@ -837,25 +840,29 @@ done:
REVISION LOG
--------------------------------------------------------------------------*/
herr_t
-H5Pencode(hid_t plist_id, void *buf, size_t *nalloc)
+H5Pencode2(hid_t plist_id, void *buf, size_t *nalloc, hid_t fapl_id)
{
H5P_genplist_t *plist; /* Property list to query */
herr_t ret_value = SUCCEED; /* return value */
FUNC_ENTER_API(FAIL)
- H5TRACE3("e", "i*x*z", plist_id, buf, nalloc);
+ H5TRACE4("e", "i*x*zi", plist_id, buf, nalloc, fapl_id);
/* Check arguments. */
if(NULL == (plist = (H5P_genplist_t *)H5I_object_verify(plist_id, H5I_GENPROP_LST)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a property list");
+ /* Verify access property list and set up collective metadata if appropriate */
+ if(H5CX_set_apl(&fapl_id, H5P_CLS_FACC, H5I_INVALID_HID, TRUE) < 0)
+ HGOTO_ERROR(H5E_FILE, H5E_CANTSET, H5I_INVALID_HID, "can't set access property list info")
+
/* Call the internal encode routine */
if((ret_value = H5P__encode(plist, TRUE, buf, nalloc)) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTENCODE, FAIL, "unable to encode property list");
done:
FUNC_LEAVE_API(ret_value)
-} /* H5Pencode() */
+} /* H5Pencode2() */
/*--------------------------------------------------------------------------
diff --git a/src/H5PB.c b/src/H5PB.c
index a325ad1..25c5f43 100644
--- a/src/H5PB.c
+++ b/src/H5PB.c
@@ -36,6 +36,7 @@
#include "H5Fpkg.h" /* Files */
#include "H5FDprivate.h" /* File drivers */
#include "H5Iprivate.h" /* IDs */
+#include "H5MMprivate.h" /* Memory management */
#include "H5PBpkg.h" /* File access */
#include "H5SLprivate.h" /* Skip List */
@@ -252,7 +253,7 @@ H5PB_print_stats(const H5PB_t *page_buf)
HDassert(page_buf);
- printf("PAGE BUFFER STATISTICS:\n");
+ HDprintf("PAGE BUFFER STATISTICS:\n");
HDprintf("******* METADATA\n");
HDprintf("\t Total Accesses: %u\n", page_buf->accesses[0]);
@@ -609,7 +610,7 @@ H5PB_update_entry(H5PB_t *page_buf, haddr_t addr, size_t size, const void *buf)
HDassert(addr + size <= page_addr + page_buf->page_size);
offset = addr - page_addr;
- HDmemcpy((uint8_t *)page_entry->page_buf_ptr + offset, buf, size);
+ H5MM_memcpy((uint8_t *)page_entry->page_buf_ptr + offset, buf, size);
/* move to top of LRU list */
H5PB__MOVE_TO_TOP_LRU(page_buf, page_entry)
@@ -818,7 +819,7 @@ H5PB_read(H5F_t *f, H5FD_mem_t type, haddr_t addr, size_t size, void *buf/*out*/
offset = addr - first_page_addr;
HDassert(page_buf->page_size > offset);
- HDmemcpy(buf, (uint8_t *)page_entry->page_buf_ptr + offset,
+ H5MM_memcpy(buf, (uint8_t *)page_entry->page_buf_ptr + offset,
page_buf->page_size - (size_t)offset);
/* move to top of LRU list */
@@ -829,7 +830,7 @@ H5PB_read(H5F_t *f, H5FD_mem_t type, haddr_t addr, size_t size, void *buf/*out*/
offset = (num_touched_pages-2)*page_buf->page_size +
(page_buf->page_size - (addr - first_page_addr));
- HDmemcpy((uint8_t *)buf + offset, page_entry->page_buf_ptr,
+ H5MM_memcpy((uint8_t *)buf + offset, page_entry->page_buf_ptr,
(size_t)((addr + size) - last_page_addr));
/* move to top of LRU list */
@@ -839,7 +840,7 @@ H5PB_read(H5F_t *f, H5FD_mem_t type, haddr_t addr, size_t size, void *buf/*out*/
else {
offset = i*page_buf->page_size;
- HDmemcpy((uint8_t *)buf+(i*page_buf->page_size) , page_entry->page_buf_ptr,
+ H5MM_memcpy((uint8_t *)buf+(i*page_buf->page_size) , page_entry->page_buf_ptr,
page_buf->page_size);
} /* end else */
} /* end if */
@@ -872,7 +873,7 @@ H5PB_read(H5F_t *f, H5FD_mem_t type, haddr_t addr, size_t size, void *buf/*out*/
buf_offset = (0 == i ? 0 : size - access_size);
/* copy the requested data from the page into the input buffer */
- HDmemcpy((uint8_t *)buf + buf_offset, (uint8_t *)page_entry->page_buf_ptr + offset, access_size);
+ H5MM_memcpy((uint8_t *)buf + buf_offset, (uint8_t *)page_entry->page_buf_ptr + offset, access_size);
/* Update LRU */
H5PB__MOVE_TO_TOP_LRU(page_buf, page_entry)
@@ -937,7 +938,7 @@ H5PB_read(H5F_t *f, H5FD_mem_t type, haddr_t addr, size_t size, void *buf/*out*/
/* Copy the requested data from the page into the input buffer */
offset = (0 == i ? addr - search_addr : 0);
buf_offset = (0 == i ? 0 : size - access_size);
- HDmemcpy((uint8_t *)buf + buf_offset, (uint8_t *)new_page_buf + offset, access_size);
+ H5MM_memcpy((uint8_t *)buf + buf_offset, (uint8_t *)new_page_buf + offset, access_size);
/* Create the new PB entry */
if(NULL == (page_entry = H5FL_CALLOC(H5PB_entry_t)))
@@ -1102,7 +1103,7 @@ H5PB_write(H5F_t *f, H5FD_mem_t type, haddr_t addr,
HDassert(page_buf->page_size > offset);
/* Update page's data */
- HDmemcpy((uint8_t *)page_entry->page_buf_ptr + offset, buf, page_buf->page_size - (size_t)offset);
+ H5MM_memcpy((uint8_t *)page_entry->page_buf_ptr + offset, buf, page_buf->page_size - (size_t)offset);
/* Mark page dirty and push to top of LRU */
page_entry->is_dirty = TRUE;
@@ -1121,7 +1122,7 @@ H5PB_write(H5F_t *f, H5FD_mem_t type, haddr_t addr,
(page_buf->page_size - (addr - first_page_addr));
/* Update page's data */
- HDmemcpy(page_entry->page_buf_ptr, (const uint8_t *)buf + offset,
+ H5MM_memcpy(page_entry->page_buf_ptr, (const uint8_t *)buf + offset,
(size_t)((addr + size) - last_page_addr));
/* Mark page dirty and push to top of LRU */
@@ -1173,7 +1174,7 @@ H5PB_write(H5F_t *f, H5FD_mem_t type, haddr_t addr,
buf_offset = (0 == i ? 0 : size - access_size);
/* Copy the requested data from the input buffer into the page */
- HDmemcpy((uint8_t *)page_entry->page_buf_ptr + offset, (const uint8_t *)buf + buf_offset, access_size);
+ H5MM_memcpy((uint8_t *)page_entry->page_buf_ptr + offset, (const uint8_t *)buf + buf_offset, access_size);
/* Mark page dirty and push to top of LRU */
page_entry->is_dirty = TRUE;
@@ -1289,7 +1290,7 @@ H5PB_write(H5F_t *f, H5FD_mem_t type, haddr_t addr,
} /* end else */
/* Copy the requested data from the page into the input buffer */
- HDmemcpy((uint8_t *)new_page_buf + offset, (const uint8_t *)buf+buf_offset, access_size);
+ H5MM_memcpy((uint8_t *)new_page_buf + offset, (const uint8_t *)buf+buf_offset, access_size);
/* Page is dirty now */
page_entry->is_dirty = TRUE;
diff --git a/src/H5Pacpl.c b/src/H5Pacpl.c
index 2322c76..53e68fa 100644
--- a/src/H5Pacpl.c
+++ b/src/H5Pacpl.c
@@ -40,10 +40,6 @@
/* Local Macros */
/****************/
-/* Definitions for locations parameters */
-#define H5A_CRT_LOCATION_SIZE sizeof(H5VL_loc_params_t)
-#define H5A_CRT_LOCATION_DEF H5I_BADID
-
/******************/
/* Local Typedefs */
@@ -59,9 +55,6 @@
/* Local Prototypes */
/********************/
-/* Property class callbacks */
-static herr_t H5P_acrt_reg_prop(H5P_genclass_t *pclass);
-
/*********************/
/* Package Variables */
@@ -76,7 +69,7 @@ const H5P_libclass_t H5P_CLS_ACRT[1] = {{
&H5P_CLS_ATTRIBUTE_CREATE_g, /* Pointer to class */
&H5P_CLS_ATTRIBUTE_CREATE_ID_g, /* Pointer to class ID */
&H5P_LST_ATTRIBUTE_CREATE_ID_g, /* Pointer to default property list ID */
- H5P_acrt_reg_prop, /* Default property registration routine */
+ NULL, /* Default property registration routine */
NULL, /* Class creation callback */
NULL, /* Class creation callback info */
@@ -91,44 +84,3 @@ const H5P_libclass_t H5P_CLS_ACRT[1] = {{
/* Library Private Variables */
/*****************************/
-
-/*-------------------------------------------------------------------------
- * Function: H5P_acrt_reg_prop
- *
- * Purpose: Register the attribute creation property list class's properties
- *
- * Return: SUCCEED/FAIL
- *
- *-------------------------------------------------------------------------
- */
-static herr_t
-H5P_acrt_reg_prop(H5P_genclass_t *pclass)
-{
- hid_t type_id = H5I_INVALID_HID;
- hid_t space_id = H5I_INVALID_HID;
- H5VL_loc_params_t loc_params;
- herr_t ret_value = SUCCEED;
-
- FUNC_ENTER_NOAPI_NOINIT
-
- /* Register the type ID property*/
- if(H5P__register_real(pclass, H5VL_PROP_ATTR_TYPE_ID, sizeof(hid_t), &type_id,
- 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 space ID property */
- if(H5P__register_real(pclass, H5VL_PROP_ATTR_SPACE_ID, sizeof(hid_t), &space_id,
- 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 lcpl ID property */
- HDmemset(&loc_params, 0, sizeof(H5VL_loc_params_t));
- loc_params.obj_type = H5A_CRT_LOCATION_DEF;
- if(H5P__register_real(pclass, H5VL_PROP_ATTR_LOC_PARAMS, H5A_CRT_LOCATION_SIZE, &loc_params,
- NULL, NULL, NULL, NULL, NULL, 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_acrt_reg_prop() */
-
diff --git a/src/H5Pdapl.c b/src/H5Pdapl.c
index 00e598f..5ce12b4 100644
--- a/src/H5Pdapl.c
+++ b/src/H5Pdapl.c
@@ -37,8 +37,8 @@
#include "H5Eprivate.h" /* Error handling */
#include "H5Fprivate.h" /* Files */
#include "H5Iprivate.h" /* IDs */
+#include "H5MMprivate.h" /* Memory management */
#include "H5Ppkg.h" /* Property lists */
-#include "H5MMprivate.h" /* Memory management */
/****************/
@@ -341,7 +341,7 @@ H5P__dapl_vds_file_pref_enc(const void *value, void **_pp, size_t *size)
/* encode the prefix */
if(NULL != vds_file_pref) {
- HDmemcpy(*(char **)pp, vds_file_pref, len);
+ H5MM_memcpy(*(char **)pp, vds_file_pref, len);
*pp += len;
} /* end if */
} /* end if */
@@ -589,7 +589,7 @@ H5P__dapl_efile_pref_enc(const void *value, void **_pp, size_t *size)
/* encode the prefix */
if(NULL != efile_pref) {
- HDmemcpy(*(char **)pp, efile_pref, len);
+ H5MM_memcpy(*(char **)pp, efile_pref, len);
*pp += len;
} /* end if */
} /* end if */
diff --git a/src/H5Pdcpl.c b/src/H5Pdcpl.c
index b85f105..6b9edf1 100644
--- a/src/H5Pdcpl.c
+++ b/src/H5Pdcpl.c
@@ -246,9 +246,6 @@ static hbool_t H5P_dcrt_def_layout_init_g = FALSE;
static herr_t
H5P__dcrt_reg_prop(H5P_genclass_t *pclass)
{
- hid_t type_id = H5I_INVALID_HID;
- hid_t space_id = H5I_INVALID_HID;
- hid_t lcpl_id = H5P_LINK_CREATE_DEFAULT;
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_STATIC
@@ -283,21 +280,6 @@ H5P__dcrt_reg_prop(H5P_genclass_t *pclass)
NULL, NULL, NULL, NULL) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class")
- /* Register the type ID property*/
- if(H5P__register_real(pclass, H5VL_PROP_DSET_TYPE_ID, sizeof(hid_t), &type_id,
- NULL, NULL, NULL, NULL, NULL, NULL, NULL, H5P_ignore_cmp, NULL) < 0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class")
-
- /* Register the space ID property */
- if(H5P__register_real(pclass, H5VL_PROP_DSET_SPACE_ID, sizeof(hid_t), &space_id,
- NULL, NULL, NULL, NULL, NULL, NULL, NULL, H5P_ignore_cmp, NULL) < 0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class")
-
- /* Register the lcpl ID property */
- if(H5P__register_real(pclass, H5VL_PROP_DSET_LCPL_ID, sizeof(hid_t), &lcpl_id,
- NULL, NULL, NULL, NULL, NULL, NULL, NULL, H5P_ignore_cmp, 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() */
@@ -439,13 +421,13 @@ H5P__dcrt_layout_enc(const void *value, void **_pp, size_t *size)
for(u = 0; u < layout->storage.u.virt.list_nused; u++) {
/* Source file name */
tmp_size = HDstrlen(layout->storage.u.virt.list[u].source_file_name) + (size_t)1;
- (void)HDmemcpy(*pp, layout->storage.u.virt.list[u].source_file_name, tmp_size);
+ (void)H5MM_memcpy(*pp, layout->storage.u.virt.list[u].source_file_name, tmp_size);
*pp += tmp_size;
*size += tmp_size;
/* Source dataset name */
tmp_size = HDstrlen(layout->storage.u.virt.list[u].source_dset_name) + (size_t)1;
- (void)HDmemcpy(*pp, layout->storage.u.virt.list[u].source_dset_name, tmp_size);
+ (void)H5MM_memcpy(*pp, layout->storage.u.virt.list[u].source_dset_name, tmp_size);
*pp += tmp_size;
*size += tmp_size;
@@ -615,14 +597,14 @@ H5P__dcrt_layout_dec(const void **_pp, void *value)
tmp_size = HDstrlen((const char *)*pp) + 1;
if(NULL == (tmp_layout.storage.u.virt.list[u].source_file_name = (char *)H5MM_malloc(tmp_size)))
HGOTO_ERROR(H5E_PLIST, H5E_CANTALLOC, FAIL, "unable to allocate memory for source file name")
- (void)HDmemcpy(tmp_layout.storage.u.virt.list[u].source_file_name, *pp, tmp_size);
+ (void)H5MM_memcpy(tmp_layout.storage.u.virt.list[u].source_file_name, *pp, tmp_size);
*pp += tmp_size;
/* Source dataset name */
tmp_size = HDstrlen((const char *)*pp) + 1;
if(NULL == (tmp_layout.storage.u.virt.list[u].source_dset_name = (char *)H5MM_malloc(tmp_size)))
HGOTO_ERROR(H5E_PLIST, H5E_CANTALLOC, FAIL, "unable to allocate memory for source dataset name")
- (void)HDmemcpy(tmp_layout.storage.u.virt.list[u].source_dset_name, *pp, tmp_size);
+ (void)H5MM_memcpy(tmp_layout.storage.u.virt.list[u].source_dset_name, *pp, tmp_size);
*pp += tmp_size;
/* Source selection */
@@ -687,7 +669,7 @@ H5P__dcrt_layout_dec(const void **_pp, void *value)
} /* end switch */
/* Set the value */
- HDmemcpy(value, layout, sizeof(H5O_layout_t));
+ H5MM_memcpy(value, layout, sizeof(H5O_layout_t));
done:
FUNC_LEAVE_NOAPI(ret_value)
@@ -1036,7 +1018,7 @@ H5P__dcrt_fill_value_enc(const void *value, void **_pp, size_t *size)
/* Encode the fill value & datatype */
if(fill->size > 0) {
/* Encode the fill value itself */
- HDmemcpy(*pp, (uint8_t *)fill->buf, (size_t)fill->size);
+ H5MM_memcpy(*pp, (uint8_t *)fill->buf, (size_t)fill->size);
*pp += fill->size;
/* Encode fill value datatype */
@@ -1133,7 +1115,7 @@ H5P__dcrt_fill_value_dec(const void **_pp, void *_value)
/* Allocate fill buffer and copy the contents in it */
if(NULL == (fill->buf = H5MM_malloc((size_t)fill->size)))
HGOTO_ERROR(H5E_PLIST, H5E_CANTALLOC, FAIL, "memory allocation failed for fill value buffer")
- HDmemcpy((uint8_t *)fill->buf, *pp, (size_t)fill->size);
+ H5MM_memcpy((uint8_t *)fill->buf, *pp, (size_t)fill->size);
*pp += fill->size;
enc_size = *(*pp)++;
@@ -1448,7 +1430,7 @@ H5P__dcrt_ext_file_list_enc(const void *value, void **_pp, size_t *size)
UINT64ENCODE_VAR(*pp, enc_value, enc_size);
/* Encode name */
- HDmemcpy(*pp, (uint8_t *)(efl->slot[u].name), len);
+ H5MM_memcpy(*pp, (uint8_t *)(efl->slot[u].name), len);
*pp += len;
/* Encode offset */
@@ -2035,7 +2017,7 @@ H5Pset_chunk(hid_t plist_id, int ndims, const hsize_t dim[/*ndims*/])
#endif /* H5_HAVE_C99_DESIGNATED_INITIALIZER */
/* Verify & initialize property's chunk dims */
- HDmemcpy(&chunk_layout, &H5D_def_layout_chunk_g, sizeof(H5D_def_layout_chunk_g));
+ H5MM_memcpy(&chunk_layout, &H5D_def_layout_chunk_g, sizeof(H5D_def_layout_chunk_g));
HDmemset(&chunk_layout.u.chunk.dim, 0, sizeof(chunk_layout.u.chunk.dim));
chunk_nelmts = 1;
for(u = 0; u < (unsigned)ndims; u++) {
@@ -2204,7 +2186,7 @@ H5Pset_virtual(hid_t dcpl_id, hid_t vspace_id, const char *src_file_name,
HGOTO_ERROR(H5E_PLIST, H5E_CANTRESET, FAIL, "can't release layout message")
/* Copy the default virtual layout */
- HDmemcpy(&virtual_layout, &H5D_def_layout_virtual_g, sizeof(H5D_def_layout_virtual_g));
+ H5MM_memcpy(&virtual_layout, &H5D_def_layout_virtual_g, sizeof(H5D_def_layout_virtual_g));
/* Sanity check */
HDassert(virtual_layout.storage.u.virt.list_nalloc == 0);
@@ -3243,7 +3225,7 @@ H5Pset_fill_value(hid_t plist_id, hid_t type_id, const void *value)
fill.size = (ssize_t)H5T_get_size(type);
if(NULL == (fill.buf = H5MM_malloc((size_t)fill.size)))
HGOTO_ERROR(H5E_RESOURCE, H5E_CANTINIT, FAIL, "memory allocation failed for fill value")
- HDmemcpy(fill.buf, value, (size_t)fill.size);
+ H5MM_memcpy(fill.buf, value, (size_t)fill.size);
/* Set up type conversion function */
if(NULL == (tpath = H5T_path_find(type, type)))
@@ -3351,7 +3333,7 @@ H5P_get_fill_value(H5P_genplist_t *plist, const H5T_t *type, void *value/*out*/)
if(H5T_path_bkg(tpath) && NULL == (bkg = H5MM_malloc(H5T_get_size(fill.type))))
HGOTO_ERROR(H5E_PLIST, H5E_CANTALLOC, FAIL, "memory allocation failed for type conversion")
} /* end else */
- HDmemcpy(buf, fill.buf, H5T_get_size(fill.type));
+ H5MM_memcpy(buf, fill.buf, H5T_get_size(fill.type));
/* Do the conversion */
if((dst_id = H5I_register(H5I_DATATYPE, H5T_copy(type, H5T_COPY_TRANSIENT), FALSE)) < 0)
@@ -3359,7 +3341,7 @@ H5P_get_fill_value(H5P_genplist_t *plist, const H5T_t *type, void *value/*out*/)
if(H5T_convert(tpath, src_id, dst_id, (size_t)1, (size_t)0, (size_t)0, buf, bkg) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTINIT, FAIL, "datatype conversion failed")
if(buf != value)
- HDmemcpy(value, buf, H5T_get_size(type));
+ H5MM_memcpy(value, buf, H5T_get_size(type));
done:
if(buf != value)
diff --git a/src/H5Pdeprec.c b/src/H5Pdeprec.c
index 4a63b36..1b5f581 100644
--- a/src/H5Pdeprec.c
+++ b/src/H5Pdeprec.c
@@ -36,6 +36,7 @@
/* Headers */
/***********/
#include "H5private.h" /* Generic Functions */
+#include "H5CXprivate.h" /* API Contexts */
#include "H5Eprivate.h" /* Error handling */
#include "H5Fprivate.h" /* Files */
#include "H5Iprivate.h" /* IDs */
@@ -486,6 +487,54 @@ done:
FUNC_LEAVE_API(ret_value)
} /* end H5Pget_version() */
+
+/*--------------------------------------------------------------------------
+ NAME
+ H5Pencode1
+ PURPOSE
+ Routine to convert the property values in a property list into a binary buffer
+ USAGE
+ herr_t H5Pencode1(plist_id, buf, nalloc)
+ hid_t plist_id; IN: Identifier to property list to encode
+ void *buf: OUT: buffer to gold the encoded plist
+ size_t *nalloc; IN/OUT: size of buffer needed to encode plist
+ RETURNS
+ Returns non-negative on success, negative on failure.
+ DESCRIPTION
+ Encodes a property list into a binary buffer. If the buffer is NULL, then
+ the call will set the size needed to encode the plist in nalloc. Otherwise
+ the routine will encode the plist in buf.
+ GLOBAL VARIABLES
+ COMMENTS, BUGS, ASSUMPTIONS
+ EXAMPLES
+ REVISION LOG
+--------------------------------------------------------------------------*/
+herr_t
+H5Pencode1(hid_t plist_id, void *buf, size_t *nalloc)
+{
+ H5P_genplist_t *plist; /* Property list to query */
+ hid_t temp_fapl_id = H5P_DEFAULT;
+ herr_t ret_value = SUCCEED; /* return value */
+
+ FUNC_ENTER_API(FAIL)
+ H5TRACE3("e", "i*x*z", plist_id, buf, nalloc);
+
+ /* Check arguments. */
+ if(NULL == (plist = (H5P_genplist_t *)H5I_object_verify(plist_id, H5I_GENPROP_LST)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a property list");
+
+ /* Verify access property list and set up collective metadata if appropriate */
+ if(H5CX_set_apl(&temp_fapl_id, H5P_CLS_FACC, H5I_INVALID_HID, TRUE) < 0)
+ HGOTO_ERROR(H5E_FILE, H5E_CANTSET, H5I_INVALID_HID, "can't set access property list info")
+
+ /* Call the internal encode routine */
+ if((ret_value = H5P__encode(plist, TRUE, buf, nalloc)) < 0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTENCODE, FAIL, "unable to encode property list");
+
+done:
+ FUNC_LEAVE_API(ret_value)
+} /* H5Pencode1() */
+
/*-------------------------------------------------------------------------
* Function: H5Pset_file_space
*
diff --git a/src/H5Pdxpl.c b/src/H5Pdxpl.c
index 8338d84..df9cf4e 100644
--- a/src/H5Pdxpl.c
+++ b/src/H5Pdxpl.c
@@ -695,7 +695,7 @@ H5P__dxfr_xform_enc(const void *value, void **_pp, size_t *size)
HDassert(pexp);
/* Copy the expression into the buffer */
- HDmemcpy(*pp, (const uint8_t *)pexp, len);
+ H5MM_memcpy(*pp, (const uint8_t *)pexp, len);
*pp += len;
*pp[0] = '\0';
} /* end if */
diff --git a/src/H5Pfapl.c b/src/H5Pfapl.c
index 452ea3f..585e913 100644
--- a/src/H5Pfapl.c
+++ b/src/H5Pfapl.c
@@ -1064,7 +1064,7 @@ H5P__file_driver_copy(void *value)
else if(driver->fapl_size > 0) {
if(NULL == (new_pl = H5MM_malloc(driver->fapl_size)))
HGOTO_ERROR(H5E_PLIST, H5E_CANTALLOC, FAIL, "driver info allocation failed")
- HDmemcpy(new_pl, info->driver_info, driver->fapl_size);
+ H5MM_memcpy(new_pl, info->driver_info, driver->fapl_size);
} /* end else-if */
else
HGOTO_ERROR(H5E_PLIST, H5E_UNSUPPORTED, FAIL, "no way to copy driver info")
@@ -2597,7 +2597,7 @@ H5Pset_file_image(hid_t fapl_id, void *buf_ptr, size_t buf_len)
HGOTO_ERROR(H5E_RESOURCE, H5E_CANTCOPY, FAIL, "image_memcpy callback failed")
} /* end if */
else
- HDmemcpy(image_info.buffer, buf_ptr, buf_len);
+ H5MM_memcpy(image_info.buffer, buf_ptr, buf_len);
} /* end if */
else
image_info.buffer = NULL;
@@ -2691,7 +2691,7 @@ H5Pget_file_image(hid_t fapl_id, void **buf_ptr_ptr, size_t *buf_len_ptr)
HGOTO_ERROR(H5E_RESOURCE, H5E_CANTCOPY, FAIL, "image_memcpy callback failed")
} /* end if */
else
- HDmemcpy(copy_ptr, image_info.buffer, image_info.size);
+ H5MM_memcpy(copy_ptr, image_info.buffer, image_info.size);
} /* end if */
*buf_ptr_ptr = copy_ptr;
@@ -2894,7 +2894,7 @@ H5P__file_image_info_copy(void *value)
HGOTO_ERROR(H5E_PLIST, H5E_CANTCOPY, FAIL, "image_memcpy callback failed")
} /* end if */
else
- HDmemcpy(info->buffer, old_buffer, info->size);
+ H5MM_memcpy(info->buffer, old_buffer, info->size);
} /* end if */
/* Copy udata if it exists */
@@ -3089,7 +3089,7 @@ H5P__facc_cache_image_config_dec(const void **_pp, void *_value)
HDcompile_assert(sizeof(size_t) <= sizeof(uint64_t));
/* Set property to default value */
- HDmemcpy(config, &H5F_def_mdc_initCacheImageCfg_g, sizeof(H5AC_cache_image_config_t));
+ H5MM_memcpy(config, &H5F_def_mdc_initCacheImageCfg_g, sizeof(H5AC_cache_image_config_t));
/* Decode type sizes */
enc_size = *(*pp)++;
@@ -3480,7 +3480,7 @@ H5P__facc_cache_config_enc(const void *value, void **_pp, size_t *size)
H5_ENCODE_UNSIGNED(*pp, config->close_trace_file);
- HDmemcpy(*pp, (const uint8_t *)(config->trace_file_name), (size_t)(H5AC__MAX_TRACE_FILE_NAME_LEN + 1));
+ H5MM_memcpy(*pp, (const uint8_t *)(config->trace_file_name), (size_t)(H5AC__MAX_TRACE_FILE_NAME_LEN + 1));
*pp += H5AC__MAX_TRACE_FILE_NAME_LEN + 1;
H5_ENCODE_UNSIGNED(*pp, config->evictions_enabled);
@@ -3615,7 +3615,7 @@ H5P__facc_cache_config_dec(const void **_pp, void *_value)
HDcompile_assert(sizeof(size_t) <= sizeof(uint64_t));
/* Set property to default value */
- HDmemcpy(config, &H5F_def_mdc_initCacheCfg_g, sizeof(H5AC_cache_config_t));
+ H5MM_memcpy(config, &H5F_def_mdc_initCacheCfg_g, sizeof(H5AC_cache_config_t));
/* Decode type sizes */
enc_size = *(*pp)++;
@@ -4195,7 +4195,7 @@ H5Pget_mdc_log_options(hid_t plist_id, hbool_t *is_enabled, char *location,
/* Copy log location to output buffer */
if(location_ptr && location)
- HDmemcpy(location, location_ptr, *location_size);
+ H5MM_memcpy(location, location_ptr, *location_size);
/* Get location size, including terminating NULL */
if(location_size) {
@@ -4250,7 +4250,7 @@ H5P_facc_mdc_log_location_enc(const void *value, void **_pp, size_t *size)
/* encode the prefix */
if(NULL != log_location) {
- HDmemcpy(*(char **)pp, log_location, len);
+ H5MM_memcpy(*(char **)pp, log_location, len);
*pp += len;
} /* end if */
} /* end if */
@@ -4536,7 +4536,7 @@ H5P__encode_coll_md_read_flag_t(const void *value, void **_pp, size_t *size)
if(NULL != *pp) {
/* Encode the value */
- HDmemcpy(*pp, coll_md_read_flag, sizeof(H5P_coll_md_read_flag_t));
+ H5MM_memcpy(*pp, coll_md_read_flag, sizeof(H5P_coll_md_read_flag_t));
*pp += sizeof(H5P_coll_md_read_flag_t);
} /* end if */
@@ -4907,6 +4907,43 @@ done:
/*-------------------------------------------------------------------------
+ * Function: H5P_reset_vol_class
+ *
+ * Purpose: Change the VOL connector for a file access property class.
+ *
+ * Note: The VOL property will be copied into the property list and
+ * the reference count on the previous VOL will _NOT_ be decremented.
+ * The reference count on the new VOL will _NOT_ be incremented.
+ *
+ * Return: SUCCEED/FAIL
+ *
+ * Programmer: Quincey Koziol
+ * March 8, 2019
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5P_reset_vol_class(const H5P_genclass_t *pclass, const H5VL_connector_prop_t *vol_prop)
+{
+ H5VL_connector_prop_t old_vol_prop; /* Previous VOL connector property */
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_NOAPI(FAIL)
+
+ /* Get the connector ID & info property */
+ if(H5P__class_get(pclass, H5F_ACS_VOL_CONN_NAME, &old_vol_prop) < 0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get VOL connector ID & info")
+
+ /* Set the new connector ID & info property */
+ if(H5P__class_set(pclass, H5F_ACS_VOL_CONN_NAME, vol_prop) < 0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set VOL connector ID & info")
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5P_set_vol_class() */
+
+
+/*-------------------------------------------------------------------------
* Function: H5Pset_vol
*
* Purpose: Set the file VOL connector (VOL_ID) for a file access
@@ -5231,7 +5268,7 @@ H5P__facc_vol_cmp(const void *_info1, const void *_info2, size_t H5_ATTR_UNUSED
/* Use one of the classes (cls1) info comparison routines to compare the
* info objects
*/
- HDassert(cls1->info_cmp == cls2->info_cmp);
+ HDassert(cls1->info_cls.cmp == cls2->info_cls.cmp);
status = H5VL_cmp_connector_info(cls1, &cmp_value, info1->connector_info, info2->connector_info);
HDassert(status >= 0);
diff --git a/src/H5Pgcpl.c b/src/H5Pgcpl.c
index ab289e4..e2fdcea 100644
--- a/src/H5Pgcpl.c
+++ b/src/H5Pgcpl.c
@@ -128,7 +128,6 @@ static const H5O_linfo_t H5G_def_linfo_g = H5G_CRT_LINK_INFO_DEF; /* Defaul
static herr_t
H5P__gcrt_reg_prop(H5P_genclass_t *pclass)
{
- hid_t lcpl_id = H5P_LINK_CREATE_DEFAULT;
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_STATIC
@@ -145,11 +144,6 @@ H5P__gcrt_reg_prop(H5P_genclass_t *pclass)
NULL, NULL, NULL, NULL) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class")
- /* Register the lcpl ID property */
- if(H5P__register_real(pclass, H5VL_PROP_GRP_LCPL_ID, sizeof(hid_t), &lcpl_id,
- NULL, NULL, NULL, NULL, NULL, 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__gcrt_reg_prop() */
diff --git a/src/H5Pint.c b/src/H5Pint.c
index e2ae792..0670adc 100644
--- a/src/H5Pint.c
+++ b/src/H5Pint.c
@@ -127,62 +127,65 @@ static herr_t H5P__free_del_name_cb(void *item, void H5_ATTR_UNUSED *key, void H
* Predefined property list classes. These are initialized at runtime by
* H5P__init_package() in this source file.
*/
-hid_t H5P_CLS_ROOT_ID_g = FAIL;
+hid_t H5P_CLS_ROOT_ID_g = H5I_INVALID_HID;
H5P_genclass_t *H5P_CLS_ROOT_g = NULL;
-hid_t H5P_CLS_OBJECT_CREATE_ID_g = FAIL;
+hid_t H5P_CLS_OBJECT_CREATE_ID_g = H5I_INVALID_HID;
H5P_genclass_t *H5P_CLS_OBJECT_CREATE_g = NULL;
-hid_t H5P_CLS_FILE_CREATE_ID_g = FAIL;
+hid_t H5P_CLS_FILE_CREATE_ID_g = H5I_INVALID_HID;
H5P_genclass_t *H5P_CLS_FILE_CREATE_g = NULL;
-hid_t H5P_CLS_FILE_ACCESS_ID_g = FAIL;
+hid_t H5P_CLS_FILE_ACCESS_ID_g = H5I_INVALID_HID;
H5P_genclass_t *H5P_CLS_FILE_ACCESS_g = NULL;
-hid_t H5P_CLS_DATASET_CREATE_ID_g = FAIL;
+hid_t H5P_CLS_DATASET_CREATE_ID_g = H5I_INVALID_HID;
H5P_genclass_t *H5P_CLS_DATASET_CREATE_g = NULL;
-hid_t H5P_CLS_DATASET_ACCESS_ID_g = FAIL;
+hid_t H5P_CLS_DATASET_ACCESS_ID_g = H5I_INVALID_HID;
H5P_genclass_t *H5P_CLS_DATASET_ACCESS_g = NULL;
-hid_t H5P_CLS_DATASET_XFER_ID_g = FAIL;
+hid_t H5P_CLS_DATASET_XFER_ID_g = H5I_INVALID_HID;
H5P_genclass_t *H5P_CLS_DATASET_XFER_g = NULL;
-hid_t H5P_CLS_FILE_MOUNT_ID_g = FAIL;
+hid_t H5P_CLS_FILE_MOUNT_ID_g = H5I_INVALID_HID;
H5P_genclass_t *H5P_CLS_FILE_MOUNT_g = NULL;
-hid_t H5P_CLS_GROUP_CREATE_ID_g = FAIL;
+hid_t H5P_CLS_GROUP_CREATE_ID_g = H5I_INVALID_HID;
H5P_genclass_t *H5P_CLS_GROUP_CREATE_g = NULL;
-hid_t H5P_CLS_GROUP_ACCESS_ID_g = FAIL;
+hid_t H5P_CLS_GROUP_ACCESS_ID_g = H5I_INVALID_HID;
H5P_genclass_t *H5P_CLS_GROUP_ACCESS_g = NULL;
-hid_t H5P_CLS_DATATYPE_CREATE_ID_g = FAIL;
+hid_t H5P_CLS_DATATYPE_CREATE_ID_g = H5I_INVALID_HID;
H5P_genclass_t *H5P_CLS_DATATYPE_CREATE_g = NULL;
-hid_t H5P_CLS_DATATYPE_ACCESS_ID_g = FAIL;
+hid_t H5P_CLS_DATATYPE_ACCESS_ID_g = H5I_INVALID_HID;
H5P_genclass_t *H5P_CLS_DATATYPE_ACCESS_g = NULL;
-hid_t H5P_CLS_ATTRIBUTE_CREATE_ID_g = FAIL;
+hid_t H5P_CLS_ATTRIBUTE_CREATE_ID_g = H5I_INVALID_HID;
H5P_genclass_t *H5P_CLS_ATTRIBUTE_CREATE_g = NULL;
-hid_t H5P_CLS_ATTRIBUTE_ACCESS_ID_g = FAIL;
+hid_t H5P_CLS_ATTRIBUTE_ACCESS_ID_g = H5I_INVALID_HID;
H5P_genclass_t *H5P_CLS_ATTRIBUTE_ACCESS_g = NULL;
-hid_t H5P_CLS_OBJECT_COPY_ID_g = FAIL;
+hid_t H5P_CLS_OBJECT_COPY_ID_g = H5I_INVALID_HID;
H5P_genclass_t *H5P_CLS_OBJECT_COPY_g = NULL;
-hid_t H5P_CLS_LINK_CREATE_ID_g = FAIL;
+hid_t H5P_CLS_LINK_CREATE_ID_g = H5I_INVALID_HID;
H5P_genclass_t *H5P_CLS_LINK_CREATE_g = NULL;
-hid_t H5P_CLS_LINK_ACCESS_ID_g = FAIL;
+hid_t H5P_CLS_LINK_ACCESS_ID_g = H5I_INVALID_HID;
H5P_genclass_t *H5P_CLS_LINK_ACCESS_g = NULL;
-hid_t H5P_CLS_STRING_CREATE_ID_g = FAIL;
+hid_t H5P_CLS_STRING_CREATE_ID_g = H5I_INVALID_HID;
H5P_genclass_t *H5P_CLS_STRING_CREATE_g = NULL;
+hid_t H5P_CLS_VOL_INITIALIZE_ID_g = H5I_INVALID_HID;
+H5P_genclass_t *H5P_CLS_VOL_INITIALIZE_g = NULL;
/*
* Predefined property lists for each predefined class. These are initialized
* at runtime by H5P__init_package() in this source file.
*/
-hid_t H5P_LST_FILE_CREATE_ID_g = FAIL;
-hid_t H5P_LST_FILE_ACCESS_ID_g = FAIL;
-hid_t H5P_LST_DATASET_CREATE_ID_g = FAIL;
-hid_t H5P_LST_DATASET_ACCESS_ID_g = FAIL;
-hid_t H5P_LST_DATASET_XFER_ID_g = FAIL;
-hid_t H5P_LST_FILE_MOUNT_ID_g = FAIL;
-hid_t H5P_LST_GROUP_CREATE_ID_g = FAIL;
-hid_t H5P_LST_GROUP_ACCESS_ID_g = FAIL;
-hid_t H5P_LST_DATATYPE_CREATE_ID_g = FAIL;
-hid_t H5P_LST_DATATYPE_ACCESS_ID_g = FAIL;
-hid_t H5P_LST_ATTRIBUTE_CREATE_ID_g = FAIL;
-hid_t H5P_LST_ATTRIBUTE_ACCESS_ID_g = FAIL;
-hid_t H5P_LST_OBJECT_COPY_ID_g = FAIL;
-hid_t H5P_LST_LINK_CREATE_ID_g = FAIL;
-hid_t H5P_LST_LINK_ACCESS_ID_g = FAIL;
+hid_t H5P_LST_FILE_CREATE_ID_g = H5I_INVALID_HID;
+hid_t H5P_LST_FILE_ACCESS_ID_g = H5I_INVALID_HID;
+hid_t H5P_LST_DATASET_CREATE_ID_g = H5I_INVALID_HID;
+hid_t H5P_LST_DATASET_ACCESS_ID_g = H5I_INVALID_HID;
+hid_t H5P_LST_DATASET_XFER_ID_g = H5I_INVALID_HID;
+hid_t H5P_LST_FILE_MOUNT_ID_g = H5I_INVALID_HID;
+hid_t H5P_LST_GROUP_CREATE_ID_g = H5I_INVALID_HID;
+hid_t H5P_LST_GROUP_ACCESS_ID_g = H5I_INVALID_HID;
+hid_t H5P_LST_DATATYPE_CREATE_ID_g = H5I_INVALID_HID;
+hid_t H5P_LST_DATATYPE_ACCESS_ID_g = H5I_INVALID_HID;
+hid_t H5P_LST_ATTRIBUTE_CREATE_ID_g = H5I_INVALID_HID;
+hid_t H5P_LST_ATTRIBUTE_ACCESS_ID_g = H5I_INVALID_HID;
+hid_t H5P_LST_OBJECT_COPY_ID_g = H5I_INVALID_HID;
+hid_t H5P_LST_LINK_CREATE_ID_g = H5I_INVALID_HID;
+hid_t H5P_LST_LINK_ACCESS_ID_g = H5I_INVALID_HID;
+hid_t H5P_LST_VOL_INITIALIZE_ID_g = H5I_INVALID_HID;
/* Root property list class library initialization object */
const H5P_libclass_t H5P_CLS_ROOT[1] = {{
@@ -283,6 +286,26 @@ const H5P_libclass_t H5P_CLS_TACC[1] = {{
NULL /* Class close callback info */
}};
+/* VOL initialization property list class library initialization object */
+/* (move to proper source code file when used for real) */
+const H5P_libclass_t H5P_CLS_VINI[1] = {{
+ "VOL initialization", /* Class name for debugging */
+ H5P_TYPE_VOL_INITIALIZE, /* Class type */
+
+ &H5P_CLS_ROOT_g, /* Parent class */
+ &H5P_CLS_VOL_INITIALIZE_g, /* Pointer to class */
+ &H5P_CLS_VOL_INITIALIZE_ID_g, /* Pointer to class ID */
+ &H5P_LST_VOL_INITIALIZE_ID_g, /* Pointer to default property list ID */
+ NULL, /* Default property registration routine */
+
+ NULL, /* Class creation callback */
+ NULL, /* Class creation callback info */
+ NULL, /* Class copy callback */
+ NULL, /* Class copy callback info */
+ NULL, /* Class close callback */
+ NULL /* Class close callback info */
+}};
+
/* Library property list classes defined in other code modules */
/* (And not present in src/H5Pprivate.h) */
@@ -331,7 +354,8 @@ static H5P_libclass_t const * const init_class[] = {
H5P_CLS_TACC, /* Datatype access */
H5P_CLS_ACRT, /* Attribute creation */
H5P_CLS_AACC, /* Attribute access */
- H5P_CLS_LCRT /* Link creation */
+ H5P_CLS_LCRT, /* Link creation */
+ H5P_CLS_VINI /* VOL initialization */
};
/* Declare a free list to manage the H5P_genclass_t struct */
@@ -525,7 +549,8 @@ H5P_term_package(void)
H5P_LST_OBJECT_COPY_ID_g =
H5P_LST_LINK_CREATE_ID_g =
H5P_LST_LINK_ACCESS_ID_g =
- H5P_LST_FILE_MOUNT_ID_g = (-1);
+ H5P_LST_VOL_INITIALIZE_ID_g =
+ H5P_LST_FILE_MOUNT_ID_g = H5I_INVALID_HID;
} /* end if */
} /* end if */
@@ -552,6 +577,7 @@ H5P_term_package(void)
H5P_CLS_OBJECT_COPY_g =
H5P_CLS_LINK_CREATE_g =
H5P_CLS_LINK_ACCESS_g =
+ H5P_CLS_VOL_INITIALIZE_g =
H5P_CLS_FILE_MOUNT_g = NULL;
H5P_CLS_ROOT_ID_g =
@@ -571,7 +597,8 @@ H5P_term_package(void)
H5P_CLS_OBJECT_COPY_ID_g =
H5P_CLS_LINK_CREATE_ID_g =
H5P_CLS_LINK_ACCESS_ID_g =
- H5P_CLS_FILE_MOUNT_ID_g = (-1);
+ H5P_CLS_VOL_INITIALIZE_ID_g =
+ H5P_CLS_FILE_MOUNT_ID_g = H5I_INVALID_HID;
} /* end if */
} /* end if */
@@ -631,7 +658,7 @@ H5P__do_prop_cb1(H5SL_t *slist, H5P_genprop_t *prop, H5P_prp_cb1_t cb)
/* Allocate space for a temporary copy of the property value */
if(NULL == (tmp_value = H5MM_malloc(prop->size)))
HGOTO_ERROR(H5E_PLIST, H5E_CANTALLOC, FAIL, "memory allocation failed for temporary property value")
- HDmemcpy(tmp_value, prop->value, prop->size);
+ H5MM_memcpy(tmp_value, prop->value, prop->size);
/* Call "type 1" callback ('create', 'copy' or 'close') */
if(cb(prop->name, prop->size, tmp_value) < 0)
@@ -642,7 +669,7 @@ H5P__do_prop_cb1(H5SL_t *slist, H5P_genprop_t *prop, H5P_prp_cb1_t cb)
HGOTO_ERROR(H5E_PLIST, H5E_CANTCOPY, FAIL, "Can't copy property")
/* Copy the changed value into the new property */
- HDmemcpy(pcopy->value, tmp_value, prop->size);
+ H5MM_memcpy(pcopy->value, tmp_value, prop->size);
/* Insert the changed property into the property list */
if(H5P__add_prop(slist, pcopy) < 0)
@@ -990,7 +1017,7 @@ H5P__dup_prop(H5P_genprop_t *oprop, H5P_prop_within_t type)
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed")
/* Copy basic property information */
- HDmemcpy(prop, oprop, sizeof(H5P_genprop_t));
+ H5MM_memcpy(prop, oprop, sizeof(H5P_genprop_t));
/* Check if we should duplicate the name or share it */
@@ -1030,7 +1057,7 @@ H5P__dup_prop(H5P_genprop_t *oprop, H5P_prop_within_t type)
HDassert(prop->size > 0);
if(NULL == (prop->value = H5MM_malloc(prop->size)))
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed")
- HDmemcpy(prop->value, oprop->value, prop->size);
+ H5MM_memcpy(prop->value, oprop->value, prop->size);
} /* end if */
/* Set return value */
@@ -1117,7 +1144,7 @@ H5P__create_prop(const char *name, size_t size, H5P_prop_within_t type,
if(value != NULL) {
if(NULL == (prop->value = H5MM_malloc (prop->size)))
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed")
- HDmemcpy(prop->value, value, prop->size);
+ H5MM_memcpy(prop->value, value, prop->size);
} /* end if */
else
prop->value = NULL;
@@ -2727,7 +2754,7 @@ H5P__poke_plist_cb(H5P_genplist_t *plist, const char *name, H5P_genprop_t *prop,
HGOTO_ERROR(H5E_PLIST, H5E_BADVALUE, FAIL, "property has zero size")
/* Overwrite value in property */
- HDmemcpy(prop->value, udata->value, prop->size);
+ H5MM_memcpy(prop->value, udata->value, prop->size);
done:
FUNC_LEAVE_NOAPI(ret_value)
@@ -2779,7 +2806,7 @@ H5P__poke_pclass_cb(H5P_genplist_t *plist, const char *name, H5P_genprop_t *prop
if(NULL == (pcopy = H5P__dup_prop(prop, H5P_PROP_WITHIN_LIST)))
HGOTO_ERROR(H5E_PLIST, H5E_CANTCOPY, FAIL, "Can't copy property")
- HDmemcpy(pcopy->value, udata->value, pcopy->size);
+ H5MM_memcpy(pcopy->value, udata->value, pcopy->size);
/* Insert the changed property into the property list */
if(H5P__add_prop(plist->props, pcopy) < 0)
@@ -2888,7 +2915,7 @@ H5P__set_plist_cb(H5P_genplist_t *plist, const char *name, H5P_genprop_t *prop,
/* Make a copy of the current value, in case the callback fails */
if(NULL == (tmp_value = H5MM_malloc(prop->size)))
HGOTO_ERROR(H5E_PLIST, H5E_CANTALLOC, FAIL, "memory allocation failed temporary property value")
- HDmemcpy(tmp_value, udata->value, prop->size);
+ H5MM_memcpy(tmp_value, udata->value, prop->size);
/* Call user's callback */
if((*(prop->set))(plist->plist_id, name, prop->size, tmp_value) < 0)
@@ -2909,7 +2936,7 @@ H5P__set_plist_cb(H5P_genplist_t *plist, const char *name, H5P_genprop_t *prop,
} /* end if */
/* Copy new [possibly unchanged] value into property value */
- HDmemcpy(prop->value, prp_value, prop->size);
+ H5MM_memcpy(prop->value, prp_value, prop->size);
done:
/* Free the temporary value buffer */
@@ -2968,7 +2995,7 @@ H5P__set_pclass_cb(H5P_genplist_t *plist, const char *name, H5P_genprop_t *prop,
/* Make a copy of the current value, in case the callback fails */
if(NULL == (tmp_value = H5MM_malloc(prop->size)))
HGOTO_ERROR(H5E_PLIST, H5E_CANTALLOC, FAIL, "memory allocation failed temporary property value")
- HDmemcpy(tmp_value, udata->value, prop->size);
+ H5MM_memcpy(tmp_value, udata->value, prop->size);
/* Call user's callback */
if((*(prop->set))(plist->plist_id, name, prop->size, tmp_value) < 0)
@@ -2985,7 +3012,7 @@ H5P__set_pclass_cb(H5P_genplist_t *plist, const char *name, H5P_genprop_t *prop,
if(NULL == (pcopy = H5P__dup_prop(prop, H5P_PROP_WITHIN_LIST)))
HGOTO_ERROR(H5E_PLIST, H5E_CANTCOPY, FAIL, "Can't copy property")
- HDmemcpy(pcopy->value, prp_value, pcopy->size);
+ H5MM_memcpy(pcopy->value, prp_value, pcopy->size);
/* Insert the changed property into the property list */
if(H5P__add_prop(plist->props, pcopy) < 0)
@@ -3061,6 +3088,116 @@ done:
/*--------------------------------------------------------------------------
NAME
+ H5P__class_get
+ PURPOSE
+ Internal routine to get a property's value from a property class.
+ USAGE
+ herr_t H5P__class_get(pclass, name, value)
+ const H5P_genclass_t *pclass; IN: Property class to find property in
+ const char *name; IN: Name of property to get
+ void *value; IN: Pointer to the value for the property
+ RETURNS
+ Returns non-negative on success, negative on failure.
+ DESCRIPTION
+ Gets the current value for a property in a property class. The property
+ name must exist or this routine will fail.
+ GLOBAL VARIABLES
+ COMMENTS, BUGS, ASSUMPTIONS
+ The 'get' callback routine registered for this property will _NOT_ be
+ called, this routine is designed for internal library use only!
+
+ This routine may not be called for zero-sized properties and will
+ return an error in that case.
+ EXAMPLES
+ REVISION LOG
+--------------------------------------------------------------------------*/
+herr_t
+H5P__class_get(const H5P_genclass_t *pclass, const char *name, void *value)
+{
+ H5P_genprop_t *prop; /* Temporary property pointer */
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_PACKAGE
+
+ /* Sanity check */
+ HDassert(pclass);
+ HDassert(name);
+ HDassert(value);
+
+ /* Find property in list */
+ if(NULL == (prop = (H5P_genprop_t *)H5SL_search(pclass->props, name)))
+ HGOTO_ERROR(H5E_PLIST, H5E_NOTFOUND, FAIL, "property doesn't exist")
+
+ /* Check for property size >0 */
+ if(0 == prop->size)
+ HGOTO_ERROR(H5E_PLIST, H5E_BADVALUE, FAIL, "property has zero size")
+
+ /* Copy the property value */
+ H5MM_memcpy(value, prop->value, prop->size);
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* H5P__class_get() */
+
+
+/*--------------------------------------------------------------------------
+ NAME
+ H5P__class_set
+ PURPOSE
+ Internal routine to set a property's value in a property class.
+ USAGE
+ herr_t H5P__class_set(pclass, name, value)
+ const H5P_genclass_t *pclass; IN: Property class to find property in
+ const char *name; IN: Name of property to set
+ const void *value; IN: Pointer to the value for the property
+ RETURNS
+ Returns non-negative on success, negative on failure.
+ DESCRIPTION
+ Sets a new value for a property in a property class. The property name
+ must exist or this routine will fail.
+ GLOBAL VARIABLES
+ COMMENTS, BUGS, ASSUMPTIONS
+ The 'set' callback routine registered for this property will _NOT_ be
+ called, this routine is designed for internal library use only!
+
+ This routine may not be called for zero-sized properties and will
+ return an error in that case.
+
+ The previous value is overwritten, not released in any way.
+ EXAMPLES
+ REVISION LOG
+--------------------------------------------------------------------------*/
+herr_t
+H5P__class_set(const H5P_genclass_t *pclass, const char *name, const void *value)
+{
+ H5P_genprop_t *prop; /* Temporary property pointer */
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_PACKAGE
+
+ /* Sanity check */
+ HDassert(pclass);
+ HDassert(name);
+ HDassert(value);
+
+ /* Find property in list */
+ if(NULL == (prop = (H5P_genprop_t *)H5SL_search(pclass->props, name)))
+ HGOTO_ERROR(H5E_PLIST, H5E_NOTFOUND, FAIL, "property doesn't exist")
+
+ /* Check for property size >0 */
+ if(0 == prop->size)
+ HGOTO_ERROR(H5E_PLIST, H5E_BADVALUE, FAIL, "property has zero size")
+
+ /* Copy the property value */
+ H5MM_memcpy(prop->value, value, prop->size);
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* H5P__class_set() */
+
+
+/*--------------------------------------------------------------------------
+ NAME
H5P_exist_plist
PURPOSE
Internal routine to query the existance of a property in a property list.
@@ -4234,7 +4371,7 @@ H5P__peek_cb(H5P_genplist_t *plist, const char *name, H5P_genprop_t *prop,
HGOTO_ERROR(H5E_PLIST, H5E_BADVALUE, FAIL, "property has zero size")
/* Make a (shallow) copy of the value */
- HDmemcpy(udata->value, prop->value, prop->size);
+ H5MM_memcpy(udata->value, prop->value, prop->size);
done:
FUNC_LEAVE_NOAPI(ret_value)
@@ -4334,18 +4471,18 @@ H5P__get_cb(H5P_genplist_t *plist, const char *name, H5P_genprop_t *prop,
/* Make a copy of the current value, in case the callback fails */
if(NULL == (tmp_value = H5MM_malloc(prop->size)))
HGOTO_ERROR(H5E_PLIST, H5E_CANTALLOC, FAIL, "memory allocation failed temporary property value")
- HDmemcpy(tmp_value, prop->value, prop->size);
+ H5MM_memcpy(tmp_value, prop->value, prop->size);
/* Call user's callback */
if((*(prop->get))(plist->plist_id, name, prop->size, tmp_value) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTINIT, FAIL, "can't set property value")
/* Copy new [possibly unchanged] value into return value */
- HDmemcpy(udata->value, tmp_value, prop->size);
+ H5MM_memcpy(udata->value, tmp_value, prop->size);
} /* end if */
/* No 'get' callback, just copy value */
else
- HDmemcpy(udata->value, prop->value, prop->size);
+ H5MM_memcpy(udata->value, prop->value, prop->size);
done:
/* Free the temporary value buffer */
@@ -4518,7 +4655,7 @@ H5P__del_pclass_cb(H5P_genplist_t *plist, const char *name, H5P_genprop_t *prop,
/* Allocate space for a temporary copy of the property value */
if(NULL == (tmp_value = H5MM_malloc(prop->size)))
HGOTO_ERROR(H5E_PLIST, H5E_CANTALLOC, FAIL, "memory allocation failed for temporary property value")
- HDmemcpy(tmp_value, prop->value, prop->size);
+ H5MM_memcpy(tmp_value, prop->value, prop->size);
/* Call user's callback */
if((*(prop->del))(plist->plist_id, name, prop->size, tmp_value) < 0)
@@ -4967,7 +5104,7 @@ H5P_close(void *_plist)
/* Allocate space for a temporary copy of the property value */
if(NULL==(tmp_value=H5MM_malloc(tmp->size)))
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed for temporary property value")
- HDmemcpy(tmp_value,tmp->value,tmp->size);
+ H5MM_memcpy(tmp_value,tmp->value,tmp->size);
/* Call the 'close' callback */
(tmp->close)(tmp->name,tmp->size,tmp_value);
@@ -5298,7 +5435,7 @@ H5P__new_plist_of_type(H5P_plist_type_t type)
FUNC_ENTER_PACKAGE
/* Sanity checks */
- HDcompile_assert(H5P_TYPE_ATTRIBUTE_ACCESS == (H5P_TYPE_MAX_TYPE - 1));
+ HDcompile_assert(H5P_TYPE_VOL_INITIALIZE == (H5P_TYPE_MAX_TYPE - 1));
HDassert(type >= H5P_TYPE_USER && type <= H5P_TYPE_LINK_ACCESS);
/* Check arguments */
@@ -5377,6 +5514,10 @@ H5P__new_plist_of_type(H5P_plist_type_t type)
class_id = H5P_CLS_LINK_ACCESS_ID_g;
break;
+ case H5P_TYPE_VOL_INITIALIZE:
+ class_id = H5P_CLS_VOL_INITIALIZE_ID_g;
+ break;
+
case H5P_TYPE_USER: /* shut compiler warnings up */
case H5P_TYPE_ROOT:
case H5P_TYPE_MAX_TYPE:
diff --git a/src/H5Plapl.c b/src/H5Plapl.c
index bedeed9..7a7cc23 100644
--- a/src/H5Plapl.c
+++ b/src/H5Plapl.c
@@ -715,7 +715,7 @@ H5P__lacc_elink_pref_enc(const void *value, void **_pp, size_t *size)
/* encode the prefix */
if(NULL != elink_pref) {
- HDmemcpy(*(char **)pp, elink_pref, len);
+ H5MM_memcpy(*(char **)pp, elink_pref, len);
*pp += len;
} /* end if */
} /* end if */
diff --git a/src/H5Plcpl.c b/src/H5Plcpl.c
index 16be52a..ace853a 100644
--- a/src/H5Plcpl.c
+++ b/src/H5Plcpl.c
@@ -48,30 +48,6 @@
#define H5L_CRT_INTERMEDIATE_GROUP_ENC H5P__encode_unsigned
#define H5L_CRT_INTERMEDIATE_GROUP_DEC H5P__decode_unsigned
-/* ======== VOL specific properties ========= */
-/* Definitions for target object ID */
-#define H5L_CRT_TARGET_SIZE sizeof(void *)
-#define H5L_CRT_TARGET_DEF NULL
-
-/* Definitions for Location params */
-#define H5L_CRT_LOCATION_SIZE sizeof(H5VL_loc_params_t)
-#define H5L_CRT_LOCATION_DEF {H5I_BADID, H5VL_OBJECT_BY_SELF, {{HADDR_UNDEF}}}
-
-/* Definitions for target object NAME */
-#define H5L_CRT_TARGET_NAME_SIZE sizeof(char *)
-#define H5L_CRT_TARGET_NAME_DEF NULL
-
-/* Definitions for link type */
-#define H5L_CRT_LINK_TYPE_SIZE sizeof(link_type)
-#define H5L_CRT_LINK_TYPE_DEF H5L_TYPE_ERROR
-
-/* Definitions for UDATA */
-#define H5L_CRT_UDATA_SIZE sizeof(void *)
-#define H5L_CRT_UDATA_DEF NULL
-
-/* Definitions for UDATA_SIZE */
-#define H5L_CRT_UDATA_SIZE_SIZE sizeof(size_t)
-#define H5L_CRT_UDATA_SIZE_DEF 0
/******************/
/* Local Typedefs */
@@ -143,12 +119,6 @@ static const unsigned H5L_def_intmd_group_g = H5L_CRT_INTERMEDIATE_GROUP_DEF;
herr_t
H5P_lcrt_reg_prop(H5P_genclass_t *pclass)
{
- void* target = H5L_CRT_TARGET_DEF;
- H5VL_loc_params_t loc_params = H5L_CRT_LOCATION_DEF;
- char *target_name = H5L_CRT_TARGET_NAME_DEF;
- H5L_type_t link_type = H5L_CRT_LINK_TYPE_DEF;
- void *udata = H5L_CRT_UDATA_DEF;
- size_t udata_size = H5L_CRT_UDATA_SIZE_DEF;
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(FAIL)
@@ -159,30 +129,6 @@ H5P_lcrt_reg_prop(H5P_genclass_t *pclass)
NULL, NULL, NULL, NULL) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class")
- if(H5P__register_real(pclass, H5VL_PROP_LINK_TARGET, H5L_CRT_TARGET_SIZE, &target,
- NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class")
-
- if(H5P__register_real(pclass, H5VL_PROP_LINK_TARGET_LOC_PARAMS, H5L_CRT_LOCATION_SIZE, &loc_params,
- NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class")
-
- if(H5P__register_real(pclass, H5VL_PROP_LINK_TARGET_NAME, H5L_CRT_TARGET_NAME_SIZE, &target_name,
- NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class")
-
- if(H5P__register_real(pclass, H5VL_PROP_LINK_TYPE, H5L_CRT_LINK_TYPE_SIZE, &link_type,
- NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class")
-
- if(H5P__register_real(pclass, H5VL_PROP_LINK_UDATA, H5L_CRT_UDATA_SIZE, &udata,
- NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class")
-
- if(H5P__register_real(pclass, H5VL_PROP_LINK_UDATA_SIZE, H5L_CRT_UDATA_SIZE_SIZE, &udata_size,
- NULL, NULL, NULL, NULL, NULL, 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_lcrt_reg_prop() */
diff --git a/src/H5Pocpl.c b/src/H5Pocpl.c
index c2bf6cb..a60c593 100644
--- a/src/H5Pocpl.c
+++ b/src/H5Pocpl.c
@@ -1501,7 +1501,7 @@ H5P__ocrt_pipeline_enc(const void *value, void **_pp, size_t *size)
*(*pp)++ = (uint8_t)TRUE;
/* encode filter name */
- HDmemcpy(*pp, (uint8_t *)(pline->filter[u].name), H5Z_COMMON_NAME_LEN);
+ H5MM_memcpy(*pp, (uint8_t *)(pline->filter[u].name), H5Z_COMMON_NAME_LEN);
*pp += H5Z_COMMON_NAME_LEN;
} /* end if */
else
diff --git a/src/H5Pocpypl.c b/src/H5Pocpypl.c
index 666a945..2dc92f9 100644
--- a/src/H5Pocpypl.c
+++ b/src/H5Pocpypl.c
@@ -384,7 +384,7 @@ H5P__ocpy_merge_comm_dt_list_enc(const void *value, void **_pp, size_t *size)
/* Encode merge committed dtype list */
if(*pp) {
- HDmemcpy(*(char **)pp, dt_list->path, len);
+ H5MM_memcpy(*(char **)pp, dt_list->path, len);
*pp += len;
} /* end if */
diff --git a/src/H5Ppkg.h b/src/H5Ppkg.h
index 13f3b13..c8e5e98 100644
--- a/src/H5Ppkg.h
+++ b/src/H5Ppkg.h
@@ -151,6 +151,10 @@ H5_DLL herr_t H5P__register(H5P_genclass_t **pclass, const char *name, size_t si
H5P_prp_close_func_t prp_close);
H5_DLL herr_t H5P__add_prop(H5SL_t *props, H5P_genprop_t *prop);
H5_DLL herr_t H5P__access_class(H5P_genclass_t *pclass, H5P_class_mod_t mod);
+H5_DLL herr_t H5P__class_get(const H5P_genclass_t *pclass, const char *name,
+ void *value);
+H5_DLL herr_t H5P__class_set(const H5P_genclass_t *pclass, const char *name,
+ const void *value);
H5_DLL htri_t H5P__exist_pclass(H5P_genclass_t *pclass, const char *name);
H5_DLL herr_t H5P__get_size_plist(const H5P_genplist_t *plist, const char *name,
size_t *size);
diff --git a/src/H5Pprivate.h b/src/H5Pprivate.h
index 866f088..07910c3 100644
--- a/src/H5Pprivate.h
+++ b/src/H5Pprivate.h
@@ -78,6 +78,7 @@ typedef enum H5P_plist_type_t {
H5P_TYPE_LINK_CREATE = 16,
H5P_TYPE_LINK_ACCESS = 17,
H5P_TYPE_ATTRIBUTE_ACCESS = 18,
+ H5P_TYPE_VOL_INITIALIZE = 19,
H5P_TYPE_MAX_TYPE
} H5P_plist_type_t;
@@ -148,6 +149,7 @@ H5_DLLVAR const struct H5P_libclass_t H5P_CLS_OCPY[1]; /* Object copy */
/* Forward declaration of structs used below */
struct H5O_fill_t;
struct H5T_t;
+struct H5VL_connector_prop_t;
/* Package initialization routine */
H5_DLL herr_t H5P_init(void);
@@ -178,6 +180,8 @@ H5_DLL const void *H5P_peek_driver_info(H5P_genplist_t *plist);
H5_DLL herr_t H5P_set_driver(H5P_genplist_t *plist, hid_t new_driver_id,
const void *new_driver_info);
H5_DLL herr_t H5P_set_vol(H5P_genplist_t *plist, hid_t vol_id, const void *vol_info);
+H5_DLL herr_t H5P_reset_vol_class(const H5P_genclass_t *pclass,
+ const struct H5VL_connector_prop_t *vol_prop);
H5_DLL herr_t H5P_set_vlen_mem_manager(H5P_genplist_t *plist,
H5MM_allocate_t alloc_func, void *alloc_info, H5MM_free_t free_func,
void *free_info);
diff --git a/src/H5Ppublic.h b/src/H5Ppublic.h
index 078fe74..cad2071 100644
--- a/src/H5Ppublic.h
+++ b/src/H5Ppublic.h
@@ -68,6 +68,7 @@
#define H5P_OBJECT_COPY (H5OPEN H5P_CLS_OBJECT_COPY_ID_g)
#define H5P_LINK_CREATE (H5OPEN H5P_CLS_LINK_CREATE_ID_g)
#define H5P_LINK_ACCESS (H5OPEN H5P_CLS_LINK_ACCESS_ID_g)
+#define H5P_VOL_INITIALIZE (H5OPEN H5P_CLS_VOL_INITIALIZE_ID_g)
/*
* The library's default property lists
@@ -87,6 +88,7 @@
#define H5P_OBJECT_COPY_DEFAULT (H5OPEN H5P_LST_OBJECT_COPY_ID_g)
#define H5P_LINK_CREATE_DEFAULT (H5OPEN H5P_LST_LINK_CREATE_ID_g)
#define H5P_LINK_ACCESS_DEFAULT (H5OPEN H5P_LST_LINK_ACCESS_ID_g)
+#define H5P_VOL_INITIALIZE_DEFAULT (H5OPEN H5P_LST_VOL_INITIALIZE_ID_g)
/* Common creation order flags (for links in groups and attributes on objects) */
#define H5P_CRT_ORDER_TRACKED 0x0001
@@ -195,6 +197,7 @@ H5_DLLVAR hid_t H5P_CLS_ATTRIBUTE_ACCESS_ID_g;
H5_DLLVAR hid_t H5P_CLS_OBJECT_COPY_ID_g;
H5_DLLVAR hid_t H5P_CLS_LINK_CREATE_ID_g;
H5_DLLVAR hid_t H5P_CLS_LINK_ACCESS_ID_g;
+H5_DLLVAR hid_t H5P_CLS_VOL_INITIALIZE_ID_g;
/* Default roperty list IDs */
/* (Internal to library, do not use! Use macros above) */
@@ -213,6 +216,7 @@ H5_DLLVAR hid_t H5P_LST_ATTRIBUTE_ACCESS_ID_g;
H5_DLLVAR hid_t H5P_LST_OBJECT_COPY_ID_g;
H5_DLLVAR hid_t H5P_LST_LINK_CREATE_ID_g;
H5_DLLVAR hid_t H5P_LST_LINK_ACCESS_ID_g;
+H5_DLLVAR hid_t H5P_LST_VOL_INITIALIZE_ID_g;
/*********************/
/* Public Prototypes */
@@ -236,7 +240,7 @@ H5_DLL herr_t H5Pinsert2(hid_t plist_id, const char *name, size_t size,
H5P_prp_compare_func_t prp_cmp, H5P_prp_close_func_t prp_close);
H5_DLL herr_t H5Pset(hid_t plist_id, const char *name, const void *value);
H5_DLL htri_t H5Pexist(hid_t plist_id, const char *name);
-H5_DLL herr_t H5Pencode(hid_t plist_id, void *buf, size_t *nalloc);
+H5_DLL herr_t H5Pencode2(hid_t plist_id, void *buf, size_t *nalloc, hid_t fapl_id);
H5_DLL hid_t H5Pdecode(const void *buf);
H5_DLL herr_t H5Pget_size(hid_t id, const char *name, size_t *size);
H5_DLL herr_t H5Pget_nprops(hid_t id, size_t *nprops);
@@ -536,6 +540,7 @@ H5_DLL herr_t H5Pinsert1(hid_t plist_id, const char *name, size_t size,
void *value, H5P_prp_set_func_t prp_set, H5P_prp_get_func_t prp_get,
H5P_prp_delete_func_t prp_delete, H5P_prp_copy_func_t prp_copy,
H5P_prp_close_func_t prp_close);
+H5_DLL herr_t H5Pencode1(hid_t plist_id, void *buf, size_t *nalloc);
H5_DLL H5Z_filter_t H5Pget_filter1(hid_t plist_id, unsigned filter,
unsigned int *flags/*out*/, size_t *cd_nelmts/*out*/,
unsigned cd_values[]/*out*/, size_t namelen, char name[]);
diff --git a/src/H5Rint.c b/src/H5Rint.c
index a4f76ce..8109ac0 100644
--- a/src/H5Rint.c
+++ b/src/H5Rint.c
@@ -23,6 +23,7 @@
/***********/
#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 "H5Gprivate.h" /* Groups */
@@ -215,6 +216,9 @@ H5R__create(void *_ref, H5G_loc_t *loc, const char *name, H5R_type_t ref_type, H
obj_loc.path = &path;
H5G_loc_reset(&obj_loc);
+ /* Set the FAPL for the API context */
+ H5CX_set_libver_bounds(loc->oloc->file);
+
/* Find the object */
if(H5G_loc_find(loc, name, &obj_loc) < 0)
HGOTO_ERROR(H5E_REFERENCE, H5E_NOTFOUND, FAIL, "object not found")
diff --git a/src/H5S.c b/src/H5S.c
index 2faf540..5153045 100644
--- a/src/H5S.c
+++ b/src/H5S.c
@@ -23,9 +23,11 @@
/***********/
#include "H5private.h" /* Generic Functions */
#include "H5Eprivate.h" /* Error handling */
+#include "H5CXprivate.h" /* API Contexts */
#include "H5Fprivate.h" /* Files */
#include "H5FLprivate.h" /* Free lists */
#include "H5Iprivate.h" /* IDs */
+#include "H5MMprivate.h" /* Memory management */
#include "H5Oprivate.h" /* Object headers */
#include "H5Spkg.h" /* Dataspaces */
@@ -46,7 +48,12 @@
/********************/
/* Local Prototypes */
/********************/
-static htri_t H5S_is_simple(const H5S_t *sdim);
+static htri_t H5S__is_simple(const H5S_t *sdim);
+
+
+/*****************************/
+/* Library Private Variables */
+/*****************************/
/*********************/
@@ -60,18 +67,10 @@ hbool_t H5_PKG_INIT_VAR = FALSE;
const unsigned H5O_sdspace_ver_bounds[] = {
H5O_SDSPACE_VERSION_1, /* H5F_LIBVER_EARLIEST */
H5O_SDSPACE_VERSION_2, /* H5F_LIBVER_V18 */
+ H5O_SDSPACE_VERSION_2, /* H5F_LIBVER_V110 */
H5O_SDSPACE_VERSION_LATEST /* H5F_LIBVER_LATEST */
};
-/*****************************/
-/* Library Private Variables */
-/*****************************/
-
-
-/*******************/
-/* Local Variables */
-/*******************/
-
/* Declare a free list to manage the H5S_extent_t struct */
H5FL_DEFINE(H5S_extent_t);
@@ -81,6 +80,11 @@ H5FL_DEFINE(H5S_t);
/* Declare a free list to manage the array's of hsize_t's */
H5FL_ARR_DEFINE(hsize_t, H5S_MAX_RANK);
+
+/*******************/
+/* Local Variables */
+/*******************/
+
/* Dataspace ID class */
static const H5I_class_t H5I_DATASPACE_CLS[1] = {{
H5I_DATASPACE, /* ID class value */
@@ -89,6 +93,14 @@ static const H5I_class_t H5I_DATASPACE_CLS[1] = {{
(H5I_free_t)H5S_close /* Callback routine for closing objects of this class */
}};
+/* Dataspace selection iterator ID class */
+static const H5I_class_t H5I_SPACE_SEL_ITER_CLS[1] = {{
+ H5I_SPACE_SEL_ITER, /* ID class value */
+ 0, /* Class flags */
+ 0, /* # of reserved IDs for class */
+ (H5I_free_t)H5S_sel_iter_close /* Callback routine for closing objects of this class */
+}};
+
/* Flag indicating "top" of interface has been initialized */
static hbool_t H5S_top_package_initialize_s = FALSE;
@@ -112,9 +124,13 @@ H5S__init_package(void)
FUNC_ENTER_PACKAGE
- /* Initialize the atom group for the file IDs */
+ /* Initialize the atom group for the dataspace IDs */
if(H5I_register_type(H5I_DATASPACE_CLS) < 0)
- HGOTO_ERROR(H5E_DATASPACE, H5E_CANTINIT, FAIL, "unable to initialize interface")
+ HGOTO_ERROR(H5E_DATASPACE, H5E_CANTINIT, FAIL, "unable to initialize dataspace ID class")
+
+ /* Initialize the atom group for the dataspace selction iterator IDs */
+ if(H5I_register_type(H5I_SPACE_SEL_ITER_CLS) < 0)
+ HGOTO_ERROR(H5E_DATASPACE, H5E_CANTINIT, FAIL, "unable to initialize dataspace selection iterator ID class")
/* Mark "top" of interface as initialized, too */
H5S_top_package_initialize_s = TRUE;
@@ -155,6 +171,11 @@ H5S_top_term_package(void)
n++; /*H5I*/
} /* end if */
+ if(H5I_nmembers(H5I_SPACE_SEL_ITER) > 0) {
+ (void)H5I_clear_type(H5I_SPACE_SEL_ITER, FALSE, FALSE);
+ n++; /*H5I*/
+ } /* end if */
+
/* Mark "top" of interface as closed */
if(0 == n)
H5S_top_package_initialize_s = FALSE;
@@ -194,11 +215,15 @@ H5S_term_package(void)
if(H5_PKG_INIT_VAR) {
/* Sanity checks */
HDassert(0 == H5I_nmembers(H5I_DATASPACE));
+ HDassert(0 == H5I_nmembers(H5I_SPACE_SEL_ITER));
HDassert(FALSE == H5S_top_package_initialize_s);
/* Destroy the dataspace object id group */
n += (H5I_dec_type_ref(H5I_DATASPACE) > 0);
+ /* Destroy the dataspace selection iterator object id group */
+ n += (H5I_dec_type_ref(H5I_SPACE_SEL_ITER) > 0);
+
/* Mark interface as closed */
if(0 == n)
H5_PKG_INIT_VAR = FALSE;
@@ -329,10 +354,9 @@ H5S_create(H5S_class_t type)
ret_value = new_ds;
done:
- if(ret_value == NULL) {
+ if(ret_value == NULL)
if(new_ds && H5S_close(new_ds) < 0)
HDONE_ERROR(H5E_DATASPACE, H5E_CANTRELEASE, NULL, "unable to release dataspace")
- } /* end if */
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5S_create() */
@@ -359,7 +383,7 @@ done:
hid_t
H5Screate(H5S_class_t type)
{
- H5S_t *new_ds=NULL; /* New dataspace structure */
+ H5S_t *new_ds = NULL; /* New dataspace structure */
hid_t ret_value; /* Return value */
FUNC_ENTER_API(FAIL)
@@ -373,21 +397,20 @@ H5Screate(H5S_class_t type)
HGOTO_ERROR(H5E_DATASPACE, H5E_CANTCREATE, FAIL, "unable to create dataspace")
/* Atomize */
- if((ret_value = H5I_register (H5I_DATASPACE, new_ds, TRUE)) < 0)
+ if((ret_value = H5I_register(H5I_DATASPACE, new_ds, TRUE)) < 0)
HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, FAIL, "unable to register dataspace atom")
done:
- if(ret_value < 0) {
+ if(ret_value < 0)
if(new_ds && H5S_close(new_ds) < 0)
HDONE_ERROR(H5E_DATASPACE, H5E_CANTRELEASE, FAIL, "unable to release dataspace")
- } /* end if */
FUNC_LEAVE_API(ret_value)
} /* end H5Screate() */
/*-------------------------------------------------------------------------
- * Function: H5S_extent_release
+ * Function: H5S__extent_release
*
* Purpose: Releases all memory associated with a dataspace extent.
*
@@ -396,16 +419,12 @@ done:
* Programmer: Quincey Koziol
* Thursday, July 23, 1998
*
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
herr_t
-H5S_extent_release(H5S_extent_t *extent)
+H5S__extent_release(H5S_extent_t *extent)
{
- herr_t ret_value=SUCCEED; /* Return value */
-
- FUNC_ENTER_NOAPI(FAIL)
+ FUNC_ENTER_PACKAGE_NOERR
HDassert(extent);
@@ -417,9 +436,8 @@ H5S_extent_release(H5S_extent_t *extent)
extent->max = H5FL_ARR_FREE(hsize_t, extent->max);
} /* end if */
-done:
- FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5S_extent_release() */
+ FUNC_LEAVE_NOAPI(SUCCEED)
+} /* end H5S__extent_release() */
/*-------------------------------------------------------------------------
@@ -445,16 +463,20 @@ H5S_close(H5S_t *ds)
/* Release selection (this should come before the extent release) */
if(H5S_SELECT_RELEASE(ds) < 0)
- HDONE_ERROR(H5E_DATASPACE, H5E_CANTRELEASE, FAIL, "unable to release dataspace selection")
+ HGOTO_ERROR(H5E_DATASPACE, H5E_CANTRELEASE, FAIL, "unable to release dataspace selection")
/* Release extent */
- if(H5S_extent_release(&ds->extent) < 0)
- HDONE_ERROR(H5E_DATASPACE, H5E_CANTRELEASE, FAIL, "unable to release dataspace extent")
-
- /* Release the main structure */
- ds = H5FL_FREE(H5S_t, ds);
+ if(H5S__extent_release(&ds->extent) < 0)
+ HGOTO_ERROR(H5E_DATASPACE, H5E_CANTRELEASE, FAIL, "unable to release dataspace extent")
done:
+ /* Release the main structure.
+ * Always do this to ensure that we don't leak memory when calling this
+ * function on partially constructed dataspaces (which will fail one or
+ * both of the above calls)
+ */
+ H5FL_FREE(H5S_t, ds);
+
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5S_close() */
@@ -466,13 +488,9 @@ done:
*
* Return: Non-negative on success/Negative on failure
*
- * Errors:
- *
* Programmer: Robb Matzke
* Tuesday, December 9, 1997
*
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
herr_t
@@ -484,7 +502,7 @@ H5Sclose(hid_t space_id)
H5TRACE1("e", "i", space_id);
/* Check args */
- if (NULL == H5I_object_verify(space_id,H5I_DATASPACE))
+ if(NULL == H5I_object_verify(space_id, H5I_DATASPACE))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataspace")
/* When the reference count reaches zero the resources are freed */
@@ -502,14 +520,11 @@ done:
* Purpose: Copies a dataspace.
*
* Return: Success: ID of the new dataspace
- *
* Failure: Negative
*
* Programmer: Robb Matzke
* Friday, January 30, 1998
*
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
hid_t
@@ -535,10 +550,9 @@ H5Scopy(hid_t space_id)
HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, FAIL, "unable to register dataspace atom")
done:
- if(ret_value < 0) {
+ if(ret_value < 0)
if(dst && H5S_close(dst) < 0)
HDONE_ERROR(H5E_DATASPACE, H5E_CANTRELEASE, FAIL, "unable to release dataspace")
- } /* end if */
FUNC_LEAVE_API(ret_value)
} /* end H5Scopy() */
@@ -554,8 +568,6 @@ done:
* Programmer: Quincey Koziol
* Thursday, July 23, 1998
*
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
herr_t
@@ -593,8 +605,6 @@ done:
* Programmer: Neil Fortner
* Monday, February 23, 2015
*
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
herr_t
@@ -608,7 +618,7 @@ H5S_extent_copy(H5S_t *dst, const H5S_t *src)
HDassert(src);
/* Copy extent */
- if(H5S_extent_copy_real(&(dst->extent), &(src->extent), TRUE) < 0)
+ if(H5S__extent_copy_real(&(dst->extent), &(src->extent), TRUE) < 0)
HGOTO_ERROR(H5E_DATASPACE, H5E_CANTCOPY, FAIL, "can't copy extent")
/* If the selection is 'all', update the number of elements selected in the
@@ -623,7 +633,7 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5S_extent_copy_real
+ * Function: H5S__extent_copy_real
*
* Purpose: Copies a dataspace extent
*
@@ -632,20 +642,18 @@ done:
* Programmer: Quincey Koziol
* Wednesday, June 3, 1998
*
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
herr_t
-H5S_extent_copy_real(H5S_extent_t *dst, const H5S_extent_t *src, hbool_t copy_max)
+H5S__extent_copy_real(H5S_extent_t *dst, const H5S_extent_t *src, hbool_t copy_max)
{
unsigned u;
herr_t ret_value = SUCCEED; /* Return value */
- FUNC_ENTER_NOAPI(FAIL)
+ FUNC_ENTER_PACKAGE
/* Release destination extent before we copy over it */
- if(H5S_extent_release(dst) < 0)
+ if(H5S__extent_release(dst) < 0)
HGOTO_ERROR(H5E_DATASPACE, H5E_CANTRELEASE, FAIL, "unable to release dataspace extent")
/* Copy the regular fields */
@@ -690,7 +698,7 @@ H5S_extent_copy_real(H5S_extent_t *dst, const H5S_extent_t *src, hbool_t copy_ma
done:
FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5S_extent_copy_real() */
+} /* end H5S__extent_copy_real() */
/*-------------------------------------------------------------------------
@@ -704,14 +712,11 @@ done:
* selection)
*
* Return: Success: A pointer to a new copy of SRC
- *
* Failure: NULL
*
* Programmer: Robb Matzke
* Thursday, December 4, 1997
*
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
H5S_t *
@@ -726,7 +731,7 @@ H5S_copy(const H5S_t *src, hbool_t share_selection, hbool_t copy_max)
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed")
/* Copy the source dataspace's extent */
- if(H5S_extent_copy_real(&(dst->extent), &(src->extent), copy_max) < 0)
+ if(H5S__extent_copy_real(&(dst->extent), &(src->extent), copy_max) < 0)
HGOTO_ERROR(H5E_DATASPACE, H5E_CANTCOPY, NULL, "can't copy extent")
/* Copy the source dataspace's selection */
@@ -751,7 +756,6 @@ done:
* Purpose: Determines how many data points a dataset extent has.
*
* Return: Success: Number of data points in the dataset extent.
- *
* Failure: negative
*
* Programmer: Robb Matzke
@@ -761,9 +765,6 @@ done:
* pattern, don't call it directly, use the appropriate macro
* defined in H5Sprivate.h.
*
- * Modifications:
- * Changed Name - QAK 7/7/98
- *
*-------------------------------------------------------------------------
*/
hssize_t
@@ -790,15 +791,11 @@ done:
* Purpose: Determines how many data points a dataset extent has.
*
* Return: Success: Number of data points in the dataset.
- *
* Failure: negative
*
* Programmer: Robb Matzke
* Tuesday, December 9, 1997
*
- * Modifications:
- * Changed Name - QAK 7/7/98
- *
*-------------------------------------------------------------------------
*/
hssize_t
@@ -832,14 +829,11 @@ done:
*
* Return: Success: Maximum number of data points the dataspace
* may have.
- *
* Failure: 0
*
* Programmer: Robb Matzke
* Tuesday, December 9, 1997
*
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
hsize_t
@@ -853,7 +847,7 @@ H5S_get_npoints_max(const H5S_t *ds)
/* check args */
HDassert(ds);
- switch (H5S_GET_EXTENT_TYPE(ds)) {
+ switch(H5S_GET_EXTENT_TYPE(ds)) {
case H5S_NULL:
ret_value = 0;
break;
@@ -863,31 +857,30 @@ H5S_get_npoints_max(const H5S_t *ds)
break;
case H5S_SIMPLE:
- if (ds->extent.max) {
- for (ret_value=1, u=0; u<ds->extent.rank; u++) {
- if (H5S_UNLIMITED==ds->extent.max[u]) {
+ if(ds->extent.max) {
+ for(ret_value = 1, u = 0; u < ds->extent.rank; u++) {
+ if(H5S_UNLIMITED == ds->extent.max[u]) {
ret_value = HSIZET_MAX;
break;
- }
+ } /* end if */
else
ret_value *= ds->extent.max[u];
- }
- }
- else {
- for (ret_value=1, u=0; u<ds->extent.rank; u++)
+ } /* end for */
+ } /* end if */
+ else
+ for(ret_value = 1, u = 0; u < ds->extent.rank; u++)
ret_value *= ds->extent.size[u];
- }
break;
case H5S_NO_CLASS:
default:
HDassert("unknown dataspace class" && 0);
HGOTO_ERROR(H5E_DATASPACE, H5E_UNSUPPORTED, 0, "internal error (unknown dataspace class)")
- }
+ } /* end switch */
done:
FUNC_LEAVE_NOAPI(ret_value)
-}
+} /* end H5S_get_npoints_max() */
/*-------------------------------------------------------------------------
@@ -896,21 +889,18 @@ done:
* Purpose: Determines the dimensionality of a dataspace.
*
* Return: Success: The number of dimensions in a dataspace.
- *
* Failure: Negative
*
* Programmer: Robb Matzke
* Thursday, December 11, 1997
*
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
int
H5Sget_simple_extent_ndims(hid_t space_id)
{
- H5S_t *ds;
- int ret_value;
+ H5S_t *ds;
+ int ret_value; /* Return value */
FUNC_ENTER_API(FAIL)
H5TRACE1("Is", "i", space_id);
@@ -933,7 +923,6 @@ done:
*
* Return: Success: Non-negative number of dimensions. Zero
* implies a scalar.
- *
* Failure: Negative
*
* Programmer: Robb Matzke
@@ -943,8 +932,6 @@ done:
* pattern, don't call it directly, use the appropriate macro
* defined in H5Sprivate.h.
*
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
int
@@ -979,43 +966,36 @@ done:
* Function: H5Sget_simple_extent_dims
*
* Purpose: Returns the size and maximum sizes in each dimension of
- * a dataspace DS through the DIMS and MAXDIMS arguments.
+ * a dataspace DS through the DIMS and MAXDIMS arguments.
*
* Return: Success: Number of dimensions, the same value as
* returned by H5Sget_simple_extent_ndims().
- *
* Failure: Negative
*
* Programmer: Robb Matzke
* Thursday, December 11, 1997
*
- * Modifications:
- * June 18, 1998 Albert Cheng
- * Added maxdims argument. Removed dims argument check
- * since it can still return ndims even if both dims and
- * maxdims are NULLs.
- *
*-------------------------------------------------------------------------
*/
int
H5Sget_simple_extent_dims(hid_t space_id, hsize_t dims[]/*out*/,
- hsize_t maxdims[]/*out*/)
+ hsize_t maxdims[]/*out*/)
{
- H5S_t *ds;
- int ret_value;
+ H5S_t *ds;
+ int ret_value; /* Return value */
FUNC_ENTER_API(FAIL)
H5TRACE3("Is", "ixx", space_id, dims, maxdims);
/* Check args */
- if (NULL == (ds = (H5S_t *)H5I_object_verify(space_id, H5I_DATASPACE)))
+ if(NULL == (ds = (H5S_t *)H5I_object_verify(space_id, H5I_DATASPACE)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataspace")
ret_value = H5S_get_simple_extent_dims(ds, dims, maxdims);
done:
FUNC_LEAVE_API(ret_value)
-}
+} /* end H5Sget_simple_extent_dims() */
/*-------------------------------------------------------------------------
@@ -1081,14 +1061,11 @@ done:
* function may not be meaningful for all types of dataspaces.
*
* Return: Success: Number of dimensions. Zero implies scalar.
- *
* Failure: Negative
*
* Programmer: Robb Matzke
* Thursday, December 11, 1997
*
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
int
@@ -1155,13 +1132,6 @@ done:
* Programmer: Quincey Koziol
* Tuesday, December 31, 2002
*
- * Modifications:
- *
- * John Mainzer, 6/6/05
- * Updated function to use the new dirtied parameter of
- * H5AC_unprotect() instead of manipulating the is_dirty
- * field of the cache info.
- *
*-------------------------------------------------------------------------
*/
herr_t
@@ -1191,7 +1161,6 @@ done:
* Purpose: Reads the dataspace from an object header.
*
* Return: Success: Pointer to a new dataspace.
- *
* Failure: NULL
*
* Programmer: Robb Matzke
@@ -1224,10 +1193,9 @@ H5S_read(const H5O_loc_t *loc)
ret_value = ds;
done:
- if(ret_value == NULL) {
+ if(ret_value == NULL)
if(ds != NULL)
ds = H5FL_FREE(H5S_t, ds);
- } /* end if */
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5S_read() */
@@ -1235,11 +1203,11 @@ done:
/*--------------------------------------------------------------------------
NAME
- H5S_is_simple
+ H5S__is_simple
PURPOSE
Check if a dataspace is simple (internal)
USAGE
- htri_t H5S_is_simple(sdim)
+ htri_t H5S__is_simple(sdim)
H5S_t *sdim; IN: Pointer to dataspace object to query
RETURNS
TRUE/FALSE/FAIL
@@ -1248,21 +1216,21 @@ done:
has orthogonal, evenly spaced dimensions.
--------------------------------------------------------------------------*/
static htri_t
-H5S_is_simple(const H5S_t *sdim)
+H5S__is_simple(const H5S_t *sdim)
{
htri_t ret_value = FAIL; /* Return value */
- FUNC_ENTER_NOAPI_NOINIT_NOERR
+ FUNC_ENTER_STATIC_NOERR
/* Check args and all the boring stuff. */
HDassert(sdim);
/* H5S_NULL shouldn't be simple dataspace */
ret_value = (H5S_GET_EXTENT_TYPE(sdim) == H5S_SIMPLE ||
- H5S_GET_EXTENT_TYPE(sdim) == H5S_SCALAR) ? TRUE : FALSE;
+ H5S_GET_EXTENT_TYPE(sdim) == H5S_SCALAR) ? TRUE : FALSE;
FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5S_is_simple() */
+} /* end H5S__is_simple() */
/*--------------------------------------------------------------------------
@@ -1282,21 +1250,21 @@ H5S_is_simple(const H5S_t *sdim)
htri_t
H5Sis_simple(hid_t space_id)
{
- H5S_t *space; /* dataspace to modify */
- htri_t ret_value;
+ H5S_t *space; /* Dataspace to check */
+ htri_t ret_value; /* Return value */
FUNC_ENTER_API(FAIL)
H5TRACE1("t", "i", space_id);
/* Check args and all the boring stuff. */
- if ((space = (H5S_t *)H5I_object_verify(space_id,H5I_DATASPACE)) == NULL)
+ if(NULL == (space = (H5S_t *)H5I_object_verify(space_id, H5I_DATASPACE)))
HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "not a dataspace")
- ret_value = H5S_is_simple(space);
+ ret_value = H5S__is_simple(space);
- done:
+done:
FUNC_LEAVE_API(ret_value)
-}
+} /* end H5Sis_simple() */
/*--------------------------------------------------------------------------
@@ -1324,56 +1292,44 @@ H5Sis_simple(hid_t space_id)
Currently, only the first dimension in the array (the slowest) may be
unlimited in size.
- MODIFICATION
- A null dataspace cannot be created from simple space with this function.
-
- Christian Chilan 01/17/2007
- Verifies that each element of DIMS is not equal to H5S_UNLIMITED.
-
- Raymond Lu 03/30/2011
- We allow 0 dimension size for non-unlimited dimension starting from 1.8.7
- release.
--------------------------------------------------------------------------*/
herr_t
H5Sset_extent_simple(hid_t space_id, int rank, const hsize_t dims[/*rank*/],
- const hsize_t max[/*rank*/])
+ const hsize_t max[/*rank*/])
{
- H5S_t *space; /* dataspace to modify */
- int u; /* local counting variable */
- herr_t ret_value=SUCCEED; /* Return value */
+ H5S_t *space; /* Dataspace to modify */
+ int u; /* Local counting variable */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(FAIL)
H5TRACE4("e", "iIs*[a1]h*[a1]h", space_id, rank, dims, max);
/* Check args */
- if ((space = (H5S_t *)H5I_object_verify(space_id,H5I_DATASPACE)) == NULL)
+ if(NULL == (space = (H5S_t *)H5I_object_verify(space_id, H5I_DATASPACE)))
HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "not a dataspace")
- if (rank > 0 && dims == NULL)
+ if(rank > 0 && dims == NULL)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no dimensions specified")
- if (rank<0 || rank>H5S_MAX_RANK)
+ if(rank < 0 || rank > H5S_MAX_RANK)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid rank")
- if (dims) {
- for (u=0; u<rank; u++) {
- if (H5S_UNLIMITED==dims[u])
+ if(dims)
+ for(u = 0; u < rank; u++)
+ if(H5S_UNLIMITED == dims[u])
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "current dimension must have a specific size, not H5S_UNLIMITED")
- }
- }
- if (max!=NULL) {
- if(dims==NULL)
+ if(max != NULL) {
+ if(dims == NULL)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "maximum dimension specified, but no current dimensions specified")
- for (u=0; u<rank; u++) {
- if (max[u]!=H5S_UNLIMITED && max[u]<dims[u])
+ for(u = 0; u < rank; u++)
+ if(max[u] != H5S_UNLIMITED && max[u] < dims[u])
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid maximum dimension size")
- }
- }
+ } /* end if */
/* Do it */
- if (H5S_set_extent_simple(space, (unsigned)rank, dims, max)<0)
+ if(H5S_set_extent_simple(space, (unsigned)rank, dims, max) < 0)
HGOTO_ERROR(H5E_DATASPACE, H5E_CANTINIT, FAIL, "unable to set simple extent")
done:
FUNC_LEAVE_API(ret_value)
-}
+} /* end H5Sset_extent_simple() */
/*-------------------------------------------------------------------------
@@ -1384,19 +1340,17 @@ done:
*
* Return: Non-negative on success/Negative on failure
*
- * Programmer: Robb Matzke (copied from H5Sset_extent_simple)
+ * Programmer: Robb Matzke
* Wednesday, July 8, 1998
*
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
herr_t
H5S_set_extent_simple(H5S_t *space, unsigned rank, const hsize_t *dims,
- const hsize_t *max)
+ const hsize_t *max)
{
unsigned u; /* Local index variable */
- herr_t ret_value = SUCCEED; /* Return value */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(FAIL)
@@ -1405,7 +1359,7 @@ H5S_set_extent_simple(H5S_t *space, unsigned rank, const hsize_t *dims,
HDassert(0 == rank || dims);
/* shift out of the previous state to a "simple" dataspace. */
- if(H5S_extent_release(&space->extent) < 0)
+ if(H5S__extent_release(&space->extent) < 0)
HGOTO_ERROR(H5E_RESOURCE, H5E_CANTFREE, FAIL, "failed to release previous dataspace extent")
if(rank == 0) { /* scalar variable */
@@ -1432,12 +1386,11 @@ H5S_set_extent_simple(H5S_t *space, unsigned rank, const hsize_t *dims,
/* Copy the maximum dimensions if specified. Otherwise, the maximal dimensions are the
* same as the dimension */
space->extent.max = (hsize_t *)H5FL_ARR_MALLOC(hsize_t, (size_t)rank);
- if(max != NULL) {
- HDmemcpy(space->extent.max, max, sizeof(hsize_t) * rank);
- } else {
+ if(max != NULL)
+ H5MM_memcpy(space->extent.max, max, sizeof(hsize_t) * rank);
+ else
for(u = 0; u < space->extent.rank; u++)
space->extent.max[u] = dims[u];
- }
} /* end else */
/* Selection related cleanup */
@@ -1453,7 +1406,7 @@ H5S_set_extent_simple(H5S_t *space, unsigned rank, const hsize_t *dims,
done:
FUNC_LEAVE_NOAPI(ret_value)
-} /* H5S_set_extent_simple() */
+} /* end H5S_set_extent_simple() */
/*-------------------------------------------------------------------------
@@ -1469,26 +1422,20 @@ done:
* than the corresponding element of DIMS.
*
* Return: Success: The ID for the new simple dataspace object.
- *
* Failure: Negative
*
* Programmer: Quincey Koziol
* Tuesday, January 27, 1998
*
- * Modification:
- * Raymond Lu 03/30/2011
- * We allow 0-dimension for non-unlimited dimension starting
- * from 1.8.7 release.
- *
*-------------------------------------------------------------------------
*/
hid_t
H5Screate_simple(int rank, const hsize_t dims[/*rank*/],
- const hsize_t maxdims[/*rank*/])
+ const hsize_t maxdims[/*rank*/])
{
H5S_t *space = NULL;
int i;
- hid_t ret_value;
+ hid_t ret_value; /* Return value */
FUNC_ENTER_API(FAIL)
H5TRACE3("i", "Is*[a0]h*[a0]h", rank, dims, maxdims);
@@ -1514,7 +1461,7 @@ H5Screate_simple(int rank, const hsize_t dims[/*rank*/],
} /* end for */
/* Create the space and set the extent */
- if(NULL == (space = H5S_create_simple((unsigned)rank,dims,maxdims)))
+ if(NULL == (space = H5S_create_simple((unsigned)rank, dims, maxdims)))
HGOTO_ERROR(H5E_DATASPACE, H5E_CANTCREATE, FAIL, "can't create simple dataspace")
/* Atomize */
@@ -1522,10 +1469,9 @@ H5Screate_simple(int rank, const hsize_t dims[/*rank*/],
HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, FAIL, "unable to register dataspace ID")
done:
- if(ret_value < 0) {
+ if(ret_value < 0)
if(space && H5S_close(space) < 0)
HDONE_ERROR(H5E_DATASPACE, H5E_CANTRELEASE, FAIL, "unable to release dataspace")
- } /* end if */
FUNC_LEAVE_API(ret_value)
} /* end H5Screate_simple() */
@@ -1539,32 +1485,26 @@ done:
* Return: Success: The ID for the new simple dataspace object.
* Failure: Negative
*
- * Errors:
- *
* Programmer: Quincey Koziol
* Thursday, April 3, 2003
*
- * Modifications:
- * Extracted from H5Screate_simple
- * Quincey Koziol, Thursday, April 3, 2003
- *
*-------------------------------------------------------------------------
*/
H5S_t *
H5S_create_simple(unsigned rank, const hsize_t dims[/*rank*/],
- const hsize_t maxdims[/*rank*/])
+ const hsize_t maxdims[/*rank*/])
{
H5S_t *ret_value = NULL; /* Return value */
FUNC_ENTER_NOAPI(NULL)
/* Check arguments */
- HDassert(rank <=H5S_MAX_RANK);
+ HDassert(rank <= H5S_MAX_RANK);
/* Create the space and set the extent */
- if(NULL==(ret_value=H5S_create(H5S_SIMPLE)))
+ if(NULL == (ret_value = H5S_create(H5S_SIMPLE)))
HGOTO_ERROR(H5E_DATASPACE, H5E_CANTCREATE, NULL, "can't create simple dataspace")
- if(H5S_set_extent_simple(ret_value,rank,dims,maxdims)<0)
+ if(H5S_set_extent_simple(ret_value, rank, dims, maxdims) < 0)
HGOTO_ERROR(H5E_DATASPACE, H5E_CANTINIT, NULL, "can't set dimensions")
done:
@@ -1573,42 +1513,46 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5Sencode
+ * Function: H5Sencode2
*
* Purpose: Given a dataspace ID, converts the object description
* (including selection) into binary in a buffer.
+ * The selection will be encoded according to the file
+ * format setting in fapl.
*
* Return: Success: non-negative
- *
- * Failure: negative
+ * Failure: negative
*
* Programmer: Raymond Lu
* slu@ncsa.uiuc.edu
* July 14, 2004
*
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
herr_t
-H5Sencode(hid_t obj_id, void *buf, size_t *nalloc)
+H5Sencode2(hid_t obj_id, void *buf, size_t *nalloc, hid_t fapl_id)
{
H5S_t *dspace;
herr_t ret_value=SUCCEED;
FUNC_ENTER_API(FAIL)
- H5TRACE3("e", "i*x*z", obj_id, buf, nalloc);
+ H5TRACE4("e", "i*x*zi", obj_id, buf, nalloc, fapl_id);
/* Check argument and retrieve object */
- if (NULL == (dspace = (H5S_t *)H5I_object_verify(obj_id, H5I_DATASPACE)))
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataspace")
+ if(NULL == (dspace = (H5S_t *)H5I_object_verify(obj_id, H5I_DATASPACE)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataspace")
+
+ /* Verify access property list and set up collective metadata if appropriate */
+ if(H5CX_set_apl(&fapl_id, H5P_CLS_FACC, H5I_INVALID_HID, TRUE) < 0)
+ HGOTO_ERROR(H5E_FILE, H5E_CANTSET, H5I_INVALID_HID, "can't set access property list info")
- if(H5S_encode(dspace, (unsigned char **)&buf, nalloc)<0)
- HGOTO_ERROR(H5E_DATASPACE, H5E_CANTENCODE, FAIL, "can't encode dataspace")
+
+ if(H5S_encode(dspace, (unsigned char **)&buf, nalloc) < 0)
+ HGOTO_ERROR(H5E_DATASPACE, H5E_CANTENCODE, FAIL, "can't encode dataspace")
done:
FUNC_LEAVE_API(ret_value)
-}
+} /* H5Sencode2() */
/*-------------------------------------------------------------------------
@@ -1697,7 +1641,6 @@ done:
* return a new object handle.
*
* Return: Success: dataspace ID(non-negative)
- *
* Failure: negative
*
* Programmer: Raymond Lu
@@ -1737,7 +1680,6 @@ done:
* description of dataspace and returns a new object handle.
*
* Return: Success: dataspace ID(non-negative)
- *
* Failure: negative
*
* Programmer: Raymond Lu
@@ -1784,11 +1726,11 @@ H5S_decode(const unsigned char **p)
pp += extent_size;
/* Copy the extent into dataspace structure */
- if((ds = H5FL_CALLOC(H5S_t))==NULL)
+ if(NULL == (ds = H5FL_CALLOC(H5S_t)))
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed for dataspace conversion path table")
- if(H5O_msg_copy(H5O_SDSPACE_ID, extent, &(ds->extent)) == NULL)
+ if(NULL == H5O_msg_copy(H5O_SDSPACE_ID, extent, &(ds->extent)))
HGOTO_ERROR(H5E_DATASPACE, H5E_CANTCOPY, NULL, "can't copy object")
- if(H5S_extent_release(extent) < 0)
+ if(H5S__extent_release(extent) < 0)
HGOTO_ERROR(H5E_RESOURCE, H5E_CANTDELETE, NULL, "can't release previous dataspace")
extent = H5FL_FREE(H5S_extent_t, extent);
@@ -1819,11 +1761,8 @@ done:
* Purpose: Internal function for retrieving the type of extent for a dataspace object
*
* Return: Success: The class of the dataspace object
- *
* Failure: N5S_NO_CLASS
*
- * Errors:
- *
* Programmer: Quincey Koziol
* Thursday, September 28, 2000
*
@@ -1831,8 +1770,6 @@ done:
* pattern, don't call it directly, use the appropriate macro
* defined in H5Sprivate.h.
*
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
H5S_class_t
@@ -1844,11 +1781,11 @@ H5S_get_simple_extent_type(const H5S_t *space)
HDassert(space);
- ret_value=H5S_GET_EXTENT_TYPE(space);
+ ret_value = H5S_GET_EXTENT_TYPE(space);
done:
FUNC_LEAVE_NOAPI(ret_value)
-}
+} /* end H5S_get_simple_extent_type() */
/*-------------------------------------------------------------------------
@@ -1857,36 +1794,31 @@ done:
* Purpose: Retrieves the type of extent for a dataspace object
*
* Return: Success: The class of the dataspace object
- *
* Failure: N5S_NO_CLASS
*
- * Errors:
- *
* Programmer: Quincey Koziol
* Thursday, July 23, 1998
*
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
H5S_class_t
H5Sget_simple_extent_type(hid_t sid)
{
H5S_t *space;
- H5S_class_t ret_value;
+ H5S_class_t ret_value; /* Return value */
FUNC_ENTER_API(H5S_NO_CLASS)
H5TRACE1("Sc", "i", sid);
/* Check arguments */
- if (NULL == (space = (H5S_t *)H5I_object_verify(sid, H5I_DATASPACE)))
+ if(NULL == (space = (H5S_t *)H5I_object_verify(sid, H5I_DATASPACE)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5S_NO_CLASS, "not a dataspace")
- ret_value=H5S_GET_EXTENT_TYPE(space);
+ ret_value = H5S_GET_EXTENT_TYPE(space);
done:
FUNC_LEAVE_API(ret_value)
-}
+} /* end H5Sget_simple_extent_type() */
/*--------------------------------------------------------------------------
@@ -1906,68 +1838,25 @@ done:
herr_t
H5Sset_extent_none(hid_t space_id)
{
- H5S_t *space; /* dataspace to modify */
- herr_t ret_value=SUCCEED; /* Return value */
+ H5S_t *space; /* Dataspace to modify */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(FAIL)
H5TRACE1("e", "i", space_id);
/* Check args */
- if (NULL == (space = (H5S_t *)H5I_object_verify(space_id, H5I_DATASPACE)))
+ if(NULL == (space = (H5S_t *)H5I_object_verify(space_id, H5I_DATASPACE)))
HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "not a dataspace")
/* Clear the previous extent from the dataspace */
- if(H5S_extent_release(&space->extent)<0)
+ if(H5S__extent_release(&space->extent) < 0)
HGOTO_ERROR(H5E_RESOURCE, H5E_CANTDELETE, FAIL, "can't release previous dataspace")
- space->extent.type=H5S_NO_CLASS;
+ space->extent.type = H5S_NO_CLASS;
done:
FUNC_LEAVE_API(ret_value)
-} /* end H5Sset_extent_none() */
-
-
-/*--------------------------------------------------------------------------
- NAME
- H5Soffset_simple
- PURPOSE
- Changes the offset of a selection within a simple dataspace extent
- USAGE
- herr_t H5Soffset_simple(space_id, offset)
- hid_t space_id; IN: Dataspace object to reset
- const hssize_t *offset; IN: Offset to position the selection at
- RETURNS
- Non-negative on success/Negative on failure
- DESCRIPTION
- This function creates an offset for the selection within an extent, allowing
- the same shaped selection to be moved to different locations within a
- dataspace without requiring it to be re-defined.
---------------------------------------------------------------------------*/
-herr_t
-H5Soffset_simple(hid_t space_id, const hssize_t *offset)
-{
- H5S_t *space; /* dataspace to modify */
- herr_t ret_value=SUCCEED; /* Return value */
-
- FUNC_ENTER_API(FAIL)
- H5TRACE2("e", "i*Hs", space_id, offset);
-
- /* Check args */
- if (NULL == (space = (H5S_t *)H5I_object_verify(space_id, H5I_DATASPACE)))
- HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "not a dataspace")
- if (space->extent.rank==0 || (H5S_GET_EXTENT_TYPE(space)==H5S_SCALAR
- || H5S_GET_EXTENT_TYPE(space)==H5S_NULL))
- HGOTO_ERROR(H5E_ATOM, H5E_UNSUPPORTED, FAIL, "can't set offset on scalar or null dataspace")
- if (offset == NULL)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no offset specified")
-
- /* Set the selection offset */
- if(H5S_select_offset(space,offset)<0)
- HGOTO_ERROR(H5E_DATASPACE, H5E_CANTINIT, FAIL, "can't set offset")
-
-done:
- FUNC_LEAVE_API(ret_value)
-} /* end H5Soffset_simple() */
+} /* end H5Sset_extent_none() */
/*-------------------------------------------------------------------------
@@ -1996,7 +1885,7 @@ H5S_set_extent(H5S_t *space, const hsize_t *size)
HDassert(size);
/* Verify that the dimensions being changed are allowed to change */
- for(u = 0; u < space->extent.rank; u++) {
+ for(u = 0; u < space->extent.rank; u++)
if(space->extent.size[u] != size[u]) {
/* Check for invalid dimension size modification */
if(space->extent.max && H5S_UNLIMITED != space->extent.max[u] &&
@@ -2006,7 +1895,6 @@ H5S_set_extent(H5S_t *space, const hsize_t *size)
/* Indicate that dimension size can be modified */
ret_value = TRUE;
} /* end if */
- } /* end for */
/* Update dimension size(s) */
if(ret_value)
@@ -2033,7 +1921,7 @@ done:
*
*-------------------------------------------------------------------------
*/
-hbool_t
+H5_ATTR_PURE hbool_t
H5S_has_extent(const H5S_t *ds)
{
hbool_t ret_value = FALSE; /* Return value */
@@ -2104,7 +1992,6 @@ done:
* Purpose: Determines if two dataspace extents are equal.
*
* Return: Success: TRUE if equal, FALSE if unequal
- *
* Failure: Negative
*
* Programmer: Quincey Koziol
@@ -2116,7 +2003,7 @@ htri_t
H5Sextent_equal(hid_t space1_id, hid_t space2_id)
{
const H5S_t *ds1, *ds2; /* Dataspaces to compare */
- htri_t ret_value;
+ htri_t ret_value; /* Return value */
FUNC_ENTER_API(FAIL)
H5TRACE2("t", "ii", space1_id, space2_id);
@@ -2148,7 +2035,7 @@ done:
DESCRIPTION
Compare two dataspaces if their extents are identical.
--------------------------------------------------------------------------*/
-htri_t
+H5_ATTR_PURE htri_t
H5S_extent_equal(const H5S_t *ds1, const H5S_t *ds2)
{
unsigned u; /* Local index variable */
@@ -2209,7 +2096,7 @@ done:
*
*-------------------------------------------------------------------------
*/
-hsize_t
+H5_ATTR_PURE hsize_t
H5S_extent_nelem(const H5S_extent_t *ext)
{
FUNC_ENTER_NOAPI_NOINIT_NOERR
@@ -2257,6 +2144,5 @@ H5S_set_version(H5F_t *f, H5S_t *ds)
done:
FUNC_LEAVE_NOAPI(ret_value)
-
} /* end H5S_set_version() */
diff --git a/src/H5SL.c b/src/H5SL.c
index c0934ca..5f00fb8 100644
--- a/src/H5SL.c
+++ b/src/H5SL.c
@@ -240,7 +240,7 @@
/* Allocate space for new forward pointers */ \
if(NULL == (_tmp = (H5SL_node_t **)H5FL_FAC_MALLOC(H5SL_fac_g[X->log_nalloc]))) \
HGOTO_ERROR(H5E_SLIST, H5E_CANTALLOC, ERR, "memory allocation failed") \
- HDmemcpy((void *)_tmp, (const void *)X->forward, (LVL + 1) * sizeof(H5SL_node_t *)); \
+ H5MM_memcpy((void *)_tmp, (const void *)X->forward, (LVL + 1) * sizeof(H5SL_node_t *)); \
X->forward = (H5SL_node_t **)H5FL_FAC_FREE(H5SL_fac_g[X->log_nalloc-1], (void *)X->forward); \
X->forward = _tmp; \
} /* end if */ \
@@ -262,7 +262,7 @@
/* Allocate space for new forward pointers */ \
if(NULL == (_tmp = (H5SL_node_t **)H5FL_FAC_MALLOC(H5SL_fac_g[X->log_nalloc]))) \
HGOTO_ERROR(H5E_SLIST, H5E_NOSPACE, NULL, "memory allocation failed") \
- HDmemcpy((void *)_tmp, (const void *)X->forward, (LVL) * sizeof(H5SL_node_t *)); \
+ H5MM_memcpy((void *)_tmp, (const void *)X->forward, (LVL) * sizeof(H5SL_node_t *)); \
X->forward = (H5SL_node_t **)H5FL_FAC_FREE(H5SL_fac_g[X->log_nalloc+1], (void *)X->forward); \
X->forward = _tmp; \
} /* end if */ \
diff --git a/src/H5SM.c b/src/H5SM.c
index 0fa3489..290e575 100644
--- a/src/H5SM.c
+++ b/src/H5SM.c
@@ -274,6 +274,7 @@ H5SM__type_to_flag(unsigned type_id, unsigned *type_flag)
case H5O_FILL_ID:
type_id = H5O_FILL_NEW_ID;
/* Fall through... */
+ H5_ATTR_FALLTHROUGH
case H5O_SDSPACE_ID:
case H5O_DTYPE_ID:
@@ -2318,7 +2319,7 @@ H5SM__read_iter_op(H5O_t *oh, H5O_mesg_t *mesg/*in,out*/, unsigned sequence,
HGOTO_ERROR(H5E_SOHM, H5E_NOSPACE, H5_ITER_ERROR, "memory allocation failed")
/* Copy the encoded message into the buffer to return */
- HDmemcpy(udata->encoding_buf, mesg->raw, udata->buf_size);
+ H5MM_memcpy(udata->encoding_buf, mesg->raw, udata->buf_size);
/* Found the message we were looking for */
ret_value = H5_ITER_STOP;
@@ -2356,7 +2357,7 @@ H5SM__read_mesg_fh_cb(const void *obj, size_t obj_len, void *_udata)
HGOTO_ERROR(H5E_SOHM, H5E_NOSPACE, FAIL, "memory allocation failed")
/* Copy the message from the heap */
- HDmemcpy(udata->encoding_buf, obj, obj_len);
+ H5MM_memcpy(udata->encoding_buf, obj, obj_len);
udata->buf_size = obj_len;
done:
diff --git a/src/H5SMbtree2.c b/src/H5SMbtree2.c
index f0c4963..7f6c804 100644
--- a/src/H5SMbtree2.c
+++ b/src/H5SMbtree2.c
@@ -24,6 +24,7 @@
/***********/
#include "H5private.h" /* Generic Functions */
#include "H5Eprivate.h" /* Error handling */
+#include "H5MMprivate.h" /* Memory management */
#include "H5Opkg.h" /* Object Headers */
#include "H5SMpkg.h" /* Shared object header messages */
@@ -248,7 +249,7 @@ H5SM_bt2_convert_to_list_op(const void * record, void *op_data)
/* Insert this message at the end of the list */
HDassert(list->messages[mesg_idx].location == H5SM_NO_LOC);
HDassert(message->location != H5SM_NO_LOC);
- HDmemcpy(&(list->messages[mesg_idx]), message, sizeof(H5SM_sohm_t));
+ H5MM_memcpy(&(list->messages[mesg_idx]), message, sizeof(H5SM_sohm_t));
FUNC_LEAVE_NOAPI(SUCCEED)
} /* end H5SM_bt2_convert_to_list_op() */
diff --git a/src/H5SMcache.c b/src/H5SMcache.c
index f0b469a..49ce2b4 100644
--- a/src/H5SMcache.c
+++ b/src/H5SMcache.c
@@ -388,7 +388,7 @@ H5SM__cache_table_serialize(const H5F_t *f, void *_image, size_t len,
HDassert(H5F_SOHM_VERS(f) == HDF5_SHAREDHEADER_VERSION);
/* Encode magic number */
- HDmemcpy(image, H5SM_TABLE_MAGIC, (size_t)H5_SIZEOF_MAGIC);
+ H5MM_memcpy(image, H5SM_TABLE_MAGIC, (size_t)H5_SIZEOF_MAGIC);
image += H5_SIZEOF_MAGIC;
/* Encode each index header */
@@ -710,7 +710,7 @@ H5SM__cache_list_serialize(const H5F_t *f, void *_image, size_t len,
HDassert(list->header->list_size == len);
/* Encode magic number */
- HDmemcpy(image, H5SM_LIST_MAGIC, (size_t)H5_SIZEOF_MAGIC);
+ H5MM_memcpy(image, H5SM_LIST_MAGIC, (size_t)H5_SIZEOF_MAGIC);
image += H5_SIZEOF_MAGIC;
/* serialize messages from the messages array */
diff --git a/src/H5SMmessage.c b/src/H5SMmessage.c
index ad84b24..0cca6bb 100644
--- a/src/H5SMmessage.c
+++ b/src/H5SMmessage.c
@@ -24,6 +24,7 @@
/***********/
#include "H5private.h" /* Generic Functions */
#include "H5Eprivate.h" /* Error handling */
+#include "H5MMprivate.h" /* Memory management */
#include "H5Opkg.h" /* Object Headers */
#include "H5SMpkg.h" /* Shared object header messages */
@@ -302,7 +303,7 @@ H5SM__message_encode(uint8_t *raw, const void *_nrecord, void *_ctx)
if(message->location == H5SM_IN_HEAP) {
UINT32ENCODE(raw, message->u.heap_loc.ref_count);
- HDmemcpy(raw, message->u.heap_loc.fheap_id.id, (size_t)H5O_FHEAP_ID_LEN);
+ H5MM_memcpy(raw, message->u.heap_loc.fheap_id.id, (size_t)H5O_FHEAP_ID_LEN);
} /* end if */
else {
HDassert(message->location == H5SM_IN_OH);
@@ -343,7 +344,7 @@ H5SM__message_decode(const uint8_t *raw, void *_nrecord, void *_ctx)
if(message->location == H5SM_IN_HEAP) {
UINT32DECODE(raw, message->u.heap_loc.ref_count);
- HDmemcpy(message->u.heap_loc.fheap_id.id, raw, (size_t)H5O_FHEAP_ID_LEN);
+ H5MM_memcpy(message->u.heap_loc.fheap_id.id, raw, (size_t)H5O_FHEAP_ID_LEN);
} /* end if */
else {
HDassert(message->location == H5SM_IN_OH);
diff --git a/src/H5ST.c b/src/H5ST.c
index dd5b63c..3a1020b 100644
--- a/src/H5ST.c
+++ b/src/H5ST.c
@@ -743,19 +743,19 @@ H5ST__dump_internal(H5ST_ptr_t p)
FUNC_ENTER_STATIC_NOERR
if(p) {
- printf("p=%p\n", (void *)p);
- printf("\tp->up=%p\n", (void *)p->up);
- printf("\tp->parent=%p\n", (void *)p->parent);
- printf("\tp->lokid=%p\n", (void *)p->lokid);
- printf("\tp->hikid=%p\n", (void *)p->hikid);
- printf("\tp->eqkid=%p\n", (void *)p->eqkid);
- printf("\tp->splitchar=%c\n", p->splitchar);
+ HDprintf("p=%p\n", (void *)p);
+ HDprintf("\tp->up=%p\n", (void *)p->up);
+ HDprintf("\tp->parent=%p\n", (void *)p->parent);
+ HDprintf("\tp->lokid=%p\n", (void *)p->lokid);
+ HDprintf("\tp->hikid=%p\n", (void *)p->hikid);
+ HDprintf("\tp->eqkid=%p\n", (void *)p->eqkid);
+ HDprintf("\tp->splitchar=%c\n", p->splitchar);
H5ST__dump_internal(p->lokid);
if(p->splitchar)
H5ST__dump_internal(p->eqkid);
else
- printf("%s\n", (char *)p->eqkid);
+ HDprintf("%s\n", (char *)p->eqkid);
H5ST__dump_internal(p->hikid);
} /* end if */
diff --git a/src/H5Sall.c b/src/H5Sall.c
index 3b77b98..fbe7041 100644
--- a/src/H5Sall.c
+++ b/src/H5Sall.c
@@ -18,38 +18,55 @@
* Purpose: "All" selection dataspace I/O functions.
*/
+/****************/
+/* Module Setup */
+/****************/
+
#include "H5Smodule.h" /* This source code file is part of the H5S module */
+/***********/
+/* Headers */
+/***********/
#include "H5private.h" /* Generic Functions */
#include "H5Eprivate.h" /* Error handling */
#include "H5Iprivate.h" /* ID Functions */
#include "H5Spkg.h" /* Dataspace functions */
-#include "H5VMprivate.h" /* Vector functions */
+#include "H5VMprivate.h" /* Vector functions */
+
+
+/****************/
+/* Local Macros */
+/****************/
+
+
+/******************/
+/* Local Typedefs */
+/******************/
+
-/* Static function prototypes */
+/********************/
+/* Local Prototypes */
+/********************/
/* Selection callbacks */
static herr_t H5S__all_copy(H5S_t *dst, const H5S_t *src, hbool_t share_selection);
-static herr_t H5S__all_get_seq_list(const H5S_t *space, unsigned flags,
- H5S_sel_iter_t *iter, size_t maxseq, size_t maxbytes,
- size_t *nseq, size_t *nbytes, hsize_t *off, size_t *len);
static herr_t H5S__all_release(H5S_t *space);
static htri_t H5S__all_is_valid(const H5S_t *space);
static hssize_t H5S__all_serial_size(const H5S_t *space);
static herr_t H5S__all_serialize(const H5S_t *space, uint8_t **p);
-static herr_t H5S__all_deserialize(H5S_t *space, uint32_t version, uint8_t flags,
- const uint8_t **p);
+static herr_t H5S__all_deserialize(H5S_t **space, const uint8_t **p);
static herr_t H5S__all_bounds(const H5S_t *space, hsize_t *start, hsize_t *end);
static herr_t H5S__all_offset(const H5S_t *space, hsize_t *off);
static int H5S__all_unlim_dim(const H5S_t *space);
static htri_t H5S__all_is_contiguous(const H5S_t *space);
static htri_t H5S__all_is_single(const H5S_t *space);
static htri_t H5S__all_is_regular(const H5S_t *space);
+static htri_t H5S__all_shape_same(const H5S_t *space1, const H5S_t *space2);
static herr_t H5S__all_adjust_u(H5S_t *space, const hsize_t *offset);
static herr_t H5S__all_project_scalar(const H5S_t *space, hsize_t *offset);
static herr_t H5S__all_project_simple(const H5S_t *space, H5S_t *new_space, hsize_t *offset);
-static herr_t H5S__all_iter_init(H5S_sel_iter_t *iter, const H5S_t *space);
+static herr_t H5S__all_iter_init(const H5S_t *space, H5S_sel_iter_t *iter);
/* Selection iteration callbacks */
static herr_t H5S__all_iter_coords(const H5S_sel_iter_t *iter, hsize_t *coords);
@@ -58,15 +75,26 @@ static hsize_t H5S__all_iter_nelmts(const H5S_sel_iter_t *iter);
static htri_t H5S__all_iter_has_next_block(const H5S_sel_iter_t *iter);
static herr_t H5S__all_iter_next(H5S_sel_iter_t *sel_iter, size_t nelem);
static herr_t H5S__all_iter_next_block(H5S_sel_iter_t *sel_iter);
+static herr_t H5S__all_iter_get_seq_list(H5S_sel_iter_t *iter, size_t maxseq,
+ size_t maxbytes, size_t *nseq, size_t *nbytes, hsize_t *off, size_t *len);
static herr_t H5S__all_iter_release(H5S_sel_iter_t *sel_iter);
+
+/*****************************/
+/* Library Private Variables */
+/*****************************/
+
+
+/*********************/
+/* Package Variables */
+/*********************/
+
/* Selection properties for "all" selections */
const H5S_select_class_t H5S_sel_all[1] = {{
H5S_SEL_ALL,
/* Methods on selection */
H5S__all_copy,
- H5S__all_get_seq_list,
H5S__all_release,
H5S__all_is_valid,
H5S__all_serial_size,
@@ -79,12 +107,18 @@ const H5S_select_class_t H5S_sel_all[1] = {{
H5S__all_is_contiguous,
H5S__all_is_single,
H5S__all_is_regular,
+ H5S__all_shape_same,
H5S__all_adjust_u,
H5S__all_project_scalar,
H5S__all_project_simple,
H5S__all_iter_init,
}};
+
+/*******************/
+/* Local Variables */
+/*******************/
+
/* Iteration properties for "all" selections */
static const H5S_sel_iter_class_t H5S_sel_iter_all[1] = {{
H5S_SEL_ALL,
@@ -96,16 +130,18 @@ static const H5S_sel_iter_class_t H5S_sel_iter_all[1] = {{
H5S__all_iter_has_next_block,
H5S__all_iter_next,
H5S__all_iter_next_block,
+ H5S__all_iter_get_seq_list,
H5S__all_iter_release,
}};
+
/*-------------------------------------------------------------------------
* Function: H5S__all_iter_init
*
* Purpose: Initializes iteration information for "all" selection.
*
- * Return: non-negative on success, negative on failure.
+ * Return: Non-negative on success, negative on failure.
*
* Programmer: Quincey Koziol
* Tuesday, June 16, 1998
@@ -113,7 +149,7 @@ static const H5S_sel_iter_class_t H5S_sel_iter_all[1] = {{
*-------------------------------------------------------------------------
*/
static herr_t
-H5S__all_iter_init(H5S_sel_iter_t *iter, const H5S_t *space)
+H5S__all_iter_init(const H5S_t H5_ATTR_UNUSED *space, H5S_sel_iter_t *iter)
{
FUNC_ENTER_STATIC_NOERR
@@ -121,9 +157,6 @@ H5S__all_iter_init(H5S_sel_iter_t *iter, const H5S_t *space)
HDassert(space && H5S_SEL_ALL == H5S_GET_SELECT_TYPE(space));
HDassert(iter);
- /* Initialize the number of elements to iterate over */
- iter->elmt_left = H5S_GET_SELECT_NPOINTS(space);
-
/* Start at the upper left location */
iter->u.all.elmt_offset = 0;
iter->u.all.byte_offset = 0;
@@ -132,7 +165,7 @@ H5S__all_iter_init(H5S_sel_iter_t *iter, const H5S_t *space)
iter->type = H5S_sel_iter_all;
FUNC_LEAVE_NOAPI(SUCCEED)
-} /* H5S__all_iter_init() */
+} /* end H5S__all_iter_init() */
/*-------------------------------------------------------------------------
@@ -141,7 +174,7 @@ H5S__all_iter_init(H5S_sel_iter_t *iter, const H5S_t *space)
* Purpose: Retrieve the current coordinates of iterator for current
* selection
*
- * Return: non-negative on success, negative on failure
+ * Return: Non-negative on success, negative on failure
*
* Programmer: Quincey Koziol
* Tuesday, April 22, 2003
@@ -165,7 +198,7 @@ H5S__all_iter_coords(const H5S_sel_iter_t *iter, hsize_t *coords)
done:
FUNC_LEAVE_NOAPI(ret_value)
-} /* H5S__all_iter_coords() */
+} /* end H5S__all_iter_coords() */
/*-------------------------------------------------------------------------
@@ -174,7 +207,7 @@ done:
* Purpose: Retrieve the current block of iterator for current
* selection
*
- * Return: non-negative on success, negative on failure
+ * Return: Non-negative on success, negative on failure
*
* Programmer: Quincey Koziol
* Monday, June 2, 2003
@@ -204,7 +237,7 @@ H5S__all_iter_block(const H5S_sel_iter_t *iter, hsize_t *start, hsize_t *end)
} /* end for */
FUNC_LEAVE_NOAPI(SUCCEED)
-} /* H5S__all_iter_block() */
+} /* end H5S__all_iter_block() */
/*-------------------------------------------------------------------------
@@ -212,7 +245,7 @@ H5S__all_iter_block(const H5S_sel_iter_t *iter, hsize_t *start, hsize_t *end)
*
* Purpose: Return number of elements left to process in iterator
*
- * Return: non-negative number of elements on success, zero on failure
+ * Return: Non-negative number of elements on success, zero on failure
*
* Programmer: Quincey Koziol
* Tuesday, June 16, 1998
@@ -228,7 +261,7 @@ H5S__all_iter_nelmts(const H5S_sel_iter_t *iter)
HDassert(iter);
FUNC_LEAVE_NOAPI(iter->elmt_left)
-} /* H5S__all_iter_nelmts() */
+} /* end H5S__all_iter_nelmts() */
/*--------------------------------------------------------------------------
@@ -257,7 +290,7 @@ H5S__all_iter_has_next_block(const H5S_sel_iter_t H5_ATTR_UNUSED *iter)
HDassert(iter);
FUNC_LEAVE_NOAPI(FALSE)
-} /* H5S__all_iter_has_next_block() */
+} /* end H5S__all_iter_has_next_block() */
/*--------------------------------------------------------------------------
@@ -292,7 +325,7 @@ H5S__all_iter_next(H5S_sel_iter_t *iter, size_t nelem)
iter->u.all.byte_offset += (nelem * iter->elmt_size);
FUNC_LEAVE_NOAPI(SUCCEED)
-} /* H5S__all_iter_next() */
+} /* end H5S__all_iter_next() */
/*--------------------------------------------------------------------------
@@ -321,7 +354,77 @@ H5S__all_iter_next_block(H5S_sel_iter_t H5_ATTR_UNUSED *iter)
HDassert(iter);
FUNC_LEAVE_NOAPI(FAIL)
-} /* H5S__all_iter_next_block() */
+} /* end H5S__all_iter_next_block() */
+
+
+/*--------------------------------------------------------------------------
+ NAME
+ H5S__all_iter_get_seq_list
+ PURPOSE
+ Create a list of offsets & lengths for a selection
+ USAGE
+ herr_t H5S__all_iter_get_seq_list(iter,maxseq,maxelem,nseq,nelem,off,len)
+ H5S_sel_iter_t *iter; IN/OUT: Selection iterator describing last
+ position of interest in selection.
+ size_t maxseq; IN: Maximum number of sequences to generate
+ size_t maxelem; IN: Maximum number of elements to include in the
+ generated sequences
+ size_t *nseq; OUT: Actual number of sequences generated
+ size_t *nelem; OUT: Actual number of elements in sequences generated
+ hsize_t *off; OUT: Array of offsets
+ size_t *len; OUT: Array of lengths
+ RETURNS
+ Non-negative on success/Negative on failure.
+ DESCRIPTION
+ Use the selection in the dataspace to generate a list of byte offsets and
+ lengths for the region(s) selected. Start/Restart from the position in the
+ ITER parameter. The number of sequences generated is limited by the MAXSEQ
+ parameter and the number of sequences actually generated is stored in the
+ NSEQ parameter.
+ GLOBAL VARIABLES
+ COMMENTS, BUGS, ASSUMPTIONS
+ EXAMPLES
+ REVISION LOG
+--------------------------------------------------------------------------*/
+static herr_t
+H5S__all_iter_get_seq_list(H5S_sel_iter_t *iter, size_t H5_ATTR_UNUSED maxseq,
+ size_t maxelem, size_t *nseq, size_t *nelem, hsize_t *off, size_t *len)
+{
+ size_t elem_used; /* The number of elements used */
+
+ FUNC_ENTER_STATIC_NOERR
+
+ /* Check args */
+ HDassert(iter);
+ HDassert(maxseq > 0);
+ HDassert(maxelem > 0);
+ HDassert(nseq);
+ HDassert(nelem);
+ HDassert(off);
+ HDassert(len);
+
+ /* Determine the actual number of elements to use */
+ H5_CHECK_OVERFLOW(iter->elmt_left, hsize_t, size_t);
+ elem_used = MIN(maxelem, (size_t)iter->elmt_left);
+ HDassert(elem_used > 0);
+
+ /* Compute the offset in the dataset */
+ off[0] = iter->u.all.byte_offset;
+ len[0] = elem_used * iter->elmt_size;
+
+ /* Should only need one sequence for 'all' selections */
+ *nseq = 1;
+
+ /* Set the number of elements used */
+ *nelem = elem_used;
+
+ /* Update the iterator */
+ iter->elmt_left -= elem_used;
+ iter->u.all.elmt_offset += elem_used;
+ iter->u.all.byte_offset += len[0];
+
+ FUNC_LEAVE_NOAPI(SUCCEED)
+} /* end H5S__all_iter_get_seq_list() */
/*--------------------------------------------------------------------------
@@ -350,7 +453,7 @@ H5S__all_iter_release(H5S_sel_iter_t H5_ATTR_UNUSED * iter)
HDassert(iter);
FUNC_LEAVE_NOAPI(SUCCEED)
-} /* H5S__all_iter_release() */
+} /* end H5S__all_iter_release() */
/*--------------------------------------------------------------------------
@@ -382,7 +485,7 @@ H5S__all_release(H5S_t *space)
space->select.num_elem = 0;
FUNC_LEAVE_NOAPI(SUCCEED)
-} /* H5S__all_release() */
+} /* end H5S__all_release() */
/*--------------------------------------------------------------------------
@@ -391,9 +494,10 @@ H5S__all_release(H5S_t *space)
PURPOSE
Copy a selection from one dataspace to another
USAGE
- herr_t H5S__all_copy(dst, src)
+ herr_t H5S__all_copy(dst, src, share_selection)
H5S_t *dst; OUT: Pointer to the destination dataspace
H5S_t *src; IN: Pointer to the source dataspace
+ hbool_t; IN: Whether to share the selection between the dataspaces
RETURNS
Non-negative on success/Negative on failure
DESCRIPTION
@@ -519,7 +623,7 @@ H5S__all_serialize(const H5S_t *space, uint8_t **p)
/* Store the preamble information */
UINT32ENCODE(pp, (uint32_t)H5S_GET_SELECT_TYPE(space)); /* Store the type of selection */
- UINT32ENCODE(pp, (uint32_t)1); /* Store the version number */
+ UINT32ENCODE(pp, (uint32_t)H5S_ALL_VERSION_1); /* Store the version number */
UINT32ENCODE(pp, (uint32_t)0); /* Store the un-used padding */
UINT32ENCODE(pp, (uint32_t)0); /* Store the additional information length */
@@ -527,7 +631,7 @@ H5S__all_serialize(const H5S_t *space, uint8_t **p)
*p = pp;
FUNC_LEAVE_NOAPI(SUCCEED)
-} /* H5S__all_serialize() */
+} /* end H5S__all_serialize() */
/*--------------------------------------------------------------------------
@@ -537,10 +641,8 @@ H5S__all_serialize(const H5S_t *space, uint8_t **p)
Deserialize the current selection from a user-provided buffer.
USAGE
herr_t H5S_all_deserialize(space, p)
- H5S_t *space; IN/OUT: Dataspace pointer to place
+ H5S_t **space; IN/OUT: Dataspace pointer to place
selection into
- uint32_t version IN: Selection version
- uint8_t flags IN: Selection flags
uint8 **p; OUT: Pointer to buffer holding serialized
selection. Will be advanced to end of
serialized selection.
@@ -555,24 +657,53 @@ H5S__all_serialize(const H5S_t *space, uint8_t **p)
REVISION LOG
--------------------------------------------------------------------------*/
static herr_t
-H5S__all_deserialize(H5S_t *space, uint32_t H5_ATTR_UNUSED version, uint8_t H5_ATTR_UNUSED flags,
- const uint8_t H5_ATTR_UNUSED **p)
+H5S__all_deserialize(H5S_t **space, const uint8_t **p)
{
+ uint32_t version; /* Version number */
+ H5S_t *tmp_space = NULL; /* Pointer to actual dataspace to use,
+ either *space or a newly allocated one */
herr_t ret_value = SUCCEED; /* return value */
FUNC_ENTER_STATIC
- HDassert(space);
HDassert(p);
HDassert(*p);
+ /* As part of the efforts to push all selection-type specific coding
+ to the callbacks, the coding for the allocation of a null dataspace
+ is moved from H5S_select_deserialize() in H5Sselect.c.
+ This is needed for decoding virtual layout in H5O__layout_decode() */
+
+ /* Allocate space if not provided */
+ if(!*space) {
+ if(NULL == (tmp_space = H5S_create(H5S_SIMPLE)))
+ HGOTO_ERROR(H5E_DATASPACE, H5E_CANTCREATE, FAIL, "can't create dataspace")
+ } /* end if */
+ else
+ tmp_space = *space;
+
+ /* Decode version */
+ UINT32DECODE(*p, version);
+
+ /* Skip over the remainder of the header */
+ *p += 8;
+
/* Change to "all" selection */
- if(H5S_select_all(space, TRUE) < 0)
+ if(H5S_select_all(tmp_space, TRUE) < 0)
HGOTO_ERROR(H5E_DATASPACE, H5E_CANTDELETE, FAIL, "can't change selection")
+ /* Return space to the caller if allocated */
+ if(!*space)
+ *space = tmp_space;
+
done:
+ /* Free temporary space if not passed to caller (only happens on error) */
+ if(!*space && tmp_space)
+ if(H5S_close(tmp_space) < 0)
+ HDONE_ERROR(H5E_DATASPACE, H5E_CANTFREE, FAIL, "can't close dataspace")
+
FUNC_LEAVE_NOAPI(ret_value)
-} /* H5S__all_deserialize() */
+} /* end H5S__all_deserialize() */
/*--------------------------------------------------------------------------
@@ -622,7 +753,7 @@ H5S__all_bounds(const H5S_t *space, hsize_t *start, hsize_t *end)
} /* end for */
FUNC_LEAVE_NOAPI(SUCCEED)
-} /* H5S__all_bounds() */
+} /* end H5S__all_bounds() */
/*--------------------------------------------------------------------------
@@ -657,7 +788,7 @@ H5S__all_offset(const H5S_t H5_ATTR_UNUSED *space, hsize_t *offset)
*offset = 0;
FUNC_LEAVE_NOAPI(SUCCEED)
-} /* H5S__all_offset() */
+} /* end H5S__all_offset() */
/*--------------------------------------------------------------------------
@@ -716,7 +847,7 @@ H5S__all_is_contiguous(const H5S_t H5_ATTR_UNUSED *space)
HDassert(space);
FUNC_LEAVE_NOAPI(TRUE)
-} /* H5S__all_is_contiguous() */
+} /* end H5S__all_is_contiguous() */
/*--------------------------------------------------------------------------
@@ -745,7 +876,7 @@ H5S__all_is_single(const H5S_t H5_ATTR_UNUSED *space)
HDassert(space);
FUNC_LEAVE_NOAPI(TRUE)
-} /* H5S__all_is_single() */
+} /* end H5S__all_is_single() */
/*--------------------------------------------------------------------------
@@ -776,7 +907,71 @@ H5S__all_is_regular(const H5S_t H5_ATTR_UNUSED *space)
HDassert(space);
FUNC_LEAVE_NOAPI(TRUE)
-} /* H5S__all_is_regular() */
+} /* end H5S__all_is_regular() */
+
+
+/*--------------------------------------------------------------------------
+ NAME
+ H5S__all_shape_same
+ PURPOSE
+ Check if a two "all" selections are the same shape
+ USAGE
+ htri_t H5S__all_shape_same(space1, space2)
+ const H5S_t *space1; IN: First dataspace to check
+ const H5S_t *space2; IN: Second dataspace to check
+ RETURNS
+ TRUE / FALSE / FAIL
+ DESCRIPTION
+ Checks to see if the current selection in each dataspace are the same
+ shape.
+ GLOBAL VARIABLES
+ COMMENTS, BUGS, ASSUMPTIONS
+ EXAMPLES
+ REVISION LOG
+--------------------------------------------------------------------------*/
+static htri_t
+H5S__all_shape_same(const H5S_t *space1, const H5S_t *space2)
+{
+ int space1_dim; /* Current dimension in first dataspace */
+ int space2_dim; /* Current dimension in second dataspace */
+ htri_t ret_value = TRUE; /* Return value */
+
+ FUNC_ENTER_STATIC_NOERR
+
+ /* Check args */
+ HDassert(space1);
+ HDassert(space2);
+
+ /* Initialize dataspace dims */
+ space1_dim = (int)space1->extent.rank - 1;
+ space2_dim = (int)space2->extent.rank - 1;
+
+ /* Recall that space1_rank >= space2_rank.
+ *
+ * In the following while loop, we test to see if space1 and space2
+ * have identical size in all dimensions they have in common.
+ */
+ while(space2_dim >= 0) {
+ if(space1->extent.size[space1_dim] != space2->extent.size[space2_dim])
+ HGOTO_DONE(FALSE)
+
+ space1_dim--;
+ space2_dim--;
+ } /* end while */
+
+ /* Since we are selecting the entire space, we must also verify that space1
+ * has size 1 in all dimensions that it does not share with space2.
+ */
+ while(space1_dim >= 0) {
+ if(space1->extent.size[space1_dim] != 1)
+ HGOTO_DONE(FALSE)
+
+ space1_dim--;
+ } /* end while */
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5S__all_shape_same() */
/*--------------------------------------------------------------------------
@@ -807,7 +1002,7 @@ H5S__all_adjust_u(H5S_t H5_ATTR_UNUSED *space, const hsize_t H5_ATTR_UNUSED *off
HDassert(offset);
FUNC_LEAVE_NOAPI(SUCCEED)
-} /* H5S__all_adjust_u() */
+} /* end H5S__all_adjust_u() */
/*-------------------------------------------------------------------------
@@ -816,7 +1011,7 @@ H5S__all_adjust_u(H5S_t H5_ATTR_UNUSED *space, const hsize_t H5_ATTR_UNUSED *off
* Purpose: Projects a single element 'all' selection into a scalar
* dataspace
*
- * Return: non-negative on success, negative on failure.
+ * Return: Non-negative on success, negative on failure.
*
* Programmer: Quincey Koziol
* Sunday, July 18, 2010
@@ -836,7 +1031,7 @@ H5S__all_project_scalar(const H5S_t H5_ATTR_UNUSED *space, hsize_t *offset)
*offset = 0;
FUNC_LEAVE_NOAPI(SUCCEED)
-} /* H5S__all_project_scalar() */
+} /* end H5S__all_project_scalar() */
/*-------------------------------------------------------------------------
@@ -845,7 +1040,7 @@ H5S__all_project_scalar(const H5S_t H5_ATTR_UNUSED *space, hsize_t *offset)
* Purpose: Projects an 'all' selection onto/into a simple dataspace
* of a different rank
*
- * Return: non-negative on success, negative on failure.
+ * Return: Non-negative on success, negative on failure.
*
* Programmer: Quincey Koziol
* Sunday, July 18, 2010
@@ -853,7 +1048,8 @@ H5S__all_project_scalar(const H5S_t H5_ATTR_UNUSED *space, hsize_t *offset)
*-------------------------------------------------------------------------
*/
static herr_t
-H5S__all_project_simple(const H5S_t *base_space, H5S_t *new_space, hsize_t *offset)
+H5S__all_project_simple(const H5S_t H5_ATTR_UNUSED *base_space,
+ H5S_t *new_space, hsize_t H5_ATTR_UNUSED *offset)
{
herr_t ret_value = SUCCEED; /* Return value */
@@ -870,7 +1066,7 @@ H5S__all_project_simple(const H5S_t *base_space, H5S_t *new_space, hsize_t *offs
done:
FUNC_LEAVE_NOAPI(ret_value)
-} /* H5S__all_project_simple() */
+} /* end H5S__all_project_simple() */
/*--------------------------------------------------------------------------
@@ -914,7 +1110,7 @@ H5S_select_all(H5S_t *space, hbool_t rel_prev)
done:
FUNC_LEAVE_NOAPI(ret_value)
-} /* H5S_select_all() */
+} /* end H5S_select_all() */
/*--------------------------------------------------------------------------
@@ -953,79 +1149,5 @@ H5Sselect_all(hid_t spaceid)
done:
FUNC_LEAVE_API(ret_value)
-} /* H5Sselect_all() */
-
-
-/*--------------------------------------------------------------------------
- NAME
- H5S__all_get_seq_list
- PURPOSE
- Create a list of offsets & lengths for a selection
- USAGE
- herr_t H5S__all_get_seq_list(space,flags,iter,maxseq,maxelem,nseq,nelem,off,len)
- H5S_t *space; IN: Dataspace containing selection to use.
- unsigned flags; IN: Flags for extra information about operation
- H5S_sel_iter_t *iter; IN/OUT: Selection iterator describing last
- position of interest in selection.
- size_t maxseq; IN: Maximum number of sequences to generate
- size_t maxelem; IN: Maximum number of elements to include in the
- generated sequences
- size_t *nseq; OUT: Actual number of sequences generated
- size_t *nelem; OUT: Actual number of elements in sequences generated
- hsize_t *off; OUT: Array of offsets
- size_t *len; OUT: Array of lengths
- RETURNS
- Non-negative on success/Negative on failure.
- DESCRIPTION
- Use the selection in the dataspace to generate a list of byte offsets and
- lengths for the region(s) selected. Start/Restart from the position in the
- ITER parameter. The number of sequences generated is limited by the MAXSEQ
- parameter and the number of sequences actually generated is stored in the
- NSEQ parameter.
- GLOBAL VARIABLES
- COMMENTS, BUGS, ASSUMPTIONS
- EXAMPLES
- REVISION LOG
---------------------------------------------------------------------------*/
-static herr_t
-H5S__all_get_seq_list(const H5S_t H5_ATTR_UNUSED *space, unsigned H5_ATTR_UNUSED flags, H5S_sel_iter_t *iter,
- size_t H5_ATTR_UNUSED maxseq, size_t maxelem, size_t *nseq, size_t *nelem,
- hsize_t *off, size_t *len)
-{
- size_t elem_used; /* The number of elements used */
-
- FUNC_ENTER_STATIC_NOERR
-
- /* Check args */
- HDassert(space);
- HDassert(iter);
- HDassert(maxseq > 0);
- HDassert(maxelem > 0);
- HDassert(nseq);
- HDassert(nelem);
- HDassert(off);
- HDassert(len);
-
- /* Determine the actual number of elements to use */
- H5_CHECK_OVERFLOW(iter->elmt_left, hsize_t, size_t);
- elem_used = MIN(maxelem, (size_t)iter->elmt_left);
- HDassert(elem_used > 0);
-
- /* Compute the offset in the dataset */
- off[0] = iter->u.all.byte_offset;
- len[0] = elem_used * iter->elmt_size;
-
- /* Should only need one sequence for 'all' selections */
- *nseq = 1;
-
- /* Set the number of elements used */
- *nelem = elem_used;
-
- /* Update the iterator */
- iter->elmt_left -= elem_used;
- iter->u.all.elmt_offset += elem_used;
- iter->u.all.byte_offset += len[0];
-
- FUNC_LEAVE_NOAPI(SUCCEED)
-} /* end H5S__all_get_seq_list() */
+} /* end H5Sselect_all() */
diff --git a/src/H5Sdbg.c b/src/H5Sdbg.c
index ebd05ce..8171191 100644
--- a/src/H5Sdbg.c
+++ b/src/H5Sdbg.c
@@ -57,16 +57,16 @@
/********************/
-/*********************/
-/* Package Variables */
-/*********************/
-
-
/*****************************/
/* Library Private Variables */
/*****************************/
+/*********************/
+/* Package Variables */
+/*********************/
+
+
/*******************/
/* Local Variables */
/*******************/
@@ -94,24 +94,24 @@ H5S_debug(H5F_t *f, const void *_mesg, FILE *stream, int indent, int fwidth)
switch(H5S_GET_EXTENT_TYPE(mesg)) {
case H5S_NULL:
- fprintf(stream, "%*s%-*s H5S_NULL\n", indent, "", fwidth,
+ HDfprintf(stream, "%*s%-*s H5S_NULL\n", indent, "", fwidth,
"Space class:");
break;
case H5S_SCALAR:
- fprintf(stream, "%*s%-*s H5S_SCALAR\n", indent, "", fwidth,
+ HDfprintf(stream, "%*s%-*s H5S_SCALAR\n", indent, "", fwidth,
"Space class:");
break;
case H5S_SIMPLE:
- fprintf(stream, "%*s%-*s H5S_SIMPLE\n", indent, "", fwidth,
+ HDfprintf(stream, "%*s%-*s H5S_SIMPLE\n", indent, "", fwidth,
"Space class:");
H5O_debug_id(H5O_SDSPACE_ID, f, &(mesg->extent), stream, indent + 3, MAX(0, fwidth - 3));
break;
case H5S_NO_CLASS:
default:
- fprintf(stream, "%*s%-*s **UNKNOWN-%ld**\n", indent, "", fwidth,
+ HDfprintf(stream, "%*s%-*s **UNKNOWN-%ld**\n", indent, "", fwidth,
"Space class:", (long)(H5S_GET_EXTENT_TYPE(mesg)));
break;
} /* end switch */
diff --git a/src/H5Sdeprec.c b/src/H5Sdeprec.c
new file mode 100644
index 0000000..e4ec1b0
--- /dev/null
+++ b/src/H5Sdeprec.c
@@ -0,0 +1,121 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * 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: H5Sdeprec.c
+ *
+ * Purpose: Deprecated functions from the H5S interface. These
+ * functions are here for compatibility purposes and may be
+ * removed in the future. Applications should switch to the
+ * newer APIs.
+ *
+ *-------------------------------------------------------------------------
+ */
+
+/****************/
+/* Module Setup */
+/****************/
+
+#include "H5Smodule.h" /* This source code file is part of the H5S module */
+
+
+/***********/
+/* Headers */
+/***********/
+#include "H5private.h" /* Generic Functions */
+#include "H5CXprivate.h" /* API Contexts */
+#include "H5Spkg.h" /* Dataspaces */
+#include "H5Eprivate.h" /* Error handling */
+#include "H5Iprivate.h" /* IDs */
+
+
+/****************/
+/* Local Macros */
+/****************/
+
+
+/******************/
+/* Local Typedefs */
+/******************/
+
+
+/********************/
+/* Package Typedefs */
+/********************/
+
+
+/********************/
+/* Local Prototypes */
+/********************/
+
+
+/*********************/
+/* Package Variables */
+/*********************/
+
+
+/*****************************/
+/* Library Private Variables */
+/*****************************/
+
+
+/*******************/
+/* Local Variables */
+/*******************/
+
+
+#ifndef H5_NO_DEPRECATED_SYMBOLS
+
+/*-------------------------------------------------------------------------
+ * Function: H5Sencode1
+ *
+ * Purpose: Given a dataspace ID, converts the object description
+ * (including selection) into binary in a buffer.
+ *
+ * Return: Success: non-negative
+ * Failure: negative
+ *
+ * Programmer: Raymond Lu
+ * slu@ncsa.uiuc.edu
+ * July 14, 2004
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5Sencode1(hid_t obj_id, void *buf, size_t *nalloc)
+{
+ H5S_t *dspace;
+ hid_t temp_fapl_id = H5P_DEFAULT;
+ herr_t ret_value=SUCCEED;
+
+ FUNC_ENTER_API(FAIL)
+ H5TRACE3("e", "i*x*z", obj_id, buf, nalloc);
+
+ /* Check argument and retrieve object */
+ if (NULL == (dspace = (H5S_t *)H5I_object_verify(obj_id, H5I_DATASPACE)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataspace")
+
+ /* Verify access property list and set up collective metadata if appropriate */
+ if(H5CX_set_apl(&temp_fapl_id, H5P_CLS_FACC, H5I_INVALID_HID, TRUE) < 0)
+ HGOTO_ERROR(H5E_FILE, H5E_CANTSET, H5I_INVALID_HID, "can't set access property list info")
+
+ /* Use (earliest, latest) i.e. not latest format */
+ if(H5S_encode(dspace, (unsigned char **)&buf, nalloc)<0)
+ HGOTO_ERROR(H5E_DATASPACE, H5E_CANTENCODE, FAIL, "can't encode dataspace")
+
+done:
+ FUNC_LEAVE_API(ret_value)
+} /* H5Sencode1() */
+#endif /* H5_NO_DEPRECATED_SYMBOLS */
+
diff --git a/src/H5Shyper.c b/src/H5Shyper.c
index 88c570d..2acc135 100644
--- a/src/H5Shyper.c
+++ b/src/H5Shyper.c
@@ -18,56 +18,163 @@
* Purpose: Hyperslab selection dataspace I/O functions.
*/
+/****************/
+/* Module Setup */
+/****************/
+
#include "H5Smodule.h" /* This source code file is part of the H5S module */
-#include "H5private.h" /* Generic Functions */
+/***********/
+/* Headers */
+/***********/
+#include "H5private.h" /* Generic Functions */
+#include "H5CXprivate.h" /* API Contexts */
#include "H5Eprivate.h" /* Error handling */
#include "H5FLprivate.h" /* Free Lists */
#include "H5Iprivate.h" /* ID Functions */
-#include "H5Spkg.h" /* Dataspace functions */
-#include "H5VMprivate.h" /* Vector functions */
+#include "H5MMprivate.h" /* Memory management */
+#include "H5Spkg.h" /* Dataspace functions */
+#include "H5VMprivate.h" /* Vector functions */
-/* Local Macros */
-/* Local datatypes */
+/****************/
+/* Local Macros */
+/****************/
-/* Static function prototypes */
+/* Macro for checking if two ranges overlap one another */
+/*
+ * Check for the inverse of whether the ranges are disjoint. If they are
+ * disjoint, then the low bound of one of the ranges must be greater than the
+ * high bound of the other.
+ */
+/* (Assumes that low & high bounds are _inclusive_) */
+#define H5S_RANGE_OVERLAP(L1, H1, L2, H2) \
+ (!((L1) > (H2) || (L2) > (H1)))
+
+/* Flags for which hyperslab fragments to compute */
+#define H5S_HYPER_COMPUTE_B_NOT_A 0x01
+#define H5S_HYPER_COMPUTE_A_AND_B 0x02
+#define H5S_HYPER_COMPUTE_A_NOT_B 0x04
+
+/* Macro to advance a span, possibly recycling it first */
+#define H5S_HYPER_ADVANCE_SPAN(recover, curr_span, next_span) \
+ do { \
+ H5S_hyper_span_t *saved_next_span = (next_span); \
+ \
+ /* Check if the span should be recovered */ \
+ if(recover) { \
+ H5S__hyper_free_span(curr_span); \
+ (recover) = FALSE; \
+ } /* end if */ \
+ \
+ /* Set the current span to saved next span */ \
+ (curr_span) = saved_next_span; \
+ } while(0)
+
+/* Macro to add "skipped" elements to projection during the execution of
+ * H5S__hyper_project_intersect() */
+#define H5S_HYPER_PROJ_INT_ADD_SKIP(UDATA, ADD, ERR) \
+ do { \
+ /* If there are any elements to add, we must add them \
+ * to the projection first before adding skip */ \
+ if((UDATA)->nelem > 0) \
+ if(H5S__hyper_proj_int_build_proj(UDATA) < 0) \
+ HGOTO_ERROR(H5E_DATASPACE, H5E_CANTAPPEND, ERR, "can't add elements to projected selection") \
+ (UDATA)->skip += (ADD); \
+ } while(0) /* end H5S_HYPER_PROJ_INT_ADD_SKIP() */
+
+
+/******************/
+/* Local Typedefs */
+/******************/
+
+/* Define alias for hsize_t, for allocating H5S_hyper_span_info_t + bounds objects */
+/* (Makes it easier to understand the alloc / free calls) */
+typedef hsize_t hbounds_t;
+
+/* Struct for holding persistent information during iteration for
+ * H5S__hyper_project_intersect() */
+typedef struct {
+ const H5S_hyper_span_t *ds_span[H5S_MAX_RANK]; /* Array of the current spans in the destination space in each dimension */
+ hsize_t ds_low[H5S_MAX_RANK]; /* Array of current low bounds (of iteration) for each element in ds_span */
+ H5S_hyper_span_info_t *ps_span_info[H5S_MAX_RANK]; /* Array of span info structs for projected space during iteration */
+ uint32_t ps_clean_bitmap; /* Bitmap of whether the nth rank has a clean projected space since the last time it was set to 1 */
+ unsigned ss_rank; /* Rank of source space */
+ unsigned ds_rank; /* Rank of destination space */
+ unsigned depth; /* Current depth of iterator in destination space */
+ hsize_t skip; /* Number of elements to skip in projected space */
+ hsize_t nelem; /* Number of elements to add to projected space (after skip) */
+ uint64_t op_gen; /* Operation generation for counting elements */
+} H5S_hyper_project_intersect_ud_t;
+
+/* Assert that H5S_MAX_RANK is <= 32 so our trick with using a 32 bit bitmap
+ * (ps_clean_bitmap) works. If H5S_MAX_RANK increases either increase the size
+ * of ps_clean_bitmap or change the algorithm to use an array. */
+#if H5S_MAX_RANK > 32
+#error H5S_MAX_RANK too large for ps_clean_bitmap field in H5S_hyper_project_intersect_ud_t struct
+#endif
+
+
+/********************/
+/* Local Prototypes */
+/********************/
static H5S_hyper_span_t *H5S__hyper_new_span(hsize_t low, hsize_t high,
H5S_hyper_span_info_t *down, H5S_hyper_span_t *next);
-static herr_t H5S__hyper_span_precompute(H5S_hyper_span_info_t *spans, size_t elmt_size);
-static void H5S__hyper_span_scratch(H5S_hyper_span_info_t *spans);
-static H5S_hyper_span_info_t *H5S__hyper_copy_span(H5S_hyper_span_info_t *spans);
+static H5S_hyper_span_info_t *H5S__hyper_new_span_info(unsigned rank);
+static H5S_hyper_span_info_t *H5S__hyper_copy_span(H5S_hyper_span_info_t *spans,
+ unsigned rank);
static hbool_t H5S__hyper_cmp_spans(const H5S_hyper_span_info_t *span_info1,
const H5S_hyper_span_info_t *span_info2);
-static herr_t H5S__hyper_free_span_info(H5S_hyper_span_info_t *span_info);
-static herr_t H5S__hyper_free_span(H5S_hyper_span_t *span);
-static hbool_t H5S__hyper_is_valid_helper(const H5S_hyper_span_info_t *spans,
- const hssize_t *offset, const hsize_t *size);
-static herr_t H5S__hyper_recover_span(hbool_t *recover,
- H5S_hyper_span_t **curr_span, H5S_hyper_span_t *next_span);
-static H5S_hyper_span_t *H5S__hyper_coord_to_span(unsigned rank,
- const hsize_t *coords);
-static herr_t H5S__hyper_append_span(H5S_hyper_span_t **prev_span,
- H5S_hyper_span_info_t **span_tree, hsize_t low, hsize_t high,
- H5S_hyper_span_info_t *down, H5S_hyper_span_t *next);
+static void H5S__hyper_free_span_info(H5S_hyper_span_info_t *span_info);
+static void H5S__hyper_free_span(H5S_hyper_span_t *span);
+static herr_t H5S__hyper_span_blocklist(const H5S_hyper_span_info_t *spans,
+ hsize_t start[], hsize_t end[], hsize_t rank, hsize_t *startblock, hsize_t *numblocks,
+ hsize_t **buf);
+static herr_t H5S__get_select_hyper_blocklist(H5S_t *space, hsize_t startblock,
+ hsize_t numblocks, hsize_t *buf);
+static H5S_hyper_span_t *H5S__hyper_coord_to_span(unsigned rank, const hsize_t *coords);
+static herr_t H5S__hyper_append_span(H5S_hyper_span_info_t **span_tree,
+ unsigned ndims, hsize_t low, hsize_t high, H5S_hyper_span_info_t *down);
static herr_t H5S__hyper_clip_spans(H5S_hyper_span_info_t *a_spans,
- H5S_hyper_span_info_t *b_spans, H5S_hyper_span_info_t **a_not_b,
+ H5S_hyper_span_info_t *b_spans, unsigned selector,
+ unsigned ndims, H5S_hyper_span_info_t **a_not_b,
H5S_hyper_span_info_t **a_and_b, H5S_hyper_span_info_t **b_not_a);
-static herr_t H5S__hyper_merge_spans(H5S_t *space,
- H5S_hyper_span_info_t *new_spans, hbool_t can_own);
-static hsize_t H5S__hyper_spans_nelem(const H5S_hyper_span_info_t *spans);
+static herr_t H5S__hyper_merge_spans(H5S_t *space, H5S_hyper_span_info_t *new_spans);
+static hsize_t H5S__hyper_spans_nelem_helper(H5S_hyper_span_info_t *spans,
+ uint64_t op_gen);
+static hsize_t H5S__hyper_spans_nelem(H5S_hyper_span_info_t *spans);
+static herr_t H5S__hyper_add_disjoint_spans(H5S_t *space, H5S_hyper_span_info_t *new_spans);
static H5S_hyper_span_info_t *H5S__hyper_make_spans(unsigned rank,
- const hsize_t *start, const hsize_t *stride, const hsize_t *count,
- const hsize_t *block);
+ const hsize_t *start, const hsize_t *stride,
+ const hsize_t *count, const hsize_t *block);
+static herr_t H5S__hyper_update_diminfo(H5S_t *space, H5S_seloper_t op,
+ const H5S_hyper_dim_t *new_hyper_diminfo);
static herr_t H5S__hyper_generate_spans(H5S_t *space);
+static hbool_t H5S__check_spans_overlap(const H5S_hyper_span_info_t *spans1,
+ const H5S_hyper_span_info_t *spans2);
+static herr_t H5S__fill_in_new_space(H5S_t *space1, H5S_seloper_t op,
+ H5S_hyper_span_info_t *space2_span_lst, hbool_t can_own_span2,
+ hbool_t *span2_owned, hbool_t *updated_spans, H5S_t **result);
static herr_t H5S__generate_hyperslab(H5S_t *space, H5S_seloper_t op,
const hsize_t start[], const hsize_t stride[], const hsize_t count[],
const hsize_t block[]);
-/* Needed for use in hyperslab code (H5Shyper.c) */
-#ifdef NEW_HYPERSLAB_API
-static herr_t H5S_select_select (H5S_t *space1, H5S_seloper_t op, H5S_t *space2);
-#endif /*NEW_HYPERSLAB_API*/
+static herr_t H5S__set_regular_hyperslab(H5S_t *space, const hsize_t start[],
+ const hsize_t *app_stride, const hsize_t app_count[], const hsize_t *app_block,
+ const hsize_t *opt_stride, const hsize_t opt_count[], const hsize_t *opt_block);
+static herr_t H5S__fill_in_select(H5S_t *space1, H5S_seloper_t op, H5S_t *space2,
+ H5S_t **result);
+static H5S_t *H5S__combine_select(H5S_t *space1, H5S_seloper_t op, H5S_t *space2);
+static herr_t H5S__hyper_iter_get_seq_list_gen(H5S_sel_iter_t *iter, size_t maxseq,
+ size_t maxelem, size_t *nseq, size_t *nelem, hsize_t *off, size_t *len);
+static herr_t H5S__hyper_iter_get_seq_list_opt(H5S_sel_iter_t *iter, size_t maxseq,
+ size_t maxelem, size_t *nseq, size_t *nelem, hsize_t *off, size_t *len);
+static herr_t H5S__hyper_iter_get_seq_list_single(H5S_sel_iter_t *iter, size_t maxseq,
+ size_t maxelem, size_t *nseq, size_t *nelem, hsize_t *off, size_t *len);
+static herr_t H5S__hyper_proj_int_build_proj(H5S_hyper_project_intersect_ud_t *udata);
+static herr_t H5S__hyper_proj_int_iterate(const H5S_hyper_span_info_t *ss_span_info,
+ const H5S_hyper_span_info_t *sis_span_info, hsize_t count, unsigned depth,
+ H5S_hyper_project_intersect_ud_t *udata);
static void H5S__hyper_get_clip_diminfo(hsize_t start, hsize_t stride,
hsize_t *count, hsize_t *block, hsize_t clip_size);
static hsize_t H5S__hyper_get_clip_extent_real(const H5S_t *clip_space,
@@ -75,15 +182,12 @@ static hsize_t H5S__hyper_get_clip_extent_real(const H5S_t *clip_space,
/* Selection callbacks */
static herr_t H5S__hyper_copy(H5S_t *dst, const H5S_t *src, hbool_t share_selection);
-static herr_t H5S__hyper_get_seq_list(const H5S_t *space, unsigned flags,
- H5S_sel_iter_t *iter, size_t maxseq, size_t maxbytes,
- size_t *nseq, size_t *nbytes, hsize_t *off, size_t *len);
static herr_t H5S__hyper_release(H5S_t *space);
static htri_t H5S__hyper_is_valid(const H5S_t *space);
+static hsize_t H5S__hyper_span_nblocks(H5S_hyper_span_info_t *spans);
static hssize_t H5S__hyper_serial_size(const H5S_t *space);
static herr_t H5S__hyper_serialize(const H5S_t *space, uint8_t **p);
-static herr_t H5S__hyper_deserialize(H5S_t *space, uint32_t version, uint8_t flags,
- const uint8_t **p);
+static herr_t H5S__hyper_deserialize(H5S_t **space, const uint8_t **p);
static herr_t H5S__hyper_bounds(const H5S_t *space, hsize_t *start, hsize_t *end);
static herr_t H5S__hyper_offset(const H5S_t *space, hsize_t *offset);
static int H5S__hyper_unlim_dim(const H5S_t *space);
@@ -92,10 +196,11 @@ static herr_t H5S__hyper_num_elem_non_unlim(const H5S_t *space,
static htri_t H5S__hyper_is_contiguous(const H5S_t *space);
static htri_t H5S__hyper_is_single(const H5S_t *space);
static htri_t H5S__hyper_is_regular(const H5S_t *space);
+static htri_t H5S__hyper_shape_same(const H5S_t *space1, const H5S_t *space2);
static herr_t H5S__hyper_adjust_u(H5S_t *space, const hsize_t *offset);
static herr_t H5S__hyper_project_scalar(const H5S_t *space, hsize_t *offset);
static herr_t H5S__hyper_project_simple(const H5S_t *space, H5S_t *new_space, hsize_t *offset);
-static herr_t H5S__hyper_iter_init(H5S_sel_iter_t *iter, const H5S_t *space);
+static herr_t H5S__hyper_iter_init(const H5S_t *space, H5S_sel_iter_t *iter);
/* Selection iteration callbacks */
static herr_t H5S__hyper_iter_coords(const H5S_sel_iter_t *iter, hsize_t *coords);
@@ -104,12 +209,19 @@ static hsize_t H5S__hyper_iter_nelmts(const H5S_sel_iter_t *iter);
static htri_t H5S__hyper_iter_has_next_block(const H5S_sel_iter_t *sel_iter);
static herr_t H5S__hyper_iter_next(H5S_sel_iter_t *sel_iter, size_t nelem);
static herr_t H5S__hyper_iter_next_block(H5S_sel_iter_t *sel_iter);
+static herr_t H5S__hyper_iter_get_seq_list(H5S_sel_iter_t *iter, size_t maxseq,
+ size_t maxbytes, size_t *nseq, size_t *nbytes, hsize_t *off, size_t *len);
static herr_t H5S__hyper_iter_release(H5S_sel_iter_t *sel_iter);
-/* Static function for optimizing hyperslab */
-static hbool_t H5S__hyper_rebuild_helper(const H5S_hyper_span_t *span,
- H5S_hyper_dim_t span_slab_info[], unsigned rank);
-static hbool_t H5S__hyper_rebuild(H5S_t *space);
+
+/*****************************/
+/* Library Private Variables */
+/*****************************/
+
+
+/*********************/
+/* Package Variables */
+/*********************/
/* Selection properties for hyperslab selections */
const H5S_select_class_t H5S_sel_hyper[1] = {{
@@ -117,7 +229,6 @@ const H5S_select_class_t H5S_sel_hyper[1] = {{
/* Methods on selection */
H5S__hyper_copy,
- H5S__hyper_get_seq_list,
H5S__hyper_release,
H5S__hyper_is_valid,
H5S__hyper_serial_size,
@@ -130,12 +241,25 @@ const H5S_select_class_t H5S_sel_hyper[1] = {{
H5S__hyper_is_contiguous,
H5S__hyper_is_single,
H5S__hyper_is_regular,
+ H5S__hyper_shape_same,
H5S__hyper_adjust_u,
H5S__hyper_project_scalar,
H5S__hyper_project_simple,
H5S__hyper_iter_init,
}};
+/* Format version bounds for dataspace hyperslab selection */
+const unsigned H5O_sds_hyper_ver_bounds[] = {
+ H5S_HYPER_VERSION_1, /* H5F_LIBVER_EARLIEST */
+ H5S_HYPER_VERSION_1, /* H5F_LIBVER_V18 */
+ H5S_HYPER_VERSION_2, /* H5F_LIBVER_V110 */
+ H5S_HYPER_VERSION_3 /* H5F_LIBVER_LATEST */
+};
+
+/*******************/
+/* Local Variables */
+/*******************/
+
/* Iteration properties for hyperslab selections */
static const H5S_sel_iter_class_t H5S_sel_iter_hyper[1] = {{
H5S_SEL_HYPERSLABS,
@@ -147,22 +271,21 @@ static const H5S_sel_iter_class_t H5S_sel_iter_hyper[1] = {{
H5S__hyper_iter_has_next_block,
H5S__hyper_iter_next,
H5S__hyper_iter_next_block,
+ H5S__hyper_iter_get_seq_list,
H5S__hyper_iter_release,
}};
-/* Static variables */
-
/* Arrays for default stride, block, etc. */
-static const hsize_t H5S_hyper_zeros_g[H5O_LAYOUT_NDIMS] = {
+static const hsize_t H5S_hyper_zeros_g[H5S_MAX_RANK] = {
0,0,0,0, 0,0,0,0,
0,0,0,0, 0,0,0,0,
0,0,0,0, 0,0,0,0,
- 0,0,0,0, 0,0,0,0,0};
-static const hsize_t H5S_hyper_ones_g[H5O_LAYOUT_NDIMS] = {
+ 0,0,0,0, 0,0,0,0};
+static const hsize_t H5S_hyper_ones_g[H5S_MAX_RANK] = {
1,1,1,1, 1,1,1,1,
1,1,1,1, 1,1,1,1,
1,1,1,1, 1,1,1,1,
- 1,1,1,1, 1,1,1,1,1};
+ 1,1,1,1, 1,1,1,1};
/* Declare a free list to manage the H5S_hyper_sel_t struct */
H5FL_DEFINE_STATIC(H5S_hyper_sel_t);
@@ -170,12 +293,18 @@ H5FL_DEFINE_STATIC(H5S_hyper_sel_t);
/* Declare a free list to manage the H5S_hyper_span_t struct */
H5FL_DEFINE_STATIC(H5S_hyper_span_t);
-/* Declare a free list to manage the H5S_hyper_span_info_t struct */
-H5FL_DEFINE_STATIC(H5S_hyper_span_info_t);
+/* Declare a free list to manage the H5S_hyper_span_info_t + hsize_t array struct */
+H5FL_BARR_DEFINE_STATIC(H5S_hyper_span_info_t, hbounds_t, H5S_MAX_RANK * 2);
/* Declare extern free list to manage the H5S_sel_iter_t struct */
H5FL_EXTERN(H5S_sel_iter_t);
+/* Current operation generation */
+/* (Start with '1' to avoid clashing with '0' value in newly allocated structs) */
+static uint64_t H5S_hyper_op_gen_g = 1;
+
+
+/* Uncomment this, to provide the debugging routines for printing selection info */
/* #define H5S_HYPER_DEBUG */
#ifdef H5S_HYPER_DEBUG
static herr_t
@@ -184,9 +313,9 @@ H5S__hyper_print_spans_helper(FILE *f, const H5S_hyper_span_t *span, unsigned de
FUNC_ENTER_STATIC_NOERR
while(span) {
- HDfprintf(f,"%s: depth=%u, span=%p, (%Hu, %Hu), nelem=%Hu, pstride=%Hu\n", FUNC, depth, span, span->low, span->high, span->nelem, span->pstride);
- if(span->down && span->down->head) {
- HDfprintf(f,"%s: spans=%p, count=%u, scratch=%p, head=%p\n", FUNC, span->down, span->down->count, span->down->scratch, span->down->head);
+ HDfprintf(f,"%s: %*sdepth=%u, span=%p, (%Hu, %Hu), next=%p\n", FUNC, depth * 2, "", depth, span, span->low, span->high, span->next);
+ if(span->down) {
+ HDfprintf(f,"%s: %*sspans=%p, count=%u, bounds[0]={%Hu, %Hu}, head=%p\n", FUNC, (depth + 1) * 2, "", span->down, span->down->count, span->down->low_bounds[0], span->down->high_bounds[0], span->down->head);
H5S__hyper_print_spans_helper(f, span->down->head, depth + 1);
} /* end if */
span = span->next;
@@ -201,7 +330,7 @@ H5S__hyper_print_spans(FILE *f, const H5S_hyper_span_info_t *span_lst)
FUNC_ENTER_STATIC_NOERR
if(span_lst != NULL) {
- HDfprintf(f, "%s: spans=%p, count=%u, scratch=%p, head=%p\n", FUNC, span_lst, span_lst->count, span_lst->scratch, span_lst->head);
+ HDfprintf(f, "%s: spans=%p, count=%u, bounds[0]={%Hu, %Hu}, head=%p\n", FUNC, span_lst, span_lst->count, span_lst->low_bounds[0], span_lst->high_bounds[0], span_lst->head);
H5S__hyper_print_spans_helper(f, span_lst->head, 0);
} /* end if */
@@ -250,25 +379,194 @@ H5S__hyper_print_diminfo(FILE *f, const H5S_t *space)
{
FUNC_ENTER_STATIC_NOERR
- H5S__hyper_print_diminfo_helper(f, "opt_diminfo", space->extent.rank, space->select.sel_info.hslab->opt_diminfo);
- H5S__hyper_print_diminfo_helper(f, "app_diminfo", space->extent.rank, space->select.sel_info.hslab->app_diminfo);
+ H5S__hyper_print_diminfo_helper(f, "diminfo.opt", space->extent.rank, space->select.sel_info.hslab->diminfo.opt);
+ H5S__hyper_print_diminfo_helper(f, "diminfo.app", space->extent.rank, space->select.sel_info.hslab->diminfo.app);
FUNC_LEAVE_NOAPI(SUCCEED)
}
+
+
+/*--------------------------------------------------------------------------
+ NAME
+ H5S__hyper_print_spans_dfs
+ PURPOSE
+ Output the span elements for one span list in depth-first order
+ USAGE
+ herr_t H5S__hyper_print_spans_dfs(f, span_lst, depth)
+ FILE *f; IN: the file to output
+ const H5S_hyper_span_info_t *span_lst; IN: the span list to output
+ unsigned depth; IN: the level of this span list
+ RETURNS
+ non-negative on success, negative on failure
+ GLOBAL VARIABLES
+ COMMENTS, BUGS, ASSUMPTIONS
+ EXAMPLES
+ REVISION LOG
+--------------------------------------------------------------------------*/
+static herr_t
+H5S__hyper_print_spans_dfs(FILE *f, const H5S_hyper_span_info_t *span_lst,
+ unsigned depth, unsigned dims)
+{
+ H5S_hyper_span_t *actual_tail = NULL;
+ H5S_hyper_span_t *cur_elem;
+ unsigned num_elems = 0;
+ unsigned u, elem_idx;
+
+ FUNC_ENTER_STATIC_NOERR
+
+ /* get the actual tail from head */
+ cur_elem = span_lst->head;
+ HDassert(cur_elem); /* at least 1 element */
+ while(cur_elem) {
+ actual_tail = cur_elem;
+ cur_elem = cur_elem->next;
+ num_elems++;
+ } /* end while */
+
+ for(u = 0; u < depth; u++)
+ HDfprintf(f, "\t");
+ HDfprintf(f, "DIM[%u]: ref_count=%u, #elems=%u, head=%p, tail=%p, actual_tail=%p, matched=%t\n", depth,
+ span_lst->count, num_elems, span_lst->head,
+ span_lst->tail, actual_tail, (span_lst->tail == actual_tail));
+
+ for(u = 0; u < depth; u++)
+ HDfprintf(f, "\t");
+ HDfprintf(f, "low_bounds=[");
+ for(u = 0; u < dims - 1; u++)
+ HDfprintf(f, "%llu,", span_lst->low_bounds[u]);
+ HDfprintf(f, "%llu]\n", span_lst->low_bounds[dims - 1]);
+
+ for(u = 0; u < depth; u++)
+ HDfprintf(f, "\t");
+ HDfprintf(f, "high_bounds=[");
+ for(u = 0; u < dims - 1; u++)
+ HDfprintf(f, "%llu,", span_lst->high_bounds[u]);
+ HDfprintf(f, "%llu]\n", span_lst->high_bounds[dims - 1]);
+
+ cur_elem = span_lst->head;
+ elem_idx = 0;
+ while(cur_elem) {
+ for(u = 0; u < depth; u++)
+ HDfprintf(f, "\t");
+ HDfprintf(f, "ELEM[%u]: ptr=%p, low=%Hu, high=%Hu, down=%p\n",
+ elem_idx++, cur_elem, cur_elem->low, cur_elem->high, cur_elem->down);
+ if(cur_elem->down)
+ H5S__hyper_print_spans_dfs(f, cur_elem->down, depth + 1, dims);
+ cur_elem = cur_elem->next;
+ } /* end while */
+
+ FUNC_LEAVE_NOAPI(SUCCEED)
+} /* end H5S__hyper_print_spans_dfs() */
+
+
+/*--------------------------------------------------------------------------
+ NAME
+ H5S__hyper_print_space_dfs
+ PURPOSE
+ Output the span elements for one hyperslab selection space in depth-first order
+ USAGE
+ herr_t H5S__hyper_print_space_dfs(f, space)
+ FILE *f; IN: the file to output
+ const H5S_t *space; IN: the selection space to output
+ RETURNS
+ non-negative on success, negative on failure
+ GLOBAL VARIABLES
+ COMMENTS, BUGS, ASSUMPTIONS
+ EXAMPLES
+ REVISION LOG
+--------------------------------------------------------------------------*/
+static herr_t
+H5S__hyper_print_space_dfs(FILE *f, const H5S_t *space)
+{
+ const H5S_hyper_sel_t *hslab = space->select.sel_info.hslab;
+ const unsigned dims = space->extent.rank;
+ unsigned u;
+
+ FUNC_ENTER_STATIC_NOERR
+
+ HDassert(hslab);
+
+ HDfprintf(f, "=======================\n");
+ HDfprintf(f, "SPACE: span_lst=%p, #dims=%u, offset_changed=%d\n", hslab->span_lst, dims, space->select.offset_changed);
+
+ HDfprintf(f, " offset=[");
+ for(u = 0; u < dims - 1; u++)
+ HDfprintf(f, "%lld,", space->select.offset[u]);
+ HDfprintf(f, "%lld]\n", space->select.offset[dims - 1]);
+
+ HDfprintf(f, " low_bounds=[");
+ if(space->select.sel_info.hslab->diminfo_valid == H5S_DIMINFO_VALID_YES) {
+ for(u = 0; u < dims - 1; u++)
+ HDfprintf(f, "%llu,", space->select.sel_info.hslab->diminfo.low_bounds[u]);
+ HDfprintf(f, "%llu]\n", space->select.sel_info.hslab->diminfo.low_bounds[dims - 1]);
+ } /* end if */
+ else {
+ for(u = 0; u < dims - 1; u++)
+ HDfprintf(f, "%llu,", space->select.sel_info.hslab->span_lst->low_bounds[u]);
+ HDfprintf(f, "%llu]\n", space->select.sel_info.hslab->span_lst->low_bounds[dims - 1]);
+ } /* end else */
+
+ HDfprintf(f, " high_bounds=[");
+ if(space->select.sel_info.hslab->diminfo_valid == H5S_DIMINFO_VALID_YES) {
+ for(u = 0; u < dims - 1; u++)
+ HDfprintf(f, "%llu,", space->select.sel_info.hslab->diminfo.high_bounds[u]);
+ HDfprintf(f, "%llu]\n", space->select.sel_info.hslab->diminfo.high_bounds[dims - 1]);
+ } /* end if */
+ else {
+ for(u = 0; u < dims - 1; u++)
+ HDfprintf(f, "%llu,", space->select.sel_info.hslab->span_lst->high_bounds[u]);
+ HDfprintf(f, "%llu]\n", space->select.sel_info.hslab->span_lst->high_bounds[dims - 1]);
+ } /* end else */
+
+ /* Print out diminfo, if it's valid */
+ if(space->select.sel_info.hslab->diminfo_valid == H5S_DIMINFO_VALID_YES)
+ H5S__hyper_print_diminfo(f, space);
+
+ /* Start print out the highest-order of dimension */
+ if(hslab->span_lst)
+ H5S__hyper_print_spans_dfs(f, hslab->span_lst, 0, dims);
+ HDfprintf(f, "=======================\n\n");
+
+ FUNC_LEAVE_NOAPI(SUCCEED)
+} /* end H5S__hyper_print_space_dfs() */
#endif /* H5S_HYPER_DEBUG */
/*-------------------------------------------------------------------------
+ * Function: H5S__hyper_get_op_gen
+ *
+ * Purpose: Acquire a unique operation generation value
+ *
+ * Return: Operation generation value (can't fail)
+ *
+ * Programmer: Quincey Koziol
+ * Saturday, January 19, 2019
+ *
+ * Notes: Assumes that a 64-bit value will not wrap around during
+ * the lifespan of the process.
+ *
+ *-------------------------------------------------------------------------
+ */
+uint64_t
+H5S__hyper_get_op_gen(void)
+{
+ FUNC_ENTER_PACKAGE_NOERR
+
+ FUNC_LEAVE_NOAPI(H5S_hyper_op_gen_g++);
+} /* end H5S__hyper_op_gen() */
+
+
+/*-------------------------------------------------------------------------
* Function: H5S__hyper_iter_init
*
- * Purpose: Initializes iteration information for hyperslab span tree selection.
+ * Purpose: Initializes iteration information for hyperslab selection.
*
- * Return: non-negative on success, negative on failure.
+ * Return: Non-negative on success, negative on failure.
*
* Programmer: Quincey Koziol
* Saturday, February 24, 2001
*
- * Notes: If the 'elmt_size' parameter is set to zero, the regular
+ * Notes: If the 'iter->elmt_size' field is set to zero, the regular
* hyperslab selection iterator will not be 'flattened'. This
* is used by the H5S_select_shape_same() code to avoid changing
* the rank and appearance of the selection.
@@ -276,37 +574,47 @@ H5S__hyper_print_diminfo(FILE *f, const H5S_t *space)
*-------------------------------------------------------------------------
*/
static herr_t
-H5S__hyper_iter_init(H5S_sel_iter_t *iter, const H5S_t *space)
+H5S__hyper_iter_init(const H5S_t *space, H5S_sel_iter_t *iter)
{
- unsigned rank; /* Dataspace's dimension rank */
- unsigned u; /* Index variable */
+ hsize_t *slab_size; /* Pointer to the dataspace dimensions to use for calc. slab */
+ hsize_t acc; /* Accumulator for computing cumulative sizes */
+ unsigned slab_dim; /* Rank of the fastest changing dimension for calc. slab */
+ unsigned rank; /* Dataspace's dimension rank */
+ unsigned u; /* Index variable */
+ int i; /* Index variable */
+ herr_t ret_value = SUCCEED; /* return value */
- FUNC_ENTER_STATIC_NOERR
+ FUNC_ENTER_STATIC
/* Check args */
HDassert(space && H5S_SEL_HYPERSLABS == H5S_GET_SELECT_TYPE(space));
HDassert(iter);
HDassert(space->select.sel_info.hslab->unlim_dim < 0);
- /* Initialize the number of points to iterate over */
- iter->elmt_left = space->select.num_elem;
+ /* Initialize the hyperslab iterator's rank */
iter->u.hyp.iter_rank = 0;
/* Get the rank of the dataspace */
- rank = space->extent.rank;
+ rank = iter->rank;
+
+ /* Attempt to rebuild diminfo if it is invalid and has not been confirmed
+ * to be impossible.
+ */
+ if(space->select.sel_info.hslab->diminfo_valid == H5S_DIMINFO_VALID_NO)
+ H5S__hyper_rebuild((H5S_t *)space); /* Casting away const OK -NAF */
/* Check for the special case of just one H5Sselect_hyperslab call made */
- if(space->select.sel_info.hslab->diminfo_valid) {
+ if(space->select.sel_info.hslab->diminfo_valid == H5S_DIMINFO_VALID_YES) {
/* Initialize the information needed for regular hyperslab I/O */
const H5S_hyper_dim_t *tdiminfo; /* Temporary pointer to diminfo information */
const hsize_t *mem_size; /* Temporary pointer to dataspace extent's dimension sizes */
unsigned cont_dim = 0; /* # of contiguous dimensions */
/* Set the temporary pointer to the dimension information */
- tdiminfo = space->select.sel_info.hslab->opt_diminfo;
+ tdiminfo = space->select.sel_info.hslab->diminfo.opt;
/* Set the temporary pointer to the dataspace extent's dimension sizes */
- mem_size = space->extent.size;
+ mem_size = iter->dims;
/*
* For a regular hyperslab to be contiguous up to some dimension, it
@@ -333,11 +641,9 @@ H5S__hyper_iter_init(H5S_sel_iter_t *iter, const H5S_t *space)
/* Check if the regular selection can be "flattened" */
if(cont_dim > 0) {
- hsize_t acc; /* Accumulator for "flattened" dimension's sizes */
- unsigned last_dim_flattened = 1; /* Flag to indicate that the last dimension was flattened */
+ hbool_t last_dim_flattened = TRUE; /* Flag to indicate that the last dimension was flattened */
unsigned flat_rank = rank-cont_dim; /* Number of dimensions after flattening */
unsigned curr_dim; /* Current dimension */
- int i; /* Index variable */
/* Set the iterator's rank to the contiguous dimensions */
iter->u.hyp.iter_rank = flat_rank;
@@ -351,7 +657,7 @@ H5S__hyper_iter_init(H5S_sel_iter_t *iter, const H5S_t *space)
acc *= mem_size[i];
/* Indicate that the dimension was flattened */
- last_dim_flattened = 1;
+ last_dim_flattened = TRUE;
} /* end if */
else {
if(last_dim_flattened) {
@@ -366,10 +672,10 @@ H5S__hyper_iter_init(H5S_sel_iter_t *iter, const H5S_t *space)
iter->u.hyp.diminfo[curr_dim].count = tdiminfo[i].count;
iter->u.hyp.diminfo[curr_dim].block = tdiminfo[i].block * acc;
iter->u.hyp.size[curr_dim] = mem_size[i] * acc;
- iter->u.hyp.sel_off[curr_dim] = space->select.offset[i] * (hssize_t)acc;
+ iter->u.hyp.sel_off[curr_dim] = iter->sel_off[i] * (hssize_t)acc;
/* Reset the "last dim flattened" flag to avoid flattened any further dimensions */
- last_dim_flattened = 0;
+ last_dim_flattened = FALSE;
/* Reset the "accumulator" for possible further dimension flattening */
acc = 1;
@@ -381,7 +687,7 @@ H5S__hyper_iter_init(H5S_sel_iter_t *iter, const H5S_t *space)
iter->u.hyp.diminfo[curr_dim].count = tdiminfo[i].count;
iter->u.hyp.diminfo[curr_dim].block = tdiminfo[i].block;
iter->u.hyp.size[curr_dim] = mem_size[i];
- iter->u.hyp.sel_off[curr_dim] = space->select.offset[i];
+ iter->u.hyp.sel_off[curr_dim] = iter->sel_off[i];
} /* end else */
/* Decrement "current" flattened dimension */
@@ -392,20 +698,23 @@ H5S__hyper_iter_init(H5S_sel_iter_t *iter, const H5S_t *space)
/* Initialize "flattened" iterator offset to initial location and dataspace extent and selection information to correct values */
for(u = 0; u < flat_rank; u++)
iter->u.hyp.off[u] = iter->u.hyp.diminfo[u].start;
+
+ /* Set up information for computing slab sizes */
+ slab_dim = iter->u.hyp.iter_rank - 1;
+ slab_size = iter->u.hyp.size;
} /* end if */
else {
+ /* Make local copy of the regular selection information */
+ HDcompile_assert(sizeof(iter->u.hyp.diminfo) == sizeof(space->select.sel_info.hslab->diminfo.opt));
+ H5MM_memcpy(iter->u.hyp.diminfo, tdiminfo, sizeof(iter->u.hyp.diminfo));
+
/* Initialize position to initial location */
- /* Also make local copy of the regular selection information */
- for(u = 0; u < rank; u++) {
- /* Regular selection information */
- iter->u.hyp.diminfo[u].start = tdiminfo[u].start;
- iter->u.hyp.diminfo[u].stride = tdiminfo[u].stride;
- iter->u.hyp.diminfo[u].count = tdiminfo[u].count;
- iter->u.hyp.diminfo[u].block = tdiminfo[u].block;
-
- /* Position information */
+ for(u = 0; u < rank; u++)
iter->u.hyp.off[u] = tdiminfo[u].start;
- } /* end if */
+
+ /* Set up information for computing slab sizes */
+ slab_dim = iter->rank - 1;
+ slab_size = iter->dims;
} /* end else */
/* Flag the diminfo information as valid in the iterator */
@@ -414,16 +723,30 @@ H5S__hyper_iter_init(H5S_sel_iter_t *iter, const H5S_t *space)
/* Initialize irregular region information also (for release) */
iter->u.hyp.spans = NULL;
} /* end if */
- else {
+ else { /* Initialize the information needed for non-regular hyperslab I/O */
H5S_hyper_span_info_t *spans; /* Pointer to hyperslab span info node */
-/* Initialize the information needed for non-regular hyperslab I/O */
- HDassert(space->select.sel_info.hslab->span_lst);
- /* Make a copy of the span tree to iterate over */
- iter->u.hyp.spans = H5S__hyper_copy_span(space->select.sel_info.hslab->span_lst);
-
- /* Set the nelem & pstride values according to the element size */
- H5S__hyper_span_precompute(iter->u.hyp.spans, iter->elmt_size);
+ /* If this iterator is created from an API call, by default we clone the
+ * selection now, as the dataspace could be modified or go out of scope.
+ *
+ * However, if the H5S_SEL_ITER_SHARE_WITH_DATASPACE flag is given,
+ * the selection is shared between the selection iterator and the
+ * dataspace. In this case, the application _must_not_ modify or
+ * close the dataspace that the iterator is operating on, or undefined
+ * behavior will occur.
+ */
+ if((iter->flags & H5S_SEL_ITER_API_CALL) &&
+ !(iter->flags & H5S_SEL_ITER_SHARE_WITH_DATASPACE)) {
+ /* Copy the span tree */
+ if(NULL == (iter->u.hyp.spans = H5S__hyper_copy_span(space->select.sel_info.hslab->span_lst, space->extent.rank)))
+ HGOTO_ERROR(H5E_DATASPACE, H5E_CANTCOPY, FAIL, "can't copy span tree")
+ } /* end if */
+ else {
+ /* Share the source dataspace's span tree by incrementing the reference count on it */
+ HDassert(space->select.sel_info.hslab->span_lst);
+ iter->u.hyp.spans = space->select.sel_info.hslab->span_lst;
+ iter->u.hyp.spans->count++;
+ } /* end else */
/* Initialize the starting span_info's and spans */
spans = iter->u.hyp.spans;
@@ -442,14 +765,33 @@ H5S__hyper_iter_init(H5S_sel_iter_t *iter, const H5S_t *space)
spans = spans->head->down;
} /* end for */
+ /* Set up information for computing slab sizes */
+ slab_dim = iter->rank - 1;
+ slab_size = iter->dims;
+
/* Flag the diminfo information as not valid in the iterator */
iter->u.hyp.diminfo_valid = FALSE;
} /* end else */
+ /* Compute the cumulative size of dataspace dimensions */
+ for(i = (int)slab_dim, acc = iter->elmt_size; i >= 0; i--) {
+ iter->u.hyp.slab[i] = acc;
+ acc *= slab_size[i];
+ } /* end for */
+
+ /* Initialize more information for irregular hyperslab selections */
+ if(!iter->u.hyp.diminfo_valid) {
+ /* Set the offset of the first element iterated on, in each dimension */
+ for(u = 0; u < rank; u++)
+ /* Compute the sequential element offset */
+ iter->u.hyp.loc_off[u] = ((hsize_t)((hssize_t)iter->u.hyp.off[u] + iter->sel_off[u])) * iter->u.hyp.slab[u];
+ } /* end if */
+
/* Initialize type of selection iterator */
iter->type = H5S_sel_iter_hyper;
- FUNC_LEAVE_NOAPI(SUCCEED)
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
} /* end H5S__hyper_iter_init() */
@@ -459,7 +801,7 @@ H5S__hyper_iter_init(H5S_sel_iter_t *iter, const H5S_t *space)
* Purpose: Retrieve the current coordinates of iterator for current
* selection
*
- * Return: non-negative on success, negative on failure
+ * Return: Non-negative on success, negative on failure
*
* Programmer: Quincey Koziol
* Tuesday, April 22, 2003
@@ -529,10 +871,10 @@ H5S__hyper_iter_coords(const H5S_sel_iter_t *iter, hsize_t *coords)
HDassert(v < 0);
} /* end if */
else
- HDmemcpy(coords, iter->u.hyp.off, sizeof(hsize_t) * iter->rank);
+ H5MM_memcpy(coords, iter->u.hyp.off, sizeof(hsize_t) * iter->rank);
} /* end if */
else
- HDmemcpy(coords, iter->u.hyp.off, sizeof(hsize_t) * iter->rank);
+ H5MM_memcpy(coords, iter->u.hyp.off, sizeof(hsize_t) * iter->rank);
FUNC_LEAVE_NOAPI(SUCCEED)
} /* end H5S__hyper_iter_coords() */
@@ -544,7 +886,7 @@ H5S__hyper_iter_coords(const H5S_sel_iter_t *iter, hsize_t *coords)
* Purpose: Retrieve the current block of iterator for current
* selection
*
- * Return: non-negative on success, negative on failure
+ * Return: Non-negative on success, negative on failure
*
* Programmer: Quincey Koziol
* Monday, June 2, 2003
@@ -570,20 +912,18 @@ H5S__hyper_iter_block(const H5S_sel_iter_t *iter, hsize_t *start, hsize_t *end)
/* Check for a single "regular" hyperslab */
if(iter->u.hyp.diminfo_valid) {
- /* Compute the end of the block */
+ /* Copy the start and compute the end of the block */
for(u = 0; u < iter->rank; u++) {
start[u] = iter->u.hyp.off[u];
end[u] = (start[u] + iter->u.hyp.diminfo[u].block) - 1;
} /* end for */
} /* end if */
else {
- /* Copy the start of the block */
- for(u = 0; u < iter->rank; u++)
+ /* Copy the start & end of the block */
+ for(u = 0; u < iter->rank; u++) {
start[u] = iter->u.hyp.span[u]->low;
-
- /* Copy the end of the block */
- for(u = 0; u < iter->rank; u++)
end[u] = iter->u.hyp.span[u]->high;
+ } /* end for */
} /* end else */
FUNC_LEAVE_NOAPI(SUCCEED)
@@ -595,7 +935,7 @@ H5S__hyper_iter_block(const H5S_sel_iter_t *iter, hsize_t *start, hsize_t *end)
*
* Purpose: Return number of elements left to process in iterator
*
- * Return: non-negative number of elements on success, zero on failure
+ * Return: Non-negative number of elements on success, zero on failure
*
* Programmer: Quincey Koziol
* Tuesday, June 16, 1998
@@ -631,7 +971,7 @@ H5S__hyper_iter_nelmts(const H5S_sel_iter_t *iter)
EXAMPLES
REVISION LOG
--------------------------------------------------------------------------*/
-static htri_t
+static H5_ATTR_PURE htri_t
H5S__hyper_iter_has_next_block(const H5S_sel_iter_t *iter)
{
unsigned u; /* Local index variable */
@@ -689,7 +1029,7 @@ H5S__hyper_iter_next(H5S_sel_iter_t *iter, size_t nelem)
{
unsigned ndims; /* Number of dimensions of dataset */
int fast_dim; /* Rank of the fastest changing dimension for the dataspace */
- unsigned i; /* Counters */
+ unsigned u; /* Counters */
FUNC_ENTER_STATIC_NOERR
@@ -697,19 +1037,17 @@ H5S__hyper_iter_next(H5S_sel_iter_t *iter, size_t nelem)
/* (i.e. a regular hyperslab selection */
if(iter->u.hyp.diminfo_valid) {
const H5S_hyper_dim_t *tdiminfo; /* Temporary pointer to diminfo information */
- hsize_t iter_offset[H5O_LAYOUT_NDIMS];
- hsize_t iter_count[H5O_LAYOUT_NDIMS];
+ hsize_t iter_offset[H5S_MAX_RANK];
+ hsize_t iter_count[H5S_MAX_RANK];
int temp_dim; /* Temporary rank holder */
/* Check if this is a "flattened" regular hyperslab selection */
- if(iter->u.hyp.iter_rank != 0 && iter->u.hyp.iter_rank < iter->rank) {
+ if(iter->u.hyp.iter_rank != 0 && iter->u.hyp.iter_rank < iter->rank)
/* Set the aliases for the dimension rank */
ndims = iter->u.hyp.iter_rank;
- } /* end if */
- else {
+ else
/* Set the aliases for the dimension rank */
ndims = iter->rank;
- } /* end else */
/* Set the fastest dimension rank */
fast_dim = (int)ndims - 1;
@@ -718,14 +1056,14 @@ H5S__hyper_iter_next(H5S_sel_iter_t *iter, size_t nelem)
tdiminfo = iter->u.hyp.diminfo;
/* Calculate the offset and block count for each dimension */
- for(i = 0; i < ndims; i++) {
- if(tdiminfo[i].count == 1) {
- iter_offset[i] = iter->u.hyp.off[i] - tdiminfo[i].start;
- iter_count[i] = 0;
+ for(u = 0; u < ndims; u++) {
+ if(tdiminfo[u].count == 1) {
+ iter_offset[u] = iter->u.hyp.off[u] - tdiminfo[u].start;
+ iter_count[u] = 0;
} /* end if */
else {
- iter_offset[i] = (iter->u.hyp.off[i] - tdiminfo[i].start) % tdiminfo[i].stride;
- iter_count[i] = (iter->u.hyp.off[i] - tdiminfo[i].start) / tdiminfo[i].stride;
+ iter_offset[u] = (iter->u.hyp.off[u] - tdiminfo[u].start) % tdiminfo[u].stride;
+ iter_count[u] = (iter->u.hyp.off[u] - tdiminfo[u].start) / tdiminfo[u].stride;
} /* end else */
} /* end for */
@@ -750,10 +1088,9 @@ H5S__hyper_iter_next(H5S_sel_iter_t *iter, size_t nelem)
/* Decrement the number of elements advanced */
nelem -= actual_elem;
} /* end if */
- else {
+ else
/* Move to the next row in the current dimension */
iter_offset[temp_dim]++;
- } /* end else */
/* If this block is still in the range of blocks to output for the dimension, break out of loop */
if(iter_offset[temp_dim] < tdiminfo[temp_dim].block)
@@ -776,8 +1113,8 @@ H5S__hyper_iter_next(H5S_sel_iter_t *iter, size_t nelem)
} /* end while */
/* Translate current iter_offset and iter_count into iterator position */
- for(i = 0; i < ndims; i++)
- iter->u.hyp.off[i] = tdiminfo[i].start + (tdiminfo[i].stride * iter_count[i]) + iter_offset[i];
+ for(u = 0; u < ndims; u++)
+ iter->u.hyp.off[u] = tdiminfo[u].start + (tdiminfo[u].stride * iter_count[u]) + iter_offset[u];
} /* end if */
/* Must be an irregular hyperslab selection */
else {
@@ -821,15 +1158,13 @@ H5S__hyper_iter_next(H5S_sel_iter_t *iter, size_t nelem)
/* Decrement the number of elements advanced */
nelem -= actual_elem;
} /* end if */
- else {
+ else
/* Move to the next row in the current dimension */
abs_arr[curr_dim]++;
- } /* end else */
/* Check if we are still within the span */
- if(abs_arr[curr_dim] <= curr_span->high) {
+ if(abs_arr[curr_dim] <= curr_span->high)
break;
- } /* end if */
/* If we walked off that span, advance to the next span */
else {
/* Advance span in this dimension */
@@ -845,10 +1180,9 @@ H5S__hyper_iter_next(H5S_sel_iter_t *iter, size_t nelem)
break;
} /* end if */
- else {
+ else
/* If we finished the span list in this dimension, decrement the dimension worked on and loop again */
curr_dim--;
- } /* end else */
} /* end else */
} /* end while */
@@ -907,22 +1241,20 @@ H5S__hyper_iter_next_block(H5S_sel_iter_t *iter)
FUNC_ENTER_STATIC_NOERR
/* Check for the special case of just one H5Sselect_hyperslab call made */
- /* (i.e. a regular hyperslab selection */
+ /* (i.e. a regular hyperslab selection) */
if(iter->u.hyp.diminfo_valid) {
const H5S_hyper_dim_t *tdiminfo; /* Temporary pointer to diminfo information */
- hsize_t iter_offset[H5O_LAYOUT_NDIMS];
- hsize_t iter_count[H5O_LAYOUT_NDIMS];
+ hsize_t iter_offset[H5S_MAX_RANK];
+ hsize_t iter_count[H5S_MAX_RANK];
int temp_dim; /* Temporary rank holder */
/* Check if this is a "flattened" regular hyperslab selection */
- if(iter->u.hyp.iter_rank != 0 && iter->u.hyp.iter_rank < iter->rank) {
+ if(iter->u.hyp.iter_rank != 0 && iter->u.hyp.iter_rank < iter->rank)
/* Set the aliases for the dimension rank */
ndims = iter->u.hyp.iter_rank;
- } /* end if */
- else {
+ else
/* Set the aliases for the dimension rank */
ndims = iter->rank;
- } /* end else */
/* Set the fastest dimension rank */
fast_dim = (int)ndims - 1;
@@ -945,14 +1277,12 @@ H5S__hyper_iter_next_block(H5S_sel_iter_t *iter)
/* Advance one block */
temp_dim = fast_dim; /* Start with the fastest changing dimension */
while(temp_dim >= 0) {
- if(temp_dim == fast_dim) {
+ if(temp_dim == fast_dim)
/* Move iterator over current block */
iter_offset[temp_dim] += tdiminfo[temp_dim].block;
- } /* end if */
- else {
+ else
/* Move to the next row in the current dimension */
iter_offset[temp_dim]++;
- } /* end else */
/* If this block is still in the range of blocks to output for the dimension, break out of loop */
if(iter_offset[temp_dim] < tdiminfo[temp_dim].block)
@@ -1001,19 +1331,16 @@ H5S__hyper_iter_next_block(H5S_sel_iter_t *iter)
curr_span = ispan[curr_dim];
/* Increment absolute position */
- if(curr_dim == fast_dim) {
+ if(curr_dim == fast_dim)
/* Move the iterator over rest of element in span */
abs_arr[curr_dim] = curr_span->high + 1;
- } /* end if */
- else {
+ else
/* Move to the next row in the current dimension */
abs_arr[curr_dim]++;
- } /* end else */
/* Check if we are still within the span */
- if(abs_arr[curr_dim] <= curr_span->high) {
+ if(abs_arr[curr_dim] <= curr_span->high)
break;
- } /* end if */
/* If we walked off that span, advance to the next span */
else {
/* Advance span in this dimension */
@@ -1029,10 +1356,9 @@ H5S__hyper_iter_next_block(H5S_sel_iter_t *iter)
break;
} /* end if */
- else {
+ else
/* If we finished the span list in this dimension, decrement the dimension worked on and loop again */
curr_dim--;
- } /* end else */
} /* end else */
} /* end while */
@@ -1063,231 +1389,1467 @@ H5S__hyper_iter_next_block(H5S_sel_iter_t *iter)
} /* end else */
FUNC_LEAVE_NOAPI(SUCCEED)
-} /* end H5S__hyper_iter_next() */
+} /* end H5S__hyper_iter_next_block() */
/*--------------------------------------------------------------------------
NAME
- H5S__hyper_iter_release
+ H5S__hyper_iter_get_seq_list_gen
PURPOSE
- Release hyperslab selection iterator information for a dataspace
+ Create a list of offsets & lengths for a selection
USAGE
- herr_t H5S__hyper_iter_release(iter)
- H5S_sel_iter_t *iter; IN: Pointer to selection iterator
+ herr_t H5S__hyper_iter_get_seq_list_gen(iter,maxseq,maxelem,nseq,nelem,off,len)
+ H5S_sel_iter_t *iter; IN/OUT: Selection iterator describing last
+ position of interest in selection.
+ size_t maxseq; IN: Maximum number of sequences to generate
+ size_t maxelem; IN: Maximum number of elements to include in the
+ generated sequences
+ size_t *nseq; OUT: Actual number of sequences generated
+ size_t *nelem; OUT: Actual number of elements in sequences generated
+ hsize_t *off; OUT: Array of offsets
+ size_t *len; OUT: Array of lengths
RETURNS
- Non-negative on success/Negative on failure
+ Non-negative on success/Negative on failure.
DESCRIPTION
- Releases all information for a dataspace hyperslab selection iterator
+ Use the selection in the dataspace to generate a list of byte offsets and
+ lengths for the region(s) selected. Start/Restart from the position in the
+ ITER parameter. The number of sequences generated is limited by the MAXSEQ
+ parameter and the number of sequences actually generated is stored in the
+ NSEQ parameter.
GLOBAL VARIABLES
COMMENTS, BUGS, ASSUMPTIONS
EXAMPLES
REVISION LOG
--------------------------------------------------------------------------*/
static herr_t
-H5S__hyper_iter_release(H5S_sel_iter_t *iter)
+H5S__hyper_iter_get_seq_list_gen(H5S_sel_iter_t *iter, size_t maxseq, size_t maxelem,
+ size_t *nseq, size_t *nelem, hsize_t *off, size_t *len)
{
+ H5S_hyper_span_t *curr_span; /* Current hyperslab span node */
+ H5S_hyper_span_t **ispan; /* Iterator's hyperslab span nodes */
+ hsize_t *slab; /* Cumulative size of each dimension in bytes */
+ hsize_t loc_off; /* Byte offset in the dataspace */
+ hsize_t last_span_end = 0; /* The offset of the end of the last span */
+ hsize_t *abs_arr; /* Absolute hyperslab span position, in elements */
+ hsize_t *loc_arr; /* Byte offset of hyperslab span position within buffer */
+ const hssize_t *sel_off; /* Offset within the dataspace extent */
+ size_t span_elmts = 0; /* Number of elements to actually use for this span */
+ size_t span_size = 0; /* Number of bytes in current span to actually process */
+ size_t io_left; /* Initial number of elements to process */
+ size_t io_elmts_left; /* Number of elements left to process */
+ size_t io_used; /* Number of elements processed */
+ size_t curr_seq = 0; /* Number of sequence/offsets stored in the arrays */
+ size_t elem_size; /* Size of each element iterating over */
+ unsigned ndims; /* Number of dimensions of dataset */
+ unsigned fast_dim; /* Rank of the fastest changing dimension for the dataspace */
+ int curr_dim; /* Current dimension being operated on */
+ unsigned u; /* Index variable */
+
FUNC_ENTER_STATIC_NOERR
/* Check args */
HDassert(iter);
+ HDassert(maxseq > 0);
+ HDassert(maxelem > 0);
+ HDassert(nseq);
+ HDassert(nelem);
+ HDassert(off);
+ HDassert(len);
-/* Release the information needed for non-regular hyperslab I/O */
- /* Free the copy of the selections span tree */
- if(iter->u.hyp.spans != NULL)
- H5S__hyper_free_span_info(iter->u.hyp.spans);
+ /* Set the rank of the fastest changing dimension */
+ ndims = iter->rank;
+ fast_dim = (ndims - 1);
+
+ /* Get the pointers to the current span info and span nodes */
+ curr_span = iter->u.hyp.span[fast_dim];
+ abs_arr = iter->u.hyp.off;
+ loc_arr = iter->u.hyp.loc_off;
+ slab = iter->u.hyp.slab;
+ sel_off = iter->sel_off;
+ ispan = iter->u.hyp.span;
+ elem_size = iter->elmt_size;
+
+ /* Set the amount of elements to perform I/O on, etc. */
+ H5_CHECK_OVERFLOW(iter->elmt_left, hsize_t, size_t);
+ io_elmts_left = io_left = MIN(maxelem, (size_t)iter->elmt_left);
+
+ /* Set the offset of the first element iterated on */
+ for(u = 0, loc_off = 0; u < ndims; u++)
+ loc_off += loc_arr[u];
+
+ /* Take care of any partial spans leftover from previous I/Os */
+ if(abs_arr[fast_dim] != curr_span->low) {
+ /* Finish the span in the fastest changing dimension */
+
+ /* Compute the number of elements to attempt in this span */
+ H5_CHECKED_ASSIGN(span_elmts, size_t, ((curr_span->high - abs_arr[fast_dim]) + 1), hsize_t);
+
+ /* Check number of elements against upper bounds allowed */
+ if(span_elmts > io_elmts_left)
+ span_elmts = io_elmts_left;
+
+ /* Set the span_size, in bytes */
+ span_size = span_elmts * elem_size;
+
+ /* Add the partial span to the list of sequences */
+ off[curr_seq] = loc_off;
+ len[curr_seq] = span_size;
+
+ /* Increment sequence count */
+ curr_seq++;
+
+ /* Set the location of the last span's end */
+ last_span_end = loc_off + span_size;
+
+ /* Decrement I/O left to perform */
+ io_elmts_left -= span_elmts;
+
+ /* Check if we are done */
+ if(io_elmts_left > 0) {
+ /* Move to next span in fastest changing dimension */
+ curr_span = curr_span->next;
+
+ if(NULL != curr_span) {
+ /* Move location offset of destination */
+ loc_off += (curr_span->low - abs_arr[fast_dim]) * elem_size;
+
+ /* Move iterator for fastest changing dimension */
+ abs_arr[fast_dim] = curr_span->low;
+ loc_arr[fast_dim] = ((hsize_t)((hssize_t)curr_span->low + sel_off[fast_dim])) * slab[fast_dim];
+ ispan[fast_dim] = curr_span;
+ } /* end if */
+ } /* end if */
+ else {
+ /* Advance the hyperslab iterator */
+ abs_arr[fast_dim] += span_elmts;
+
+ /* Check if we are still within the span */
+ if(abs_arr[fast_dim] <= curr_span->high) {
+ /* Sanity check */
+ HDassert(ispan[fast_dim] == curr_span);
+
+ /* Update byte offset */
+ loc_arr[fast_dim] += span_size;
+ } /* end if */
+ /* If we walked off that span, advance to the next span */
+ else {
+ /* Advance span in this dimension */
+ curr_span = curr_span->next;
+
+ /* Check if we have a valid span in this dimension still */
+ if(NULL != curr_span) {
+ /* Reset absolute position */
+ abs_arr[fast_dim] = curr_span->low;
+
+ /* Update location offset */
+ loc_arr[fast_dim] = ((hsize_t)((hssize_t)curr_span->low + sel_off[fast_dim])) * slab[fast_dim];
+
+ /* Reset the span in the current dimension */
+ ispan[fast_dim] = curr_span;
+ } /* end if */
+ } /* end else */
+ } /* end else */
+
+ /* Adjust iterator pointers */
+
+ if(NULL == curr_span) {
+/* Same as code in main loop */
+ /* Start at the next fastest dim */
+ curr_dim = (int)(fast_dim - 1);
+
+ /* Work back up through the dimensions */
+ while(curr_dim >= 0) {
+ /* Reset the current span */
+ curr_span = ispan[curr_dim];
+
+ /* Increment absolute position */
+ abs_arr[curr_dim]++;
+
+ /* Check if we are still within the span */
+ if(abs_arr[curr_dim] <= curr_span->high) {
+ /* Update location offset */
+ loc_arr[curr_dim] += slab[curr_dim];
+
+ break;
+ } /* end if */
+ /* If we walked off that span, advance to the next span */
+ else {
+ /* Advance span in this dimension */
+ curr_span = curr_span->next;
+
+ /* Check if we have a valid span in this dimension still */
+ if(NULL != curr_span) {
+ /* Reset the span in the current dimension */
+ ispan[curr_dim] = curr_span;
+
+ /* Reset absolute position */
+ abs_arr[curr_dim] = curr_span->low;
+
+ /* Update byte location */
+ loc_arr[curr_dim] = ((hsize_t)((hssize_t)curr_span->low + sel_off[curr_dim])) * slab[curr_dim];
+
+ break;
+ } /* end if */
+ else
+ /* If we finished the span list in this dimension, decrement the dimension worked on and loop again */
+ curr_dim--;
+ } /* end else */
+ } /* end while */
+
+ /* Check if we have more spans in the tree */
+ if(curr_dim >= 0) {
+ /* Walk back down the iterator positions, resetting them */
+ while((unsigned)curr_dim < fast_dim) {
+ HDassert(curr_span);
+ HDassert(curr_span->down);
+ HDassert(curr_span->down->head);
+
+ /* Increment current dimension */
+ curr_dim++;
+
+ /* Set the new span_info & span for this dimension */
+ ispan[curr_dim] = curr_span->down->head;
+
+ /* Advance span down the tree */
+ curr_span = curr_span->down->head;
+
+ /* Reset the absolute offset for the dim */
+ abs_arr[curr_dim] = curr_span->low;
+
+ /* Update the location offset */
+ loc_arr[curr_dim] = ((hsize_t)((hssize_t)curr_span->low + sel_off[curr_dim])) * slab[curr_dim];
+ } /* end while */
+
+ /* Verify that the curr_span points to the fastest dim */
+ HDassert(curr_span == ispan[fast_dim]);
+
+ /* Reset the buffer offset */
+ for(u = 0, loc_off = 0; u < ndims; u++)
+ loc_off += loc_arr[u];
+ } /* end else */
+ else
+ /* We had better be done with I/O or bad things are going to happen... */
+ HDassert(io_elmts_left == 0);
+ } /* end if */
+ } /* end if */
+
+ /* Perform the I/O on the elements, based on the position of the iterator */
+ while(io_elmts_left > 0 && curr_seq < maxseq) {
+ H5S_hyper_span_t *prev_span; /* Previous hyperslab span node */
+
+ /* Sanity check */
+ HDassert(curr_span);
+
+ /* Set to current span, so the first adjustment to loc_off is 0 */
+ prev_span = curr_span;
+
+ /* Loop over all the spans in the fastest changing dimension */
+ while(curr_span != NULL) {
+ hsize_t nelmts; /* # of elements covered by current span */
+
+ /* Move location offset of current span */
+ loc_off += (curr_span->low - prev_span->low) * elem_size;
+
+ /* Compute the number of elements to attempt in this span */
+ nelmts = (curr_span->high - curr_span->low) + 1;
+ H5_CHECKED_ASSIGN(span_elmts, size_t, nelmts, hsize_t);
+
+ /* Check number of elements against upper bounds allowed */
+ if(span_elmts >= io_elmts_left) {
+ /* Trim the number of elements to output */
+ span_elmts = io_elmts_left;
+ span_size = span_elmts * elem_size;
+ io_elmts_left = 0;
+
+/* COMMON */
+ /* Store the I/O information for the span */
+
+ /* Check if this is appending onto previous sequence */
+ if(curr_seq > 0 && last_span_end == loc_off)
+ len[curr_seq - 1] += span_size;
+ else {
+ off[curr_seq] = loc_off;
+ len[curr_seq] = span_size;
+
+ /* Increment the number of sequences in arrays */
+ curr_seq++;
+ } /* end else */
+/* end COMMON */
+
+ /* Break out now, we are finished with I/O */
+ break;
+ } /* end if */
+ else {
+ /* Decrement I/O left to perform */
+ span_size = span_elmts * elem_size;
+ io_elmts_left -= span_elmts;
+
+/* COMMON */
+ /* Store the I/O information for the span */
+
+ /* Check if this is appending onto previous sequence */
+ if(curr_seq > 0 && last_span_end == loc_off)
+ len[curr_seq - 1] += span_size;
+ else {
+ off[curr_seq] = loc_off;
+ len[curr_seq] = span_size;
+
+ /* Increment the number of sequences in arrays */
+ curr_seq++;
+ } /* end else */
+/* end COMMON */
+
+ /* If the sequence & offset arrays are full, do what? */
+ if(curr_seq >= maxseq)
+ /* Break out now, we are finished with sequences */
+ break;
+ } /* end else */
+
+ /* Set the location of the last span's end */
+ last_span_end = loc_off + span_size;
+
+ /* Move to next span in fastest changing dimension */
+ prev_span = curr_span;
+ curr_span = curr_span->next;
+ } /* end while */
+
+ /* Check if we are done */
+ if(io_elmts_left == 0 || curr_seq >= maxseq) {
+ /* Sanity checks */
+ HDassert(curr_span);
+
+ /* Update absolute position */
+ abs_arr[fast_dim] = curr_span->low + span_elmts;
+
+ /* Check if we are still within the span */
+ if(abs_arr[fast_dim] <= curr_span->high) {
+ /* Reset the span for the fast dimension */
+ ispan[fast_dim] = curr_span;
+
+ /* Update location offset */
+ loc_arr[fast_dim] = ((hsize_t)((hssize_t)curr_span->low + (hssize_t)span_elmts + sel_off[fast_dim])) * slab[fast_dim];
+
+ break;
+ } /* end if */
+ /* If we walked off that span, advance to the next span */
+ else {
+ /* Advance span in this dimension */
+ curr_span = curr_span->next;
+
+ /* Check if we have a valid span in this dimension still */
+ if(curr_span != NULL) {
+ /* Reset absolute position */
+ abs_arr[fast_dim] = curr_span->low;
+ loc_arr[fast_dim] = ((hsize_t)((hssize_t)curr_span->low + sel_off[fast_dim])) * slab[fast_dim];
+ ispan[fast_dim] = curr_span;
+
+ break;
+ } /* end if */
+ } /* end else */
+ } /* end if */
+
+ /* Adjust iterator pointers */
+
+ /* Start at the next fastest dim */
+ curr_dim = (int)(fast_dim - 1);
+
+ /* Work back up through the dimensions */
+ while(curr_dim >= 0) {
+ /* Reset the current span */
+ curr_span = ispan[curr_dim];
+
+ /* Increment absolute position */
+ abs_arr[curr_dim]++;
+
+ /* Check if we are still within the span */
+ if(abs_arr[curr_dim] <= curr_span->high) {
+ /* Update location offset */
+ loc_arr[curr_dim] += slab[curr_dim];
+
+ break;
+ } /* end if */
+ /* If we walked off that span, advance to the next span */
+ else {
+ /* Advance span in this dimension */
+ curr_span = curr_span->next;
+
+ /* Check if we have a valid span in this dimension still */
+ if(curr_span != NULL) {
+ /* Reset the span in the current dimension */
+ ispan[curr_dim] = curr_span;
+
+ /* Reset absolute position */
+ abs_arr[curr_dim] = curr_span->low;
+
+ /* Update location offset */
+ loc_arr[curr_dim] = ((hsize_t)((hssize_t)curr_span->low + sel_off[curr_dim])) * slab[curr_dim];
+
+ break;
+ } /* end if */
+ else
+ /* If we finished the span list in this dimension, decrement the dimension worked on and loop again */
+ curr_dim--;
+ } /* end else */
+ } /* end while */
+
+ /* Check if we are finished with the spans in the tree */
+ if(curr_dim < 0) {
+ /* We had better be done with I/O or bad things are going to happen... */
+ HDassert(io_elmts_left == 0);
+ break;
+ } /* end if */
+ else {
+ /* Walk back down the iterator positions, resetting them */
+ while((unsigned)curr_dim < fast_dim) {
+ HDassert(curr_span);
+ HDassert(curr_span->down);
+ HDassert(curr_span->down->head);
+
+ /* Increment current dimension to the next dimension down */
+ curr_dim++;
+
+ /* Set the new span for the next dimension down */
+ ispan[curr_dim] = curr_span->down->head;
+
+ /* Advance span down the tree */
+ curr_span = curr_span->down->head;
+
+ /* Reset the absolute offset for the dim */
+ abs_arr[curr_dim] = curr_span->low;
+
+ /* Update location offset */
+ loc_arr[curr_dim] = ((hsize_t)((hssize_t)curr_span->low + sel_off[curr_dim])) * slab[curr_dim];
+ } /* end while */
+
+ /* Verify that the curr_span points to the fastest dim */
+ HDassert(curr_span == ispan[fast_dim]);
+ } /* end else */
+
+ /* Reset the buffer offset */
+ for(u = 0, loc_off = 0; u < ndims; u++)
+ loc_off += loc_arr[u];
+ } /* end while */
+
+ /* Decrement number of elements left in iterator */
+ io_used = io_left - io_elmts_left;
+ iter->elmt_left -= io_used;
+
+ /* Set the number of sequences generated */
+ *nseq = curr_seq;
+
+ /* Set the number of elements used */
+ *nelem = io_used;
FUNC_LEAVE_NOAPI(SUCCEED)
-} /* end H5S__hyper_iter_release() */
+} /* end H5S__hyper_iter_get_seq_list_gen() */
/*--------------------------------------------------------------------------
NAME
- H5S__hyper_new_span
+ H5S__hyper_iter_get_seq_list_opt
PURPOSE
- Make a new hyperslab span node
+ Create a list of offsets & lengths for a selection
USAGE
- H5S_hyper_span_t *H5S__hyper_new_span(low, high, down, next)
- hsize_t low, high; IN: Low and high bounds for new span node
- H5S_hyper_span_info_t *down; IN: Down span tree for new node
- H5S_hyper_span_t *next; IN: Next span for new node
+ herr_t H5S__hyper_iter_get_seq_list_opt(iter,maxseq,maxelem,nseq,nelem,off,len)
+ H5S_sel_iter_t *iter; IN/OUT: Selection iterator describing last
+ position of interest in selection.
+ size_t maxseq; IN: Maximum number of sequences to generate
+ size_t maxelem; IN: Maximum number of elements to include in the
+ generated sequences
+ size_t *nseq; OUT: Actual number of sequences generated
+ size_t *nelem; OUT: Actual number of elements in sequences generated
+ hsize_t *off; OUT: Array of offsets
+ size_t *len; OUT: Array of lengths
RETURNS
- Pointer to next span node on success, NULL on failure
+ Non-negative on success/Negative on failure.
DESCRIPTION
- Allocate and initialize a new hyperslab span node, filling in the low &
- high bounds, the down span and next span pointers also. Increment the
- reference count of the 'down span' if applicable.
+ Use the selection in the dataspace to generate a list of byte offsets and
+ lengths for the region(s) selected. Start/Restart from the position in the
+ ITER parameter. The number of sequences generated is limited by the MAXSEQ
+ parameter and the number of sequences actually generated is stored in the
+ NSEQ parameter.
GLOBAL VARIABLES
COMMENTS, BUGS, ASSUMPTIONS
EXAMPLES
REVISION LOG
--------------------------------------------------------------------------*/
-static H5S_hyper_span_t *
-H5S__hyper_new_span(hsize_t low, hsize_t high, H5S_hyper_span_info_t *down, H5S_hyper_span_t *next)
+static herr_t
+H5S__hyper_iter_get_seq_list_opt(H5S_sel_iter_t *iter, size_t maxseq, size_t maxelem,
+ size_t *nseq, size_t *nelem, hsize_t *off, size_t *len)
{
- H5S_hyper_span_t *ret_value = NULL; /* Return value */
+ hsize_t *mem_size; /* Size of the source buffer */
+ hsize_t *slab; /* Hyperslab size */
+ const hssize_t *sel_off; /* Selection offset in dataspace */
+ hsize_t offset[H5S_MAX_RANK]; /* Coordinate offset in dataspace */
+ hsize_t tmp_count[H5S_MAX_RANK]; /* Temporary block count */
+ hsize_t tmp_block[H5S_MAX_RANK]; /* Temporary block offset */
+ hsize_t wrap[H5S_MAX_RANK]; /* Bytes to wrap around at the end of a row */
+ hsize_t skip[H5S_MAX_RANK]; /* Bytes to skip between blocks */
+ const H5S_hyper_dim_t *tdiminfo; /* Temporary pointer to diminfo information */
+ hsize_t fast_dim_start, /* Local copies of fastest changing dimension info */
+ fast_dim_stride,
+ fast_dim_block,
+ fast_dim_offset;
+ size_t fast_dim_buf_off; /* Local copy of amount to move fastest dimension buffer offset */
+ size_t fast_dim_count; /* Number of blocks left in fastest changing dimension */
+ size_t tot_blk_count; /* Total number of blocks left to output */
+ size_t act_blk_count; /* Actual number of blocks to output */
+ size_t total_rows; /* Total number of entire rows to output */
+ size_t curr_rows; /* Current number of entire rows to output */
+ unsigned fast_dim; /* Rank of the fastest changing dimension for the dataspace */
+ unsigned ndims; /* Number of dimensions of dataset */
+ int temp_dim; /* Temporary rank holder */
+ hsize_t loc; /* Coordinate offset */
+ size_t curr_seq = 0; /* Current sequence being operated on */
+ size_t actual_elem; /* The actual number of elements to count */
+ size_t actual_bytes;/* The actual number of bytes to copy */
+ size_t io_left; /* The number of elements left in I/O operation */
+ size_t start_io_left; /* The initial number of elements left in I/O operation */
+ size_t elem_size; /* Size of each element iterating over */
+ unsigned u; /* Local index variable */
- FUNC_ENTER_STATIC
+ FUNC_ENTER_STATIC_NOERR
- /* Allocate a new span node */
- if(NULL == (ret_value = H5FL_MALLOC(H5S_hyper_span_t)))
- HGOTO_ERROR(H5E_DATASPACE, H5E_CANTALLOC, NULL, "can't allocate hyperslab span")
+ /* Check args */
+ HDassert(iter);
+ HDassert(maxseq > 0);
+ HDassert(maxelem > 0);
+ HDassert(nseq);
+ HDassert(nelem);
+ HDassert(off);
+ HDassert(len);
- /* Copy the span's basic information */
- ret_value->low = low;
- ret_value->high = high;
- ret_value->nelem = (high - low) + 1;
- ret_value->pstride = 0;
- ret_value->down = down;
- ret_value->next = next;
+ /* Set the local copy of the diminfo pointer */
+ tdiminfo = iter->u.hyp.diminfo;
- /* Increment the reference count of the 'down span' if there is one */
- if(ret_value->down)
- ret_value->down->count++;
+ /* Check if this is a "flattened" regular hyperslab selection */
+ if(iter->u.hyp.iter_rank != 0 && iter->u.hyp.iter_rank < iter->rank) {
+ /* Set the aliases for a few important dimension ranks */
+ ndims = iter->u.hyp.iter_rank;
-done:
- FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5S__hyper_new_span() */
+ /* Set the local copy of the selection offset */
+ sel_off = iter->u.hyp.sel_off;
+
+ /* Set up the pointer to the size of the memory dataspace */
+ mem_size = iter->u.hyp.size;
+ } /* end if */
+ else {
+ /* Set the aliases for a few important dimension ranks */
+ ndims = iter->rank;
+
+ /* Set the local copy of the selection offset */
+ sel_off = iter->sel_off;
+
+ /* Set up the pointer to the size of the memory dataspace */
+ mem_size = iter->dims;
+ } /* end else */
+
+ /* Set up some local variables */
+ fast_dim = ndims - 1;
+ elem_size = iter->elmt_size;
+ slab = iter->u.hyp.slab;
+
+ /* Calculate the number of elements to sequence through */
+ H5_CHECK_OVERFLOW(iter->elmt_left, hsize_t, size_t);
+ io_left = MIN((size_t)iter->elmt_left, maxelem);
+
+ /* Sanity check that there aren't any "remainder" sequences in process */
+ HDassert(!((iter->u.hyp.off[fast_dim] - tdiminfo[fast_dim].start) % tdiminfo[fast_dim].stride != 0 ||
+ ((iter->u.hyp.off[fast_dim] != tdiminfo[fast_dim].start) && tdiminfo[fast_dim].count == 1)));
+
+ /* We've cleared the "remainder" of the previous fastest dimension
+ * sequence before calling this routine, so we must be at the beginning of
+ * a sequence. Use the fancy algorithm to compute the offsets and run
+ * through as many as possible, until the buffer fills up.
+ */
+
+ /* Keep the number of elements we started with */
+ start_io_left = io_left;
+
+ /* Compute the arrays to perform I/O on */
+
+ /* Copy the location of the point to get */
+ /* (Add in the selection offset) */
+ for(u = 0; u < ndims; u++)
+ offset[u] = (hsize_t)((hssize_t)iter->u.hyp.off[u] + sel_off[u]);
+
+ /* Compute the current "counts" for this location */
+ for(u = 0; u < ndims; u++) {
+ if(tdiminfo[u].count == 1) {
+ tmp_count[u] = 0;
+ tmp_block[u] = iter->u.hyp.off[u] - tdiminfo[u].start;
+ } /* end if */
+ else {
+ tmp_count[u] = (iter->u.hyp.off[u] - tdiminfo[u].start) / tdiminfo[u].stride;
+ tmp_block[u] = (iter->u.hyp.off[u] - tdiminfo[u].start) % tdiminfo[u].stride;
+ } /* end else */
+ } /* end for */
+
+ /* Compute the initial buffer offset */
+ for(u = 0, loc = 0; u < ndims; u++)
+ loc += offset[u] * slab[u];
+
+ /* Set the number of elements to write each time */
+ H5_CHECKED_ASSIGN(actual_elem, size_t, tdiminfo[fast_dim].block, hsize_t);
+
+ /* Set the number of actual bytes */
+ actual_bytes = actual_elem * elem_size;
+
+ /* Set local copies of information for the fastest changing dimension */
+ fast_dim_start = tdiminfo[fast_dim].start;
+ fast_dim_stride = tdiminfo[fast_dim].stride;
+ fast_dim_block = tdiminfo[fast_dim].block;
+ H5_CHECKED_ASSIGN(fast_dim_buf_off, size_t, slab[fast_dim] * fast_dim_stride, hsize_t);
+ fast_dim_offset = (hsize_t)((hssize_t)fast_dim_start + sel_off[fast_dim]);
+
+ /* Compute the number of blocks which would fit into the buffer */
+ H5_CHECK_OVERFLOW(io_left / fast_dim_block, hsize_t, size_t);
+ tot_blk_count = (size_t)(io_left / fast_dim_block);
+
+ /* Don't go over the maximum number of sequences allowed */
+ tot_blk_count = MIN(tot_blk_count, (maxseq - curr_seq));
+
+ /* Compute the amount to wrap at the end of each row */
+ for(u = 0; u < ndims; u++)
+ wrap[u] = (mem_size[u] - (tdiminfo[u].stride * tdiminfo[u].count)) * slab[u];
+
+ /* Compute the amount to skip between blocks */
+ for(u = 0; u < ndims; u++)
+ skip[u] = (tdiminfo[u].stride - tdiminfo[u].block) * slab[u];
+
+ /* Check if there is a partial row left (with full blocks) */
+ if(tmp_count[fast_dim] > 0) {
+ /* Get number of blocks in fastest dimension */
+ H5_CHECKED_ASSIGN(fast_dim_count, size_t, tdiminfo[fast_dim].count - tmp_count[fast_dim], hsize_t);
+
+ /* Make certain this entire row will fit into buffer */
+ fast_dim_count = MIN(fast_dim_count, tot_blk_count);
+
+ /* Number of blocks to sequence over */
+ act_blk_count = fast_dim_count;
+
+ /* Loop over all the blocks in the fastest changing dimension */
+ while(fast_dim_count > 0) {
+ /* Store the sequence information */
+ off[curr_seq] = loc;
+ len[curr_seq] = actual_bytes;
+
+ /* Increment sequence count */
+ curr_seq++;
+
+ /* Increment information to reflect block just processed */
+ loc += fast_dim_buf_off;
+
+ /* Decrement number of blocks */
+ fast_dim_count--;
+ } /* end while */
+
+ /* Decrement number of elements left */
+ io_left -= actual_elem * act_blk_count;
+
+ /* Decrement number of blocks left */
+ tot_blk_count -= act_blk_count;
+
+ /* Increment information to reflect block just processed */
+ tmp_count[fast_dim] += act_blk_count;
+
+ /* Check if we finished the entire row of blocks */
+ if(tmp_count[fast_dim] >= tdiminfo[fast_dim].count) {
+ /* Increment offset in destination buffer */
+ loc += wrap[fast_dim];
+
+ /* Increment information to reflect block just processed */
+ offset[fast_dim] = fast_dim_offset; /* reset the offset in the fastest dimension */
+ tmp_count[fast_dim] = 0;
+
+ /* Increment the offset and count for the other dimensions */
+ temp_dim = (int)fast_dim - 1;
+ while(temp_dim >= 0) {
+ /* Move to the next row in the curent dimension */
+ offset[temp_dim]++;
+ tmp_block[temp_dim]++;
+
+ /* If this block is still in the range of blocks to output for the dimension, break out of loop */
+ if(tmp_block[temp_dim] < tdiminfo[temp_dim].block)
+ break;
+ else {
+ /* Move to the next block in the current dimension */
+ offset[temp_dim] += (tdiminfo[temp_dim].stride - tdiminfo[temp_dim].block);
+ loc += skip[temp_dim];
+ tmp_block[temp_dim] = 0;
+ tmp_count[temp_dim]++;
+
+ /* If this block is still in the range of blocks to output for the dimension, break out of loop */
+ if(tmp_count[temp_dim] < tdiminfo[temp_dim].count)
+ break;
+ else {
+ offset[temp_dim] = (hsize_t)((hssize_t)tdiminfo[temp_dim].start + sel_off[temp_dim]);
+ loc += wrap[temp_dim];
+ tmp_count[temp_dim] = 0; /* reset back to the beginning of the line */
+ tmp_block[temp_dim] = 0;
+ } /* end else */
+ } /* end else */
+
+ /* Decrement dimension count */
+ temp_dim--;
+ } /* end while */
+ } /* end if */
+ else {
+ /* Update the offset in the fastest dimension */
+ offset[fast_dim] += (fast_dim_stride * act_blk_count);
+ } /* end else */
+ } /* end if */
+
+ /* Compute the number of entire rows to read in */
+ H5_CHECK_OVERFLOW(tot_blk_count / tdiminfo[fast_dim].count, hsize_t, size_t);
+ curr_rows = total_rows = (size_t)(tot_blk_count / tdiminfo[fast_dim].count);
+
+ /* Reset copy of number of blocks in fastest dimension */
+ H5_CHECKED_ASSIGN(fast_dim_count, size_t, tdiminfo[fast_dim].count, hsize_t);
+
+ /* Read in data until an entire sequence can't be written out any longer */
+ while(curr_rows > 0) {
+
+#define DUFF_GUTS \
+/* Store the sequence information */ \
+off[curr_seq] = loc; \
+len[curr_seq] = actual_bytes; \
+ \
+/* Increment sequence count */ \
+curr_seq++; \
+ \
+/* Increment information to reflect block just processed */ \
+loc += fast_dim_buf_off;
+
+#ifdef NO_DUFFS_DEVICE
+ /* Loop over all the blocks in the fastest changing dimension */
+ while(fast_dim_count > 0) {
+ DUFF_GUTS
+
+ /* Decrement number of blocks */
+ fast_dim_count--;
+ } /* end while */
+#else /* NO_DUFFS_DEVICE */
+ {
+ size_t duffs_index; /* Counting index for Duff's device */
+
+ duffs_index = (fast_dim_count + 7) / 8;
+ switch (fast_dim_count % 8) {
+ default:
+ HDassert(0 && "This Should never be executed!");
+ break;
+ case 0:
+ do
+ {
+ DUFF_GUTS
+ H5_ATTR_FALLTHROUGH
+ case 7:
+ DUFF_GUTS
+ H5_ATTR_FALLTHROUGH
+ case 6:
+ DUFF_GUTS
+ H5_ATTR_FALLTHROUGH
+ case 5:
+ DUFF_GUTS
+ H5_ATTR_FALLTHROUGH
+ case 4:
+ DUFF_GUTS
+ H5_ATTR_FALLTHROUGH
+ case 3:
+ DUFF_GUTS
+ H5_ATTR_FALLTHROUGH
+ case 2:
+ DUFF_GUTS
+ H5_ATTR_FALLTHROUGH
+ case 1:
+ DUFF_GUTS
+ } while (--duffs_index > 0);
+ } /* end switch */
+ }
+#endif /* NO_DUFFS_DEVICE */
+#undef DUFF_GUTS
+
+ /* Increment offset in destination buffer */
+ loc += wrap[fast_dim];
+
+ /* Increment the offset and count for the other dimensions */
+ temp_dim = (int)fast_dim - 1;
+ while(temp_dim >= 0) {
+ /* Move to the next row in the curent dimension */
+ offset[temp_dim]++;
+ tmp_block[temp_dim]++;
+
+ /* If this block is still in the range of blocks to output for the dimension, break out of loop */
+ if(tmp_block[temp_dim] < tdiminfo[temp_dim].block)
+ break;
+ else {
+ /* Move to the next block in the current dimension */
+ offset[temp_dim] += (tdiminfo[temp_dim].stride - tdiminfo[temp_dim].block);
+ loc += skip[temp_dim];
+ tmp_block[temp_dim] = 0;
+ tmp_count[temp_dim]++;
+
+ /* If this block is still in the range of blocks to output for the dimension, break out of loop */
+ if(tmp_count[temp_dim] < tdiminfo[temp_dim].count)
+ break;
+ else {
+ offset[temp_dim] = (hsize_t)((hssize_t)tdiminfo[temp_dim].start + sel_off[temp_dim]);
+ loc += wrap[temp_dim];
+ tmp_count[temp_dim] = 0; /* reset back to the beginning of the line */
+ tmp_block[temp_dim] = 0;
+ } /* end else */
+ } /* end else */
+
+ /* Decrement dimension count */
+ temp_dim--;
+ } /* end while */
+
+ /* Decrement the number of rows left */
+ curr_rows--;
+ } /* end while */
+
+ /* Adjust the number of blocks & elements left to transfer */
+
+ /* Decrement number of elements left */
+ H5_CHECK_OVERFLOW(actual_elem * (total_rows * tdiminfo[fast_dim].count), hsize_t, size_t);
+ io_left -= (size_t)(actual_elem * (total_rows * tdiminfo[fast_dim].count));
+
+ /* Decrement number of blocks left */
+ H5_CHECK_OVERFLOW((total_rows * tdiminfo[fast_dim].count), hsize_t, size_t);
+ tot_blk_count -= (size_t)(total_rows * tdiminfo[fast_dim].count);
+
+ /* Read in partial row of blocks */
+ if(io_left > 0 && curr_seq < maxseq) {
+ /* Get remaining number of blocks left to output */
+ fast_dim_count = tot_blk_count;
+
+ /* Loop over all the blocks in the fastest changing dimension */
+ while(fast_dim_count > 0) {
+ /* Store the sequence information */
+ off[curr_seq] = loc;
+ len[curr_seq] = actual_bytes;
+
+ /* Increment sequence count */
+ curr_seq++;
+
+ /* Increment information to reflect block just processed */
+ loc += fast_dim_buf_off;
+
+ /* Decrement number of blocks */
+ fast_dim_count--;
+ } /* end while */
+
+ /* Decrement number of elements left */
+ io_left -= actual_elem * tot_blk_count;
+
+ /* Increment information to reflect block just processed */
+ offset[fast_dim] += (fast_dim_stride * tot_blk_count); /* move the offset in the fastest dimension */
+
+ /* Handle any leftover, partial blocks in this row */
+ if(io_left > 0 && curr_seq < maxseq) {
+ actual_elem = io_left;
+ actual_bytes = actual_elem * elem_size;
+
+ /* Store the sequence information */
+ off[curr_seq] = loc;
+ len[curr_seq] = actual_bytes;
+
+ /* Increment sequence count */
+ curr_seq++;
+
+ /* Decrement the number of elements left */
+ io_left -= actual_elem;
+
+ /* Increment buffer correctly */
+ offset[fast_dim] += actual_elem;
+ } /* end if */
+
+ /* don't bother checking slower dimensions */
+ HDassert(io_left == 0 || curr_seq == maxseq);
+ } /* end if */
+
+ /* Update the iterator */
+
+ /* Update the iterator with the location we stopped */
+ /* (Subtract out the selection offset) */
+ for(u = 0; u < ndims; u++)
+ iter->u.hyp.off[u] = (hsize_t)((hssize_t)offset[u] - sel_off[u]);
+
+ /* Decrement the number of elements left in selection */
+ iter->elmt_left -= (start_io_left - io_left);
+
+ /* Increment the number of sequences generated */
+ *nseq += curr_seq;
+
+ /* Increment the number of elements used */
+ *nelem += start_io_left - io_left;
+
+ FUNC_LEAVE_NOAPI(SUCCEED)
+} /* end H5S__hyper_iter_get_seq_list_opt() */
/*--------------------------------------------------------------------------
NAME
- H5S__hyper_span_precompute_helper
+ H5S__hyper_iter_get_seq_list_single
PURPOSE
- Helper routine to precompute the nelem and pstrides in bytes.
+ Create a list of offsets & lengths for a selection
USAGE
- void H5S__hyper_span_precompute_helper(span_info, elmt_size)
- H5S_hyper_span_info_t *span_info; IN/OUT: Span tree to work on
- size_t elmt_size; IN: element size to work with
+ herr_t H5S__hyper_iter_get_seq_list_single(flags, iter, maxseq, maxelem, nseq, nelem, off, len)
+ unsigned flags; IN: Flags for extra information about operation
+ H5S_sel_iter_t *iter; IN/OUT: Selection iterator describing last
+ position of interest in selection.
+ size_t maxseq; IN: Maximum number of sequences to generate
+ size_t maxelem; IN: Maximum number of elements to include in the
+ generated sequences
+ size_t *nseq; OUT: Actual number of sequences generated
+ size_t *nelem; OUT: Actual number of elements in sequences generated
+ hsize_t *off; OUT: Array of offsets
+ size_t *len; OUT: Array of lengths
RETURNS
- None
+ Non-negative on success/Negative on failure.
DESCRIPTION
- Change the nelem and pstride values in the span tree from elements to
- bytes using the elmt_size parameter.
+ Use the selection in the dataspace to generate a list of byte offsets and
+ lengths for the region(s) selected. Start/Restart from the position in the
+ ITER parameter. The number of sequences generated is limited by the MAXSEQ
+ parameter and the number of sequences actually generated is stored in the
+ NSEQ parameter.
GLOBAL VARIABLES
COMMENTS, BUGS, ASSUMPTIONS
EXAMPLES
REVISION LOG
--------------------------------------------------------------------------*/
-static void
-H5S__hyper_span_precompute_helper(H5S_hyper_span_info_t *spans, size_t elmt_size)
+static herr_t
+H5S__hyper_iter_get_seq_list_single(H5S_sel_iter_t *iter, size_t maxseq, size_t maxelem,
+ size_t *nseq, size_t *nelem, hsize_t *off, size_t *len)
{
+ const H5S_hyper_dim_t *tdiminfo; /* Temporary pointer to diminfo information */
+ const hssize_t *sel_off; /* Selection offset in dataspace */
+ hsize_t *mem_size; /* Size of the source buffer */
+ hsize_t base_offset[H5S_MAX_RANK]; /* Base coordinate offset in dataspace */
+ hsize_t offset[H5S_MAX_RANK]; /* Coordinate offset in dataspace */
+ hsize_t *slab; /* Hyperslab size */
+ hsize_t fast_dim_block; /* Local copies of fastest changing dimension info */
+ hsize_t loc; /* Coordinate offset */
+ size_t tot_blk_count; /* Total number of blocks left to output */
+ size_t elem_size; /* Size of each element iterating over */
+ size_t io_left; /* The number of elements left in I/O operation */
+ size_t actual_elem; /* The actual number of elements to count */
+ unsigned ndims; /* Number of dimensions of dataset */
+ unsigned fast_dim; /* Rank of the fastest changing dimension for the dataspace */
+ unsigned skip_dim; /* Rank of the dimension to skip along */
+ unsigned u; /* Local index variable */
+
FUNC_ENTER_STATIC_NOERR
- /* Sanity checks */
- HDassert(spans);
- HDassert(spans->scratch == (H5S_hyper_span_info_t *)~((size_t)NULL) ||
- spans->scratch == NULL);
+ /* Check args */
+ HDassert(iter);
+ HDassert(maxseq > 0);
+ HDassert(maxelem > 0);
+ HDassert(nseq);
+ HDassert(nelem);
+ HDassert(off);
+ HDassert(len);
+
+ /* Set a local copy of the diminfo pointer */
+ tdiminfo = iter->u.hyp.diminfo;
- /* Check if we've already set this down span tree */
- if(spans->scratch != (H5S_hyper_span_info_t *)~((size_t)NULL)) {
- H5S_hyper_span_t *span; /* Hyperslab span */
+ /* Check if this is a "flattened" regular hyperslab selection */
+ if(iter->u.hyp.iter_rank != 0 && iter->u.hyp.iter_rank < iter->rank) {
+ /* Set the aliases for a few important dimension ranks */
+ ndims = iter->u.hyp.iter_rank;
- /* Set the tree's scratch pointer */
- spans->scratch = (H5S_hyper_span_info_t *)~((size_t)NULL);
+ /* Set the local copy of the selection offset */
+ sel_off = iter->u.hyp.sel_off;
- /* Set the scratch pointers in all the nodes */
- span = spans->head;
+ /* Set up the pointer to the size of the memory dataspace */
+ mem_size = iter->u.hyp.size;
+ } /* end if */
+ else {
+ /* Set the aliases for a few important dimension ranks */
+ ndims = iter->rank;
- /* Loop over all the spans for this down span tree */
- while(span != NULL) {
- /* If there are down spans, precompute their values also */
- if(span->down != NULL)
- H5S__hyper_span_precompute_helper(span->down, elmt_size);
+ /* Set the local copy of the selection offset */
+ sel_off = iter->sel_off;
- /* Change the nelem & pstride values into bytes */
- span->nelem *= elmt_size;
- span->pstride *= elmt_size;
+ /* Set up the pointer to the size of the memory dataspace */
+ mem_size = iter->dims;
+ } /* end else */
- /* Advance to next span */
- span = span->next;
- } /* end while */
+ /* Set up some local variables */
+ fast_dim = ndims - 1;
+ elem_size = iter->elmt_size;
+ slab = iter->u.hyp.slab;
+
+ /* Copy the base location of the block */
+ /* (Add in the selection offset) */
+ for(u = 0; u < ndims; u++)
+ base_offset[u] = (hsize_t)((hssize_t)tdiminfo[u].start + sel_off[u]);
+
+ /* Copy the location of the point to get */
+ /* (Add in the selection offset) */
+ for(u = 0; u < ndims; u++)
+ offset[u] = (hsize_t)((hssize_t)iter->u.hyp.off[u] + sel_off[u]);
+
+ /* Compute the initial buffer offset */
+ for(u = 0, loc = 0; u < ndims; u++)
+ loc += offset[u] * slab[u];
+
+ /* Set local copies of information for the fastest changing dimension */
+ fast_dim_block = tdiminfo[fast_dim].block;
+
+ /* Calculate the number of elements to sequence through */
+ H5_CHECK_OVERFLOW(iter->elmt_left, hsize_t, size_t);
+ io_left = MIN((size_t)iter->elmt_left, maxelem);
+
+ /* Compute the number of blocks which would fit into the buffer */
+ H5_CHECK_OVERFLOW(io_left / fast_dim_block, hsize_t, size_t);
+ tot_blk_count = (size_t)(io_left / fast_dim_block);
+
+ /* Don't go over the maximum number of sequences allowed */
+ tot_blk_count = MIN(tot_blk_count, maxseq);
+
+ /* Set the number of elements to write each time */
+ H5_CHECKED_ASSIGN(actual_elem, size_t, fast_dim_block, hsize_t);
+
+ /* Check for blocks to operate on */
+ if(tot_blk_count > 0) {
+ size_t actual_bytes; /* The actual number of bytes to copy */
+
+ /* Set the number of actual bytes */
+ actual_bytes = actual_elem * elem_size;
+
+ /* Check for 1-dim selection */
+ if(0 == fast_dim) {
+ /* Sanity checks */
+ HDassert(1 == tot_blk_count);
+ HDassert(io_left == actual_elem);
+
+ /* Store the sequence information */
+ *off++ = loc;
+ *len++ = actual_bytes;
+ } /* end if */
+ else {
+ hsize_t skip_slab; /* Temporary copy of slab[fast_dim - 1] */
+ size_t blk_count; /* Total number of blocks left to output */
+ int i; /* Local index variable */
+
+ /* Find first dimension w/block >1 */
+ skip_dim = fast_dim;
+ for(i = (int)(fast_dim - 1); i >= 0; i--)
+ if(tdiminfo[i].block > 1) {
+ skip_dim = (unsigned)i;
+ break;
+ } /* end if */
+ skip_slab = slab[skip_dim];
+
+ /* Check for being able to use fast algorithm for 1-D */
+ if(0 == skip_dim) {
+ /* Create sequences until an entire row can't be used */
+ blk_count = tot_blk_count;
+ while(blk_count > 0) {
+ /* Store the sequence information */
+ *off++ = loc;
+ *len++ = actual_bytes;
+
+ /* Increment offset in destination buffer */
+ loc += skip_slab;
+
+ /* Decrement block count */
+ blk_count--;
+ } /* end while */
+
+ /* Move to the next location */
+ offset[skip_dim] += tot_blk_count;
+ } /* end if */
+ else {
+ hsize_t tmp_block[H5S_MAX_RANK]; /* Temporary block offset */
+ hsize_t skip[H5S_MAX_RANK]; /* Bytes to skip between blocks */
+ int temp_dim; /* Temporary rank holder */
+
+ /* Set the starting block location */
+ for(u = 0; u < ndims; u++)
+ tmp_block[u] = iter->u.hyp.off[u] - tdiminfo[u].start;
+
+ /* Compute the amount to skip between sequences */
+ for(u = 0; u < ndims; u++)
+ skip[u] = (mem_size[u] - tdiminfo[u].block) * slab[u];
+
+ /* Create sequences until an entire row can't be used */
+ blk_count = tot_blk_count;
+ while(blk_count > 0) {
+ /* Store the sequence information */
+ *off++ = loc;
+ *len++ = actual_bytes;
+
+ /* Set temporary dimension for advancing offsets */
+ temp_dim = (int)skip_dim;
+
+ /* Increment offset in destination buffer */
+ loc += skip_slab;
+
+ /* Increment the offset and count for the other dimensions */
+ while(temp_dim >= 0) {
+ /* Move to the next row in the curent dimension */
+ offset[temp_dim]++;
+ tmp_block[temp_dim]++;
+
+ /* If this block is still in the range of blocks to output for the dimension, break out of loop */
+ if(tmp_block[temp_dim] < tdiminfo[temp_dim].block)
+ break;
+ else {
+ offset[temp_dim] = base_offset[temp_dim];
+ loc += skip[temp_dim];
+ tmp_block[temp_dim] = 0;
+ } /* end else */
+
+ /* Decrement dimension count */
+ temp_dim--;
+ } /* end while */
+
+ /* Decrement block count */
+ blk_count--;
+ } /* end while */
+ } /* end else */
+ } /* end else */
+
+ /* Update the iterator, if there were any blocks used */
+
+ /* Decrement the number of elements left in selection */
+ iter->elmt_left -= tot_blk_count * actual_elem;
+
+ /* Check if there are elements left in iterator */
+ if(iter->elmt_left > 0) {
+ /* Update the iterator with the location we stopped */
+ /* (Subtract out the selection offset) */
+ for(u = 0; u < ndims; u++)
+ iter->u.hyp.off[u] = (hsize_t)((hssize_t)offset[u] - sel_off[u]);
+ } /* end if */
+
+ /* Increment the number of sequences generated */
+ *nseq += tot_blk_count;
+
+ /* Increment the number of elements used */
+ *nelem += tot_blk_count * actual_elem;
} /* end if */
- FUNC_LEAVE_NOAPI_VOID
-} /* end H5S__hyper_span_precompute_helper() */
+ /* Check for partial block, with room for another sequence */
+ if(io_left > (tot_blk_count * actual_elem) && tot_blk_count < maxseq) {
+ size_t elmt_remainder; /* Elements remaining */
+
+ /* Compute elements left */
+ elmt_remainder = io_left - (tot_blk_count * actual_elem);
+ HDassert(elmt_remainder < fast_dim_block);
+ HDassert(elmt_remainder > 0);
+
+ /* Store the sequence information */
+ *off++ = loc;
+ *len++ = elmt_remainder * elem_size;
+
+ /* Update the iterator with the location we stopped */
+ iter->u.hyp.off[fast_dim] += (hsize_t)elmt_remainder;
+
+ /* Decrement the number of elements left in selection */
+ iter->elmt_left -= elmt_remainder;
+
+ /* Increment the number of sequences generated */
+ (*nseq)++;
+
+ /* Increment the number of elements used */
+ *nelem += elmt_remainder;
+ } /* end if */
+
+ /* Sanity check */
+ HDassert(*nseq > 0);
+ HDassert(*nelem > 0);
+
+ FUNC_LEAVE_NOAPI(SUCCEED)
+} /* end H5S__hyper_iter_get_seq_list_single() */
/*--------------------------------------------------------------------------
NAME
- H5S__hyper_span_precompute
+ H5S__hyper_iter_get_seq_list
PURPOSE
- Precompute the nelem and pstrides in bytes.
+ Create a list of offsets & lengths for a selection
USAGE
- herr_t H5S__hyper_span_precompute(span_info, elmt_size)
- H5S_hyper_span_info_t *span_info; IN/OUT: Span tree to work on
- size_t elmt_size; IN: element size to work with
+ herr_t H5S__hyper_iter_get_seq_list(iter,maxseq,maxelem,nseq,nelem,off,len)
+ H5S_t *space; IN: Dataspace containing selection to use.
+ unsigned flags; IN: Flags for extra information about operation
+ H5S_sel_iter_t *iter; IN/OUT: Selection iterator describing last
+ position of interest in selection.
+ size_t maxseq; IN: Maximum number of sequences to generate
+ size_t maxelem; IN: Maximum number of elements to include in the
+ generated sequences
+ size_t *nseq; OUT: Actual number of sequences generated
+ size_t *nelem; OUT: Actual number of elements in sequences generated
+ hsize_t *off; OUT: Array of offsets (in bytes)
+ size_t *len; OUT: Array of lengths (in bytes)
RETURNS
- Non-negative on success, negative on failure
+ Non-negative on success/Negative on failure.
DESCRIPTION
- Change the nelem and pstride values in the span tree from elements to
- bytes using the elmt_size parameter.
+ Use the selection in the dataspace to generate a list of byte offsets and
+ lengths for the region(s) selected. Start/Restart from the position in the
+ ITER parameter. The number of sequences generated is limited by the MAXSEQ
+ parameter and the number of sequences actually generated is stored in the
+ NSEQ parameter.
GLOBAL VARIABLES
COMMENTS, BUGS, ASSUMPTIONS
EXAMPLES
REVISION LOG
--------------------------------------------------------------------------*/
static herr_t
-H5S__hyper_span_precompute(H5S_hyper_span_info_t *spans, size_t elmt_size)
+H5S__hyper_iter_get_seq_list(H5S_sel_iter_t *iter, size_t maxseq,
+ size_t maxelem, size_t *nseq, size_t *nelem, hsize_t *off, size_t *len)
{
+ herr_t ret_value = FAIL; /* return value */
+
FUNC_ENTER_STATIC_NOERR
- HDassert(spans);
+ /* Check args */
+ HDassert(iter);
+ HDassert(iter->elmt_left > 0);
+ HDassert(maxseq > 0);
+ HDassert(maxelem > 0);
+ HDassert(nseq);
+ HDassert(nelem);
+ HDassert(off);
+ HDassert(len);
- /* Call the helper routine to actually do the work */
- H5S__hyper_span_precompute_helper(spans, elmt_size);
+ /* Check for the special case of just one H5Sselect_hyperslab call made */
+ if(iter->u.hyp.diminfo_valid) {
+ const H5S_hyper_dim_t *tdiminfo; /* Temporary pointer to diminfo information */
+ const hssize_t *sel_off; /* Selection offset in dataspace */
+ unsigned ndims; /* Number of dimensions of dataset */
+ unsigned fast_dim; /* Rank of the fastest changing dimension for the dataspace */
+ hbool_t single_block; /* Whether the selection is a single block */
+ unsigned u; /* Local index variable */
- /* Reset the scratch pointers for the next routine which needs them */
- H5S__hyper_span_scratch(spans);
+ /* Set a local copy of the diminfo pointer */
+ tdiminfo = iter->u.hyp.diminfo;
- FUNC_LEAVE_NOAPI(SUCCEED)
-} /* end H5S__hyper_span_precompute() */
+ /* Check if this is a "flattened" regular hyperslab selection */
+ if(iter->u.hyp.iter_rank != 0 && iter->u.hyp.iter_rank < iter->rank) {
+ /* Set the aliases for a few important dimension ranks */
+ ndims = iter->u.hyp.iter_rank;
+
+ /* Set the local copy of the selection offset */
+ sel_off = iter->u.hyp.sel_off;
+ } /* end if */
+ else {
+ /* Set the aliases for a few important dimension ranks */
+ ndims = iter->rank;
+
+ /* Set the local copy of the selection offset */
+ sel_off = iter->sel_off;
+ } /* end else */
+ fast_dim = ndims - 1;
+
+ /* Check if we stopped in the middle of a sequence of elements */
+ if((iter->u.hyp.off[fast_dim] - tdiminfo[fast_dim].start) % tdiminfo[fast_dim].stride != 0 ||
+ ((iter->u.hyp.off[fast_dim] != tdiminfo[fast_dim].start) && tdiminfo[fast_dim].count == 1)) {
+ hsize_t *slab; /* Hyperslab size */
+ hsize_t loc; /* Coordinate offset */
+ size_t leftover; /* The number of elements left over from the last sequence */
+ size_t actual_elem; /* The actual number of elements to count */
+ size_t elem_size; /* Size of each element iterating over */
+
+ /* Calculate the number of elements left in the sequence */
+ if(tdiminfo[fast_dim].count == 1) {
+ H5_CHECKED_ASSIGN(leftover, size_t, tdiminfo[fast_dim].block - (iter->u.hyp.off[fast_dim] - tdiminfo[fast_dim].start), hsize_t);
+ } /* end if */
+ else {
+ H5_CHECKED_ASSIGN(leftover, size_t, tdiminfo[fast_dim].block - ((iter->u.hyp.off[fast_dim] - tdiminfo[fast_dim].start) % tdiminfo[fast_dim].stride), hsize_t);
+ } /* end else */
+
+ /* Make certain that we don't write too many */
+ actual_elem = MIN3(leftover, (size_t)iter->elmt_left, maxelem);
+
+ /* Set up some local variables */
+ elem_size = iter->elmt_size;
+ slab = iter->u.hyp.slab;
+
+ /* Compute the initial buffer offset */
+ for(u = 0, loc = 0; u < ndims; u++)
+ loc += ((hsize_t)((hssize_t)iter->u.hyp.off[u] + sel_off[u])) * slab[u];
+
+ /* Add a new sequence */
+ off[0] = loc;
+ H5_CHECKED_ASSIGN(len[0], size_t, actual_elem * elem_size, hsize_t);
+
+ /* Increment sequence array locations */
+ off++;
+ len++;
+
+ /* Advance the hyperslab iterator */
+ H5S__hyper_iter_next(iter, actual_elem);
+
+ /* Decrement the number of elements left in selection */
+ iter->elmt_left -= actual_elem;
+
+ /* Decrement element/sequence limits */
+ maxelem -= actual_elem;
+ maxseq--;
+
+ /* Set the number of sequences generated and elements used */
+ *nseq = 1;
+ *nelem = actual_elem;
+
+ /* Check for using up all the sequences/elements */
+ if(0 == iter->elmt_left || 0 == maxelem || 0 == maxseq)
+ return(SUCCEED);
+ } /* end if */
+ else {
+ /* Reset the number of sequences generated and elements used */
+ *nseq = 0;
+ *nelem = 0;
+ } /* end else */
+
+ /* Check for a single block selected */
+ single_block = TRUE;
+ for(u = 0; u < ndims; u++)
+ if(1 != tdiminfo[u].count) {
+ single_block = FALSE;
+ break;
+ } /* end if */
+
+ /* Check for single block selection */
+ if(single_block)
+ /* Use single-block optimized call to generate sequence list */
+ ret_value = H5S__hyper_iter_get_seq_list_single(iter, maxseq, maxelem, nseq, nelem, off, len);
+ else
+ /* Use optimized call to generate sequence list */
+ ret_value = H5S__hyper_iter_get_seq_list_opt(iter, maxseq, maxelem, nseq, nelem, off, len);
+ } /* end if */
+ else
+ /* Call the general sequence generator routine */
+ ret_value = H5S__hyper_iter_get_seq_list_gen(iter, maxseq, maxelem, nseq, nelem, off, len);
+
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5S__hyper_iter_get_seq_list() */
/*--------------------------------------------------------------------------
NAME
- H5S__hyper_span_scratch
+ H5S__hyper_iter_release
PURPOSE
- Reset the scratch pointers on hyperslab span trees
+ Release hyperslab selection iterator information for a dataspace
USAGE
- void H5S__hyper_span_scratch(span_info)
- H5S_hyper_span_info_t *span_info; IN: Span tree to reset
+ herr_t H5S__hyper_iter_release(iter)
+ H5S_sel_iter_t *iter; IN: Pointer to selection iterator
RETURNS
- <none>
+ Non-negative on success/Negative on failure
DESCRIPTION
- Reset the scratch pointers on a hyperslab span tree to NULL.
+ Releases all information for a dataspace hyperslab selection iterator
GLOBAL VARIABLES
COMMENTS, BUGS, ASSUMPTIONS
EXAMPLES
REVISION LOG
--------------------------------------------------------------------------*/
-static void
-H5S__hyper_span_scratch(H5S_hyper_span_info_t *spans)
+static herr_t
+H5S__hyper_iter_release(H5S_sel_iter_t *iter)
{
FUNC_ENTER_STATIC_NOERR
- HDassert(spans);
+ /* Check args */
+ HDassert(iter);
- /* Check if we've already set this down span tree */
- if(spans->scratch != NULL) {
- H5S_hyper_span_t *span; /* Hyperslab span */
+ /* Free the copy of the hyperslab selection span tree */
+ if(iter->u.hyp.spans != NULL)
+ H5S__hyper_free_span_info(iter->u.hyp.spans);
- /* Reset the tree's scratch pointer */
- spans->scratch = NULL;
+ FUNC_LEAVE_NOAPI(SUCCEED)
+} /* end H5S__hyper_iter_release() */
- /* Set the scratch pointers in all the nodes */
- span = spans->head;
- while(span != NULL) {
- /* If there are down spans, set their scratch value also */
- if(span->down != NULL)
- H5S__hyper_span_scratch(span->down);
+
+/*--------------------------------------------------------------------------
+ NAME
+ H5S__hyper_new_span
+ PURPOSE
+ Make a new hyperslab span node
+ USAGE
+ H5S_hyper_span_t *H5S__hyper_new_span(low, high, down, next)
+ hsize_t low, high; IN: Low and high bounds for new span node
+ H5S_hyper_span_info_t *down; IN: Down span tree for new node
+ H5S_hyper_span_t *next; IN: Next span for new node
+ RETURNS
+ Pointer to new span node on success, NULL on failure
+ DESCRIPTION
+ Allocate and initialize a new hyperslab span node, filling in the low &
+ high bounds, the down span and next span pointers also. Increment the
+ reference count of the 'down span' if applicable.
+ GLOBAL VARIABLES
+ COMMENTS, BUGS, ASSUMPTIONS
+ EXAMPLES
+ REVISION LOG
+--------------------------------------------------------------------------*/
+static H5S_hyper_span_t *
+H5S__hyper_new_span(hsize_t low, hsize_t high, H5S_hyper_span_info_t *down,
+ H5S_hyper_span_t *next)
+{
+ H5S_hyper_span_t *ret_value = NULL; /* Return value */
- /* Advance to next span */
- span = span->next;
- } /* end while */
- } /* end if */
+ FUNC_ENTER_STATIC
- FUNC_LEAVE_NOAPI_VOID
-} /* end H5S__hyper_span_scratch() */
+ /* Allocate a new span node */
+ if(NULL == (ret_value = H5FL_MALLOC(H5S_hyper_span_t)))
+ HGOTO_ERROR(H5E_DATASPACE, H5E_CANTALLOC, NULL, "can't allocate hyperslab span")
+
+ /* Copy the span's basic information */
+ ret_value->low = low;
+ ret_value->high = high;
+ ret_value->down = down;
+ ret_value->next = next;
+
+ /* Increment the reference count of the 'down span' if there is one */
+ if(ret_value->down)
+ ret_value->down->count++;
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5S__hyper_new_span() */
+
+
+/*--------------------------------------------------------------------------
+ NAME
+ H5S__hyper_new_span_info
+ PURPOSE
+ Make a new hyperslab span info node
+ USAGE
+ H5S_hyper_span_info_t *H5S__hyper_new_span_info(rank)
+ unsigned rank; IN: Rank of span info, in selection
+ RETURNS
+ Pointer to new span node info on success, NULL on failure
+ DESCRIPTION
+ Allocate and initialize a new hyperslab span info node of a given rank,
+ setting up the low & high bound array pointers.
+ GLOBAL VARIABLES
+ COMMENTS, BUGS, ASSUMPTIONS
+ Note that this uses the C99 "flexible array member" feature.
+ EXAMPLES
+ REVISION LOG
+--------------------------------------------------------------------------*/
+static H5S_hyper_span_info_t *
+H5S__hyper_new_span_info(unsigned rank)
+{
+ H5S_hyper_span_info_t *ret_value = NULL; /* Return value */
+
+ FUNC_ENTER_STATIC
+
+ /* Sanity check */
+ HDassert(rank > 0);
+ HDassert(rank <= H5S_MAX_RANK);
+
+ /* Allocate a new span info node */
+ if(NULL == (ret_value = (H5S_hyper_span_info_t *)H5FL_ARR_CALLOC(hbounds_t, rank * 2)))
+ HGOTO_ERROR(H5E_DATASPACE, H5E_CANTALLOC, NULL, "can't allocate hyperslab span info")
+
+ /* Set low & high bound pointers into the 'bounds' array */
+ ret_value->low_bounds = ret_value->bounds;
+ ret_value->high_bounds = &ret_value->bounds[rank];
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5S__hyper_new_span_info() */
/*--------------------------------------------------------------------------
@@ -1296,8 +2858,10 @@ H5S__hyper_span_scratch(H5S_hyper_span_info_t *spans)
PURPOSE
Helper routine to copy a hyperslab span tree
USAGE
- H5S_hyper_span_info_t * H5S__hyper_copy_span_helper(spans)
- H5S_hyper_span_info_t *spans; IN: Span tree to copy
+ H5S_hyper_span_info_t * H5S__hyper_copy_span_helper(spans, rank)
+ H5S_hyper_span_info_t *spans; IN: Span tree to copy
+ unsigned rank; IN: Rank of span tree
+ uint64_t op_gen; IN: Operation generation
RETURNS
Pointer to the copied span tree on success, NULL on failure
DESCRIPTION
@@ -1308,7 +2872,8 @@ H5S__hyper_span_scratch(H5S_hyper_span_info_t *spans)
REVISION LOG
--------------------------------------------------------------------------*/
static H5S_hyper_span_info_t *
-H5S__hyper_copy_span_helper(H5S_hyper_span_info_t *spans)
+H5S__hyper_copy_span_helper(H5S_hyper_span_info_t *spans, unsigned rank,
+ uint64_t op_gen)
{
H5S_hyper_span_t *span; /* Hyperslab span */
H5S_hyper_span_t *new_span; /* Temporary hyperslab span */
@@ -1320,26 +2885,30 @@ H5S__hyper_copy_span_helper(H5S_hyper_span_info_t *spans)
/* Sanity checks */
HDassert(spans);
- HDassert(spans->scratch != (H5S_hyper_span_info_t *)~((size_t)NULL));
/* Check if the span tree was already copied */
- if(spans->scratch != NULL) {
+ if(spans->op_gen == op_gen) {
/* Just return the value of the already copied span tree */
- ret_value = spans->scratch;
+ ret_value = spans->u.copied;
/* Increment the reference count of the span tree */
ret_value->count++;
} /* end if */
else {
/* Allocate a new span_info node */
- if(NULL == (ret_value = H5FL_CALLOC(H5S_hyper_span_info_t)))
+ if(NULL == (ret_value = H5S__hyper_new_span_info(rank)))
HGOTO_ERROR(H5E_DATASPACE, H5E_CANTALLOC, NULL, "can't allocate hyperslab span info")
- /* Copy the span_info information */
+ /* Set the non-zero span_info information */
+ H5MM_memcpy(ret_value->low_bounds, spans->low_bounds, rank * sizeof(hsize_t));
+ H5MM_memcpy(ret_value->high_bounds, spans->high_bounds, rank * sizeof(hsize_t));
ret_value->count = 1;
- /* Set the scratch pointer in the node being copied to the newly allocated node */
- spans->scratch = ret_value;
+ /* Set the operation generation for the span info, to avoid future copies */
+ spans->op_gen = op_gen;
+
+ /* Set the 'copied' pointer in the node being copied to the newly allocated node */
+ spans->u.copied = ret_value;
/* Copy over the nodes in the span list */
span = spans->head;
@@ -1355,12 +2924,9 @@ H5S__hyper_copy_span_helper(H5S_hyper_span_info_t *spans)
else
prev_span->next = new_span;
- /* Copy the pstride */
- new_span->pstride = span->pstride;
-
/* Recurse to copy the 'down' spans, if there are any */
if(span->down != NULL) {
- if(NULL == (new_down = H5S__hyper_copy_span_helper(span->down)))
+ if(NULL == (new_down = H5S__hyper_copy_span_helper(span->down, rank - 1, op_gen)))
HGOTO_ERROR(H5E_DATASPACE, H5E_CANTCOPY, NULL, "can't copy hyperslab spans")
new_span->down = new_down;
} /* end if */
@@ -1371,6 +2937,9 @@ H5S__hyper_copy_span_helper(H5S_hyper_span_info_t *spans)
/* Advance to next span */
span = span->next;
} /* end while */
+
+ /* Retain a pointer to the last span */
+ ret_value->tail = prev_span;
} /* end else */
done:
@@ -1384,10 +2953,11 @@ done:
PURPOSE
Copy a hyperslab span tree
USAGE
- H5S_hyper_span_info_t * H5S__hyper_copy_span(span_info)
- H5S_hyper_span_info_t *span_info; IN: Span tree to copy
+ H5S_hyper_span_info_t * H5S__hyper_copy_span(span_info, rank)
+ H5S_hyper_span_info_t *span_info; IN: Span tree to copy
+ unsigned rank; IN: Rank of span tree
RETURNS
- Non-negative on success, negative on failure
+ Pointer to the copied span tree on success, NULL on failure
DESCRIPTION
Copy a hyperslab span tree, using reference counting as appropriate.
(Which means that just the nodes in the top span tree are duplicated and
@@ -1398,21 +2968,23 @@ done:
REVISION LOG
--------------------------------------------------------------------------*/
static H5S_hyper_span_info_t *
-H5S__hyper_copy_span(H5S_hyper_span_info_t *spans)
+H5S__hyper_copy_span(H5S_hyper_span_info_t *spans, unsigned rank)
{
+ uint64_t op_gen; /* Operation generation value */
H5S_hyper_span_info_t *ret_value = NULL; /* Return value */
FUNC_ENTER_STATIC
+ /* Sanity check */
HDassert(spans);
+ /* Acquire an operation generation value for this operation */
+ op_gen = H5S__hyper_get_op_gen();
+
/* Copy the hyperslab span tree */
- if(NULL == (ret_value = H5S__hyper_copy_span_helper(spans)))
+ if(NULL == (ret_value = H5S__hyper_copy_span_helper(spans, rank, op_gen)))
HGOTO_ERROR(H5E_DATASPACE, H5E_CANTCOPY, NULL, "can't copy hyperslab span tree")
- /* Reset the scratch pointers for the next routine which needs them */
- H5S__hyper_span_scratch(spans);
-
done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5S__hyper_copy_span() */
@@ -1422,90 +2994,94 @@ done:
NAME
H5S__hyper_cmp_spans
PURPOSE
- Check if two hyperslab slabs are the same
+ Check if two hyperslab span trees are the same
USAGE
hbool_t H5S__hyper_cmp_spans(span1, span2)
- H5S_hyper_span_t *span1; IN: First span tree to compare
- H5S_hyper_span_t *span2; IN: Second span tree to compare
+ H5S_hyper_span_info_t *span_info1; IN: First span tree to compare
+ H5S_hyper_span_info_t *span_info2; IN: Second span tree to compare
RETURNS
TRUE (1) or FALSE (0) on success, can't fail
DESCRIPTION
- Compare two hyperslab slabs to determine if they refer to the same
- selection. If span1 & span2 are both NULL, that counts as equal
+ Compare two hyperslab span trees to determine if they refer to the same
+ selection. If span1 & span2 are both NULL, that counts as equal.
GLOBAL VARIABLES
COMMENTS, BUGS, ASSUMPTIONS
EXAMPLES
REVISION LOG
--------------------------------------------------------------------------*/
-static hbool_t
-H5S__hyper_cmp_spans(const H5S_hyper_span_info_t *span_info1, const H5S_hyper_span_info_t *span_info2)
+static H5_ATTR_PURE hbool_t
+H5S__hyper_cmp_spans(const H5S_hyper_span_info_t *span_info1,
+ const H5S_hyper_span_info_t *span_info2)
{
- hbool_t ret_value = FALSE; /* Return value */
+ hbool_t ret_value = TRUE; /* Return value */
FUNC_ENTER_STATIC_NOERR
/* Check for redundant comparison (or both spans being NULL) */
- if(span_info1 == span_info2)
- ret_value = TRUE;
- else {
+ if(span_info1 != span_info2) {
/* Check for one span being NULL */
if(span_info1 == NULL || span_info2 == NULL)
- ret_value = FALSE;
+ HGOTO_DONE(FALSE)
else {
- const H5S_hyper_span_t *span1;
- const H5S_hyper_span_t *span2;
-
- /* Get the pointers to the actual lists of spans */
- span1 = span_info1->head;
- span2 = span_info2->head;
-
- /* Sanity checking */
- HDassert(span1);
- HDassert(span2);
-
- /* infinite loop which must be broken out of */
- while(1) {
- /* Check for both spans being NULL */
- if(span1 == NULL && span2 == NULL) {
- ret_value = TRUE;
- break;
- } /* end if */
- else {
- /* Check for one span being NULL */
- if(span1 == NULL || span2 == NULL) {
- ret_value = FALSE;
- break;
- } /* end if */
+ /* Compare low & high bounds for this span list */
+ /* (Could compare lower dimensions also, but not certain if
+ * that's worth it. - QAK, 2019/01/23)
+ */
+ if(span_info1->low_bounds[0] != span_info2->low_bounds[0])
+ HGOTO_DONE(FALSE)
+ else if(span_info1->high_bounds[0] != span_info2->high_bounds[0])
+ HGOTO_DONE(FALSE)
+ else {
+ const H5S_hyper_span_t *span1;
+ const H5S_hyper_span_t *span2;
+
+ /* Get the pointers to the actual lists of spans */
+ span1 = span_info1->head;
+ span2 = span_info2->head;
+
+ /* Sanity checking */
+ HDassert(span1);
+ HDassert(span2);
+
+ /* infinite loop which must be broken out of */
+ while(1) {
+ /* Check for both spans being NULL */
+ if(span1 == NULL && span2 == NULL)
+ HGOTO_DONE(TRUE)
else {
- /* Check if the actual low & high span information is the same */
- if(span1->low != span2->low || span1->high != span2->high) {
- ret_value = FALSE;
- break;
- } /* end if */
+ /* Check for one span being NULL */
+ if(span1 == NULL || span2 == NULL)
+ HGOTO_DONE(FALSE)
else {
- if(span1->down != NULL || span2 != NULL) {
- if(!H5S__hyper_cmp_spans(span1->down, span2->down)) {
- ret_value = FALSE;
- break;
+ /* Check if the actual low & high span information is the same */
+ if(span1->low != span2->low || span1->high != span2->high)
+ HGOTO_DONE(FALSE)
+ else {
+ if(span1->down != NULL || span2->down != NULL) {
+ if(!H5S__hyper_cmp_spans(span1->down, span2->down))
+ HGOTO_DONE(FALSE)
+ else {
+ /* Keep going... */
+ } /* end else */
} /* end if */
else {
/* Keep going... */
} /* end else */
- } /* end if */
- else {
- /* Keep going... */
} /* end else */
} /* end else */
} /* end else */
- } /* end else */
- /* Advance to the next nodes in the span list */
- span1 = span1->next;
- span2 = span2->next;
- } /* end while */
+ /* Advance to the next nodes in the span list */
+ span1 = span1->next;
+ span2 = span2->next;
+ } /* end while */
+ } /* end else */
} /* end else */
- } /* end else */
+ } /* end if */
+ /* Fall through, with default return value of 'TRUE' if spans were already visited */
+
+done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5S__hyper_cmp_spans() */
@@ -1516,10 +3092,10 @@ H5S__hyper_cmp_spans(const H5S_hyper_span_info_t *span_info1, const H5S_hyper_sp
PURPOSE
Free a hyperslab span info node
USAGE
- herr_t H5S__hyper_free_span_info(span_info)
+ void H5S__hyper_free_span_info(span_info)
H5S_hyper_span_info_t *span_info; IN: Span info node to free
RETURNS
- Non-negative on success, negative on failure
+ None
DESCRIPTION
Free a hyperslab span info node, along with all the span nodes and the
'down spans' from the nodes, if reducing their reference count to zero
@@ -1529,14 +3105,12 @@ H5S__hyper_cmp_spans(const H5S_hyper_span_info_t *span_info1, const H5S_hyper_sp
EXAMPLES
REVISION LOG
--------------------------------------------------------------------------*/
-static herr_t
+static void
H5S__hyper_free_span_info(H5S_hyper_span_info_t *span_info)
{
- H5S_hyper_span_t *span, *next_span;
- herr_t ret_value = SUCCEED; /* Return value */
-
- FUNC_ENTER_STATIC
+ FUNC_ENTER_STATIC_NOERR
+ /* Sanity check */
HDassert(span_info);
/* Decrement the span tree's reference count */
@@ -1544,22 +3118,28 @@ H5S__hyper_free_span_info(H5S_hyper_span_info_t *span_info)
/* Free the span tree if the reference count drops to zero */
if(span_info->count == 0) {
+ H5S_hyper_span_t *span; /* Pointer to spans to iterate over */
/* Work through the list of spans pointed to by this 'info' node */
span = span_info->head;
while(span != NULL) {
+ H5S_hyper_span_t *next_span; /* Pointer to next span to iterate over */
+
+ /* Keep a pointer to the next span */
next_span = span->next;
- if(H5S__hyper_free_span(span) < 0)
- HGOTO_ERROR(H5E_INTERNAL, H5E_CANTFREE, FAIL, "failed to release hyperslab span")
+
+ /* Free the current span */
+ H5S__hyper_free_span(span);
+
+ /* Advance to next span */
span = next_span;
} /* end while */
/* Free this span info */
- span_info = H5FL_FREE(H5S_hyper_span_info_t, span_info);
+ span_info = (H5S_hyper_span_info_t *)H5FL_ARR_FREE(hbounds_t, span_info);
} /* end if */
-done:
- FUNC_LEAVE_NOAPI(ret_value)
+ FUNC_LEAVE_NOAPI_VOID
} /* end H5S__hyper_free_span_info() */
@@ -1569,10 +3149,10 @@ done:
PURPOSE
Free a hyperslab span node
USAGE
- herr_t H5S__hyper_free_span(span)
+ void H5S__hyper_free_span(span)
H5S_hyper_span_t *span; IN: Span node to free
RETURNS
- Non-negative on success, negative on failure
+ None
DESCRIPTION
Free a hyperslab span node, along with the 'down spans' from the node,
if reducing their reference count to zero indicates it is appropriate to
@@ -1582,25 +3162,22 @@ done:
EXAMPLES
REVISION LOG
--------------------------------------------------------------------------*/
-static herr_t
+static void
H5S__hyper_free_span(H5S_hyper_span_t *span)
{
- herr_t ret_value = SUCCEED;
-
- FUNC_ENTER_STATIC
+ FUNC_ENTER_STATIC_NOERR
+ /* Sanity check */
HDassert(span);
/* Decrement the reference count of the 'down spans', freeing them if appropriate */
if(span->down != NULL)
- if(H5S__hyper_free_span_info(span->down) < 0)
- HGOTO_ERROR(H5E_INTERNAL, H5E_CANTFREE, FAIL, "failed to release hyperslab span tree")
+ H5S__hyper_free_span_info(span->down);
/* Free this span */
span = H5FL_FREE(H5S_hyper_span_t, span);
-done:
- FUNC_LEAVE_NOAPI(ret_value)
+ FUNC_LEAVE_NOAPI_VOID
} /* end H5S__hyper_free_span() */
@@ -1610,11 +3187,12 @@ done:
PURPOSE
Copy a selection from one dataspace to another
USAGE
- herr_t H5S__hyper_copy(dst, src)
+ herr_t H5S__hyper_copy(dst, src, share_selection)
H5S_t *dst; OUT: Pointer to the destination dataspace
H5S_t *src; IN: Pointer to the source dataspace
+ hbool_t; IN: Whether to share the selection between the dataspaces
RETURNS
- Non-negative on success/Negative on failure
+ Non-negative on success, negative on failure
DESCRIPTION
Copies all the hyperslab selection information from the source
dataspace to the destination dataspace.
@@ -1651,15 +3229,8 @@ H5S__hyper_copy(H5S_t *dst, const H5S_t *src, hbool_t share_selection)
/* Copy the hyperslab information */
dst_hslab->diminfo_valid = src_hslab->diminfo_valid;
- if(src_hslab->diminfo_valid) {
- size_t u; /* Local index variable */
-
- for(u=0; u<src->extent.rank; u++) {
- dst_hslab->opt_diminfo[u]=src_hslab->opt_diminfo[u];
- dst_hslab->app_diminfo[u]=src_hslab->app_diminfo[u];
- } /* end for */
- } /* end if */
- dst->select.sel_info.hslab->span_lst=src->select.sel_info.hslab->span_lst;
+ if(src_hslab->diminfo_valid == H5S_DIMINFO_VALID_YES)
+ H5MM_memcpy(&dst_hslab->diminfo, &src_hslab->diminfo, sizeof(H5S_hyper_diminfo_t));
/* Check if there is hyperslab span information to copy */
/* (Regular hyperslab information is copied with the selection structure) */
@@ -1671,7 +3242,7 @@ H5S__hyper_copy(H5S_t *dst, const H5S_t *src, hbool_t share_selection)
} /* end if */
else
/* Copy the hyperslab span information */
- dst->select.sel_info.hslab->span_lst = H5S__hyper_copy_span(src->select.sel_info.hslab->span_lst);
+ dst->select.sel_info.hslab->span_lst = H5S__hyper_copy_span(src->select.sel_info.hslab->span_lst, src->extent.rank);
} /* end if */
else
dst->select.sel_info.hslab->span_lst = NULL;
@@ -1687,18 +3258,16 @@ done:
/*--------------------------------------------------------------------------
NAME
- H5S__hyper_is_valid_helper
+ H5S__hyper_is_valid
PURPOSE
Check whether the selection fits within the extent, with the current
offset defined.
USAGE
- hbool_t H5S__hyper_is_valid_helper(spans, offset, rank);
- const H5S_hyper_span_info_t *spans; IN: Pointer to current hyperslab span tree
- const hssize_t *offset; IN: Pointer to offset array
- const hsize_t *size; IN: Pointer to size array
- hsize_t rank; IN: Current rank looking at
+ htri_t H5S__hyper_is_valid(space);
+ H5S_t *space; IN: Dataspace pointer to query
RETURNS
- TRUE if the selection fits within the extent, FALSE if it does not
+ TRUE if the selection fits within the extent, FALSE if it does not and
+ Negative on an error.
DESCRIPTION
Determines if the current selection at the current offset fits within the
extent for the dataspace.
@@ -1707,109 +3276,109 @@ done:
EXAMPLES
REVISION LOG
--------------------------------------------------------------------------*/
-static hbool_t
-H5S__hyper_is_valid_helper(const H5S_hyper_span_info_t *spans, const hssize_t *offset,
- const hsize_t *size)
+static htri_t
+H5S__hyper_is_valid(const H5S_t *space)
{
- H5S_hyper_span_t *curr; /* Hyperslab information nodes */
- hbool_t ret_value = TRUE; /* Return value */
+ const hsize_t *low_bounds, *high_bounds; /* Pointers to the correct pair of low & high bounds */
+ unsigned u; /* Counter */
+ htri_t ret_value = TRUE; /* return value */
FUNC_ENTER_STATIC_NOERR
- HDassert(spans);
- HDassert(offset);
- HDassert(size);
+ HDassert(space);
- /* Check each point to determine whether selection + offset is within extent */
- curr = spans->head;
- while(curr != NULL) {
- /* Check if an offset has been defined */
- /* Bounds check the selected point + offset against the extent */
- if((((hssize_t)curr->low + *offset) >= (hssize_t)*size)
- || (((hssize_t)curr->low + *offset) < 0)
- || (((hssize_t)curr->high + *offset) >= (hssize_t)*size)
- || (((hssize_t)curr->high + *offset) < 0))
- HGOTO_DONE(FALSE)
+ /* Check for unlimited selection */
+ if(space->select.sel_info.hslab->unlim_dim >= 0)
+ HGOTO_DONE(FALSE)
- /* Recurse if this node has down spans */
- if(curr->down != NULL)
- if(!H5S__hyper_is_valid_helper(curr->down, offset + 1, size + 1))
- HGOTO_DONE(FALSE)
+ /* Check which set of low & high bounds we should be using */
+ if(space->select.sel_info.hslab->diminfo_valid == H5S_DIMINFO_VALID_YES) {
+ low_bounds = space->select.sel_info.hslab->diminfo.low_bounds;
+ high_bounds = space->select.sel_info.hslab->diminfo.high_bounds;
+ } /* end if */
+ else {
+ low_bounds = space->select.sel_info.hslab->span_lst->low_bounds;
+ high_bounds = space->select.sel_info.hslab->span_lst->high_bounds;
+ } /* end else */
- /* Advance to next node */
- curr = curr->next;
- } /* end while */
+ /* Check each dimension */
+ for(u = 0; u < space->extent.rank; u++) {
+ /* Bounds check the selected point + offset against the extent */
+ if(((hssize_t)low_bounds[u] + space->select.offset[u]) < 0)
+ HGOTO_DONE(FALSE)
+ if((high_bounds[u] + (hsize_t)space->select.offset[u]) >= space->extent.size[u])
+ HGOTO_DONE(FALSE)
+ } /* end for */
done:
FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5S__hyper_is_valid_helper() */
+} /* end H5S__hyper_is_valid() */
/*--------------------------------------------------------------------------
NAME
- H5S__hyper_is_valid
+ H5S__hyper_span_nblocks_helper
PURPOSE
- Check whether the selection fits within the extent, with the current
- offset defined.
+ Helper routine to count the number of blocks in a span tree
USAGE
- htri_t H5S__hyper_is_valid(space);
- H5S_t *space; IN: Dataspace pointer to query
+ hsize_t H5S__hyper_span_nblocks_helper(spans)
+ H5S_hyper_span_info_t *spans; IN: Hyperslab span tree to count blocks of
+ uint64_t op_gen; IN: Operation generation
RETURNS
- TRUE if the selection fits within the extent, FALSE if it does not and
- Negative on an error.
+ Number of blocks in span tree on success; negative on failure
DESCRIPTION
- Determines if the current selection at the current offset fits within the
- extent for the dataspace.
+ Counts the number of blocks described by the spans in a span tree.
GLOBAL VARIABLES
COMMENTS, BUGS, ASSUMPTIONS
EXAMPLES
REVISION LOG
--------------------------------------------------------------------------*/
-static htri_t
-H5S__hyper_is_valid(const H5S_t *space)
+static hsize_t
+H5S__hyper_span_nblocks_helper(H5S_hyper_span_info_t *spans, uint64_t op_gen)
{
- htri_t ret_value = TRUE; /* return value */
+ hsize_t ret_value = 0; /* Return value */
FUNC_ENTER_STATIC_NOERR
- HDassert(space);
+ /* Sanity check */
+ HDassert(spans);
- /* Check for unlimited selection */
- if(space->select.sel_info.hslab->unlim_dim >= 0)
- HGOTO_DONE(FALSE)
+ /* Check if the span tree was already counted */
+ if(spans->op_gen == op_gen)
+ /* Just return the # of blocks in the already counted span tree */
+ ret_value = spans->u.nblocks;
+ else { /* Count the number of elements in the span tree */
+ H5S_hyper_span_t *span; /* Hyperslab span */
- /* Check for a "regular" hyperslab selection */
- if(space->select.sel_info.hslab->diminfo_valid) {
- const H5S_hyper_dim_t *diminfo=space->select.sel_info.hslab->opt_diminfo; /* local alias for diminfo */
- hssize_t end; /* The high bound of a region in a dimension */
- unsigned u; /* Counter */
+ span = spans->head;
+ if(span->down) {
+ while(span) {
+ /* If there are down spans, add the total down span blocks */
+ ret_value += H5S__hyper_span_nblocks_helper(span->down, op_gen);
- /* Check each dimension */
- for(u = 0; u < space->extent.rank; u++) {
- /* if block or count is zero, then can skip the test since */
- /* no data point is chosen */
- if(diminfo[u].count && diminfo[u].block) {
- /* Bounds check the start point in this dimension */
- if(((hssize_t)diminfo[u].start + space->select.offset[u]) < 0 ||
- ((hssize_t)diminfo[u].start + space->select.offset[u]) >= (hssize_t)space->extent.size[u])
- HGOTO_DONE(FALSE)
+ /* Advance to next span */
+ span = span->next;
+ } /* end while */
+ } /* end if */
+ else {
+ while(span) {
+ /* If there are no down spans, just count the block in this span */
+ ret_value++;
- /* Compute the largest location in this dimension */
- end = (hssize_t)(diminfo[u].start + diminfo[u].stride * (diminfo[u].count - 1) + (diminfo[u].block - 1)) + space->select.offset[u];
+ /* Advance to next span */
+ span = span->next;
+ } /* end while */
+ } /* end else */
- /* Bounds check the end point in this dimension */
- if(end < 0 || end >= (hssize_t)space->extent.size[u])
- HGOTO_DONE(FALSE)
- } /* end if */
- } /* end for */
- } /* end if */
- else
- /* Call the recursive routine to validate the span tree */
- ret_value = H5S__hyper_is_valid_helper(space->select.sel_info.hslab->span_lst, space->select.offset, space->extent.size);
+ /* Set the operation generation for this span tree, to avoid re-computing */
+ spans->op_gen = op_gen;
+
+ /* Hold a copy of the # of blocks */
+ spans->u.nblocks = ret_value;
+ } /* end else */
-done:
FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5S__hyper_is_valid() */
+} /* end H5S__hyper_span_nblocks_helper() */
/*--------------------------------------------------------------------------
@@ -1819,7 +3388,7 @@ done:
Count the number of blocks in a span tree
USAGE
hsize_t H5S__hyper_span_nblocks(spans)
- const H5S_hyper_span_info_t *spans; IN: Hyperslab span tree to count elements of
+ H5S_hyper_span_info_t *spans; IN: Hyperslab span tree to count blocks of
RETURNS
Number of blocks in span tree on success; negative on failure
DESCRIPTION
@@ -1830,7 +3399,7 @@ done:
REVISION LOG
--------------------------------------------------------------------------*/
static hsize_t
-H5S__hyper_span_nblocks(const H5S_hyper_span_info_t *spans)
+H5S__hyper_span_nblocks(H5S_hyper_span_info_t *spans)
{
hsize_t ret_value = 0; /* Return value */
@@ -1838,21 +3407,13 @@ H5S__hyper_span_nblocks(const H5S_hyper_span_info_t *spans)
/* Count the number of elements in the span tree */
if(spans != NULL) {
- H5S_hyper_span_t *span; /* Hyperslab span */
+ uint64_t op_gen; /* Operation generation value */
- span = spans->head;
- while(span != NULL) {
- /* If there are down spans, add the total down span blocks */
- if(span->down != NULL)
- ret_value += H5S__hyper_span_nblocks(span->down);
- /* If there are no down spans, just count the block in this span */
- else
- ret_value++;
+ /* Acquire an operation generation value for this operation */
+ op_gen = H5S__hyper_get_op_gen();
- /* Advance to next span */
- span = span->next;
- } /* end while */
- } /* end else */
+ ret_value = H5S__hyper_span_nblocks_helper(spans, op_gen);
+ } /* end if */
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5S__hyper_span_nblocks() */
@@ -1864,8 +3425,9 @@ H5S__hyper_span_nblocks(const H5S_hyper_span_info_t *spans)
PURPOSE
Get the number of hyperslab blocks in current hyperslab selection
USAGE
- hsize_t H5S__get_select_hyper_nblocks(space)
+ hsize_t H5S__get_select_hyper_nblocks(space, app_ref)
H5S_t *space; IN: Dataspace ptr of selection to query
+ hbool_t app_ref; IN: Whether this is an appl. ref. call
RETURNS
The number of hyperslab blocks in selection on success, negative on failure
DESCRIPTION
@@ -1876,7 +3438,7 @@ H5S__hyper_span_nblocks(const H5S_hyper_span_info_t *spans)
REVISION LOG
--------------------------------------------------------------------------*/
static hsize_t
-H5S__get_select_hyper_nblocks(const H5S_t *space)
+H5S__get_select_hyper_nblocks(const H5S_t *space, hbool_t app_ref)
{
hsize_t ret_value = 0; /* Return value */
@@ -1886,12 +3448,14 @@ H5S__get_select_hyper_nblocks(const H5S_t *space)
HDassert(space->select.sel_info.hslab->unlim_dim < 0);
/* Check for a "regular" hyperslab selection */
- if(space->select.sel_info.hslab->diminfo_valid) {
+ /* (No need to rebuild the dimension info yet -QAK) */
+ if(space->select.sel_info.hslab->diminfo_valid == H5S_DIMINFO_VALID_YES) {
unsigned u; /* Local index variable */
/* Check each dimension */
for(ret_value = 1, u = 0; u < space->extent.rank; u++)
- ret_value *= space->select.sel_info.hslab->app_diminfo[u].count;
+ ret_value *= (app_ref ? space->select.sel_info.hslab->diminfo.app[u].count :
+ space->select.sel_info.hslab->diminfo.opt[u].count);
} /* end if */
else
ret_value = H5S__hyper_span_nblocks(space->select.sel_info.hslab->span_lst);
@@ -1934,7 +3498,7 @@ H5Sget_select_hyper_nblocks(hid_t spaceid)
if(space->select.sel_info.hslab->unlim_dim >= 0)
HGOTO_ERROR(H5E_DATASPACE, H5E_UNSUPPORTED, FAIL, "cannot get number of blocks for unlimited selection")
- ret_value = (hssize_t)H5S__get_select_hyper_nblocks(space);
+ ret_value = (hssize_t)H5S__get_select_hyper_nblocks(space, TRUE);
done:
FUNC_LEAVE_API(ret_value)
@@ -1943,6 +3507,207 @@ done:
/*--------------------------------------------------------------------------
NAME
+ H5S__hyper_get_enc_size_real
+ PURPOSE
+ Determine the size to encode the hyperslab selection info
+ USAGE
+ hssize_t H5S__hyper_get_enc_size_real(max_size, enc_size)
+ hsize_t max_size: IN: The maximum size of the hyperslab selection info
+ unint8_t *enc_size: OUT:The encoding size
+ RETURNS
+ The size to encode hyperslab selection info
+ DESCRIPTION
+ Determine the size by comparing "max_size" with (2^32 - 1) and (2^16 - 1).
+ GLOBAL VARIABLES
+ COMMENTS, BUGS, ASSUMPTIONS
+ EXAMPLES
+ REVISION LOG
+--------------------------------------------------------------------------*/
+static uint8_t
+H5S__hyper_get_enc_size_real(hsize_t max_size)
+{
+ uint8_t ret_value = H5S_SELECT_INFO_ENC_SIZE_2;
+
+ FUNC_ENTER_STATIC_NOERR
+
+ if(max_size > H5S_UINT32_MAX)
+ ret_value = H5S_SELECT_INFO_ENC_SIZE_8;
+ else if(max_size > H5S_UINT16_MAX)
+ ret_value = H5S_SELECT_INFO_ENC_SIZE_4;
+ else
+ ret_value = H5S_SELECT_INFO_ENC_SIZE_2;
+
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* H5S__hyper_get_enc_size_real() */
+
+
+/*--------------------------------------------------------------------------
+ NAME
+ H5S__hyper_get_version_enc_size
+ PURPOSE
+ Determine the version and encoded size to use for encoding hyperslab selection info
+ USAGE
+ hssize_t H5S__hyper_get_version_enc_size(space, block_count, version, enc_size)
+ const H5S_t *space: IN: The dataspace
+ hsize_t block_count: IN: The number of blocks in the selection
+ uint32_t *version: OUT: The version to use for encoding
+ uint8_t *enc_size: OUT: The encoded size to use
+
+ RETURNS
+ The version and the size to encode hyperslab selection info
+ DESCRIPTION
+ Determine the version to use for encoding hyperslab selection info based
+ on the following:
+ (1) the file format setting in fapl
+ (2) whether the number of blocks or selection high bounds exceeds H5S_UINT32_MAX or not
+
+ Determine the encoded size based on version:
+ For version 3, the encoded size is determined according to:
+ (a) regular hyperslab
+ (1) The maximum needed to store start/stride/count/block
+ (2) Special handling for count/block: need to provide room for H5S_UNLIMITED
+ (b) irregular hyperslab
+ The maximum size needed to store:
+ (1) the number of blocks
+ (2) the selection high bounds
+ GLOBAL VARIABLES
+ COMMENTS, BUGS, ASSUMPTIONS
+ EXAMPLES
+ REVISION LOG
+--------------------------------------------------------------------------*/
+static herr_t
+H5S__hyper_get_version_enc_size(const H5S_t *space, hsize_t block_count, uint32_t *version, uint8_t *enc_size)
+{
+ hsize_t bounds_start[H5S_MAX_RANK]; /* Starting coordinate of bounding box */
+ hsize_t bounds_end[H5S_MAX_RANK]; /* Opposite coordinate of bounding box */
+ hbool_t count_up_version = FALSE; /* Whether number of blocks exceed H5S_UINT32_MAX */
+ hbool_t bound_up_version = FALSE; /* Whether high bounds exceed H5S_UINT32_MAX */
+ H5F_libver_t low_bound; /* The 'low' bound of library format versions */
+ H5F_libver_t high_bound; /* The 'high' bound of library format versions */
+ htri_t is_regular; /* A regular hyperslab or not */
+ uint32_t tmp_version; /* Local temporay version */
+ unsigned u; /* Local index variable */
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_STATIC
+
+ /* Get bounding box for the selection */
+ HDmemset(bounds_end, 0, sizeof(bounds_end));
+
+ if(space->select.sel_info.hslab->unlim_dim < 0) /* ! H5S_UNLIMITED */
+ /* Get bounding box for the selection */
+ if(H5S__hyper_bounds(space, bounds_start, bounds_end) < 0)
+ HGOTO_ERROR(H5E_DATASPACE, H5E_CANTGET, FAIL, "can't get selection bounds")
+
+ /* Determine whether the number of blocks or the high bounds in the selection exceed (2^32 - 1) */
+ if(block_count > H5S_UINT32_MAX)
+ count_up_version = TRUE;
+ else {
+ for(u = 0; u < space->extent.rank; u++)
+ if(bounds_end[u] > H5S_UINT32_MAX) {
+ bound_up_version = TRUE;
+ break;
+ } /* end if */
+ } /* end else */
+
+ /* Get the file's low_bound and high_bound */
+ if(H5CX_get_libver_bounds(&low_bound, &high_bound) < 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get low/high bounds from API context")
+
+ /* Determine regular hyperslab */
+ is_regular = H5S__hyper_is_regular(space);
+
+ if(low_bound >= H5F_LIBVER_V112 || space->select.sel_info.hslab->unlim_dim >= 0)
+ tmp_version = MAX(H5S_HYPER_VERSION_2, H5O_sds_hyper_ver_bounds[low_bound]);
+ else {
+ if(count_up_version || bound_up_version)
+ tmp_version = is_regular ? H5S_HYPER_VERSION_2 : H5S_HYPER_VERSION_3;
+ else
+ tmp_version = (is_regular && block_count >= 4) ? H5O_sds_hyper_ver_bounds[low_bound] : H5S_HYPER_VERSION_1;
+ } /* end else */
+
+ /* Version bounds check */
+ if(tmp_version > H5O_sds_hyper_ver_bounds[high_bound]) {
+ /* Fail for irregular hyperslab if exceeds 32 bits */
+ if(count_up_version)
+ HGOTO_ERROR(H5E_DATASPACE, H5E_BADVALUE, FAIL, "The number of blocks in hyperslab selection exceeds 2^32")
+ else if(bound_up_version)
+ HGOTO_ERROR(H5E_DATASPACE, H5E_BADVALUE, FAIL, "The end of bounding box in hyperslab selection exceeds 2^32")
+ else
+ HGOTO_ERROR(H5E_DATASPACE, H5E_BADRANGE, FAIL, "Dataspace hyperslab selection version out of bounds")
+ } /* end if */
+
+ /* Set the message version */
+ *version = tmp_version;
+
+ /* Determine the encoded size based on version */
+ switch(tmp_version) {
+ case H5S_HYPER_VERSION_1:
+ *enc_size = H5S_SELECT_INFO_ENC_SIZE_4;
+ break;
+
+ case H5S_HYPER_VERSION_2:
+ *enc_size = H5S_SELECT_INFO_ENC_SIZE_8;
+ break;
+
+ case H5S_HYPER_VERSION_3:
+ if(is_regular) {
+ uint8_t enc1, enc2;
+ hsize_t max1 = 0;
+ hsize_t max2 = 0;
+
+ /* Find max for count[] and block[] */
+ for(u = 0; u < space->extent.rank; u++) {
+ if(space->select.sel_info.hslab->diminfo.opt[u].count != H5S_UNLIMITED &&
+ space->select.sel_info.hslab->diminfo.opt[u].count > max1)
+ max1 = space->select.sel_info.hslab->diminfo.opt[u].count;
+ if(space->select.sel_info.hslab->diminfo.opt[u].block != H5S_UNLIMITED &&
+ space->select.sel_info.hslab->diminfo.opt[u].block > max1)
+ max1 = space->select.sel_info.hslab->diminfo.opt[u].block;
+ } /* end for */
+
+ /* +1 to provide room for H5S_UNLIMITED */
+ enc1 = H5S__hyper_get_enc_size_real(++max1);
+
+ /* Find max for start[] and stride[] */
+ for(u = 0; u < space->extent.rank; u++) {
+ if(space->select.sel_info.hslab->diminfo.opt[u].start > max2)
+ max2 = space->select.sel_info.hslab->diminfo.opt[u].start;
+ if(space->select.sel_info.hslab->diminfo.opt[u].stride > max2)
+ max2 = space->select.sel_info.hslab->diminfo.opt[u].stride;
+ } /* end for */
+
+ /* Determine the encoding size */
+ enc2 = H5S__hyper_get_enc_size_real(max2);
+
+ *enc_size = MAX(enc1, enc2);
+ } /* end if */
+ else {
+ hsize_t max_size = block_count;
+ HDassert(space->select.sel_info.hslab->unlim_dim < 0);
+
+ /* Find max for block_count and bounds_end[] */
+ for(u = 0; u < space->extent.rank; u++)
+ if(bounds_end[u] > max_size)
+ max_size = bounds_end[u];
+
+ /* Determine the encoding size */
+ *enc_size = H5S__hyper_get_enc_size_real(max_size);
+ } /* end else */
+ break;
+
+ default:
+ HGOTO_ERROR(H5E_DATASPACE, H5E_UNSUPPORTED, FAIL, "unknown hyperslab selection version")
+ break;
+ } /* end switch */
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* H5S__hyper_get_version_enc_size() */
+
+
+/*--------------------------------------------------------------------------
+ NAME
H5S__hyper_serial_size
PURPOSE
Determine the number of bytes needed to store the serialized hyperslab
@@ -1963,49 +3728,74 @@ done:
static hssize_t
H5S__hyper_serial_size(const H5S_t *space)
{
- hsize_t block_count; /* block counter for regular hyperslabs */
- unsigned u; /* Counter */
- hssize_t ret_value = -1; /* return value */
+ hsize_t block_count = 0; /* block counter for regular hyperslabs */
+ uint32_t version; /* Version number */
+ uint8_t enc_size; /* Encoded size of hyerslab selection info */
+ hssize_t ret_value = -1; /* return value */
- FUNC_ENTER_STATIC_NOERR
+ FUNC_ENTER_STATIC
HDassert(space);
- /* Check for version (right now, an unlimited dimension is the only thing
- * that would bump the version) */
- if(space->select.sel_info.hslab->unlim_dim >= 0)
+ if(space->select.sel_info.hslab->unlim_dim < 0) /* ! H5S_UNLIMITED */
+ block_count = H5S__get_select_hyper_nblocks(space, FALSE);
+
+ /* Determine the version and the encoded size */
+ if(H5S__hyper_get_version_enc_size(space, block_count, &version, &enc_size) < 0)
+ HGOTO_ERROR(H5E_DATASPACE, H5E_CANTGET, FAIL, "can't determine hyper version & enc_size")
+
+ if(version == H5S_HYPER_VERSION_3) {
+ /* Version 3: regular */
+ /* Size required is always:
+ * <type (4 bytes)> + <version (4 bytes)> + <flags (1 byte)> +
+ * <size of offset info (1 byte)> + <rank (4 bytes)> +
+ * (4 (start/stride/count/block) * <enc_size> * <rank>) =
+ * 14 + (4 * enc_size * rank) bytes
+ */
+ if(H5S__hyper_is_regular(space))
+ ret_value = (hssize_t)14 +
+ ((hssize_t)4 * (hssize_t)enc_size * (hssize_t)space->extent.rank);
+ else {
+ /* Version 3: irregular */
+ /* Size required is always:
+ * <type (4 bytes)> + <version (4 bytes)> + <flags (1 byte)> +
+ * <size of offset info (1 byte)> + <rank (4 bytes)> +
+ * < # of blocks (depend on enc_size) > +
+ * (2 (starting/ending offset) * <rank> * <enc_size> * <# of blocks) =
+ * = 14 bytes + enc_size (block_count) + (2 * enc_size * rank * block_count) bytes
+ */
+ ret_value = 14 + enc_size;
+ H5_CHECK_OVERFLOW(((unsigned)2 * enc_size * space->extent.rank * block_count), hsize_t, hssize_t);
+ ret_value += (hssize_t)((unsigned)2 * enc_size * space->extent.rank * block_count);
+ } /* end else */
+ } /* end if */
+ else if(version == H5S_HYPER_VERSION_2) {
/* Version 2 */
/* Size required is always:
* <type (4 bytes)> + <version (4 bytes)> + <flags (1 byte)> +
* <length (4 bytes)> + <rank (4 bytes)> +
- * (4 (start/stride/count/block) * <rank> * <value (8 bytes)>) =
- * 17 + (4 * rank * 8) bytes
+ * (4 (start/stride/count/block) * <enc_size (8 bytes)> * <rank>) =
+ * 17 + (4 * 8 * rank) bytes
*/
- ret_value = (hssize_t)17 + ((hssize_t)4 * (hssize_t)space->extent.rank
- * (hssize_t)8);
+ HDassert(enc_size == 8);
+ ret_value = (hssize_t)17 + ((hssize_t)4 * (hssize_t)8 * (hssize_t)space->extent.rank);
+ } /* end else-if */
else {
+ HDassert(version == H5S_HYPER_VERSION_1);
+ HDassert(enc_size == 4);
/* Version 1 */
/* Basic number of bytes required to serialize hyperslab selection:
* <type (4 bytes)> + <version (4 bytes)> + <padding (4 bytes)> +
- * <length (4 bytes)> + <rank (4 bytes)> + <# of blocks (4 bytes)>
- * = 24 bytes
+ * <length (4 bytes)> + <rank (4 bytes)> + <# of blocks (4 bytes)> +
+ * (2 (starting/ending offset) * <enc_size (4 bytes)> * <rank> * <# of blocks) =
+ * = 24 bytes + (2 * 4 * rank * block_count)
*/
ret_value = 24;
-
- /* Check for a "regular" hyperslab selection */
- if(space->select.sel_info.hslab->diminfo_valid) {
- /* Check each dimension */
- for(block_count = 1, u = 0; u < space->extent.rank; u++)
- block_count *= space->select.sel_info.hslab->opt_diminfo[u].count;
- } /* end if */
- else
- /* Spin through hyperslab spans, adding 8 * rank bytes for each block */
- block_count = H5S__hyper_span_nblocks(space->select.sel_info.hslab->span_lst);
-
H5_CHECK_OVERFLOW((8 * space->extent.rank * block_count), hsize_t, hssize_t);
- ret_value += (hssize_t)(8 * block_count * space->extent.rank);
+ ret_value += (hssize_t)(8 * space->extent.rank * block_count);
} /* end else */
+done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5S__hyper_serial_size() */
@@ -2016,12 +3806,13 @@ H5S__hyper_serial_size(const H5S_t *space)
PURPOSE
Serialize the current selection into a user-provided buffer.
USAGE
- void H5S__hyper_serialize_helper(spans, start, end, rank, buf)
+ void H5S__hyper_serialize_helper(spans, start, end, rank, enc_size, buf)
H5S_hyper_span_info_t *spans; IN: Hyperslab span tree to serialize
hssize_t start[]; IN/OUT: Accumulated start points
hssize_t end[]; IN/OUT: Accumulated end points
hsize_t rank; IN: Current rank looking at
- uint8 *buf; OUT: Buffer to put serialized selection into
+ uint8_t enc_size IN: Encoded size of hyperslab selection info
+ uint8_t *buf; OUT: Buffer to put serialized selection into
RETURNS
None
DESCRIPTION
@@ -2034,7 +3825,7 @@ H5S__hyper_serial_size(const H5S_t *space)
--------------------------------------------------------------------------*/
static void
H5S__hyper_serialize_helper(const H5S_hyper_span_info_t *spans,
- hsize_t *start, hsize_t *end, hsize_t rank, uint8_t **p)
+ hsize_t *start, hsize_t *end, hsize_t rank, uint8_t enc_size, uint8_t **p)
{
H5S_hyper_span_t *curr; /* Pointer to current hyperslab span */
uint8_t *pp = (*p); /* Local pointer for decoding */
@@ -2045,7 +3836,7 @@ H5S__hyper_serialize_helper(const H5S_hyper_span_info_t *spans,
HDassert(spans);
HDassert(start);
HDassert(end);
- HDassert(rank < H5O_LAYOUT_NDIMS);
+ HDassert(rank < H5S_MAX_RANK);
HDassert(p && pp);
/* Walk through the list of spans, recursing or outputting them */
@@ -2058,26 +3849,65 @@ H5S__hyper_serialize_helper(const H5S_hyper_span_info_t *spans,
end[rank] = curr->high;
/* Recurse down to the next dimension */
- H5S__hyper_serialize_helper(curr->down, start, end, rank + 1, &pp);
+ H5S__hyper_serialize_helper(curr->down, start, end, rank + 1, enc_size, &pp);
} /* end if */
else {
hsize_t u; /* Index variable */
/* Encode all the previous dimensions starting & ending points */
+ switch(enc_size) {
+ case H5S_SELECT_INFO_ENC_SIZE_2:
+ /* Encode previous starting points */
+ for(u=0; u<rank; u++)
+ UINT16ENCODE(pp, (uint16_t)start[u]);
- /* Encode previous starting points */
- for(u = 0; u < rank; u++)
- UINT32ENCODE(pp, (uint32_t)start[u]);
+ /* Encode starting point for this span */
+ UINT16ENCODE(pp, (uint16_t)curr->low);
- /* Encode starting point for this span */
- UINT32ENCODE(pp, (uint32_t)curr->low);
+ /* Encode previous ending points */
+ for(u=0; u<rank; u++)
+ UINT16ENCODE(pp, (uint16_t)end[u]);
- /* Encode previous ending points */
- for(u = 0; u < rank; u++)
- UINT32ENCODE(pp, (uint32_t)end[u]);
+ /* Encode starting point for this span */
+ UINT16ENCODE(pp, (uint16_t)curr->high);
+ break;
+
+ case H5S_SELECT_INFO_ENC_SIZE_4:
+ /* Encode previous starting points */
+ for(u=0; u<rank; u++)
+ UINT32ENCODE(pp, (uint32_t)start[u]);
+
+ /* Encode starting point for this span */
+ UINT32ENCODE(pp, (uint32_t)curr->low);
+
+ /* Encode previous ending points */
+ for(u=0; u<rank; u++)
+ UINT32ENCODE(pp, (uint32_t)end[u]);
+
+ /* Encode starting point for this span */
+ UINT32ENCODE(pp, (uint32_t)curr->high);
+ break;
+
+ case H5S_SELECT_INFO_ENC_SIZE_8:
+ /* Encode previous starting points */
+ for(u=0; u<rank; u++)
+ UINT64ENCODE(pp, (uint64_t)start[u]);
+
+ /* Encode starting point for this span */
+ UINT64ENCODE(pp, (uint64_t)curr->low);
- /* Encode starting point for this span */
- UINT32ENCODE(pp, (uint32_t)curr->high);
+ /* Encode previous ending points */
+ for(u=0; u<rank; u++)
+ UINT64ENCODE(pp, (uint64_t)end[u]);
+
+ /* Encode starting point for this span */
+ UINT64ENCODE(pp, (uint64_t)curr->high);
+ break;
+
+ default:
+ HDassert(0 && "Unknown enc size?!?");
+
+ } /* end switch */
} /* end else */
/* Advance to next node */
@@ -2088,7 +3918,7 @@ H5S__hyper_serialize_helper(const H5S_hyper_span_info_t *spans,
*p = pp;
FUNC_LEAVE_NOAPI_VOID
-} /* H5S__hyper_serialize_helper() */
+} /* end H5S__hyper_serialize_helper() */
/*--------------------------------------------------------------------------
@@ -2115,14 +3945,26 @@ H5S__hyper_serialize_helper(const H5S_hyper_span_info_t *spans,
static herr_t
H5S__hyper_serialize(const H5S_t *space, uint8_t **p)
{
- uint8_t *pp; /* Local pointer for decoding */
- uint8_t *lenp; /* Pointer to length location for later storage */
- uint32_t len = 0; /* Number of bytes used */
+ const H5S_hyper_dim_t *diminfo; /* Alias for dataspace's diminfo information */
+ hsize_t tmp_count[H5S_MAX_RANK]; /* Temporary hyperslab counts */
+ hsize_t offset[H5S_MAX_RANK]; /* Offset of element in dataspace */
+ hsize_t start[H5S_MAX_RANK]; /* Location of start of hyperslab */
+ hsize_t end[H5S_MAX_RANK]; /* Location of end of hyperslab */
+ uint8_t *pp; /* Local pointer for decoding */
+ uint8_t *lenp = NULL; /* pointer to length location for later storage */
+ uint32_t len = 0; /* number of bytes used */
uint32_t version; /* Version number */
uint8_t flags = 0; /* Flags for message */
- hsize_t block_count; /* Block counter for regular hyperslabs */
+ hsize_t block_count = 0; /* block counter for regular hyperslabs */
+ unsigned fast_dim; /* Rank of the fastest changing dimension for the dataspace */
+ unsigned ndims; /* Rank of the dataspace */
+ unsigned u; /* Local counting variable */
+ hbool_t complete = FALSE; /* Whether we are done with the iteration */
+ hbool_t is_regular; /* Whether selection is regular */
+ uint8_t enc_size;
+ herr_t ret_value = SUCCEED; /* return value */
- FUNC_ENTER_STATIC_NOERR
+ FUNC_ENTER_STATIC
/* Sanity checks */
HDassert(space);
@@ -2130,161 +3972,228 @@ H5S__hyper_serialize(const H5S_t *space, uint8_t **p)
pp = (*p);
HDassert(pp);
- /* Calculate version */
- if(space->select.sel_info.hslab->unlim_dim >= 0) {
- version = 2;
- flags |= H5S_SELECT_FLAG_UNLIM;
- } /* end if */
- else
- version = 1;
+ /* Set some convienence values */
+ ndims = space->extent.rank;
+ diminfo = space->select.sel_info.hslab->diminfo.opt;
+
+ if(space->select.sel_info.hslab->unlim_dim < 0) /* ! H5S_UNLIMITED */
+ block_count = H5S__get_select_hyper_nblocks(space, FALSE);
+
+ /* Determine the version and the encoded size */
+ if(H5S__hyper_get_version_enc_size(space, block_count, &version, &enc_size) < 0)
+ HGOTO_ERROR(H5E_DATASPACE, H5E_CANTGET, FAIL, "can't determine hyper version & enc_size")
+
+ is_regular = H5S__hyper_is_regular(space);
+ if(is_regular &&
+ (version == H5S_HYPER_VERSION_2 || version == H5S_HYPER_VERSION_3))
+ flags |= H5S_HYPER_REGULAR;
/* Store the preamble information */
UINT32ENCODE(pp, (uint32_t)H5S_GET_SELECT_TYPE(space)); /* Store the type of selection */
UINT32ENCODE(pp, version); /* Store the version number */
- if(version >= 2)
- *(pp)++ = flags; /* Store the flags */
- else
- UINT32ENCODE(pp, (uint32_t)0); /* Store the un-used padding */
- lenp = pp; /* keep the pointer to the length location for later */
- pp += 4; /* skip over space for length */
- /* Encode number of dimensions */
- UINT32ENCODE(pp, (uint32_t)space->extent.rank);
- len += 4;
+ if(version >= 3) {
+ *(pp)++ = flags; /* Store the flags */
+ *(pp)++ = enc_size; /* Store size of offset info */
+ } /* end if */
+ else {
+ if(version == 2)
+ *(pp)++ = flags; /* Store the flags */
+ else
+ UINT32ENCODE(pp, (uint32_t)0); /* Store the un-used padding */
+ lenp = pp; /* keep the pointer to the length location for later */
+ pp += 4; /* skip over space for length */
- /* If there is an unlimited dimension, only encode opt_unlim_diminfo */
- if(flags & H5S_SELECT_FLAG_UNLIM) {
- unsigned i;
+ len += 4; /* ndims */
+ } /* end else */
- HDassert(H5S_UNLIMITED == HSIZE_UNDEF);
+ /* Encode number of dimensions */
+ UINT32ENCODE(pp, (uint32_t)ndims);
- /* Iterate over dimensions */
- for(i = 0; i < space->extent.rank; i++) {
+ if(is_regular) {
+ if(version >= H5S_HYPER_VERSION_2) {
+ HDassert(H5S_UNLIMITED == HSIZE_UNDEF);
+
+ /* Iterate over dimensions */
/* Encode start/stride/block/count */
- UINT64ENCODE(pp, space->select.sel_info.hslab->opt_diminfo[i].start);
- UINT64ENCODE(pp, space->select.sel_info.hslab->opt_diminfo[i].stride);
- UINT64ENCODE(pp, space->select.sel_info.hslab->opt_diminfo[i].count);
- UINT64ENCODE(pp, space->select.sel_info.hslab->opt_diminfo[i].block);
- } /* end for */
- } /* end if */
- /* Check for a "regular" hyperslab selection */
- else if(space->select.sel_info.hslab->diminfo_valid) {
- const H5S_hyper_dim_t *diminfo; /* Alias for dataspace's diminfo information */
- hsize_t offset[H5O_LAYOUT_NDIMS]; /* Offset of element in dataspace */
- hsize_t tmp_count[H5O_LAYOUT_NDIMS]; /* Temporary hyperslab counts */
- unsigned fast_dim; /* Rank of the fastest changing dimension for the dataspace */
- unsigned ndims; /* Rank of the dataspace */
- unsigned u; /* Local counting variable */
- hbool_t done; /* Whether we are done with the iteration */
+ switch(enc_size) {
+ case H5S_SELECT_INFO_ENC_SIZE_2:
+ HDassert(version == H5S_HYPER_VERSION_3);
+ for(u = 0; u < space->extent.rank; u++) {
+ UINT16ENCODE(pp, diminfo[u].start);
+ UINT16ENCODE(pp, diminfo[u].stride);
+ if(diminfo[u].count == H5S_UNLIMITED)
+ UINT16ENCODE(pp, H5S_UINT16_MAX)
+ else
+ UINT16ENCODE(pp, diminfo[u].count)
+ if(diminfo[u].block == H5S_UNLIMITED)
+ UINT16ENCODE(pp, H5S_UINT16_MAX)
+ else
+ UINT16ENCODE(pp, diminfo[u].block)
+ } /* end for */
+ break;
- /* Set some convenience values */
- ndims = space->extent.rank;
- fast_dim = ndims - 1;
- diminfo = space->select.sel_info.hslab->opt_diminfo;
+ case H5S_SELECT_INFO_ENC_SIZE_4:
+ HDassert(version == H5S_HYPER_VERSION_3);
+ for(u = 0; u < space->extent.rank; u++) {
+ UINT32ENCODE(pp, diminfo[u].start);
+ UINT32ENCODE(pp, diminfo[u].stride);
+ if(diminfo[u].count == H5S_UNLIMITED)
+ UINT32ENCODE(pp, H5S_UINT32_MAX)
+ else
+ UINT32ENCODE(pp, diminfo[u].count)
+ if(diminfo[u].block == H5S_UNLIMITED)
+ UINT32ENCODE(pp, H5S_UINT32_MAX)
+ else
+ UINT32ENCODE(pp, diminfo[u].block)
+ } /* end for */
+ break;
- /* Check each dimension */
- for(block_count = 1, u = 0; u < ndims; u++)
- block_count *= diminfo[u].count;
+ case H5S_SELECT_INFO_ENC_SIZE_8:
+ HDassert(version == H5S_HYPER_VERSION_2 || version == H5S_HYPER_VERSION_3);
+ for(u = 0; u < space->extent.rank; u++) {
+ UINT64ENCODE(pp, diminfo[u].start);
+ UINT64ENCODE(pp, diminfo[u].stride);
+ if(diminfo[u].count == H5S_UNLIMITED)
+ UINT64ENCODE(pp, H5S_UINT64_MAX)
+ else
+ UINT64ENCODE(pp, diminfo[u].count)
+ if(diminfo[u].block == H5S_UNLIMITED)
+ UINT64ENCODE(pp, H5S_UINT64_MAX)
+ else
+ UINT64ENCODE(pp, diminfo[u].block)
+ } /* end for */
+ if(version == H5S_HYPER_VERSION_2)
+ len += (4 * space->extent.rank * 8);
+ break;
+ default:
+ HGOTO_ERROR(H5E_DATASPACE, H5E_UNSUPPORTED, FAIL, "unknown offset info size for hyperslab")
+ break;
+ } /* end switch */
+ } /* end if */
+ else {
+ HDassert(version == H5S_HYPER_VERSION_1);
+
+ /* Set some convienence values */
+ fast_dim = ndims - 1;
- /* Encode number of hyperslabs */
- H5_CHECK_OVERFLOW(block_count, hsize_t, uint32_t);
- UINT32ENCODE(pp, (uint32_t)block_count);
- len += 4;
+ /* Encode number of hyperslabs */
+ H5_CHECK_OVERFLOW(block_count, hsize_t, uint32_t);
+ UINT32ENCODE(pp, (uint32_t)block_count);
+ len += 4;
- /* Now serialize the information for the regular hyperslab */
+ /* Now serialize the information for the regular hyperslab */
- /* Build the tables of count sizes as well as the initial offset */
- for(u = 0; u < ndims; u++) {
- tmp_count[u] = diminfo[u].count;
- offset[u] = diminfo[u].start;
- } /* end for */
+ /* Build the tables of count sizes as well as the initial offset */
+ for(u = 0; u < ndims; u++) {
+ tmp_count[u] = diminfo[u].count;
+ offset[u] = diminfo[u].start;
+ } /* end for */
- /* We're not done with the iteration */
- done = FALSE;
+ /* Go iterate over the hyperslabs */
+ while(complete == FALSE) {
+ /* Iterate over the blocks in the fastest dimension */
+ while(tmp_count[fast_dim] > 0) {
+ /* Add 8 bytes times the rank for each hyperslab selected */
+ len += 8 * ndims;
- /* Go iterate over the hyperslabs */
- while(done == FALSE) {
- /* Iterate over the blocks in the fastest dimension */
- while(tmp_count[fast_dim] > 0) {
- /* Add 8 bytes times the rank for each hyperslab selected */
- len += 8 * ndims;
+ /* Encode hyperslab starting location */
+ for(u = 0; u < ndims; u++)
+ UINT32ENCODE(pp, (uint32_t)offset[u]);
- /* Encode hyperslab starting location */
- for(u = 0; u < ndims; u++)
- UINT32ENCODE(pp, (uint32_t)offset[u]);
+ /* Encode hyperslab ending location */
+ for(u = 0; u < ndims; u++)
+ UINT32ENCODE(pp, (uint32_t)(offset[u] + (diminfo[u].block - 1)));
- /* Encode hyperslab ending location */
- for(u = 0; u < ndims; u++)
- UINT32ENCODE(pp, (uint32_t)(offset[u] + (diminfo[u].block - 1)));
+ /* Move the offset to the next sequence to start */
+ offset[fast_dim]+=diminfo[fast_dim].stride;
+
+ /* Decrement the block count */
+ tmp_count[fast_dim]--;
+ } /* end while */
- /* Move the offset to the next sequence to start */
- offset[fast_dim]+=diminfo[fast_dim].stride;
+ /* Work on other dimensions if necessary */
+ if(fast_dim > 0) {
+ int temp_dim; /* Temporary rank holder */
- /* Decrement the block count */
- tmp_count[fast_dim]--;
- } /* end while */
+ /* Reset the block counts */
+ tmp_count[fast_dim] = diminfo[fast_dim].count;
- /* Work on other dimensions if necessary */
- if(fast_dim > 0) {
- int temp_dim; /* Temporary rank holder */
+ /* Bubble up the decrement to the slower changing dimensions */
+ temp_dim = (int)fast_dim - 1;
+ while(temp_dim >= 0 && complete == FALSE) {
+ /* Decrement the block count */
+ tmp_count[temp_dim]--;
- /* Reset the block counts */
- tmp_count[fast_dim] = diminfo[fast_dim].count;
+ /* Check if we have more blocks left */
+ if(tmp_count[temp_dim] > 0)
+ break;
- /* Bubble up the decrement to the slower changing dimensions */
- temp_dim = (int)fast_dim - 1;
- while(temp_dim >= 0 && done == FALSE) {
- /* Decrement the block count */
- tmp_count[temp_dim]--;
+ /* Check for getting out of iterator */
+ if(temp_dim == 0)
+ complete = TRUE;
- /* Check if we have more blocks left */
- if(tmp_count[temp_dim] > 0)
- break;
+ /* Reset the block count in this dimension */
+ tmp_count[temp_dim] = diminfo[temp_dim].count;
- /* Check for getting out of iterator */
- if(temp_dim == 0)
- done = TRUE;
+ /* Wrapped a dimension, go up to next dimension */
+ temp_dim--;
+ } /* end while */
+ } /* end if */
+ else
+ break; /* Break out now, for 1-D selections */
- /* Reset the block count in this dimension */
- tmp_count[temp_dim] = diminfo[temp_dim].count;
+ /* Re-compute offset array */
+ for(u = 0; u < ndims; u++)
+ offset[u] = diminfo[u].start + diminfo[u].stride * (diminfo[u].count - tmp_count[u]);
+ } /* end while */
+ } /* end else */
+ } /* end if */
+ else { /* irregular */
+ /* Encode number of hyperslabs */
+ switch(enc_size) {
+ case H5S_SELECT_INFO_ENC_SIZE_2:
+ HDassert(version == H5S_HYPER_VERSION_3);
+ H5_CHECK_OVERFLOW(block_count, hsize_t, uint16_t);
+ UINT16ENCODE(pp, (uint16_t)block_count);
+ break;
- /* Wrapped a dimension, go up to next dimension */
- temp_dim--;
- } /* end while */
- } /* end if */
- else
- break; /* Break out now, for 1-D selections */
+ case H5S_SELECT_INFO_ENC_SIZE_4:
+ HDassert(version == H5S_HYPER_VERSION_1 || version == H5S_HYPER_VERSION_3);
+ H5_CHECK_OVERFLOW(block_count, hsize_t, uint32_t);
+ UINT32ENCODE(pp, (uint32_t)block_count);
+ break;
- /* Re-compute offset array */
- for(u = 0; u < ndims; u++)
- offset[u] = diminfo[u].start + diminfo[u].stride * (diminfo[u].count - tmp_count[u]);
- } /* end while */
- } /* end if */
- else {
- hsize_t start[H5O_LAYOUT_NDIMS]; /* Location of start of hyperslab */
- hsize_t end[H5O_LAYOUT_NDIMS]; /* Location of end of hyperslab */
+ case H5S_SELECT_INFO_ENC_SIZE_8:
+ HDassert(version == H5S_HYPER_VERSION_3);
+ UINT64ENCODE(pp, block_count);
+ break;
- /* Encode number of hyperslabs */
- block_count = H5S__hyper_span_nblocks(space->select.sel_info.hslab->span_lst);
- H5_CHECK_OVERFLOW(block_count, hsize_t, uint32_t);
- UINT32ENCODE(pp, (uint32_t)block_count);
- len += 4;
+ default:
+ HGOTO_ERROR(H5E_DATASPACE, H5E_UNSUPPORTED, FAIL, "unknown offset info size for hyperslab")
+ break;
+ } /* end switch */
- /* Add 8 bytes times the rank for each hyperslab selected */
- H5_CHECK_OVERFLOW((8 * space->extent.rank * block_count), hsize_t, size_t);
- len += (uint32_t)(8 * space->extent.rank * block_count);
+ if(version == H5S_HYPER_VERSION_1) {
+ len += 4; /* block_count */
- /* Encode each hyperslab in selection */
- H5S__hyper_serialize_helper(space->select.sel_info.hslab->span_lst, start, end, (hsize_t)0, &pp);
+ /* Add 8 bytes times the rank for each hyperslab selected */
+ H5_CHECK_OVERFLOW((8 * ndims * block_count), hsize_t, size_t);
+ len += (uint32_t)(8 * ndims * block_count);
+ } /* end if */
+
+ H5S__hyper_serialize_helper(space->select.sel_info.hslab->span_lst, start, end, (hsize_t)0, enc_size, &pp);
} /* end else */
/* Encode length */
- UINT32ENCODE(lenp, (uint32_t)len); /* Store the length of the extra information */
+ if(version <= H5S_HYPER_VERSION_2)
+ UINT32ENCODE(lenp, (uint32_t)len); /* Store the length of the extra information */
/* Update encoding pointer */
*p = pp;
- FUNC_LEAVE_NOAPI(SUCCEED)
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
} /* end H5S__hyper_serialize() */
@@ -2295,10 +4204,8 @@ H5S__hyper_serialize(const H5S_t *space, uint8_t **p)
Deserialize the current selection from a user-provided buffer.
USAGE
herr_t H5S__hyper_deserialize(space, p)
- H5S_t *space; IN/OUT: Dataspace pointer to place
+ H5S_t **space; IN/OUT: Dataspace pointer to place
selection into
- uint32_t version IN: Selection version
- uint8_t flags IN: Selection flags
uint8 **p; OUT: Pointer to buffer holding serialized
selection. Will be advanced to end of
serialized selection.
@@ -2313,82 +4220,216 @@ H5S__hyper_serialize(const H5S_t *space, uint8_t **p)
REVISION LOG
--------------------------------------------------------------------------*/
static herr_t
-H5S__hyper_deserialize(H5S_t *space, uint32_t H5_ATTR_UNUSED version, uint8_t flags,
- const uint8_t **p)
+H5S__hyper_deserialize(H5S_t **space, const uint8_t **p)
{
- unsigned rank; /* Rank of points */
- const uint8_t *pp; /* Local pointer for decoding */
- hsize_t start[H5O_LAYOUT_NDIMS]; /* Hyperslab start information */
- hsize_t block[H5O_LAYOUT_NDIMS]; /* Hyperslab block information */
- unsigned u; /* Local counting variable */
- herr_t ret_value = FAIL; /* Return value */
+ H5S_t *tmp_space = NULL; /* Pointer to actual dataspace to use,
+ either *space or a newly allocated one */
+ hsize_t dims[H5S_MAX_RANK]; /* Dimenion sizes */
+ hsize_t start[H5S_MAX_RANK]; /* hyperslab start information */
+ hsize_t block[H5S_MAX_RANK]; /* hyperslab block information */
+ uint32_t version; /* Version number */
+ uint8_t flags = 0; /* Flags */
+ uint8_t enc_size = 0; /* Encoded size of selection info */
+ unsigned rank; /* rank of points */
+ const uint8_t *pp; /* Local pointer for decoding */
+ unsigned u; /* Local counting variable */
+ herr_t ret_value=FAIL; /* return value */
FUNC_ENTER_STATIC
/* Check args */
- HDassert(space);
HDassert(p);
pp = (*p);
HDassert(pp);
- /* Deserialize slabs to select */
- /* (The header and rank have already beed decoded) */
- rank = space->extent.rank; /* Retrieve rank from space */
+ /* As part of the efforts to push all selection-type specific coding
+ to the callbacks, the coding for the allocation of a null dataspace
+ is moved from H5S_select_deserialize() in H5Sselect.c to here.
+ This is needed for decoding virtual layout in H5O__layout_decode() */
+ /* Allocate space if not provided */
+ if(!*space) {
+ if(NULL == (tmp_space = H5S_create(H5S_SIMPLE)))
+ HGOTO_ERROR(H5E_DATASPACE, H5E_CANTCREATE, FAIL, "can't create dataspace")
+ } /* end if */
+ else
+ tmp_space = *space;
- /* If there is an unlimited dimension, only encode opt_unlim_diminfo */
- if(flags & H5S_SELECT_FLAG_UNLIM) {
- hsize_t stride[H5O_LAYOUT_NDIMS]; /* Hyperslab stride information */
- hsize_t count[H5O_LAYOUT_NDIMS]; /* Hyperslab count information */
+ /* Decode version */
+ UINT32DECODE(pp, version);
+
+ if(version >= (uint32_t)H5S_HYPER_VERSION_2) {
+ /* Decode flags */
+ flags = *(pp)++;
+
+ if(version >= (uint32_t)H5S_HYPER_VERSION_3)
+ /* decode size of offset info */
+ enc_size = *(pp)++;
+ else {
+ /* Skip over the remainder of the header */
+ pp += 4;
+ enc_size = H5S_SELECT_INFO_ENC_SIZE_8;
+ } /* end else */
+
+ /* Check for unknown flags */
+ if(flags & ~H5S_SELECT_FLAG_BITS)
+ HGOTO_ERROR(H5E_DATASPACE, H5E_CANTLOAD, FAIL, "unknown flag for selection")
+ } /* end if */
+ else {
+ /* Skip over the remainder of the header */
+ pp += 8;
+ enc_size = H5S_SELECT_INFO_ENC_SIZE_4;
+ } /* end else */
+
+ /* Check encoded */
+ if(enc_size & ~H5S_SELECT_INFO_ENC_SIZE_BITS)
+ HGOTO_ERROR(H5E_DATASPACE, H5E_CANTLOAD, FAIL, "unknown size of point/offset info for selection")
+
+ /* Decode the rank of the point selection */
+ UINT32DECODE(pp,rank);
+
+ if(!*space) {
+ /* Patch the rank of the allocated dataspace */
+ (void)HDmemset(dims, 0, (size_t)rank * sizeof(dims[0]));
+ if(H5S_set_extent_simple(tmp_space, rank, dims, NULL) < 0)
+ HGOTO_ERROR(H5E_DATASPACE, H5E_CANTINIT, FAIL, "can't set dimensions")
+ } /* end if */
+ else
+ /* Verify the rank of the provided dataspace */
+ if(rank != tmp_space->extent.rank)
+ HGOTO_ERROR(H5E_DATASPACE, H5E_BADRANGE, FAIL, "rank of serialized selection does not match dataspace")
+
+ if(flags & H5S_HYPER_REGULAR) {
+ hsize_t stride[H5S_MAX_RANK]; /* Hyperslab stride information */
+ hsize_t count[H5S_MAX_RANK]; /* Hyperslab count information */
/* Sanity checks */
HDassert(H5S_UNLIMITED == HSIZE_UNDEF);
HDassert(version >= 2);
- /* Iterate over dimensions */
- for(u = 0; u < rank; u++) {
- /* Decode start/stride/block/count */
- UINT64DECODE(pp, start[u]);
- UINT64DECODE(pp, stride[u]);
- UINT64DECODE(pp, count[u]);
- UINT64DECODE(pp, block[u]);
- } /* end for */
+ /* Decode start/stride/block/count */
+ switch(enc_size) {
+ case H5S_SELECT_INFO_ENC_SIZE_2:
+ for(u = 0; u < tmp_space->extent.rank; u++) {
+ UINT16DECODE(pp, start[u]);
+ UINT16DECODE(pp, stride[u]);
+
+ UINT16DECODE(pp, count[u]);
+ if((uint16_t)count[u] == H5S_UINT16_MAX)
+ count[u] = H5S_UNLIMITED;
+
+ UINT16DECODE(pp, block[u]);
+ if((uint16_t)block[u] == H5S_UINT16_MAX)
+ block[u] = H5S_UNLIMITED;
+ } /* end for */
+ break;
+
+ case H5S_SELECT_INFO_ENC_SIZE_4:
+ for(u = 0; u < tmp_space->extent.rank; u++) {
+ UINT32DECODE(pp, start[u]);
+ UINT32DECODE(pp, stride[u]);
+
+ UINT32DECODE(pp, count[u]);
+ if((uint32_t)count[u] == H5S_UINT32_MAX)
+ count[u] = H5S_UNLIMITED;
+ UINT32DECODE(pp, block[u]);
+ if((uint32_t)block[u] == H5S_UINT32_MAX)
+ block[u] = H5S_UNLIMITED;
+ } /* end for */
+ break;
+
+ case H5S_SELECT_INFO_ENC_SIZE_8:
+ for(u = 0; u < tmp_space->extent.rank; u++) {
+ UINT64DECODE(pp, start[u]);
+ UINT64DECODE(pp, stride[u]);
+
+ UINT64DECODE(pp, count[u]);
+ if((uint64_t)count[u] == H5S_UINT64_MAX)
+ count[u] = H5S_UNLIMITED;
+
+ UINT64DECODE(pp, block[u]);
+ if((uint64_t)block[u] == H5S_UINT64_MAX)
+ block[u] = H5S_UNLIMITED;
+ } /* end for */
+ break;
+
+ default:
+ HGOTO_ERROR(H5E_DATASPACE, H5E_UNSUPPORTED, FAIL, "unknown offset info size for hyperslab")
+ break;
+ } /* end switch */
+
/* Select the hyperslab to the current selection */
- if((ret_value = H5S_select_hyperslab(space, H5S_SELECT_SET, start, stride, count, block)) < 0)
+ if((ret_value = H5S_select_hyperslab(tmp_space, H5S_SELECT_SET, start, stride, count, block)) < 0)
HGOTO_ERROR(H5E_DATASPACE, H5E_CANTSET, FAIL, "can't change selection")
} /* end if */
else {
const hsize_t *stride; /* Hyperslab stride information */
const hsize_t *count; /* Hyperslab count information */
- hsize_t end[H5O_LAYOUT_NDIMS]; /* Hyperslab end information */
- hsize_t *tstart; /* Temporary hyperslab pointers */
- hsize_t *tend; /* Temporary hyperslab pointers */
- hsize_t *tblock; /* Temporary hyperslab pointers */
- size_t block_count; /* Number of blocks in selection */
- unsigned v; /* Local counting variable */
+ hsize_t end[H5S_MAX_RANK]; /* Hyperslab end information */
+ hsize_t *tstart; /* Temporary hyperslab pointers */
+ hsize_t *tend; /* Temporary hyperslab pointers */
+ hsize_t *tblock; /* Temporary hyperslab pointers */
+ size_t num_elem; /* Number of elements in selection */
+ unsigned v; /* Local counting variable */
+
+ /* decode the number of blocks */
+ switch(enc_size) {
+ case H5S_SELECT_INFO_ENC_SIZE_2:
+ UINT16DECODE(pp, num_elem);
+ break;
+
+ case H5S_SELECT_INFO_ENC_SIZE_4:
+ UINT32DECODE(pp, num_elem);
+ break;
+
+ case H5S_SELECT_INFO_ENC_SIZE_8:
+ UINT64DECODE(pp, num_elem);
+ break;
- /* Decode the number of blocks */
- UINT32DECODE(pp, block_count);
+ default:
+ HGOTO_ERROR(H5E_DATASPACE, H5E_UNSUPPORTED, FAIL, "unknown offset info size for hyperslab")
+ break;
+ } /* end switch */
/* Set the count & stride for all blocks */
stride = count = H5S_hyper_ones_g;
/* Retrieve the coordinates from the buffer */
- for(u = 0; u < block_count; u++) {
- /* Decode the starting points */
- for(tstart = start, v = 0; v < rank; v++, tstart++)
- UINT32DECODE(pp, *tstart);
+ for(u = 0; u < num_elem; u++) {
+ /* Decode the starting and ending points */
+ switch(enc_size) {
+ case H5S_SELECT_INFO_ENC_SIZE_2:
+ for(tstart = start, v = 0; v < rank; v++, tstart++)
+ UINT16DECODE(pp, *tstart);
+ for(tend = end, v = 0; v < rank; v++, tend++)
+ UINT16DECODE(pp, *tend);
+ break;
- /* Decode the ending points */
- for(tend = end, v = 0; v < rank; v++, tend++)
- UINT32DECODE(pp, *tend);
+ case H5S_SELECT_INFO_ENC_SIZE_4:
+ for(tstart = start,v = 0; v < rank; v++, tstart++)
+ UINT32DECODE(pp, *tstart);
+ for(tend = end, v = 0; v < rank; v++, tend++)
+ UINT32DECODE(pp, *tend);
+ break;
+
+ case H5S_SELECT_INFO_ENC_SIZE_8:
+ for(tstart = start, v = 0; v < rank; v++, tstart++)
+ UINT64DECODE(pp, *tstart);
+ for(tend = end, v = 0; v < rank; v++, tend++)
+ UINT64DECODE(pp, *tend);
+ break;
+
+ default:
+ HGOTO_ERROR(H5E_DATASPACE, H5E_UNSUPPORTED, FAIL, "unknown offset info size for hyperslab")
+ break;
+ } /* end switch */
/* Change the ending points into blocks */
for(tblock = block, tstart = start, tend = end, v = 0; v < rank; v++, tstart++, tend++, tblock++)
*tblock = (*tend - *tstart) + 1;
/* Select or add the hyperslab to the current selection */
- if((ret_value = H5S_select_hyperslab(space, (u == 0 ? H5S_SELECT_SET : H5S_SELECT_OR), start, stride, count, block)) < 0)
+ if((ret_value = H5S_select_hyperslab(tmp_space, (u == 0 ? H5S_SELECT_SET : H5S_SELECT_OR), start, stride, count, block)) < 0)
HGOTO_ERROR(H5E_DATASPACE, H5E_CANTSET, FAIL, "can't change selection")
} /* end for */
} /* end else */
@@ -2396,7 +4437,16 @@ H5S__hyper_deserialize(H5S_t *space, uint32_t H5_ATTR_UNUSED version, uint8_t fl
/* Update decoding pointer */
*p = pp;
+ /* Return space to the caller if allocated */
+ if(!*space)
+ *space = tmp_space;
+
done:
+ /* Free temporary space if not passed to caller (only happens on error) */
+ if(!*space && tmp_space)
+ if(H5S_close(tmp_space) < 0)
+ HDONE_ERROR(H5E_DATASPACE, H5E_CANTFREE, FAIL, "can't close dataspace")
+
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5S__hyper_deserialize() */
@@ -2440,14 +4490,13 @@ H5S__hyper_span_blocklist(const H5S_hyper_span_info_t *spans, hsize_t start[],
hsize_t **buf)
{
const H5S_hyper_span_t *curr; /* Pointer to current hyperslab span */
- hsize_t u; /* Index variable */
herr_t ret_value = SUCCEED; /* return value */
FUNC_ENTER_STATIC
/* Sanity checks */
HDassert(spans);
- HDassert(rank < H5O_LAYOUT_NDIMS);
+ HDassert(rank < H5S_MAX_RANK);
HDassert(start);
HDassert(end);
HDassert(startblock);
@@ -2478,19 +4527,19 @@ H5S__hyper_span_blocklist(const H5S_hyper_span_info_t *spans, hsize_t start[],
/* Encode all the previous dimensions starting & ending points */
/* Copy previous starting points */
- for(u = 0; u < rank; u++, (*buf)++)
- HDmemcpy(*buf, &start[u], sizeof(hsize_t));
+ H5MM_memcpy(*buf, start, rank * sizeof(hsize_t));
+ (*buf) += rank;
/* Copy starting point for this span */
- HDmemcpy(*buf, &curr->low, sizeof(hsize_t));
+ **buf = curr->low;
(*buf)++;
/* Copy previous ending points */
- for(u = 0; u < rank; u++, (*buf)++)
- HDmemcpy(*buf, &end[u], sizeof(hsize_t));
+ H5MM_memcpy(*buf, end, rank * sizeof(hsize_t));
+ (*buf) += rank;
- /* Copy starting point for this span */
- HDmemcpy(*buf, &curr->high, sizeof(hsize_t));
+ /* Copy ending point for this span */
+ **buf = curr->high;
(*buf)++;
/* Decrement the number of blocks processed */
@@ -2538,7 +4587,8 @@ done:
REVISION LOG
--------------------------------------------------------------------------*/
static herr_t
-H5S__get_select_hyper_blocklist(H5S_t *space, hbool_t internal, hsize_t startblock, hsize_t numblocks, hsize_t *buf)
+H5S__get_select_hyper_blocklist(H5S_t *space, hsize_t startblock,
+ hsize_t numblocks, hsize_t *buf)
{
herr_t ret_value = SUCCEED; /* Return value */
@@ -2548,11 +4598,18 @@ H5S__get_select_hyper_blocklist(H5S_t *space, hbool_t internal, hsize_t startblo
HDassert(buf);
HDassert(space->select.sel_info.hslab->unlim_dim < 0);
+ /* Attempt to rebuild diminfo if it is invalid and has not been confirmed
+ * to be impossible.
+ */
+ if(space->select.sel_info.hslab->diminfo_valid == H5S_DIMINFO_VALID_NO)
+ H5S__hyper_rebuild(space);
+
/* Check for a "regular" hyperslab selection */
- if(space->select.sel_info.hslab->diminfo_valid) {
+ if(space->select.sel_info.hslab->diminfo_valid == H5S_DIMINFO_VALID_YES) {
const H5S_hyper_dim_t *diminfo; /* Alias for dataspace's diminfo information */
- hsize_t tmp_count[H5O_LAYOUT_NDIMS]; /* Temporary hyperslab counts */
- hsize_t offset[H5O_LAYOUT_NDIMS]; /* Offset of element in dataspace */
+ hsize_t tmp_count[H5S_MAX_RANK]; /* Temporary hyperslab counts */
+ hsize_t offset[H5S_MAX_RANK]; /* Offset of element in dataspace */
+ hsize_t end[H5S_MAX_RANK]; /* End of elements in dataspace */
unsigned fast_dim; /* Rank of the fastest changing dimension for the dataspace */
unsigned ndims; /* Rank of the dataspace */
hbool_t done; /* Whether we are done with the iteration */
@@ -2563,31 +4620,25 @@ H5S__get_select_hyper_blocklist(H5S_t *space, hbool_t internal, hsize_t startblo
fast_dim = ndims - 1;
/* Check which set of dimension information to use */
- if(internal)
+ if(space->select.sel_info.hslab->unlim_dim >= 0)
/*
- * Use the "optimized dimension information" to pass back information
- * on the blocks set, not the "application information".
+ * There is an unlimited dimension so we must use diminfo.opt as
+ * it has been "clipped" to the current extent.
*/
- diminfo = space->select.sel_info.hslab->opt_diminfo;
+ diminfo = space->select.sel_info.hslab->diminfo.opt;
else
- if(space->select.sel_info.hslab->unlim_dim >= 0)
- /*
- * There is an unlimited dimension so we must use opt_diminfo as
- * it has been "clipped" to the current extent.
- */
- diminfo = space->select.sel_info.hslab->opt_diminfo;
- else
- /*
- * Use the "application dimension information" to pass back to
- * the user the blocks they set, not the optimized, internal
- * information.
- */
- diminfo = space->select.sel_info.hslab->app_diminfo;
+ /*
+ * Use the "application dimension information" to pass back to
+ * the user the blocks they set, not the optimized, internal
+ * information.
+ */
+ diminfo = space->select.sel_info.hslab->diminfo.app;
/* Build the tables of count sizes as well as the initial offset */
for(u = 0; u < ndims; u++) {
tmp_count[u] = diminfo[u].count;
offset[u] = diminfo[u].start;
+ end[u] = diminfo[u].start + (diminfo[u].block - 1);
} /* end for */
/* We're not done with the iteration */
@@ -2595,31 +4646,45 @@ H5S__get_select_hyper_blocklist(H5S_t *space, hbool_t internal, hsize_t startblo
/* Go iterate over the hyperslabs */
while(!done && numblocks > 0) {
- hsize_t temp_off; /* Offset in a given dimension */
+ /* Skip over initial blocks */
+ if(startblock > 0) {
+ /* Skip all blocks in row */
+ if(startblock >= tmp_count[fast_dim]) {
+ startblock -= tmp_count[fast_dim];
+ tmp_count[fast_dim] = 0;
+ } /* end if */
+ else {
+ /* Move the offset to the next sequence to start */
+ offset[fast_dim] += diminfo[fast_dim].stride * startblock;
+ end[fast_dim] += diminfo[fast_dim].stride * startblock;
+
+ /* Decrement the block count */
+ tmp_count[fast_dim] -= startblock;
+
+ /* Done with starting blocks */
+ startblock = 0;
+ } /* end else */
+ } /* end if */
/* Iterate over the blocks in the fastest dimension */
while(tmp_count[fast_dim] > 0 && numblocks > 0) {
+ /* Sanity check */
+ HDassert(startblock == 0);
- /* Check if we should copy this block information */
- if(startblock == 0) {
- /* Copy the starting location */
- HDmemcpy(buf, offset, sizeof(hsize_t) * ndims);
- buf += ndims;
+ /* Copy the starting location */
+ H5MM_memcpy(buf, offset, sizeof(hsize_t) * ndims);
+ buf += ndims;
- /* Compute the ending location */
- HDmemcpy(buf, offset, sizeof(hsize_t) * ndims);
- for(u = 0; u < ndims; u++)
- buf[u] += (diminfo[u].block - 1);
- buf += ndims;
+ /* Compute the ending location */
+ H5MM_memcpy(buf, end, sizeof(hsize_t) * ndims);
+ buf += ndims;
- /* Decrement the number of blocks to retrieve */
- numblocks--;
- } /* end if */
- else
- startblock--;
+ /* Decrement the number of blocks to retrieve */
+ numblocks--;
/* Move the offset to the next sequence to start */
offset[fast_dim] += diminfo[fast_dim].stride;
+ end[fast_dim] += diminfo[fast_dim].stride;
/* Decrement the block count */
tmp_count[fast_dim]--;
@@ -2642,28 +4707,29 @@ H5S__get_select_hyper_blocklist(H5S_t *space, hbool_t internal, hsize_t startblo
if(tmp_count[temp_dim] > 0)
break;
+ /* Reset the block count in this dimension */
+ tmp_count[temp_dim] = diminfo[temp_dim].count;
+
/* Check for getting out of iterator */
if(temp_dim == 0)
done = TRUE;
- /* Reset the block count in this dimension */
- tmp_count[temp_dim] = diminfo[temp_dim].count;
-
/* Wrapped a dimension, go up to next dimension */
temp_dim--;
} /* end while */
} /* end if */
- /* Re-compute offset array */
- for(u = 0; u < ndims; u++) {
- temp_off = diminfo[u].start + diminfo[u].stride * (diminfo[u].count - tmp_count[u]);
- offset[u] = temp_off;
- } /* end for */
+ /* Re-compute offset & end arrays */
+ if(!done)
+ for(u = 0; u < ndims; u++) {
+ offset[u] = diminfo[u].start + diminfo[u].stride * (diminfo[u].count - tmp_count[u]);
+ end[u] = offset[u] + (diminfo[u].block - 1);
+ } /* end for */
} /* end while */
} /* end if */
else {
- hsize_t start[H5O_LAYOUT_NDIMS]; /* Location of start of hyperslab */
- hsize_t end[H5O_LAYOUT_NDIMS]; /* Location of end of hyperslab */
+ hsize_t start[H5S_MAX_RANK]; /* Location of start of hyperslab */
+ hsize_t end[H5S_MAX_RANK]; /* Location of end of hyperslab */
ret_value = H5S__hyper_span_blocklist(space->select.sel_info.hslab->span_lst, start, end, (hsize_t)0, &startblock, &numblocks, &buf);
} /* end else */
@@ -2684,7 +4750,7 @@ H5S__get_select_hyper_blocklist(H5S_t *space, hbool_t internal, hsize_t startblo
hsize_t numblocks; IN: Number of hyperslab blocks to get
hsize_t buf[]; OUT: List of hyperslab blocks selected
RETURNS
- Non-negative on success, negative on failure
+ Non-negative on success/Negative on failure
DESCRIPTION
Puts a list of the hyperslab blocks into the user's buffer. The blocks
start with the 'startblock'th block in the list of blocks and put
@@ -2724,7 +4790,7 @@ H5Sget_select_hyper_blocklist(hid_t spaceid, hsize_t startblock,
/* Go get the correct number of blocks */
if(numblocks > 0)
- ret_value = H5S__get_select_hyper_blocklist(space, 0, startblock, numblocks, buf);
+ ret_value = H5S__get_select_hyper_blocklist(space, startblock, numblocks, buf);
else
ret_value = SUCCEED; /* Successfully got 0 blocks... */
@@ -2735,76 +4801,6 @@ done:
/*--------------------------------------------------------------------------
NAME
- H5S_hyper_bounds_helper
- PURPOSE
- Gets the bounding box containing the selection.
- USAGE
- htri_t H5S_hyper_bounds_helper(spans, offset, rank);
- const H5S_hyper_span_info_t *spans; IN: Pointer to current hyperslab span tree
- const hssize_t *offset; IN: Pointer to offset array
- hsize_t rank; IN: Current rank looking at
- hsize_t *start; OUT: Start array bounds
- hsize_t *end; OUT: End array bounds
- RETURNS
- Non-negative on success, negative on failure
- DESCRIPTION
- Retrieves the bounding box containing the current selection and places
- it into the user's buffers. The start and end buffers must be large
- enough to hold the dataspace rank number of coordinates. The bounding box
- exactly contains the selection, ie. if a 2-D element selection is currently
- defined with the following points: (4,5), (6,8) (10,7), the bounding box
- with be (4, 5), (10, 8).
- The bounding box calculations _does_ include the current offset of the
- selection within the dataspace extent.
- GLOBAL VARIABLES
- COMMENTS, BUGS, ASSUMPTIONS
- EXAMPLES
- REVISION LOG
---------------------------------------------------------------------------*/
-static herr_t
-H5S_hyper_bounds_helper(const H5S_hyper_span_info_t *spans, const hssize_t *offset, hsize_t rank, hsize_t *start, hsize_t *end)
-{
- H5S_hyper_span_t *curr; /* Hyperslab information nodes */
- herr_t ret_value = SUCCEED; /* Return value */
-
- FUNC_ENTER_NOAPI_NOINIT
-
- HDassert(spans);
- HDassert(offset);
- HDassert(rank < H5O_LAYOUT_NDIMS);
- HDassert(start);
- HDassert(end);
-
- /* Check each point to determine whether selection+offset is within extent */
- curr=spans->head;
- while(curr!=NULL) {
- /* Check for offset moving selection negative */
- if(((hssize_t)curr->low + offset[rank]) < 0)
- HGOTO_ERROR(H5E_DATASPACE, H5E_BADRANGE, FAIL, "offset moves selection out of bounds")
-
- /* Check if the current span extends the bounding box */
- if((curr->low + (hsize_t)offset[rank]) < start[rank])
- start[rank] = curr->low + (hsize_t)offset[rank];
- if((curr->high + (hsize_t)offset[rank]) > end[rank])
- end[rank] = curr->high + (hsize_t)offset[rank];
-
- /* Recurse if this node has down spans */
- if(curr->down != NULL) {
- if(H5S_hyper_bounds_helper(curr->down, offset, (rank + 1), start, end) < 0)
- HGOTO_ERROR(H5E_DATASPACE, H5E_BADSELECT, FAIL, "failure in lower dimension")
- } /* end if */
-
- /* Advance to next node */
- curr = curr->next;
- } /* end while */
-
-done:
- FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5S_hyper_bounds_helper() */
-
-
-/*--------------------------------------------------------------------------
- NAME
H5S__hyper_bounds
PURPOSE
Gets the bounding box containing the selection.
@@ -2832,8 +4828,8 @@ done:
static herr_t
H5S__hyper_bounds(const H5S_t *space, hsize_t *start, hsize_t *end)
{
- unsigned rank; /* Dataspace rank */
- unsigned i; /* index variable */
+ const hsize_t *low_bounds, *high_bounds; /* Pointers to the correct pair of low & high bounds */
+ unsigned u; /* Local index variable */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_STATIC
@@ -2843,37 +4839,32 @@ H5S__hyper_bounds(const H5S_t *space, hsize_t *start, hsize_t *end)
HDassert(start);
HDassert(end);
- /* Set the start and end arrays up */
- rank = space->extent.rank;
- for(i = 0; i < rank; i++) {
- start[i] = HSIZET_MAX;
- end[i] = 0;
- } /* end for */
-
- /* Check for a "regular" hyperslab selection */
- if(space->select.sel_info.hslab->diminfo_valid) {
- const H5S_hyper_dim_t *diminfo = space->select.sel_info.hslab->opt_diminfo; /* local alias for diminfo */
+ /* Check which set of low & high bounds we should be using */
+ if(space->select.sel_info.hslab->diminfo_valid == H5S_DIMINFO_VALID_YES) {
+ low_bounds = space->select.sel_info.hslab->diminfo.low_bounds;
+ high_bounds = space->select.sel_info.hslab->diminfo.high_bounds;
+ } /* end if */
+ else {
+ low_bounds = space->select.sel_info.hslab->span_lst->low_bounds;
+ high_bounds = space->select.sel_info.hslab->span_lst->high_bounds;
+ } /* end else */
- /* Check each dimension */
- for(i = 0; i < rank; i++) {
- /* Check for offset moving selection negative */
- if((space->select.offset[i] + (hssize_t)diminfo[i].start) < 0)
- HGOTO_ERROR(H5E_DATASPACE, H5E_BADRANGE, FAIL, "offset moves selection out of bounds")
+ /* Loop over dimensions */
+ for(u = 0; u < space->extent.rank; u++) {
+ /* Sanity check */
+ HDassert(low_bounds[u] <= high_bounds[u]);
- /* Compute the smallest location in this dimension */
- start[i] = diminfo[i].start + (hsize_t)space->select.offset[i];
+ /* Check for offset moving selection negative */
+ if(((hssize_t)low_bounds[u] + space->select.offset[u]) < 0)
+ HGOTO_ERROR(H5E_DATASPACE, H5E_BADRANGE, FAIL, "offset moves selection out of bounds")
- /* Compute the largest location in this dimension */
- if((int)i == space->select.sel_info.hslab->unlim_dim)
- end[i] = H5S_UNLIMITED;
- else
- end[i] = diminfo[i].start + diminfo[i].stride * (diminfo[i].count - 1) + (diminfo[i].block - 1) + (hsize_t)space->select.offset[i];
- } /* end for */
- } /* end if */
- else {
- /* Call the recursive routine to get the bounds for the span tree */
- ret_value = H5S_hyper_bounds_helper(space->select.sel_info.hslab->span_lst, space->select.offset, (hsize_t)0, start, end);
- } /* end if */
+ /* Set the low & high bounds in this dimension */
+ start[u] = (hsize_t)((hssize_t)low_bounds[u] + space->select.offset[u]);
+ if((int)u == space->select.sel_info.hslab->unlim_dim)
+ end[u] = H5S_UNLIMITED;
+ else
+ end[u] = (hsize_t)((hssize_t)high_bounds[u] + space->select.offset[u]);
+ } /* end for */
done:
FUNC_LEAVE_NOAPI(ret_value)
@@ -2924,8 +4915,9 @@ H5S__hyper_offset(const H5S_t *space, hsize_t *offset)
dim_size = space->extent.size;
/* Check for a "regular" hyperslab selection */
- if(space->select.sel_info.hslab->diminfo_valid) {
- const H5S_hyper_dim_t *diminfo = space->select.sel_info.hslab->opt_diminfo; /* Local alias for diminfo */
+ /* (No need to rebuild the dimension info yet -QAK) */
+ if(space->select.sel_info.hslab->diminfo_valid == H5S_DIMINFO_VALID_YES) {
+ const H5S_hyper_dim_t *diminfo = space->select.sel_info.hslab->diminfo.opt; /* Local alias for diminfo */
/* Loop through starting coordinates, calculating the linear offset */
accum = 1;
@@ -3075,7 +5067,7 @@ done:
EXAMPLES
REVISION LOG
--------------------------------------------------------------------------*/
-static htri_t
+static H5_ATTR_PURE htri_t
H5S__hyper_is_contiguous(const H5S_t *space)
{
hbool_t small_contiguous, /* Flag for small contiguous block */
@@ -3088,8 +5080,9 @@ H5S__hyper_is_contiguous(const H5S_t *space)
HDassert(space);
/* Check for a "regular" hyperslab selection */
- if(space->select.sel_info.hslab->diminfo_valid) {
- const H5S_hyper_dim_t *diminfo=space->select.sel_info.hslab->opt_diminfo; /* local alias for diminfo */
+ /* (No need to rebuild the dimension info yet -QAK) */
+ if(space->select.sel_info.hslab->diminfo_valid == H5S_DIMINFO_VALID_YES) {
+ const H5S_hyper_dim_t *diminfo=space->select.sel_info.hslab->diminfo.opt; /* local alias for diminfo */
/*
* For a regular hyperslab to be contiguous, it must have only one
@@ -3145,10 +5138,10 @@ H5S__hyper_is_contiguous(const H5S_t *space)
/*
* For a hyperslab to be contiguous, it must have only one block and
- * (either it's size must be the same as the dataspace extent's in all
- * but the slowest changing dimension
- * OR
- * block size must be 1 in all but the fastest changing dimension).
+ * either it's size must be the same as the dataspace extent's in all
+ * but the slowest changing dimension
+ * OR
+ * block size must be 1 in all but the fastest changing dimension.
*/
/* Initialize flags */
large_contiguous = TRUE; /* assume true and reset if the dimensions don't match */
@@ -3260,7 +5253,7 @@ H5S__hyper_is_contiguous(const H5S_t *space)
EXAMPLES
REVISION LOG
--------------------------------------------------------------------------*/
-static htri_t
+static H5_ATTR_PURE htri_t
H5S__hyper_is_single(const H5S_t *space)
{
htri_t ret_value = TRUE; /* return value */
@@ -3270,7 +5263,10 @@ H5S__hyper_is_single(const H5S_t *space)
HDassert(space);
/* Check for a "single" hyperslab selection */
- if(space->select.sel_info.hslab->diminfo_valid) {
+ /* (No need to rebuild the dimension info yet, since the span-tree
+ * algorithm is fast -QAK)
+ */
+ if(space->select.sel_info.hslab->diminfo_valid == H5S_DIMINFO_VALID_YES) {
unsigned u; /* index variable */
/*
@@ -3280,7 +5276,7 @@ H5S__hyper_is_single(const H5S_t *space)
/* Check for a single block */
for(u = 0; u < space->extent.rank; u++)
- if(space->select.sel_info.hslab->opt_diminfo[u].count > 1)
+ if(space->select.sel_info.hslab->diminfo.opt[u].count > 1)
HGOTO_DONE(FALSE)
} /* end if */
else {
@@ -3328,7 +5324,6 @@ done:
This is primarily used for reading the entire selection in one swoop.
GLOBAL VARIABLES
COMMENTS, BUGS, ASSUMPTIONS
- Doesn't check for "regular" hyperslab selections composed of spans
EXAMPLES
REVISION LOG
--------------------------------------------------------------------------*/
@@ -3342,8 +5337,14 @@ H5S__hyper_is_regular(const H5S_t *space)
/* Check args */
HDassert(space);
+ /* Attempt to rebuild diminfo if it is invalid and has not been confirmed
+ * to be impossible.
+ */
+ if(space->select.sel_info.hslab->diminfo_valid == H5S_DIMINFO_VALID_NO)
+ H5S__hyper_rebuild((H5S_t *)space); /* Casting away const OK -NAF */
+
/* Only simple check for regular hyperslabs for now... */
- if(space->select.sel_info.hslab->diminfo_valid)
+ if(space->select.sel_info.hslab->diminfo_valid == H5S_DIMINFO_VALID_YES)
ret_value = TRUE;
else
ret_value = FALSE;
@@ -3354,93 +5355,395 @@ H5S__hyper_is_regular(const H5S_t *space)
/*--------------------------------------------------------------------------
NAME
- H5S__hyper_release
+ H5S__hyper_spans_shape_same_helper
PURPOSE
- Release hyperslab selection information for a dataspace
+ Helper routine to check if two hyperslab span trees are the same shape
USAGE
- herr_t H5S__hyper_release(space)
- H5S_t *space; IN: Pointer to dataspace
+ hbool_t H5S__hyper_spans_shape_same_helper(span1, span2, offset, rest_zeros)
+ H5S_hyper_span_info_t *span_info1; IN: First span tree to compare
+ H5S_hyper_span_info_t *span_info2; IN: Second span tree to compare
+ hssize_t offset[]; IN: Offset between the span trees
+ hbool_t rest_zeros[]; IN: Array of flags which indicate
+ the rest of the offset[] array
+ is zero values.
RETURNS
- Non-negative on success/Negative on failure
+ TRUE (1) or FALSE (0) on success, can't fail
DESCRIPTION
- Releases all hyperslab selection information for a dataspace
+ Compare two hyperslab span trees to determine if they refer to a selection
+ with the same shape, with a possible (constant) offset between their
+ elements. Very similar to H5S__hyper_cmp_spans, except the selected
+ elements can be offset by a vector.
GLOBAL VARIABLES
COMMENTS, BUGS, ASSUMPTIONS
EXAMPLES
REVISION LOG
- * Robb Matzke, 1998-08-25
- * The fields which are freed are set to NULL to prevent them from being
- * freed again later. This fixes some allocation problems where
- * changing the hyperslab selection of one dataspace causes a core dump
- * when closing some other dataspace.
--------------------------------------------------------------------------*/
-static herr_t
-H5S__hyper_release(H5S_t *space)
+static H5_ATTR_PURE hbool_t
+H5S__hyper_spans_shape_same_helper(const H5S_hyper_span_info_t *span_info1,
+ const H5S_hyper_span_info_t *span_info2, hssize_t offset[],
+ hbool_t rest_zeros[])
{
- herr_t ret_value = SUCCEED;
+ hbool_t ret_value = TRUE; /* Return value */
+
+ FUNC_ENTER_PACKAGE_NOERR
+
+ /* Sanity checks */
+ HDassert(span_info1);
+ HDassert(span_info2);
+ HDassert(offset);
+ HDassert(rest_zeros);
+
+ /* Compare low & high bounds for this span list */
+ /* (Could compare lower dimensions also, but not certain if
+ * that's worth it. - QAK, 2019/01/23)
+ */
+ if((hsize_t)((hssize_t)span_info1->low_bounds[0] + offset[0]) != span_info2->low_bounds[0])
+ HGOTO_DONE(FALSE)
+ else if((hsize_t)((hssize_t)span_info1->high_bounds[0] + offset[0]) != span_info2->high_bounds[0])
+ HGOTO_DONE(FALSE)
+ else {
+ const H5S_hyper_span_t *span1;
+ const H5S_hyper_span_t *span2;
+
+ /* Get the pointers to the actual lists of spans */
+ span1 = span_info1->head;
+ span2 = span_info2->head;
+
+ /* Sanity checking */
+ HDassert(span1);
+ HDassert(span2);
+
+ /* infinite loop which must be broken out of */
+ while(1) {
+ /* Check for both spans being NULL */
+ if(span1 == NULL && span2 == NULL)
+ HGOTO_DONE(TRUE)
+
+ /* Check for one span being NULL */
+ if(span1 == NULL || span2 == NULL)
+ HGOTO_DONE(FALSE)
+
+ /* Check if the actual low & high span information is the same */
+ if((hsize_t)((hssize_t)span1->low + offset[0]) != span2->low || (hsize_t)((hssize_t)span1->high + offset[0]) != span2->high)
+ HGOTO_DONE(FALSE)
+
+ /* Check for down tree for this span */
+ if(span1->down != NULL || span2->down != NULL) {
+ /* If the rest of the span trees have a zero offset, use the faster comparison routine */
+ if(rest_zeros[0]) {
+ if(!H5S__hyper_cmp_spans(span1->down, span2->down))
+ HGOTO_DONE(FALSE)
+ else {
+ /* Keep going... */
+ } /* end else */
+ } /* end if */
+ else {
+ if(!H5S__hyper_spans_shape_same_helper(span1->down, span2->down, &offset[1], &rest_zeros[1]))
+ HGOTO_DONE(FALSE)
+ else {
+ /* Keep going... */
+ } /* end else */
+ } /* end else */
+ } /* end if */
+ else {
+ /* Keep going... */
+ } /* end else */
+
+ /* Advance to the next nodes in the span list */
+ span1 = span1->next;
+ span2 = span2->next;
+ } /* end while */
+ } /* end else */
+
+ /* Fall through, with default return value of 'TRUE' if spans were already visited */
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5S__hyper_spans_shape_same_helper() */
+
+
+/*--------------------------------------------------------------------------
+ NAME
+ H5S__hyper_spans_shape_same
+ PURPOSE
+ Check if two hyperslab span trees are the same shape
+ USAGE
+ hbool_t H5S__hyper_spans_shape_same(span1, span2)
+ H5S_hyper_span_info_t *span_info1; IN: First span tree to compare
+ H5S_hyper_span_info_t *span_info2; IN: Second span tree to compare
+ RETURNS
+ TRUE (1) or FALSE (0) on success, can't fail
+ DESCRIPTION
+ Compare two hyperslab span trees to determine if they refer to a selection
+ with the same shape. Very similar to H5S__hyper_cmp_spans, except the
+ selected elements can be offset by a vector.
+ GLOBAL VARIABLES
+ COMMENTS, BUGS, ASSUMPTIONS
+ EXAMPLES
+ REVISION LOG
+--------------------------------------------------------------------------*/
+static H5_ATTR_PURE hbool_t
+H5S__hyper_spans_shape_same(const H5S_hyper_span_info_t *span_info1,
+ const H5S_hyper_span_info_t *span_info2, unsigned ndims)
+{
+ const H5S_hyper_span_t *span1; /* Pointer to spans in first span tree */
+ const H5S_hyper_span_t *span2; /* Pointer to spans in second span tree */
+ hssize_t offset[H5S_MAX_RANK]; /* Offset vector for selections */
+ hbool_t rest_zeros[H5S_MAX_RANK]; /* Vector of flags to indicate when remaining offset is all zero */
+ hbool_t zero_offset; /* Whether the two selections have a non-zero offset */
+ unsigned u; /* Local index variable */
+ hbool_t ret_value = TRUE; /* Return value */
+
+ FUNC_ENTER_STATIC_NOERR
+
+ /* Sanity check */
+ HDassert(span_info1);
+ HDassert(span_info2);
+ HDassert(ndims > 0);
+
+ /* Initialize arrays */
+ HDmemset(offset, 0, sizeof(offset));
+ HDmemset(rest_zeros, 0, sizeof(rest_zeros));
+
+ /* Check for an offset between the two selections */
+ span1 = span_info1->head;
+ span2 = span_info2->head;
+ zero_offset = TRUE;
+ for(u = 0; u < ndims; u++) {
+ /* Check for offset in this dimension */
+ if(span1->low != span2->low) {
+ offset[u] = (hssize_t)span2->low - (hssize_t)span1->low;
+
+ /* Indicate that the offset vector is not all zeros */
+ if(zero_offset)
+ zero_offset = FALSE;
+ } /* end if */
+
+ /* Sanity check */
+ /* (Both span trees must have the same depth) */
+ HDassert((span1->down && span2->down) || (NULL == span1->down && NULL == span2->down));
+
+ /* Advance to next dimension */
+ if(span1->down) {
+ span1 = span1->down->head;
+ span2 = span2->down->head;
+ } /* end if */
+ } /* end for */
+
+ /* Check if there's a "tail" of all zeros in a non-zero offset vector */
+ if(!zero_offset) {
+ int i; /* Local index variable */
+
+ /* Find first non-zero offset, from the fastest dimension up */
+ for(i = (int)(ndims - 1); i >= 0; i--)
+ if(offset[i]) {
+ rest_zeros[i] = TRUE;
+ break;
+ } /* end if */
+
+ /* Sanity check */
+ /* (Must eventually have found a non-zero offset) */
+ HDassert(i >= 0);
+ } /* end if */
+
+ /* If the offset vector is all zero, we can use the faster span tree
+ * comparison routine. Otherwise, use a generalized version of that
+ * routine.
+ */
+ if(zero_offset)
+ ret_value = H5S__hyper_cmp_spans(span_info1, span_info2);
+ else
+ ret_value = H5S__hyper_spans_shape_same_helper(span_info1, span_info2, offset, rest_zeros);
+
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5S__hyper_spans_shape_same() */
+
+
+/*--------------------------------------------------------------------------
+ NAME
+ H5S__hyper_shape_same
+ PURPOSE
+ Check if a two hyperslab selections are the same shape
+ USAGE
+ htri_t H5S__hyper_shape_same(space1, space2)
+ const H5S_t *space1; IN: First dataspace to check
+ const H5S_t *space2; IN: Second dataspace to check
+ RETURNS
+ TRUE / FALSE / FAIL
+ DESCRIPTION
+ Checks to see if the current selection in each dataspace are the same
+ shape.
+ GLOBAL VARIABLES
+ COMMENTS, BUGS, ASSUMPTIONS
+ Handles when both are regular in an efficient way, otherwise converts
+ both to span tree form (if necessary) and compares efficiently them in
+ that form.
+
+ Rank of space1 must always be >= to rank of space2.
+ EXAMPLES
+ REVISION LOG
+--------------------------------------------------------------------------*/
+static htri_t
+H5S__hyper_shape_same(const H5S_t *space1, const H5S_t *space2)
+{
+ unsigned space1_rank; /* Number of dimensions of first dataspace */
+ unsigned space2_rank; /* Number of dimensions of second dataspace */
+ htri_t ret_value = TRUE; /* Return value */
FUNC_ENTER_STATIC
/* Check args */
- HDassert(space && H5S_SEL_HYPERSLABS == H5S_GET_SELECT_TYPE(space));
+ HDassert(space1);
+ HDassert(space2);
- /* Reset the number of points selected */
- space->select.num_elem = 0;
+ /* Get dataspace ranks */
+ space1_rank = space1->extent.rank;
+ space2_rank = space2->extent.rank;
- /* Release irregular hyperslab information */
- if(space->select.sel_info.hslab) {
- if(space->select.sel_info.hslab->span_lst != NULL)
- if(H5S__hyper_free_span_info(space->select.sel_info.hslab->span_lst) < 0)
- HGOTO_ERROR(H5E_INTERNAL, H5E_CANTFREE, FAIL, "failed to release hyperslab spans")
+ /* Sanity check */
+ HDassert(space1_rank >= space2_rank);
+ HDassert(space2_rank > 0);
+
+ /* Rebuild diminfo if it is invalid and has not been confirmed to be
+ * impossible */
+ if(space1->select.sel_info.hslab->diminfo_valid == H5S_DIMINFO_VALID_NO)
+ H5S__hyper_rebuild((H5S_t *)space1); /* Casting away const OK -QAK */
+ if(space2->select.sel_info.hslab->diminfo_valid == H5S_DIMINFO_VALID_NO)
+ H5S__hyper_rebuild((H5S_t *)space2); /* Casting away const OK -QAK */
+
+ /* If both are regular hyperslabs, compare their diminfo values */
+ if(space1->select.sel_info.hslab->diminfo_valid == H5S_DIMINFO_VALID_YES
+ && space2->select.sel_info.hslab->diminfo_valid == H5S_DIMINFO_VALID_YES) {
+ int space1_dim; /* Current dimension in first dataspace */
+ int space2_dim; /* Current dimension in second dataspace */
+
+ /* Initialize dimensions */
+ space1_dim = (int)space1_rank - 1;
+ space2_dim = (int)space2_rank - 1;
+
+ /* Check that the shapes are the same in the common dimensions, and that
+ * block == 1 in all dimensions that appear only in space1.
+ */
+ while(space2_dim >= 0) {
+ if(space1->select.sel_info.hslab->diminfo.opt[space1_dim].stride !=
+ space2->select.sel_info.hslab->diminfo.opt[space2_dim].stride)
+ HGOTO_DONE(FALSE)
- /* Release space for the hyperslab selection information */
- space->select.sel_info.hslab = H5FL_FREE(H5S_hyper_sel_t, space->select.sel_info.hslab);
+ if(space1->select.sel_info.hslab->diminfo.opt[space1_dim].count !=
+ space2->select.sel_info.hslab->diminfo.opt[space2_dim].count)
+ HGOTO_DONE(FALSE)
+
+ if(space1->select.sel_info.hslab->diminfo.opt[space1_dim].block !=
+ space2->select.sel_info.hslab->diminfo.opt[space2_dim].block)
+ HGOTO_DONE(FALSE)
+
+ space1_dim--;
+ space2_dim--;
+ } /* end while */
+
+ while(space1_dim >= 0) {
+ if(space1->select.sel_info.hslab->diminfo.opt[space1_dim].block != 1)
+ HGOTO_DONE(FALSE)
+
+ space1_dim--;
+ } /* end while */
} /* end if */
+ /* If both aren't regular, use fast irregular comparison */
+ else {
+ H5S_hyper_span_info_t *spans1; /* Hyperslab spans for first dataspace */
+
+ /* Make certain that both selections have span trees */
+ if(NULL == space1->select.sel_info.hslab->span_lst)
+ if(H5S__hyper_generate_spans((H5S_t *)space1) < 0) /* Casting away const OK -QAK */
+ HGOTO_ERROR(H5E_DATASPACE, H5E_UNINITIALIZED, FAIL, "can't construct span tree for hyperslab selection")
+ if(NULL == space2->select.sel_info.hslab->span_lst)
+ if(H5S__hyper_generate_spans((H5S_t *)space2) < 0) /* Casting away const OK -QAK */
+ HGOTO_ERROR(H5E_DATASPACE, H5E_UNINITIALIZED, FAIL, "can't construct span tree for hyperslab selection")
+
+ /* If rank of space A is different (guaranteed greater) than
+ * rank of space B, walk down the span tree, verifying
+ * that the block size is 1 on the way down.
+ */
+ if(space1_rank > space2_rank) {
+ unsigned diff_rank = space1_rank - space2_rank; /* Difference in ranks */
+
+ /* Walk down the dimensions */
+ spans1 = space1->select.sel_info.hslab->span_lst;
+ while(diff_rank > 0) {
+ H5S_hyper_span_t *span; /* Span for this dimension */
+
+ /* Get pointer to first span in tree */
+ span = spans1->head;
+
+ /* Check for more spans in this dimension */
+ if(span->next)
+ HGOTO_DONE(FALSE)
+
+ /* Check for span size > 1 element */
+ if(span->low != span->high)
+ HGOTO_DONE(FALSE)
+
+ /* Walk down to the next dimension */
+ spans1 = span->down;
+ diff_rank--;
+ } /* end while */
+
+ /* Sanity check */
+ HDassert(spans1);
+ } /* end if */
+ else
+ spans1 = space1->select.sel_info.hslab->span_lst;
+
+ /* Compare the span trees */
+ ret_value = H5S__hyper_spans_shape_same(spans1, space2->select.sel_info.hslab->span_lst, space2_rank);
+ } /* end else */
+
+ /* Fall through with 'TRUE' value, if not set earlier */
done:
FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5S__hyper_release() */
+} /* end H5S__hyper_shape_same() */
/*--------------------------------------------------------------------------
NAME
- H5S__hyper_recover_span
+ H5S__hyper_release
PURPOSE
- Recover a generated span, if appropriate
+ Release hyperslab selection information for a dataspace
USAGE
- herr_t H5S__hyper_recover_span(recover, curr_span, next_span)
- unsigned *recover; IN/OUT: Pointer recover flag
- H5S_hyper_span_t **curr_span; IN/OUT: Pointer to current span in list
- H5S_hyper_span_t *next_span; IN: Pointer to next span
+ herr_t H5S__hyper_release(space)
+ H5S_t *space; IN: Pointer to dataspace
RETURNS
- Non-negative on success, negative on failure
+ Non-negative on success/Negative on failure
DESCRIPTION
- Check if the current span needs to be recovered and free it if so.
- Set the current span to the next span in any case.
+ Releases all hyperslab selection information for a dataspace
GLOBAL VARIABLES
COMMENTS, BUGS, ASSUMPTIONS
EXAMPLES
REVISION LOG
--------------------------------------------------------------------------*/
static herr_t
-H5S__hyper_recover_span(hbool_t *recover, H5S_hyper_span_t **curr_span, H5S_hyper_span_t *next_span)
+H5S__hyper_release(H5S_t *space)
{
FUNC_ENTER_STATIC_NOERR
- HDassert(recover);
- HDassert(curr_span);
+ /* Check args */
+ HDassert(space && H5S_SEL_HYPERSLABS == H5S_GET_SELECT_TYPE(space));
- /* Check if the span should be recovered */
- if(*recover) {
- H5S__hyper_free_span(*curr_span);
- *recover = FALSE;
- } /* end if */
+ /* Reset the number of points selected */
+ space->select.num_elem = 0;
- /* Set the current span to next span */
- *curr_span = next_span;
+ /* Release irregular hyperslab information */
+ if(space->select.sel_info.hslab) {
+ if(space->select.sel_info.hslab->span_lst != NULL)
+ H5S__hyper_free_span_info(space->select.sel_info.hslab->span_lst);
+
+ /* Release space for the hyperslab selection information */
+ space->select.sel_info.hslab = H5FL_FREE(H5S_hyper_sel_t, space->select.sel_info.hslab);
+ } /* end if */
FUNC_LEAVE_NOAPI(SUCCEED)
-} /* H5S__hyper_recover_span() */
+} /* end H5S__hyper_release() */
/*--------------------------------------------------------------------------
@@ -3453,7 +5756,7 @@ H5S__hyper_recover_span(hbool_t *recover, H5S_hyper_span_t **curr_span, H5S_hype
unsigned rank; IN: Number of dimensions of coordinate
hsize_t *coords; IN: Location of element
RETURNS
- Non-negative on success, negative on failure
+ Non-NULL pointer to new span tree on success, NULL on failure
DESCRIPTION
Create a span tree for a single element
GLOBAL VARIABLES
@@ -3475,14 +5778,20 @@ H5S__hyper_coord_to_span(unsigned rank, const hsize_t *coords)
/* Search for location to insert new element in tree */
if(rank > 1) {
- /* Allocate a span info node */
- if(NULL == (down = H5FL_CALLOC(H5S_hyper_span_info_t)))
+ /* Allocate a span info node for coordinates below this one */
+ if(NULL == (down = H5S__hyper_new_span_info(rank - 1)))
HGOTO_ERROR(H5E_DATASPACE, H5E_CANTALLOC, NULL, "can't allocate hyperslab span")
+ /* Set the low & high bounds for this span info node */
+ H5MM_memcpy(down->low_bounds, &coords[1], (rank - 1) * sizeof(hsize_t));
+ H5MM_memcpy(down->high_bounds, &coords[1], (rank - 1) * sizeof(hsize_t));
/* Build span tree for coordinates below this one */
if(NULL == (down->head = H5S__hyper_coord_to_span(rank - 1, &coords[1])))
HGOTO_ERROR(H5E_DATASPACE, H5E_CANTALLOC, NULL, "can't allocate hyperslab span")
+
+ /* Update the tail pointer of the down dimension, and it's a single span element */
+ down->tail = down->head;
} /* end if */
/* Build span for this coordinate */
@@ -3504,12 +5813,13 @@ done:
NAME
H5S__hyper_add_span_element_helper
PURPOSE
- Add a single element to a span tree
+ Helper routine to add a single element to a span tree
USAGE
- herr_t H5S_hyper_add_span_element_helper(prev_span, span_tree, rank, coords)
+ herr_t H5S__hyper_add_span_element_helper(span_tree, rank, coords, first_dim_modified)
H5S_hyper_span_info_t *span_tree; IN/OUT: Pointer to span tree to append to
unsigned rank; IN: Number of dimensions of coordinates
- hsize_t *coords; IN: Location of element to add to span tree
+ hsize_t *coords; IN: Location of element to add to span tree
+ int *first_dim_modified; IN: Index of the first dimension modified
RETURNS
Non-negative on success, negative on failure
DESCRIPTION
@@ -3522,13 +5832,9 @@ done:
--------------------------------------------------------------------------*/
static herr_t
H5S__hyper_add_span_element_helper(H5S_hyper_span_info_t *span_tree,
- unsigned rank, const hsize_t *coords)
+ unsigned rank, const hsize_t *coords, int *first_dim_modified)
{
- H5S_hyper_span_info_t *tspan_info; /* Temporary pointer to span info */
- H5S_hyper_span_info_t *prev_span_info; /* Pointer to span info for level above current position */
- H5S_hyper_span_t *tmp_span; /* Temporary pointer to a span */
- H5S_hyper_span_t *tmp2_span; /* Another temporary pointer to a span */
- H5S_hyper_span_t *new_span; /* New span created for element */
+ H5S_hyper_span_t *tail_span; /* Pointer to the tail span of one dimension */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_STATIC
@@ -3537,166 +5843,196 @@ H5S__hyper_add_span_element_helper(H5S_hyper_span_info_t *span_tree,
HDassert(span_tree);
HDassert(rank > 0);
HDassert(coords);
+ HDassert(first_dim_modified);
/* Get pointer to last span in span tree */
- tspan_info=span_tree;
- if(span_tree->scratch)
- tmp_span=(H5S_hyper_span_t *)span_tree->scratch;
- else {
- tmp_span=span_tree->head;
- HDassert(tmp_span);
- span_tree->scratch=(H5S_hyper_span_info_t *)tmp_span;
- } /* end else */
-
- /* Find last span tree which includes a portion of the coordinate */
- prev_span_info=NULL;
- while(coords[0]>=tmp_span->low && coords[0]<=tmp_span->high) {
- /* Move rank & coordinate offset down a dimension */
- rank--;
- coords++;
-
- /* Remember the span tree we are descending into */
- prev_span_info=tspan_info;
- tspan_info=tmp_span->down;
+ tail_span = span_tree->tail;
+
+ /* Determine if tail span includes a portion of the coordinate */
+ /* (Should never happen with the lowest level in the span tree) */
+ if(coords[0] >= tail_span->low && coords[0] <= tail_span->high) {
+ H5S_hyper_span_t *prev_down_tail_span; /* Pointer to previous down spans' tail pointer */
+ hsize_t prev_down_tail_span_high; /* Value of previous down spans' tail's high value */
+
+ /* Retain into about down spans' tail */
+ prev_down_tail_span = tail_span->down->tail;
+ prev_down_tail_span_high = tail_span->down->tail->high;
+
+ /* Drop down a dimension */
+ HDassert(rank > 1);
+ if(H5S__hyper_add_span_element_helper(tail_span->down, rank - 1, &coords[1], first_dim_modified) < 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTINSERT, FAIL, "can't insert coordinate into span tree")
+
+ /* Check & update high bounds for lower dimensions */
+ if(*first_dim_modified >= 0) {
+ unsigned first_dim; /* First dimension modified, relative to this span tree */
+ hbool_t first_dim_set = FALSE; /* Whether first dimension modified is set */
+ unsigned u; /* Local index variable */
- /* Get the last span in this span's 'down' tree */
- if(tspan_info->scratch)
- tmp_span=(H5S_hyper_span_t *)tspan_info->scratch;
- else {
- tmp_span=tspan_info->head;
- HDassert(tmp_span);
- tspan_info->scratch=(H5S_hyper_span_info_t *)tmp_span;
- } /* end else */
- } /* end while */
+ /* Adjust first dimension modified to be relative to this span tree */
+ first_dim = (unsigned)(*first_dim_modified + 1);
- /* Check if we made it all the way to the bottom span in the tree */
- if(rank>1) {
- /* Before we create another span at this level in the tree, check if
- * the last span's "down tree" was equal to any other spans in this
- * list of spans in the span tree.
- *
- * If so, release last span information and make last span merge into
- * previous span (if possible), or at least share their "down tree"
- * information.
- */
- tmp2_span=tspan_info->head;
- while(tmp2_span!=tmp_span) {
- if(H5S__hyper_cmp_spans(tmp2_span->down,tmp_span->down)==TRUE) {
- /* Check for merging into previous span */
- if(tmp2_span->high+1==tmp_span->low) {
- /* Release last span created */
- H5S__hyper_free_span(tmp_span);
+ /* Reset modified dimension, in case no bounds in this span tree change */
+ *first_dim_modified = -1;
- /* Increase size of previous span */
- tmp2_span->high++;
- tmp2_span->nelem++;
+ /* Iterate through coordinates */
+ for(u = first_dim; u < rank; u++) {
+ /* Check if coordinate is outside the bounds for this span tree */
+ if(coords[u] > span_tree->high_bounds[u]) {
+ /* Update high bounds for this tree */
+ span_tree->high_bounds[u] = coords[u];
- /* Reset the 'tmp_span' for the rest of this block's algorithm */
- tmp_span=tmp2_span;
+ /* Need to signal to higher dimensions if high bounds changed */
+ if(!first_dim_set) {
+ *first_dim_modified = (int)u;
+ first_dim_set = TRUE;
+ } /* end if */
} /* end if */
- /* Span is disjoint, but has the same "down tree" selection */
- else {
- /* Release "down tree" information */
- H5S__hyper_free_span_info(tmp_span->down);
+ } /* end for */
+ } /* end if */
- /* Point at earlier span's "down tree" */
- tmp_span->down=tmp2_span->down;
+ /* Check if previous tail span in down spans is different than current
+ * tail span, or if its high value changed, in which case we should
+ * check if the updated node can share down spans with other nodes.
+ */
+ if(tail_span->down->tail != prev_down_tail_span ||
+ prev_down_tail_span_high != tail_span->down->tail->high) {
+ H5S_hyper_span_t *stop_span; /* Pointer to span to stop at */
+ H5S_hyper_span_t *tmp_span; /* Temporary pointer to a span */
+ uint64_t op_gen; /* Operation generation value */
+
+ /* Determine which span to stop at */
+ if(tail_span->down->tail != prev_down_tail_span) {
+ /* Sanity check */
+ HDassert(prev_down_tail_span->next == tail_span->down->tail);
+
+ /* Set the span to stop at */
+ stop_span = prev_down_tail_span;
+ } /* end if */
+ else {
+ /* Sanity check */
+ HDassert(prev_down_tail_span_high != tail_span->down->tail->high);
- /* Increment reference count on shared "down tree" */
- tmp_span->down->count++;
- } /* end else */
+ /* Set the span to stop at */
+ stop_span = tail_span->down->tail;
+ } /* end else */
- /* Found span to merge into, break out now */
- break;
- } /* end if */
+ /* Acquire an operation generation value for this operation */
+ op_gen = H5S__hyper_get_op_gen();
- /* Advance to next span to check */
- tmp2_span=tmp2_span->next;
- } /* end while */
+ /* Check if the 'stop' span in the "down tree" is equal to any other
+ * spans in the list of spans in the span tree.
+ *
+ * If so, release last span information and make last span merge into
+ * previous span (if possible), or at least share their "down tree"
+ * information.
+ */
+ tmp_span = tail_span->down->head;
+ while(tmp_span != stop_span) {
+ hbool_t attempt_merge_spans = FALSE; /* Whether to merge spans */
- /* Make span tree for current coordinates */
- if(NULL == (new_span = H5S__hyper_coord_to_span(rank, coords)))
- HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "can't allocate hyperslab span")
+ /* Different tests for when to run the 'merge' algorithm,
+ * depending whether there's "down trees" or not.
+ */
+ if(NULL == tmp_span->down) {
+ /* Spin through spans until we find the one before the 'stop' span */
+ if(tmp_span->next == stop_span)
+ attempt_merge_spans = TRUE;
+ } /* end if */
+ else {
+ /* Check if we've compared the 'stop' span's "down tree" to
+ * this span's "down tree" already.
+ */
+ if(tmp_span->down->op_gen != op_gen) {
+ if(H5S__hyper_cmp_spans(tmp_span->down, stop_span->down))
+ attempt_merge_spans = TRUE;
+
+ /* Remember that we visited this span's "down tree" already */
+ /* (Because it wasn't the same as the 'stop' span's down tree
+ * and we don't need to compare it again)
+ */
+ tmp_span->down->op_gen = op_gen;
+ } /* end if */
+ } /* end else */
- /* Add new span tree as span */
- HDassert(tmp_span);
- tmp_span->next=new_span;
+ /* Check for merging into previous span */
+ if(attempt_merge_spans) {
+ if(tmp_span->high + 1 == stop_span->low) {
+ /* Increase size of previous span */
+ tmp_span->high++;
- /* Make scratch pointer point to last span in list */
- HDassert(tspan_info);
- tspan_info->scratch=(H5S_hyper_span_info_t *)new_span;
+ /* Update pointers appropriately */
+ if(stop_span == prev_down_tail_span) {
+ /* Sanity check */
+ HDassert(stop_span->next == tail_span->down->tail);
- /* Set the proper 'pstride' for new span */
- new_span->pstride=new_span->low-tmp_span->low;
- } /* end if */
- else {
- /* Does new node adjoin existing node? */
- if(tmp_span->high+1==coords[0]) {
- tmp_span->high++;
- tmp_span->nelem++;
-
- /* Check if this span tree should now be merged with a level higher in the tree */
- if(prev_span_info!=NULL) {
- /* Before we create another span at this level in the tree, check if
- * the last span's "down tree" was equal to any other spans in this
- * list of spans in the span tree.
- *
- * If so, release last span information and make last span merge into
- * previous span (if possible), or at least share their "down tree"
- * information.
- */
- tmp2_span=prev_span_info->head;
- tmp_span=(H5S_hyper_span_t *)prev_span_info->scratch;
- while(tmp2_span!=tmp_span) {
- if(H5S__hyper_cmp_spans(tmp2_span->down,tmp_span->down)==TRUE) {
- /* Check for merging into previous span */
- if(tmp2_span->high+1==tmp_span->low) {
- /* Release last span created */
- H5S__hyper_free_span(tmp_span);
-
- /* Increase size of previous span */
- tmp2_span->high++;
- tmp2_span->nelem++;
-
- /* Update pointers */
- tmp2_span->next=NULL;
- prev_span_info->scratch=(H5S_hyper_span_info_t *)tmp2_span;
+ tmp_span->next = stop_span->next;
} /* end if */
- /* Span is disjoint, but has the same "down tree" selection */
else {
- /* Release "down tree" information */
- H5S__hyper_free_span_info(tmp_span->down);
+ /* Sanity check */
+ HDassert(tmp_span->next == tail_span->down->tail);
- /* Point at earlier span's "down tree" */
- tmp_span->down=tmp2_span->down;
-
- /* Increment reference count on shared "down tree" */
- tmp_span->down->count++;
+ tmp_span->next = NULL;
+ tail_span->down->tail = tmp_span;
} /* end else */
- /* Found span to merge into, break out now */
- break;
+ /* Release last span created */
+ H5S__hyper_free_span(stop_span);
} /* end if */
+ /* Span is disjoint, but has the same "down tree" selection */
+ /* (If it has a "down tree") */
+ else if(stop_span->down) {
+ /* Release "down tree" information */
+ H5S__hyper_free_span_info(stop_span->down);
- /* Advance to next span to check */
- tmp2_span=tmp2_span->next;
- } /* end while */
- } /* end if */
+ /* Point at earlier span's "down tree" */
+ stop_span->down = tmp_span->down;
+
+ /* Increment reference count on shared "down tree" */
+ stop_span->down->count++;
+ } /* end else */
+
+ /* Found span to merge into, break out now */
+ break;
+ } /* end if */
+
+ /* Advance to next span to check */
+ tmp_span = tmp_span->next;
+ } /* end while */
} /* end if */
- else {
- if(NULL == (new_span = H5S__hyper_new_span(coords[0], coords[0], NULL, NULL)))
- HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "can't allocate hyperslab span")
+ } /* end if */
+ else {
+ unsigned u; /* Local index variable */
- /* Add new span tree as span */
- HDassert(tmp_span);
- tmp_span->next=new_span;
+ /* Check if we made it all the way to the bottom span list in the tree
+ * and the new coordinate adjoins the current tail span.
+ */
+ if(rank == 1 && (tail_span->high + 1) == coords[0])
+ /* Append element to current tail span */
+ tail_span->high++;
+ else {
+ H5S_hyper_span_t *new_span; /* New span created for element */
- /* Make scratch pointer point to last span in list */
- tspan_info->scratch=(H5S_hyper_span_info_t *)new_span;
+ /* Make span tree for current coordinate(s) */
+ if(NULL == (new_span = H5S__hyper_coord_to_span(rank, coords)))
+ HGOTO_ERROR(H5E_DATASPACE, H5E_CANTALLOC, FAIL, "can't allocate hyperslab spans for coordinate")
- /* Set the proper 'pstride' for new span */
- new_span->pstride = new_span->low - tmp_span->low;
+ /* Add new span to span tree list */
+ tail_span->next = new_span;
+ span_tree->tail = new_span;
} /* end else */
+
+ /* Update high bound for current span tree */
+ HDassert(coords[0] > span_tree->high_bounds[0]);
+ span_tree->high_bounds[0] = coords[0];
+
+ /* Update high bounds for dimensions below this one */
+ for(u = 1; u < rank; u++)
+ if(coords[u] > span_tree->high_bounds[u])
+ span_tree->high_bounds[u] = coords[u];
+
+ /* Need to signal to higher dimensions that high bounds changed */
+ *first_dim_modified = 0;
} /* end else */
done:
@@ -3721,6 +6057,24 @@ done:
GLOBAL VARIABLES
COMMENTS, BUGS, ASSUMPTIONS
Assumes that the element is not already in the dataspace's selection
+
+ NOTE: There's also an assumption about the context of this function call -
+ This function is only called is only being called from H5D_chunk_mem_cb
+ in src/H5Dchunk.c, when the library is iterating over a memory
+ selection, so the coordinates passed to H5S_hyper_add_span_element will
+ always be in increasing order (according to a row-major (i.e. C, not
+ FORTRAN) scan) over the dataset. Therefore, for every input of
+ coordinates, only the last span element (i.e., the tail pointer) in
+ one dimension is checked against the input.
+
+ NOTE: This algorithm is definitely "correct" and tries to conserve memory
+ as much as possible, but it's doing a _lot_ of work that might be
+ better spent running a similar algorithm to "condense" the span tree
+ (possibly even back into a regular selection) just before the selection
+ is used for I/O on the chunk. I'm not going to spend the time on this
+ currently, but it does sound like a good direction to explore.
+ QAK, 2019/01/24
+
EXAMPLES
REVISION LOG
--------------------------------------------------------------------------*/
@@ -3740,9 +6094,13 @@ H5S_hyper_add_span_element(H5S_t *space, unsigned rank, const hsize_t *coords)
/* Check if this is the first element in the selection */
if(NULL == space->select.sel_info.hslab) {
/* Allocate a span info node */
- if(NULL == (head = H5FL_CALLOC(H5S_hyper_span_info_t)))
+ if(NULL == (head = H5S__hyper_new_span_info(rank)))
HGOTO_ERROR(H5E_DATASPACE, H5E_CANTALLOC, FAIL, "can't allocate hyperslab span info")
+ /* Set the low & high bounds for this span info node */
+ H5MM_memcpy(head->low_bounds, coords, rank * sizeof(hsize_t));
+ H5MM_memcpy(head->high_bounds, coords, rank * sizeof(hsize_t));
+
/* Set the reference count */
head->count = 1;
@@ -3750,6 +6108,9 @@ H5S_hyper_add_span_element(H5S_t *space, unsigned rank, const hsize_t *coords)
if(NULL == (head->head = H5S__hyper_coord_to_span(rank, coords)))
HGOTO_ERROR(H5E_DATASPACE, H5E_CANTALLOC, FAIL, "can't allocate hyperslab spans for coordinate")
+ /* Update the tail pointer of this newly created span in dimension "rank" */
+ head->tail = head->head;
+
/* Allocate selection info */
if(NULL == (space->select.sel_info.hslab = H5FL_MALLOC(H5S_hyper_sel_t)))
HGOTO_ERROR(H5E_DATASPACE, H5E_CANTALLOC, FAIL, "can't allocate hyperslab selection")
@@ -3761,7 +6122,7 @@ H5S_hyper_add_span_element(H5S_t *space, unsigned rank, const hsize_t *coords)
space->select.type = H5S_sel_hyper;
/* Reset "regular" hyperslab flag */
- space->select.sel_info.hslab->diminfo_valid = FALSE;
+ space->select.sel_info.hslab->diminfo_valid = H5S_DIMINFO_VALID_NO;
/* Set unlim_dim */
space->select.sel_info.hslab->unlim_dim = -1;
@@ -3770,7 +6131,10 @@ H5S_hyper_add_span_element(H5S_t *space, unsigned rank, const hsize_t *coords)
space->select.num_elem = 1;
} /* end if */
else {
- if(H5S__hyper_add_span_element_helper(space->select.sel_info.hslab->span_lst, rank, coords) < 0)
+ int first_dim_modified = -1; /* Index of first dimension modified */
+
+ /* Add the element to the current set of spans */
+ if(H5S__hyper_add_span_element_helper(space->select.sel_info.hslab->span_lst, rank, coords, &first_dim_modified) < 0)
HGOTO_ERROR(H5E_DATASPACE, H5E_CANTINSERT, FAIL, "can't insert coordinate into span tree")
/* Increment # of elements in selection */
@@ -3788,236 +6152,16 @@ done:
/*--------------------------------------------------------------------------
NAME
- H5S_hyper_reset_scratch
- PURPOSE
- Reset the scratch information for span tree
- USAGE
- herr_t H5S_hyper_reset_scratch(space)
- H5S_t *space; IN/OUT: Pointer to dataspace to reset scratch pointers
- RETURNS
- Non-negative on success, negative on failure
- DESCRIPTION
- Resets the "scratch" pointers used for various tasks in computing hyperslab
- spans.
- GLOBAL VARIABLES
- COMMENTS, BUGS, ASSUMPTIONS
- EXAMPLES
- REVISION LOG
---------------------------------------------------------------------------*/
-herr_t
-H5S_hyper_reset_scratch(H5S_t *space)
-{
- herr_t ret_value = SUCCEED; /* Return value */
-
- FUNC_ENTER_NOAPI(FAIL)
-
- HDassert(space);
-
- /* Check if there are spans in the span tree */
- if(space->select.sel_info.hslab->span_lst != NULL)
- /* Reset the scratch pointers for the next routine which needs them */
- H5S__hyper_span_scratch(space->select.sel_info.hslab->span_lst);
-
-done:
- FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5S_hyper_reset_scratch() */
-
-
-/*--------------------------------------------------------------------------
- NAME
- H5S_hyper_convert
- PURPOSE
- Convert a compatible selection to span tree form
- USAGE
- herr_t H5S_hyper_convert(space)
- H5S_t *space; IN/OUT: Pointer to dataspace to convert
- RETURNS
- Non-negative on success, negative on failure
- DESCRIPTION
- Converts a compatible selection (currently only "all" selections) to the
- span-tree form of a hyperslab selection. (Point and "none" selection aren't
- currently supported and hyperslab selection always have the span-tree form
- available).
- GLOBAL VARIABLES
- COMMENTS, BUGS, ASSUMPTIONS
- EXAMPLES
- REVISION LOG
---------------------------------------------------------------------------*/
-herr_t
-H5S_hyper_convert(H5S_t *space)
-{
- herr_t ret_value = SUCCEED; /* Return value */
-
- FUNC_ENTER_NOAPI(FAIL)
-
- HDassert(space);
-
- /* Check the type of selection */
- switch(H5S_GET_SELECT_TYPE(space)) {
- case H5S_SEL_ALL: /* All elements selected in dataspace */
- /* Convert current "all" selection to "real" hyperslab selection */
- {
- const hsize_t *tmp_start; /* Temporary start information */
- const hsize_t *tmp_stride; /* Temporary stride information */
- const hsize_t *tmp_count; /* Temporary count information */
- const hsize_t *tmp_block; /* Temporary block information */
-
- /* Set up temporary information for the dimensions */
- tmp_start = H5S_hyper_zeros_g;
- tmp_stride = tmp_count = H5S_hyper_ones_g;
- tmp_block = space->extent.size;
-
- /* Convert to hyperslab selection */
- if(H5S_select_hyperslab(space,H5S_SELECT_SET,tmp_start,tmp_stride,tmp_count,tmp_block)<0)
- HGOTO_ERROR(H5E_DATASPACE, H5E_CANTSET, FAIL, "can't convert selection")
- } /* end case */
- break;
-
- case H5S_SEL_HYPERSLABS: /* Hyperslab selection */
- break;
-
- case H5S_SEL_NONE: /* No elements selected in dataspace */
- case H5S_SEL_POINTS: /* Point selection */
- case H5S_SEL_ERROR: /* Selection error */
- case H5S_SEL_N: /* Selection count */
- default:
- HGOTO_ERROR(H5E_ARGS, H5E_UNSUPPORTED, FAIL, "can't convert to span tree selection")
- } /* end switch */
-
-done:
- FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5S_hyper_convert() */
-
-#ifdef LATER
-
-/*--------------------------------------------------------------------------
- NAME
- H5S_hyper_intersect_helper
- PURPOSE
- Helper routine to detect intersections in span trees
- USAGE
- htri_t H5S_hyper_intersect_helper(spans1, spans2)
- H5S_hyper_span_info_t *spans1; IN: First span tree to operate with
- H5S_hyper_span_info_t *spans2; IN: Second span tree to operate with
- RETURNS
- Non-negative on success, negative on failure
- DESCRIPTION
- Quickly detect intersections between two span trees
- GLOBAL VARIABLES
- COMMENTS, BUGS, ASSUMPTIONS
- EXAMPLES
- REVISION LOG
---------------------------------------------------------------------------*/
-static htri_t
-H5S_hyper_intersect_helper (H5S_hyper_span_info_t *spans1, H5S_hyper_span_info_t *spans2)
-{
- H5S_hyper_span_t *curr1; /* Pointer to current span in 1st span tree */
- H5S_hyper_span_t *curr2; /* Pointer to current span in 2nd span tree */
- htri_t status; /* Status from recursive call */
- htri_t ret_value=FALSE; /* Return value */
-
- FUNC_ENTER_NOAPI_NOINIT
-
- /* Sanity check */
- HDassert((spans1 && spans2) || (spans1 == NULL && spans2 == NULL));
-
- /* "NULL" span trees compare as overlapping */
- if(spans1==NULL && spans2==NULL)
- HGOTO_DONE(TRUE);
-
- /* Get the span lists for each span in this tree */
- curr1=spans1->head;
- curr2=spans2->head;
-
- /* Iterate over the spans in each tree */
- while(curr1!=NULL && curr2!=NULL) {
- /* Check for 1st span entirely before 2nd span */
- if(curr1->high<curr2->low)
- curr1=curr1->next;
- /* Check for 2nd span entirely before 1st span */
- else if(curr2->high<curr1->low)
- curr2=curr2->next;
- /* Spans must overlap */
- else {
- /* Recursively check spans in next dimension down */
- if((status=H5S_hyper_intersect_helper(curr1->down,curr2->down))<0)
- HGOTO_ERROR(H5E_DATASPACE, H5E_BADSELECT, FAIL, "can't perform hyperslab intersection check")
-
- /* If there is a span intersection in the down dimensions, the span trees overlap */
- if(status==TRUE)
- HGOTO_DONE(TRUE);
-
- /* No intersection in down dimensions, advance to next span */
- if(curr1->high<curr2->high)
- curr1=curr1->next;
- else
- curr2=curr2->next;
- } /* end else */
- } /* end while */
-
-done:
- FUNC_LEAVE_NOAPI(ret_value)
-} /* H5S_hyper_intersect_helper() */
-
-
-/*--------------------------------------------------------------------------
- NAME
- H5S_hyper_intersect
- PURPOSE
- Detect intersections in span trees
- USAGE
- htri_t H5S_hyper_intersect(space1, space2)
- H5S_t *space1; IN: First dataspace to operate on span tree
- H5S_t *space2; IN: Second dataspace to operate on span tree
- RETURNS
- Non-negative on success, negative on failure
- DESCRIPTION
- Quickly detect intersections between two span trees
- GLOBAL VARIABLES
- COMMENTS, BUGS, ASSUMPTIONS
- EXAMPLES
- REVISION LOG
---------------------------------------------------------------------------*/
-htri_t
-H5S_hyper_intersect (H5S_t *space1, H5S_t *space2)
-{
- htri_t ret_value=FAIL; /* Return value */
-
- FUNC_ENTER_NOAPI_NOINIT
-
- /* Sanity check */
- HDassert(space1);
- HDassert(space2);
-
- /* Check that the space selections both have span trees */
- if(space1->select.sel_info.hslab->span_lst==NULL ||
- space2->select.sel_info.hslab->span_lst==NULL)
- HGOTO_ERROR(H5E_DATASPACE, H5E_UNINITIALIZED, FAIL, "dataspace does not have span tree")
-
- /* Check that the dataspaces are both the same rank */
- if(space1->extent.rank!=space2->extent.rank)
- HGOTO_ERROR(H5E_DATASPACE, H5E_BADRANGE, FAIL, "dataspace ranks don't match")
-
- /* Perform the span-by-span intersection check */
- if((ret_value=H5S_hyper_intersect_helper(space1->select.sel_info.hslab->span_lst,space2->select.sel_info.hslab->span_lst))<0)
- HGOTO_ERROR(H5E_DATASPACE, H5E_BADSELECT, FAIL, "can't perform hyperslab intersection check")
-
-done:
- FUNC_LEAVE_NOAPI(ret_value)
-} /* H5S_hyper_intersect() */
-#endif /* LATER */
-
-
-/*--------------------------------------------------------------------------
- NAME
H5S__hyper_intersect_block_helper
PURPOSE
Helper routine to detect intersections in span trees
USAGE
hbool_t H5S__hyper_intersect_block_helper(spans, start, end)
H5S_hyper_span_info_t *spans; IN: First span tree to operate with
+ unsigned rank; IN: Number of dimensions for span tree
hsize_t *start; IN: Starting coordinate for block
hsize_t *end; IN: Ending coordinate for block
+ uint64_t op_gen; IN: Operation generation
RETURN
Non-negative (TRUE/FALSE) on success, can't fail
DESCRIPTION
@@ -4028,10 +6172,9 @@ done:
REVISION LOG
--------------------------------------------------------------------------*/
static hbool_t
-H5S__hyper_intersect_block_helper(const H5S_hyper_span_info_t *spans,
- const hsize_t *start, const hsize_t *end)
+H5S__hyper_intersect_block_helper(H5S_hyper_span_info_t *spans,
+ unsigned rank, const hsize_t *start, const hsize_t *end, uint64_t op_gen)
{
- H5S_hyper_span_t *curr; /* Pointer to current span in 1st span tree */
hbool_t ret_value = FALSE; /* Return value */
FUNC_ENTER_STATIC_NOERR
@@ -4041,37 +6184,52 @@ H5S__hyper_intersect_block_helper(const H5S_hyper_span_info_t *spans,
HDassert(start);
HDassert(end);
- /* Get the span list for spans in this tree */
- curr = spans->head;
-
- /* Iterate over the spans in the tree */
- while(curr != NULL) {
- /* Check for span entirely before block */
- if(curr->high < *start)
- /* Advance to next span in this dimension */
- curr = curr->next;
- /* If this span is past the end of the block, then we're done in this dimension */
- else if(curr->low > *end)
- HGOTO_DONE(FALSE)
- /* block & span overlap */
- else {
- if(curr->down == NULL)
- HGOTO_DONE(TRUE)
- else {
- hbool_t status; /* Status from recursive call */
+ /* Check if we've already visited this span tree */
+ if(spans->op_gen != op_gen) {
+ H5S_hyper_span_t *curr; /* Pointer to current span in 1st span tree */
+ unsigned u; /* Local index variable */
- /* Recursively check spans in next dimension down */
- status = H5S__hyper_intersect_block_helper(curr->down, start + 1, end + 1);
+ /* Verify that there is a possibility of an overlap by checking the block
+ * against the low & high bounds for the span tree.
+ */
+ for(u = 0; u < rank; u++)
+ if(start[u] > spans->high_bounds[u] || end[u] < spans->low_bounds[u])
+ HGOTO_DONE(FALSE)
- /* If there is a span intersection in the down dimensions, the span trees overlap */
- if(status == TRUE)
- HGOTO_DONE(TRUE);
+ /* Get the span list for spans in this tree */
+ curr = spans->head;
- /* No intersection in down dimensions, advance to next span */
+ /* Iterate over the spans in the tree */
+ while(curr != NULL) {
+ /* Check for span entirely before block */
+ if(curr->high < *start)
+ /* Advance to next span in this dimension */
curr = curr->next;
+ /* If this span is past the end of the block, then we're done in this dimension */
+ else if(curr->low > *end)
+ HGOTO_DONE(FALSE)
+ /* block & span overlap */
+ else {
+ /* If this is the bottom dimension, then the span tree overlaps the block */
+ if(curr->down == NULL)
+ HGOTO_DONE(TRUE)
+ /* Recursively check spans in next dimension down */
+ else {
+ /* If there is an intersection in the "down" dimensions,
+ * the span trees overlap.
+ */
+ if(H5S__hyper_intersect_block_helper(curr->down, rank - 1, start + 1, end + 1, op_gen))
+ HGOTO_DONE(TRUE)
+
+ /* No intersection in down dimensions, advance to next span */
+ curr = curr->next;
+ } /* end else */
} /* end else */
- } /* end else */
- } /* end while */
+ } /* end while */
+
+ /* Set the tree's operation generation */
+ spans->op_gen = op_gen;
+ } /* end if */
/* Fall through with 'FALSE' return value */
@@ -4096,33 +6254,130 @@ done:
Quickly detect intersections between span tree and block
GLOBAL VARIABLES
COMMENTS, BUGS, ASSUMPTIONS
+ Does not use selection offset.
EXAMPLES
REVISION LOG
--------------------------------------------------------------------------*/
htri_t
H5S_hyper_intersect_block(H5S_t *space, const hsize_t *start, const hsize_t *end)
{
+ const hsize_t *low_bounds, *high_bounds; /* Pointers to the correct pair of low & high bounds */
+ unsigned u; /* Local index variable */
htri_t ret_value = FAIL; /* Return value */
FUNC_ENTER_NOAPI(FAIL)
/* Sanity check */
HDassert(space);
+ HDassert(H5S_SEL_HYPERSLABS == H5S_GET_SELECT_TYPE(space));
HDassert(start);
HDassert(end);
- /* Check for 'all' selection, instead of a hyperslab selection */
- /* (Technically, this shouldn't be in the "hyperslab" routines...) */
- if(H5S_GET_SELECT_TYPE(space) == H5S_SEL_ALL)
- HGOTO_DONE(TRUE);
+ /* Attempt to rebuild diminfo if it is invalid and has not been confirmed
+ * to be impossible.
+ */
+ if(space->select.sel_info.hslab->diminfo_valid == H5S_DIMINFO_VALID_NO)
+ H5S__hyper_rebuild(space);
- /* Check that the space selection has a span tree */
- if(NULL == space->select.sel_info.hslab->span_lst)
- if(H5S__hyper_generate_spans(space) < 0)
- HGOTO_ERROR(H5E_DATASPACE, H5E_UNINITIALIZED, FAIL, "dataspace does not have span tree")
+ /* Check which set of low & high bounds we should be using */
+ if(space->select.sel_info.hslab->diminfo_valid == H5S_DIMINFO_VALID_YES) {
+ low_bounds = space->select.sel_info.hslab->diminfo.low_bounds;
+ high_bounds = space->select.sel_info.hslab->diminfo.high_bounds;
+ } /* end if */
+ else {
+ low_bounds = space->select.sel_info.hslab->span_lst->low_bounds;
+ high_bounds = space->select.sel_info.hslab->span_lst->high_bounds;
+ } /* end else */
- /* Perform the span-by-span intersection check */
- ret_value = H5S__hyper_intersect_block_helper(space->select.sel_info.hslab->span_lst, start, end);
+ /* Loop over selection bounds and block, checking for overlap */
+ for(u = 0; u < space->extent.rank; u++)
+ /* If selection bounds & block don't overlap, can leave now */
+ if(!H5S_RANGE_OVERLAP(low_bounds[u], high_bounds[u], start[u], end[u]))
+ HGOTO_DONE(FALSE)
+
+ /* Check for regular hyperslab intersection */
+ if(space->select.sel_info.hslab->diminfo_valid == H5S_DIMINFO_VALID_YES) {
+ hbool_t single_block; /* Whether the regular selection is a single block */
+
+ /* Check for a single block */
+ /* For a regular hyperslab to be single, it must have only one block
+ * (i.e. count == 1 in all dimensions).
+ */
+ single_block = TRUE;
+ for(u = 0; u < space->extent.rank; u++)
+ if(space->select.sel_info.hslab->diminfo.opt[u].count > 1)
+ single_block = FALSE;
+
+ /* Single blocks have already been "compared" above, in the low / high
+ * bound checking, so just return TRUE if we've reached here - they
+ * would have been rejected earlier, if they didn't intersect.
+ */
+ if(single_block)
+ HGOTO_DONE(TRUE)
+ else {
+ /* Loop over the dimensions, checking for an intersection */
+ for(u = 0; u < space->extent.rank; u++) {
+ /* If the block's start is <= the hyperslab start, they intersect */
+ /* (So, if the start is > the hyperslab start, check more conditions) */
+ if(start[u] > space->select.sel_info.hslab->diminfo.opt[u].start) {
+ hsize_t adj_start; /* Start coord, adjusted for hyperslab selection parameters */
+ hsize_t nstride; /* Number of strides into the selection */
+
+ /* Adjust start coord for selection's 'start' offset */
+ adj_start = start[u] - space->select.sel_info.hslab->diminfo.opt[u].start;
+
+ /* Compute # of strides into the selection */
+ if(space->select.sel_info.hslab->diminfo.opt[u].count > 1)
+ nstride = adj_start / space->select.sel_info.hslab->diminfo.opt[u].stride;
+ else
+ nstride = 0;
+
+ /* Sanity check */
+ HDassert(nstride <= space->select.sel_info.hslab->diminfo.opt[u].count);
+
+ /* "Rebase" the adjusted start coord into the same range
+ * range of values as the selections's first block.
+ */
+ adj_start -= nstride * space->select.sel_info.hslab->diminfo.opt[u].stride;
+
+ /* If the adjusted start doesn't fall within the first hyperslab
+ * span, check for the block overlapping with the next one.
+ */
+ if(adj_start >= space->select.sel_info.hslab->diminfo.opt[u].block) {
+ hsize_t adj_end; /* End coord, adjusted for hyperslab selection parameters */
+
+ /* Adjust end coord for selection's 'start' offset */
+ adj_end = end[u] - space->select.sel_info.hslab->diminfo.opt[u].start;
+
+ /* "Rebase" the adjusted end coord into the same range
+ * range of values as the selections's first block.
+ */
+ adj_end -= nstride * space->select.sel_info.hslab->diminfo.opt[u].stride;
+
+ /* If block doesn't extend over beginning of next span,
+ * it doesn't intersect.
+ */
+ if(adj_end < space->select.sel_info.hslab->diminfo.opt[u].stride)
+ HGOTO_DONE(FALSE)
+ } /* end if */
+ } /* end if */
+ } /* end for */
+
+ /* If we've looped through all dimensions and none of them didn't
+ * overlap, then all of them do, so we report TRUE.
+ */
+ HGOTO_DONE(TRUE)
+ } /* end else */
+ } /* end if */
+ else {
+ uint64_t op_gen; /* Operation generation value */
+
+ /* Acquire an operation generation value for this operation */
+ op_gen = H5S__hyper_get_op_gen();
+
+ /* Perform the span-by-span intersection check */
+ ret_value = H5S__hyper_intersect_block_helper(space->select.sel_info.hslab->span_lst, space->extent.rank, start, end, op_gen);
+ } /* end else */
done:
FUNC_LEAVE_NOAPI(ret_value)
@@ -4137,7 +6392,9 @@ done:
USAGE
void H5S__hyper_adjust_u_helper(spans, offset)
H5S_hyper_span_info_t *spans; IN: Span tree to operate with
+ unsigned rank; IN: Number of dimensions for span tree
const hsize_t *offset; IN: Offset to subtract
+ uint64_t op_gen; IN: Operation generation
RETURNS
None
DESCRIPTION
@@ -4148,23 +6405,26 @@ done:
REVISION LOG
--------------------------------------------------------------------------*/
static void
-H5S__hyper_adjust_u_helper(H5S_hyper_span_info_t *spans,
- const hsize_t *offset)
+H5S__hyper_adjust_u_helper(H5S_hyper_span_info_t *spans, unsigned rank,
+ const hsize_t *offset, uint64_t op_gen)
{
FUNC_ENTER_STATIC_NOERR
/* Sanity checks */
HDassert(spans);
- HDassert(spans->scratch == (H5S_hyper_span_info_t *)~((size_t)NULL) ||
- spans->scratch == NULL);
HDassert(offset);
- /* Check if we've already set this down span tree */
- if(spans->scratch != (H5S_hyper_span_info_t *)~((size_t)NULL)) {
+ /* Check if we've already set this span tree */
+ if(spans->op_gen != op_gen) {
H5S_hyper_span_t *span; /* Pointer to current span in span tree */
+ unsigned u; /* Local index variable */
- /* Set the tree's scratch pointer */
- spans->scratch = (H5S_hyper_span_info_t *)~((size_t)NULL);
+ /* Adjust the span tree's low & high bounds */
+ for(u = 0; u < rank; u++) {
+ HDassert(spans->low_bounds[u] >= offset[u]);
+ spans->low_bounds[u] -= offset[u];
+ spans->high_bounds[u] -= offset[u];
+ } /* end for */
/* Iterate over the spans in tree */
span = spans->head;
@@ -4176,11 +6436,14 @@ H5S__hyper_adjust_u_helper(H5S_hyper_span_info_t *spans,
/* Recursively adjust spans in next dimension down */
if(span->down != NULL)
- H5S__hyper_adjust_u_helper(span->down, offset + 1);
+ H5S__hyper_adjust_u_helper(span->down, rank - 1, offset + 1, op_gen);
/* Advance to next span in this dimension */
span = span->next;
} /* end while */
+
+ /* Set the tree's operation generation */
+ spans->op_gen = op_gen;
} /* end if */
FUNC_LEAVE_NOAPI_VOID
@@ -4215,21 +6478,29 @@ H5S__hyper_adjust_u(H5S_t *space, const hsize_t *offset)
HDassert(offset);
/* Subtract the offset from the "regular" coordinates, if they exist */
- if(space->select.sel_info.hslab->diminfo_valid) {
+ /* (No need to rebuild the dimension info yet -QAK) */
+ if(space->select.sel_info.hslab->diminfo_valid == H5S_DIMINFO_VALID_YES) {
unsigned u; /* Local index variable */
for(u = 0; u < space->extent.rank; u++) {
- HDassert(space->select.sel_info.hslab->opt_diminfo[u].start >= offset[u]);
- space->select.sel_info.hslab->opt_diminfo[u].start -= offset[u];
+ HDassert(space->select.sel_info.hslab->diminfo.opt[u].start >= offset[u]);
+ space->select.sel_info.hslab->diminfo.opt[u].start -= offset[u];
+
+ /* Adjust the low & high bounds */
+ HDassert(space->select.sel_info.hslab->diminfo.low_bounds[u] >= offset[u]);
+ space->select.sel_info.hslab->diminfo.low_bounds[u] -= offset[u];
+ space->select.sel_info.hslab->diminfo.high_bounds[u] -= offset[u];
} /* end for */
} /* end if */
/* Subtract the offset from the span tree coordinates, if they exist */
if(space->select.sel_info.hslab->span_lst) {
- H5S__hyper_adjust_u_helper(space->select.sel_info.hslab->span_lst, offset);
+ uint64_t op_gen; /* Operation generation value */
+
+ /* Acquire an operation generation value for this operation */
+ op_gen = H5S__hyper_get_op_gen();
- /* Reset the scratch pointers for the next routine which needs them */
- H5S__hyper_span_scratch(space->select.sel_info.hslab->span_lst);
+ H5S__hyper_adjust_u_helper(space->select.sel_info.hslab->span_lst, space->extent.rank, offset, op_gen);
} /* end if */
FUNC_LEAVE_NOAPI(SUCCEED)
@@ -4242,7 +6513,7 @@ H5S__hyper_adjust_u(H5S_t *space, const hsize_t *offset)
* Purpose: Projects a single element hyperslab selection into a scalar
* dataspace
*
- * Return: non-negative on success, negative on failure.
+ * Return: Non-negative on success, negative on failure.
*
* Programmer: Quincey Koziol
* Sunday, July 18, 2010
@@ -4261,12 +6532,20 @@ H5S__hyper_project_scalar(const H5S_t *space, hsize_t *offset)
HDassert(offset);
/* Check for a "regular" hyperslab selection */
- if(space->select.sel_info.hslab->diminfo_valid) {
- const H5S_hyper_dim_t *diminfo = space->select.sel_info.hslab->opt_diminfo; /* Alias for dataspace's diminfo information */
+ /* (No need to rebuild the dimension info yet -QAK) */
+ if(space->select.sel_info.hslab->diminfo_valid == H5S_DIMINFO_VALID_YES) {
+ const H5S_hyper_dim_t *diminfo = space->select.sel_info.hslab->diminfo.opt; /* Alias for dataspace's diminfo information */
unsigned u; /* Counter */
/* Build the table of the initial offset */
for(u = 0; u < space->extent.rank; u++) {
+ /* Sanity check diminfo */
+ HDassert(1 == diminfo[u].count);
+ HDassert(1 == diminfo[u].block);
+
+ /* Sanity check bounds, while we're here */
+ HDassert(diminfo[u].start == space->select.sel_info.hslab->diminfo.low_bounds[u]);
+
/* Keep the offset for later */
block[u] = diminfo[u].start;
} /* end for */
@@ -4278,17 +6557,22 @@ H5S__hyper_project_scalar(const H5S_t *space, hsize_t *offset)
/* Advance down selected spans */
curr = space->select.sel_info.hslab->span_lst->head;
curr_dim = 0;
- while(curr) {
- /* Sanity check for more than one span */
+ while(1) {
+ /* Sanity checks */
HDassert(NULL == curr->next);
HDassert(curr->low == curr->high);
+ HDassert(curr_dim < space->extent.rank);
/* Save the location of the selection in current dimension */
block[curr_dim] = curr->low;
/* Advance down to next dimension */
- curr = curr->down->head;
- curr_dim++;
+ if(curr->down) {
+ curr = curr->down->head;
+ curr_dim++;
+ } /* end if */
+ else
+ break;
} /* end while */
} /* end else */
@@ -4305,7 +6589,7 @@ H5S__hyper_project_scalar(const H5S_t *space, hsize_t *offset)
* Purpose: Projects a hyperslab selection onto/into a simple dataspace
* of a lower rank
*
- * Return: non-negative on success, negative on failure.
+ * Return: Non-negative on success, negative on failure.
*
* Programmer: Quincey Koziol
* Sunday, July 18, 2010
@@ -4352,7 +6636,7 @@ H5S__hyper_project_simple_lower(const H5S_t *base_space, H5S_t *new_space)
* Purpose: Projects a hyperslab selection onto/into a simple dataspace
* of a higher rank
*
- * Return: non-negative on success, negative on failure.
+ * Return: Non-negative on success, negative on failure.
*
* Programmer: Quincey Koziol
* Sunday, July 18, 2010
@@ -4365,6 +6649,7 @@ H5S__hyper_project_simple_higher(const H5S_t *base_space, H5S_t *new_space)
H5S_hyper_span_t *prev_span = NULL; /* Pointer to previous list of spans */
unsigned delta_rank; /* Difference in dataspace ranks */
unsigned curr_dim; /* Current dimension being operated on */
+ unsigned u; /* Local index variable */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_STATIC
@@ -4383,10 +6668,9 @@ H5S__hyper_project_simple_higher(const H5S_t *base_space, H5S_t *new_space)
H5S_hyper_span_t *new_span; /* Temporary hyperslab span */
/* Allocate a new span_info node */
- if(NULL == (new_span_info = H5FL_CALLOC(H5S_hyper_span_info_t))) {
+ if(NULL == (new_span_info = H5S__hyper_new_span_info(new_space->extent.rank))) {
if(prev_span)
- if(H5S__hyper_free_span(prev_span) < 0)
- HERROR(H5E_DATASPACE, H5E_CANTFREE, "can't free hyperslab span");
+ H5S__hyper_free_span(prev_span);
HGOTO_ERROR(H5E_DATASPACE, H5E_CANTALLOC, FAIL, "can't allocate hyperslab span info")
} /* end if */
@@ -4398,13 +6682,24 @@ H5S__hyper_project_simple_higher(const H5S_t *base_space, H5S_t *new_space)
if(NULL == (new_span = H5S__hyper_new_span((hsize_t)0, (hsize_t)0, NULL, NULL))) {
HDassert(new_span_info);
if(!prev_span)
- (void)H5FL_FREE(H5S_hyper_span_info_t, new_span_info);
+ (void)H5FL_ARR_FREE(hbounds_t, new_span_info);
HGOTO_ERROR(H5E_DATASPACE, H5E_CANTALLOC, FAIL, "can't allocate hyperslab span")
} /* end if */
/* Set the span_info information */
new_span_info->count = 1;
new_span_info->head = new_span;
+ new_span_info->tail = new_span;
+
+ /* Set the bounding box */
+ for(u = 0; u < delta_rank; u++) {
+ new_span_info->low_bounds[u] = 0;
+ new_span_info->high_bounds[u] = 0;
+ } /* end for */
+ for(; u < new_space->extent.rank; u++) {
+ new_span_info->low_bounds[u] = base_space->select.sel_info.hslab->span_lst->low_bounds[u - delta_rank];
+ new_span_info->high_bounds[u] = base_space->select.sel_info.hslab->span_lst->high_bounds[u - delta_rank];
+ } /* end for */
/* Attach to new space, if top span info */
if(NULL == new_space->select.sel_info.hslab->span_lst)
@@ -4426,10 +6721,9 @@ H5S__hyper_project_simple_higher(const H5S_t *base_space, H5S_t *new_space)
done:
if(ret_value < 0 && new_space->select.sel_info.hslab->span_lst) {
if(new_space->select.sel_info.hslab->span_lst->head)
- if(H5S__hyper_free_span(new_space->select.sel_info.hslab->span_lst->head) < 0)
- HDONE_ERROR(H5E_DATASPACE, H5E_CANTFREE, FAIL, "can't free hyperslab span")
+ H5S__hyper_free_span(new_space->select.sel_info.hslab->span_lst->head);
- new_space->select.sel_info.hslab->span_lst = H5FL_FREE(H5S_hyper_span_info_t, new_space->select.sel_info.hslab->span_lst);
+ new_space->select.sel_info.hslab->span_lst = (H5S_hyper_span_info_t *)H5FL_ARR_FREE(hbounds_t, new_space->select.sel_info.hslab->span_lst);
} /* end if */
FUNC_LEAVE_NOAPI(ret_value)
@@ -4442,7 +6736,7 @@ done:
* Purpose: Projects a hyperslab selection onto/into a simple dataspace
* of a different rank
*
- * Return: non-negative on success, negative on failure.
+ * Return: Non-negative on success, negative on failure.
*
* Programmer: Quincey Koziol
* Sunday, July 18, 2010
@@ -4450,7 +6744,8 @@ done:
*-------------------------------------------------------------------------
*/
static herr_t
-H5S__hyper_project_simple(const H5S_t *base_space, H5S_t *new_space, hsize_t *offset)
+H5S__hyper_project_simple(const H5S_t *base_space, H5S_t *new_space,
+ hsize_t *offset)
{
herr_t ret_value = SUCCEED; /* Return value */
@@ -4473,15 +6768,16 @@ H5S__hyper_project_simple(const H5S_t *base_space, H5S_t *new_space, hsize_t *of
new_space->select.sel_info.hslab->unlim_dim = -1;
/* Check for a "regular" hyperslab selection */
- if(base_space->select.sel_info.hslab->diminfo_valid) {
+ /* (No need to rebuild the dimension info yet -QAK) */
+ if(base_space->select.sel_info.hslab->diminfo_valid == H5S_DIMINFO_VALID_YES) {
unsigned base_space_dim; /* Current dimension in the base dataspace */
unsigned new_space_dim; /* Current dimension in the new dataspace */
+ unsigned u; /* Local index variable */
/* Check if the new space's rank is < or > base space's rank */
if(new_space->extent.rank < base_space->extent.rank) {
- const H5S_hyper_dim_t *opt_diminfo = base_space->select.sel_info.hslab->opt_diminfo; /* Alias for dataspace's diminfo information */
+ const H5S_hyper_dim_t *opt_diminfo = base_space->select.sel_info.hslab->diminfo.opt; /* Alias for dataspace's diminfo information */
hsize_t block[H5S_MAX_RANK]; /* Block selected in base dataspace */
- unsigned u; /* Local index variable */
/* Compute the offset for the down-projection */
HDmemset(block, 0, sizeof(block));
@@ -4501,15 +6797,15 @@ H5S__hyper_project_simple(const H5S_t *base_space, H5S_t *new_space, hsize_t *of
/* Set the diminfo information for the higher dimensions */
for(new_space_dim = 0; new_space_dim < (new_space->extent.rank - base_space->extent.rank); new_space_dim++) {
- new_space->select.sel_info.hslab->app_diminfo[new_space_dim].start = 0;
- new_space->select.sel_info.hslab->app_diminfo[new_space_dim].stride = 1;
- new_space->select.sel_info.hslab->app_diminfo[new_space_dim].count = 1;
- new_space->select.sel_info.hslab->app_diminfo[new_space_dim].block = 1;
-
- new_space->select.sel_info.hslab->opt_diminfo[new_space_dim].start = 0;
- new_space->select.sel_info.hslab->opt_diminfo[new_space_dim].stride = 1;
- new_space->select.sel_info.hslab->opt_diminfo[new_space_dim].count = 1;
- new_space->select.sel_info.hslab->opt_diminfo[new_space_dim].block = 1;
+ new_space->select.sel_info.hslab->diminfo.app[new_space_dim].start = 0;
+ new_space->select.sel_info.hslab->diminfo.app[new_space_dim].stride = 1;
+ new_space->select.sel_info.hslab->diminfo.app[new_space_dim].count = 1;
+ new_space->select.sel_info.hslab->diminfo.app[new_space_dim].block = 1;
+
+ new_space->select.sel_info.hslab->diminfo.opt[new_space_dim].start = 0;
+ new_space->select.sel_info.hslab->diminfo.opt[new_space_dim].stride = 1;
+ new_space->select.sel_info.hslab->diminfo.opt[new_space_dim].count = 1;
+ new_space->select.sel_info.hslab->diminfo.opt[new_space_dim].block = 1;
} /* end for */
/* Start at beginning of base space's dimension info */
@@ -4518,31 +6814,37 @@ H5S__hyper_project_simple(const H5S_t *base_space, H5S_t *new_space, hsize_t *of
/* Copy the diminfo */
while(base_space_dim < base_space->extent.rank) {
- new_space->select.sel_info.hslab->app_diminfo[new_space_dim].start =
- base_space->select.sel_info.hslab->app_diminfo[base_space_dim].start;
- new_space->select.sel_info.hslab->app_diminfo[new_space_dim].stride =
- base_space->select.sel_info.hslab->app_diminfo[base_space_dim].stride;
- new_space->select.sel_info.hslab->app_diminfo[new_space_dim].count =
- base_space->select.sel_info.hslab->app_diminfo[base_space_dim].count;
- new_space->select.sel_info.hslab->app_diminfo[new_space_dim].block =
- base_space->select.sel_info.hslab->app_diminfo[base_space_dim].block;
-
- new_space->select.sel_info.hslab->opt_diminfo[new_space_dim].start =
- base_space->select.sel_info.hslab->opt_diminfo[base_space_dim].start;
- new_space->select.sel_info.hslab->opt_diminfo[new_space_dim].stride =
- base_space->select.sel_info.hslab->opt_diminfo[base_space_dim].stride;
- new_space->select.sel_info.hslab->opt_diminfo[new_space_dim].count =
- base_space->select.sel_info.hslab->opt_diminfo[base_space_dim].count;
- new_space->select.sel_info.hslab->opt_diminfo[new_space_dim].block =
- base_space->select.sel_info.hslab->opt_diminfo[base_space_dim].block;
+ new_space->select.sel_info.hslab->diminfo.app[new_space_dim].start =
+ base_space->select.sel_info.hslab->diminfo.app[base_space_dim].start;
+ new_space->select.sel_info.hslab->diminfo.app[new_space_dim].stride =
+ base_space->select.sel_info.hslab->diminfo.app[base_space_dim].stride;
+ new_space->select.sel_info.hslab->diminfo.app[new_space_dim].count =
+ base_space->select.sel_info.hslab->diminfo.app[base_space_dim].count;
+ new_space->select.sel_info.hslab->diminfo.app[new_space_dim].block =
+ base_space->select.sel_info.hslab->diminfo.app[base_space_dim].block;
+
+ new_space->select.sel_info.hslab->diminfo.opt[new_space_dim].start =
+ base_space->select.sel_info.hslab->diminfo.opt[base_space_dim].start;
+ new_space->select.sel_info.hslab->diminfo.opt[new_space_dim].stride =
+ base_space->select.sel_info.hslab->diminfo.opt[base_space_dim].stride;
+ new_space->select.sel_info.hslab->diminfo.opt[new_space_dim].count =
+ base_space->select.sel_info.hslab->diminfo.opt[base_space_dim].count;
+ new_space->select.sel_info.hslab->diminfo.opt[new_space_dim].block =
+ base_space->select.sel_info.hslab->diminfo.opt[base_space_dim].block;
/* Advance to next dimensions */
base_space_dim++;
new_space_dim++;
} /* end for */
+ /* Update the bounding box */
+ for(u = 0; u < new_space->extent.rank; u++) {
+ new_space->select.sel_info.hslab->diminfo.low_bounds[u] = new_space->select.sel_info.hslab->diminfo.opt[u].start;
+ new_space->select.sel_info.hslab->diminfo.high_bounds[u] = new_space->select.sel_info.hslab->diminfo.low_bounds[u] + new_space->select.sel_info.hslab->diminfo.opt[u].stride * (new_space->select.sel_info.hslab->diminfo.opt[u].count - 1) + (new_space->select.sel_info.hslab->diminfo.opt[u].block - 1);
+ } /* end for */
+
/* Indicate that the dimension information is valid */
- new_space->select.sel_info.hslab->diminfo_valid = TRUE;
+ new_space->select.sel_info.hslab->diminfo_valid = H5S_DIMINFO_VALID_YES;
/* Indicate that there's no slab information */
new_space->select.sel_info.hslab->span_lst = NULL;
@@ -4587,8 +6889,8 @@ H5S__hyper_project_simple(const H5S_t *base_space, H5S_t *new_space, hsize_t *of
HGOTO_ERROR(H5E_DATASPACE, H5E_CANTSELECT, FAIL, "can't project hyperslab selection into less dimensions")
} /* end else */
- /* Indicate that the dimension information is not valid */
- new_space->select.sel_info.hslab->diminfo_valid = FALSE;
+ /* Copy the status of the dimension information */
+ new_space->select.sel_info.hslab->diminfo_valid = base_space->select.sel_info.hslab->diminfo_valid;
} /* end else */
/* Number of elements selected will be the same */
@@ -4610,7 +6912,9 @@ done:
USAGE
void H5S__hyper_adjust_s_helper(spans, offset)
H5S_hyper_span_info_t *spans; IN: Span tree to operate with
+ unsigned rank; IN: Number of dimensions for span tree
const hssize_t *offset; IN: Offset to subtract
+ uint64_t op_gen; IN: Operation generation
RETURNS
None
DESCRIPTION
@@ -4621,23 +6925,26 @@ done:
REVISION LOG
--------------------------------------------------------------------------*/
static void
-H5S__hyper_adjust_s_helper(H5S_hyper_span_info_t *spans,
- const hssize_t *offset)
+H5S__hyper_adjust_s_helper(H5S_hyper_span_info_t *spans, unsigned rank,
+ const hssize_t *offset, uint64_t op_gen)
{
FUNC_ENTER_STATIC_NOERR
/* Sanity checks */
HDassert(spans);
- HDassert(spans->scratch == (H5S_hyper_span_info_t *)~((size_t)NULL) ||
- spans->scratch == NULL);
HDassert(offset);
- /* Check if we've already set this down span tree */
- if(spans->scratch != (H5S_hyper_span_info_t *)~((size_t)NULL)) {
+ /* Check if we've already set this span tree */
+ if(spans->op_gen != op_gen) {
H5S_hyper_span_t *span; /* Pointer to current span in span tree */
+ unsigned u; /* Local index variable */
- /* Set the tree's scratch pointer */
- spans->scratch = (H5S_hyper_span_info_t *)~((size_t)NULL);
+ /* Adjust the span tree's low & high bounds */
+ for(u = 0; u < rank; u++) {
+ HDassert((hssize_t)spans->low_bounds[u] >= offset[u]);
+ spans->low_bounds[u] = (hsize_t)((hssize_t)spans->low_bounds[u] - offset[u]);
+ spans->high_bounds[u] = (hsize_t)((hssize_t)spans->high_bounds[u] - offset[u]);
+ } /* end for */
/* Iterate over the spans in tree */
span = spans->head;
@@ -4649,11 +6956,14 @@ H5S__hyper_adjust_s_helper(H5S_hyper_span_info_t *spans,
/* Recursively adjust spans in next dimension down */
if(span->down != NULL)
- H5S__hyper_adjust_s_helper(span->down, offset + 1);
+ H5S__hyper_adjust_s_helper(span->down, rank - 1, offset + 1, op_gen);
/* Advance to next span in this dimension */
span = span->next;
} /* end while */
+
+ /* Set the tree's operation generation */
+ spans->op_gen = op_gen;
} /* end if */
FUNC_LEAVE_NOAPI_VOID
@@ -4681,6 +6991,8 @@ H5S__hyper_adjust_s_helper(H5S_hyper_span_info_t *spans,
herr_t
H5S_hyper_adjust_s(H5S_t *space, const hssize_t *offset)
{
+ hbool_t non_zero_offset = FALSE; /* Whether any offset is non-zero */
+ unsigned u; /* Local index variable */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(FAIL)
@@ -4689,22 +7001,38 @@ H5S_hyper_adjust_s(H5S_t *space, const hssize_t *offset)
HDassert(space);
HDassert(offset);
- /* Subtract the offset from the "regular" coordinates, if they exist */
- if(space->select.sel_info.hslab->diminfo_valid) {
- unsigned u; /* Local index variable */
+ /* Check for an all-zero offset vector */
+ for(u = 0; u < space->extent.rank; u++)
+ if(0 != offset[u]) {
+ non_zero_offset = TRUE;
+ break;
+ } /* end if */
- for(u = 0; u < space->extent.rank; u++) {
- HDassert((hssize_t)space->select.sel_info.hslab->opt_diminfo[u].start >= offset[u]);
- space->select.sel_info.hslab->opt_diminfo[u].start = (hsize_t)((hssize_t)space->select.sel_info.hslab->opt_diminfo[u].start - offset[u]);
- } /* end for */
- } /* end if */
+ /* Only perform operation if the offset is non-zero */
+ if(non_zero_offset) {
+ /* Subtract the offset from the "regular" coordinates, if they exist */
+ /* (No need to rebuild the dimension info yet -QAK) */
+ if(space->select.sel_info.hslab->diminfo_valid == H5S_DIMINFO_VALID_YES) {
+ for(u = 0; u < space->extent.rank; u++) {
+ HDassert((hssize_t)space->select.sel_info.hslab->diminfo.opt[u].start >= offset[u]);
+ space->select.sel_info.hslab->diminfo.opt[u].start = (hsize_t)((hssize_t)space->select.sel_info.hslab->diminfo.opt[u].start - offset[u]);
- /* Subtract the offset from the span tree coordinates, if they exist */
- if(space->select.sel_info.hslab->span_lst) {
- H5S__hyper_adjust_s_helper(space->select.sel_info.hslab->span_lst, offset);
+ /* Adjust the low & high bounds */
+ HDassert((hssize_t)space->select.sel_info.hslab->diminfo.low_bounds[u] >= offset[u]);
+ space->select.sel_info.hslab->diminfo.low_bounds[u] = (hsize_t)((hssize_t)space->select.sel_info.hslab->diminfo.low_bounds[u] - offset[u]);
+ space->select.sel_info.hslab->diminfo.high_bounds[u] = (hsize_t)((hssize_t)space->select.sel_info.hslab->diminfo.high_bounds[u] - offset[u]);
+ } /* end for */
+ } /* end if */
+
+ /* Subtract the offset from the span tree coordinates, if they exist */
+ if(space->select.sel_info.hslab->span_lst) {
+ uint64_t op_gen; /* Operation generation value */
- /* Reset the scratch pointers for the next routine which needs them */
- H5S__hyper_span_scratch(space->select.sel_info.hslab->span_lst);
+ /* Acquire an operation generation value for this operation */
+ op_gen = H5S__hyper_get_op_gen();
+
+ H5S__hyper_adjust_s_helper(space->select.sel_info.hslab->span_lst, space->extent.rank, offset, op_gen);
+ } /* end if */
} /* end if */
done:
@@ -4807,7 +7135,7 @@ H5S_hyper_denormalize_offset(H5S_t *space, const hssize_t *old_offset)
HGOTO_ERROR(H5E_DATASPACE, H5E_CANTSET, FAIL, "can't adjust selection")
/* Copy the selection offset over */
- HDmemcpy(space->select.offset, old_offset, sizeof(hssize_t) * space->extent.rank);
+ H5MM_memcpy(space->select.offset, old_offset, sizeof(hssize_t) * space->extent.rank);
done:
FUNC_LEAVE_NOAPI(ret_value)
@@ -4820,12 +7148,11 @@ done:
PURPOSE
Create a new span and append to span list
USAGE
- herr_t H5S__hyper_append_span(prev_span, span_tree, low, high, down, next)
- H5S_hyper_span_t **prev_span; IN/OUT: Pointer to previous span in list
+ herr_t H5S__hyper_append_span(span_tree, ndims, low, high, down)
H5S_hyper_span_info_t **span_tree; IN/OUT: Pointer to span tree to append to
- hsize_t low, high; IN: Low and high bounds for new span node
+ unsigned ndims; IN: Number of dimension for span
+ hsize_t low, high; IN: Low and high bounds for new span node
H5S_hyper_span_info_t *down; IN: Down span tree for new node
- H5S_hyper_span_t *next; IN: Next span for new node
RETURNS
Non-negative on success, negative on failure
DESCRIPTION
@@ -4837,81 +7164,117 @@ done:
REVISION LOG
--------------------------------------------------------------------------*/
static herr_t
-H5S__hyper_append_span(H5S_hyper_span_t **prev_span,
- H5S_hyper_span_info_t **span_tree, hsize_t low, hsize_t high, H5S_hyper_span_info_t *down, H5S_hyper_span_t *next)
+H5S__hyper_append_span(H5S_hyper_span_info_t **span_tree, unsigned ndims,
+ hsize_t low, hsize_t high, H5S_hyper_span_info_t *down)
{
H5S_hyper_span_t *new_span = NULL;
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_STATIC
- HDassert(prev_span);
+ /* Sanity check */
HDassert(span_tree);
/* Check for adding first node to merged spans */
- if(*prev_span == NULL) {
+ if(*span_tree == NULL) {
/* Allocate new span node to append to list */
- if(NULL == (new_span = H5S__hyper_new_span(low, high, down, next)))
+ if(NULL == (new_span = H5S__hyper_new_span(low, high, down, NULL)))
HGOTO_ERROR(H5E_DATASPACE, H5E_CANTALLOC, FAIL, "can't allocate hyperslab span")
- /* Make first node in span list */
-
- /* Check that we haven't already allocated a span tree */
- HDassert(*span_tree == NULL);
+ /* Make new span the first node in span list */
/* Allocate a new span_info node */
- if(NULL == (*span_tree = H5FL_CALLOC(H5S_hyper_span_info_t)))
+ if(NULL == (*span_tree = H5S__hyper_new_span_info(ndims)))
HGOTO_ERROR(H5E_DATASPACE, H5E_CANTALLOC, FAIL, "can't allocate hyperslab span")
/* Set the span tree's basic information */
(*span_tree)->count = 1;
(*span_tree)->head = new_span;
+ (*span_tree)->tail = new_span;
+
+ /* Set low & high bounds for new span tree */
+ (*span_tree)->low_bounds[0] = low;
+ (*span_tree)->high_bounds[0] = high;
+ if(down) {
+ /* Sanity check */
+ HDassert(ndims > 1);
- /* Update previous merged span */
- *prev_span = new_span;
+ H5MM_memcpy(&((*span_tree)->low_bounds[1]), down->low_bounds, sizeof(hsize_t) * (ndims - 1));
+ H5MM_memcpy(&((*span_tree)->high_bounds[1]), down->high_bounds, sizeof(hsize_t) * (ndims - 1));
+ } /* end if */
} /* end if */
/* Merge or append to existing merged spans list */
else {
+ htri_t down_cmp = (-1); /* Comparison value for down spans */
+
/* Check if span can just extend the previous merged span */
- if((((*prev_span)->high + 1) == low) &&
- H5S__hyper_cmp_spans(down, (*prev_span)->down)==TRUE) {
+ if((((*span_tree)->tail->high + 1) == low) &&
+ (down_cmp = H5S__hyper_cmp_spans(down, (*span_tree)->tail->down))) {
/* Extend previous merged span to include new high bound */
- (*prev_span)->high = high;
- (*prev_span)->nelem += (high - low) + 1;
+ (*span_tree)->tail->high = high;
+
+ /* Extend span tree's high bound in this dimension */
+ /* (No need to update lower dimensions, since this span shares them with previous span) */
+ (*span_tree)->high_bounds[0] = high;
} /* end if */
else {
- /* Allocate new span node to append to list */
- if(NULL == (new_span = H5S__hyper_new_span(low, high, down, next)))
- HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "can't allocate hyperslab span")
+ H5S_hyper_span_info_t *new_down; /* Down pointer for new span node */
+
+ /* Sanity check */
+ /* (If down_cmp was set to TRUE above, we won't be in this branch) */
+ HDassert(down_cmp != TRUE);
/* Check if there is actually a down span */
- if(new_span->down) {
+ if(down) {
/* Check if the down spans for the new span node are the same as the previous span node */
- if(H5S__hyper_cmp_spans(new_span->down, (*prev_span)->down)) {
- /* Release the down span for the new node */
- H5S__hyper_free_span_info(new_span->down);
-
- /* Point the new node's down span at the previous node's down span */
- new_span->down = (*prev_span)->down;
+ /* (Uses the 'down span comparison' from earlier, if already computed) */
+ if(down_cmp < 0 && (down_cmp = H5S__hyper_cmp_spans(down, (*span_tree)->tail->down)))
+ /* Share the previous span's down span tree */
+ new_down = (*span_tree)->tail->down;
+ else
+ new_down = down;
+ } /* end if */
+ else
+ new_down = NULL;
- /* Increment the reference count to the shared down span */
- new_span->down->count++;
+ /* Allocate new span node to append to list */
+ if(NULL == (new_span = H5S__hyper_new_span(low, high, new_down, NULL)))
+ HGOTO_ERROR(H5E_DATASPACE, H5E_CANTALLOC, FAIL, "can't allocate hyperslab span")
+
+ /* Update the high bounds for current dimension */
+ (*span_tree)->high_bounds[0] = high;
+
+ /* Update low & high bounds in lower dimensions, if there are any */
+ if(down) {
+ /* Sanity checks */
+ HDassert(ndims > 1);
+ HDassert(down_cmp >= 0);
+
+ /* Check if we are sharing down spans with a previous node */
+ /* (Only need to check for bounds changing if down spans aren't shared) */
+ if(down_cmp == FALSE) {
+ unsigned u; /* Local index variable */
+
+ /* Loop over lower dimensions, checking & updating low & high bounds */
+ for(u = 0; u < (ndims - 1); u++) {
+ if(down->low_bounds[u] < (*span_tree)->low_bounds[u + 1])
+ (*span_tree)->low_bounds[u + 1] = down->low_bounds[u];
+ if(down->high_bounds[u] > (*span_tree)->high_bounds[u + 1])
+ (*span_tree)->high_bounds[u + 1] = down->high_bounds[u];
+ } /* end for */
} /* end if */
} /* end if */
- /* Indicate elements from previous span */
- new_span->pstride = low - (*prev_span)->low;
-
/* Append to end of merged spans list */
- (*prev_span)->next = new_span;
- *prev_span = new_span;
+ (*span_tree)->tail->next = new_span;
+ (*span_tree)->tail = new_span;
} /* end else */
} /* end else */
done:
if(ret_value < 0)
- if(new_span && H5S__hyper_free_span(new_span) < 0)
- HDONE_ERROR(H5E_DATASPACE, H5E_CANTFREE, FAIL, "failed to release new hyperslab span")
+ if(new_span)
+ H5S__hyper_free_span(new_span);
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5S__hyper_append_span() */
@@ -4923,9 +7286,18 @@ done:
PURPOSE
Clip a new span tree against the current spans in the hyperslab selection
USAGE
- herr_t H5S__hyper_clip_spans(span_a, span_b, a_not_b, a_and_b, b_not_a)
+ herr_t H5S__hyper_clip_spans(span_a, span_b, selector, curr_dim, dim_size,
+ span_a_b_bounds[4], all_clips_bound,
+ a_not_b, a_and_b, b_not_a)
H5S_hyper_span_t *a_spans; IN: Span tree 'a' to clip with.
H5S_hyper_span_t *b_spans; IN: Span tree 'b' to clip with.
+ unsigned selector; IN: The parameter deciding which output is needed
+ (only considering the last three bits ABC:
+ If A is set, then a_not_b is needed;
+ If B is set, then a_and_b is needed;
+ If C is set, then b_not_a is needed;
+ )
+ unsigned ndims; IN: Number of dimensions of this span tree
H5S_hyper_span_t **a_not_b; OUT: Span tree of 'a' hyperslab spans which
doesn't overlap with 'b' hyperslab
spans.
@@ -4939,9 +7311,10 @@ done:
DESCRIPTION
Clip one span tree ('a') against another span tree ('b'). Creates span
trees for the area defined by the 'a' span tree which does not overlap the
- 'b' span tree, the area defined by the overlap of the 'a' hyperslab span
- tree and the 'b' span tree, and the area defined by the 'b' hyperslab span
- tree which does not overlap the 'a' span tree.
+ 'b' span tree ("a not b"), the area defined by the overlap of the 'a'
+ hyperslab span tree and the 'b' span tree ("a and b"), and the area defined
+ by the 'b' hyperslab span tree which does not overlap the 'a' span
+ tree ("b not a").
GLOBAL VARIABLES
COMMENTS, BUGS, ASSUMPTIONS
EXAMPLES
@@ -4949,20 +7322,14 @@ done:
--------------------------------------------------------------------------*/
static herr_t
H5S__hyper_clip_spans(H5S_hyper_span_info_t *a_spans, H5S_hyper_span_info_t *b_spans,
+ unsigned selector, unsigned ndims,
H5S_hyper_span_info_t **a_not_b, H5S_hyper_span_info_t **a_and_b,
H5S_hyper_span_info_t **b_not_a)
{
- H5S_hyper_span_t *span_a; /* Pointer to a node in span tree 'a' */
- H5S_hyper_span_t *span_b; /* Pointer to a node in span tree 'b' */
- H5S_hyper_span_t *tmp_span; /* Temporary pointer to new span */
- H5S_hyper_span_t *last_a_not_b; /* Pointer to previous node in span tree 'a_not_b' */
- H5S_hyper_span_t *last_a_and_b; /* Pointer to previous node in span tree 'a_and_b' */
- H5S_hyper_span_t *last_b_not_a; /* Pointer to previous node in span tree 'b_not_a' */
- H5S_hyper_span_info_t *down_a_not_b; /* Temporary pointer to a_not_b span tree of down spans for overlapping nodes */
- H5S_hyper_span_info_t *down_a_and_b; /* Temporary pointer to a_and_b span tree of down spans for overlapping nodes */
- H5S_hyper_span_info_t *down_b_not_a; /* Temporary pointer to b_and_a span tree of down spans for overlapping nodes */
- hbool_t recover_a, recover_b; /* Flags to indicate when to recover temporary spans */
- herr_t ret_value = SUCCEED; /* Return value */
+ hbool_t need_a_not_b; /* Whether to generate a_not_b list */
+ hbool_t need_a_and_b; /* Whether to generate a_and_b list */
+ hbool_t need_b_not_a; /* Whether to generate b_not_a list */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_STATIC
@@ -4973,6 +7340,11 @@ H5S__hyper_clip_spans(H5S_hyper_span_info_t *a_spans, H5S_hyper_span_info_t *b_s
HDassert(a_and_b);
HDassert(b_not_a);
+ /* Set which list(s) to be generated, based on selector */
+ need_a_not_b = ((selector & H5S_HYPER_COMPUTE_A_NOT_B) != 0);
+ need_a_and_b = ((selector & H5S_HYPER_COMPUTE_A_AND_B) != 0);
+ need_b_not_a = ((selector & H5S_HYPER_COMPUTE_B_NOT_A) != 0);
+
/* Check if both span trees are not defined */
if(a_spans == NULL && b_spans == NULL) {
*a_not_b = NULL;
@@ -4983,38 +7355,56 @@ H5S__hyper_clip_spans(H5S_hyper_span_info_t *a_spans, H5S_hyper_span_info_t *b_s
else if(a_spans == NULL) {
*a_not_b = NULL;
*a_and_b = NULL;
- if(NULL == (*b_not_a = H5S__hyper_copy_span(b_spans)))
- HGOTO_ERROR(H5E_INTERNAL, H5E_CANTCOPY, FAIL, "can't copy hyperslab span tree")
+ if(need_b_not_a) {
+ if(NULL == (*b_not_a = H5S__hyper_copy_span(b_spans, ndims)))
+ HGOTO_ERROR(H5E_INTERNAL, H5E_CANTCOPY, FAIL, "can't copy hyperslab span tree")
+ } /* end if */
+ else
+ *b_not_a = NULL;
} /* end if */
/* If span 'b' is not defined, but 'a' is, copy 'a' and set the other return span trees to empty */
else if(b_spans == NULL) {
- if(NULL == (*a_not_b = H5S__hyper_copy_span(a_spans)) )
- HGOTO_ERROR(H5E_INTERNAL, H5E_CANTCOPY, FAIL, "can't copy hyperslab span tree")
*a_and_b = NULL;
*b_not_a = NULL;
+ if(need_a_not_b) {
+ if(NULL == (*a_not_b = H5S__hyper_copy_span(a_spans, ndims)))
+ HGOTO_ERROR(H5E_INTERNAL, H5E_CANTCOPY, FAIL, "can't copy hyperslab span tree")
+ } /* end if */
+ else
+ *a_not_b = NULL;
} /* end if */
/* If span 'a' and 'b' are both defined, calculate the proper span trees */
else {
/* Check if both span trees completely overlap */
if(H5S__hyper_cmp_spans(a_spans, b_spans)) {
*a_not_b = NULL;
- if(NULL == (*a_and_b = H5S__hyper_copy_span(a_spans)))
- HGOTO_ERROR(H5E_INTERNAL, H5E_CANTCOPY, FAIL, "can't copy hyperslab span tree")
*b_not_a = NULL;
+ if(need_a_and_b) {
+ if(NULL == (*a_and_b = H5S__hyper_copy_span(a_spans, ndims)))
+ HGOTO_ERROR(H5E_INTERNAL, H5E_CANTCOPY, FAIL, "can't copy hyperslab span tree")
+ } /* end if */
+ else
+ *a_and_b = NULL;
} /* end if */
else {
+ H5S_hyper_span_t *span_a; /* Pointer to a node in span tree 'a' */
+ H5S_hyper_span_t *span_b; /* Pointer to a node in span tree 'b' */
+ hbool_t recover_a, recover_b; /* Flags to indicate when to recover temporary spans */
+
/* Get the pointers to the new and old span lists */
span_a = a_spans->head;
span_b = b_spans->head;
- /* Reset the pointers to the previous spans */
- last_a_not_b = last_a_and_b = last_b_not_a = NULL;
-
/* No spans to recover yet */
recover_a = recover_b = FALSE;
/* Work through the list of spans in the new list */
while(span_a != NULL && span_b != NULL) {
+ H5S_hyper_span_info_t *down_a_not_b; /* Temporary pointer to a_not_b span tree of down spans for overlapping nodes */
+ H5S_hyper_span_info_t *down_a_and_b; /* Temporary pointer to a_and_b span tree of down spans for overlapping nodes */
+ H5S_hyper_span_info_t *down_b_not_a; /* Temporary pointer to b_and_a span tree of down spans for overlapping nodes */
+ H5S_hyper_span_t *tmp_span; /* Temporary pointer to new span */
+
/* Check if span 'a' is completely before span 'b' */
/* AAAAAAA */
/* <-----------------------------------> */
@@ -5023,11 +7413,12 @@ H5S__hyper_clip_spans(H5S_hyper_span_info_t *a_spans, H5S_hyper_span_info_t *b_s
/* Copy span 'a' and add to a_not_b list */
/* Merge/add span 'a' with/to a_not_b list */
- if(H5S__hyper_append_span(&last_a_not_b, a_not_b, span_a->low, span_a->high, span_a->down, NULL) < 0)
- HGOTO_ERROR(H5E_DATASPACE, H5E_CANTAPPEND, FAIL, "can't allocate hyperslab span")
+ if(need_a_not_b)
+ if(H5S__hyper_append_span(a_not_b, ndims, span_a->low, span_a->high, span_a->down) < 0)
+ HGOTO_ERROR(H5E_DATASPACE, H5E_CANTAPPEND, FAIL, "can't allocate hyperslab span")
/* Advance span 'a', leave span 'b' */
- H5S__hyper_recover_span(&recover_a, &span_a, span_a->next);
+ H5S_HYPER_ADVANCE_SPAN(recover_a, span_a, span_a->next);
} /* end if */
/* Check if span 'a' overlaps only the lower bound */
/* of span 'b' , up to the upper bound of span 'b' */
@@ -5038,8 +7429,9 @@ H5S__hyper_clip_spans(H5S_hyper_span_info_t *a_spans, H5S_hyper_span_info_t *b_s
/* Split span 'a' into two parts at the low bound of span 'b' */
/* Merge/add lower part of span 'a' with/to a_not_b list */
- if(H5S__hyper_append_span(&last_a_not_b, a_not_b, span_a->low, span_b->low - 1, span_a->down, NULL) < 0)
- HGOTO_ERROR(H5E_DATASPACE, H5E_CANTAPPEND, FAIL, "can't allocate hyperslab span")
+ if(need_a_not_b)
+ if(H5S__hyper_append_span(a_not_b, ndims, span_a->low, span_b->low - 1, span_a->down) < 0)
+ HGOTO_ERROR(H5E_DATASPACE, H5E_CANTAPPEND, FAIL, "can't allocate hyperslab span")
/* Check for overlaps between upper part of span 'a' and lower part of span 'b' */
@@ -5049,8 +7441,9 @@ H5S__hyper_clip_spans(H5S_hyper_span_info_t *a_spans, H5S_hyper_span_info_t *b_s
/* If there are no down spans, just add the overlapping area to the a_and_b list */
if(span_a->down == NULL) {
/* Merge/add overlapped part with/to a_and_b list */
- if(H5S__hyper_append_span(&last_a_and_b, a_and_b, span_b->low, span_a->high, NULL, NULL) < 0)
- HGOTO_ERROR(H5E_DATASPACE, H5E_CANTAPPEND, FAIL, "can't allocate hyperslab span")
+ if(need_a_and_b)
+ if(H5S__hyper_append_span(a_and_b, ndims, span_b->low, span_a->high, NULL) < 0)
+ HGOTO_ERROR(H5E_DATASPACE, H5E_CANTAPPEND, FAIL, "can't allocate hyperslab span")
} /* end if */
/* If there are down spans, check for the overlap in them and add to each appropriate list */
else {
@@ -5060,14 +7453,20 @@ H5S__hyper_clip_spans(H5S_hyper_span_info_t *a_spans, H5S_hyper_span_info_t *b_s
down_b_not_a = NULL;
/* Check for overlaps in the 'down spans' of span 'a' & 'b' */
- if(H5S__hyper_clip_spans(span_a->down,span_b->down,&down_a_not_b,&down_a_and_b,&down_b_not_a)<0)
+ /** Note: since the bound box of remaining dimensions
+ * has been updated in the following clip function (via
+ * all_clips_bounds), there's no need updating the bound box
+ * after each append call in the following codes */
+ if(H5S__hyper_clip_spans(span_a->down, span_b->down, selector, ndims - 1, &down_a_not_b, &down_a_and_b, &down_b_not_a) < 0)
HGOTO_ERROR(H5E_DATASPACE, H5E_CANTCLIP, FAIL, "can't clip hyperslab information")
/* Check for additions to the a_not_b list */
if(down_a_not_b) {
+ HDassert(need_a_not_b == TRUE);
+
/* Merge/add overlapped part with/to a_not_b list */
- if(H5S__hyper_append_span(&last_a_not_b,a_not_b,span_b->low,span_a->high,down_a_not_b,NULL)==FAIL)
- HGOTO_ERROR(H5E_RESOURCE, H5E_CANTAPPEND, FAIL, "can't allocate hyperslab span")
+ if(H5S__hyper_append_span(a_not_b, ndims, span_b->low, span_a->high, down_a_not_b) < 0)
+ HGOTO_ERROR(H5E_DATASPACE, H5E_CANTAPPEND, FAIL, "can't allocate hyperslab span")
/* Release the down span tree generated */
H5S__hyper_free_span_info(down_a_not_b);
@@ -5075,9 +7474,11 @@ H5S__hyper_clip_spans(H5S_hyper_span_info_t *a_spans, H5S_hyper_span_info_t *b_s
/* Check for additions to the a_and_b list */
if(down_a_and_b) {
+ HDassert(need_a_and_b == TRUE);
+
/* Merge/add overlapped part with/to a_and_b list */
- if(H5S__hyper_append_span(&last_a_and_b,a_and_b,span_b->low,span_a->high,down_a_and_b,NULL)==FAIL)
- HGOTO_ERROR(H5E_RESOURCE, H5E_CANTAPPEND, FAIL, "can't allocate hyperslab span")
+ if(H5S__hyper_append_span(a_and_b, ndims, span_b->low, span_a->high, down_a_and_b) < 0)
+ HGOTO_ERROR(H5E_DATASPACE, H5E_CANTAPPEND, FAIL, "can't allocate hyperslab span")
/* Release the down span tree generated */
H5S__hyper_free_span_info(down_a_and_b);
@@ -5085,9 +7486,11 @@ H5S__hyper_clip_spans(H5S_hyper_span_info_t *a_spans, H5S_hyper_span_info_t *b_s
/* Check for additions to the b_not_a list */
if(down_b_not_a) {
+ HDassert(need_b_not_a == TRUE);
+
/* Merge/add overlapped part with/to b_not_a list */
- if(H5S__hyper_append_span(&last_b_not_a,b_not_a,span_b->low,span_a->high,down_b_not_a,NULL)==FAIL)
- HGOTO_ERROR(H5E_RESOURCE, H5E_CANTAPPEND, FAIL, "can't allocate hyperslab span")
+ if(H5S__hyper_append_span(b_not_a, ndims, span_b->low, span_a->high, down_b_not_a) < 0)
+ HGOTO_ERROR(H5E_DATASPACE, H5E_CANTAPPEND, FAIL, "can't allocate hyperslab span")
/* Release the down span tree generated */
H5S__hyper_free_span_info(down_b_not_a);
@@ -5103,17 +7506,17 @@ H5S__hyper_clip_spans(H5S_hyper_span_info_t *a_spans, H5S_hyper_span_info_t *b_s
HGOTO_ERROR(H5E_DATASPACE, H5E_NOSPACE, FAIL, "can't allocate hyperslab span")
/* Advance span 'a' */
- H5S__hyper_recover_span(&recover_a,&span_a,span_a->next);
+ H5S_HYPER_ADVANCE_SPAN(recover_a, span_a, span_a->next);
/* Make upper part of span 'b' into new span 'b' */
- H5S__hyper_recover_span(&recover_b,&span_b,tmp_span);
+ H5S_HYPER_ADVANCE_SPAN(recover_b, span_b, tmp_span);
recover_b = TRUE;
} /* end if */
/* No upper part of span 'b' to split */
else {
/* Advance both 'a' and 'b' */
- H5S__hyper_recover_span(&recover_a,&span_a,span_a->next);
- H5S__hyper_recover_span(&recover_b,&span_b,span_b->next);
+ H5S_HYPER_ADVANCE_SPAN(recover_a, span_a, span_a->next);
+ H5S_HYPER_ADVANCE_SPAN(recover_b, span_b, span_b->next);
} /* end else */
} /* end if */
/* Check if span 'a' overlaps the lower & upper bound */
@@ -5125,8 +7528,9 @@ H5S__hyper_clip_spans(H5S_hyper_span_info_t *a_spans, H5S_hyper_span_info_t *b_s
/* Split off lower part of span 'a' at lower span of span 'b' */
/* Merge/add lower part of span 'a' with/to a_not_b list */
- if(H5S__hyper_append_span(&last_a_not_b,a_not_b,span_a->low,span_b->low-1,span_a->down,NULL)==FAIL)
- HGOTO_ERROR(H5E_RESOURCE, H5E_CANTAPPEND, FAIL, "can't allocate hyperslab span")
+ if(need_a_not_b)
+ if(H5S__hyper_append_span(a_not_b, ndims, span_a->low, span_b->low - 1, span_a->down) < 0)
+ HGOTO_ERROR(H5E_DATASPACE, H5E_CANTAPPEND, FAIL, "can't allocate hyperslab span")
/* Check for overlaps between middle part of span 'a' and span 'b' */
@@ -5136,8 +7540,9 @@ H5S__hyper_clip_spans(H5S_hyper_span_info_t *a_spans, H5S_hyper_span_info_t *b_s
/* If there are no down spans, just add the overlapping area to the a_and_b list */
if(span_a->down == NULL) {
/* Merge/add overlapped part with/to a_and_b list */
- if(H5S__hyper_append_span(&last_a_and_b,a_and_b,span_b->low,span_b->high,NULL,NULL)==FAIL)
- HGOTO_ERROR(H5E_RESOURCE, H5E_CANTAPPEND, FAIL, "can't allocate hyperslab span")
+ if(need_a_and_b)
+ if(H5S__hyper_append_span(a_and_b, ndims, span_b->low, span_b->high, NULL) < 0)
+ HGOTO_ERROR(H5E_DATASPACE, H5E_CANTAPPEND, FAIL, "can't allocate hyperslab span")
} /* end if */
/* If there are down spans, check for the overlap in them and add to each appropriate list */
else {
@@ -5147,14 +7552,16 @@ H5S__hyper_clip_spans(H5S_hyper_span_info_t *a_spans, H5S_hyper_span_info_t *b_s
down_b_not_a = NULL;
/* Check for overlaps in the 'down spans' of span 'a' & 'b' */
- if(H5S__hyper_clip_spans(span_a->down,span_b->down,&down_a_not_b,&down_a_and_b,&down_b_not_a)<0)
+ if(H5S__hyper_clip_spans(span_a->down, span_b->down, selector, ndims - 1, &down_a_not_b, &down_a_and_b, &down_b_not_a) < 0)
HGOTO_ERROR(H5E_DATASPACE, H5E_CANTCLIP, FAIL, "can't clip hyperslab information")
/* Check for additions to the a_not_b list */
if(down_a_not_b) {
+ HDassert(need_a_not_b == TRUE);
+
/* Merge/add overlapped part with/to a_not_b list */
- if(H5S__hyper_append_span(&last_a_not_b,a_not_b,span_b->low,span_b->high,down_a_not_b,NULL)==FAIL)
- HGOTO_ERROR(H5E_RESOURCE, H5E_CANTAPPEND, FAIL, "can't allocate hyperslab span")
+ if(H5S__hyper_append_span(a_not_b, ndims, span_b->low, span_b->high, down_a_not_b) < 0)
+ HGOTO_ERROR(H5E_DATASPACE, H5E_CANTAPPEND, FAIL, "can't allocate hyperslab span")
/* Release the down span tree generated */
H5S__hyper_free_span_info(down_a_not_b);
@@ -5162,9 +7569,11 @@ H5S__hyper_clip_spans(H5S_hyper_span_info_t *a_spans, H5S_hyper_span_info_t *b_s
/* Check for additions to the a_and_b list */
if(down_a_and_b) {
+ HDassert(need_a_and_b == TRUE);
+
/* Merge/add overlapped part with/to a_and_b list */
- if(H5S__hyper_append_span(&last_a_and_b,a_and_b,span_b->low,span_b->high,down_a_and_b,NULL)==FAIL)
- HGOTO_ERROR(H5E_RESOURCE, H5E_CANTAPPEND, FAIL, "can't allocate hyperslab span")
+ if(H5S__hyper_append_span(a_and_b, ndims, span_b->low, span_b->high, down_a_and_b) < 0)
+ HGOTO_ERROR(H5E_DATASPACE, H5E_CANTAPPEND, FAIL, "can't allocate hyperslab span")
/* Release the down span tree generated */
H5S__hyper_free_span_info(down_a_and_b);
@@ -5172,9 +7581,11 @@ H5S__hyper_clip_spans(H5S_hyper_span_info_t *a_spans, H5S_hyper_span_info_t *b_s
/* Check for additions to the b_not_a list */
if(down_b_not_a) {
+ HDassert(need_b_not_a == TRUE);
+
/* Merge/add overlapped part with/to b_not_a list */
- if(H5S__hyper_append_span(&last_b_not_a,b_not_a,span_b->low,span_b->high,down_b_not_a,NULL)==FAIL)
- HGOTO_ERROR(H5E_RESOURCE, H5E_CANTAPPEND, FAIL, "can't allocate hyperslab span")
+ if(H5S__hyper_append_span(b_not_a, ndims, span_b->low, span_b->high, down_b_not_a) < 0)
+ HGOTO_ERROR(H5E_DATASPACE, H5E_CANTAPPEND, FAIL, "can't allocate hyperslab span")
/* Release the down span tree generated */
H5S__hyper_free_span_info(down_b_not_a);
@@ -5188,11 +7599,11 @@ H5S__hyper_clip_spans(H5S_hyper_span_info_t *a_spans, H5S_hyper_span_info_t *b_s
HGOTO_ERROR(H5E_DATASPACE, H5E_NOSPACE, FAIL, "can't allocate hyperslab span")
/* Make upper part of span 'a' the new span 'a' */
- H5S__hyper_recover_span(&recover_a,&span_a,tmp_span);
+ H5S_HYPER_ADVANCE_SPAN(recover_a, span_a, tmp_span);
recover_a = TRUE;
/* Advance span 'b' */
- H5S__hyper_recover_span(&recover_b,&span_b,span_b->next);
+ H5S_HYPER_ADVANCE_SPAN(recover_b, span_b, span_b->next);
} /* end if */
/* Check if span 'a' is entirely within span 'b' */
/* AAAAA */
@@ -5204,8 +7615,9 @@ H5S__hyper_clip_spans(H5S_hyper_span_info_t *a_spans, H5S_hyper_span_info_t *b_s
/* Check if there is actually a lower part of span 'b' to split off */
if(span_a->low > span_b->low) {
/* Merge/add lower part of span 'b' with/to b_not_a list */
- if(H5S__hyper_append_span(&last_b_not_a,b_not_a,span_b->low,span_a->low-1,span_b->down,NULL)==FAIL)
- HGOTO_ERROR(H5E_RESOURCE, H5E_CANTAPPEND, FAIL, "can't allocate hyperslab span")
+ if(need_b_not_a)
+ if(H5S__hyper_append_span(b_not_a, ndims, span_b->low, span_a->low - 1, span_b->down) < 0)
+ HGOTO_ERROR(H5E_DATASPACE, H5E_CANTAPPEND, FAIL, "can't allocate hyperslab span")
} /* end if */
else {
/* Keep going, nothing to split off */
@@ -5219,8 +7631,9 @@ H5S__hyper_clip_spans(H5S_hyper_span_info_t *a_spans, H5S_hyper_span_info_t *b_s
/* If there are no down spans, just add the overlapping area to the a_and_b list */
if(span_a->down == NULL) {
/* Merge/add overlapped part with/to a_and_b list */
- if(H5S__hyper_append_span(&last_a_and_b,a_and_b,span_a->low,span_a->high,NULL,NULL)==FAIL)
- HGOTO_ERROR(H5E_RESOURCE, H5E_CANTAPPEND, FAIL, "can't allocate hyperslab span")
+ if(need_a_and_b)
+ if(H5S__hyper_append_span(a_and_b, ndims, span_a->low, span_a->high, NULL) < 0)
+ HGOTO_ERROR(H5E_DATASPACE, H5E_CANTAPPEND, FAIL, "can't allocate hyperslab span")
} /* end if */
/* If there are down spans, check for the overlap in them and add to each appropriate list */
else {
@@ -5230,34 +7643,40 @@ H5S__hyper_clip_spans(H5S_hyper_span_info_t *a_spans, H5S_hyper_span_info_t *b_s
down_b_not_a = NULL;
/* Check for overlaps in the 'down spans' of span 'a' & 'b' */
- if(H5S__hyper_clip_spans(span_a->down,span_b->down,&down_a_not_b,&down_a_and_b,&down_b_not_a)<0)
+ if(H5S__hyper_clip_spans(span_a->down, span_b->down, selector, ndims - 1, &down_a_not_b, &down_a_and_b, &down_b_not_a) < 0)
HGOTO_ERROR(H5E_DATASPACE, H5E_CANTCLIP, FAIL, "can't clip hyperslab information")
/* Check for additions to the a_not_b list */
if(down_a_not_b) {
+ HDassert(need_a_not_b == TRUE);
+
/* Merge/add overlapped part with/to a_not_b list */
- if(H5S__hyper_append_span(&last_a_not_b,a_not_b,span_a->low,span_a->high,down_a_not_b,NULL)==FAIL)
- HGOTO_ERROR(H5E_RESOURCE, H5E_CANTAPPEND, FAIL, "can't allocate hyperslab span")
+ if(H5S__hyper_append_span(a_not_b, ndims, span_a->low, span_a->high, down_a_not_b) < 0)
+ HGOTO_ERROR(H5E_DATASPACE, H5E_CANTAPPEND, FAIL, "can't allocate hyperslab span")
/* Release the down span tree generated */
H5S__hyper_free_span_info(down_a_not_b);
} /* end if */
/* Check for additions to the a_and_b list */
- if(down_a_and_b!=NULL) {
+ if(down_a_and_b) {
+ HDassert(need_a_and_b == TRUE);
+
/* Merge/add overlapped part with/to a_and_b list */
- if(H5S__hyper_append_span(&last_a_and_b,a_and_b,span_a->low,span_a->high,down_a_and_b,NULL)==FAIL)
- HGOTO_ERROR(H5E_RESOURCE, H5E_CANTAPPEND, FAIL, "can't allocate hyperslab span")
+ if(H5S__hyper_append_span(a_and_b, ndims, span_a->low, span_a->high, down_a_and_b) < 0)
+ HGOTO_ERROR(H5E_DATASPACE, H5E_CANTAPPEND, FAIL, "can't allocate hyperslab span")
/* Release the down span tree generated */
H5S__hyper_free_span_info(down_a_and_b);
} /* end if */
/* Check for additions to the b_not_a list */
- if(down_b_not_a!=NULL) {
+ if(down_b_not_a) {
+ HDassert(need_b_not_a == TRUE);
+
/* Merge/add overlapped part with/to b_not_a list */
- if(H5S__hyper_append_span(&last_b_not_a,b_not_a,span_a->low,span_a->high,down_b_not_a,NULL)==FAIL)
- HGOTO_ERROR(H5E_RESOURCE, H5E_CANTAPPEND, FAIL, "can't allocate hyperslab span")
+ if(H5S__hyper_append_span(b_not_a, ndims, span_a->low, span_a->high, down_b_not_a) < 0)
+ HGOTO_ERROR(H5E_DATASPACE, H5E_CANTAPPEND, FAIL, "can't allocate hyperslab span")
/* Release the down span tree generated */
H5S__hyper_free_span_info(down_b_not_a);
@@ -5273,16 +7692,16 @@ H5S__hyper_clip_spans(H5S_hyper_span_info_t *a_spans, H5S_hyper_span_info_t *b_s
HGOTO_ERROR(H5E_DATASPACE, H5E_CANTALLOC, FAIL, "can't allocate hyperslab span")
/* And advance span 'a' */
- H5S__hyper_recover_span(&recover_a,&span_a,span_a->next);
+ H5S_HYPER_ADVANCE_SPAN(recover_a, span_a, span_a->next);
/* Make upper part of span 'b' the new span 'b' */
- H5S__hyper_recover_span(&recover_b,&span_b,tmp_span);
- recover_b=1;
+ H5S_HYPER_ADVANCE_SPAN(recover_b, span_b, tmp_span);
+ recover_b = TRUE;
} /* end if */
else {
/* Advance both span 'a' & span 'b' */
- H5S__hyper_recover_span(&recover_a,&span_a,span_a->next);
- H5S__hyper_recover_span(&recover_b,&span_b,span_b->next);
+ H5S_HYPER_ADVANCE_SPAN(recover_a, span_a, span_a->next);
+ H5S_HYPER_ADVANCE_SPAN(recover_b, span_b, span_b->next);
} /* end else */
} /* end if */
/* Check if span 'a' overlaps only the upper bound */
@@ -5296,8 +7715,9 @@ H5S__hyper_clip_spans(H5S_hyper_span_info_t *a_spans, H5S_hyper_span_info_t *b_s
/* Split off lower part of span 'b' at lower span of span 'a' */
/* Merge/add lower part of span 'b' with/to b_not_a list */
- if(H5S__hyper_append_span(&last_b_not_a,b_not_a,span_b->low,span_a->low-1,span_b->down,NULL)==FAIL)
- HGOTO_ERROR(H5E_RESOURCE, H5E_CANTAPPEND, FAIL, "can't allocate hyperslab span")
+ if(need_b_not_a)
+ if(H5S__hyper_append_span(b_not_a, ndims, span_b->low, span_a->low - 1, span_b->down) < 0)
+ HGOTO_ERROR(H5E_DATASPACE, H5E_CANTAPPEND, FAIL, "can't allocate hyperslab span")
} /* end if */
else {
/* Keep going, nothing to split off */
@@ -5311,8 +7731,9 @@ H5S__hyper_clip_spans(H5S_hyper_span_info_t *a_spans, H5S_hyper_span_info_t *b_s
/* If there are no down spans, just add the overlapping area to the a_and_b list */
if(span_a->down == NULL) {
/* Merge/add overlapped part with/to a_and_b list */
- if(H5S__hyper_append_span(&last_a_and_b,a_and_b,span_a->low,span_b->high,NULL,NULL)==FAIL)
- HGOTO_ERROR(H5E_RESOURCE, H5E_CANTAPPEND, FAIL, "can't allocate hyperslab span")
+ if(need_a_and_b)
+ if(H5S__hyper_append_span(a_and_b, ndims, span_a->low, span_b->high, NULL) < 0)
+ HGOTO_ERROR(H5E_DATASPACE, H5E_CANTAPPEND, FAIL, "can't allocate hyperslab span")
} /* end if */
/* If there are down spans, check for the overlap in them and add to each appropriate list */
else {
@@ -5322,24 +7743,28 @@ H5S__hyper_clip_spans(H5S_hyper_span_info_t *a_spans, H5S_hyper_span_info_t *b_s
down_b_not_a = NULL;
/* Check for overlaps in the 'down spans' of span 'a' & 'b' */
- if(H5S__hyper_clip_spans(span_a->down,span_b->down,&down_a_not_b,&down_a_and_b,&down_b_not_a)<0)
+ if(H5S__hyper_clip_spans(span_a->down, span_b->down, selector, ndims - 1, &down_a_not_b, &down_a_and_b, &down_b_not_a) < 0)
HGOTO_ERROR(H5E_DATASPACE, H5E_CANTCLIP, FAIL, "can't clip hyperslab information")
/* Check for additions to the a_not_b list */
if(down_a_not_b) {
+ HDassert(need_a_not_b == TRUE);
+
/* Merge/add overlapped part with/to a_not_b list */
- if(H5S__hyper_append_span(&last_a_not_b,a_not_b,span_a->low,span_b->high,down_a_not_b,NULL)==FAIL)
- HGOTO_ERROR(H5E_RESOURCE, H5E_CANTAPPEND, FAIL, "can't allocate hyperslab span")
+ if(H5S__hyper_append_span(a_not_b, ndims, span_a->low, span_b->high, down_a_not_b) < 0)
+ HGOTO_ERROR(H5E_DATASPACE, H5E_CANTAPPEND, FAIL, "can't allocate hyperslab span")
/* Release the down span tree generated */
H5S__hyper_free_span_info(down_a_not_b);
} /* end if */
/* Check for additions to the a_and_b list */
- if(down_a_and_b!=NULL) {
+ if(down_a_and_b) {
+ HDassert(need_a_and_b == TRUE);
+
/* Merge/add overlapped part with/to a_and_b list */
- if(H5S__hyper_append_span(&last_a_and_b,a_and_b,span_a->low,span_b->high,down_a_and_b,NULL)==FAIL)
- HGOTO_ERROR(H5E_RESOURCE, H5E_CANTAPPEND, FAIL, "can't allocate hyperslab span")
+ if(H5S__hyper_append_span(a_and_b, ndims, span_a->low, span_b->high, down_a_and_b) < 0)
+ HGOTO_ERROR(H5E_DATASPACE, H5E_CANTAPPEND, FAIL, "can't allocate hyperslab span")
/* Release the down span tree generated */
H5S__hyper_free_span_info(down_a_and_b);
@@ -5347,9 +7772,11 @@ H5S__hyper_clip_spans(H5S_hyper_span_info_t *a_spans, H5S_hyper_span_info_t *b_s
/* Check for additions to the b_not_a list */
if(down_b_not_a) {
+ HDassert(need_b_not_a == TRUE);
+
/* Merge/add overlapped part with/to b_not_a list */
- if(H5S__hyper_append_span(&last_b_not_a,b_not_a,span_a->low,span_b->high,down_b_not_a,NULL)==FAIL)
- HGOTO_ERROR(H5E_RESOURCE, H5E_CANTAPPEND, FAIL, "can't allocate hyperslab span")
+ if(H5S__hyper_append_span(b_not_a, ndims, span_a->low, span_b->high, down_b_not_a) < 0)
+ HGOTO_ERROR(H5E_DATASPACE, H5E_CANTAPPEND, FAIL, "can't allocate hyperslab span")
/* Release the down span tree generated */
H5S__hyper_free_span_info(down_b_not_a);
@@ -5363,11 +7790,11 @@ H5S__hyper_clip_spans(H5S_hyper_span_info_t *a_spans, H5S_hyper_span_info_t *b_s
HGOTO_ERROR(H5E_DATASPACE, H5E_CANTALLOC, FAIL, "can't allocate hyperslab span")
/* Make upper part of span 'a' into new span 'a' */
- H5S__hyper_recover_span(&recover_a,&span_a,tmp_span);
- recover_a=1;
+ H5S_HYPER_ADVANCE_SPAN(recover_a, span_a, tmp_span);
+ recover_a = TRUE;
/* Advance span 'b' */
- H5S__hyper_recover_span(&recover_b,&span_b,span_b->next);
+ H5S_HYPER_ADVANCE_SPAN(recover_b, span_b, span_b->next);
} /* end if */
/* span 'a' must be entirely above span 'b' */
/* AAAAA */
@@ -5377,40 +7804,70 @@ H5S__hyper_clip_spans(H5S_hyper_span_info_t *a_spans, H5S_hyper_span_info_t *b_s
/* Copy span 'b' and add to b_not_a list */
/* Merge/add span 'b' with/to b_not_a list */
- if(H5S__hyper_append_span(&last_b_not_a,b_not_a,span_b->low,span_b->high,span_b->down,NULL)==FAIL)
- HGOTO_ERROR(H5E_RESOURCE, H5E_CANTAPPEND, FAIL, "can't allocate hyperslab span")
+ if(need_b_not_a)
+ if(H5S__hyper_append_span(b_not_a, ndims, span_b->low, span_b->high, span_b->down) < 0)
+ HGOTO_ERROR(H5E_DATASPACE, H5E_CANTAPPEND, FAIL, "can't allocate hyperslab span")
/* Advance span 'b', leave span 'a' */
- H5S__hyper_recover_span(&recover_b,&span_b,span_b->next);
+ H5S_HYPER_ADVANCE_SPAN(recover_b, span_b, span_b->next);
} /* end else */
} /* end while */
/* Clean up 'a' spans which haven't been covered yet */
if(span_a != NULL && span_b == NULL) {
- while(span_a != NULL) {
- /* Copy span 'a' and add to a_not_b list */
-
- /* Merge/add span 'a' with/to a_not_b list */
- if(H5S__hyper_append_span(&last_a_not_b,a_not_b,span_a->low,span_a->high,span_a->down,NULL)==FAIL)
- HGOTO_ERROR(H5E_RESOURCE, H5E_CANTAPPEND, FAIL, "can't allocate hyperslab span")
+ /* Check if need to merge/add 'a' spans with/to a_not_b list */
+ if(need_a_not_b) {
+ /* (This loop, and the similar one below for 'b' spans,
+ * could be replaced with an optimized routine that quickly
+ * appended the remaining spans to the 'not' list, but
+ * until it looks like it's taking a lot of time for an
+ * important use case, it's been left generic, and similar
+ * to other code above. -QAK, 2019/02/01)
+ */
+ while(span_a != NULL) {
+ /* Copy span 'a' and add to a_not_b list */
+ if(H5S__hyper_append_span(a_not_b, ndims, span_a->low, span_a->high, span_a->down) < 0)
+ HGOTO_ERROR(H5E_DATASPACE, H5E_CANTAPPEND, FAIL, "can't allocate hyperslab span")
- /* Advance to the next 'a' span */
- H5S__hyper_recover_span(&recover_a,&span_a,span_a->next);
- } /* end while */
+ /* Advance to the next 'a' span */
+ H5S_HYPER_ADVANCE_SPAN(recover_a, span_a, span_a->next);
+ } /* end while */
+ } /* end if */
+ else {
+ /* Free the span, if it's generated */
+ if(recover_a)
+ H5S__hyper_free_span(span_a);
+ } /* end else */
} /* end if */
/* Clean up 'b' spans which haven't been covered yet */
else if(span_a == NULL && span_b != NULL) {
- while(span_b != NULL) {
- /* Copy span 'b' and add to b_not_a list */
-
- /* Merge/add span 'b' with/to b_not_a list */
- if(H5S__hyper_append_span(&last_b_not_a,b_not_a,span_b->low,span_b->high,span_b->down,NULL)==FAIL)
- HGOTO_ERROR(H5E_RESOURCE, H5E_CANTAPPEND, FAIL, "can't allocate hyperslab span")
+ /* Check if need to merge/add 'b' spans with/to b_not_a list */
+ if(need_b_not_a) {
+ /* (This loop, and the similar one above for 'a' spans,
+ * could be replaced with an optimized routine that quickly
+ * appended the remaining spans to the 'not' list, but
+ * until it looks like it's taking a lot of time for an
+ * important use case, it's been left generic, and similar
+ * to other code above. -QAK, 2019/02/01)
+ */
+ while(span_b != NULL) {
+ /* Copy span 'b' and add to b_not_a list */
+ if(H5S__hyper_append_span(b_not_a, ndims, span_b->low, span_b->high, span_b->down) < 0)
+ HGOTO_ERROR(H5E_DATASPACE, H5E_CANTAPPEND, FAIL, "can't allocate hyperslab span")
- /* Advance to the next 'b' span */
- H5S__hyper_recover_span(&recover_b,&span_b,span_b->next);
- } /* end while */
+ /* Advance to the next 'b' span */
+ H5S_HYPER_ADVANCE_SPAN(recover_b, span_b, span_b->next);
+ } /* end while */
+ } /* end if */
+ else {
+ /* Free the span, if it's generated */
+ if(recover_b)
+ H5S__hyper_free_span(span_b);
+ } /* end else */
} /* end if */
+ else
+ /* Sanity check */
+ HDassert(span_a == NULL && span_b == NULL);
} /* end else */
} /* end else */
@@ -5430,6 +7887,7 @@ done:
together
H5S_hyper_span_info_t *b_spans; IN: Second hyperslab spans to merge
together
+ unsigned ndims; IN: Number of dimensions of this span tree
RETURNS
Pointer to span tree containing the merged spans on success, NULL on failure
DESCRIPTION
@@ -5437,11 +7895,13 @@ done:
the merged set.
GLOBAL VARIABLES
COMMENTS, BUGS, ASSUMPTIONS
+ Handles merging span trees that overlap.
EXAMPLES
REVISION LOG
--------------------------------------------------------------------------*/
static H5S_hyper_span_info_t *
-H5S__hyper_merge_spans_helper(H5S_hyper_span_info_t *a_spans, H5S_hyper_span_info_t *b_spans)
+H5S__hyper_merge_spans_helper(H5S_hyper_span_info_t *a_spans, H5S_hyper_span_info_t *b_spans,
+ unsigned ndims)
{
H5S_hyper_span_info_t *merged_spans = NULL; /* Pointer to the merged span tree */
H5S_hyper_span_info_t *ret_value = NULL; /* Return value */
@@ -5457,23 +7917,19 @@ H5S__hyper_merge_spans_helper(H5S_hyper_span_info_t *a_spans, H5S_hyper_span_inf
merged_spans = NULL;
else {
/* Copy one of the span trees to return */
- if(NULL == (merged_spans = H5S__hyper_copy_span(a_spans)))
+ if(NULL == (merged_spans = H5S__hyper_copy_span(a_spans, ndims)))
HGOTO_ERROR(H5E_INTERNAL, H5E_CANTCOPY, NULL, "can't copy hyperslab span tree")
} /* end else */
} /* end if */
else {
H5S_hyper_span_t *span_a; /* Pointer to current span 'a' working on */
H5S_hyper_span_t *span_b; /* Pointer to current span 'b' working on */
- H5S_hyper_span_t *prev_span_merge; /* Pointer to previous merged span */
hbool_t recover_a, recover_b; /* Flags to indicate when to recover temporary spans */
/* Get the pointers to the 'a' and 'b' span lists */
span_a = a_spans->head;
span_b = b_spans->head;
- /* Set the pointer to the previous spans */
- prev_span_merge = NULL;
-
/* No spans to recover yet */
recover_a = recover_b = FALSE;
@@ -5488,11 +7944,11 @@ H5S__hyper_merge_spans_helper(H5S_hyper_span_info_t *a_spans, H5S_hyper_span_inf
/* BBBBBBBBBB */
if(span_a->high < span_b->low) {
/* Merge/add span 'a' with/to the merged spans */
- if(H5S__hyper_append_span(&prev_span_merge,&merged_spans,span_a->low,span_a->high,span_a->down,NULL)==FAIL)
- HGOTO_ERROR(H5E_RESOURCE, H5E_CANTAPPEND, NULL, "can't allocate hyperslab span")
+ if(H5S__hyper_append_span(&merged_spans, ndims, span_a->low, span_a->high, span_a->down) < 0)
+ HGOTO_ERROR(H5E_DATASPACE, H5E_CANTAPPEND, NULL, "can't allocate hyperslab span")
/* Advance span 'a' */
- H5S__hyper_recover_span(&recover_a,&span_a,span_a->next);
+ H5S_HYPER_ADVANCE_SPAN(recover_a, span_a, span_a->next);
} /* end if */
/* Check if span 'a' overlaps only the lower bound */
/* of span 'b', up to the upper bound of span 'b' */
@@ -5503,20 +7959,20 @@ H5S__hyper_merge_spans_helper(H5S_hyper_span_info_t *a_spans, H5S_hyper_span_inf
/* Check if span 'a' and span 'b' down spans are equal */
if(H5S__hyper_cmp_spans(span_a->down, span_b->down)) {
/* Merge/add copy of span 'a' with/to merged spans */
- if(H5S__hyper_append_span(&prev_span_merge,&merged_spans,span_a->low,span_a->high,span_a->down,NULL)==FAIL)
- HGOTO_ERROR(H5E_RESOURCE, H5E_CANTAPPEND, NULL, "can't allocate hyperslab span")
+ if(H5S__hyper_append_span(&merged_spans, ndims, span_a->low, span_a->high, span_a->down) < 0)
+ HGOTO_ERROR(H5E_DATASPACE, H5E_CANTAPPEND, NULL, "can't allocate hyperslab span")
} /* end if */
else {
/* Merge/add lower part of span 'a' with/to merged spans */
- if(H5S__hyper_append_span(&prev_span_merge,&merged_spans,span_a->low,span_b->low-1,span_a->down,NULL)==FAIL)
- HGOTO_ERROR(H5E_RESOURCE, H5E_CANTAPPEND, NULL, "can't allocate hyperslab span")
+ if(H5S__hyper_append_span(&merged_spans, ndims, span_a->low, span_b->low - 1, span_a->down) < 0)
+ HGOTO_ERROR(H5E_DATASPACE, H5E_CANTAPPEND, NULL, "can't allocate hyperslab span")
/* Get merged span tree for overlapped section */
- tmp_spans = H5S__hyper_merge_spans_helper(span_a->down,span_b->down);
+ tmp_spans = H5S__hyper_merge_spans_helper(span_a->down, span_b->down, ndims - 1);
/* Merge/add overlapped section to merged spans */
- if(H5S__hyper_append_span(&prev_span_merge,&merged_spans,span_b->low,span_a->high,tmp_spans,NULL)==FAIL)
- HGOTO_ERROR(H5E_RESOURCE, H5E_CANTAPPEND, NULL, "can't allocate hyperslab span")
+ if(H5S__hyper_append_span(&merged_spans, ndims, span_b->low, span_a->high, tmp_spans) < 0)
+ HGOTO_ERROR(H5E_DATASPACE, H5E_CANTAPPEND, NULL, "can't allocate hyperslab span")
/* Release merged span tree for overlapped section */
H5S__hyper_free_span_info(tmp_spans);
@@ -5527,20 +7983,20 @@ H5S__hyper_merge_spans_helper(H5S_hyper_span_info_t *a_spans, H5S_hyper_span_inf
/* Copy upper part of span 'b' as new span 'b' */
/* Allocate new span node to append to list */
- if((tmp_span = H5S__hyper_new_span(span_a->high+1,span_b->high,span_b->down,span_b->next))==NULL)
- HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "can't allocate hyperslab span")
+ if(NULL == (tmp_span = H5S__hyper_new_span(span_a->high + 1, span_b->high, span_b->down, span_b->next)))
+ HGOTO_ERROR(H5E_DATASPACE, H5E_CANTALLOC, NULL, "can't allocate hyperslab span")
/* Advance span 'a' */
- H5S__hyper_recover_span(&recover_a,&span_a,span_a->next);
+ H5S_HYPER_ADVANCE_SPAN(recover_a, span_a, span_a->next);
/* Set new span 'b' to tmp_span */
- H5S__hyper_recover_span(&recover_b,&span_b,tmp_span);
+ H5S_HYPER_ADVANCE_SPAN(recover_b, span_b, tmp_span);
recover_b = TRUE;
} /* end if */
else {
/* Advance both span 'a' & 'b' */
- H5S__hyper_recover_span(&recover_a,&span_a,span_a->next);
- H5S__hyper_recover_span(&recover_b,&span_b,span_b->next);
+ H5S_HYPER_ADVANCE_SPAN(recover_a, span_a, span_a->next);
+ H5S_HYPER_ADVANCE_SPAN(recover_b, span_b, span_b->next);
} /* end else */
} /* end if */
/* Check if span 'a' overlaps the lower & upper bound */
@@ -5552,20 +8008,20 @@ H5S__hyper_merge_spans_helper(H5S_hyper_span_info_t *a_spans, H5S_hyper_span_inf
/* Check if span 'a' and span 'b' down spans are equal */
if(H5S__hyper_cmp_spans(span_a->down, span_b->down)) {
/* Merge/add copy of lower & middle parts of span 'a' to merged spans */
- if(H5S__hyper_append_span(&prev_span_merge,&merged_spans,span_a->low,span_b->high,span_a->down,NULL)==FAIL)
- HGOTO_ERROR(H5E_RESOURCE, H5E_CANTAPPEND, NULL, "can't allocate hyperslab span")
+ if(H5S__hyper_append_span(&merged_spans, ndims, span_a->low, span_b->high, span_a->down) < 0)
+ HGOTO_ERROR(H5E_DATASPACE, H5E_CANTAPPEND, NULL, "can't allocate hyperslab span")
} /* end if */
else {
/* Merge/add lower part of span 'a' to merged spans */
- if(H5S__hyper_append_span(&prev_span_merge,&merged_spans,span_a->low,span_b->low-1,span_a->down,NULL)==FAIL)
- HGOTO_ERROR(H5E_RESOURCE, H5E_CANTAPPEND, NULL, "can't allocate hyperslab span")
+ if(H5S__hyper_append_span(&merged_spans, ndims, span_a->low, span_b->low - 1, span_a->down) < 0)
+ HGOTO_ERROR(H5E_DATASPACE, H5E_CANTAPPEND, NULL, "can't allocate hyperslab span")
/* Get merged span tree for overlapped section */
- tmp_spans = H5S__hyper_merge_spans_helper(span_a->down,span_b->down);
+ tmp_spans = H5S__hyper_merge_spans_helper(span_a->down, span_b->down, ndims - 1);
/* Merge/add overlapped section to merged spans */
- if(H5S__hyper_append_span(&prev_span_merge,&merged_spans,span_b->low,span_b->high,tmp_spans,NULL)==FAIL)
- HGOTO_ERROR(H5E_RESOURCE, H5E_CANTAPPEND, NULL, "can't allocate hyperslab span")
+ if(H5S__hyper_append_span(&merged_spans, ndims, span_b->low, span_b->high, tmp_spans) < 0)
+ HGOTO_ERROR(H5E_DATASPACE, H5E_CANTAPPEND, NULL, "can't allocate hyperslab span")
/* Release merged span tree for overlapped section */
H5S__hyper_free_span_info(tmp_spans);
@@ -5578,11 +8034,11 @@ H5S__hyper_merge_spans_helper(H5S_hyper_span_info_t *a_spans, H5S_hyper_span_inf
HGOTO_ERROR(H5E_DATASPACE, H5E_CANTALLOC, NULL, "can't allocate hyperslab span")
/* Set new span 'a' to tmp_span */
- H5S__hyper_recover_span(&recover_a,&span_a,tmp_span);
+ H5S_HYPER_ADVANCE_SPAN(recover_a, span_a, tmp_span);
recover_a = TRUE;
/* Advance span 'b' */
- H5S__hyper_recover_span(&recover_b,&span_b,span_b->next);
+ H5S_HYPER_ADVANCE_SPAN(recover_b, span_b, span_b->next);
} /* end if */
/* Check if span 'a' is entirely within span 'b' */
/* AAAAA */
@@ -5592,26 +8048,26 @@ H5S__hyper_merge_spans_helper(H5S_hyper_span_info_t *a_spans, H5S_hyper_span_inf
/* Check if span 'a' and span 'b' down spans are equal */
if(H5S__hyper_cmp_spans(span_a->down, span_b->down)) {
/* Merge/add copy of lower & middle parts of span 'b' to merged spans */
- if(H5S__hyper_append_span(&prev_span_merge,&merged_spans,span_b->low,span_a->high,span_a->down,NULL)==FAIL)
- HGOTO_ERROR(H5E_RESOURCE, H5E_CANTAPPEND, NULL, "can't allocate hyperslab span")
+ if(H5S__hyper_append_span(&merged_spans, ndims, span_b->low, span_a->high, span_a->down) < 0)
+ HGOTO_ERROR(H5E_DATASPACE, H5E_CANTAPPEND, NULL, "can't allocate hyperslab span")
} /* end if */
else {
/* Check if there is a lower part of span 'b' */
if(span_a->low > span_b->low) {
/* Merge/add lower part of span 'b' to merged spans */
- if(H5S__hyper_append_span(&prev_span_merge,&merged_spans,span_b->low,span_a->low-1,span_b->down,NULL)==FAIL)
- HGOTO_ERROR(H5E_RESOURCE, H5E_CANTAPPEND, NULL, "can't allocate hyperslab span")
+ if(H5S__hyper_append_span(&merged_spans, ndims, span_b->low, span_a->low - 1, span_b->down) < 0)
+ HGOTO_ERROR(H5E_DATASPACE, H5E_CANTAPPEND, NULL, "can't allocate hyperslab span")
} /* end if */
else {
/* No lower part of span 'b' , keep going... */
} /* end else */
/* Get merged span tree for overlapped section */
- tmp_spans = H5S__hyper_merge_spans_helper(span_a->down,span_b->down);
+ tmp_spans = H5S__hyper_merge_spans_helper(span_a->down, span_b->down, ndims - 1);
/* Merge/add overlapped section to merged spans */
- if(H5S__hyper_append_span(&prev_span_merge,&merged_spans,span_a->low,span_a->high,tmp_spans,NULL)==FAIL)
- HGOTO_ERROR(H5E_RESOURCE, H5E_CANTAPPEND, NULL, "can't allocate hyperslab span")
+ if(H5S__hyper_append_span(&merged_spans, ndims, span_a->low, span_a->high, tmp_spans) < 0)
+ HGOTO_ERROR(H5E_DATASPACE, H5E_CANTAPPEND, NULL, "can't allocate hyperslab span")
/* Release merged span tree for overlapped section */
H5S__hyper_free_span_info(tmp_spans);
@@ -5626,16 +8082,16 @@ H5S__hyper_merge_spans_helper(H5S_hyper_span_info_t *a_spans, H5S_hyper_span_inf
HGOTO_ERROR(H5E_DATASPACE, H5E_CANTALLOC, NULL, "can't allocate hyperslab span")
/* Advance span 'a' */
- H5S__hyper_recover_span(&recover_a,&span_a,span_a->next);
+ H5S_HYPER_ADVANCE_SPAN(recover_a, span_a, span_a->next);
/* Set new span 'b' to tmp_span */
- H5S__hyper_recover_span(&recover_b,&span_b,tmp_span);
+ H5S_HYPER_ADVANCE_SPAN(recover_b, span_b, tmp_span);
recover_b = TRUE;
} /* end if */
else {
/* Advance both spans */
- H5S__hyper_recover_span(&recover_a,&span_a,span_a->next);
- H5S__hyper_recover_span(&recover_b,&span_b,span_b->next);
+ H5S_HYPER_ADVANCE_SPAN(recover_a, span_a, span_a->next);
+ H5S_HYPER_ADVANCE_SPAN(recover_b, span_b, span_b->next);
} /* end else */
} /* end if */
/* Check if span 'a' overlaps only the upper bound */
@@ -5647,26 +8103,26 @@ H5S__hyper_merge_spans_helper(H5S_hyper_span_info_t *a_spans, H5S_hyper_span_inf
/* Check if span 'a' and span 'b' down spans are equal */
if(H5S__hyper_cmp_spans(span_a->down, span_b->down)) {
/* Merge/add copy of span 'b' to merged spans if so */
- if(H5S__hyper_append_span(&prev_span_merge,&merged_spans,span_b->low,span_b->high,span_b->down,NULL)==FAIL)
- HGOTO_ERROR(H5E_RESOURCE, H5E_CANTAPPEND, NULL, "can't allocate hyperslab span")
+ if(H5S__hyper_append_span(&merged_spans, ndims, span_b->low, span_b->high, span_b->down) < 0)
+ HGOTO_ERROR(H5E_DATASPACE, H5E_CANTAPPEND, NULL, "can't allocate hyperslab span")
} /* end if */
else {
/* Check if there is a lower part of span 'b' */
if(span_a->low > span_b->low) {
/* Merge/add lower part of span 'b' to merged spans */
- if(H5S__hyper_append_span(&prev_span_merge,&merged_spans,span_b->low,span_a->low-1,span_b->down,NULL)==FAIL)
- HGOTO_ERROR(H5E_RESOURCE, H5E_CANTAPPEND, NULL, "can't allocate hyperslab span")
+ if(H5S__hyper_append_span(&merged_spans, ndims, span_b->low, span_a->low - 1, span_b->down) < 0)
+ HGOTO_ERROR(H5E_DATASPACE, H5E_CANTAPPEND, NULL, "can't allocate hyperslab span")
} /* end if */
else {
/* No lower part of span 'b' , keep going... */
} /* end else */
/* Get merged span tree for overlapped section */
- tmp_spans = H5S__hyper_merge_spans_helper(span_a->down,span_b->down);
+ tmp_spans = H5S__hyper_merge_spans_helper(span_a->down, span_b->down, ndims - 1);
/* Merge/add overlapped section to merged spans */
- if(H5S__hyper_append_span(&prev_span_merge,&merged_spans,span_a->low,span_b->high,tmp_spans,NULL)==FAIL)
- HGOTO_ERROR(H5E_RESOURCE, H5E_CANTAPPEND, NULL, "can't allocate hyperslab span")
+ if(H5S__hyper_append_span(&merged_spans, ndims, span_a->low, span_b->high, tmp_spans) < 0)
+ HGOTO_ERROR(H5E_DATASPACE, H5E_CANTAPPEND, NULL, "can't allocate hyperslab span")
/* Release merged span tree for overlapped section */
H5S__hyper_free_span_info(tmp_spans);
@@ -5679,11 +8135,11 @@ H5S__hyper_merge_spans_helper(H5S_hyper_span_info_t *a_spans, H5S_hyper_span_inf
HGOTO_ERROR(H5E_DATASPACE, H5E_CANTALLOC, NULL, "can't allocate hyperslab span")
/* Set new span 'a' to tmp_span */
- H5S__hyper_recover_span(&recover_a,&span_a,tmp_span);
+ H5S_HYPER_ADVANCE_SPAN(recover_a, span_a, tmp_span);
recover_a = TRUE;
/* Advance span 'b' */
- H5S__hyper_recover_span(&recover_b,&span_b,span_b->next);
+ H5S_HYPER_ADVANCE_SPAN(recover_b, span_b, span_b->next);
} /* end if */
/* Span 'a' must be entirely above span 'b' */
/* AAAAA */
@@ -5691,11 +8147,11 @@ H5S__hyper_merge_spans_helper(H5S_hyper_span_info_t *a_spans, H5S_hyper_span_inf
/* BBBBBBBBBB */
else {
/* Merge/add span 'b' with the merged spans */
- if(H5S__hyper_append_span(&prev_span_merge,&merged_spans,span_b->low,span_b->high,span_b->down,NULL)==FAIL)
- HGOTO_ERROR(H5E_RESOURCE, H5E_CANTAPPEND, NULL, "can't allocate hyperslab span")
+ if(H5S__hyper_append_span(&merged_spans, ndims, span_b->low, span_b->high, span_b->down) < 0)
+ HGOTO_ERROR(H5E_DATASPACE, H5E_CANTAPPEND, NULL, "can't allocate hyperslab span")
/* Advance span 'b' */
- H5S__hyper_recover_span(&recover_b,&span_b,span_b->next);
+ H5S_HYPER_ADVANCE_SPAN(recover_b, span_b, span_b->next);
} /* end else */
} /* end while */
@@ -5703,11 +8159,11 @@ H5S__hyper_merge_spans_helper(H5S_hyper_span_info_t *a_spans, H5S_hyper_span_inf
if(span_a != NULL && span_b == NULL) {
while(span_a != NULL) {
/* Merge/add all 'a' spans into the merged spans */
- if(H5S__hyper_append_span(&prev_span_merge,&merged_spans,span_a->low,span_a->high,span_a->down,NULL)==FAIL)
- HGOTO_ERROR(H5E_RESOURCE, H5E_CANTAPPEND, NULL, "can't allocate hyperslab span")
+ if(H5S__hyper_append_span(&merged_spans, ndims, span_a->low, span_a->high, span_a->down) < 0)
+ HGOTO_ERROR(H5E_DATASPACE, H5E_CANTAPPEND, NULL, "can't allocate hyperslab span")
/* Advance to next 'a' span, until all processed */
- H5S__hyper_recover_span(&recover_a,&span_a,span_a->next);
+ H5S_HYPER_ADVANCE_SPAN(recover_a, span_a, span_a->next);
} /* end while */
} /* end if */
@@ -5715,11 +8171,11 @@ H5S__hyper_merge_spans_helper(H5S_hyper_span_info_t *a_spans, H5S_hyper_span_inf
if(span_a == NULL && span_b != NULL) {
while(span_b != NULL) {
/* Merge/add all 'b' spans into the merged spans */
- if(H5S__hyper_append_span(&prev_span_merge,&merged_spans,span_b->low,span_b->high,span_b->down,NULL)==FAIL)
- HGOTO_ERROR(H5E_RESOURCE, H5E_CANTAPPEND, NULL, "can't allocate hyperslab span")
+ if(H5S__hyper_append_span(&merged_spans, ndims, span_b->low, span_b->high, span_b->down) < 0)
+ HGOTO_ERROR(H5E_DATASPACE, H5E_CANTAPPEND, NULL, "can't allocate hyperslab span")
/* Advance to next 'b' span, until all processed */
- H5S__hyper_recover_span(&recover_b,&span_b,span_b->next);
+ H5S_HYPER_ADVANCE_SPAN(recover_b, span_b, span_b->next);
} /* end while */
} /* end if */
} /* end else */
@@ -5729,8 +8185,8 @@ H5S__hyper_merge_spans_helper(H5S_hyper_span_info_t *a_spans, H5S_hyper_span_inf
done:
if(ret_value == NULL)
- if(merged_spans && H5S__hyper_free_span_info(merged_spans) < 0)
- HDONE_ERROR(H5E_INTERNAL, H5E_CANTFREE, NULL, "failed to release merged hyperslab spans")
+ if(merged_spans)
+ H5S__hyper_free_span_info(merged_spans);
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5S__hyper_merge_spans_helper() */
@@ -5747,44 +8203,37 @@ done:
selection.
H5S_hyper_span_t *new_spans; IN: Span tree of new spans to add to
hyperslab selection
- hbool_t can_own; IN: Flag to indicate that it is OK to point
- directly to the new spans, instead of
- copying them.
RETURNS
non-negative on success, negative on failure
DESCRIPTION
- Add a set of hyperslab spans to an existing hyperslab selection. The
- new spans are required to be non-overlapping with the existing spans in
- the dataspace's current hyperslab selection.
+ Add a set of hyperslab spans to an existing hyperslab selection.
GLOBAL VARIABLES
COMMENTS, BUGS, ASSUMPTIONS
EXAMPLES
REVISION LOG
--------------------------------------------------------------------------*/
static herr_t
-H5S__hyper_merge_spans(H5S_t *space, H5S_hyper_span_info_t *new_spans, hbool_t can_own)
+H5S__hyper_merge_spans(H5S_t *space, H5S_hyper_span_info_t *new_spans)
{
- FUNC_ENTER_STATIC_NOERR
+ herr_t ret_value = SUCCEED; /* Return value */
- /* Check args */
+ FUNC_ENTER_STATIC
+
+ /* Sanity checks */
HDassert(space);
HDassert(new_spans);
/* If this is the first span tree in the hyperslab selection, just use it */
if(space->select.sel_info.hslab->span_lst == NULL) {
- if(can_own)
- space->select.sel_info.hslab->span_lst = new_spans;
- else
- space->select.sel_info.hslab->span_lst = H5S__hyper_copy_span(new_spans);
+ space->select.sel_info.hslab->span_lst = new_spans;
+ space->select.sel_info.hslab->span_lst->count++;
} /* end if */
else {
H5S_hyper_span_info_t *merged_spans;
/* Get the merged spans */
- merged_spans = H5S__hyper_merge_spans_helper(space->select.sel_info.hslab->span_lst, new_spans);
-
- /* Sanity checking since we started with some spans, we should still have some after the merge */
- HDassert(merged_spans);
+ if(NULL == (merged_spans = H5S__hyper_merge_spans_helper(space->select.sel_info.hslab->span_lst, new_spans, space->extent.rank)))
+ HGOTO_ERROR(H5E_DATASPACE, H5E_CANTMERGE, FAIL, "can't merge hyperslab spans")
/* Free the previous spans */
H5S__hyper_free_span_info(space->select.sel_info.hslab->span_lst);
@@ -5793,18 +8242,20 @@ H5S__hyper_merge_spans(H5S_t *space, H5S_hyper_span_info_t *new_spans, hbool_t c
space->select.sel_info.hslab->span_lst = merged_spans;
} /* end else */
- FUNC_LEAVE_NOAPI(SUCCEED)
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
} /* end H5S__hyper_merge_spans() */
/*--------------------------------------------------------------------------
NAME
- H5S__hyper_spans_nelem
+ H5S__hyper_spans_nelem_helper
PURPOSE
Count the number of elements in a span tree
USAGE
- hsize_t H5S__hyper_spans_nelem(spans)
+ hsize_t H5S__hyper_spans_nelem_helper(spans, op_gen)
const H5S_hyper_span_info_t *spans; IN: Hyperslan span tree to count elements of
+ uint64_t op_gen; IN: Operation generation
RETURNS
Number of elements in span tree on success; negative on failure
DESCRIPTION
@@ -5815,47 +8266,158 @@ H5S__hyper_merge_spans(H5S_t *space, H5S_hyper_span_info_t *new_spans, hbool_t c
REVISION LOG
--------------------------------------------------------------------------*/
static hsize_t
-H5S__hyper_spans_nelem(const H5S_hyper_span_info_t *spans)
+H5S__hyper_spans_nelem_helper(H5S_hyper_span_info_t *spans, uint64_t op_gen)
{
hsize_t ret_value = 0; /* Return value */
FUNC_ENTER_STATIC_NOERR
- /* Count the number of elements in the span tree */
- if(spans != NULL) {
+ /* Sanity check */
+ HDassert(spans);
+
+ /* Check if the span tree was already counted */
+ if(spans->op_gen == op_gen)
+ /* Just return the # of elements in the already counted span tree */
+ ret_value = spans->u.nelmts;
+ else { /* Count the number of elements in the span tree */
const H5S_hyper_span_t *span; /* Hyperslab span */
span = spans->head;
- while(span != NULL) {
- /* If there are down spans, multiply the size of this span by the total down span elements */
- if(span->down != NULL)
- ret_value += span->nelem * H5S__hyper_spans_nelem(span->down);
- /* If there are no down spans, just count the elements in this span */
- else
- ret_value += span->nelem;
+ if(NULL == span->down) {
+ while(span != NULL) {
+ /* Compute # of elements covered */
+ ret_value += (span->high - span->low) + 1;
- /* Advance to next span */
- span = span->next;
- } /* end while */
+ /* Advance to next span */
+ span = span->next;
+ } /* end while */
+ } /* end if */
+ else {
+ while(span != NULL) {
+ hsize_t nelmts; /* # of elements covered by current span */
+
+ /* Compute # of elements covered */
+ nelmts = (span->high - span->low) + 1;
+
+ /* Multiply the size of this span by the total down span elements */
+ ret_value += nelmts * H5S__hyper_spans_nelem_helper(span->down, op_gen);
+
+ /* Advance to next span */
+ span = span->next;
+ } /* end while */
+ } /* end else */
+
+ /* Set the operation generation for this span tree, to avoid re-computing */
+ spans->op_gen = op_gen;
+
+ /* Hold a copy of the # of elements */
+ spans->u.nelmts = ret_value;
} /* end else */
FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5S__hyper_spans_nelem_helper() */
+
+
+/*--------------------------------------------------------------------------
+ NAME
+ H5S__hyper_spans_nelem
+ PURPOSE
+ Count the number of elements in a span tree
+ USAGE
+ hsize_t H5S__hyper_spans_nelem(spans)
+ const H5S_hyper_span_info_t *spans; IN: Hyperslan span tree to count elements of
+ RETURNS
+ Number of elements in span tree on success; negative on failure
+ DESCRIPTION
+ Counts the number of elements described by the spans in a span tree.
+ GLOBAL VARIABLES
+ COMMENTS, BUGS, ASSUMPTIONS
+ EXAMPLES
+ REVISION LOG
+--------------------------------------------------------------------------*/
+static hsize_t
+H5S__hyper_spans_nelem(H5S_hyper_span_info_t *spans)
+{
+ uint64_t op_gen; /* Operation generation value */
+ hsize_t ret_value = 0; /* Return value */
+
+ FUNC_ENTER_STATIC_NOERR
+
+ /* Sanity check */
+ HDassert(spans);
+
+ /* Acquire an operation generation value for this operation */
+ op_gen = H5S__hyper_get_op_gen();
+
+ /* Count the number of elements in the span tree */
+ ret_value = H5S__hyper_spans_nelem_helper(spans, op_gen);
+
+ FUNC_LEAVE_NOAPI(ret_value)
} /* end H5S__hyper_spans_nelem() */
/*--------------------------------------------------------------------------
NAME
+ H5S__hyper_add_disjoint_spans
+ PURPOSE
+ Add new hyperslab spans to existing hyperslab selection in the case the
+ new hyperslab spans don't overlap with the existing hyperslab selection
+ USAGE
+ herr_t H5S__hyper_add_disjoint_spans(space, new_spans)
+ H5S_t *space; IN: Dataspace to add new spans to hyperslab
+ selection.
+ H5S_hyper_span_t *new_spans; IN: Span tree of new spans to add to
+ hyperslab selection
+ RETURNS
+ Non-negative on success, negative on failure
+ DESCRIPTION
+ Add a set of hyperslab spans to an existing hyperslab selection. The
+ new spans are required not to overlap with the existing spans in the
+ dataspace's current hyperslab selection in terms of bound box.
+ GLOBAL VARIABLES
+ COMMENTS, BUGS, ASSUMPTIONS
+ EXAMPLES
+ REVISION LOG
+--------------------------------------------------------------------------*/
+static herr_t
+H5S__hyper_add_disjoint_spans(H5S_t *space, H5S_hyper_span_info_t *new_spans)
+{
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_STATIC
+
+ /* Check args */
+ HDassert(space);
+ HDassert(new_spans);
+
+ /* Update the number of elements in the selection */
+ space->select.num_elem += H5S__hyper_spans_nelem(new_spans);
+
+ /* Add the new spans to the existing selection in the dataspace */
+ if(H5S__hyper_merge_spans(space, new_spans) < 0)
+ HGOTO_ERROR(H5E_DATASPACE, H5E_CANTINSERT, FAIL, "can't merge hyperslabs")
+
+ /* Free the memory space for new spans */
+ H5S__hyper_free_span_info(new_spans);
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5S__hyper_add_disjoint_spans */
+
+
+/*--------------------------------------------------------------------------
+ NAME
H5S__hyper_make_spans
PURPOSE
Create a span tree
USAGE
H5S_hyper_span_t *H5S__hyper_make_spans(rank, start, stride, count, block)
- unsigned rank; IN: # of dimensions of the space
- const hsize_t *start; IN: Starting location of the hyperslabs
- const hsize_t *stride; IN: Stride from the beginning of one block to
+ unsigned rank; IN: # of dimensions of the space
+ const hsize_t *start; IN: Starting location of the hyperslabs
+ const hsize_t *stride; IN: Stride from the beginning of one block to
the next
- const hsize_t *count; IN: Number of blocks
- const hsize_t *block; IN: Size of hyperslab block
+ const hsize_t *count; IN: Number of blocks
+ const hsize_t *block; IN: Size of hyperslab block
RETURNS
Pointer to new span tree on success, NULL on failure
DESCRIPTION
@@ -5875,9 +8437,7 @@ H5S__hyper_make_spans(unsigned rank, const hsize_t *start, const hsize_t *stride
H5S_hyper_span_info_t *down = NULL; /* Pointer to spans in next dimension down */
H5S_hyper_span_t *last_span; /* Current position in hyperslab span list */
H5S_hyper_span_t *head = NULL; /* Head of new hyperslab span list */
- hsize_t stride_iter; /* Iterator over the stride values */
int i; /* Counters */
- unsigned u; /* Counters */
H5S_hyper_span_info_t *ret_value = NULL; /* Return value */
FUNC_ENTER_STATIC
@@ -5891,6 +8451,9 @@ H5S__hyper_make_spans(unsigned rank, const hsize_t *start, const hsize_t *stride
/* Start creating spans in fastest changing dimension */
for(i = (int)(rank - 1); i >= 0; i--) {
+ hsize_t curr_low, curr_high; /* Current low & high values */
+ hsize_t dim_stride; /* Current dim's stride */
+ unsigned u; /* Local index variable */
/* Sanity check */
if(0 == count[i])
@@ -5901,8 +8464,10 @@ H5S__hyper_make_spans(unsigned rank, const hsize_t *start, const hsize_t *stride
last_span = NULL;
/* Generate all the span segments for this dimension */
- for(u = 0, stride_iter = 0; u < count[i]; u++, stride_iter += stride[i])
- {
+ curr_low = start[i];
+ curr_high = start[i] + (block[i] - 1);
+ dim_stride = stride[i];
+ for(u = 0; u < count[i]; u++, curr_low += dim_stride, curr_high += dim_stride) {
H5S_hyper_span_t *span; /* New hyperslab span */
/* Allocate a span node */
@@ -5910,12 +8475,14 @@ H5S__hyper_make_spans(unsigned rank, const hsize_t *start, const hsize_t *stride
HGOTO_ERROR(H5E_DATASPACE, H5E_CANTALLOC, NULL, "can't allocate hyperslab span")
/* Set the span's basic information */
- span->low = start[i] + stride_iter;
- span->high = span->low + (block[i] - 1);
- span->nelem = block[i];
- span->pstride = stride[i];
+ span->low = curr_low;
+ span->high = curr_high;
span->next = NULL;
+ /* Set the information for the next dimension down's spans */
+ /* (Will be NULL for fastest changing dimension) */
+ span->down = down;
+
/* Append to the list of spans in this dimension */
if(head == NULL)
head = span;
@@ -5924,23 +8491,32 @@ H5S__hyper_make_spans(unsigned rank, const hsize_t *start, const hsize_t *stride
/* Move current pointer */
last_span = span;
-
- /* Set the information for the next dimension down's spans, if appropriate */
- if(down != NULL) {
- span->down = down;
- down->count++; /* Increment reference count for shared span */
- } /* end if */
- else
- span->down = NULL;
} /* end for */
+ /* Increment ref. count of shared span */
+ if(down != NULL)
+ down->count = (unsigned)count[i];
+
/* Allocate a span info node */
- if(NULL == (down = H5FL_CALLOC(H5S_hyper_span_info_t)))
+ if(NULL == (down = H5S__hyper_new_span_info(rank)))
HGOTO_ERROR(H5E_DATASPACE, H5E_CANTALLOC, NULL, "can't allocate hyperslab span")
/* Keep the pointer to the next dimension down's completed list */
down->head = head;
+ /* Keep the tail pointer to the next dimension down's completed list */
+ down->tail = last_span;
+
+ /* Set the low & high bounds for this dimension */
+ down->low_bounds[0] = down->head->low;
+ down->high_bounds[0] = down->tail->high;
+
+ /* Copy bounds from lower dimensions */
+ /* (head & tail pointers share lower dimensions, so using either is OK) */
+ if(head->down) {
+ H5MM_memcpy(&down->low_bounds[1], &head->down->low_bounds[0], sizeof(hsize_t) * ((rank - 1) - (unsigned)i));
+ H5MM_memcpy(&down->high_bounds[1], &head->down->high_bounds[0], sizeof(hsize_t) * ((rank - 1) - (unsigned)i));
+ } /* end if */
} /* end for */
/* Indicate that there is a pointer to this tree */
@@ -5961,7 +8537,7 @@ done:
do {
if(down) {
head = down->head;
- down = H5FL_FREE(H5S_hyper_span_info_t, down);
+ down = (H5S_hyper_span_info_t *)H5FL_ARR_FREE(hbounds_t, down);
} /* end if */
down = head->down;
@@ -5980,6 +8556,224 @@ done:
/*--------------------------------------------------------------------------
NAME
+ H5S__hyper_update_diminfo
+ PURPOSE
+ Attempt to update optimized hyperslab information quickly. (It can be
+ recovered with regular selection). If this algorithm cannot determine
+ the optimized dimension info quickly, this function will simply mark it
+ as invalid and unknown if it can be built (H5S_DIMINFO_VALID_NO), so
+ H5S__hyper_rebuild can be run later to determine for sure.
+ USAGE
+ herr_t H5S__hyper_update_diminfo(space, op, new_hyper_diminfo)
+ H5S_t *space; IN: Dataspace to check
+ H5S_seloper_t op; IN: The operation being performed on the
+ selection
+ const H5S_hyper_dim_t new_hyper_diminfo; IN: The new selection that
+ is being combined with
+ the current
+ RETURNS
+ >=0 on success, <0 on failure
+ DESCRIPTION
+ Examine the span tree for a hyperslab selection and rebuild
+ the start/stride/count/block information for the selection, if possible.
+
+ GLOBAL VARIABLES
+ COMMENTS, BUGS, ASSUMPTIONS
+ EXAMPLES
+ REVISION LOG
+--------------------------------------------------------------------------*/
+static herr_t
+H5S__hyper_update_diminfo(H5S_t *space, H5S_seloper_t op,
+ const H5S_hyper_dim_t *new_hyper_diminfo)
+{
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_STATIC_NOERR
+
+ /* Check args */
+ HDassert(space);
+ HDassert(new_hyper_diminfo);
+
+ /* Check for conditions that prevent us from using the fast algorithm here */
+ /* (and instead require H5S__hyper_rebuild) */
+ if(!((op == H5S_SELECT_OR) || (op == H5S_SELECT_XOR))
+ || space->select.sel_info.hslab->diminfo_valid != H5S_DIMINFO_VALID_YES
+ || !space->select.sel_info.hslab->span_lst->head)
+ space->select.sel_info.hslab->diminfo_valid = H5S_DIMINFO_VALID_NO;
+ else {
+ H5S_hyper_dim_t tmp_diminfo[H5S_MAX_RANK]; /* Temporary dimension info */
+ hbool_t found_nonidentical_dim = FALSE;
+ unsigned curr_dim;
+
+ /* Copy current diminfo.opt values */
+ H5MM_memcpy(tmp_diminfo, space->select.sel_info.hslab->diminfo.opt, sizeof(tmp_diminfo));
+
+ /* Loop over dimensions */
+ for(curr_dim = 0; curr_dim < space->extent.rank; curr_dim++) {
+ /* Check for this being identical */
+ if((tmp_diminfo[curr_dim].start != new_hyper_diminfo[curr_dim].start)
+ || (tmp_diminfo[curr_dim].stride != new_hyper_diminfo[curr_dim].stride)
+ || (tmp_diminfo[curr_dim].count != new_hyper_diminfo[curr_dim].count)
+ || (tmp_diminfo[curr_dim].block != new_hyper_diminfo[curr_dim].block)) {
+ hsize_t high_start, high_count, high_block; /* The start, count & block values for the higher block */
+
+ /* Dimension is not identical */
+ /* Check if we already found a nonidentical dim - only one is
+ * allowed */
+ if(found_nonidentical_dim) {
+ space->select.sel_info.hslab->diminfo_valid = H5S_DIMINFO_VALID_NO;
+ break;
+ } /* end if */
+
+ /* Check that strides are the same, or count is 1 for one of the
+ * slabs */
+ if((tmp_diminfo[curr_dim].stride != new_hyper_diminfo[curr_dim].stride)
+ && (tmp_diminfo[curr_dim].count > 1)
+ && (new_hyper_diminfo[curr_dim].count > 1)) {
+ space->select.sel_info.hslab->diminfo_valid = H5S_DIMINFO_VALID_NO;
+ break;
+ } /* end if */
+
+ /* Patch tmp_diminfo.stride if its count is 1 */
+ if((tmp_diminfo[curr_dim].count == 1)
+ && (new_hyper_diminfo[curr_dim].count > 1))
+ tmp_diminfo[curr_dim].stride = new_hyper_diminfo[curr_dim].stride;
+
+ /* Determine lowest start, and set tmp_diminfo.start, count and
+ * block to use the lowest, and high_start, high_count and
+ * high_block to use the highest
+ */
+ if(tmp_diminfo[curr_dim].start < new_hyper_diminfo[curr_dim].start) {
+ high_start = new_hyper_diminfo[curr_dim].start;
+ high_count = new_hyper_diminfo[curr_dim].count;
+ high_block = new_hyper_diminfo[curr_dim].block;
+ } /* end if */
+ else {
+ high_start = tmp_diminfo[curr_dim].start;
+ tmp_diminfo[curr_dim].start = new_hyper_diminfo[curr_dim].start;
+ high_count = tmp_diminfo[curr_dim].count;
+ tmp_diminfo[curr_dim].count = new_hyper_diminfo[curr_dim].count;
+ high_block = tmp_diminfo[curr_dim].block;
+ tmp_diminfo[curr_dim].block = new_hyper_diminfo[curr_dim].block;
+ } /* end else */
+
+ /* If count is 1 for both slabs, take different actions */
+ if((tmp_diminfo[curr_dim].count == 1) && (high_count == 1)) {
+ /* Check for overlap */
+ if((tmp_diminfo[curr_dim].start + tmp_diminfo[curr_dim].block)
+ > high_start) {
+ /* Check operation type */
+ if(op == H5S_SELECT_OR)
+ /* Merge blocks */
+ tmp_diminfo[curr_dim].block = ((high_start + high_block)
+ >= (tmp_diminfo[curr_dim].start + tmp_diminfo[curr_dim].block))
+ ? (high_start + high_block - tmp_diminfo[curr_dim].start)
+ : tmp_diminfo[curr_dim].block;
+ else {
+ /* Block values must be the same */
+ if(tmp_diminfo[curr_dim].block != high_block) {
+ space->select.sel_info.hslab->diminfo_valid = H5S_DIMINFO_VALID_NO;
+ break;
+ } /* end if */
+
+ /* XOR - overlap creates 2 blocks */
+ tmp_diminfo[curr_dim].stride = high_block;
+ tmp_diminfo[curr_dim].count = 2;
+ tmp_diminfo[curr_dim].block = high_start - tmp_diminfo[curr_dim].start;
+ } /* end else */
+ } /* end if */
+ else if((tmp_diminfo[curr_dim].start + tmp_diminfo[curr_dim].block)
+ == high_start)
+ /* Blocks border, merge them */
+ tmp_diminfo[curr_dim].block += high_block;
+ else {
+ /* Distinct blocks */
+ /* Block values must be the same */
+ if(tmp_diminfo[curr_dim].block != high_block) {
+ space->select.sel_info.hslab->diminfo_valid = H5S_DIMINFO_VALID_NO;
+ break;
+ } /* end if */
+
+ /* Create strided selection */
+ tmp_diminfo[curr_dim].stride = high_start - tmp_diminfo[curr_dim].start;
+ tmp_diminfo[curr_dim].count = 2;
+ } /* end else */
+ } /* end if */
+ else {
+ /* Check if block values are the same */
+ if(tmp_diminfo[curr_dim].block != new_hyper_diminfo[curr_dim].block) {
+ space->select.sel_info.hslab->diminfo_valid = H5S_DIMINFO_VALID_NO;
+ break;
+ } /* end if */
+
+ /* Check phase of strides */
+ if((tmp_diminfo[curr_dim].start % tmp_diminfo[curr_dim].stride)
+ != (new_hyper_diminfo[curr_dim].start % tmp_diminfo[curr_dim].stride)) {
+ space->select.sel_info.hslab->diminfo_valid = H5S_DIMINFO_VALID_NO;
+ break;
+ } /* end if */
+
+ /* Check operation type */
+ if(op == H5S_SELECT_OR) {
+ /* Make sure the slabs border or overlap */
+ if(high_start > (tmp_diminfo[curr_dim].start
+ + (tmp_diminfo[curr_dim].count
+ * tmp_diminfo[curr_dim].stride))) {
+ space->select.sel_info.hslab->diminfo_valid = H5S_DIMINFO_VALID_NO;
+ break;
+ } /* end if */
+ } /* end if */
+ else
+ /* XOR: Make sure the slabs border */
+ if(high_start != (tmp_diminfo[curr_dim].start
+ + (tmp_diminfo[curr_dim].count
+ * tmp_diminfo[curr_dim].stride))) {
+ space->select.sel_info.hslab->diminfo_valid = H5S_DIMINFO_VALID_NO;
+ break;
+ } /* end if */
+
+ /* Set count for combined selection */
+ tmp_diminfo[curr_dim].count = ((high_start
+ - tmp_diminfo[curr_dim].start)
+ / tmp_diminfo[curr_dim].stride) + high_count;
+ } /* end else */
+
+ /* Indicate that we found a nonidentical dim */
+ found_nonidentical_dim = TRUE;
+ } /* end if */
+ } /* end for */
+
+ /* Check if we succeeded, if so, set the new diminfo values */
+ if(space->select.sel_info.hslab->diminfo_valid == H5S_DIMINFO_VALID_YES)
+ for(curr_dim = 0; curr_dim < space->extent.rank; curr_dim++) {
+ hsize_t tmp_high_bound;
+
+ /* Set the new diminfo values */
+ space->select.sel_info.hslab->diminfo.app[curr_dim].start = space->select.sel_info.hslab->diminfo.opt[curr_dim].start = tmp_diminfo[curr_dim].start;
+ HDassert(tmp_diminfo[curr_dim].stride > 0);
+ space->select.sel_info.hslab->diminfo.app[curr_dim].stride = space->select.sel_info.hslab->diminfo.opt[curr_dim].stride = tmp_diminfo[curr_dim].stride;
+ HDassert(tmp_diminfo[curr_dim].count > 0);
+ space->select.sel_info.hslab->diminfo.app[curr_dim].count = space->select.sel_info.hslab->diminfo.opt[curr_dim].count = tmp_diminfo[curr_dim].count;
+ HDassert(tmp_diminfo[curr_dim].block > 0);
+ space->select.sel_info.hslab->diminfo.app[curr_dim].block = space->select.sel_info.hslab->diminfo.opt[curr_dim].block = tmp_diminfo[curr_dim].block;
+
+ /* Check for updating the low & high bounds */
+ if(tmp_diminfo[curr_dim].start < space->select.sel_info.hslab->diminfo.low_bounds[curr_dim])
+ space->select.sel_info.hslab->diminfo.low_bounds[curr_dim] = tmp_diminfo[curr_dim].start;
+ tmp_high_bound = tmp_diminfo[curr_dim].start +
+ (tmp_diminfo[curr_dim].block - 1) +
+ (tmp_diminfo[curr_dim].stride * (tmp_diminfo[curr_dim].count - 1));
+ if(tmp_high_bound > space->select.sel_info.hslab->diminfo.low_bounds[curr_dim])
+ space->select.sel_info.hslab->diminfo.high_bounds[curr_dim] = tmp_high_bound;
+ } /* end for */
+ } /* end else */
+
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5S__hyper_update_diminfo() */
+
+
+/*--------------------------------------------------------------------------
+ NAME
H5S__hyper_rebuild_helper
PURPOSE
Helper routine to rebuild optimized hyperslab information if possible.
@@ -5989,6 +8783,7 @@ done:
const H5S_hyper_span_t *span; IN: Portion of span tree to check
H5S_hyper_dim_t span_slab[]; OUT: Rebuilt section of hyperslab description
unsigned rank; IN: Current dimension to work on
+ uint64_t op_gen; IN: Operation generation
RETURNS
TRUE/FALSE for hyperslab selection rebuilt
DESCRIPTION
@@ -6003,108 +8798,85 @@ done:
KY, 2005/9/22
--------------------------------------------------------------------------*/
static hbool_t
-H5S__hyper_rebuild_helper(const H5S_hyper_span_t *span, H5S_hyper_dim_t span_slab_info[],
- unsigned rank)
+H5S__hyper_rebuild_helper(const H5S_hyper_span_info_t *spans, H5S_hyper_dim_t span_slab_info[])
{
+ const H5S_hyper_span_t *span; /* Hyperslab span */
+ const H5S_hyper_span_t *prev_span; /* Previous span in list */
+ hsize_t start; /* Starting element for this dimension */
+ hsize_t stride; /* Stride for this dimension */
+ hsize_t block; /* Block size for this dimension */
+ hsize_t prev_low; /* Low bound for previous span */
+ size_t spancount; /* Number of spans encountered in this dimension */
hbool_t ret_value = TRUE; /* Return value */
FUNC_ENTER_STATIC_NOERR
- if(span) {
- const H5S_hyper_span_t *prev_span = NULL; /* Previous span in list */
- H5S_hyper_dim_t canon_down_span_slab_info[H5S_MAX_RANK];
- hsize_t curr_stride;
- hsize_t curr_block;
- hsize_t curr_start;
- hsize_t curr_low;
- size_t outcount; /* Number of spans encountered in this dimension */
-
- /* Initialization */
- curr_stride = 1;
- curr_low = 0;
- outcount = 0;
-
- /* Get "canonical" down span information */
- if(span->down) {
- HDassert(span->down->head);
-
- /* Go to the next down span and check whether the selection can be rebuilt */
- if(!H5S__hyper_rebuild_helper(span->down->head, span_slab_info, rank - 1))
- HGOTO_DONE(FALSE)
-
- HDmemcpy(canon_down_span_slab_info, span_slab_info, sizeof(H5S_hyper_dim_t) * rank);
- } /* end if */
+ /* Sanity check */
+ HDassert(spans);
- /* Assign the initial starting point & block size */
- curr_start = span->low;
- curr_block = (span->high - span->low) + 1;
+ /* Initialization */
+ span = spans->head;
+ stride = 1;
+ prev_low = 0;
+ spancount = 0;
- /* Loop the spans */
- while(span) {
- if(outcount > 0) {
- hsize_t next_stride; /* Stride from previous span */
- hsize_t next_block; /* Block size of current span */
+ /* Get "canonical" down span information */
+ if(span->down)
+ /* Go to the next down span and check whether the selection can be rebuilt */
+ if(!H5S__hyper_rebuild_helper(span->down, &span_slab_info[1]))
+ HGOTO_DONE(FALSE)
- /* Check that down spans match current slab info */
- /* (Can skip check if previous span's down pointer is same as current one) */
- if(span->down && (NULL == prev_span || prev_span->down != span->down)) {
- H5S_hyper_dim_t *curr_down_span_slab_info;
- unsigned u; /* Local index variable */
+ /* Assign the initial starting point & block size for this dimension */
+ start = span->low;
+ block = (span->high - span->low) + 1;
- HDassert(span->down->head);
+ /* Loop the spans */
+ prev_span = NULL;
+ while(span) {
+ if(spancount > 0) {
+ hsize_t curr_stride; /* Current stride from previous span */
+ hsize_t curr_block; /* Block size of current span */
- /* Go to the next down span and check whether the selection can be rebuilt.*/
- if(!H5S__hyper_rebuild_helper(span->down->head, span_slab_info, rank - 1))
- HGOTO_DONE(FALSE)
+ /* Sanity check */
+ HDassert(prev_span);
- /* Compare the slab information of the adjacent spans in the down span tree.
- We have to compare all the sub-tree slab information with the canon_down_span_slab_info.*/
- for(u = 0; u < rank - 1; u++) {
- curr_down_span_slab_info = &span_slab_info[u];
-
- if(curr_down_span_slab_info->count > 0 && canon_down_span_slab_info[u].count > 0) {
- if(curr_down_span_slab_info->start != canon_down_span_slab_info[u].start
- || curr_down_span_slab_info->stride != canon_down_span_slab_info[u].stride
- || curr_down_span_slab_info->block != canon_down_span_slab_info[u].block
- || curr_down_span_slab_info->count != canon_down_span_slab_info[u].count)
- HGOTO_DONE(FALSE)
- } /* end if */
- else if(!((curr_down_span_slab_info->count == 0) && (canon_down_span_slab_info[u].count == 0)))
- HGOTO_DONE(FALSE)
- } /* end for */
- } /* end if */
+ /* Check that down spans match current slab info */
+ /* (Can skip check if previous span's down pointer is same as current one) */
+ if(span->down && prev_span->down != span->down)
+ if(!H5S__hyper_cmp_spans(span->down, prev_span->down))
+ HGOTO_DONE(FALSE)
- /* Obtain values for stride and block */
- next_stride = span->low - curr_low;
- next_block = (span->high - span->low) + 1;
+ /* Obtain values for stride and block */
+ curr_stride = span->low - prev_low;
+ curr_block = (span->high - span->low) + 1;
- /* Compare stride and block in this span, to compare stride,
- * three spans are needed. Account for the first two spans.
- */
- if(next_block != curr_block)
- HGOTO_DONE(FALSE)
- if(outcount > 1 && curr_stride != next_stride)
+ /* Compare stride and block for this span. To compare stride,
+ * three spans are needed. Account for the first two spans.
+ */
+ if(curr_block != block)
+ HGOTO_DONE(FALSE)
+ if(spancount > 1) {
+ if(stride != curr_stride)
HGOTO_DONE(FALSE)
-
- /* Keep the isolated stride to be 1 */
- curr_stride = next_stride;
} /* end if */
+ else
+ stride = curr_stride;
+ } /* end if */
- /* Keep current starting point */
- curr_low = span->low;
+ /* Keep current starting point */
+ prev_low = span->low;
- /* Advance to next span */
- prev_span = span;
- span = span->next;
- outcount++;
- } /* end while */
+ /* Advance to next span */
+ prev_span = span;
+ span = span->next;
+ spancount++;
+ } /* end while */
- /* Save the span information. */
- span_slab_info[rank - 1].start = curr_start;
- span_slab_info[rank - 1].count = outcount;
- span_slab_info[rank - 1].block = curr_block;
- span_slab_info[rank - 1].stride = curr_stride;
- } /* end if */
+ /* Save the span information. */
+ span_slab_info[0].start = start;
+ span_slab_info[0].count = spancount;
+ span_slab_info[0].block = block;
+ span_slab_info[0].stride = stride;
done:
FUNC_LEAVE_NOAPI(ret_value)
@@ -6118,65 +8890,46 @@ done:
Rebuild optimized hyperslab information if possible.
(It can be recovered with regular selection)
USAGE
- hbool_t H5S__hyper_rebuild(space)
- const H5S_t *space; IN: Dataspace to check
+ void H5S__hyper_rebuild(space)
+ H5S_t *space; IN: Dataspace to check
RETURNS
- TRUE/FALSE for hyperslab selection rebuilt
+ None
DESCRIPTION
- Examine the span tree for a hyperslab selection and rebuild
- the start/stride/count/block information for the selection, if possible.
+ Examine the span tree for a hyperslab selection and rebuild a regular
+ start/stride/count/block hyperslab selection, if possible.
GLOBAL VARIABLES
COMMENTS, BUGS, ASSUMPTIONS
To be able to recover the optimized information, the span tree must conform
to span tree able to be generated from a single H5S_SELECT_SET operation.
EXAMPLES
REVISION LOG
- This routine is the optimization of the old version. The previous version
- can only detect a singluar selection. This version is general enough to
- detect any regular selection.
- KY, 2005/9/22
--------------------------------------------------------------------------*/
-static hbool_t
+void
H5S__hyper_rebuild(H5S_t *space)
{
- H5S_hyper_dim_t top_span_slab_info[H5O_LAYOUT_NDIMS];
- unsigned rank, curr_dim;
- hbool_t ret_value = TRUE; /* Return value */
+ H5S_hyper_dim_t rebuilt_slab_info[H5S_MAX_RANK];
- FUNC_ENTER_STATIC_NOERR
+ FUNC_ENTER_PACKAGE_NOERR
/* Check args */
HDassert(space);
HDassert(space->select.sel_info.hslab->span_lst);
- /* Check the rank of space */
- rank = space->extent.rank;
-
- /* Check whether the slab can be rebuilt. Only regular selection can be rebuilt. If yes, fill in correct values.*/
- if(!H5S__hyper_rebuild_helper(space->select.sel_info.hslab->span_lst->head, top_span_slab_info, rank)) {
- HGOTO_DONE(FALSE)
- } /* end if */
+ /* Check whether the slab can be rebuilt */
+ /* (Only regular selection can be rebuilt. If yes, fill in correct values) */
+ if(FALSE == H5S__hyper_rebuild_helper(space->select.sel_info.hslab->span_lst, rebuilt_slab_info))
+ space->select.sel_info.hslab->diminfo_valid = H5S_DIMINFO_VALID_IMPOSSIBLE;
else {
- H5S_hyper_dim_t *diminfo;
- H5S_hyper_dim_t *app_diminfo;
-
- diminfo = space->select.sel_info.hslab->opt_diminfo;
- app_diminfo = space->select.sel_info.hslab->app_diminfo;
-
- for(curr_dim = 0; curr_dim < rank; curr_dim++) {
+ /* Set the dimension info & bounds for the dataspace, from the rebuilt info */
+ H5MM_memcpy(space->select.sel_info.hslab->diminfo.app, rebuilt_slab_info, sizeof(rebuilt_slab_info));
+ H5MM_memcpy(space->select.sel_info.hslab->diminfo.opt, rebuilt_slab_info, sizeof(rebuilt_slab_info));
+ H5MM_memcpy(space->select.sel_info.hslab->diminfo.low_bounds, space->select.sel_info.hslab->span_lst->low_bounds, sizeof(hsize_t) * space->extent.rank);
+ H5MM_memcpy(space->select.sel_info.hslab->diminfo.high_bounds, space->select.sel_info.hslab->span_lst->high_bounds, sizeof(hsize_t) * space->extent.rank);
- app_diminfo[(rank - curr_dim) - 1].start = diminfo[(rank - curr_dim) - 1].start = top_span_slab_info[curr_dim].start;
- app_diminfo[(rank - curr_dim) - 1].stride = diminfo[(rank - curr_dim) - 1].stride = top_span_slab_info[curr_dim].stride;
- app_diminfo[(rank - curr_dim) - 1].count = diminfo[(rank - curr_dim) - 1].count = top_span_slab_info[curr_dim].count;
- app_diminfo[(rank - curr_dim) - 1].block = diminfo[(rank - curr_dim) - 1].block = top_span_slab_info[curr_dim].block;
-
- } /* end for */
-
- space->select.sel_info.hslab->diminfo_valid = TRUE;
+ space->select.sel_info.hslab->diminfo_valid = H5S_DIMINFO_VALID_YES;
} /* end else */
-done:
- FUNC_LEAVE_NOAPI(ret_value)
+ FUNC_LEAVE_NOAPI_VOID
} /* end H5S__hyper_rebuild() */
@@ -6201,12 +8954,12 @@ done:
static herr_t
H5S__hyper_generate_spans(H5S_t *space)
{
- hsize_t tmp_start[H5O_LAYOUT_NDIMS]; /* Temporary start information */
- hsize_t tmp_stride[H5O_LAYOUT_NDIMS]; /* Temporary stride information */
- hsize_t tmp_count[H5O_LAYOUT_NDIMS]; /* Temporary count information */
- hsize_t tmp_block[H5O_LAYOUT_NDIMS]; /* Temporary block information */
- unsigned u; /* Local index variable */
- herr_t ret_value = SUCCEED; /* Return value */
+ hsize_t tmp_start[H5S_MAX_RANK]; /* Temporary start information */
+ hsize_t tmp_stride[H5S_MAX_RANK]; /* Temporary stride information */
+ hsize_t tmp_count[H5S_MAX_RANK]; /* Temporary count information */
+ hsize_t tmp_block[H5S_MAX_RANK]; /* Temporary block information */
+ unsigned u; /* Local index variable */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_STATIC
@@ -6219,15 +8972,15 @@ H5S__hyper_generate_spans(H5S_t *space)
/* These should be able to be converted to assertions once everything
* that calls this function checks for unlimited selections first
* (especially the new hyperslab API) -NAF */
- if(space->select.sel_info.hslab->opt_diminfo[u].count == H5S_UNLIMITED)
+ if(space->select.sel_info.hslab->diminfo.opt[u].count == H5S_UNLIMITED)
HGOTO_ERROR(H5E_DATASPACE, H5E_UNSUPPORTED, FAIL, "can't generate spans with unlimited count")
- if(space->select.sel_info.hslab->opt_diminfo[u].block == H5S_UNLIMITED)
+ if(space->select.sel_info.hslab->diminfo.opt[u].block == H5S_UNLIMITED)
HGOTO_ERROR(H5E_DATASPACE, H5E_UNSUPPORTED, FAIL, "can't generate spans with unlimited block")
- tmp_start[u]=space->select.sel_info.hslab->opt_diminfo[u].start;
- tmp_stride[u]=space->select.sel_info.hslab->opt_diminfo[u].stride;
- tmp_count[u]=space->select.sel_info.hslab->opt_diminfo[u].count;
- tmp_block[u]=space->select.sel_info.hslab->opt_diminfo[u].block;
+ tmp_start[u] = space->select.sel_info.hslab->diminfo.opt[u].start;
+ tmp_stride[u] = space->select.sel_info.hslab->diminfo.opt[u].stride;
+ tmp_count[u] = space->select.sel_info.hslab->diminfo.opt[u].count;
+ tmp_block[u] = space->select.sel_info.hslab->diminfo.opt[u].block;
} /* end for */
/* Build the hyperslab information also */
@@ -6238,7 +8991,386 @@ done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5S__hyper_generate_spans() */
-#ifndef NEW_HYPERSLAB_API
+
+/*--------------------------------------------------------------------------
+ NAME
+ H5S__check_spans_overlap
+ PURPOSE
+ Check if two selections' bounds overlap.
+ USAGE
+ hbool_t H5S__check_spans_overlap(spans1, spans2)
+ const H5S_hyper_span_info_t *spans1; IN: Second span list
+ const H5S_hyper_span_info_t *spans2; IN: Second span list
+ RETURNS
+ TRUE for overlap, FALSE for no overlap
+ PROGRAMMER
+ Quincey Koziol - January 24, 2019
+ GLOBAL VARIABLES
+ COMMENTS, BUGS, ASSUMPTIONS
+ EXAMPLES
+ REVISION LOG
+--------------------------------------------------------------------------*/
+static H5_ATTR_PURE hbool_t
+H5S__check_spans_overlap(const H5S_hyper_span_info_t *spans1,
+ const H5S_hyper_span_info_t *spans2)
+{
+ hbool_t ret_value = FALSE; /* Return value */
+
+ FUNC_ENTER_STATIC_NOERR
+
+ /* Sanity checks */
+ HDassert(spans1);
+ HDassert(spans2);
+
+ /* Use low & high bounds to try to avoid spinning through the span lists */
+ if(H5S_RANGE_OVERLAP(spans1->low_bounds[0], spans1->high_bounds[0],
+ spans2->low_bounds[0], spans2->high_bounds[0])) {
+ H5S_hyper_span_t *span1, *span2; /* Hyperslab spans */
+
+ /* Walk over spans, comparing them for overlap */
+ span1 = spans1->head;
+ span2 = spans2->head;
+ while(span1 && span2) {
+ /* Check current two spans for overlap */
+ if(H5S_RANGE_OVERLAP(span1->low, span1->high, span2->low, span2->high)) {
+ /* Check for spans in lowest dimension already */
+ if(span1->down) {
+ /* Sanity check */
+ HDassert(span2->down);
+
+ /* Check lower dimensions for overlap */
+ if(H5S__check_spans_overlap(span1->down, span2->down))
+ HGOTO_DONE(TRUE);
+ } /* end if */
+ else
+ HGOTO_DONE(TRUE);
+ } /* end if */
+
+ /* Advance one of the spans */
+ if(span1->high <= span2->high) {
+ /* Advance span1, unless it would be off the list and span2 has more nodes */
+ if(NULL == span1->next && NULL != span2->next)
+ span2 = span2->next;
+ else
+ span1 = span1->next;
+ } /* end if */
+ else {
+ /* Advance span2, unless it would be off the list and span1 has more nodes */
+ if(NULL == span2->next && NULL != span1->next)
+ span1 = span1->next;
+ else
+ span2 = span2->next;
+ } /* end else */
+ } /* end while */
+
+ /* Make certain we've exhausted our comparisons */
+ HDassert((NULL == span1 && (NULL != span2 && NULL == span2->next)) ||
+ ((NULL != span1 && NULL == span1->next) && NULL == span2));
+ } /* end of */
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5S__check_spans_overlap() */
+
+
+/*--------------------------------------------------------------------------
+ NAME
+ H5S__fill_in_new_space
+ PURPOSE
+ Combine two span lists, one from an existing dataspace and the
+ other from input arguments, into a new selection depending on the
+ selection operator. The new selection is put into a resulting dataspace
+ which could be allocated inside the function.
+ USAGE
+ herr_t H5S__fill_in_new_space(space1, op, space2_span_lst, can_own_span2,
+ span2_owned, result)
+ H5S_t *space1; IN: Dataspace containing the first span list
+ H5S_seloper_t op; IN: Selection operation
+ H5S_hyper_span_info_t *space2_span_lst; IN: Second span list
+ hbool_t can_own_span2; IN: Indicates whether the 2nd span list could be
+ owned by the result. If not, the 2nd span list
+ has to be copied.
+ hbool_t *span2_owned; OUT: Indicates if the 2nd span list is actually owned
+ H5S_t **result; OUT: The dataspace containing the the new selection. It
+ could be same with the 1st dataspace.
+ RETURNS
+ Non-negative on success, negative on failure
+ PROGRAMMER
+ Chao Mei July 8, 2011
+ GLOBAL VARIABLES
+ COMMENTS, BUGS, ASSUMPTIONS
+ EXAMPLES
+ REVISION LOG
+--------------------------------------------------------------------------*/
+static herr_t
+H5S__fill_in_new_space(H5S_t *space1, H5S_seloper_t op,
+ H5S_hyper_span_info_t *space2_span_lst, hbool_t can_own_span2,
+ hbool_t *span2_owned, hbool_t *updated_spans, H5S_t **result)
+{
+ H5S_hyper_span_info_t *a_not_b = NULL; /* Span tree for hyperslab spans in old span tree and not in new span tree */
+ H5S_hyper_span_info_t *a_and_b = NULL; /* Span tree for hyperslab spans in both old and new span trees */
+ H5S_hyper_span_info_t *b_not_a = NULL; /* Span tree for hyperslab spans in new span tree and not in old span tree */
+ hbool_t overlapped = FALSE; /* Whether selections overlap */
+ hbool_t is_result_new = FALSE;
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_STATIC
+
+ HDassert(space1);
+ HDassert(space2_span_lst);
+ HDassert(op >= H5S_SELECT_OR && op <= H5S_SELECT_NOTA);
+ /* The result is either a to-be-created space or an empty one */
+ HDassert(*result == NULL || *result == space1);
+ HDassert(space1->select.sel_info.hslab->span_lst);
+ HDassert(span2_owned);
+
+ /* Reset flags to return */
+ *span2_owned = FALSE;
+ *updated_spans = FALSE;
+
+ /* The result shares the same info from space1 */
+ if(*result == NULL) {
+ if(NULL == ((*result) = H5S_copy(space1, TRUE, TRUE)))
+ HGOTO_ERROR(H5E_DATASPACE, H5E_CANTINIT, FAIL, "unable to copy dataspace")
+ space1->select.sel_info.hslab->span_lst->count--;
+ (*result)->select.sel_info.hslab->span_lst = NULL;
+ is_result_new = TRUE;
+ } /* end if */
+
+ /* Check both spaces to see if they overlap */
+ overlapped = H5S__check_spans_overlap(space1->select.sel_info.hslab->span_lst, space2_span_lst);
+
+ if(!overlapped) {
+ switch(op) {
+ case H5S_SELECT_OR:
+ case H5S_SELECT_XOR:
+ /* Add the new disjoint spans to the space */
+ /* Copy of space1's spans to *result, and another copy of space2's spans */
+ if(is_result_new)
+ (*result)->select.sel_info.hslab->span_lst = H5S__hyper_copy_span(space1->select.sel_info.hslab->span_lst, space1->extent.rank);
+ if(!can_own_span2) {
+ b_not_a = H5S__hyper_copy_span(space2_span_lst, space1->extent.rank);
+ if(H5S__hyper_add_disjoint_spans(*result, b_not_a) < 0)
+ HGOTO_ERROR(H5E_DATASPACE, H5E_CANTINSERT, FAIL, "can't append hyperslabs")
+
+ /* The new_spans are now owned by 'space', so they should not be released */
+ b_not_a = NULL;
+ } /* end if */
+ else {
+ if(H5S__hyper_add_disjoint_spans(*result, space2_span_lst) < 0)
+ HGOTO_ERROR(H5E_DATASPACE, H5E_CANTINSERT, FAIL, "can't append hyperslabs")
+ *span2_owned = TRUE;
+ } /* end else */
+
+ /* Indicate that the spans changed */
+ *updated_spans = TRUE;
+ break;
+
+ case H5S_SELECT_AND:
+ /* Convert *result to "none" selection */
+ if(H5S_select_none(*result) < 0)
+ HGOTO_ERROR(H5E_DATASPACE, H5E_CANTSELECT, FAIL, "can't convert selection")
+ HGOTO_DONE(SUCCEED);
+
+ case H5S_SELECT_NOTB:
+ /* Copy space1's spans to *result */
+ if(is_result_new)
+ (*result)->select.sel_info.hslab->span_lst = H5S__hyper_copy_span(space1->select.sel_info.hslab->span_lst, space1->extent.rank);
+
+ /* Indicate that the spans changed */
+ *updated_spans = TRUE;
+ break;
+
+ case H5S_SELECT_NOTA:
+ if(!is_result_new) {
+ HDassert(space1 == *result);
+
+ /* Free the current selection */
+ H5S__hyper_free_span_info(space1->select.sel_info.hslab->span_lst);
+ space1->select.sel_info.hslab->span_lst = NULL;
+ } /* end if */
+
+ /* Copy space2's spans to *result */
+ if(!can_own_span2)
+ (*result)->select.sel_info.hslab->span_lst = H5S__hyper_copy_span(space2_span_lst, space1->extent.rank);
+ else {
+ (*result)->select.sel_info.hslab->span_lst = space2_span_lst;
+ *span2_owned = TRUE;
+ } /* end else */
+
+ /* Reset the number of items in selection */
+ (*result)->select.num_elem = H5S__hyper_spans_nelem(space2_span_lst);
+
+ /* Indicate that the spans changed */
+ *updated_spans = TRUE;
+ break;
+
+ case H5S_SELECT_NOOP:
+ case H5S_SELECT_SET:
+ case H5S_SELECT_APPEND:
+ case H5S_SELECT_PREPEND:
+ case H5S_SELECT_INVALID:
+ default:
+ HGOTO_ERROR(H5E_ARGS, H5E_UNSUPPORTED, FAIL, "invalid selection operation")
+ } /* end switch */
+ } /* end if */
+ else {
+ unsigned selector = 0; /* Select which clipping spans to generate */
+
+ /* Generate mask for clip operation depending on the op */
+ switch(op) {
+ case H5S_SELECT_OR: /* a + b_not_a */
+ selector = H5S_HYPER_COMPUTE_B_NOT_A;
+ break;
+
+ case H5S_SELECT_XOR: /* a_not_b + b_not_a */
+ selector = H5S_HYPER_COMPUTE_A_NOT_B | H5S_HYPER_COMPUTE_B_NOT_A;
+ break;
+
+ case H5S_SELECT_AND: /* a_and_b */
+ selector = H5S_HYPER_COMPUTE_A_AND_B;
+ break;
+
+ case H5S_SELECT_NOTB: /* a_not_b */
+ selector = H5S_HYPER_COMPUTE_A_NOT_B;
+ break;
+
+ case H5S_SELECT_NOTA: /* b_not_a */
+ selector = H5S_HYPER_COMPUTE_B_NOT_A;
+ break;
+
+ case H5S_SELECT_NOOP:
+ case H5S_SELECT_SET:
+ case H5S_SELECT_APPEND:
+ case H5S_SELECT_PREPEND:
+ case H5S_SELECT_INVALID:
+ default:
+ HGOTO_ERROR(H5E_ARGS, H5E_UNSUPPORTED, FAIL, "invalid selection operation")
+ } /* end switch */
+
+ /* Generate lists of spans which overlap and don't overlap */
+ if(H5S__hyper_clip_spans(space1->select.sel_info.hslab->span_lst,
+ space2_span_lst, selector, space1->extent.rank,
+ &a_not_b, &a_and_b, &b_not_a) < 0)
+ HGOTO_ERROR(H5E_DATASPACE, H5E_CANTCLIP, FAIL, "can't clip hyperslab information")
+ switch(op) {
+ case H5S_SELECT_OR:
+ if(is_result_new)
+ (*result)->select.sel_info.hslab->span_lst = H5S__hyper_copy_span(space1->select.sel_info.hslab->span_lst, space1->extent.rank);
+ break;
+
+ case H5S_SELECT_AND:
+ case H5S_SELECT_XOR:
+ case H5S_SELECT_NOTB:
+ case H5S_SELECT_NOTA:
+ if(!is_result_new) {
+ HDassert(space1 == *result);
+
+ /* Free the current selection */
+ H5S__hyper_free_span_info(space1->select.sel_info.hslab->span_lst);
+ space1->select.sel_info.hslab->span_lst = NULL;
+ } /* end if */
+
+ /* Reset the number of items in selection */
+ /* (Will be set below) */
+ (*result)->select.num_elem = 0;
+ break;
+
+ case H5S_SELECT_NOOP:
+ case H5S_SELECT_SET:
+ case H5S_SELECT_APPEND:
+ case H5S_SELECT_PREPEND:
+ case H5S_SELECT_INVALID:
+ default:
+ HGOTO_ERROR(H5E_ARGS, H5E_UNSUPPORTED, FAIL, "invalid selection operation")
+ } /* end switch */
+
+ /* Check if there are any non-overlapped selections */
+ if(a_not_b) {
+ /* Other than OR, the span_lst is set to NULL. And in OR,
+ * a_not_b is not needed
+ */
+ HDassert(NULL == (*result)->select.sel_info.hslab->span_lst);
+
+ /* The results dataspace takes ownership of the spans */
+ /* (Since it must be NULL) */
+ (*result)->select.sel_info.hslab->span_lst = a_not_b;
+
+ /* Update the number of elements in current selection */
+ (*result)->select.num_elem = H5S__hyper_spans_nelem(a_not_b);
+
+ /* Indicate that the spans were updated */
+ *updated_spans = TRUE;
+
+ /* Indicate that the a_not_b spans are owned */
+ a_not_b = NULL;
+ } /* end if */
+
+ if(a_and_b) {
+ /**
+ * 1. Other than OR, the span_lst is set to NULL. And in OR,
+ * a_and_b is not needed
+ * 2. a_not_b will never be computed together with a_and_b
+ * because merging these two equals to a.
+ */
+ HDassert(NULL == (*result)->select.sel_info.hslab->span_lst);
+
+ /* The results dataspace takes ownership of the spans */
+ /* (Since it must be NULL) */
+ (*result)->select.sel_info.hslab->span_lst = a_and_b;
+
+ /* Update the number of elements in current selection */
+ (*result)->select.num_elem = H5S__hyper_spans_nelem(a_and_b);
+
+ /* Indicate that the spans were updated */
+ *updated_spans = TRUE;
+
+ /* Indicate that the a_and_b spans are owned */
+ a_and_b = NULL;
+ } /* end if */
+
+ if(b_not_a) {
+ /* Merge the b_not_a spans into the result dataspace */
+ if(H5S__hyper_merge_spans(*result, b_not_a) < 0)
+ HGOTO_ERROR(H5E_DATASPACE, H5E_CANTINSERT, FAIL, "can't insert hyperslabs")
+
+ /* Update the number of elements in current selection */
+ (*result)->select.num_elem += H5S__hyper_spans_nelem(b_not_a);
+
+ /* Indicate that the spans were updated */
+ *updated_spans = TRUE;
+ } /* end if */
+ } /* end else for the case the new span overlaps with the old (i.e. space) */
+
+ /* Check if the spans weren't updated, and reset selection if so */
+ if(!*updated_spans) {
+ /* If updated_spans remains FALSE as in this branch, it means the
+ * result has been cleared in XOR / AND / NOTB / NOTA cases, and the
+ * result is a copy of the dataspace in the OR case.
+ *
+ * If two dataspaces have generated any of the three clipped
+ * span trees (i.e. a_not_b, a_and_b, and b_not_a), the
+ * updated_spans must be TRUE.
+ */
+ if(H5S_SELECT_OR != op) {
+ /* Convert *result to "none" selection */
+ if(H5S_select_none(*result) < 0)
+ HGOTO_ERROR(H5E_DATASPACE, H5E_CANTSELECT, FAIL, "can't convert selection")
+ } /* end else */
+ } /* end if */
+
+done:
+ /* Free resources */
+ if(a_not_b)
+ H5S__hyper_free_span_info(a_not_b);
+ if(a_and_b)
+ H5S__hyper_free_span_info(a_and_b);
+ if(b_not_a)
+ H5S__hyper_free_span_info(b_not_a);
+
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5S__fill_in_new_space() */
+
/*-------------------------------------------------------------------------
* Function: H5S__generate_hyperlab
@@ -6247,24 +9379,16 @@ done:
*
* Return: Non-negative on success/Negative on failure
*
- * Programmer: Quincey Koziol (split from HS_select_hyperslab()).
+ * Programmer: Quincey Koziol
* Tuesday, September 12, 2000
*
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
static herr_t
-H5S__generate_hyperslab (H5S_t *space, H5S_seloper_t op,
- const hsize_t start[],
- const hsize_t stride[],
- const hsize_t count[],
- const hsize_t block[])
+H5S__generate_hyperslab(H5S_t *space, H5S_seloper_t op, const hsize_t start[],
+ const hsize_t stride[], const hsize_t count[], const hsize_t block[])
{
- H5S_hyper_span_info_t *new_spans=NULL; /* Span tree for new hyperslab */
- H5S_hyper_span_info_t *a_not_b = NULL; /* Span tree for hyperslab spans in old span tree and not in new span tree */
- H5S_hyper_span_info_t *a_and_b = NULL; /* Span tree for hyperslab spans in both old and new span trees */
- H5S_hyper_span_info_t *b_not_a = NULL; /* Span tree for hyperslab spans in new span tree and not in old span tree */
+ H5S_hyper_span_info_t *new_spans = NULL; /* Span tree for new hyperslab */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_STATIC
@@ -6282,206 +9406,390 @@ H5S__generate_hyperslab (H5S_t *space, H5S_seloper_t op,
HGOTO_ERROR(H5E_DATASPACE, H5E_CANTINSERT, FAIL, "can't create hyperslab information")
/* Generate list of blocks to add/remove based on selection operation */
- if(op==H5S_SELECT_SET) {
- /* Add new spans to current selection */
- if(H5S__hyper_merge_spans(space,new_spans,TRUE)<0)
- HGOTO_ERROR(H5E_DATASPACE, H5E_CANTINSERT, FAIL, "can't insert hyperslabs")
+ if(op == H5S_SELECT_SET) {
+ /* Free current selection */
+ if(NULL != space->select.sel_info.hslab->span_lst)
+ H5S__hyper_free_span_info(space->select.sel_info.hslab->span_lst);
+
+ /* Set the hyperslab selection to the new span tree */
+ space->select.sel_info.hslab->span_lst = new_spans;
/* Set the number of elements in current selection */
space->select.num_elem = H5S__hyper_spans_nelem(new_spans);
/* Indicate that the new_spans are owned */
- new_spans=NULL;
+ new_spans = NULL;
} /* end if */
else {
- hbool_t updated_spans = FALSE; /* Whether the spans in the selection were modified */
+ hbool_t new_spans_owned = FALSE;
+ hbool_t updated_spans = FALSE;
- /* Generate lists of spans which overlap and don't overlap */
- if(H5S__hyper_clip_spans(space->select.sel_info.hslab->span_lst,new_spans,&a_not_b,&a_and_b,&b_not_a)<0)
- HGOTO_ERROR(H5E_DATASPACE, H5E_CANTCLIP, FAIL, "can't clip hyperslab information")
+ /* Generate new spans for space */
+ if(H5S__fill_in_new_space(space, op, new_spans, TRUE, &new_spans_owned, &updated_spans, &space) < 0)
+ HGOTO_ERROR(H5E_DATASPACE, H5E_CANTSELECT, FAIL, "can't generate the specified hyperslab")
- switch(op) {
- case H5S_SELECT_OR:
- /* Add any new spans from b_not_a to current selection */
- if(b_not_a!=NULL) {
- if(H5S__hyper_merge_spans(space,b_not_a,FALSE)<0)
- HGOTO_ERROR(H5E_DATASPACE, H5E_CANTINSERT, FAIL, "can't insert hyperslabs")
+ /* Check if the spans were updated by H5S__fill_in_new_space */
+ if(updated_spans) {
+ H5S_hyper_dim_t new_hyper_diminfo[H5S_MAX_RANK];
+ unsigned u; /* Local index variable */
- /* Update the number of elements in current selection */
- space->select.num_elem += H5S__hyper_spans_nelem(b_not_a);
+ /* Sanity check */
+ HDassert(space->select.sel_info.hslab->span_lst->head);
+
+ /* Build diminfo struct */
+ for(u = 0; u <space->extent.rank; u++) {
+ new_hyper_diminfo[u].start = start[u];
+ new_hyper_diminfo[u].stride = stride[u];
+ new_hyper_diminfo[u].count = count[u];
+ new_hyper_diminfo[u].block = block[u];
+ } /* end for */
- /* Indicate that the spans were updated */
- updated_spans = TRUE;
- } /* end if */
- break;
+ /* Update space's dim info */
+ if(H5S__hyper_update_diminfo(space, op, new_hyper_diminfo) < 0)
+ HGOTO_ERROR(H5E_DATASPACE, H5E_CANTCOUNT, FAIL, "can't update hyperslab info")
+ } /* end if */
- case H5S_SELECT_AND:
- /* Free the current selection */
- if(H5S__hyper_free_span_info(space->select.sel_info.hslab->span_lst)<0)
- HGOTO_ERROR(H5E_INTERNAL, H5E_CANTFREE, FAIL, "failed to release hyperslab spans")
- space->select.sel_info.hslab->span_lst=NULL;
+ /* Indicate that the new_spans are owned, there's no need to free */
+ if(new_spans_owned)
+ new_spans = NULL;
+ } /* end else */
- /* Reset the number of items in selection */
- space->select.num_elem=0;
+done:
+ if(new_spans)
+ H5S__hyper_free_span_info(new_spans);
- /* Check if there are any overlapped selections */
- if(a_and_b!=NULL) {
- if(H5S__hyper_merge_spans(space,a_and_b,TRUE)<0)
- HGOTO_ERROR(H5E_DATASPACE, H5E_CANTINSERT, FAIL, "can't insert hyperslabs")
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5S__generate_hyperslab() */
- /* Update the number of elements in current selection */
- space->select.num_elem = H5S__hyper_spans_nelem(a_and_b);
+
+/*-------------------------------------------------------------------------
+ * Function: H5S__set_regular_hyperslab
+ *
+ * Purpose: Set a regular hyperslab
+ *
+ * Return: Non-negative on success/Negative on failure
+ *
+ * Programmer: Quincey Koziol
+ * Thursday, October 2, 2014
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5S__set_regular_hyperslab(H5S_t *space, const hsize_t start[],
+ const hsize_t *app_stride, const hsize_t app_count[], const hsize_t *app_block,
+ const hsize_t *opt_stride, const hsize_t opt_count[], const hsize_t *opt_block)
+{
+ unsigned u; /* Local index variable */
+ herr_t ret_value = SUCCEED; /* Return value */
- /* Indicate that the a_and_b spans are owned */
- a_and_b=NULL;
+ FUNC_ENTER_STATIC
- /* Indicate that the spans were updated */
- updated_spans = TRUE;
- } /* end if */
- break;
+ /* Check args */
+ HDassert(space);
+ HDassert(start);
+ HDassert(app_stride);
+ HDassert(app_count);
+ HDassert(app_block);
+ HDassert(opt_stride);
+ HDassert(opt_count);
+ HDassert(opt_block);
+
+ /* If we are setting a new selection, remove current selection first */
+ if(H5S_SELECT_RELEASE(space) < 0)
+ HGOTO_ERROR(H5E_DATASPACE, H5E_CANTDELETE, FAIL, "can't release selection")
- case H5S_SELECT_XOR:
- /* Free the current selection */
- if(H5S__hyper_free_span_info(space->select.sel_info.hslab->span_lst)<0)
- HGOTO_ERROR(H5E_INTERNAL, H5E_CANTFREE, FAIL, "failed to release hyperslab spans")
- space->select.sel_info.hslab->span_lst=NULL;
+ /* Allocate space for the hyperslab selection information */
+ if(NULL == (space->select.sel_info.hslab = H5FL_MALLOC(H5S_hyper_sel_t)))
+ HGOTO_ERROR(H5E_DATASPACE, H5E_CANTALLOC, FAIL, "can't allocate hyperslab info")
- /* Reset the number of items in selection */
- space->select.num_elem=0;
+ /* Set the diminfo */
+ space->select.num_elem = 1;
+ space->select.sel_info.hslab->unlim_dim = -1;
+ for(u = 0; u < space->extent.rank; u++) {
+ /* Set application and optimized hyperslab info */
+ space->select.sel_info.hslab->diminfo.app[u].start = start[u];
+ space->select.sel_info.hslab->diminfo.app[u].stride = app_stride[u];
+ space->select.sel_info.hslab->diminfo.app[u].count = app_count[u];
+ space->select.sel_info.hslab->diminfo.app[u].block = app_block[u];
+
+ space->select.sel_info.hslab->diminfo.opt[u].start = start[u];
+ space->select.sel_info.hslab->diminfo.opt[u].stride = opt_stride[u];
+ space->select.sel_info.hslab->diminfo.opt[u].count = opt_count[u];
+ space->select.sel_info.hslab->diminfo.opt[u].block = opt_block[u];
+
+ /* Update # of elements selected */
+ space->select.num_elem *= (opt_count[u] * opt_block[u]);
+
+ /* Set low bound of bounding box for the hyperslab selection */
+ space->select.sel_info.hslab->diminfo.low_bounds[u] = start[u];
+
+ /* Check for unlimited dimension & set high bound */
+ if((app_count[u] == H5S_UNLIMITED) || (app_block[u] == H5S_UNLIMITED)) {
+ space->select.sel_info.hslab->unlim_dim = (int)u;
+ space->select.sel_info.hslab->diminfo.high_bounds[u] = H5S_UNLIMITED;
+ } /* end if */
+ else
+ space->select.sel_info.hslab->diminfo.high_bounds[u] = start[u] + opt_stride[u] * (opt_count[u] - 1) + (opt_block[u] - 1);
+ } /* end for */
- /* Check if there are any non-overlapped selections */
- if(a_not_b!=NULL) {
- if(H5S__hyper_merge_spans(space,a_not_b,FALSE)<0)
- HGOTO_ERROR(H5E_DATASPACE, H5E_CANTINSERT, FAIL, "can't insert hyperslabs")
+ /* Handle unlimited selections */
+ if(space->select.sel_info.hslab->unlim_dim >= 0) {
+ /* Calculate num_elem_non_unlim */
+ space->select.sel_info.hslab->num_elem_non_unlim = (hsize_t)1;
+ for(u = 0; u < space->extent.rank; u++)
+ if((int)u != space->select.sel_info.hslab->unlim_dim)
+ space->select.sel_info.hslab->num_elem_non_unlim *= (opt_count[u] * opt_block[u]);
- /* Update the number of elements in current selection */
- space->select.num_elem = H5S__hyper_spans_nelem(a_not_b);
+ /* Update num_elem */
+ space->select.num_elem = H5S_UNLIMITED;
+ } /* end if */
- /* Indicate that the spans were updated */
- updated_spans = TRUE;
- } /* end if */
- if(b_not_a!=NULL) {
- if(H5S__hyper_merge_spans(space,b_not_a,FALSE)<0)
- HGOTO_ERROR(H5E_DATASPACE, H5E_CANTINSERT, FAIL, "can't insert hyperslabs")
+ /* Indicate that the dimension information is valid */
+ space->select.sel_info.hslab->diminfo_valid = H5S_DIMINFO_VALID_YES;
- /* Update the number of elements in current selection */
- space->select.num_elem += H5S__hyper_spans_nelem(b_not_a);
+ /* Indicate that there's no slab information */
+ space->select.sel_info.hslab->span_lst = NULL;
- /* Indicate that the spans were updated */
- updated_spans = TRUE;
- } /* end if */
- break;
+ /* Set selection type */
+ space->select.type = H5S_sel_hyper;
- case H5S_SELECT_NOTB:
- /* Free the current selection */
- if(H5S__hyper_free_span_info(space->select.sel_info.hslab->span_lst)<0)
- HGOTO_ERROR(H5E_INTERNAL, H5E_CANTFREE, FAIL, "failed to release hyperslab spans")
- space->select.sel_info.hslab->span_lst=NULL;
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5S__set_regular_hyperslab() */
- /* Reset the number of items in selection */
- space->select.num_elem=0;
+
+/*-------------------------------------------------------------------------
+ * Function: H5S__hyper_regular_and_single_block
+ *
+ * Purpose: Optimized routine to perform "AND" operation of a single
+ * block against a regular hyperslab selection.
+ *
+ * Note: This algorithm is invoked when constructing the chunk map
+ * and a regular hyperslab is selected in the file's dataspace.
+ *
+ * Return: Non-negative on success / Negative on failure
+ *
+ * Programmer: Quincey Koziol
+ * Saturday, February 9, 2019
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5S__hyper_regular_and_single_block(H5S_t *space, const hsize_t start[],
+ const hsize_t block[])
+{
+ hsize_t select_end, block_end; /* End of block & selection */
+ hbool_t single_block; /* Whether the selection is a single block */
+ hbool_t overlap; /* Whether block & selection overlap */
+ unsigned u; /* Local index variable */
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_NOAPI(FAIL)
+
+ /* Check args */
+ HDassert(space);
+ HDassert(start);
+ HDassert(block);
- /* Check if there are any non-overlapped selections */
- if(a_not_b!=NULL) {
- if(H5S__hyper_merge_spans(space,a_not_b,TRUE)<0)
- HGOTO_ERROR(H5E_DATASPACE, H5E_CANTINSERT, FAIL, "can't insert hyperslabs")
+ /* Check for single block selection in dataspace */
+ single_block = TRUE;
+ for(u = 0; u < space->extent.rank; u++)
+ if(1 != space->select.sel_info.hslab->diminfo.opt[u].count) {
+ single_block = FALSE;
+ break;
+ } /* end if */
- /* Update the number of elements in current selection */
- space->select.num_elem = H5S__hyper_spans_nelem(a_not_b);
+ /* Perform different optimizations, based on type of regular selection */
+ if(single_block) {
+ hsize_t new_start[H5S_MAX_RANK]; /* New starting coordinate */
+ hsize_t new_block[H5S_MAX_RANK]; /* New block size */
- /* Indicate that the a_not_b are owned */
- a_not_b=NULL;
+ /* Check for overlap and compute new start offset & block sizes */
+ overlap = TRUE;
+ for(u = 0; u < space->extent.rank; u++) {
+ /* Compute the end of the selection & block in this dimension */
+ select_end = space->select.sel_info.hslab->diminfo.high_bounds[u];
+ block_end = (start[u] + block[u]) - 1;
- /* Indicate that the spans were updated */
- updated_spans = TRUE;
- } /* end if */
+ /* Check for overlap */
+ if(!H5S_RANGE_OVERLAP(space->select.sel_info.hslab->diminfo.opt[u].start, select_end, start[u], block_end)) {
+ overlap = FALSE;
break;
+ } /* end if */
- case H5S_SELECT_NOTA:
- /* Free the current selection */
- if(H5S__hyper_free_span_info(space->select.sel_info.hslab->span_lst)<0)
- HGOTO_ERROR(H5E_INTERNAL, H5E_CANTFREE, FAIL, "failed to release hyperslab spans")
- space->select.sel_info.hslab->span_lst=NULL;
+ /* Set new start & block size in this dimension */
+ new_start[u] = MAX(space->select.sel_info.hslab->diminfo.opt[u].start, start[u]);
+ new_block[u] = (MIN(select_end, block_end) - new_start[u]) + 1;
+ } /* end for */
- /* Reset the number of items in selection */
- space->select.num_elem=0;
+ /* Check for overlap of selection & block */
+ if(overlap) {
+ /* Set selection to regular hyperslab */
+ if(H5S__set_regular_hyperslab(space, new_start, H5S_hyper_ones_g, H5S_hyper_ones_g, new_block,
+ H5S_hyper_ones_g, H5S_hyper_ones_g, new_block) < 0)
+ HGOTO_ERROR(H5E_DATASPACE, H5E_CANTSET, FAIL, "can't set regular hyperslab selection")
+ } /* end if */
+ else
+ /* Selection & block don't overlap, set to "none" selection */
+ if(H5S_select_none(space) < 0)
+ HGOTO_ERROR(H5E_DATASPACE, H5E_CANTSELECT, FAIL, "can't convert selection")
+ } /* end if */
+ else {
+ hsize_t new_start[H5S_MAX_RANK]; /* New start for hyperslab selection */
+ hsize_t new_count[H5S_MAX_RANK]; /* New count for hyperslab selection */
+ hsize_t stride[H5S_MAX_RANK]; /* Stride for hyperslab selection */
+ hsize_t new_block[H5S_MAX_RANK]; /* New block for hyperslab selection */
+ hbool_t partial_first_span; /* Whether first span in intersection is partial */
+ hbool_t partial_last_span; /* Whether last span in intersection is partial */
+
+ /* Iterate over selection, checking for overlap and computing first / last
+ * span that intersects with the block.
+ */
+ overlap = TRUE;
+ partial_first_span = FALSE;
+ partial_last_span = FALSE;
+ for(u = 0; u < space->extent.rank; u++) {
+ hsize_t first_span_start, first_span_end; /* Start / end of first span */
+ hsize_t last_span_start, last_span_end; /* Start / end of last span */
+ hsize_t nstride; /* Number of strides into the selection */
+
+ /* Compute the end of the selection & block in this dimension */
+ select_end = space->select.sel_info.hslab->diminfo.high_bounds[u];
+ block_end = (start[u] + block[u]) - 1;
+
+ /* Check for overlap */
+ if(!H5S_RANGE_OVERLAP(space->select.sel_info.hslab->diminfo.opt[u].start, select_end, start[u], block_end)) {
+ overlap = FALSE;
+ break;
+ } /* end if */
+
+ /* Find first span that is before or overlaps with start of block */
+ if(space->select.sel_info.hslab->diminfo.opt[u].start >= start[u]) {
+ /* Calculate start & end of first span */
+ first_span_start = space->select.sel_info.hslab->diminfo.opt[u].start;
+ first_span_end = (first_span_start +
+ space->select.sel_info.hslab->diminfo.opt[u].block) - 1;
+
+ /* Check if first span overlaps _end_ of block */
+ if(block_end >= first_span_start && block_end <= first_span_end)
+ partial_first_span = TRUE;
+ } /* end if */
+ else {
+ hsize_t adj_start; /* Start coord, adjusted for hyperslab selection parameters */
- /* Check if there are any non-overlapped selections */
- if(b_not_a!=NULL) {
- if(H5S__hyper_merge_spans(space,b_not_a,TRUE)<0)
- HGOTO_ERROR(H5E_DATASPACE, H5E_CANTINSERT, FAIL, "can't insert hyperslabs")
+ /* Adjust start coord for selection's 'start' offset */
+ adj_start = start[u] - space->select.sel_info.hslab->diminfo.opt[u].start;
- /* Update the number of elements in current selection */
- space->select.num_elem = H5S__hyper_spans_nelem(b_not_a);
+ /* Compute # of strides into the selection */
+ if(space->select.sel_info.hslab->diminfo.opt[u].count > 1)
+ nstride = adj_start / space->select.sel_info.hslab->diminfo.opt[u].stride;
+ else
+ nstride = 0;
+
+ /* Calculate start & end of first span */
+ first_span_start = space->select.sel_info.hslab->diminfo.opt[u].start +
+ (nstride * space->select.sel_info.hslab->diminfo.opt[u].stride);
+ first_span_end = (first_span_start +
+ space->select.sel_info.hslab->diminfo.opt[u].block) - 1;
- /* Indicate that the b_not_a are owned */
- b_not_a=NULL;
+ /* Check if first span overlaps start of block */
+ if(first_span_start < start[u] && first_span_end >= start[u])
+ partial_first_span = TRUE;
- /* Indicate that the spans were updated */
- updated_spans = TRUE;
+ /* Advance first span to start higher than block's start,
+ * if it's not partial.
+ */
+ if(first_span_end < start[u]) {
+ first_span_start += space->select.sel_info.hslab->diminfo.opt[u].stride;
+ first_span_end += space->select.sel_info.hslab->diminfo.opt[u].stride;
} /* end if */
- break;
+ } /* end else */
- case H5S_SELECT_NOOP:
- case H5S_SELECT_SET:
- case H5S_SELECT_APPEND:
- case H5S_SELECT_PREPEND:
- case H5S_SELECT_INVALID:
- default:
- HGOTO_ERROR(H5E_ARGS, H5E_UNSUPPORTED, FAIL, "invalid selection operation")
- } /* end switch */
+ /* Find last span that is before or overlaps with end of block */
+ if(select_end < block_end) {
+ /* Calculate start & end of last span */
+ last_span_start = (select_end -
+ space->select.sel_info.hslab->diminfo.opt[u].block) + 1;
+ last_span_end = select_end;
+
+ /* Check if last span overlaps _start_ of block */
+ if(start[u] >= last_span_start && start[u] <= last_span_end)
+ partial_last_span = TRUE;
+ } /* end if */
+ else {
+ hsize_t adj_end; /* End coord, adjusted for hyperslab selection parameters */
+
+ /* Adjust end coord for selection's 'start' offset */
+ adj_end = block_end - space->select.sel_info.hslab->diminfo.opt[u].start;
+
+ /* Compute # of strides into the selection */
+ if(space->select.sel_info.hslab->diminfo.opt[u].count > 1)
+ nstride = adj_end / space->select.sel_info.hslab->diminfo.opt[u].stride;
+ else
+ nstride = 0;
- /* Check if the resulting hyperslab span tree is empty */
- if(space->select.sel_info.hslab->span_lst==NULL) {
- H5S_hyper_span_info_t *spans; /* Empty hyperslab span tree */
+ /* Calculate start & end of last span */
+ last_span_start = space->select.sel_info.hslab->diminfo.opt[u].start +
+ (nstride * space->select.sel_info.hslab->diminfo.opt[u].stride);
+ last_span_end = (last_span_start +
+ space->select.sel_info.hslab->diminfo.opt[u].block) - 1;
+
+ /* Check if last span overlaps end of block */
+ if(block_end >= last_span_start && block_end <= last_span_end)
+ partial_last_span = TRUE;
+ } /* end else */
+
+ /* Check if no spans are inside block */
+ /* (Can happen when block falls in "gap" between spans) */
+ if(last_span_end < start[u]) {
+ overlap = FALSE;
+ break;
+ } /* end if */
/* Sanity check */
- HDassert(space->select.num_elem == 0);
+ HDassert(first_span_start <= last_span_start);
- /* Allocate a span info node */
- if((spans = H5FL_MALLOC(H5S_hyper_span_info_t))==NULL)
- HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "can't allocate hyperslab span")
+ /* Compute new start / count / block values */
+ new_start[u] = first_span_start;
+ if(last_span_start != first_span_start)
+ new_count[u] = ((last_span_start - first_span_start) /
+ space->select.sel_info.hslab->diminfo.opt[u].stride) + 1;
+ else
+ new_count[u] = 1;
+ new_block[u] = space->select.sel_info.hslab->diminfo.opt[u].block;
- /* Set the reference count */
- spans->count=1;
+ /* Keep same stride */
+ stride[u] = space->select.sel_info.hslab->diminfo.opt[u].stride;
+ } /* end for */
- /* Reset the scratch pad space */
- spans->scratch=0;
+ /* Check for overlap of selection & block */
+ if(overlap) {
+ /* Set selection to regular hyperslab */
+ if(H5S__set_regular_hyperslab(space, new_start, stride, new_count, new_block,
+ stride, new_count, new_block) < 0)
+ HGOTO_ERROR(H5E_DATASPACE, H5E_CANTSET, FAIL, "can't set regular hyperslab selection")
- /* Set to empty tree */
- spans->head=NULL;
+ /* If there's a partial first or last span, have to 'AND' against selection */
+ if(partial_first_span || partial_last_span) {
+ /* Generate span tree for regular selection */
+ if(H5S__hyper_generate_spans(space) < 0)
+ HGOTO_ERROR(H5E_DATASPACE, H5E_UNINITIALIZED, FAIL, "dataspace does not have span tree")
- /* Set pointer to empty span tree */
- space->select.sel_info.hslab->span_lst=spans;
+ /* 'AND' against block */
+ if(H5S__generate_hyperslab(space, H5S_SELECT_AND, start, H5S_hyper_ones_g, H5S_hyper_ones_g, block) < 0)
+ HGOTO_ERROR(H5E_DATASPACE, H5E_CANTINSERT, FAIL, "can't generate hyperslabs")
+ } /* end if */
} /* end if */
else {
- /* Check if we updated the spans */
- if(updated_spans) {
- /* Attempt to rebuild "optimized" start/stride/count/block information.
- * from resulting hyperslab span tree
- */
- H5S__hyper_rebuild(space);
- } /* end if */
+ /* Selection & block don't overlap, set to "none" selection */
+ if(H5S_select_none(space) < 0)
+ HGOTO_ERROR(H5E_DATASPACE, H5E_CANTSELECT, FAIL, "can't convert selection")
} /* end else */
} /* end else */
done:
- /* Free resources */
- if(a_not_b)
- if(H5S__hyper_free_span_info(a_not_b) < 0)
- HDONE_ERROR(H5E_INTERNAL, H5E_CANTFREE, FAIL, "failed to release temporary hyperslab spans")
- if(a_and_b)
- if(H5S__hyper_free_span_info(a_and_b) < 0)
- HDONE_ERROR(H5E_INTERNAL, H5E_CANTFREE, FAIL, "failed to release temporary hyperslab spans")
- if(b_not_a)
- if(H5S__hyper_free_span_info(b_not_a) < 0)
- HDONE_ERROR(H5E_INTERNAL, H5E_CANTFREE, FAIL, "failed to release temporary hyperslab spans")
- if(new_spans)
- if(H5S__hyper_free_span_info(new_spans) < 0)
- HDONE_ERROR(H5E_INTERNAL, H5E_CANTFREE, FAIL, "failed to release temporary hyperslab spans")
-
FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5S__generate_hyperslab() */
+} /* end H5S__hyper_regular_and_single_block() */
/*-------------------------------------------------------------------------
@@ -6500,9 +9808,9 @@ herr_t
H5S_select_hyperslab(H5S_t *space, H5S_seloper_t op, const hsize_t start[],
const hsize_t *stride, const hsize_t count[], const hsize_t *block)
{
- hsize_t int_stride[H5O_LAYOUT_NDIMS]; /* Internal storage for stride information */
- hsize_t int_count[H5O_LAYOUT_NDIMS]; /* Internal storage for count information */
- hsize_t int_block[H5O_LAYOUT_NDIMS]; /* Internal storage for block information */
+ hsize_t int_stride[H5S_MAX_RANK]; /* Internal storage for stride information */
+ hsize_t int_count[H5S_MAX_RANK]; /* Internal storage for count information */
+ hsize_t int_block[H5S_MAX_RANK]; /* Internal storage for block information */
const hsize_t *opt_stride; /* Optimized stride information */
const hsize_t *opt_count; /* Optimized count information */
const hsize_t *opt_block; /* Optimized block information */
@@ -6526,9 +9834,7 @@ H5S_select_hyperslab(H5S_t *space, H5S_seloper_t op, const hsize_t start[],
if(block == NULL)
block = H5S_hyper_ones_g;
- /*
- * Check new selection.
- */
+ /* Check new selection */
for(u = 0; u < space->extent.rank; u++) {
/* Check for overlapping hyperslab blocks in new selection. */
if(count[u] > 1 && stride[u] < block[u])
@@ -6564,7 +9870,7 @@ H5S_select_hyperslab(H5S_t *space, H5S_seloper_t op, const hsize_t start[],
if(unlim_dim >= 0)
HGOTO_ERROR(H5E_DATASPACE, H5E_UNSUPPORTED, FAIL, "cannot have more than one unlimited dimension in selection")
else {
- if(count[u] == block[u] /* == H5S_UNLIMITED */)
+ if(count[u] == block[u]) /* Both are H5S_UNLIMITED */
HGOTO_ERROR(H5E_DATASPACE, H5E_UNSUPPORTED, FAIL, "count and block cannot both be unlimited")
unlim_dim = (int)u;
} /* end else */
@@ -6714,6 +10020,7 @@ H5S_select_hyperslab(H5S_t *space, H5S_seloper_t op, const hsize_t start[],
if(op == H5S_SELECT_SET) /* Allow only "set" operation to proceed */
break;
/* Else fall through to error */
+ H5_ATTR_FALLTHROUGH
case H5S_SEL_ERROR:
case H5S_SEL_N:
@@ -6722,56 +10029,13 @@ H5S_select_hyperslab(H5S_t *space, H5S_seloper_t op, const hsize_t start[],
} /* end switch */
if(op == H5S_SELECT_SET) {
- /* If we are setting a new selection, remove current selection first */
- if(H5S_SELECT_RELEASE(space) < 0)
- HGOTO_ERROR(H5E_DATASPACE, H5E_CANTDELETE, FAIL, "can't release selection")
-
- /* Allocate space for the hyperslab selection information */
- if(NULL == (space->select.sel_info.hslab = H5FL_MALLOC(H5S_hyper_sel_t)))
- HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "can't allocate hyperslab info")
-
- /* Save the diminfo */
- space->select.num_elem = 1;
- for(u = 0; u < space->extent.rank; u++) {
- space->select.sel_info.hslab->app_diminfo[u].start = start[u];
- space->select.sel_info.hslab->app_diminfo[u].stride = stride[u];
- space->select.sel_info.hslab->app_diminfo[u].count = count[u];
- space->select.sel_info.hslab->app_diminfo[u].block = block[u];
-
- space->select.sel_info.hslab->opt_diminfo[u].start = start[u];
- space->select.sel_info.hslab->opt_diminfo[u].stride = opt_stride[u];
- space->select.sel_info.hslab->opt_diminfo[u].count = opt_count[u];
- space->select.sel_info.hslab->opt_diminfo[u].block = opt_block[u];
-
- space->select.num_elem *= (opt_count[u] * opt_block[u]);
- } /* end for */
-
- /* Save unlim_dim */
- space->select.sel_info.hslab->unlim_dim = unlim_dim;
-
- /* Indicate that the dimension information is valid */
- space->select.sel_info.hslab->diminfo_valid = TRUE;
-
- /* Indicate that there's no slab information */
- space->select.sel_info.hslab->span_lst = NULL;
-
- /* Handle unlimited selections */
- if(unlim_dim >= 0) {
- /* Calculate num_elem_non_unlim */
- space->select.sel_info.hslab->num_elem_non_unlim = (hsize_t)1;
- for(u = 0; u < space->extent.rank; u++)
- if((int)u != unlim_dim)
- space->select.sel_info.hslab->num_elem_non_unlim *= (opt_count[u] * opt_block[u]);
-
- /* Set num_elem */
- if(space->select.num_elem != (hsize_t)0)
- space->select.num_elem = H5S_UNLIMITED;
- } /* end if */
-
- /* Set selection type */
- space->select.type = H5S_sel_hyper;
+ /* Set selection to regular hyperslab */
+ if(H5S__set_regular_hyperslab(space, start, stride, count, block, opt_stride, opt_count, opt_block) < 0)
+ HGOTO_ERROR(H5E_DATASPACE, H5E_CANTSET, FAIL, "can't set regular hyperslab selection")
} /* end if */
else if(op >= H5S_SELECT_OR && op <= H5S_SELECT_NOTA) {
+ hbool_t single_block; /* Whether the selection is a single block */
+
/* Sanity check */
HDassert(H5S_GET_SELECT_TYPE(space) == H5S_SEL_HYPERSLABS);
@@ -6793,7 +10057,8 @@ H5S_select_hyperslab(H5S_t *space, H5S_seloper_t op, const hsize_t start[],
HGOTO_ERROR(H5E_DATASPACE, H5E_CANTGET, FAIL, "can't get selection bounds")
/* Patch count and block to remove unlimited and include the
- * existing selection */
+ * existing selection.
+ */
H5S__hyper_get_clip_diminfo(start[unlim_dim], opt_stride[unlim_dim], &tmp_count, &tmp_block, bounds_end[unlim_dim] + (hsize_t)1);
HDassert((tmp_count == 1) || (opt_count != H5S_hyper_ones_g));
HDassert((tmp_block == 1) || (opt_block != H5S_hyper_ones_g));
@@ -6807,21 +10072,35 @@ H5S_select_hyperslab(H5S_t *space, H5S_seloper_t op, const hsize_t start[],
} /* end if */
} /* end if */
- /* Check if there's no hyperslab span information currently */
- if(NULL == space->select.sel_info.hslab->span_lst)
- if(H5S__hyper_generate_spans(space) < 0)
- HGOTO_ERROR(H5E_DATASPACE, H5E_UNINITIALIZED, FAIL, "dataspace does not have span tree")
+ /* Check for a single block selected */
+ single_block = TRUE;
+ for(u = 0; u < space->extent.rank; u++)
+ if(1 != opt_count[u]) {
+ single_block = FALSE;
+ break;
+ } /* end if */
- /* Indicate that the regular dimensions are no longer valid */
- space->select.sel_info.hslab->diminfo_valid = FALSE;
+ /* Check for single block "AND" operation on a regular hyperslab, which
+ * is used for constructing chunk maps and can be optimized for.
+ */
+ if(H5S_SELECT_AND == op && single_block &&
+ space->select.sel_info.hslab->diminfo_valid == H5S_DIMINFO_VALID_YES) {
+ if(H5S__hyper_regular_and_single_block(space, start, opt_block) < 0)
+ HGOTO_ERROR(H5E_DATASPACE, H5E_CANTOPERATE, FAIL, "can't 'AND' single block against regular hyperslab")
+ } /* end if */
+ else {
+ /* Check if there's no hyperslab span information currently */
+ if(NULL == space->select.sel_info.hslab->span_lst)
+ if(H5S__hyper_generate_spans(space) < 0)
+ HGOTO_ERROR(H5E_DATASPACE, H5E_UNINITIALIZED, FAIL, "dataspace does not have span tree")
- /* Set selection type */
- /* (Could be overridden by resetting selection to 'none', below) */
- space->select.type = H5S_sel_hyper;
+ /* Set selection type */
+ space->select.type = H5S_sel_hyper;
- /* Add in the new hyperslab information */
- if(H5S__generate_hyperslab(space, op, start, opt_stride, opt_count, opt_block) < 0)
- HGOTO_ERROR(H5E_DATASPACE, H5E_CANTINSERT, FAIL, "can't generate hyperslabs")
+ /* Add in the new hyperslab information */
+ if(H5S__generate_hyperslab(space, op, start, opt_stride, opt_count, opt_block) < 0)
+ HGOTO_ERROR(H5E_DATASPACE, H5E_CANTINSERT, FAIL, "can't generate hyperslabs")
+ } /* end else */
} /* end if */
else
HGOTO_ERROR(H5E_ARGS, H5E_UNSUPPORTED, FAIL, "invalid selection operation")
@@ -6893,690 +10172,265 @@ H5Sselect_hyperslab(hid_t space_id, H5S_seloper_t op, const hsize_t start[],
done:
FUNC_LEAVE_API(ret_value)
} /* end H5Sselect_hyperslab() */
-#else /* NEW_HYPERSLAB_API */ /* Works */
-
-/*-------------------------------------------------------------------------
- * Function: H5S_operate_hyperslab
- *
- * Purpose: Combines two hyperslabs with an operation, putting the
- * result into a third hyperslab selection
- *
- * Return: non-negative on success/NULL on failure
- *
- * Programmer: Quincey Koziol
- * Tuesday, October 30, 2001
- *
- * Modifications:
- *
- *-------------------------------------------------------------------------
- */
-static herr_t
-H5S_operate_hyperslab (H5S_t *result, H5S_hyper_span_info_t *spans1, H5S_seloper_t op, H5S_hyper_span_info_t *spans2,
- hbool_t can_own_span2, hbool_t *span2_owned)
-{
- H5S_hyper_span_info_t *a_not_b=NULL; /* Span tree for hyperslab spans in old span tree and not in new span tree */
- H5S_hyper_span_info_t *a_and_b=NULL; /* Span tree for hyperslab spans in both old and new span trees */
- H5S_hyper_span_info_t *b_not_a=NULL; /* Span tree for hyperslab spans in new span tree and not in old span tree */
- herr_t ret_value=SUCCEED; /* Return value */
-
- FUNC_ENTER_NOAPI_NOINIT
-
- /* Check args */
- HDassert(result);
- HDassert(spans2);
- HDassert(op > H5S_SELECT_NOOP && op < H5S_SELECT_INVALID);
-
- /* Just copy the selection from spans2 if we are setting the selection */
- /* ('space1' to 'result' aliasing happens at the next layer up) */
- if(op==H5S_SELECT_SET) {
- if(H5S__hyper_merge_spans(result,spans2,can_own_span2)<0)
- HGOTO_ERROR(H5E_DATASPACE, H5E_CANTINSERT, FAIL, "can't insert hyperslabs")
-
- /* Update the number of elements in current selection */
- result->select.num_elem = H5S__hyper_spans_nelem(spans2);
-
- /* Indicate that we took ownership of span2, if allowed */
- if(can_own_span2)
- *span2_owned=TRUE;
- } /* end if */
- else {
- hbool_t updated_spans = FALSE; /* Whether the spans in the selection were modified */
-
- HDassert(spans1);
-
- /* Generate lists of spans which overlap and don't overlap */
- if(H5S__hyper_clip_spans(spans1,spans2,&a_not_b,&a_and_b,&b_not_a)<0)
- HGOTO_ERROR(H5E_DATASPACE, H5E_CANTCLIP, FAIL, "can't clip hyperslab information")
-
- /* Switch on the operation */
- switch(op) {
- case H5S_SELECT_OR:
- /* Copy spans from spans1 to current selection */
- if(spans1!=NULL) {
- if(H5S__hyper_merge_spans(result,spans1,FALSE)<0)
- HGOTO_ERROR(H5E_DATASPACE, H5E_CANTINSERT, FAIL, "can't insert hyperslabs")
-
- /* Update the number of elements in current selection */
- result->select.num_elem = H5S__hyper_spans_nelem(spans1);
- } /* end if */
-
- /* Add any new spans from spans2 to current selection */
- if(b_not_a!=NULL) {
- if(H5S__hyper_merge_spans(result,b_not_a,FALSE)<0)
- HGOTO_ERROR(H5E_DATASPACE, H5E_CANTINSERT, FAIL, "can't insert hyperslabs")
-
- /* Update the number of elements in current selection */
- result->select.num_elem += H5S__hyper_spans_nelem(b_not_a);
-
- /* Indicate that the spans were updated */
- updated_spans = TRUE;
- } /* end if */
- break;
-
- case H5S_SELECT_AND:
- /* Check if there are any overlapped selections */
- if(a_and_b!=NULL) {
- if(H5S__hyper_merge_spans(result,a_and_b,TRUE)<0)
- HGOTO_ERROR(H5E_DATASPACE, H5E_CANTINSERT, FAIL, "can't insert hyperslabs")
-
- /* Update the number of elements in current selection */
- result->select.num_elem = H5S__hyper_spans_nelem(a_and_b);
-
- /* Indicate that the result owns the a_and_b spans */
- a_and_b=NULL;
-
- /* Indicate that the spans were updated */
- updated_spans = TRUE;
- } /* end if */
- break;
-
- case H5S_SELECT_XOR:
- /* Check if there are any non-overlapped selections */
- if(a_not_b!=NULL) {
- if(H5S__hyper_merge_spans(result,a_not_b,FALSE)<0)
- HGOTO_ERROR(H5E_DATASPACE, H5E_CANTINSERT, FAIL, "can't insert hyperslabs")
-
- /* Update the number of elements in current selection */
- result->select.num_elem = H5S__hyper_spans_nelem(a_not_b);
-
- /* Indicate that the spans were updated */
- updated_spans = TRUE;
- } /* end if */
- if(b_not_a!=NULL) {
- if(H5S__hyper_merge_spans(result,b_not_a,FALSE)<0)
- HGOTO_ERROR(H5E_DATASPACE, H5E_CANTINSERT, FAIL, "can't insert hyperslabs")
-
- /* Update the number of elements in current selection */
- result->select.num_elem += H5S__hyper_spans_nelem(b_not_a);
-
- /* Indicate that the spans were updated */
- updated_spans = TRUE;
- } /* end if */
- break;
-
- case H5S_SELECT_NOTB:
- /* Check if there are any non-overlapped selections */
- if(a_not_b!=NULL) {
- if(H5S__hyper_merge_spans(result,a_not_b,TRUE)<0)
- HGOTO_ERROR(H5E_DATASPACE, H5E_CANTINSERT, FAIL, "can't insert hyperslabs")
-
- /* Update the number of elements in current selection */
- result->select.num_elem = H5S__hyper_spans_nelem(a_not_b);
-
- /* Indicate that the result owns the a_not_b spans */
- a_not_b=NULL;
-
- /* Indicate that the spans were updated */
- updated_spans = TRUE;
- } /* end if */
- break;
-
- case H5S_SELECT_NOTA:
- /* Check if there are any non-overlapped selections */
- if(b_not_a!=NULL) {
- if(H5S__hyper_merge_spans(result,b_not_a,TRUE)<0)
- HGOTO_ERROR(H5E_DATASPACE, H5E_CANTINSERT, FAIL, "can't insert hyperslabs")
-
- /* Update the number of elements in current selection */
- result->select.num_elem = H5S__hyper_spans_nelem(b_not_a);
-
- /* Indicate that the result owns the b_not_a spans */
- b_not_a=NULL;
-
- /* Indicate that the spans were updated */
- updated_spans = TRUE;
- } /* end if */
- break;
-
- default:
- HGOTO_ERROR(H5E_ARGS, H5E_UNSUPPORTED, FAIL, "invalid selection operation")
- } /* end switch */
-
- /* Free the hyperslab trees generated from the clipping algorithm */
- if(a_not_b)
- H5S__hyper_free_span_info(a_not_b);
- if(a_and_b)
- H5S__hyper_free_span_info(a_and_b);
- if(b_not_a)
- H5S__hyper_free_span_info(b_not_a);
-
- /* Check if the resulting hyperslab span tree is empty */
- if(result->select.sel_info.hslab->span_lst==NULL) {
- H5S_hyper_span_info_t *spans; /* Empty hyperslab span tree */
-
- /* Sanity check */
- HDassert(result->select.num_elem == 0);
-
- /* Allocate a span info node */
- if((spans = H5FL_MALLOC(H5S_hyper_span_info_t))==NULL)
- HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "can't allocate hyperslab span")
-
- /* Set the reference count */
- spans->count=1;
-
- /* Reset the scratch pad space */
- spans->scratch=0;
-
- /* Set to empty tree */
- spans->head=NULL;
-
- /* Set pointer to empty span tree */
- result->select.sel_info.hslab->span_lst=spans;
- } /* end if */
- else {
- /* Check if we updated the spans */
- if(updated_spans) {
- /* Attempt to rebuild "optimized" start/stride/count/block information.
- * from resulting hyperslab span tree
- */
- H5S__hyper_rebuild(result);
- } /* end if */
- } /* end else */
- } /* end else */
-
-done:
- FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5S_operate_hyperslab() */
-/*-------------------------------------------------------------------------
- * Function: H5S_generate_hyperlab
- *
- * Purpose: Generate hyperslab information from H5S_select_hyperslab()
- *
- * Return: Non-negative on success/Negative on failure
- *
- * Programmer: Quincey Koziol (split from HS_select_hyperslab()).
- * Tuesday, September 12, 2000
- *
- * Modifications:
- *
- *-------------------------------------------------------------------------
- */
-static herr_t
-H5S__generate_hyperslab(H5S_t *space, H5S_seloper_t op, const hsize_t start[],
- const hsize_t stride[], const hsize_t count[], const hsize_t block[])
-{
- H5S_hyper_span_info_t *new_spans=NULL; /* Span tree for new hyperslab */
- H5S_hyper_span_info_t *tmp_spans=NULL; /* Temporary copy of selection */
- hbool_t span2_owned=FALSE; /* Flag to indicate that span2 was used in H5S_operate_hyperslab() */
- herr_t ret_value=SUCCEED; /* Return value */
-
- FUNC_ENTER_NOAPI_NOINIT
-
- /* Check args */
- HDassert(space);
- HDassert(op > H5S_SELECT_NOOP && op < H5S_SELECT_INVALID);
- HDassert(start);
- HDassert(stride);
- HDassert(count);
- HDassert(block);
-
- /* Generate span tree for new hyperslab information */
- if(NULL == (new_spans = H5S__hyper_make_spans(space->extent.rank, start, stride, count, block)))
- HGOTO_ERROR(H5E_DATASPACE, H5E_CANTINSERT, FAIL, "can't create hyperslab information")
-
- /* Copy the original dataspace */
- if(space->select.sel_info.hslab->span_lst!=NULL) {
- /* Take ownership of the dataspace's hyperslab spans */
- /* (These are freed later) */
- tmp_spans=space->select.sel_info.hslab->span_lst;
- space->select.sel_info.hslab->span_lst=NULL;
-
- /* Reset the other dataspace selection information */
- if(H5S_SELECT_RELEASE(space)<0)
- HGOTO_ERROR(H5E_DATASPACE, H5E_CANTDELETE, FAIL, "can't release selection")
-
- /* Allocate space for the hyperslab selection information */
- if((space->select.sel_info.hslab=H5FL_MALLOC(H5S_hyper_sel_t))==NULL)
- HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "can't allocate hyperslab info")
-
- /* Set unlim_dim */
- space->select.sel_info.hslab->unlim_dim = -1;
- } /* end if */
-
- /* Combine tmp_space (really space) & new_space, with the result in space */
- if(H5S_operate_hyperslab(space,tmp_spans,op,new_spans,TRUE,&span2_owned)<0)
- HGOTO_ERROR(H5E_DATASPACE, H5E_CANTCLIP, FAIL, "can't clip hyperslab information")
-
-done:
- /* Free temporary data structures */
- if(tmp_spans!=NULL)
- if(H5S__hyper_free_span_info(tmp_spans)<0)
- HDONE_ERROR(H5E_INTERNAL, H5E_CANTFREE, FAIL, "failed to release temporary hyperslab spans")
- if(new_spans!=NULL && span2_owned==FALSE)
- if(H5S__hyper_free_span_info(new_spans)<0)
- HDONE_ERROR(H5E_INTERNAL, H5E_CANTFREE, FAIL, "failed to release temporary hyperslab spans")
-
- FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5S__generate_hyperslab() */
-
-
-/*-------------------------------------------------------------------------
- * Function: H5S_select_hyperslab
- *
- * Purpose: Internal version of H5Sselect_hyperslab().
- *
- * Return: Non-negative on success/Negative on failure
- *
- * Programmer: Quincey Koziol
- * Wednesday, January 10, 2001
- *
- * Modifications:
- *
- *-------------------------------------------------------------------------
- */
+/*--------------------------------------------------------------------------
+ NAME
+ H5S_combine_hyperslab
+ PURPOSE
+ Specify a hyperslab to combine with the current hyperslab selection, and
+ store the result in the new hyperslab selection.
+ USAGE
+ herr_t H5S_combine_hyperslab(new_space, old_space, op, start, stride, count, block)
+ H5S_t *old_space; IN: The old space the selection is performed on
+ H5S_seloper_t op; IN: Operation to perform on current selection
+ const hsize_t start[]; IN: Offset of start of hyperslab
+ const hsize_t *stride; IN: Hyperslab stride
+ const hsize_t count[]; IN: Number of blocks included in hyperslab
+ const hsize_t *block; IN: Size of block in hyperslab
+ H5S_t **new_space; OUT: The new dataspace to store the selection result
+ RETURNS
+ Non-negative on success/Negative on failure
+ DESCRIPTION
+ Combines a hyperslab selection with the current selection for a dataspace.
+ If STRIDE or BLOCK is NULL, they are assumed to be set to all '1'.
+ GLOBAL VARIABLES
+ COMMENTS, BUGS, ASSUMPTIONS
+ In some cases, copying the whole span tree from old_space to new_space
+ can be avoided. Deal with such cases directly, otherwise this function
+ is equivalent to:
+ 1. Copy the whole span tree from old_space into new_space
+ 2. Call H5S_select_hyperslab with the new_space.
+ EXAMPLES
+ REVISION LOG
+--------------------------------------------------------------------------*/
herr_t
-H5S_select_hyperslab (H5S_t *space, H5S_seloper_t op,
- const hsize_t start[],
- const hsize_t *stride,
- const hsize_t count[],
- const hsize_t *block)
+H5S_combine_hyperslab(H5S_t *old_space, H5S_seloper_t op, const hsize_t start[],
+ const hsize_t *stride, const hsize_t count[], const hsize_t *block,
+ H5S_t **new_space)
{
- hsize_t int_stride[H5O_LAYOUT_NDIMS]; /* Internal storage for stride information */
- hsize_t int_count[H5O_LAYOUT_NDIMS]; /* Internal storage for count information */
- hsize_t int_block[H5O_LAYOUT_NDIMS]; /* Internal storage for block information */
- const hsize_t *opt_stride; /* Optimized stride information */
- const hsize_t *opt_count; /* Optimized count information */
- const hsize_t *opt_block; /* Optimized block information */
- unsigned u; /* Counters */
- int unlim_dim = -1; /* Unlimited dimension in selection, of -1 if none */
- herr_t ret_value=SUCCEED; /* Return value */
+ unsigned u; /* Local index variable */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(FAIL)
/* Check args */
- HDassert(space);
+ HDassert(old_space);
HDassert(start);
HDassert(count);
- HDassert(op > H5S_SELECT_NOOP && op < H5S_SELECT_INVALID);
+ HDassert(op >= H5S_SELECT_SET && op <= H5S_SELECT_NOTA);
+ HDassert(new_space);
+ HDassert(*new_space == NULL);
/* Point to the correct stride values */
- if(stride==NULL)
+ if(stride == NULL)
stride = H5S_hyper_ones_g;
/* Point to the correct block values */
- if(block==NULL)
+ if(block == NULL)
block = H5S_hyper_ones_g;
- /* Check for unlimited dimension */
- for(u = 0; u<space->extent.rank; u++)
- if((count[u] == H5S_UNLIMITED) || (block[u] == H5S_UNLIMITED)) {
- if(unlim_dim >= 0)
- HGOTO_ERROR(H5E_DATASPACE, H5E_UNSUPPORTED, FAIL, "cannot have more than one unlimited dimension in selection")
- else {
- if(count[u] == block[u] /* == H5S_UNLIMITED */)
- HGOTO_ERROR(H5E_DATASPACE, H5E_UNSUPPORTED, FAIL, "count and block cannot both be unlimited")
- unlim_dim = (int)u;
- } /* end else */
- } /* end if */
-
- /*
- * Check new selection.
- */
- for(u=0; u<space->extent.rank; u++) {
+ /* Check new selection. */
+ for(u = 0; u < old_space->extent.rank; u++) {
/* Check for overlapping hyperslab blocks in new selection. */
- if(count[u]>1 && stride[u]<block[u])
+ if(count[u] > 1 && stride[u] < block[u])
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "hyperslab blocks overlap")
/* Detect zero-sized hyperslabs in new selection */
if(count[u] == 0 || block[u] == 0) {
switch(op) {
- case H5S_SELECT_SET: /* Select "set" operation */
case H5S_SELECT_AND: /* Binary "and" operation for hyperslabs */
case H5S_SELECT_NOTA: /* Binary "B not A" operation for hyperslabs */
/* Convert to "none" selection */
- if(H5S_select_none(space)<0)
- HGOTO_ERROR(H5E_DATASPACE, H5E_CANTDELETE, FAIL, "can't convert selection")
+ /* Copy the first dataspace without sharing the list of spans */
+ if(NULL == ((*new_space) = H5S_copy(old_space, TRUE, TRUE)))
+ HGOTO_ERROR(H5E_DATASPACE, H5E_CANTINIT, FAIL, "unable to copy dataspace")
+ if(H5S_select_none((*new_space)) < 0)
+ HGOTO_ERROR(H5E_DATASPACE, H5E_CANTSELECT, FAIL, "can't convert selection")
HGOTO_DONE(SUCCEED);
case H5S_SELECT_OR: /* Binary "or" operation for hyperslabs */
case H5S_SELECT_XOR: /* Binary "xor" operation for hyperslabs */
case H5S_SELECT_NOTB: /* Binary "A not B" operation for hyperslabs */
+ /* Copy the first dataspace with sharing the list of spans */
+ if(NULL == ((*new_space) = H5S_copy(old_space, FALSE, TRUE)))
+ HGOTO_ERROR(H5E_DATASPACE, H5E_CANTINIT, FAIL, "unable to copy dataspace")
HGOTO_DONE(SUCCEED); /* Selection stays same */
+ case H5S_SELECT_NOOP:
+ case H5S_SELECT_SET:
+ case H5S_SELECT_APPEND:
+ case H5S_SELECT_PREPEND:
+ case H5S_SELECT_INVALID:
default:
HGOTO_ERROR(H5E_ARGS, H5E_UNSUPPORTED, FAIL, "invalid selection operation")
} /* end switch */
} /* end if */
} /* end for */
- /* Optimize hyperslab parameters to merge contiguous blocks, etc. */
- if(stride == H5S_hyper_ones_g && block == H5S_hyper_ones_g) {
- /* Point to existing arrays */
- opt_stride = H5S_hyper_ones_g;
- opt_count = H5S_hyper_ones_g;
- opt_block = count;
- } /* end if */
- else {
- /* Point to local arrays */
- opt_stride = int_stride;
- opt_count = int_count;
- opt_block = int_block;
- for(u=0; u<space->extent.rank; u++) {
- /* contiguous hyperslabs have the block size equal to the stride */
- if((stride[u] == block[u]) && (count[u] != H5S_UNLIMITED)) {
- int_count[u]=1;
- int_stride[u]=1;
- if(block[u]==1)
- int_block[u]=count[u];
- else
- int_block[u]=block[u]*count[u];
- } /* end if */
- else {
- if(count[u]==1)
- int_stride[u]=1;
- else {
- HDassert((stride[u] > block[u]) || ((stride[u] == block[u])
- && (count[u] == H5S_UNLIMITED)));
- int_stride[u]=stride[u];
- } /* end else */
- int_count[u]=count[u];
- int_block[u]=block[u];
- } /* end else */
- } /* end for */
- } /* end else */
-
- /* Check for operating on unlimited selection */
- if((H5S_GET_SELECT_TYPE(space) == H5S_SEL_HYPERSLABS)
- && (space->select.sel_info.hslab->unlim_dim >= 0)
- && (op != H5S_SELECT_SET))
- {
- /* Check for invalid operation */
- if(unlim_dim >= 0)
- HGOTO_ERROR(H5E_DATASPACE, H5E_UNSUPPORTED, FAIL, "cannot modify unlimited selection with another unlimited selection")
- if(!((op == H5S_SELECT_AND) || (op == H5S_SELECT_NOTA)))
- HGOTO_ERROR(H5E_DATASPACE, H5E_UNSUPPORTED, FAIL, "unsupported operation on unlimited selection")
- HDassert(space->select.sel_info.hslab->diminfo_valid);
+ if(H5S_GET_SELECT_TYPE(old_space) == H5S_SEL_HYPERSLABS) {
+ hsize_t *old_low_bounds; /* Pointer to old space's low & high bounds */
+ hsize_t *old_high_bounds;
+ hsize_t new_low_bounds[H5S_MAX_RANK]; /* New space's low & high bounds */
+ hsize_t new_high_bounds[H5S_MAX_RANK];
+ hbool_t overlapped = FALSE;
+
+ /* Set up old space's low & high bounds */
+ if(old_space->select.sel_info.hslab->span_lst) {
+ old_low_bounds = old_space->select.sel_info.hslab->span_lst->low_bounds;
+ old_high_bounds = old_space->select.sel_info.hslab->span_lst->high_bounds;
+ } /* end if */
+ else {
+ old_low_bounds = old_space->select.sel_info.hslab->diminfo.low_bounds;
+ old_high_bounds = old_space->select.sel_info.hslab->diminfo.high_bounds;
+ } /* end else */
- /* Clip unlimited selection to include new selection */
- if(H5S_hyper_clip_unlim(space,
- start[space->select.sel_info.hslab->unlim_dim]
- + ((opt_count[space->select.sel_info.hslab->unlim_dim]
- - (hsize_t)1)
- * opt_stride[space->select.sel_info.hslab->unlim_dim])
- + opt_block[space->select.sel_info.hslab->unlim_dim]) < 0)
- HGOTO_ERROR(H5E_DATASPACE, H5E_CANTCLIP, FAIL, "failed to clip unlimited selection")
+ /* Generate bounding box for hyperslab parameters */
+ for(u = 0; u < old_space->extent.rank; u++) {
+ new_low_bounds[u] = start[u];
+ new_high_bounds[u] = start[u] + stride[u] * (count[u] - 1) + (block[u] - 1);
+ } /* end for */
- /* If an empty space was returned it must be "none" */
- HDassert((space->select.num_elem > (hsize_t)0)
- || (space->select.type->type == H5S_SEL_NONE));
- } /* end if */
+ /* Check bound box of both spaces to see if they overlap */
+ if(H5S_RANGE_OVERLAP(old_low_bounds[0], old_high_bounds[0],
+ new_low_bounds[0], new_high_bounds[0]))
+ overlapped = TRUE;
+
+ /* Non-overlapping situations can be handled in special ways */
+ if(!overlapped) {
+ H5S_hyper_span_info_t *new_spans = NULL;
+ H5S_hyper_dim_t new_hyper_diminfo[H5S_MAX_RANK];
+
+ if(NULL == ((*new_space) = H5S_copy(old_space, TRUE, TRUE)))
+ HGOTO_ERROR(H5E_DATASPACE, H5E_CANTCOPY, FAIL, "unable to copy dataspace")
+ if(NULL != (*new_space)->select.sel_info.hslab->span_lst) {
+ old_space->select.sel_info.hslab->span_lst->count--;
+ (*new_space)->select.sel_info.hslab->span_lst = NULL;
+ } /* end if */
- /* Fixup operation for non-hyperslab selections */
- switch(H5S_GET_SELECT_TYPE(space)) {
- case H5S_SEL_NONE: /* No elements selected in dataspace */
+ /* Generate hyperslab info for new space */
switch(op) {
- case H5S_SELECT_SET: /* Select "set" operation */
- /* Change "none" selection to hyperslab selection */
- break;
+ case H5S_SELECT_OR:
+ case H5S_SELECT_XOR:
+ /* Add the new space to the space */
+ if(NULL == (new_spans = H5S__hyper_make_spans(old_space->extent.rank, start, stride, count, block)))
+ HGOTO_ERROR(H5E_DATASPACE, H5E_CANTINSERT, FAIL, "can't create hyperslab information")
+ if(NULL != old_space->select.sel_info.hslab->span_lst)
+ (*new_space)->select.sel_info.hslab->span_lst = H5S__hyper_copy_span(old_space->select.sel_info.hslab->span_lst, old_space->extent.rank);
+ if(H5S__hyper_add_disjoint_spans(*new_space, new_spans) < 0)
+ HGOTO_ERROR(H5E_DATASPACE, H5E_CANTINSERT, FAIL, "can't append hyperslabs")
+
+ /* Build diminfo struct */
+ for(u = 0; u < (*new_space)->extent.rank; u++) {
+ new_hyper_diminfo[u].start = start[u];
+ new_hyper_diminfo[u].stride = stride[u];
+ new_hyper_diminfo[u].count = count[u];
+ new_hyper_diminfo[u].block = block[u];
+ } /* end for */
- case H5S_SELECT_OR: /* Binary "or" operation for hyperslabs */
- case H5S_SELECT_XOR: /* Binary "xor" operation for hyperslabs */
- case H5S_SELECT_NOTA: /* Binary "B not A" operation for hyperslabs */
- op=H5S_SELECT_SET; /* Maps to "set" operation when applied to "none" selection */
+ /* Update space's dim info */
+ if(H5S__hyper_update_diminfo(*new_space, op, new_hyper_diminfo) < 0)
+ HGOTO_ERROR(H5E_DATASPACE, H5E_CANTCOUNT, FAIL, "can't update hyperslab info")
break;
- case H5S_SELECT_AND: /* Binary "and" operation for hyperslabs */
- case H5S_SELECT_NOTB: /* Binary "A not B" operation for hyperslabs */
- HGOTO_DONE(SUCCEED); /* Selection stays "none" */
-
- default:
- HGOTO_ERROR(H5E_ARGS, H5E_UNSUPPORTED, FAIL, "invalid selection operation")
- } /* end switch */
- break;
-
- case H5S_SEL_ALL: /* All elements selected in dataspace */
- switch(op) {
- case H5S_SELECT_SET: /* Select "set" operation */
- /* Change "all" selection to hyperslab selection */
+ case H5S_SELECT_AND:
+ if(H5S_select_none((*new_space)) < 0)
+ HGOTO_ERROR(H5E_DATASPACE, H5E_CANTSELECT, FAIL, "can't convert selection")
break;
- case H5S_SELECT_OR: /* Binary "or" operation for hyperslabs */
- HGOTO_DONE(SUCCEED); /* Selection stays "all" */
-
- case H5S_SELECT_AND: /* Binary "and" operation for hyperslabs */
- op=H5S_SELECT_SET; /* Maps to "set" operation when applied to "none" selection */
+ case H5S_SELECT_NOTB:
+ if(NULL != old_space->select.sel_info.hslab->span_lst) {
+ if(NULL == ((*new_space)->select.sel_info.hslab->span_lst = H5S__hyper_copy_span(old_space->select.sel_info.hslab->span_lst, old_space->extent.rank)))
+ HGOTO_ERROR(H5E_DATASPACE, H5E_CANTCOPY, FAIL, "unable to copy dataspace")
+ } /* end if */
+ else {
+ if(H5S_select_none((*new_space)) < 0)
+ HGOTO_ERROR(H5E_DATASPACE, H5E_CANTSELECT, FAIL, "can't convert selection")
+ } /* end else */
break;
- case H5S_SELECT_XOR: /* Binary "xor" operation for hyperslabs */
- case H5S_SELECT_NOTB: /* Binary "A not B" operation for hyperslabs */
- /* Convert current "all" selection to "real" hyperslab selection */
- /* Then allow operation to proceed */
- {
- hsize_t tmp_start[H5O_LAYOUT_NDIMS]; /* Temporary start information */
- hsize_t tmp_stride[H5O_LAYOUT_NDIMS]; /* Temporary stride information */
- hsize_t tmp_count[H5O_LAYOUT_NDIMS]; /* Temporary count information */
- hsize_t tmp_block[H5O_LAYOUT_NDIMS]; /* Temporary block information */
-
- /* Fill in temporary information for the dimensions */
- for(u=0; u<space->extent.rank; u++) {
- tmp_start[u]=0;
- tmp_stride[u]=1;
- tmp_count[u]=1;
- tmp_block[u]=space->extent.size[u];
- } /* end for */
-
- /* Convert to hyperslab selection */
- if(H5S_select_hyperslab(space,H5S_SELECT_SET,tmp_start,tmp_stride,tmp_count,tmp_block)<0)
- HGOTO_ERROR(H5E_DATASPACE, H5E_CANTDELETE, FAIL, "can't convert selection")
- } /* end case */
+ case H5S_SELECT_NOTA:
+ if(H5S__set_regular_hyperslab(*new_space, start, stride, count, block, stride, count, block) < 0)
+ HGOTO_ERROR(H5E_DATASPACE, H5E_CANTSET, FAIL, "can't set regular selection")
break;
- case H5S_SELECT_NOTA: /* Binary "B not A" operation for hyperslabs */
- /* Convert to "none" selection */
- if(H5S_select_none(space)<0)
- HGOTO_ERROR(H5E_DATASPACE, H5E_CANTDELETE, FAIL, "can't convert selection")
- HGOTO_DONE(SUCCEED);
-
+ case H5S_SELECT_NOOP:
+ case H5S_SELECT_SET:
+ case H5S_SELECT_APPEND:
+ case H5S_SELECT_PREPEND:
+ case H5S_SELECT_INVALID:
default:
HGOTO_ERROR(H5E_ARGS, H5E_UNSUPPORTED, FAIL, "invalid selection operation")
} /* end switch */
- break;
-
- case H5S_SEL_HYPERSLABS:
- /* Hyperslab operation on hyperslab selection, OK */
- break;
-
- case H5S_SEL_POINTS: /* Can't combine hyperslab operations and point selections currently */
- if(op==H5S_SELECT_SET) /* Allow only "set" operation to proceed */
- break;
- /* Else fall through to error */
-
- default:
- HGOTO_ERROR(H5E_ARGS, H5E_UNSUPPORTED, FAIL, "invalid selection operation")
- } /* end switch */
-
-
- if(op==H5S_SELECT_SET) {
- /* If we are setting a new selection, remove current selection first */
- if(H5S_SELECT_RELEASE(space)<0)
- HGOTO_ERROR(H5E_DATASPACE, H5E_CANTDELETE, FAIL, "can't release hyperslab")
-
- /* Allocate space for the hyperslab selection information */
- if(NULL == (space->select.sel_info.hslab = H5FL_MALLOC(H5S_hyper_sel_t)))
- HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "can't allocate hyperslab info")
-
- /* Save the diminfo */
- space->select.num_elem=1;
- for(u=0; u<space->extent.rank; u++) {
- space->select.sel_info.hslab->app_diminfo[u].start = start[u];
- space->select.sel_info.hslab->app_diminfo[u].stride = stride[u];
- space->select.sel_info.hslab->app_diminfo[u].count = count[u];
- space->select.sel_info.hslab->app_diminfo[u].block = block[u];
-
- space->select.sel_info.hslab->opt_diminfo[u].start = start[u];
- space->select.sel_info.hslab->opt_diminfo[u].stride = opt_stride[u];
- space->select.sel_info.hslab->opt_diminfo[u].count = opt_count[u];
- space->select.sel_info.hslab->opt_diminfo[u].block = opt_block[u];
-
- space->select.num_elem*=(opt_count[u]*opt_block[u]);
- } /* end for */
-
- /* Save unlim_dim */
- space->select.sel_info.hslab->unlim_dim = unlim_dim;
-
- /* Indicate that the dimension information is valid */
- space->select.sel_info.hslab->diminfo_valid = TRUE;
-
- /* Indicate that there's no slab information */
- space->select.sel_info.hslab->span_lst = NULL;
- /* Handle unlimited selections */
- if(unlim_dim >= 0) {
- /* Calculate num_elem_non_unlim */
- space->select.sel_info.hslab->num_elem_non_unlim = (hsize_t)1;
- for(u = 0; u < space->extent.rank; u++)
- if((int)u != unlim_dim)
- space->select.sel_info.hslab->num_elem_non_unlim *= (opt_count[u] * opt_block[u]);
-
- /* Set num_elem */
- if(space->select.num_elem != (hsize_t)0)
- space->select.num_elem = H5S_UNLIMITED;
- } /* end if */
- } /* end if */
- else if(op>=H5S_SELECT_OR && op<=H5S_SELECT_NOTA) {
- /* Sanity check */
- HDassert(H5S_GET_SELECT_TYPE(space) == H5S_SEL_HYPERSLABS);
-
- /* Handle unlimited selections */
- if(unlim_dim >= 0) {
- hsize_t bounds_start[H5S_MAX_RANK];
- hsize_t bounds_end[H5S_MAX_RANK];
- hsize_t tmp_count = opt_count[unlim_dim];
- hsize_t tmp_block = opt_block[unlim_dim];
-
- /* Check for invalid operation */
- if(space->select.sel_info.hslab->unlim_dim >= 0)
- HGOTO_ERROR(H5E_DATASPACE, H5E_UNSUPPORTED, FAIL, "cannot modify unlimited selection with another unlimited selection")
- if(!((op == H5S_SELECT_AND) || (op == H5S_SELECT_NOTB)))
- HGOTO_ERROR(H5E_DATASPACE, H5E_UNSUPPORTED, FAIL, "unsupported operation with unlimited selection")
-
- /* Get bounds of existing selection */
- if(H5S_hyper_bounds(space, bounds_start, bounds_end) < 0)
- HGOTO_ERROR(H5E_DATASPACE, H5E_CANTGET, FAIL, "can't get selection bounds")
-
- /* Patch count and block to remove unlimited and include the
- * existing selection */
- H5S__hyper_get_clip_diminfo(start[unlim_dim], opt_stride[unlim_dim], &tmp_count, &tmp_block, bounds_end[unlim_dim] + (hsize_t)1);
- HDassert((tmp_count == 1) || (opt_count != H5S_hyper_ones_g));
- HDassert((tmp_block == 1) || (opt_block != H5S_hyper_ones_g));
- if(opt_count != H5S_hyper_ones_g) {
- HDassert(opt_count == int_count);
- int_count[unlim_dim] = tmp_count;
- } /* end if */
- if(opt_block != H5S_hyper_ones_g) {
- HDassert(opt_block == int_block);
- int_block[unlim_dim] = tmp_block;
- } /* end if */
- } /* end if */
+ HGOTO_DONE(SUCCEED);
+ } /* end if(!overlapped) */
+ } /* end if the selection of old space is H5S_SEL_HYPERSLABS */
- /* Check if there's no hyperslab span information currently */
- if(NULL == space->select.sel_info.hslab->span_lst)
- if(H5S__hyper_generate_spans(space) < 0)
- HGOTO_ERROR(H5E_DATASPACE, H5E_UNINITIALIZED, FAIL, "dataspace does not have span tree")
+ /* Copy the first dataspace with sharing the list of spans */
+ if(NULL == ((*new_space) = H5S_copy(old_space, TRUE, TRUE)))
+ HGOTO_ERROR(H5E_DATASPACE, H5E_CANTINIT, FAIL, "unable to copy dataspace")
- /* Indicate that the regular dimensions are no longer valid */
- space->select.sel_info.hslab->diminfo_valid = FALSE;
-
- /* Add in the new hyperslab information */
- if(H5S__generate_hyperslab (space, op, start, opt_stride, opt_count, opt_block)<0)
- HGOTO_ERROR(H5E_DATASPACE, H5E_CANTINSERT, FAIL, "can't generate hyperslabs")
- } /* end if */
- else
- HGOTO_ERROR(H5E_ARGS, H5E_UNSUPPORTED, FAIL, "invalid selection operation")
-
- /* Set selection type */
- space->select.type = H5S_sel_hyper;
+ /* Note: a little overhead in calling the function as some conditions are checked again */
+ if(H5S_select_hyperslab(*new_space, op, start, stride, count, block) < 0)
+ HGOTO_ERROR(H5E_DATASPACE, H5E_CANTINIT, FAIL, "unable to set hyperslab selection")
done:
FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5S_select_hyperslab() */
+} /* end H5S_combine_hyperslab() */
-/*--------------------------------------------------------------------------
- NAME
- H5Sselect_hyperslab
- PURPOSE
- Specify a hyperslab to combine with the current hyperslab selection
- USAGE
- herr_t H5Sselect_hyperslab(dsid, op, start, stride, count, block)
- hid_t dsid; IN: Dataspace ID of selection to modify
- H5S_seloper_t op; IN: Operation to perform on current selection
- const hsize_t *start; IN: Offset of start of hyperslab
- const hsize_t *stride; IN: Hyperslab stride
- const hsize_t *count; IN: Number of blocks included in hyperslab
- const hsize_t *block; IN: Size of block in hyperslab
- RETURNS
- Non-negative on success/Negative on failure
- DESCRIPTION
- Combines a hyperslab selection with the current selection for a dataspace.
- If the current selection is not a hyperslab, it is freed and the hyperslab
- parameters passed in are combined with the H5S_SEL_ALL hyperslab (ie. a
- selection composing the entire current extent). If STRIDE or BLOCK is
- NULL, they are assumed to be set to all '1'.
- GLOBAL VARIABLES
- COMMENTS, BUGS, ASSUMPTIONS
- EXAMPLES
- REVISION LOG
---------------------------------------------------------------------------*/
-herr_t
-H5Sselect_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[])
+/*-------------------------------------------------------------------------
+ * Function: H5S__fill_in_select
+ *
+ * Purpose: Combines two hyperslabs with an operation, putting the
+ * result into a third hyperslab selection
+ *
+ * Return: Non-negative on success/negative on failure
+ *
+ * Programmer: Chao Mei
+ * Tuesday, July 5, 2011
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5S__fill_in_select(H5S_t *space1, H5S_seloper_t op, H5S_t *space2, H5S_t **result)
{
- H5S_t *space = NULL; /* Dataspace to modify selection of */
- herr_t ret_value=SUCCEED; /* Return value */
-
- FUNC_ENTER_API(FAIL)
- H5TRACE6("e", "iSs*h*h*h*h", space_id, op, start, stride, count, block);
+ hbool_t span2_owned;
+ hbool_t updated_spans;
+ herr_t ret_value = SUCCEED; /* Return value */
- /* Check args */
- if (NULL == (space = (H5S_t *)H5I_object_verify(space_id, H5I_DATASPACE)))
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataspace")
- if (H5S_SCALAR==H5S_GET_EXTENT_TYPE(space))
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "hyperslab doesn't support H5S_SCALAR space")
- if (H5S_NULL==H5S_GET_EXTENT_TYPE(space))
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "hyperslab doesn't support H5S_NULL space")
- if(start==NULL || count==NULL)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "hyperslab not specified")
- if(!(op>H5S_SELECT_NOOP && op<H5S_SELECT_INVALID))
- HGOTO_ERROR(H5E_ARGS, H5E_UNSUPPORTED, FAIL, "invalid selection operation")
- if(stride!=NULL) {
- unsigned u; /* Local index variable */
+ FUNC_ENTER_STATIC
- /* Check for 0-sized strides */
- for(u=0; u<space->extent.rank; u++) {
- if(stride[u]==0)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid stride==0 value")
- } /* end for */
+ /* Sanity check */
+ HDassert(space1);
+ HDassert(space2);
+ HDassert(op >= H5S_SELECT_OR && op <= H5S_SELECT_NOTA);
+ HDassert(space1->extent.rank == space2->extent.rank);
+ /* The result is either a to-be-created space or an empty one */
+ HDassert(NULL == *result || *result == space1);
+ HDassert(space1->select.sel_info.hslab->span_lst);
+ HDassert(space2->select.sel_info.hslab->span_lst);
+
+ /* Note: the offset of space2 is not considered here for bounding box */
+ if(H5S__fill_in_new_space(space1, op, space2->select.sel_info.hslab->span_lst, FALSE, &span2_owned, &updated_spans, result) < 0)
+ HGOTO_ERROR(H5E_DATASPACE, H5E_CANTSELECT, FAIL, "can't create the specified selection")
+
+ /* Update diminfo if space2's diminfo was valid, otherwise just mark it as
+ * invalid if the spans were updated */
+ HDassert(result);
+ if(updated_spans) {
+ if(space2->select.sel_info.hslab->diminfo_valid == H5S_DIMINFO_VALID_YES) {
+ if(H5S__hyper_update_diminfo(*result, op, space2->select.sel_info.hslab->diminfo.opt) < 0)
+ HGOTO_ERROR(H5E_DATASPACE, H5E_CANTCOUNT, FAIL, "can't update hyperslab info")
+ } /* end if */
+ else
+ (*result)->select.sel_info.hslab->diminfo_valid = H5S_DIMINFO_VALID_NO;
} /* end if */
- if (H5S_select_hyperslab(space, op, start, stride, count, block)<0)
- HGOTO_ERROR(H5E_DATASPACE, H5E_CANTINIT, FAIL, "unable to set hyperslab selection")
-
done:
- FUNC_LEAVE_API(ret_value)
-} /* end H5Sselect_hyperslab() */
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5S__fill_in_select() */
/*--------------------------------------------------------------------------
@@ -7587,7 +10441,7 @@ done:
return a new dataspace with the combined selection as the selection in the
new dataspace.
USAGE
- hid_t H5Srefine_hyperslab(dsid, op, start, stride, count, block)
+ hid_t H5Scombine_hyperslab(dsid, op, start, stride, count, block)
hid_t dsid; IN: Dataspace ID of selection to use
H5S_seloper_t op; IN: Operation to perform on current selection
const hsize_t *start; IN: Offset of start of hyperslab
@@ -7595,7 +10449,7 @@ done:
const hsize_t *count; IN: Number of blocks included in hyperslab
const hsize_t *block; IN: Size of block in hyperslab
RETURNS
- Dataspace ID on success/Negative on failure
+ Dataspace ID on success / H5I_INVALID_HID on failure
DESCRIPTION
Combines a hyperslab selection with the current selection for a dataspace,
creating a new dataspace to return the generated selection.
@@ -7616,28 +10470,24 @@ H5Scombine_hyperslab(hid_t space_id, H5S_seloper_t op, const hsize_t start[],
H5S_t *new_space = NULL; /* New dataspace created */
hid_t ret_value; /* Return value */
- FUNC_ENTER_API(FAIL)
+ FUNC_ENTER_API(H5I_INVALID_HID)
H5TRACE6("i", "iSs*h*h*h*h", space_id, op, start, stride, count, block);
/* Check args */
if(NULL == (space = (H5S_t *)H5I_object_verify(space_id, H5I_DATASPACE)))
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataspace")
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not a dataspace")
if(start == NULL || count == NULL)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "hyperslab not specified")
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5I_INVALID_HID, "hyperslab not specified")
if(!(op >= H5S_SELECT_SET && op <= H5S_SELECT_NOTA))
- HGOTO_ERROR(H5E_ARGS, H5E_UNSUPPORTED, FAIL, "invalid selection operation")
+ HGOTO_ERROR(H5E_ARGS, H5E_UNSUPPORTED, H5I_INVALID_HID, "invalid selection operation")
- /* Copy the first dataspace */
- if (NULL == (new_space = H5S_copy (space, TRUE, TRUE)))
- HGOTO_ERROR(H5E_DATASPACE, H5E_CANTINIT, NULL, "unable to copy dataspace")
-
- /* Go modify the selection in the new dataspace */
- if (H5S_select_hyperslab(new_space, op, start, stride, count, block)<0)
- HGOTO_ERROR(H5E_DATASPACE, H5E_CANTINIT, FAIL, "unable to set hyperslab selection")
+ /* Generate new space, with combination of selections */
+ if(H5S_combine_hyperslab(space, op, start, stride, count, block, &new_space) < 0)
+ HGOTO_ERROR(H5E_DATASPACE, H5E_CANTINIT, H5I_INVALID_HID, "unable to set hyperslab selection")
/* Atomize */
if((ret_value = H5I_register(H5I_DATASPACE, new_space, TRUE)) < 0)
- HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, FAIL, "unable to register dataspace atom")
+ HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register dataspace atom")
done:
if(ret_value < 0 && new_space)
@@ -7657,17 +10507,13 @@ done:
* Programmer: Quincey Koziol
* Tuesday, October 30, 2001
*
- * Chao Mei
- * Wednesday, June 29, 2011
- *
*-------------------------------------------------------------------------
*/
static H5S_t *
H5S__combine_select(H5S_t *space1, H5S_seloper_t op, H5S_t *space2)
{
H5S_t *new_space = NULL; /* New dataspace generated */
- hbool_t span2_owned=FALSE; /* Flag to indicate that span2 was used in H5S_operate_hyperslab() */
- H5S_t *ret_value; /* return value */
+ H5S_t *ret_value = NULL; /* Return value */
FUNC_ENTER_STATIC
@@ -7676,33 +10522,38 @@ H5S__combine_select(H5S_t *space1, H5S_seloper_t op, H5S_t *space2)
HDassert(space2);
HDassert(op >= H5S_SELECT_OR && op <= H5S_SELECT_NOTA);
- /* Check that the space selections both have span trees */
- if(space1->select.sel_info.hslab->span_lst==NULL)
- if(H5S__hyper_generate_spans(space1)<0)
- HGOTO_ERROR(H5E_DATASPACE, H5E_UNINITIALIZED, NULL, "dataspace does not have span tree")
- if(space2->select.sel_info.hslab->span_lst==NULL)
- if(H5S__hyper_generate_spans(space2)<0)
+ /* Check if space1 selections has span trees */
+ if(NULL == space1->select.sel_info.hslab->span_lst)
+ if(H5S__hyper_generate_spans(space1) < 0)
HGOTO_ERROR(H5E_DATASPACE, H5E_UNINITIALIZED, NULL, "dataspace does not have span tree")
- /* Copy the first dataspace */
- if (NULL == (new_space = H5S_copy (space1, TRUE, TRUE)))
- HGOTO_ERROR(H5E_DATASPACE, H5E_CANTINIT, NULL, "unable to copy dataspace")
-
- /* Free the current selection for the new dataspace */
- if(H5S_SELECT_RELEASE(new_space)<0)
- HGOTO_ERROR(H5E_DATASPACE, H5E_CANTDELETE, NULL, "can't release selection")
+ if(NULL == space2->select.sel_info.hslab->span_lst) {
+ hsize_t tmp_start[H5S_MAX_RANK];
+ hsize_t tmp_stride[H5S_MAX_RANK];
+ hsize_t tmp_count[H5S_MAX_RANK];
+ hsize_t tmp_block[H5S_MAX_RANK];
+ unsigned u;
+
+ for(u = 0; u < space2->extent.rank; u++) {
+ tmp_start[u] = space2->select.sel_info.hslab->diminfo.opt[u].start;
+ tmp_stride[u] = space2->select.sel_info.hslab->diminfo.opt[u].stride;
+ tmp_count[u] = space2->select.sel_info.hslab->diminfo.opt[u].count;
+ tmp_block[u] = space2->select.sel_info.hslab->diminfo.opt[u].block;
+ } /* end for */
- /* Allocate space for the hyperslab selection information */
- if((new_space->select.sel_info.hslab=H5FL_CALLOC(H5S_hyper_sel_t))==NULL)
- HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "can't allocate hyperslab info")
+ /* Combine hyperslab selection with regular selection directly */
+ if(H5S_combine_hyperslab(space1, op, tmp_start, tmp_stride, tmp_count, tmp_block, &new_space) < 0)
+ HGOTO_ERROR(H5E_DATASPACE, H5E_CANTINIT, NULL, "unable to set hyperslab selection")
+ } /* end if */
+ else{
+ /* Combine new_space (a copy of space 1) & space2, with the result in new_space */
+ if(H5S__fill_in_select(space1, op, space2, &new_space) < 0)
+ HGOTO_ERROR(H5E_DATASPACE, H5E_CANTCLIP, NULL, "can't clip hyperslab information")
+ } /* end else */
/* Set unlim_dim */
new_space->select.sel_info.hslab->unlim_dim = -1;
- /* Combine space1 & space2, with the result in new_space */
- if(H5S_operate_hyperslab(new_space,space1->select.sel_info.hslab->span_lst,op,space2->select.sel_info.hslab->span_lst,FALSE,&span2_owned)<0)
- HGOTO_ERROR(H5E_DATASPACE, H5E_CANTCLIP, NULL, "can't clip hyperslab information")
-
/* Set return value */
ret_value = new_space;
@@ -7726,7 +10577,7 @@ done:
H5S_seloper_t op; IN: Selection operation
hid_t space2; IN: Second Dataspace ID
RETURNS
- Dataspace ID on success/Negative on failure
+ Dataspace ID on success / H5I_INVALID_HID on failure
DESCRIPTION
Combine two existing hyperslab selections with an operation, returning
a new dataspace with the resulting selection. The dataspace extent from
@@ -7744,32 +10595,42 @@ H5Scombine_select(hid_t space1_id, H5S_seloper_t op, hid_t space2_id)
H5S_t *new_space = NULL; /* New Dataspace */
hid_t ret_value; /* Return value */
- FUNC_ENTER_API(FAIL)
+ FUNC_ENTER_API(H5I_INVALID_HID)
H5TRACE3("i", "iSsi", space1_id, op, space2_id);
/* Check args */
if(NULL == (space1 = (H5S_t *)H5I_object_verify(space1_id, H5I_DATASPACE)))
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataspace")
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not a dataspace")
if(NULL == (space2 = (H5S_t *)H5I_object_verify(space2_id, H5I_DATASPACE)))
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataspace")
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not a dataspace")
if(!(op >= H5S_SELECT_OR && op <= H5S_SELECT_NOTA))
- HGOTO_ERROR(H5E_ARGS, H5E_UNSUPPORTED, FAIL, "invalid selection operation")
+ HGOTO_ERROR(H5E_ARGS, H5E_UNSUPPORTED, H5I_INVALID_HID, "invalid selection operation")
/* Check that both dataspaces have the same rank */
if(space1->extent.rank != space2->extent.rank)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "dataspaces not same rank")
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5I_INVALID_HID, "dataspaces not same rank")
+
+ /* Note: currently, the offset of each dataspace is ignored */
+#if 0
+ /* Check that both dataspaces have the same offset */
+ /* Same note as in H5Smodify_select */
+ for(u=0; u<space1->extent.rank; u++) {
+ if(space1->select.offset[u] != space2->select.offset[u])
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5I_INVALID_HID, "dataspaces not same offset")
+ } /* end for */
+#endif
/* Check that both dataspaces have hyperslab selections */
if(H5S_GET_SELECT_TYPE(space1) != H5S_SEL_HYPERSLABS || H5S_GET_SELECT_TYPE(space2) != H5S_SEL_HYPERSLABS)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "dataspaces don't have hyperslab selections")
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5I_INVALID_HID, "dataspaces don't have hyperslab selections")
/* Go combine the dataspaces */
if(NULL == (new_space = H5S__combine_select(space1, op, space2)))
- HGOTO_ERROR(H5E_DATASPACE, H5E_CANTINIT, FAIL, "unable to create hyperslab selection")
+ HGOTO_ERROR(H5E_DATASPACE, H5E_CANTINIT, H5I_INVALID_HID, "unable to create hyperslab selection")
/* Atomize */
if((ret_value = H5I_register(H5I_DATASPACE, new_space, TRUE)) < 0)
- HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, FAIL, "unable to register dataspace atom")
+ HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register dataspace atom")
done:
if(ret_value < 0 && new_space)
@@ -7780,77 +10641,73 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5S_select_select
+ * Function: H5S__modify_select
*
- * Purpose: Internal version of H5Sselect_select().
+ * Purpose: Internal version of H5Smodify_select().
*
* Return: New dataspace on success/NULL on failure
*
* Programmer: Quincey Koziol
* Tuesday, October 30, 2001
*
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
-static herr_t
-H5S_select_select (H5S_t *space1, H5S_seloper_t op, H5S_t *space2)
+herr_t
+H5S__modify_select(H5S_t *space1, H5S_seloper_t op, H5S_t *space2)
{
- H5S_hyper_span_info_t *tmp_spans=NULL; /* Temporary copy of selection */
- hbool_t span2_owned=FALSE; /* Flag to indicate that span2 was used in H5S_operate_hyperslab() */
- herr_t ret_value=SUCCEED; /* Return value */
+ herr_t ret_value = SUCCEED; /* Return value */
- FUNC_ENTER_NOAPI_NOINIT
+ FUNC_ENTER_PACKAGE
/* Check args */
HDassert(space1);
HDassert(space2);
- HDassert(op > H5S_SELECT_NOOP && op < H5S_SELECT_INVALID);
+ HDassert(op >= H5S_SELECT_OR && op <= H5S_SELECT_NOTA);
/* Check that the space selections both have span trees */
- if(space1->select.sel_info.hslab->span_lst==NULL)
- if(H5S__hyper_generate_spans(space1)<0)
- HGOTO_ERROR(H5E_DATASPACE, H5E_UNINITIALIZED, FAIL, "dataspace does not have span tree")
- if(space2->select.sel_info.hslab->span_lst==NULL)
- if(H5S__hyper_generate_spans(space2)<0)
+ if(NULL == space1->select.sel_info.hslab->span_lst)
+ if(H5S__hyper_generate_spans(space1) < 0)
HGOTO_ERROR(H5E_DATASPACE, H5E_UNINITIALIZED, FAIL, "dataspace does not have span tree")
- /* Take ownership of the dataspace's hyperslab spans */
- /* (These are freed later) */
- tmp_spans=space1->select.sel_info.hslab->span_lst;
- space1->select.sel_info.hslab->span_lst=NULL;
-
- /* Reset the other dataspace selection information */
- if(H5S_SELECT_RELEASE(space1)<0)
- HGOTO_ERROR(H5E_DATASPACE, H5E_CANTDELETE, FAIL, "can't release selection")
-
- /* Allocate space for the hyperslab selection information */
- if((space1->select.sel_info.hslab=H5FL_CALLOC(H5S_hyper_sel_t))==NULL)
- HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "can't allocate hyperslab info")
-
/* Set unlim_dim */
space1->select.sel_info.hslab->unlim_dim = -1;
- /* Combine tmp_spans (from space1) & spans from space2, with the result in space1 */
- if(H5S_operate_hyperslab(space1,tmp_spans,op,space2->select.sel_info.hslab->span_lst,FALSE,&span2_owned)<0)
- HGOTO_ERROR(H5E_DATASPACE, H5E_CANTCLIP, FAIL, "can't clip hyperslab information")
+ if(NULL == space2->select.sel_info.hslab->span_lst) {
+ hsize_t tmp_start[H5S_MAX_RANK];
+ hsize_t tmp_stride[H5S_MAX_RANK];
+ hsize_t tmp_count[H5S_MAX_RANK];
+ hsize_t tmp_block[H5S_MAX_RANK];
+ unsigned u;
+
+ for(u = 0; u < space2->extent.rank; u++) {
+ tmp_start[u] = space2->select.sel_info.hslab->diminfo.opt[u].start;
+ tmp_stride[u] = space2->select.sel_info.hslab->diminfo.opt[u].stride;
+ tmp_count[u] = space2->select.sel_info.hslab->diminfo.opt[u].count;
+ tmp_block[u] = space2->select.sel_info.hslab->diminfo.opt[u].block;
+ } /* end for */
-done:
- if(tmp_spans!=NULL)
- H5S__hyper_free_span_info(tmp_spans);
+ /* Call H5S_select_hyperslab directly */
+ if(H5S_select_hyperslab(space1, op, tmp_start, tmp_stride, tmp_count, tmp_block) < 0)
+ HGOTO_ERROR(H5E_DATASPACE, H5E_CANTINIT, FAIL, "unable to set hyperslab selection")
+ } /* end if */
+ else
+ /* Combine spans from space1 & spans from space2, with the result in space1 */
+ if(H5S__fill_in_select(space1, op, space2, &space1) < 0)
+ HGOTO_ERROR(H5E_DATASPACE, H5E_CANTCLIP, FAIL, "can't perform operation on two selections")
+done:
FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5S_select_select() */
+} /* end H5S__modify_select() */
/*--------------------------------------------------------------------------
NAME
- H5Sselect_select
+ H5Smodify_select
PURPOSE
Refine a hyperslab selection with an operation using a second hyperslab
- to modify it.
+ to modify it
USAGE
- herr_t H5Sselect_select(space1, op, space2)
+ herr_t H5Smodify_select(space1, op, space2)
hid_t space1; IN/OUT: First Dataspace ID
H5S_seloper_t op; IN: Selection operation
hid_t space2; IN: Second Dataspace ID
@@ -7866,7 +10723,7 @@ done:
REVISION LOG
--------------------------------------------------------------------------*/
herr_t
-H5Sselect_select(hid_t space1_id, H5S_seloper_t op, hid_t space2_id)
+H5Smodify_select(hid_t space1_id, H5S_seloper_t op, hid_t space2_id)
{
H5S_t *space1; /* First Dataspace */
H5S_t *space2; /* Second Dataspace */
@@ -7887,1348 +10744,615 @@ H5Sselect_select(hid_t space1_id, H5S_seloper_t op, hid_t space2_id)
if(space1->extent.rank != space2->extent.rank)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "dataspaces not same rank")
+ /* Check that both dataspaces have the same offset */
+ /** Note that this is a tricky part of this function. It's
+ * possible that two dataspaces have different "offset". If the
+ * space2 has smaller offset value than that of space1 in a
+ * dimension, then the span elements of this dimension in
+ * space2 could have negative "low" and "high" values relative
+ * to the offset in space1. In other words, if the bounds of
+ * span elements in space2 are adjusted relative to the offset
+ * in space1, then every span element's bound is computed as
+ * "origin_bound+offset2-offset1". Therefore, if offset2 (the
+ * offset of space2) is smaller, then
+ * "origin_bound+offset2-offset1" could be negative which is
+ * not allowed by the bound type declaration as hsize_t!
+ * As a result, if the op is an OR selection, then the final
+ * result may contain span elements that have negative bound!
+ * So right now, the difference in the offset is totally
+ * ignored!!
+ */
+#if 0
+ for(u=0; u<space1->extent.rank; u++) {
+ if(space1->select.offset[u] != space2->select.offset[u])
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "dataspaces not same offset")
+ } /* end for */
+#endif
+
/* Check that both dataspaces have hyperslab selections */
if(H5S_GET_SELECT_TYPE(space1) != H5S_SEL_HYPERSLABS || H5S_GET_SELECT_TYPE(space2) != H5S_SEL_HYPERSLABS)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "dataspaces don't have hyperslab selections")
/* Go refine the first selection */
- if (H5S_select_select(space1, op, space2)<0)
+ if(H5S__modify_select(space1, op, space2) < 0)
HGOTO_ERROR(H5E_DATASPACE, H5E_CANTINIT, FAIL, "unable to modify hyperslab selection")
done:
FUNC_LEAVE_API(ret_value)
-} /* end H5Sselect_select() */
-#endif /* NEW_HYPERSLAB_API */ /* Works */
+} /* end H5Smodify_select() */
/*--------------------------------------------------------------------------
NAME
- H5S__hyper_get_seq_list_gen
+ H5S__hyper_proj_int_build_proj
PURPOSE
- Create a list of offsets & lengths for a selection
+ Secondary iteration routine for H5S__hyper_project_intersection
USAGE
- herr_t H5S_select_hyper_get_file_list_gen(space,iter,maxseq,maxelem,nseq,nelem,off,len)
- H5S_t *space; IN: Dataspace containing selection to use.
- H5S_sel_iter_t *iter; IN/OUT: Selection iterator describing last
- position of interest in selection.
- size_t maxseq; IN: Maximum number of sequences to generate
- size_t maxelem; IN: Maximum number of elements to include in the
- generated sequences
- size_t *nseq; OUT: Actual number of sequences generated
- size_t *nelem; OUT: Actual number of elements in sequences generated
- hsize_t *off; OUT: Array of offsets
- size_t *len; OUT: Array of lengths
+ herr_t H5S__hyper_proj_int_build_proj(udata)
+ H5S_hyper_project_intersect_ud_t *udata; IN/OUT: Persistent shared data for iteration
RETURNS
Non-negative on success/Negative on failure.
DESCRIPTION
- Use the selection in the dataspace to generate a list of byte offsets and
- lengths for the region(s) selected. Start/Restart from the position in the
- ITER parameter. The number of sequences generated is limited by the MAXSEQ
- parameter and the number of sequences actually generated is stored in the
- NSEQ parameter.
+ Takes the skip and nelem amounts listed in udata and converts them to
+ span trees in the projected space, using the destination space. This
+ is a non-recursive algorithm by necessity, it saves the current state
+ of iteration in udata and resumes in the same location on subsequent
+ calls.
GLOBAL VARIABLES
COMMENTS, BUGS, ASSUMPTIONS
EXAMPLES
REVISION LOG
--------------------------------------------------------------------------*/
static herr_t
-H5S__hyper_get_seq_list_gen(const H5S_t *space, H5S_sel_iter_t *iter,
- size_t maxseq, size_t maxelem, size_t *nseq, size_t *nelem,
- hsize_t *off, size_t *len)
-{
- H5S_hyper_span_t *curr_span; /* Current hyperslab span node */
- H5S_hyper_span_t **ispan; /* Iterator's hyperslab span nodes */
- hsize_t slab[H5O_LAYOUT_NDIMS]; /* Cumulative size of each dimension in bytes */
- hsize_t acc; /* Accumulator for computing cumulative sizes */
- hsize_t loc_off; /* Element offset in the dataspace */
- hsize_t last_span_end = 0; /* The offset of the end of the last span */
- hsize_t *abs_arr; /* Absolute hyperslab span position */
- const hssize_t *off_arr; /* Offset within the dataspace extent */
- size_t span_size = 0; /* Number of bytes in current span to actually process */
- size_t io_left; /* Number of elements left to process */
- size_t io_bytes_left; /* Number of bytes left to process */
- size_t io_used; /* Number of elements processed */
- size_t curr_seq = 0; /* Number of sequence/offsets stored in the arrays */
- size_t elem_size; /* Size of each element iterating over */
- unsigned ndims; /* Number of dimensions of dataset */
- unsigned fast_dim; /* Rank of the fastest changing dimension for the dataspace */
- int curr_dim; /* Current dimension being operated on */
- unsigned u; /* Index variable */
- int i; /* Index variable */
-
- FUNC_ENTER_STATIC_NOERR
-
- /* Check args */
- HDassert(space);
- HDassert(iter);
- HDassert(maxseq > 0);
- HDassert(maxelem > 0);
- HDassert(nseq);
- HDassert(nelem);
- HDassert(off);
- HDassert(len);
-
- /* Set the rank of the fastest changing dimension */
- ndims = space->extent.rank;
- fast_dim = (ndims - 1);
-
- /* Get the pointers to the current span info and span nodes */
- curr_span = iter->u.hyp.span[fast_dim];
- abs_arr = iter->u.hyp.off;
- off_arr = space->select.offset;
- ispan = iter->u.hyp.span;
- elem_size = iter->elmt_size;
-
- /* Set the amount of elements to perform I/O on, etc. */
- H5_CHECK_OVERFLOW(iter->elmt_left, hsize_t, size_t);
- io_left = MIN(maxelem, (size_t)iter->elmt_left);
- io_bytes_left = io_left * elem_size;
-
- /* Compute the cumulative size of dataspace dimensions */
- for(i = (int)fast_dim, acc = elem_size; i >= 0; i--) {
- slab[i] = acc;
- acc *= space->extent.size[i];
- } /* end for */
-
- /* Set the offset of the first element iterated on */
- for(u = 0, loc_off = 0; u < ndims; u++)
- /* Compute the sequential element offset */
- loc_off += ((hsize_t)((hssize_t)abs_arr[u] + off_arr[u])) * slab[u];
-
- /* Range check against number of elements left in selection */
- HDassert(io_bytes_left <= (iter->elmt_left * elem_size));
-
- /* Take care of any partial spans leftover from previous I/Os */
- if(abs_arr[fast_dim]!=curr_span->low) {
-
- /* Finish the span in the fastest changing dimension */
-
- /* Compute the number of bytes to attempt in this span */
- H5_CHECKED_ASSIGN(span_size, size_t, ((curr_span->high-abs_arr[fast_dim])+1)*elem_size, hsize_t);
-
- /* Check number of bytes against upper bounds allowed */
- if(span_size>io_bytes_left)
- span_size=io_bytes_left;
-
- /* Add the partial span to the list of sequences */
- off[curr_seq]=loc_off;
- len[curr_seq]=span_size;
-
- /* Increment sequence count */
- curr_seq++;
-
- /* Set the location of the last span's end */
- last_span_end=loc_off+span_size;
-
- /* Decrement I/O left to perform */
- io_bytes_left-=span_size;
+H5S__hyper_proj_int_build_proj(H5S_hyper_project_intersect_ud_t *udata) {
+ herr_t ret_value = SUCCEED; /* Return value */
- /* Advance the hyperslab iterator */
- /* Check if we are done */
- if(io_bytes_left > 0) {
- /* Move to next span in fastest changing dimension */
- curr_span = curr_span->next;
+ FUNC_ENTER_STATIC
- if(NULL != curr_span) {
- /* Move location offset of destination */
- loc_off += (curr_span->low - abs_arr[fast_dim]) * elem_size;
+ HDassert(udata->nelem > 0);
- /* Move iterator for fastest changing dimension */
- abs_arr[fast_dim] = curr_span->low;
- } /* end if */
- } /* end if */
- else {
- abs_arr[fast_dim] += span_size / elem_size;
+ /*
+ * Skip over skipped elements
+ */
+ if(udata->skip > 0) {
+ /* Work upwards, finishing each span tree before moving up */
+ HDassert(udata->ds_span[udata->depth]);
+ do {
+ /* Check for lowest dimension */
+ if(udata->ds_span[udata->depth]->down) {
+ if(udata->ds_low[udata->depth] <= udata->ds_span[udata->depth]->high) {
+ /* If we will run out of elements to skip in this span,
+ * advance to the first not fully skipped span and break
+ * out of this loop (start moving downwards) */
+ if(udata->skip < H5S__hyper_spans_nelem_helper(udata->ds_span[udata->depth]->down, udata->op_gen)
+ * (udata->ds_span[udata->depth]->high - udata->ds_low[udata->depth] + 1)) {
+ udata->ds_low[udata->depth] += udata->skip / udata->ds_span[udata->depth]->down->u.nelmts;
+ udata->skip %= udata->ds_span[udata->depth]->down->u.nelmts;
+ break;
+ } /* end if */
- /* Check if we are still within the span */
- if(abs_arr[fast_dim] <= curr_span->high) {
- iter->u.hyp.span[fast_dim] = curr_span;
+ /* Skip over this entire span */
+ udata->skip -= udata->ds_span[udata->depth]->down->u.nelmts
+ * (udata->ds_span[udata->depth]->high - udata->ds_low[udata->depth] + 1);
+ } /* end if */
} /* end if */
- /* If we walked off that span, advance to the next span */
else {
- /* Advance span in this dimension */
- curr_span = curr_span->next;
-
- /* Check if we have a valid span in this dimension still */
- if(NULL != curr_span) {
- /* Reset absolute position */
- abs_arr[fast_dim] = curr_span->low;
- iter->u.hyp.span[fast_dim] = curr_span;
- } /* end if */
- } /* end else */
- } /* end else */
-
- /* Adjust iterator pointers */
-
- if(NULL == curr_span) {
-/* Same as code in main loop */
- /* Start at the next fastest dim */
- curr_dim = (int)(fast_dim - 1);
-
- /* Work back up through the dimensions */
- while(curr_dim >= 0) {
- /* Reset the current span */
- curr_span = iter->u.hyp.span[curr_dim];
-
- /* Increment absolute position */
- abs_arr[curr_dim]++;
-
- /* Check if we are still within the span */
- if(abs_arr[curr_dim] <= curr_span->high) {
+ HDassert(udata->ds_rank - udata->depth == 1);
+
+ /* If we will run out of elements to skip in this span,
+ * skip the remainder of the skipped elements and break out */
+ HDassert(udata->ds_low[udata->depth] <= udata->ds_span[udata->depth]->high);
+ if(udata->skip < (udata->ds_span[udata->depth]->high - udata->ds_low[udata->depth] + 1)) {
+ udata->ds_low[udata->depth] += udata->skip;
+ udata->skip = 0;
break;
} /* end if */
- /* If we walked off that span, advance to the next span */
- else {
- /* Advance span in this dimension */
- curr_span = curr_span->next;
- /* Check if we have a valid span in this dimension still */
- if(NULL != curr_span) {
- /* Reset the span in the current dimension */
- ispan[curr_dim] = curr_span;
+ /* Skip over this entire span */
+ udata->skip -= udata->ds_span[udata->depth]->high - udata->ds_low[udata->depth] + 1;
+ } /* end else */
- /* Reset absolute position */
- abs_arr[curr_dim] = curr_span->low;
+ /* Advance to next span */
+ udata->ds_span[udata->depth] = udata->ds_span[udata->depth]->next;
+ if(udata->ds_span[udata->depth])
+ udata->ds_low[udata->depth] = udata->ds_span[udata->depth]->low;
+ else if(udata->depth > 0) {
+ /* If present, append this span tree to the higher dimension's,
+ * and release ownership of it */
+ if(udata->ps_span_info[udata->depth]) {
+ if(H5S__hyper_append_span(&udata->ps_span_info[udata->depth - 1],
+ udata->ds_rank - udata->depth + 1, udata->ds_low[udata->depth - 1],
+ udata->ds_low[udata->depth - 1],
+ udata->ps_span_info[udata->depth]) < 0)
+ HGOTO_ERROR(H5E_DATASPACE, H5E_CANTAPPEND, FAIL, "can't allocate hyperslab span")
+ H5S__hyper_free_span_info(udata->ps_span_info[udata->depth]);
+ udata->ps_span_info[udata->depth] = NULL;
+ } /* end if */
+ /* Ran out of spans, move up one dimension */
+ udata->depth--;
+ HDassert(udata->ds_span[udata->depth]);
+ udata->ds_low[udata->depth]++;
+ } /* end if */
+ else
+ HGOTO_ERROR(H5E_DATASPACE, H5E_BADVALUE, FAIL, "insufficient elements in destination selection")
+ } while((udata->skip > 0)
+ || (udata->ds_low[udata->depth] > udata->ds_span[udata->depth]->high));
+
+ /* Work downwards until skip is 0 */
+ HDassert(udata->ds_span[udata->depth]);
+ while(udata->skip > 0) {
+ HDassert(udata->ds_span[udata->depth]->down);
+ udata->depth++;
+ udata->ds_span[udata->depth] = udata->ds_span[udata->depth - 1]->down->head;
+ udata->ds_low[udata->depth] = udata->ds_span[udata->depth]->low;
+ if(udata->ds_span[udata->depth]->down) {
+ do {
+ /* If we will run out of elements to skip in this span,
+ * advance to the first not fully skipped span and
+ * continue down */
+ if(udata->skip < H5S__hyper_spans_nelem_helper(udata->ds_span[udata->depth]->down, udata->op_gen)
+ * (udata->ds_span[udata->depth]->high - udata->ds_low[udata->depth] + 1)) {
+ udata->ds_low[udata->depth] += udata->skip / udata->ds_span[udata->depth]->down->u.nelmts;
+ udata->skip %= udata->ds_span[udata->depth]->down->u.nelmts;
break;
} /* end if */
- else {
- /* If we finished the span list in this dimension, decrement the dimension worked on and loop again */
- curr_dim--;
- } /* end else */
- } /* end else */
- } /* end while */
-
- /* Check if we have more spans in the tree */
- if(curr_dim >= 0) {
- /* Walk back down the iterator positions, resetting them */
- while((unsigned)curr_dim < fast_dim) {
- HDassert(curr_span);
- HDassert(curr_span->down);
- HDassert(curr_span->down->head);
-
- /* Increment current dimension */
- curr_dim++;
-
- /* Set the new span_info & span for this dimension */
- iter->u.hyp.span[curr_dim] = curr_span->down->head;
-
- /* Advance span down the tree */
- curr_span = curr_span->down->head;
-
- /* Reset the absolute offset for the dim */
- abs_arr[curr_dim] = curr_span->low;
- } /* end while */
-
- /* Verify that the curr_span points to the fastest dim */
- HDassert(curr_span == iter->u.hyp.span[fast_dim]);
-
- /* Reset the buffer offset */
- for(u = 0, loc_off = 0; u < ndims; u++)
- loc_off += ((hsize_t)((hssize_t)abs_arr[u] + off_arr[u])) * slab[u];
- } /* end else */
- else
- /* We had better be done with I/O or bad things are going to happen... */
- HDassert(io_bytes_left == 0);
- } /* end if */
- } /* end if */
-
- /* Perform the I/O on the elements, based on the position of the iterator */
- while(io_bytes_left > 0 && curr_seq < maxseq) {
- /* Sanity check */
- HDassert(curr_span);
-
- /* Adjust location offset of destination to compensate for initial increment below */
- loc_off -= curr_span->pstride;
- /* Loop over all the spans in the fastest changing dimension */
- while(curr_span != NULL) {
- /* Move location offset of destination */
- loc_off += curr_span->pstride;
-
- /* Compute the number of elements to attempt in this span */
- H5_CHECKED_ASSIGN(span_size, size_t, curr_span->nelem, hsize_t);
-
- /* Check number of elements against upper bounds allowed */
- if(span_size >= io_bytes_left) {
- /* Trim the number of bytes to output */
- span_size = io_bytes_left;
- io_bytes_left = 0;
-
-/* COMMON */
- /* Store the I/O information for the span */
+ /* Skip over this entire span */
+ udata->skip -= udata->ds_span[udata->depth]->down->u.nelmts
+ * (udata->ds_span[udata->depth]->high - udata->ds_low[udata->depth] + 1);
- /* Check if this is appending onto previous sequence */
- if(curr_seq > 0 && last_span_end == loc_off)
- len[curr_seq - 1] += span_size;
- else {
- off[curr_seq] = loc_off;
- len[curr_seq] = span_size;
-
- /* Increment the number of sequences in arrays */
- curr_seq++;
- } /* end else */
-
- /* Set the location of the last span's end */
- last_span_end = loc_off + span_size;
-/* end COMMON */
-
- /* Break out now, we are finished with I/O */
- break;
+ /* Advance to next span */
+ udata->ds_span[udata->depth] = udata->ds_span[udata->depth]->next;
+ HDassert(udata->ds_span[udata->depth]);
+ udata->ds_low[udata->depth] = udata->ds_span[udata->depth]->low;
+ } while(udata->skip > 0);
} /* end if */
else {
- /* Decrement I/O left to perform */
- io_bytes_left -= span_size;
-
-/* COMMON */
- /* Store the I/O information for the span */
-
- /* Check if this is appending onto previous sequence */
- if(curr_seq > 0 && last_span_end == loc_off)
- len[curr_seq-1]+=span_size;
- else {
- off[curr_seq] = loc_off;
- len[curr_seq] = span_size;
-
- /* Increment the number of sequences in arrays */
- curr_seq++;
- } /* end else */
+ do {
+ /* If we will run out of elements to skip in this span,
+ * skip the remainder of the skipped elements */
+ if(udata->skip < (udata->ds_span[udata->depth]->high - udata->ds_low[udata->depth] + 1)) {
+ udata->ds_low[udata->depth] += udata->skip;
+ udata->skip = 0;
+ break;
+ } /* end if */
- /* Set the location of the last span's end */
- last_span_end = loc_off + span_size;
-/* end COMMON */
+ /* Skip over this entire span */
+ udata->skip -= udata->ds_span[udata->depth]->high - udata->ds_low[udata->depth] + 1;
- /* If the sequence & offset arrays are full, do what? */
- if(curr_seq >= maxseq) {
- /* Break out now, we are finished with sequences */
- break;
- } /* end else */
+ /* Advance to next span */
+ udata->ds_span[udata->depth] = udata->ds_span[udata->depth]->next;
+ HDassert(udata->ds_span[udata->depth]);
+ udata->ds_low[udata->depth] = udata->ds_span[udata->depth]->low;
+ } while(udata->skip > 0);
} /* end else */
-
- /* Move to next span in fastest changing dimension */
- curr_span=curr_span->next;
} /* end while */
+ } /* end if */
- /* Check if we are done */
- if(io_bytes_left==0 || curr_seq>=maxseq) {
- HDassert(curr_span);
- abs_arr[fast_dim]=curr_span->low+(span_size/elem_size);
-
- /* Check if we are still within the span */
- if(abs_arr[fast_dim]<=curr_span->high) {
- iter->u.hyp.span[fast_dim]=curr_span;
- break;
- } /* end if */
- /* If we walked off that span, advance to the next span */
- else {
- /* Advance span in this dimension */
- curr_span=curr_span->next;
-
- /* Check if we have a valid span in this dimension still */
- if(curr_span!=NULL) {
- /* Reset absolute position */
- abs_arr[fast_dim]=curr_span->low;
- iter->u.hyp.span[fast_dim]=curr_span;
+ /*
+ * Add requested number of elements to projected space
+ */
+ /* Work upwards, adding all elements of each span tree until it can't fit
+ * all elements */
+ HDassert(udata->ds_span[udata->depth]);
+ do {
+ /* Check for lowest dimension */
+ if(udata->ds_span[udata->depth]->down) {
+ if(udata->ds_low[udata->depth] <= udata->ds_span[udata->depth]->high) {
+ /* If we will run out of elements to add in this span, add
+ * any complete spans, advance to the first not fully added
+ * span, and break out of this loop (start moving downwards)
+ */
+ if(udata->nelem < H5S__hyper_spans_nelem_helper(udata->ds_span[udata->depth]->down, udata->op_gen)
+ * (udata->ds_span[udata->depth]->high - udata->ds_low[udata->depth] + 1)) {
+ if(udata->nelem >= udata->ds_span[udata->depth]->down->u.nelmts) {
+ if(H5S__hyper_append_span(&udata->ps_span_info[udata->depth],
+ udata->ds_rank - udata->depth, udata->ds_low[udata->depth],
+ udata->ds_low[udata->depth] + (udata->nelem / udata->ds_span[udata->depth]->down->u.nelmts) - 1,
+ udata->ds_span[udata->depth]->down) < 0)
+ HGOTO_ERROR(H5E_DATASPACE, H5E_CANTAPPEND, FAIL, "can't allocate hyperslab span")
+ udata->ds_low[udata->depth] += udata->nelem / udata->ds_span[udata->depth]->down->u.nelmts;
+ udata->nelem %= udata->ds_span[udata->depth]->down->u.nelmts;
+ } /* end if */
break;
} /* end if */
- } /* end else */
- } /* end if */
-
- /* Adjust iterator pointers */
-
- /* Start at the next fastest dim */
- curr_dim = (int)(fast_dim - 1);
- /* Work back up through the dimensions */
- while(curr_dim >= 0) {
- /* Reset the current span */
- curr_span=iter->u.hyp.span[curr_dim];
-
- /* Increment absolute position */
- abs_arr[curr_dim]++;
-
- /* Check if we are still within the span */
- if(abs_arr[curr_dim]<=curr_span->high) {
+ /* Append span tree for entire span */
+ if(H5S__hyper_append_span(&udata->ps_span_info[udata->depth],
+ udata->ds_rank - udata->depth, udata->ds_low[udata->depth],
+ udata->ds_span[udata->depth]->high,
+ udata->ds_span[udata->depth]->down) < 0)
+ HGOTO_ERROR(H5E_DATASPACE, H5E_CANTAPPEND, FAIL, "can't allocate hyperslab span")
+ udata->nelem -= udata->ds_span[udata->depth]->down->u.nelmts
+ * (udata->ds_span[udata->depth]->high - udata->ds_low[udata->depth] + 1);
+ } /* end if */
+ } /* end if */
+ else {
+ HDassert(udata->ds_rank - udata->depth == 1);
+
+ /* If we will run out of elements to add in this span, add the
+ * remainder of the elements and break out */
+ HDassert(udata->ds_low[udata->depth] <= udata->ds_span[udata->depth]->high);
+ if(udata->nelem < (udata->ds_span[udata->depth]->high - udata->ds_low[udata->depth] + 1)) {
+ if(H5S__hyper_append_span(&udata->ps_span_info[udata->depth], 1,
+ udata->ds_low[udata->depth], udata->ds_low[udata->depth] + udata->nelem - 1, NULL) < 0)
+ HGOTO_ERROR(H5E_DATASPACE, H5E_CANTAPPEND, FAIL, "can't allocate hyperslab span")
+ udata->ds_low[udata->depth] += udata->nelem;
+ udata->nelem = 0;
break;
} /* end if */
- /* If we walked off that span, advance to the next span */
- else {
- /* Advance span in this dimension */
- curr_span=curr_span->next;
- /* Check if we have a valid span in this dimension still */
- if(curr_span!=NULL) {
- /* Reset the span in the current dimension */
- ispan[curr_dim]=curr_span;
+ /* Append span tree for entire span */
+ if(H5S__hyper_append_span(&udata->ps_span_info[udata->depth], 1,
+ udata->ds_low[udata->depth], udata->ds_span[udata->depth]->high, NULL) < 0)
+ HGOTO_ERROR(H5E_DATASPACE, H5E_CANTAPPEND, FAIL, "can't allocate hyperslab span")
+ udata->nelem -= udata->ds_span[udata->depth]->high - udata->ds_low[udata->depth] + 1;
+ } /* end else */
- /* Reset absolute position */
- abs_arr[curr_dim]=curr_span->low;
+ /* Advance to next span */
+ udata->ds_span[udata->depth] = udata->ds_span[udata->depth]->next;
+ if(udata->ds_span[udata->depth])
+ udata->ds_low[udata->depth] = udata->ds_span[udata->depth]->low;
+ else if(udata->depth > 0) {
+ /* Append this span tree to the higher dimension's, and release
+ * ownership of it */
+ HDassert(udata->ps_span_info[udata->depth]);
+ if(H5S__hyper_append_span(&udata->ps_span_info[udata->depth - 1],
+ udata->ds_rank - udata->depth + 1, udata->ds_low[udata->depth - 1],
+ udata->ds_low[udata->depth - 1],
+ udata->ps_span_info[udata->depth]) < 0)
+ HGOTO_ERROR(H5E_DATASPACE, H5E_CANTAPPEND, FAIL, "can't allocate hyperslab span")
+ H5S__hyper_free_span_info(udata->ps_span_info[udata->depth]);
+ udata->ps_span_info[udata->depth] = NULL;
+ /* Ran out of spans, move up one dimension */
+ udata->depth--;
+ HDassert(udata->ds_span[udata->depth]);
+ udata->ds_low[udata->depth]++;
+ } /* end if */
+ else {
+ /* We have finished the entire destination span tree. If there are
+ * still elements to add, issue an error. */
+ if(udata->nelem > 0)
+ HGOTO_ERROR(H5E_DATASPACE, H5E_BADVALUE, FAIL, "insufficient elements in destination selection")
+ break;
+ } /* end else */
+ } while((udata->nelem > 0)
+ || (udata->ds_low[udata->depth] > udata->ds_span[udata->depth]->high));
+
+ /* Work downwards until nelem is 0 */
+ HDassert(udata->ds_span[udata->depth] || (udata->nelem == 0));
+ while(udata->nelem > 0) {
+ HDassert(udata->ds_span[udata->depth]->down);
+ udata->depth++;
+ udata->ds_span[udata->depth] = udata->ds_span[udata->depth - 1]->down->head;
+ udata->ds_low[udata->depth] = udata->ds_span[udata->depth]->low;
+ if(udata->ds_span[udata->depth]->down) {
+ do {
+ /* If we will run out of elements to add in this span, add
+ * any complete spans, advance to the first not fully added
+ * span and continue down
+ */
+ HDassert(udata->ds_low[udata->depth] <= udata->ds_span[udata->depth]->high);
+ if(udata->nelem < H5S__hyper_spans_nelem_helper(udata->ds_span[udata->depth]->down, udata->op_gen)
+ * (udata->ds_span[udata->depth]->high - udata->ds_low[udata->depth] + 1)) {
+ if(udata->nelem >= udata->ds_span[udata->depth]->down->u.nelmts) {
+ if(H5S__hyper_append_span(&udata->ps_span_info[udata->depth],
+ udata->ds_rank - udata->depth, udata->ds_low[udata->depth],
+ udata->ds_low[udata->depth] + (udata->nelem / udata->ds_span[udata->depth]->down->u.nelmts) - 1,
+ udata->ds_span[udata->depth]->down) < 0)
+ HGOTO_ERROR(H5E_DATASPACE, H5E_CANTAPPEND, FAIL, "can't allocate hyperslab span")
+ udata->ds_low[udata->depth] += udata->nelem / udata->ds_span[udata->depth]->down->u.nelmts;
+ udata->nelem %= udata->ds_span[udata->depth]->down->u.nelmts;
+ } /* end if */
break;
} /* end if */
- else {
- /* If we finished the span list in this dimension, decrement the dimension worked on and loop again */
- curr_dim--;
- } /* end else */
- } /* end else */
- } /* end while */
- /* Check if we are finished with the spans in the tree */
- if(curr_dim < 0) {
- /* We had better be done with I/O or bad things are going to happen... */
- HDassert(io_bytes_left == 0);
- break;
+ /* Append span tree for entire span */
+ if(H5S__hyper_append_span(&udata->ps_span_info[udata->depth],
+ udata->ds_rank - udata->depth, udata->ds_low[udata->depth],
+ udata->ds_span[udata->depth]->high,
+ udata->ds_span[udata->depth]->down) < 0)
+ HGOTO_ERROR(H5E_DATASPACE, H5E_CANTAPPEND, FAIL, "can't allocate hyperslab span")
+ udata->nelem -= udata->ds_span[udata->depth]->down->u.nelmts
+ * (udata->ds_span[udata->depth]->high - udata->ds_low[udata->depth] + 1);
+
+ /* Advance to next span */
+ udata->ds_span[udata->depth] = udata->ds_span[udata->depth]->next;
+ HDassert(udata->ds_span[udata->depth]);
+ udata->ds_low[udata->depth] = udata->ds_span[udata->depth]->low;
+ } while(udata->nelem > 0);
} /* end if */
else {
- /* Walk back down the iterator positions, resetting them */
- while((unsigned)curr_dim < fast_dim) {
- HDassert(curr_span);
- HDassert(curr_span->down);
- HDassert(curr_span->down->head);
-
- /* Increment current dimension to the next dimension down */
- curr_dim++;
-
- /* Set the new span for the next dimension down */
- iter->u.hyp.span[curr_dim] = curr_span->down->head;
-
- /* Advance span down the tree */
- curr_span = curr_span->down->head;
-
- /* Reset the absolute offset for the dim */
- abs_arr[curr_dim] = curr_span->low;
- } /* end while */
+ HDassert(udata->ds_rank - udata->depth == 1);
+ do {
+ /* If we will run out of elements to add in this span, add
+ * the remainder of the elements and break out */
+ HDassert(udata->ds_low[udata->depth] <= udata->ds_span[udata->depth]->high);
+ if(udata->nelem < (udata->ds_span[udata->depth]->high - udata->ds_low[udata->depth] + 1)) {
+ if(H5S__hyper_append_span(&udata->ps_span_info[udata->depth], 1,
+ udata->ds_low[udata->depth], udata->ds_low[udata->depth] + udata->nelem - 1, NULL) < 0)
+ HGOTO_ERROR(H5E_DATASPACE, H5E_CANTAPPEND, FAIL, "can't allocate hyperslab span")
+ udata->ds_low[udata->depth] += udata->nelem;
+ udata->nelem = 0;
+ break;
+ } /* end if */
- /* Verify that the curr_span points to the fastest dim */
- HDassert(curr_span == iter->u.hyp.span[fast_dim]);
+ /* Append span tree for entire span */
+ if(H5S__hyper_append_span(&udata->ps_span_info[udata->depth], 1,
+ udata->ds_low[udata->depth], udata->ds_span[udata->depth]->high, NULL) < 0)
+ HGOTO_ERROR(H5E_DATASPACE, H5E_CANTAPPEND, FAIL, "can't allocate hyperslab span")
+ udata->nelem -= udata->ds_span[udata->depth]->high - udata->ds_low[udata->depth] + 1;
+
+ /* Advance to next span */
+ udata->ds_span[udata->depth] = udata->ds_span[udata->depth]->next;
+ HDassert(udata->ds_span[udata->depth]);
+ udata->ds_low[udata->depth] = udata->ds_span[udata->depth]->low;
+ } while(udata->nelem > 0);
} /* end else */
-
- /* Reset the buffer offset */
- for(u = 0, loc_off = 0; u < ndims; u++)
- loc_off += ((hsize_t)((hssize_t)abs_arr[u] + off_arr[u])) * slab[u];
} /* end while */
- /* Decrement number of elements left in iterator */
- io_used = (io_left - (io_bytes_left / elem_size));
- iter->elmt_left -= io_used;
-
- /* Set the number of sequences generated */
- *nseq = curr_seq;
+ HDassert(udata->skip == 0);
+ HDassert(udata->nelem == 0);
- /* Set the number of elements used */
- *nelem = io_used;
+ /* Mark projected space as changed (for all ranks) */
+ udata->ps_clean_bitmap = 0;
- FUNC_LEAVE_NOAPI(SUCCEED)
-} /* end H5S__hyper_get_seq_list_gen() */
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5S__hyper_proj_int_build_proj() */
/*--------------------------------------------------------------------------
NAME
- H5S__hyper_get_seq_list_opt
+ H5S__hyper_proj_int_iterate
PURPOSE
- Create a list of offsets & lengths for a selection
+ Main iteration routine for H5S__hyper_project_intersection
USAGE
- herr_t H5S_select_hyper_get_file_list_opt(space,iter,maxseq,maxelem,nseq,nelem,off,len)
- H5S_t *space; IN: Dataspace containing selection to use.
- H5S_sel_iter_t *iter; IN/OUT: Selection iterator describing last
- position of interest in selection.
- size_t maxseq; IN: Maximum number of sequences to generate
- size_t maxelem; IN: Maximum number of elements to include in the
- generated sequences
- size_t *nseq; OUT: Actual number of sequences generated
- size_t *nelem; OUT: Actual number of elements in sequences generated
- hsize_t *off; OUT: Array of offsets
- size_t *len; OUT: Array of lengths
+ herr_t H5S__hyper_proj_int_iterate(ss_span_info,sis_span_info,count,depth,udata)
+ const H5S_hyper_span_info_t *ss_span_info; IN: Span tree for source selection
+ const H5S_hyper_span_info_t *sis_span_info; IN: Span tree for source intersect selection
+ hsize_t count; IN: Number of times to compute the intersection of ss_span_info and sis_span_info
+ unsigned depth; IN: Depth of iteration (in terms of rank)
+ H5S_hyper_project_intersect_ud_t *udata; IN/OUT: Persistent shared data for iteration
RETURNS
Non-negative on success/Negative on failure.
DESCRIPTION
- Use the selection in the dataspace to generate a list of byte offsets and
- lengths for the region(s) selected. Start/Restart from the position in the
- ITER parameter. The number of sequences generated is limited by the MAXSEQ
- parameter and the number of sequences actually generated is stored in the
- NSEQ parameter.
+ Computes the intersection of ss_span_info and sis_span_info and projects it
+ to the projected space (held in udata). It accomplishes this by iterating
+ over both spaces and computing the number of elements to skip (in
+ ss_span_info) and the number of elements to add (the intersection) in a
+ sequential fashion (similar to run length encoding). As necessary, this
+ function both recurses into lower dimensions and calls
+ H5S__hyper_proj_int_build_proj to convert the skip/nelem pairs to the
+ projected span tree.
GLOBAL VARIABLES
COMMENTS, BUGS, ASSUMPTIONS
EXAMPLES
REVISION LOG
--------------------------------------------------------------------------*/
static herr_t
-H5S__hyper_get_seq_list_opt(const H5S_t *space, H5S_sel_iter_t *iter,
- size_t maxseq, size_t maxelem, size_t *nseq, size_t *nelem,
- hsize_t *off, size_t *len)
+H5S__hyper_proj_int_iterate(const H5S_hyper_span_info_t *ss_span_info,
+ const H5S_hyper_span_info_t *sis_span_info, hsize_t count, unsigned depth,
+ H5S_hyper_project_intersect_ud_t *udata)
{
- hsize_t *mem_size; /* Size of the source buffer */
- hsize_t slab[H5O_LAYOUT_NDIMS]; /* Hyperslab size */
- const hssize_t *sel_off; /* Selection offset in dataspace */
- hsize_t offset[H5O_LAYOUT_NDIMS]; /* Coordinate offset in dataspace */
- hsize_t tmp_count[H5O_LAYOUT_NDIMS];/* Temporary block count */
- hsize_t tmp_block[H5O_LAYOUT_NDIMS];/* Temporary block offset */
- hsize_t wrap[H5O_LAYOUT_NDIMS]; /* Bytes to wrap around at the end of a row */
- hsize_t skip[H5O_LAYOUT_NDIMS]; /* Bytes to skip between blocks */
- const H5S_hyper_dim_t *tdiminfo; /* Temporary pointer to diminfo information */
- hsize_t fast_dim_start, /* Local copies of fastest changing dimension info */
- fast_dim_stride,
- fast_dim_block,
- fast_dim_offset;
- size_t fast_dim_buf_off; /* Local copy of amount to move fastest dimension buffer offset */
- size_t fast_dim_count; /* Number of blocks left in fastest changing dimension */
- size_t tot_blk_count; /* Total number of blocks left to output */
- size_t act_blk_count; /* Actual number of blocks to output */
- size_t total_rows; /* Total number of entire rows to output */
- size_t curr_rows; /* Current number of entire rows to output */
- unsigned fast_dim; /* Rank of the fastest changing dimension for the dataspace */
- unsigned ndims; /* Number of dimensions of dataset */
- int temp_dim; /* Temporary rank holder */
- hsize_t acc; /* Accumulator */
- hsize_t loc; /* Coordinate offset */
- size_t curr_seq = 0; /* Current sequence being operated on */
- size_t actual_elem; /* The actual number of elements to count */
- size_t actual_bytes;/* The actual number of bytes to copy */
- size_t io_left; /* The number of elements left in I/O operation */
- size_t start_io_left; /* The initial number of elements left in I/O operation */
- size_t elem_size; /* Size of each element iterating over */
- unsigned u; /* Local index variable */
- int i; /* Local index variable */
-
- FUNC_ENTER_STATIC_NOERR
-
- /* Check args */
- HDassert(space);
- HDassert(iter);
- HDassert(maxseq > 0);
- HDassert(maxelem > 0);
- HDassert(nseq);
- HDassert(nelem);
- HDassert(off);
- HDassert(len);
-
- /* Set the local copy of the diminfo pointer */
- tdiminfo = iter->u.hyp.diminfo;
-
- /* Check if this is a "flattened" regular hyperslab selection */
- if(iter->u.hyp.iter_rank != 0 && iter->u.hyp.iter_rank < space->extent.rank) {
- /* Set the aliases for a few important dimension ranks */
- ndims = iter->u.hyp.iter_rank;
- fast_dim = ndims - 1;
-
- /* Set the local copy of the selection offset */
- sel_off = iter->u.hyp.sel_off;
-
- /* Set up the pointer to the size of the memory space */
- mem_size = iter->u.hyp.size;
- } /* end if */
- else {
- /* Set the aliases for a few important dimension ranks */
- ndims = space->extent.rank;
- fast_dim = ndims - 1;
-
- /* Set the local copy of the selection offset */
- sel_off = space->select.offset;
-
- /* Set up the pointer to the size of the memory space */
- mem_size = space->extent.size;
- } /* end else */
-
- /* initialize row sizes for each dimension */
- elem_size = iter->elmt_size;
- for(i = (int)fast_dim, acc = elem_size; i >= 0; i--) {
- slab[i] = acc;
- acc *= mem_size[i];
- } /* end for */
-
- /* Calculate the number of elements to sequence through */
- H5_CHECK_OVERFLOW(iter->elmt_left, hsize_t, size_t);
- io_left = MIN((size_t)iter->elmt_left, maxelem);
-
- /* Sanity check that there aren't any "remainder" sequences in process */
- HDassert(!((iter->u.hyp.off[fast_dim] - tdiminfo[fast_dim].start) % tdiminfo[fast_dim].stride != 0 ||
- ((iter->u.hyp.off[fast_dim] != tdiminfo[fast_dim].start) && tdiminfo[fast_dim].count == 1)));
-
- /* We've cleared the "remainder" of the previous fastest dimension
- * sequence before calling this routine, so we must be at the beginning of
- * a sequence. Use the fancy algorithm to compute the offsets and run
- * through as many as possible, until the buffer fills up.
- */
-
- /* Keep the number of elements we started with */
- start_io_left = io_left;
-
- /* Compute the arrays to perform I/O on */
+ const H5S_hyper_span_t *ss_span; /* Current span in source space */
+ const H5S_hyper_span_t *sis_span; /* Current span in source intersect space */
+ hsize_t ss_low; /* Current low bounds of source span */
+ hsize_t sis_low; /* Current low bounds of source intersect span */
+ hsize_t high; /* High bounds of current intersection */
+ hsize_t low; /* Low bounds of current intersection */
+ hsize_t old_skip; /* Value of udata->skip before main loop */
+ hsize_t old_nelem; /* Value of udata->nelem before main loop */
+ hbool_t check_intersect; /* Whether to check for intersecting elements */
+ unsigned u; /* Local index variable */
+ herr_t ret_value = SUCCEED; /* Return value */
- /* Copy the location of the point to get */
- /* (Add in the selection offset) */
- for(u = 0; u < ndims; u++)
- offset[u] = (hsize_t)((hssize_t)iter->u.hyp.off[u] + sel_off[u]);
+ FUNC_ENTER_STATIC
- /* Compute the current "counts" for this location */
- for(u = 0; u < ndims; u++) {
- if(tdiminfo[u].count == 1) {
- tmp_count[u] = 0;
- tmp_block[u] = iter->u.hyp.off[u] - tdiminfo[u].start;
+ /* Check for non-overlapping bounds */
+ check_intersect = TRUE;
+ for(u = 0; u < (udata->ss_rank - depth); u++)
+ if(!H5S_RANGE_OVERLAP(ss_span_info->low_bounds[u],
+ ss_span_info->high_bounds[u],
+ sis_span_info->low_bounds[u],
+ sis_span_info->high_bounds[u])) {
+ check_intersect = FALSE;
+ break;
} /* end if */
- else {
- tmp_count[u] = (iter->u.hyp.off[u] - tdiminfo[u].start) / tdiminfo[u].stride;
- tmp_block[u] = (iter->u.hyp.off[u] - tdiminfo[u].start) % tdiminfo[u].stride;
- } /* end else */
- } /* end for */
-
- /* Compute the initial buffer offset */
- for(u = 0, loc = 0; u < ndims; u++)
- loc += offset[u] * slab[u];
-
- /* Set the number of elements to write each time */
- H5_CHECKED_ASSIGN(actual_elem, size_t, tdiminfo[fast_dim].block, hsize_t);
-
- /* Set the number of actual bytes */
- actual_bytes = actual_elem * elem_size;
-
- /* Set local copies of information for the fastest changing dimension */
- fast_dim_start = tdiminfo[fast_dim].start;
- fast_dim_stride = tdiminfo[fast_dim].stride;
- fast_dim_block = tdiminfo[fast_dim].block;
- H5_CHECKED_ASSIGN(fast_dim_buf_off, size_t, slab[fast_dim] * fast_dim_stride, hsize_t);
- fast_dim_offset = (hsize_t)((hssize_t)fast_dim_start + sel_off[fast_dim]);
-
- /* Compute the number of blocks which would fit into the buffer */
- H5_CHECK_OVERFLOW(io_left / fast_dim_block, hsize_t, size_t);
- tot_blk_count = (size_t)(io_left / fast_dim_block);
-
- /* Don't go over the maximum number of sequences allowed */
- tot_blk_count = MIN(tot_blk_count, (maxseq - curr_seq));
-
- /* Compute the amount to wrap at the end of each row */
- for(u = 0; u < ndims; u++)
- wrap[u] = (mem_size[u] - (tdiminfo[u].stride * tdiminfo[u].count)) * slab[u];
-
- /* Compute the amount to skip between blocks */
- for(u = 0; u < ndims; u++)
- skip[u] = (tdiminfo[u].stride - tdiminfo[u].block) * slab[u];
- /* Check if there is a partial row left (with full blocks) */
- if(tmp_count[fast_dim] > 0) {
- /* Get number of blocks in fastest dimension */
- H5_CHECKED_ASSIGN(fast_dim_count, size_t, tdiminfo[fast_dim].count - tmp_count[fast_dim], hsize_t);
+ /* Only enter main loop if there's something to do */
+ if(check_intersect) {
+ /* Set ps_clean_bitmap */
+ udata->ps_clean_bitmap |= (((uint32_t)1) << depth);
- /* Make certain this entire row will fit into buffer */
- fast_dim_count = MIN(fast_dim_count, tot_blk_count);
+ /* Save old skip and nelem */
+ old_skip = udata->skip;
+ old_nelem = udata->nelem;
- /* Number of blocks to sequence over */
- act_blk_count = fast_dim_count;
-
- /* Loop over all the blocks in the fastest changing dimension */
- while(fast_dim_count > 0) {
- /* Store the sequence information */
- off[curr_seq] = loc;
- len[curr_seq] = actual_bytes;
-
- /* Increment sequence count */
- curr_seq++;
+ /* Intersect spaces once per count */
+ for(u = 0; u < count; u++) {
+ ss_span = ss_span_info->head;
+ sis_span = sis_span_info->head;
+ HDassert(ss_span && sis_span);
+ ss_low = ss_span->low;
+ sis_low = sis_span->low;
- /* Increment information to reflect block just processed */
- loc += fast_dim_buf_off;
-
- /* Decrement number of blocks */
- fast_dim_count--;
- } /* end while */
-
- /* Decrement number of elements left */
- io_left -= actual_elem * act_blk_count;
-
- /* Decrement number of blocks left */
- tot_blk_count -= act_blk_count;
-
- /* Increment information to reflect block just processed */
- tmp_count[fast_dim] += act_blk_count;
+ /* Main loop */
+ do {
+ /* Check if spans overlap */
+ if(H5S_RANGE_OVERLAP(ss_low, ss_span->high,
+ sis_low, sis_span->high)) {
+ high = MIN(ss_span->high, sis_span->high);
+ if(ss_span->down) {
+ /* Add skipped elements if there's a pre-gap */
+ if(ss_low < sis_low) {
+ low = sis_low;
+ H5S_HYPER_PROJ_INT_ADD_SKIP(udata, H5S__hyper_spans_nelem_helper(ss_span->down, udata->op_gen) * (sis_low - ss_low), FAIL);
+ } /* end if */
+ else
+ low = ss_low;
- /* Check if we finished the entire row of blocks */
- if(tmp_count[fast_dim] >= tdiminfo[fast_dim].count) {
- /* Increment offset in destination buffer */
- loc += wrap[fast_dim];
+ /* Recurse into next dimension down */
+ if(H5S__hyper_proj_int_iterate(ss_span->down, sis_span->down, high - low + 1, depth + 1, udata) < 0)
+ HGOTO_ERROR(H5E_DATASPACE, H5E_CANTCOMPARE, FAIL, "can't iterate over source selections")
+ } /* end if */
+ else {
+ HDassert(depth == udata->ss_rank - 1);
- /* Increment information to reflect block just processed */
- offset[fast_dim] = fast_dim_offset; /* reset the offset in the fastest dimension */
- tmp_count[fast_dim] = 0;
+ /* Add skipped elements if there's a pre-gap */
+ if(ss_low < sis_low) {
+ low = sis_low;
+ H5S_HYPER_PROJ_INT_ADD_SKIP(udata, sis_low - ss_low, FAIL);
+ } /* end if */
+ else
+ low = ss_low;
- /* Increment the offset and count for the other dimensions */
- temp_dim = (int)fast_dim - 1;
- while(temp_dim >= 0) {
- /* Move to the next row in the curent dimension */
- offset[temp_dim]++;
- tmp_block[temp_dim]++;
+ /* Add overlapping elements */
+ udata->nelem += high - low + 1;
+ } /* end else */
- /* If this block is still in the range of blocks to output for the dimension, break out of loop */
- if(tmp_block[temp_dim] < tdiminfo[temp_dim].block)
- break;
+ /* Advance spans */
+ if(ss_span->high == sis_span->high) {
+ /* Advance both spans */
+ ss_span = ss_span->next;
+ if(ss_span)
+ ss_low = ss_span->low;
+ sis_span = sis_span->next;
+ if(sis_span)
+ sis_low = sis_span->low;
+ } /* end if */
+ else if(ss_span->high == high) {
+ /* Advance source span */
+ HDassert(ss_span->high < sis_span->high);
+ sis_low = high + 1;
+ ss_span = ss_span->next;
+ if(ss_span)
+ ss_low = ss_span->low;
+ } /* end if */
+ else {
+ /* Advance source intersect span */
+ HDassert(ss_span->high > sis_span->high);
+ ss_low = high + 1;
+ sis_span = sis_span->next;
+ if(sis_span)
+ sis_low = sis_span->low;
+ } /* end else */
+ } /* end if */
else {
- /* Move to the next block in the current dimension */
- offset[temp_dim] += (tdiminfo[temp_dim].stride - tdiminfo[temp_dim].block);
- loc += skip[temp_dim];
- tmp_block[temp_dim] = 0;
- tmp_count[temp_dim]++;
+ /* Advance spans */
+ if(ss_span->high < sis_low) {
+ /* Add skipped elements */
+ if(ss_span->down)
+ H5S_HYPER_PROJ_INT_ADD_SKIP(udata, H5S__hyper_spans_nelem_helper(ss_span->down, udata->op_gen) * (ss_span->high - ss_low + 1), FAIL);
+ else
+ H5S_HYPER_PROJ_INT_ADD_SKIP(udata, ss_span->high - ss_low + 1, FAIL);
- /* If this block is still in the range of blocks to output for the dimension, break out of loop */
- if(tmp_count[temp_dim] < tdiminfo[temp_dim].count)
- break;
+ /* Advance source span */
+ ss_span = ss_span->next;
+ if(ss_span)
+ ss_low = ss_span->low;
+ } /* end if */
else {
- offset[temp_dim] = (hsize_t)((hssize_t)tdiminfo[temp_dim].start + sel_off[temp_dim]);
- loc += wrap[temp_dim];
- tmp_count[temp_dim] = 0; /* reset back to the beginning of the line */
- tmp_block[temp_dim] = 0;
+ /* Advance source intersect span */
+ HDassert(ss_low > sis_span->high);
+ sis_span = sis_span->next;
+ if(sis_span)
+ sis_low = sis_span->low;
} /* end else */
} /* end else */
-
- /* Decrement dimension count */
- temp_dim--;
- } /* end while */
- } /* end if */
- else {
- /* Update the offset in the fastest dimension */
- offset[fast_dim] += (fast_dim_stride * act_blk_count);
- } /* end else */
- } /* end if */
-
- /* Compute the number of entire rows to read in */
- H5_CHECK_OVERFLOW(tot_blk_count / tdiminfo[fast_dim].count, hsize_t, size_t);
- curr_rows = total_rows = (size_t)(tot_blk_count / tdiminfo[fast_dim].count);
-
- /* Reset copy of number of blocks in fastest dimension */
- H5_CHECKED_ASSIGN(fast_dim_count, size_t, tdiminfo[fast_dim].count, hsize_t);
-
- /* Read in data until an entire sequence can't be written out any longer */
- while(curr_rows > 0) {
-
-#define DUFF_GUTS \
-/* Store the sequence information */ \
-off[curr_seq] = loc; \
-len[curr_seq] = actual_bytes; \
- \
-/* Increment sequence count */ \
-curr_seq++; \
- \
-/* Increment information to reflect block just processed */ \
-loc += fast_dim_buf_off;
-
-#ifdef NO_DUFFS_DEVICE
- /* Loop over all the blocks in the fastest changing dimension */
- while(fast_dim_count > 0) {
- DUFF_GUTS
-
- /* Decrement number of blocks */
- fast_dim_count--;
- } /* end while */
-#else /* NO_DUFFS_DEVICE */
- {
- size_t duffs_index; /* Counting index for Duff's device */
-
- duffs_index = (fast_dim_count + 7) / 8;
- switch (fast_dim_count % 8) {
- default:
- HDassert(0 && "This Should never be executed!");
- break;
- case 0:
- do
- {
- DUFF_GUTS
- case 7:
- DUFF_GUTS
- case 6:
- DUFF_GUTS
- case 5:
- DUFF_GUTS
- case 4:
- DUFF_GUTS
- case 3:
- DUFF_GUTS
- case 2:
- DUFF_GUTS
- case 1:
- DUFF_GUTS
- } while (--duffs_index > 0);
- } /* end switch */
- }
-#endif /* NO_DUFFS_DEVICE */
-#undef DUFF_GUTS
-
- /* Increment offset in destination buffer */
- loc += wrap[fast_dim];
-
- /* Increment the offset and count for the other dimensions */
- temp_dim = (int)fast_dim - 1;
- while(temp_dim >= 0) {
- /* Move to the next row in the curent dimension */
- offset[temp_dim]++;
- tmp_block[temp_dim]++;
-
- /* If this block is still in the range of blocks to output for the dimension, break out of loop */
- if(tmp_block[temp_dim] < tdiminfo[temp_dim].block)
- break;
- else {
- /* Move to the next block in the current dimension */
- offset[temp_dim] += (tdiminfo[temp_dim].stride - tdiminfo[temp_dim].block);
- loc += skip[temp_dim];
- tmp_block[temp_dim] = 0;
- tmp_count[temp_dim]++;
-
- /* If this block is still in the range of blocks to output for the dimension, break out of loop */
- if(tmp_count[temp_dim] < tdiminfo[temp_dim].count)
- break;
+ } while(ss_span && sis_span);
+
+ if(ss_span && !((depth == 0) && (u == count - 1))) {
+ /* Count remaining elements in ss_span_info */
+ if(ss_span->down) {
+ H5S_HYPER_PROJ_INT_ADD_SKIP(udata, H5S__hyper_spans_nelem_helper(ss_span->down, udata->op_gen) * (ss_span->high - ss_low + 1), FAIL);
+ ss_span = ss_span->next;
+ while(ss_span) {
+ H5S_HYPER_PROJ_INT_ADD_SKIP(udata, H5S__hyper_spans_nelem_helper(ss_span->down, udata->op_gen) * (ss_span->high - ss_span->low + 1), FAIL);
+ ss_span = ss_span->next;
+ } /* end while */
+ } /* end if */
else {
- offset[temp_dim] = (hsize_t)((hssize_t)tdiminfo[temp_dim].start + sel_off[temp_dim]);
- loc += wrap[temp_dim];
- tmp_count[temp_dim] = 0; /* reset back to the beginning of the line */
- tmp_block[temp_dim] = 0;
+ H5S_HYPER_PROJ_INT_ADD_SKIP(udata, ss_span->high - ss_low + 1, FAIL);
+ ss_span = ss_span->next;
+ while(ss_span) {
+ H5S_HYPER_PROJ_INT_ADD_SKIP(udata, ss_span->high - ss_span->low + 1, FAIL);
+ ss_span = ss_span->next;
+ } /* end while */
} /* end else */
- } /* end else */
-
- /* Decrement dimension count */
- temp_dim--;
- } /* end while */
-
- /* Decrement the number of rows left */
- curr_rows--;
- } /* end while */
-
- /* Adjust the number of blocks & elements left to transfer */
-
- /* Decrement number of elements left */
- H5_CHECK_OVERFLOW(actual_elem * (total_rows * tdiminfo[fast_dim].count), hsize_t, size_t);
- io_left -= (size_t)(actual_elem * (total_rows * tdiminfo[fast_dim].count));
-
- /* Decrement number of blocks left */
- H5_CHECK_OVERFLOW((total_rows * tdiminfo[fast_dim].count), hsize_t, size_t);
- tot_blk_count -= (size_t)(total_rows * tdiminfo[fast_dim].count);
-
- /* Read in partial row of blocks */
- if(io_left > 0 && curr_seq < maxseq) {
- /* Get remaining number of blocks left to output */
- fast_dim_count = tot_blk_count;
-
- /* Loop over all the blocks in the fastest changing dimension */
- while(fast_dim_count > 0) {
- /* Store the sequence information */
- off[curr_seq] = loc;
- len[curr_seq] = actual_bytes;
-
- /* Increment sequence count */
- curr_seq++;
-
- /* Increment information to reflect block just processed */
- loc += fast_dim_buf_off;
-
- /* Decrement number of blocks */
- fast_dim_count--;
- } /* end while */
-
- /* Decrement number of elements left */
- io_left -= actual_elem * tot_blk_count;
-
- /* Increment information to reflect block just processed */
- offset[fast_dim] += (fast_dim_stride * tot_blk_count); /* move the offset in the fastest dimension */
-
- /* Handle any leftover, partial blocks in this row */
- if(io_left > 0 && curr_seq < maxseq) {
- actual_elem = io_left;
- actual_bytes = actual_elem * elem_size;
-
- /* Store the sequence information */
- off[curr_seq] = loc;
- len[curr_seq] = actual_bytes;
-
- /* Increment sequence count */
- curr_seq++;
-
- /* Decrement the number of elements left */
- io_left -= actual_elem;
-
- /* Increment buffer correctly */
- offset[fast_dim] += actual_elem;
- } /* end if */
-
- /* don't bother checking slower dimensions */
- HDassert(io_left == 0 || curr_seq == maxseq);
- } /* end if */
-
- /* Update the iterator */
-
- /* Update the iterator with the location we stopped */
- /* (Subtract out the selection offset) */
- for(u = 0; u < ndims; u++)
- iter->u.hyp.off[u] = (hsize_t)((hssize_t)offset[u] - sel_off[u]);
-
- /* Decrement the number of elements left in selection */
- iter->elmt_left -= (start_io_left - io_left);
-
- /* Increment the number of sequences generated */
- *nseq += curr_seq;
-
- /* Increment the number of elements used */
- *nelem += start_io_left - io_left;
-
- FUNC_LEAVE_NOAPI(SUCCEED)
-} /* end H5S__hyper_get_seq_list_opt() */
-
-
-/*--------------------------------------------------------------------------
- NAME
- H5S__hyper_get_seq_list_single
- PURPOSE
- Create a list of offsets & lengths for a selection
- USAGE
- herr_t H5S__hyper_get_seq_list_single(space, flags, iter, maxseq, maxelem, nseq, nelem, off, len)
- H5S_t *space; IN: Dataspace containing selection to use.
- unsigned flags; IN: Flags for extra information about operation
- H5S_sel_iter_t *iter; IN/OUT: Selection iterator describing last
- position of interest in selection.
- size_t maxseq; IN: Maximum number of sequences to generate
- size_t maxelem; IN: Maximum number of elements to include in the
- generated sequences
- size_t *nseq; OUT: Actual number of sequences generated
- size_t *nelem; OUT: Actual number of elements in sequences generated
- hsize_t *off; OUT: Array of offsets
- size_t *len; OUT: Array of lengths
- RETURNS
- Non-negative on success/Negative on failure.
- DESCRIPTION
- Use the selection in the dataspace to generate a list of byte offsets and
- lengths for the region(s) selected. Start/Restart from the position in the
- ITER parameter. The number of sequences generated is limited by the MAXSEQ
- parameter and the number of sequences actually generated is stored in the
- NSEQ parameter.
- GLOBAL VARIABLES
- COMMENTS, BUGS, ASSUMPTIONS
- EXAMPLES
- REVISION LOG
---------------------------------------------------------------------------*/
-static herr_t
-H5S__hyper_get_seq_list_single(const H5S_t *space, H5S_sel_iter_t *iter,
- size_t maxseq, size_t maxelem, size_t *nseq, size_t *nelem,
- hsize_t *off, size_t *len)
-{
- const H5S_hyper_dim_t *tdiminfo; /* Temporary pointer to diminfo information */
- const hssize_t *sel_off; /* Selection offset in dataspace */
- hsize_t *mem_size; /* Size of the source buffer */
- hsize_t base_offset[H5O_LAYOUT_NDIMS]; /* Base coordinate offset in dataspace */
- hsize_t offset[H5O_LAYOUT_NDIMS]; /* Coordinate offset in dataspace */
- hsize_t slab[H5O_LAYOUT_NDIMS]; /* Hyperslab size */
- hsize_t fast_dim_block; /* Local copies of fastest changing dimension info */
- hsize_t acc; /* Accumulator */
- hsize_t loc; /* Coordinate offset */
- size_t tot_blk_count; /* Total number of blocks left to output */
- size_t elem_size; /* Size of each element iterating over */
- size_t io_left; /* The number of elements left in I/O operation */
- size_t actual_elem; /* The actual number of elements to count */
- unsigned ndims; /* Number of dimensions of dataset */
- unsigned fast_dim; /* Rank of the fastest changing dimension for the dataspace */
- unsigned skip_dim; /* Rank of the dimension to skip along */
- unsigned u; /* Local index variable */
- int i; /* Local index variable */
-
- FUNC_ENTER_STATIC_NOERR
-
- /* Check args */
- HDassert(space);
- HDassert(iter);
- HDassert(maxseq > 0);
- HDassert(maxelem > 0);
- HDassert(nseq);
- HDassert(nelem);
- HDassert(off);
- HDassert(len);
-
- /* Set a local copy of the diminfo pointer */
- tdiminfo = iter->u.hyp.diminfo;
-
- /* Check if this is a "flattened" regular hyperslab selection */
- if(iter->u.hyp.iter_rank != 0 && iter->u.hyp.iter_rank < space->extent.rank) {
- /* Set the aliases for a few important dimension ranks */
- ndims = iter->u.hyp.iter_rank;
-
- /* Set the local copy of the selection offset */
- sel_off = iter->u.hyp.sel_off;
-
- /* Set up the pointer to the size of the memory space */
- mem_size = iter->u.hyp.size;
- } /* end if */
- else {
- /* Set the aliases for a few important dimension ranks */
- ndims = space->extent.rank;
-
- /* Set the local copy of the selection offset */
- sel_off = space->select.offset;
-
- /* Set up the pointer to the size of the memory space */
- mem_size = space->extent.size;
- } /* end else */
- fast_dim = ndims - 1;
-
- /* initialize row sizes for each dimension */
- elem_size = iter->elmt_size;
- for(i = (int)fast_dim, acc = elem_size; i >= 0; i--) {
- slab[i] = acc;
- acc *= mem_size[i];
- } /* end for */
-
- /* Copy the base location of the block */
- /* (Add in the selection offset) */
- for(u = 0; u < ndims; u++)
- base_offset[u] = (hsize_t)((hssize_t)tdiminfo[u].start + sel_off[u]);
-
- /* Copy the location of the point to get */
- /* (Add in the selection offset) */
- for(u = 0; u < ndims; u++)
- offset[u] = (hsize_t)((hssize_t)iter->u.hyp.off[u] + sel_off[u]);
-
- /* Compute the initial buffer offset */
- for(u = 0, loc = 0; u < ndims; u++)
- loc += offset[u] * slab[u];
-
- /* Set local copies of information for the fastest changing dimension */
- fast_dim_block = tdiminfo[fast_dim].block;
-
- /* Calculate the number of elements to sequence through */
- H5_CHECK_OVERFLOW(iter->elmt_left, hsize_t, size_t);
- io_left = MIN((size_t)iter->elmt_left, maxelem);
-
- /* Compute the number of blocks which would fit into the buffer */
- H5_CHECK_OVERFLOW(io_left / fast_dim_block, hsize_t, size_t);
- tot_blk_count = (size_t)(io_left / fast_dim_block);
-
- /* Don't go over the maximum number of sequences allowed */
- tot_blk_count = MIN(tot_blk_count, maxseq);
-
- /* Set the number of elements to write each time */
- H5_CHECKED_ASSIGN(actual_elem, size_t, fast_dim_block, hsize_t);
-
- /* Check for blocks to operate on */
- if(tot_blk_count > 0) {
- size_t actual_bytes; /* The actual number of bytes to copy */
-
- /* Set the number of actual bytes */
- actual_bytes = actual_elem * elem_size;
-
- /* Check for 1-dim selection */
- if(0 == fast_dim) {
- /* Sanity checks */
- HDassert(1 == tot_blk_count);
- HDassert(io_left == actual_elem);
-
- /* Store the sequence information */
- *off++ = loc;
- *len++ = actual_bytes;
- } /* end if */
- else {
- hsize_t skip_slab; /* Temporary copy of slab[fast_dim - 1] */
- size_t blk_count; /* Total number of blocks left to output */
+ } /* end if */
- /* Find first dimension w/block >1 */
- skip_dim = fast_dim;
- for(i = (int)(fast_dim - 1); i >= 0; i--)
- if(tdiminfo[i].block > 1) {
- skip_dim = (unsigned)i;
- break;
+ /* Check if the projected space was not changed since we started the
+ * first iteration of the loop, if so we do not need to continue
+ * looping and can just copy the result */
+ if(udata->ps_clean_bitmap & (((uint32_t)1) << depth)) {
+ HDassert(u == 0);
+ if(udata->skip == old_skip) {
+ /* First case: algorithm added only elements */
+ HDassert(udata->nelem >= old_nelem);
+ udata->nelem += (count - 1) * (udata->nelem - old_nelem);
} /* end if */
- skip_slab = slab[skip_dim];
-
- /* Check for being able to use fast algorithm for 1-D */
- if(0 == skip_dim) {
- /* Create sequences until an entire row can't be used */
- blk_count = tot_blk_count;
- while(blk_count > 0) {
- /* Store the sequence information */
- *off++ = loc;
- *len++ = actual_bytes;
-
- /* Increment offset in destination buffer */
- loc += skip_slab;
-
- /* Decrement block count */
- blk_count--;
- } /* end while */
+ else if(udata->nelem == 0) {
+ /* Second case: algorithm added only skip. In this case,
+ * nelem must be 0 since otherwise adding skip would have
+ * triggered a change in the projected space */
+ HDassert(old_nelem == 0);
+ HDassert(udata->skip > old_skip);
+ udata->skip += (count - 1) * (udata->skip - old_skip);
+ } /* end if */
+ else {
+ /* Third case: agorithm added skip and nelem (in that
+ * order). Add the same skip and nelem once for each item
+ * remaining in count. */
+ hsize_t skip_add;
+ hsize_t nelem_add;
+
+ HDassert(udata->nelem > 0);
+ HDassert(udata->skip > old_skip);
+ HDassert(old_nelem == 0);
+
+ skip_add = udata->skip - old_skip;
+ nelem_add = udata->nelem - old_nelem;
+ for(u = 1; u < count; u++) {
+ H5S_HYPER_PROJ_INT_ADD_SKIP(udata, skip_add, FAIL);
+ udata->nelem += nelem_add;
+ } /* end for */
+ } /* end else */
- /* Move to the next location */
- offset[skip_dim] += tot_blk_count;
+ /* End loop since we already took care of it */
+ break;
} /* end if */
- else {
- hsize_t tmp_block[H5O_LAYOUT_NDIMS];/* Temporary block offset */
- hsize_t skip[H5O_LAYOUT_NDIMS]; /* Bytes to skip between blocks */
- int temp_dim; /* Temporary rank holder */
-
- /* Set the starting block location */
- for(u = 0; u < ndims; u++)
- tmp_block[u] = iter->u.hyp.off[u] - tdiminfo[u].start;
-
- /* Compute the amount to skip between sequences */
- for(u = 0; u < ndims; u++)
- skip[u] = (mem_size[u] - tdiminfo[u].block) * slab[u];
-
- /* Create sequences until an entire row can't be used */
- blk_count = tot_blk_count;
- while(blk_count > 0) {
- /* Store the sequence information */
- *off++ = loc;
- *len++ = actual_bytes;
-
- /* Set temporary dimension for advancing offsets */
- temp_dim = (int)skip_dim;
-
- /* Increment offset in destination buffer */
- loc += skip_slab;
-
- /* Increment the offset and count for the other dimensions */
- while(temp_dim >= 0) {
- /* Move to the next row in the curent dimension */
- offset[temp_dim]++;
- tmp_block[temp_dim]++;
-
- /* If this block is still in the range of blocks to output for the dimension, break out of loop */
- if(tmp_block[temp_dim] < tdiminfo[temp_dim].block)
- break;
- else {
- offset[temp_dim] = base_offset[temp_dim];
- loc += skip[temp_dim];
- tmp_block[temp_dim] = 0;
- } /* end else */
-
- /* Decrement dimension count */
- temp_dim--;
- } /* end while */
-
- /* Decrement block count */
- blk_count--;
- } /* end while */
- } /* end else */
- } /* end else */
-
- /* Update the iterator, if there were any blocks used */
-
- /* Decrement the number of elements left in selection */
- iter->elmt_left -= tot_blk_count * actual_elem;
-
- /* Check if there are elements left in iterator */
- if(iter->elmt_left > 0) {
- /* Update the iterator with the location we stopped */
- /* (Subtract out the selection offset) */
- for(u = 0; u < ndims; u++)
- iter->u.hyp.off[u] = (hsize_t)((hssize_t)offset[u] - sel_off[u]);
- } /* end if */
-
- /* Increment the number of sequences generated */
- *nseq += tot_blk_count;
-
- /* Increment the number of elements used */
- *nelem += tot_blk_count * actual_elem;
- } /* end if */
-
- /* Check for partial block, with room for another sequence */
- if(io_left > (tot_blk_count * actual_elem) && tot_blk_count < maxseq) {
- size_t elmt_remainder; /* Elements remaining */
-
- /* Compute elements left */
- elmt_remainder = io_left - (tot_blk_count * actual_elem);
- HDassert(elmt_remainder < fast_dim_block);
- HDassert(elmt_remainder > 0);
-
- /* Store the sequence information */
- *off++ = loc;
- *len++ = elmt_remainder * elem_size;
-
- /* Update the iterator with the location we stopped */
- iter->u.hyp.off[fast_dim] += (hsize_t)elmt_remainder;
-
- /* Decrement the number of elements left in selection */
- iter->elmt_left -= elmt_remainder;
-
- /* Increment the number of sequences generated */
- (*nseq)++;
-
- /* Increment the number of elements used */
- *nelem += elmt_remainder;
+ } /* end for */
} /* end if */
-
- /* Sanity check */
- HDassert(*nseq > 0);
- HDassert(*nelem > 0);
-
- FUNC_LEAVE_NOAPI(SUCCEED)
-} /* end H5S__hyper_get_seq_list_single() */
-
-
-/*--------------------------------------------------------------------------
- NAME
- H5S__hyper_get_seq_list
- PURPOSE
- Create a list of offsets & lengths for a selection
- USAGE
- herr_t H5S__hyper_get_seq_list(space,flags,iter,maxseq,maxelem,nseq,nelem,off,len)
- H5S_t *space; IN: Dataspace containing selection to use.
- unsigned flags; IN: Flags for extra information about operation
- H5S_sel_iter_t *iter; IN/OUT: Selection iterator describing last
- position of interest in selection.
- size_t maxseq; IN: Maximum number of sequences to generate
- size_t maxelem; IN: Maximum number of elements to include in the
- generated sequences
- size_t *nseq; OUT: Actual number of sequences generated
- size_t *nelem; OUT: Actual number of elements in sequences generated
- hsize_t *off; OUT: Array of offsets
- size_t *len; OUT: Array of lengths
- RETURNS
- Non-negative on success/Negative on failure.
- DESCRIPTION
- Use the selection in the dataspace to generate a list of byte offsets and
- lengths for the region(s) selected. Start/Restart from the position in the
- ITER parameter. The number of sequences generated is limited by the MAXSEQ
- parameter and the number of sequences actually generated is stored in the
- NSEQ parameter.
- GLOBAL VARIABLES
- COMMENTS, BUGS, ASSUMPTIONS
- EXAMPLES
- REVISION LOG
---------------------------------------------------------------------------*/
-static herr_t
-H5S__hyper_get_seq_list(const H5S_t *space, unsigned H5_ATTR_UNUSED flags, H5S_sel_iter_t *iter,
- size_t maxseq, size_t maxelem, size_t *nseq, size_t *nelem,
- hsize_t *off, size_t *len)
-{
- herr_t ret_value = FAIL; /* return value */
-
- FUNC_ENTER_STATIC_NOERR
-
- /* Check args */
- HDassert(space);
- HDassert(iter);
- HDassert(iter->elmt_left > 0);
- HDassert(maxseq > 0);
- HDassert(maxelem > 0);
- HDassert(nseq);
- HDassert(nelem);
- HDassert(off);
- HDassert(len);
- HDassert(space->select.sel_info.hslab->unlim_dim < 0);
-
- /* Check for the special case of just one H5Sselect_hyperslab call made */
- if(space->select.sel_info.hslab->diminfo_valid) {
- const H5S_hyper_dim_t *tdiminfo; /* Temporary pointer to diminfo information */
- const hssize_t *sel_off; /* Selection offset in dataspace */
- hsize_t *mem_size; /* Size of the source buffer */
- unsigned ndims; /* Number of dimensions of dataset */
- unsigned fast_dim; /* Rank of the fastest changing dimension for the dataspace */
- hbool_t single_block; /* Whether the selection is a single block */
- unsigned u; /* Local index variable */
-
- /* Set a local copy of the diminfo pointer */
- tdiminfo = iter->u.hyp.diminfo;
-
- /* Check if this is a "flattened" regular hyperslab selection */
- if(iter->u.hyp.iter_rank != 0 && iter->u.hyp.iter_rank < space->extent.rank) {
- /* Set the aliases for a few important dimension ranks */
- ndims = iter->u.hyp.iter_rank;
-
- /* Set the local copy of the selection offset */
- sel_off = iter->u.hyp.sel_off;
-
- /* Set up the pointer to the size of the memory space */
- mem_size = iter->u.hyp.size;
- } /* end if */
- else {
- /* Set the aliases for a few important dimension ranks */
- ndims = space->extent.rank;
-
- /* Set the local copy of the selection offset */
- sel_off = space->select.offset;
-
- /* Set up the pointer to the size of the memory space */
- mem_size = space->extent.size;
- } /* end else */
- fast_dim = ndims - 1;
-
- /* Check if we stopped in the middle of a sequence of elements */
- if((iter->u.hyp.off[fast_dim] - tdiminfo[fast_dim].start) % tdiminfo[fast_dim].stride != 0 ||
- ((iter->u.hyp.off[fast_dim] != tdiminfo[fast_dim].start) && tdiminfo[fast_dim].count == 1)) {
- hsize_t slab[H5O_LAYOUT_NDIMS]; /* Hyperslab size */
- hsize_t loc; /* Coordinate offset */
- hsize_t acc; /* Accumulator */
- size_t leftover; /* The number of elements left over from the last sequence */
- size_t actual_elem; /* The actual number of elements to count */
- size_t elem_size; /* Size of each element iterating over */
- int i; /* Local index variable */
-
-
- /* Calculate the number of elements left in the sequence */
- if(tdiminfo[fast_dim].count == 1) {
- H5_CHECKED_ASSIGN(leftover, size_t, tdiminfo[fast_dim].block - (iter->u.hyp.off[fast_dim] - tdiminfo[fast_dim].start), hsize_t);
+ else if(depth > 0)
+ /* Just count skipped elements */
+ H5S_HYPER_PROJ_INT_ADD_SKIP(udata, H5S__hyper_spans_nelem_helper((H5S_hyper_span_info_t *)ss_span_info, udata->op_gen) * count, FAIL); /* Casting away const OK -NAF */
+
+ /* Clean up if we are done */
+ if(depth == 0) {
+ /* Add remaining elements */
+ if(udata->nelem > 0)
+ if(H5S__hyper_proj_int_build_proj(udata) < 0)
+ HGOTO_ERROR(H5E_DATASPACE, H5E_CANTAPPEND, FAIL, "can't add elements to projected selection")
+
+ /* Append remaining span trees */
+ for(u = udata->ds_rank - 1; u > 0; u--)
+ if(udata->ps_span_info[u]) {
+ if(H5S__hyper_append_span(&udata->ps_span_info[u - 1],
+ udata->ds_rank - u + 1, udata->ds_low[u - 1],
+ udata->ds_low[u - 1],
+ udata->ps_span_info[u]) < 0)
+ HGOTO_ERROR(H5E_DATASPACE, H5E_CANTAPPEND, FAIL, "can't allocate hyperslab span")
+ H5S__hyper_free_span_info(udata->ps_span_info[u]);
+ udata->ps_span_info[u] = NULL;
} /* end if */
- else {
- H5_CHECKED_ASSIGN(leftover, size_t, tdiminfo[fast_dim].block - ((iter->u.hyp.off[fast_dim] - tdiminfo[fast_dim].start) % tdiminfo[fast_dim].stride), hsize_t);
- } /* end else */
-
- /* Make certain that we don't write too many */
- actual_elem = MIN3(leftover, (size_t)iter->elmt_left, maxelem);
-
- /* Initialize row sizes for each dimension */
- elem_size = iter->elmt_size;
- for(i = (int)fast_dim, acc = elem_size; i >= 0; i--) {
- slab[i] = acc;
- acc *= mem_size[i];
- } /* end for */
-
- /* Compute the initial buffer offset */
- for(u = 0, loc = 0; u < ndims; u++)
- loc += ((hsize_t)((hssize_t)iter->u.hyp.off[u] + sel_off[u])) * slab[u];
-
- /* Add a new sequence */
- off[0] = loc;
- H5_CHECKED_ASSIGN(len[0], size_t, actual_elem * elem_size, hsize_t);
-
- /* Increment sequence array locations */
- off++;
- len++;
-
- /* Advance the hyperslab iterator */
- H5S__hyper_iter_next(iter, actual_elem);
-
- /* Decrement the number of elements left in selection */
- iter->elmt_left -= actual_elem;
-
- /* Decrement element/sequence limits */
- maxelem -= actual_elem;
- maxseq--;
-
- /* Set the number of sequences generated and elements used */
- *nseq = 1;
- *nelem = actual_elem;
-
- /* Check for using up all the sequences/elements */
- if(0 == iter->elmt_left || 0 == maxelem || 0 == maxseq)
- return(SUCCEED);
- } /* end if */
- else {
- /* Reset the number of sequences generated and elements used */
- *nseq = 0;
- *nelem = 0;
- } /* end else */
-
- /* Check for a single block selected */
- single_block = TRUE;
- for(u = 0; u < ndims; u++)
- if(1 != tdiminfo[u].count) {
- single_block = FALSE;
- break;
- } /* end if */
-
- /* Check for single block selection */
- if(single_block)
- /* Use single-block optimized call to generate sequence list */
- ret_value = H5S__hyper_get_seq_list_single(space, iter, maxseq, maxelem, nseq, nelem, off, len);
- else
- /* Use optimized call to generate sequence list */
- ret_value = H5S__hyper_get_seq_list_opt(space, iter, maxseq, maxelem, nseq, nelem, off, len);
} /* end if */
- else
- /* Call the general sequence generator routine */
- ret_value = H5S__hyper_get_seq_list_gen(space, iter, maxseq, maxelem, nseq, nelem, off, len);
+done:
FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5S__hyper_get_seq_list() */
+} /* end H5S__hyper_proj_int_iterate() */
/*--------------------------------------------------------------------------
@@ -9249,11 +11373,12 @@ H5S__hyper_get_seq_list(const H5S_t *space, unsigned H5_ATTR_UNUSED flags, H5S_s
DESCRIPTION
Projects the intersection of of the selections of src_space and
src_intersect_space within the selection of src_space as a selection
- within the selection of dst_space. The result is placed in the
- selection of proj_space. Note src_space, dst_space, and
- src_intersect_space do not need to use hyperslab selections, but they
- cannot use point selections. The result is always a hyperslab
- selection.
+ within the selection of dst_space. The result is placed in the selection
+ of proj_space. Note src_space, dst_space, and src_intersect_space do not
+ need to use hyperslab selections, but they cannot use point selections.
+ The result is always a hyperslab or none selection. Note also that
+ proj_space can share some span trees with dst_space, so proj_space
+ must not be subsequently modified if dst_space must be preserved.
GLOBAL VARIABLES
COMMENTS, BUGS, ASSUMPTIONS
EXAMPLES
@@ -9263,46 +11388,11 @@ herr_t
H5S__hyper_project_intersection(const H5S_t *src_space, const H5S_t *dst_space,
const H5S_t *src_intersect_space, H5S_t *proj_space)
{
- hsize_t ss_off[H5S_PROJECT_INTERSECT_NSEQS]; /* Offset array for src_space */
- size_t ss_len[H5S_PROJECT_INTERSECT_NSEQS]; /* Length array for src_space */
- size_t ss_nseq; /* Number of sequences for src_space */
- size_t ss_nelem; /* Number of elements for src_space */
- size_t ss_i = (size_t)0; /* Index into offset/length arrays for src_space */
- hbool_t advance_ss = FALSE; /* Whether to advance ss_i on the next iteration */
- H5S_sel_iter_t *ss_iter = NULL; /* Selection iterator for src_space */
- hbool_t ss_iter_init = FALSE; /* Whether ss_iter is initialized */
- hsize_t ss_sel_off = (hsize_t)0; /* Offset within src_space selection */
- hsize_t ds_off[H5S_PROJECT_INTERSECT_NSEQS]; /* Offset array for dst_space */
- size_t ds_len[H5S_PROJECT_INTERSECT_NSEQS]; /* Length array for dst_space */
- size_t ds_nseq; /* Number of sequences for dst_space */
- size_t ds_nelem; /* Number of elements for dst_space */
- size_t ds_i = (size_t)0; /* Index into offset/length arrays for dst_space */
- H5S_sel_iter_t *ds_iter = NULL; /* Selection iterator for dst_space */
- hbool_t ds_iter_init = FALSE; /* Whether ds_iter is initialized */
- hsize_t ds_sel_off = (hsize_t)0; /* Offset within dst_space selection */
- hsize_t sis_off[H5S_PROJECT_INTERSECT_NSEQS]; /* Offset array for src_intersect_space */
- size_t sis_len[H5S_PROJECT_INTERSECT_NSEQS]; /* Length array for src_intersect_space */
- size_t sis_nseq; /* Number of sequences for src_intersect_space */
- size_t sis_nelem; /* Number of elements for src_intersect_space */
- size_t sis_i = (size_t)0; /* Index into offset/length arrays for src_intersect_space */
- hbool_t advance_sis = FALSE; /* Whether to advance sis_i on the next iteration */
- H5S_sel_iter_t *sis_iter = NULL; /* Selection iterator for src_intersect_space */
- hbool_t sis_iter_init = FALSE; /* Whether sis_iter is initialized */
- hsize_t int_sel_off; /* Offset within intersected selections (ss/sis and ds/ps) */
- size_t int_len; /* Length of segment in intersected selections */
- hsize_t proj_off; /* Segment offset in proj_space */
- size_t proj_len; /* Segment length in proj_space */
- size_t proj_len_rem; /* Remaining length in proj_space for segment */
- hsize_t proj_down_dims[H5S_MAX_RANK]; /* "Down" dimensions in proj_space */
- H5S_hyper_span_info_t *curr_span_tree[H5S_MAX_RANK]; /* Current span tree being built (in each dimension) */
- H5S_hyper_span_t *prev_span[H5S_MAX_RANK]; /* Previous span in tree (in each dimension) */
- hsize_t curr_span_up_dim[H5S_MAX_RANK]; /* "Up" dimensions for current span */
- unsigned proj_rank; /* Rank of proj_space */
- hsize_t low; /* Low value of span */
- hsize_t high; /* High value of span */
- size_t span_len; /* Length of span */
- size_t nelem; /* Number of elements returned for get_seq_list op */
- unsigned i; /* Local index variable */
+ H5S_hyper_project_intersect_ud_t udata; /* User data for subroutines */
+ const H5S_hyper_span_info_t *ss_span_info;
+ const H5S_hyper_span_info_t *ds_span_info;
+ H5S_hyper_span_info_t *ss_span_info_buf = NULL;
+ H5S_hyper_span_info_t *ds_span_info_buf = NULL;
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_PACKAGE
@@ -9312,295 +11402,99 @@ H5S__hyper_project_intersection(const H5S_t *src_space, const H5S_t *dst_space,
HDassert(dst_space);
HDassert(src_intersect_space);
HDassert(proj_space);
-
+
/* Assert that src_space and src_intersect_space have same extent and there
* are no point selections */
HDassert(H5S_GET_EXTENT_NDIMS(src_space) == H5S_GET_EXTENT_NDIMS(src_intersect_space));
- HDassert(!HDmemcmp(src_space->extent.size, src_intersect_space->extent.size,
- (size_t)H5S_GET_EXTENT_NDIMS(src_space) * sizeof(src_space->extent.size[0])));
+ HDassert(H5S_GET_SELECT_NPOINTS(src_space) == H5S_GET_SELECT_NPOINTS(dst_space));
HDassert(H5S_GET_SELECT_TYPE(src_space) != H5S_SEL_POINTS);
HDassert(H5S_GET_SELECT_TYPE(dst_space) != H5S_SEL_POINTS);
- HDassert(H5S_GET_SELECT_TYPE(src_intersect_space) != H5S_SEL_POINTS);
-
- /* Initialize prev_space, curr_span_tree, and curr_span_up_dim */
- HDmemset(curr_span_tree, 0, sizeof(curr_span_tree));
- HDmemset(prev_span, 0, sizeof(prev_span));
- HDmemset(curr_span_up_dim, 0, sizeof(curr_span_up_dim));
-
- /* Save rank of projected space */
- proj_rank = proj_space->extent.rank;
- HDassert(proj_rank > 0);
+ HDassert(H5S_GET_SELECT_TYPE(src_intersect_space) == H5S_SEL_HYPERSLABS);
- /* Get numbers of elements */
- ss_nelem = (size_t)H5S_GET_SELECT_NPOINTS(src_space);
- ds_nelem = (size_t)H5S_GET_SELECT_NPOINTS(dst_space);
- sis_nelem = (size_t)H5S_GET_SELECT_NPOINTS(src_intersect_space);
- HDassert(ss_nelem == ds_nelem);
+ /* Set up ss_span_info */
+ if(H5S_GET_SELECT_TYPE(src_space) == H5S_SEL_HYPERSLABS) {
+ /* Make certain the selection has a span tree */
+ if(NULL == src_space->select.sel_info.hslab->span_lst)
+ if(H5S__hyper_generate_spans((H5S_t *)src_space) < 0) /* Casting away const OK -NAF */
+ HGOTO_ERROR(H5E_DATASPACE, H5E_UNINITIALIZED, FAIL, "can't construct span tree for source hyperslab selection")
- /* Calculate proj_down_dims */
- if(H5VM_array_down(proj_rank, proj_space->extent.size, proj_down_dims) < 0)
- HGOTO_ERROR(H5E_DATASPACE, H5E_CANTSET, FAIL, "can't compute 'down' chunk size value")
-
- /* Remove current selection from proj_space */
- if(H5S_SELECT_RELEASE(proj_space) < 0)
- HGOTO_ERROR(H5E_DATASPACE, H5E_CANTDELETE, FAIL, "can't release selection")
-
- /* If any selections are empty, skip to the end so "none" is selected */
- if((ss_nelem == 0) || (ds_nelem == 0) || (sis_nelem == 0))
- goto loop_end;
-
- /* Allocate space for the hyperslab selection information (note this sets
- * diminfo_valid to FALSE, diminfo arrays to 0, and span list to NULL) */
- if(NULL == (proj_space->select.sel_info.hslab = H5FL_CALLOC(H5S_hyper_sel_t)))
- HGOTO_ERROR(H5E_DATASPACE, H5E_CANTALLOC, FAIL, "can't allocate hyperslab info")
-
- /* Set selection type */
- proj_space->select.type = H5S_sel_hyper;
-
- /* Set unlim_dim */
- proj_space->select.sel_info.hslab->unlim_dim = -1;
-
- /* Allocate the source selection iterator */
- if(NULL == (ss_iter = H5FL_MALLOC(H5S_sel_iter_t)))
- HGOTO_ERROR(H5E_DATASPACE, H5E_CANTALLOC, FAIL, "can't allocate source selection iterator")
-
- /* Initialize source space iterator */
- if(H5S_select_iter_init(ss_iter, src_space, (size_t)1) < 0)
- HGOTO_ERROR(H5E_DATASPACE, H5E_CANTINIT, FAIL, "unable to initialize selection iterator")
- ss_iter_init = TRUE;
-
- /* Get sequence list for source space */
- if(H5S_SELECT_GET_SEQ_LIST(src_space, 0u, ss_iter, H5S_PROJECT_INTERSECT_NSEQS, ss_nelem, &ss_nseq, &nelem, ss_off, ss_len) < 0)
- HGOTO_ERROR(H5E_INTERNAL, H5E_UNSUPPORTED, FAIL, "sequence length generation failed")
- ss_nelem -= nelem;
- HDassert(ss_nseq > 0);
-
- /* Allocate the destination selection iterator */
- if(NULL == (ds_iter = H5FL_MALLOC(H5S_sel_iter_t)))
- HGOTO_ERROR(H5E_DATASPACE, H5E_CANTALLOC, FAIL, "can't allocate destination selection iterator")
-
- /* Initialize destination space iterator */
- if(H5S_select_iter_init(ds_iter, dst_space, (size_t)1) < 0)
- HGOTO_ERROR(H5E_DATASPACE, H5E_CANTINIT, FAIL, "unable to initialize selection iterator")
- ds_iter_init = TRUE;
-
- /* Get sequence list for destination space */
- if(H5S_SELECT_GET_SEQ_LIST(dst_space, 0u, ds_iter, H5S_PROJECT_INTERSECT_NSEQS, ds_nelem, &ds_nseq, &nelem, ds_off, ds_len) < 0)
- HGOTO_ERROR(H5E_DATASPACE, H5E_CANTINIT, FAIL, "unable to initialize selection iterator")
- ds_nelem -= nelem;
- HDassert(ds_nseq > 0);
-
- /* Allocate the source intersect space iterator */
- if(NULL == (sis_iter = H5FL_MALLOC(H5S_sel_iter_t)))
- HGOTO_ERROR(H5E_DATASPACE, H5E_CANTALLOC, FAIL, "can't allocate source intersect space iterator")
-
- /* Initialize source intersect space iterator */
- if(H5S_select_iter_init(sis_iter, src_intersect_space, (size_t)1) < 0)
- HGOTO_ERROR(H5E_DATASPACE, H5E_CANTINIT, FAIL, "unable to initialize selection iterator")
- sis_iter_init = TRUE;
-
- /* Get sequence list for source intersect space */
- if(H5S_SELECT_GET_SEQ_LIST(src_intersect_space, 0u, sis_iter, H5S_PROJECT_INTERSECT_NSEQS, sis_nelem, &sis_nseq, &nelem, sis_off, sis_len) < 0)
- HGOTO_ERROR(H5E_INTERNAL, H5E_UNSUPPORTED, FAIL, "sequence length generation failed")
- sis_nelem -= nelem;
- HDassert(sis_nseq > 0);
-
- /* Loop until we run out of sequences in either the source or source
- * intersect space */
- while(1) {
- while(advance_ss || (ss_off[ss_i] + ss_len[ss_i] <= sis_off[sis_i])) {
- /* Either we finished the current source sequence or the
- * sequences do not intersect. Advance source space. */
- ss_sel_off += (hsize_t)ss_len[ss_i];
- if(++ss_i == ss_nseq) {
- if(ss_nelem > 0) {
- /* Try to grab more sequences from src_space */
- if(H5S_SELECT_GET_SEQ_LIST(src_space, 0u, ss_iter, H5S_PROJECT_INTERSECT_NSEQS, ss_nelem, &ss_nseq, &nelem, ss_off, ss_len) < 0)
- HGOTO_ERROR(H5E_INTERNAL, H5E_UNSUPPORTED, FAIL, "sequence length generation failed")
- HDassert(ss_len[0] > 0);
-
- /* Update ss_nelem */
- HDassert(nelem > 0);
- HDassert(nelem <= ss_nelem);
- ss_nelem -= nelem;
-
- /* Reset source space index */
- ss_i = 0;
- } /* end if */
- else
- /* There are no more sequences in src_space, so we can exit
- * the loop. Use goto instead of break so we exit the outer
- * loop. */
- goto loop_end;
- } /* end if */
-
- /* Reset advance_ss */
- advance_ss = FALSE;
- } /* end while */
- if(advance_sis || (sis_off[sis_i] + sis_len[sis_i] <= ss_off[ss_i])) {
- do {
- /* Either we finished the current source intersect sequence or
- * the sequences do not intersect. Advance source intersect
- * space. */
- if(++sis_i == sis_nseq) {
- if(sis_nelem > 0) {
- /* Try to grab more sequences from src_intersect_space
- */
- if(H5S_SELECT_GET_SEQ_LIST(src_intersect_space, 0u, sis_iter, H5S_PROJECT_INTERSECT_NSEQS, sis_nelem, &sis_nseq, &nelem, sis_off, sis_len) < 0)
- HGOTO_ERROR(H5E_INTERNAL, H5E_UNSUPPORTED, FAIL, "sequence length generation failed")
- HDassert(sis_len[0] > 0);
-
- /* Update ss_nelem */
- HDassert(nelem > 0);
- HDassert(nelem <= sis_nelem);
- sis_nelem -= nelem;
-
- /* Reset source space index */
- sis_i = 0;
- } /* end if */
- else
- /* There are no more sequences in src_intersect_space,
- * so we can exit the loop. Use goto instead of break
- * so we exit the outer loop. */
- goto loop_end;
- } /* end if */
- } while(sis_off[sis_i] + sis_len[sis_i] <= ss_off[ss_i]);
+ /* Simply point to existing span tree */
+ ss_span_info = src_space->select.sel_info.hslab->span_lst;
+ } /* end if */
+ else {
+ /* Create temporary span tree from all selection */
+ HDassert(H5S_GET_SELECT_TYPE(src_space) == H5S_SEL_ALL);
- /* Reset advance_sis */
- advance_sis = FALSE;
- } /* end if */
- else {
- /* Sequences intersect, add intersection to projected space */
- /* Calculate intersection sequence in terms of offset within source
- * selection and advance any sequences we complete */
- if(ss_off[ss_i] >= sis_off[sis_i])
- int_sel_off = ss_sel_off;
- else
- int_sel_off = sis_off[sis_i] - ss_off[ss_i] + ss_sel_off;
- if((ss_off[ss_i] + (hsize_t)ss_len[ss_i]) <= (sis_off[sis_i]
- + (hsize_t)sis_len[sis_i])) {
- int_len = (size_t)((hsize_t)ss_len[ss_i] + ss_sel_off - int_sel_off);
- advance_ss = TRUE;
- } /* end if */
- else
- int_len = (size_t)(sis_off[sis_i] + (hsize_t)sis_len[sis_i] - ss_off[ss_i] + ss_sel_off - int_sel_off);
- if((ss_off[ss_i] + (hsize_t)ss_len[ss_i]) >= (sis_off[sis_i]
- + (hsize_t)sis_len[sis_i]))
- advance_sis = TRUE;
-
- /* Project intersection sequence to destination selection */
- while(int_len > (size_t)0) {
- while(ds_sel_off + (hsize_t)ds_len[ds_i] <= int_sel_off) {
- /* Intersection is not projected to this destination
- * sequence, advance destination space */
- ds_sel_off += (hsize_t)ds_len[ds_i];
- if(++ds_i == ds_nseq) {
- HDassert(ds_nelem > 0);
-
- /* Try to grab more sequences from dst_space */
- if(H5S_SELECT_GET_SEQ_LIST(dst_space, 0u, ds_iter, H5S_PROJECT_INTERSECT_NSEQS, ds_nelem, &ds_nseq, &nelem, ds_off, ds_len) < 0)
- HGOTO_ERROR(H5E_INTERNAL, H5E_UNSUPPORTED, FAIL, "sequence length generation failed")
- HDassert(ds_len[0] > 0);
-
- /* Update ss_nelem */
- HDassert(nelem > 0);
- HDassert(nelem <= ds_nelem);
- ds_nelem -= nelem;
-
- /* Reset source space index */
- ds_i = 0;
- } /* end if */
- } /* end while */
+ if(NULL == (ss_span_info_buf = H5S__hyper_make_spans(H5S_GET_EXTENT_NDIMS(src_space),
+ H5S_hyper_zeros_g, H5S_hyper_zeros_g, H5S_hyper_ones_g, src_space->extent.size)))
+ HGOTO_ERROR(H5E_DATASPACE, H5E_CANTINIT, FAIL, "can't create span tree for ALL source space")
+ ss_span_info = ss_span_info_buf;
+ } /* end else */
- /* Add sequence to projected space */
- HDassert(ds_sel_off <= int_sel_off);
- proj_off = ds_off[ds_i] + int_sel_off - ds_sel_off;
- proj_len = proj_len_rem = (size_t)MIN(int_len,
- (size_t)(ds_sel_off + (hsize_t)ds_len[ds_i] - int_sel_off));
-
- /* Add to span tree */
- while(proj_len_rem > (size_t)0) {
- /* Check for more than one full row (in every dim) and
- * append multiple spans at once? -NAF */
- /* Append spans in higher dimensions if we're going ouside
- * the plane of the span currently being built (i.e. it's
- * finished being built) */
- for(i = proj_rank - 1; ((i > 0)
- && ((proj_off / proj_down_dims[i - 1])
- != curr_span_up_dim[i - 1])); i--) {
- if(curr_span_tree[i]) {
- HDassert(prev_span[i]);
-
- /* Append complete lower dimension span tree to
- * current dimension */
- low = curr_span_up_dim[i - 1] % proj_space->extent.size[i - 1];
- if(H5S__hyper_append_span(&prev_span[i - 1], &curr_span_tree[i - 1], low, low, curr_span_tree[i], NULL) < 0)
- HGOTO_ERROR(H5E_DATASPACE, H5E_CANTAPPEND, FAIL, "can't allocate hyperslab span")
+ /* Set up ds_span_info */
+ if(H5S_GET_SELECT_TYPE(dst_space) == H5S_SEL_HYPERSLABS) {
+ /* Make certain the selection has a span tree */
+ if(NULL == dst_space->select.sel_info.hslab->span_lst)
+ if(H5S__hyper_generate_spans((H5S_t *)dst_space) < 0) /* Casting away const OK -NAF */
+ HGOTO_ERROR(H5E_DATASPACE, H5E_UNINITIALIZED, FAIL, "can't construct span tree for dsetination hyperslab selection")
- /* Reset lower dimension's span tree and previous
- * span since we just committed it and will start
- * over with a new one */
- if(H5S__hyper_free_span_info(curr_span_tree[i]) < 0)
- HGOTO_ERROR(H5E_DATASPACE, H5E_CANTFREE, FAIL, "can't free span info")
- curr_span_tree[i] = NULL;
- prev_span[i] = NULL;
- } /* end if */
+ /* Simply point to existing span tree */
+ ds_span_info = dst_space->select.sel_info.hslab->span_lst;
+ } /* end if */
+ else {
+ /* Create temporary span tree from all selection */
+ HDassert(H5S_GET_SELECT_TYPE(dst_space) == H5S_SEL_ALL);
- /* Update curr_span_up_dim */
- curr_span_up_dim[i - 1] = proj_off / proj_down_dims[i - 1];
- } /* end for */
+ if(NULL == (ds_span_info_buf = H5S__hyper_make_spans(H5S_GET_EXTENT_NDIMS(dst_space),
+ H5S_hyper_zeros_g, H5S_hyper_zeros_g, H5S_hyper_ones_g, dst_space->extent.size)))
+ HGOTO_ERROR(H5E_DATASPACE, H5E_CANTINIT, FAIL, "can't create span tree for ALL destination space")
+ ds_span_info = ds_span_info_buf;
+ } /* end else */
- /* Compute bounds for new span in lowest dimension */
- low = proj_off % proj_space->extent.size[proj_rank - 1];
- span_len = MIN(proj_len_rem,
- (size_t)(proj_space->extent.size[proj_rank - 1]
- - low));
- HDassert(proj_len_rem >= span_len);
- high = (low + (hsize_t)span_len) - (hsize_t)1;
+ /* Make certain the source intersect selection has a span tree */
+ if(NULL == src_intersect_space->select.sel_info.hslab->span_lst)
+ if(H5S__hyper_generate_spans((H5S_t *)src_intersect_space) < 0) /* Casting away const OK -NAF */
+ HGOTO_ERROR(H5E_DATASPACE, H5E_UNINITIALIZED, FAIL, "can't construct span tree for source intersect hyperslab selection")
- /* Append span in lowest dimension */
- if(H5S__hyper_append_span(&prev_span[proj_rank - 1], &curr_span_tree[proj_rank - 1], low, high, NULL, NULL) < 0)
- HGOTO_ERROR(H5E_DATASPACE, H5E_CANTAPPEND, FAIL, "can't allocate hyperslab span")
+ /* Initialize udata */
+ HDmemset(&udata, 0, sizeof(udata));
+ udata.ds_span[0] = ds_span_info->head;
+ udata.ds_low[0] = udata.ds_span[0]->low;
+ udata.ss_rank = H5S_GET_EXTENT_NDIMS(src_space);
+ udata.ds_rank = H5S_GET_EXTENT_NDIMS(dst_space);
+ udata.op_gen = H5S__hyper_get_op_gen();
- /* Update remaining offset and length */
- proj_off += (hsize_t)span_len;
- proj_len_rem -= span_len;
- } /* end while */
+ /* Iterate over selections and build projected span tree */
+ if(H5S__hyper_proj_int_iterate(ss_span_info, src_intersect_space->select.sel_info.hslab->span_lst, 1, 0, &udata) < 0)
+ HGOTO_ERROR(H5E_DATASPACE, H5E_CANTCOMPARE, FAIL, "selection iteration failed")
- /* Update intersection sequence */
- int_sel_off += (hsize_t)proj_len;
- int_len -= proj_len;
- } /* end while */
- } /* end else */
- } /* end while */
+ /* Remove current selection from proj_space */
+ if(H5S_SELECT_RELEASE(proj_space) < 0)
+ HGOTO_ERROR(H5E_DATASPACE, H5E_CANTDELETE, FAIL, "can't release selection")
-loop_end:
- /* Add remaining spans to span tree */
- for(i = proj_rank - 1; i > 0; i--)
- if(curr_span_tree[i]) {
- HDassert(prev_span[i]);
+ /* Check for elements in projected space */
+ if(udata.ps_span_info[0]) {
+ /* Allocate space for the hyperslab selection information (note this sets
+ * diminfo_valid to FALSE, diminfo arrays to 0, and span list to NULL) */
+ if(NULL == (proj_space->select.sel_info.hslab = H5FL_CALLOC(H5S_hyper_sel_t)))
+ HGOTO_ERROR(H5E_DATASPACE, H5E_CANTALLOC, FAIL, "can't allocate hyperslab info")
- /* Append remaining span tree to higher dimension */
- low = curr_span_up_dim[i - 1] % proj_space->extent.size[i - 1];
- if(H5S__hyper_append_span(&prev_span[i - 1], &curr_span_tree[i - 1], low, low, curr_span_tree[i], NULL) < 0)
- HGOTO_ERROR(H5E_DATASPACE, H5E_CANTAPPEND, FAIL, "can't allocate hyperslab span")
+ /* Set selection type */
+ proj_space->select.type = H5S_sel_hyper;
- /* Reset span tree */
- if(H5S__hyper_free_span_info(curr_span_tree[i]) < 0)
- HGOTO_ERROR(H5E_DATASPACE, H5E_CANTFREE, FAIL, "can't free span info")
- curr_span_tree[i] = NULL;
- } /* end if */
+ /* Set unlim_dim */
+ proj_space->select.sel_info.hslab->unlim_dim = -1;
- /* Add span tree to proj_space */
- if(curr_span_tree[0]) {
- proj_space->select.sel_info.hslab->span_lst = curr_span_tree[0];
- curr_span_tree[0] = NULL;
+ /* Set span tree */
+ proj_space->select.sel_info.hslab->span_lst = udata.ps_span_info[0];
+ udata.ps_span_info[0] = NULL;
/* Set the number of elements in current selection */
proj_space->select.num_elem = H5S__hyper_spans_nelem(proj_space->select.sel_info.hslab->span_lst);
- /* Attempt to rebuild "optimized" start/stride/count/block information.
- * from resulting hyperslab span tree */
+ /* Attempt to build "optimized" start/stride/count/block information
+ * from resulting hyperslab span tree.
+ */
H5S__hyper_rebuild(proj_space);
} /* end if */
else
@@ -9609,153 +11503,42 @@ loop_end:
HGOTO_ERROR(H5E_DATASPACE, H5E_CANTDELETE, FAIL, "can't convert selection")
done:
- /* Release source selection iterator */
- if(ss_iter_init && H5S_SELECT_ITER_RELEASE(ss_iter) < 0)
- HDONE_ERROR(H5E_DATASPACE, H5E_CANTRELEASE, FAIL, "unable to release selection iterator")
- if(ss_iter)
- ss_iter = H5FL_FREE(H5S_sel_iter_t, ss_iter);
-
- /* Release destination selection iterator */
- if(ds_iter_init && H5S_SELECT_ITER_RELEASE(ds_iter) < 0)
- HDONE_ERROR(H5E_DATASPACE, H5E_CANTRELEASE, FAIL, "unable to release selection iterator")
- if(ds_iter)
- ds_iter = H5FL_FREE(H5S_sel_iter_t, ds_iter);
-
- /* Release source intersect selection iterator */
- if(sis_iter_init && H5S_SELECT_ITER_RELEASE(sis_iter) < 0)
- HDONE_ERROR(H5E_DATASPACE, H5E_CANTRELEASE, FAIL, "unable to release selection iterator")
- if(sis_iter)
- sis_iter = H5FL_FREE(H5S_sel_iter_t, sis_iter);
+ /* Free ss_span_info_buf */
+ if(ss_span_info_buf) {
+ H5S__hyper_free_span_info(ss_span_info_buf);
+ ss_span_info_buf = NULL;
+ } /* end if */
+
+ /* Free ds_span_info_buf */
+ if(ds_span_info_buf) {
+ H5S__hyper_free_span_info(ds_span_info_buf);
+ ds_span_info_buf = NULL;
+ } /* end if */
/* Cleanup on error */
if(ret_value < 0) {
- /* Remove current selection from proj_space */
- if(H5S_SELECT_RELEASE(proj_space) < 0)
- HDONE_ERROR(H5E_DATASPACE, H5E_CANTDELETE, FAIL, "can't release selection")
+ unsigned u;
/* Free span trees */
- for(i = 0; i < proj_rank; i++)
- if(curr_span_tree[i]) {
- if(H5S__hyper_free_span_info(curr_span_tree[i]) < 0)
- HGOTO_ERROR(H5E_DATASPACE, H5E_CANTFREE, FAIL, "can't free span info")
- curr_span_tree[i] = NULL;
+ for(u = 0; u < udata.ds_rank; u++)
+ if(udata.ps_span_info[u]) {
+ H5S__hyper_free_span_info(udata.ps_span_info[u]);
+ udata.ps_span_info[u] = NULL;
} /* end if */
} /* end if */
- FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5S__hyper_project_intersection() */
-
-
-/*--------------------------------------------------------------------------
- NAME
- H5S__hyper_subtract
- PURPOSE
- Subtract one hyperslab selection from another
- USAGE
- herr_t H5S__hyper_subtract(space,subtract_space)
- H5S_t *space; IN/OUT: Selection to be operated on
- H5S_t *subtract_space; IN: Selection that will be subtracted from space
- RETURNS
- Non-negative on success/Negative on failure.
- DESCRIPTION
- Removes any and all portions of space that are also present in
- subtract_space. In essence, performs an A_NOT_B operation with the
- two selections.
-
- Note this function basically duplicates a subset of the functionality
- of H5S_select_select(). It should probably be removed when that
- function is enabled.
- GLOBAL VARIABLES
- COMMENTS, BUGS, ASSUMPTIONS
- EXAMPLES
- REVISION LOG
---------------------------------------------------------------------------*/
-herr_t
-H5S__hyper_subtract(H5S_t *space, H5S_t *subtract_space)
-{
- H5S_hyper_span_info_t *a_not_b = NULL; /* Span tree for hyperslab spans in old span tree and not in new span tree */
- H5S_hyper_span_info_t *a_and_b = NULL; /* Span tree for hyperslab spans in both old and new span trees */
- H5S_hyper_span_info_t *b_not_a = NULL; /* Span tree for hyperslab spans in new span tree and not in old span tree */
- herr_t ret_value = SUCCEED; /* Return value */
-
- FUNC_ENTER_NOAPI_NOINIT
-
- /* Check args */
- HDassert(space);
- HDassert(subtract_space);
-
- /* Check that the space selections both have span trees */
- if(space->select.sel_info.hslab->span_lst == NULL)
- if(H5S__hyper_generate_spans(space) < 0)
- HGOTO_ERROR(H5E_DATASPACE, H5E_UNINITIALIZED, FAIL, "dataspace does not have span tree")
- if(subtract_space->select.sel_info.hslab->span_lst == NULL)
- if(H5S__hyper_generate_spans(subtract_space) < 0)
- HGOTO_ERROR(H5E_DATASPACE, H5E_UNINITIALIZED, FAIL, "dataspace does not have span tree")
-
- /* Generate lists of spans which overlap and don't overlap */
- if(H5S__hyper_clip_spans(space->select.sel_info.hslab->span_lst, subtract_space->select.sel_info.hslab->span_lst, &a_not_b, &a_and_b, &b_not_a)<0)
- HGOTO_ERROR(H5E_DATASPACE, H5E_CANTCLIP, FAIL, "can't clip hyperslab information")
-
- /* Reset the other dataspace selection information */
- if(H5S_SELECT_RELEASE(space) < 0)
- HGOTO_ERROR(H5E_DATASPACE, H5E_CANTDELETE, FAIL, "can't release selection")
-
- /* Allocate space for the hyperslab selection information */
- if((space->select.sel_info.hslab = H5FL_CALLOC(H5S_hyper_sel_t)) == NULL)
- HGOTO_ERROR(H5E_DATASPACE, H5E_NOSPACE, FAIL, "can't allocate hyperslab info")
-
- /* Set unlim_dim */
- space->select.sel_info.hslab->unlim_dim = -1;
-
- /* Check for anything returned in a_not_b */
- if(a_not_b) {
- /* Update spans in space */
- space->select.sel_info.hslab->span_lst = a_not_b;
- a_not_b = NULL;
-
- /* Update number of elements */
- space->select.num_elem = H5S__hyper_spans_nelem(space->select.sel_info.hslab->span_lst);
-
- /* Attempt to rebuild "optimized" start/stride/count/block information.
- * from resulting hyperslab span tree */
- H5S__hyper_rebuild(space);
- } /* end if */
- else {
- H5S_hyper_span_info_t *spans; /* Empty hyperslab span tree */
-
- /* Set number of elements */
- space->select.num_elem = 0;
+#ifndef NDEBUG
+ /* Verify there are no more span trees */
+ {
+ unsigned u;
- /* Allocate a span info node */
- if(NULL == (spans = H5FL_MALLOC(H5S_hyper_span_info_t)))
- HGOTO_ERROR(H5E_DATASPACE, H5E_CANTALLOC, FAIL, "can't allocate hyperslab span")
-
- /* Set the reference count */
- spans->count = 1;
-
- /* Reset the scratch pad space */
- spans->scratch = 0;
-
- /* Set to empty tree */
- spans->head = NULL;
-
- /* Set pointer to empty span tree */
- space->select.sel_info.hslab->span_lst = spans;
- } /* end if */
-
-done:
- /* Free span trees */
- if(a_and_b)
- H5S__hyper_free_span_info(a_and_b);
- if(b_not_a)
- H5S__hyper_free_span_info(b_not_a);
- if(a_not_b) {
- HDassert(ret_value < 0);
- H5S__hyper_free_span_info(b_not_a);
- } /* end if */
+ for(u = 0; u < H5S_MAX_RANK; u++)
+ HDassert(!udata.ps_span_info[u]);
+ } /* end block */
+#endif /* NDEBUG */
FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5S__hyper_subtract() */
+} /* end H5S__hyper_project_intersection() */
/*--------------------------------------------------------------------------
@@ -9826,7 +11609,7 @@ H5S__hyper_get_clip_diminfo(hsize_t start, hsize_t stride, hsize_t *count,
RETURNS
Non-negative on success/Negative on failure.
DESCRIPTION
- This function changes the unlimited selection into a limited selection
+ This function changes the unlimited selection into a fixed-dimension selection
with the extent of the formerly unlimited dimension specified by clip_size.
GLOBAL VARIABLES
COMMENTS, BUGS, ASSUMPTIONS
@@ -9837,11 +11620,11 @@ H5S__hyper_get_clip_diminfo(hsize_t start, hsize_t stride, hsize_t *count,
herr_t
H5S_hyper_clip_unlim(H5S_t *space, hsize_t clip_size)
{
- H5S_hyper_sel_t *hslab; /* Convenience pointer to hyperslab info */
- hsize_t orig_count; /* Original count in unlimited dimension */
- int orig_unlim_dim; /* Original unliminted dimension */
- H5S_hyper_dim_t *diminfo; /* Convenience pointer to opt_diminfo in unlimited dimension */
- herr_t ret_value = SUCCEED;
+ H5S_hyper_sel_t *hslab = NULL; /* Convenience pointer to hyperslab info */
+ hsize_t orig_count; /* Original count in unlimited dimension */
+ int orig_unlim_dim; /* Original unliminted dimension */
+ H5S_hyper_dim_t *diminfo = NULL; /* Convenience pointer to diminfo.opt in unlimited dimension */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(FAIL)
@@ -9855,7 +11638,8 @@ H5S_hyper_clip_unlim(H5S_t *space, hsize_t clip_size)
/* Save original unlimited dimension */
orig_unlim_dim = hslab->unlim_dim;
- diminfo = &hslab->opt_diminfo[orig_unlim_dim];
+ /* Set up convenience pointer */
+ diminfo = &hslab->diminfo.opt[orig_unlim_dim];
/* Save original count in unlimited dimension */
orig_count = diminfo->count;
@@ -9871,14 +11655,18 @@ H5S_hyper_clip_unlim(H5S_t *space, hsize_t clip_size)
/* Convert to "none" selection */
if(H5S_select_none(space) < 0)
HGOTO_ERROR(H5E_DATASPACE, H5E_CANTDELETE, FAIL, "can't convert selection")
+
+ /* Reset the convenience pointers */
+ hslab = NULL;
+ diminfo = NULL;
} /* end if */
/* Check for single block in unlimited dimension */
else if(orig_count == (hsize_t)1) {
/* Calculate number of elements */
space->select.num_elem = diminfo->block * hslab->num_elem_non_unlim;
- /* Mark that opt_diminfo is valid */
- hslab->diminfo_valid = TRUE;
+ /* Mark that diminfo.opt is valid */
+ hslab->diminfo_valid = H5S_DIMINFO_VALID_YES;
} /* end if */
else {
/* Calculate number of elements */
@@ -9891,7 +11679,7 @@ H5S_hyper_clip_unlim(H5S_t *space, hsize_t clip_size)
> (clip_size - diminfo->start)) {
hsize_t start[H5S_MAX_RANK];
hsize_t block[H5S_MAX_RANK];
- unsigned i;
+ unsigned u;
/* Last block is partial, need to construct compound selection */
/* Fill start with zeros */
@@ -9899,11 +11687,11 @@ H5S_hyper_clip_unlim(H5S_t *space, hsize_t clip_size)
/* Set block to clip_size in unlimited dimension, H5S_MAX_SIZE in
* others so only unlimited dimension is clipped */
- for(i = 0; i < space->extent.rank; i++)
- if((int)i == orig_unlim_dim)
- block[i] = clip_size;
+ for(u = 0; u < space->extent.rank; u++)
+ if((int)u == orig_unlim_dim)
+ block[u] = clip_size;
else
- block[i] = H5S_MAX_SIZE;
+ block[u] = H5S_MAX_SIZE;
/* Generate span tree in selection */
if(!hslab->span_lst)
@@ -9911,17 +11699,24 @@ H5S_hyper_clip_unlim(H5S_t *space, hsize_t clip_size)
HGOTO_ERROR(H5E_DATASPACE, H5E_CANTINIT, FAIL, "unable to generate span tree")
/* Indicate that the regular dimensions are no longer valid */
- hslab->diminfo_valid = FALSE;
+ hslab->diminfo_valid = H5S_DIMINFO_VALID_NO;
/* "And" selection with calculated block to perform clip operation */
if(H5S__generate_hyperslab(space, H5S_SELECT_AND, start, H5S_hyper_ones_g, H5S_hyper_ones_g, block) < 0)
HGOTO_ERROR(H5E_DATASPACE, H5E_CANTINSERT, FAIL, "can't generate hyperslabs")
} /* end if */
else
- /* Last block is complete, simply mark that opt_diminfo is valid */
- hslab->diminfo_valid = TRUE;
+ /* Last block is complete, simply mark that diminfo.opt is valid */
+ hslab->diminfo_valid = H5S_DIMINFO_VALID_YES;
} /* end else */
+ /* Update the upper bound, if the diminfo is valid */
+ if(hslab && (H5S_DIMINFO_VALID_YES == hslab->diminfo_valid))
+ hslab->diminfo.high_bounds[orig_unlim_dim] =
+ hslab->diminfo.opt[orig_unlim_dim].start +
+ hslab->diminfo.opt[orig_unlim_dim].stride * (hslab->diminfo.opt[orig_unlim_dim].count - 1) +
+ (hslab->diminfo.opt[orig_unlim_dim].block - 1);
+
done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5S_hyper_clip_unlim() */
@@ -9970,7 +11765,7 @@ H5S__hyper_get_clip_extent_real(const H5S_t *clip_space, hsize_t num_slices,
HDassert(clip_space->select.sel_info.hslab);
HDassert(clip_space->select.sel_info.hslab->unlim_dim >= 0);
- diminfo = &clip_space->select.sel_info.hslab->opt_diminfo[clip_space->select.sel_info.hslab->unlim_dim];
+ diminfo = &clip_space->select.sel_info.hslab->diminfo.opt[clip_space->select.sel_info.hslab->unlim_dim];
if(num_slices == 0)
ret_value = incl_trail ? diminfo->start : 0;
@@ -10124,7 +11919,7 @@ H5S_hyper_get_clip_extent_match(const H5S_t *clip_space,
HDassert(clip_space->select.sel_info.hslab->num_elem_non_unlim
== match_space->select.sel_info.hslab->num_elem_non_unlim);
- match_diminfo = &match_space->select.sel_info.hslab->opt_diminfo[match_space->select.sel_info.hslab->unlim_dim];
+ match_diminfo = &match_space->select.sel_info.hslab->diminfo.opt[match_space->select.sel_info.hslab->unlim_dim];
/* Get initial count and block */
count = match_diminfo->count;
@@ -10188,13 +11983,13 @@ H5S_t *
H5S_hyper_get_unlim_block(const H5S_t *space, hsize_t block_index)
{
H5S_hyper_sel_t *hslab; /* Convenience pointer to hyperslab info */
- H5S_t *space_out = NULL;
- hsize_t start[H5S_MAX_RANK];
+ H5S_t *space_out = NULL; /* Dataspace to return */
+ hsize_t start[H5S_MAX_RANK];/* Hyperslab selection info for unlim. selection */
hsize_t stride[H5S_MAX_RANK];
hsize_t count[H5S_MAX_RANK];
hsize_t block[H5S_MAX_RANK];
- unsigned i;
- H5S_t *ret_value = NULL;
+ unsigned u; /* Local index variable */
+ H5S_t *ret_value = NULL; /* Return value */
FUNC_ENTER_NOAPI(NULL)
@@ -10203,29 +11998,29 @@ H5S_hyper_get_unlim_block(const H5S_t *space, hsize_t block_index)
hslab = space->select.sel_info.hslab;
HDassert(hslab);
HDassert(hslab->unlim_dim >= 0);
- HDassert(hslab->opt_diminfo[hslab->unlim_dim].count == H5S_UNLIMITED);
+ HDassert(hslab->diminfo.opt[hslab->unlim_dim].count == H5S_UNLIMITED);
/* Set start to select block_indexth block in unlimited dimension and set
* count to 1 in that dimension to only select that block. Copy all other
* diminfo parameters. */
- for(i = 0; i < space->extent.rank; i++) {
- if((int)i == hslab->unlim_dim){
- start[i] = hslab->opt_diminfo[i].start + (block_index
- * hslab->opt_diminfo[i].stride);
- count[i] = (hsize_t)1;
+ for(u = 0; u < space->extent.rank; u++) {
+ if((int)u == hslab->unlim_dim){
+ start[u] = hslab->diminfo.opt[u].start + (block_index
+ * hslab->diminfo.opt[u].stride);
+ count[u] = (hsize_t)1;
} /* end if */
else {
- start[i] = hslab->opt_diminfo[i].start;
- count[i] = hslab->opt_diminfo[i].count;
+ start[u] = hslab->diminfo.opt[u].start;
+ count[u] = hslab->diminfo.opt[u].count;
} /* end else */
- stride[i] = hslab->opt_diminfo[i].stride;
- block[i] = hslab->opt_diminfo[i].block;
+ stride[u] = hslab->diminfo.opt[u].stride;
+ block[u] = hslab->diminfo.opt[u].block;
} /* end for */
/* Create output space, copy extent */
if(NULL == (space_out = H5S_create(H5S_SIMPLE)))
HGOTO_ERROR(H5E_DATASPACE, H5E_CANTCREATE, NULL, "unable to create output dataspace")
- if(H5S_extent_copy_real(&space_out->extent, &space->extent, TRUE) < 0)
+ if(H5S__extent_copy_real(&space_out->extent, &space->extent, TRUE) < 0)
HGOTO_ERROR(H5E_DATASPACE, H5E_CANTCOPY, NULL, "unable to copy destination space extent")
/* Select block as defined by start/stride/count/block computed above */
@@ -10274,7 +12069,7 @@ H5S_hyper_get_first_inc_block(const H5S_t *space, hsize_t clip_size,
hbool_t *partial)
{
H5S_hyper_sel_t *hslab; /* Convenience pointer to hyperslab info */
- H5S_hyper_dim_t *diminfo; /* Convenience pointer to opt_diminfo in unlimited dimension */
+ H5S_hyper_dim_t *diminfo; /* Convenience pointer to diminfo.opt in unlimited dimension */
hsize_t ret_value = 0;
FUNC_ENTER_NOAPI(0)
@@ -10284,9 +12079,9 @@ H5S_hyper_get_first_inc_block(const H5S_t *space, hsize_t clip_size,
hslab = space->select.sel_info.hslab;
HDassert(hslab);
HDassert(hslab->unlim_dim >= 0);
- HDassert(hslab->opt_diminfo[hslab->unlim_dim].count == H5S_UNLIMITED);
+ HDassert(hslab->diminfo.opt[hslab->unlim_dim].count == H5S_UNLIMITED);
- diminfo = &hslab->opt_diminfo[hslab->unlim_dim];
+ diminfo = &hslab->diminfo.opt[hslab->unlim_dim];
/* Check for selection outside of clip_size */
if(diminfo->start >= clip_size) {
@@ -10352,7 +12147,7 @@ H5Sis_regular_hyperslab(hid_t spaceid)
done:
FUNC_LEAVE_API(ret_value)
-} /* H5Sis_regular_hyperslab() */
+} /* end H5Sis_regular_hyperslab() */
/*--------------------------------------------------------------------------
@@ -10403,18 +12198,18 @@ H5Sget_regular_hyperslab(hid_t spaceid, hsize_t start[], hsize_t stride[],
/* Retrieve hyperslab parameters */
if(start)
for(u = 0; u < space->extent.rank; u++)
- start[u] = space->select.sel_info.hslab->app_diminfo[u].start;
+ start[u] = space->select.sel_info.hslab->diminfo.app[u].start;
if(stride)
for(u = 0; u < space->extent.rank; u++)
- stride[u] = space->select.sel_info.hslab->app_diminfo[u].stride;
+ stride[u] = space->select.sel_info.hslab->diminfo.app[u].stride;
if(count)
for(u = 0; u < space->extent.rank; u++)
- count[u] = space->select.sel_info.hslab->app_diminfo[u].count;
+ count[u] = space->select.sel_info.hslab->diminfo.app[u].count;
if(block)
for(u = 0; u < space->extent.rank; u++)
- block[u] = space->select.sel_info.hslab->app_diminfo[u].block;
+ block[u] = space->select.sel_info.hslab->diminfo.app[u].block;
done:
FUNC_LEAVE_API(ret_value)
-} /* H5Sget_regular_hyperslab() */
+} /* end H5Sget_regular_hyperslab() */
diff --git a/src/H5Smpio.c b/src/H5Smpio.c
index fce075e..35daed1 100644
--- a/src/H5Smpio.c
+++ b/src/H5Smpio.c
@@ -14,60 +14,104 @@
/*
* Programmer: rky 980813
*
- * Purpose: Functions to read/write directly between app buffer and file.
+ * Purpose: Create MPI data types for HDF5 selections.
*
- * Beware of the ifdef'ed print statements.
- * I didn't make them portable.
*/
+/****************/
+/* Module Setup */
+/****************/
+
#include "H5Smodule.h" /* This source code file is part of the H5S module */
+/***********/
+/* Headers */
+/***********/
#include "H5private.h" /* Generic Functions */
#include "H5Dprivate.h" /* Datasets */
#include "H5Eprivate.h" /* Error handling */
-#include "H5Fprivate.h" /* File access */
-#include "H5FDprivate.h" /* File drivers */
-#include "H5Iprivate.h" /* IDs */
+#include "H5FLprivate.h" /* Free Lists */
#include "H5MMprivate.h" /* Memory management */
-#include "H5Oprivate.h" /* Object headers */
-#include "H5Pprivate.h" /* Property lists */
#include "H5Spkg.h" /* Dataspaces */
#include "H5VMprivate.h" /* Vector and array functions */
#ifdef H5_HAVE_PARALLEL
-static herr_t H5S_mpio_all_type(const H5S_t *space, size_t elmt_size,
+/****************/
+/* Local Macros */
+/****************/
+#define H5S_MPIO_INITIAL_ALLOC_COUNT 256
+#define TWO_GIG_LIMIT 2147483648
+#ifndef H5S_MAX_MPI_COUNT
+#define H5S_MAX_MPI_COUNT 536870911 /* (2^29)-1 */
+#endif
+
+
+/******************/
+/* Local Typedefs */
+/******************/
+
+/* Node in linked list of MPI data types created during traversal of irregular hyperslab selection */
+typedef struct H5S_mpio_mpitype_node_t {
+ MPI_Datatype type; /* MPI Datatype */
+ struct H5S_mpio_mpitype_node_t *next; /* Pointer to next node in list */
+} H5S_mpio_mpitype_node_t;
+
+/* List to track MPI data types generated during traversal of irregular hyperslab selection */
+typedef struct H5S_mpio_mpitype_list_t {
+ H5S_mpio_mpitype_node_t *head; /* Pointer to head of list */
+ H5S_mpio_mpitype_node_t *tail; /* Pointer to tail of list */
+} H5S_mpio_mpitype_list_t;
+
+
+/********************/
+/* Local Prototypes */
+/********************/
+static herr_t H5S__mpio_all_type(const H5S_t *space, size_t elmt_size,
MPI_Datatype *new_type, int *count, hbool_t *is_derived_type);
-static herr_t H5S_mpio_none_type(MPI_Datatype *new_type, int *count,
+static herr_t H5S__mpio_none_type(MPI_Datatype *new_type, int *count,
hbool_t *is_derived_type);
-static herr_t H5S_mpio_create_point_datatype(size_t elmt_size, hsize_t num_points,
+static herr_t H5S__mpio_create_point_datatype(size_t elmt_size, hsize_t num_points,
MPI_Aint *disp, MPI_Datatype *new_type);
-static herr_t H5S_mpio_point_type(const H5S_t *space, size_t elmt_size,
+static herr_t H5S__mpio_point_type(const H5S_t *space, size_t elmt_size,
MPI_Datatype *new_type, int *count, hbool_t *is_derived_type,
hbool_t do_permute, hsize_t **permute_map, hbool_t *is_permuted);
-static herr_t H5S_mpio_permute_type(const H5S_t *space, size_t elmt_size,
+static herr_t H5S__mpio_permute_type(const H5S_t *space, size_t elmt_size,
hsize_t **permute_map, MPI_Datatype *new_type, int *count,
hbool_t *is_derived_type);
-static herr_t H5S_mpio_hyper_type(const H5S_t *space, size_t elmt_size,
+static herr_t H5S__mpio_reg_hyper_type(const H5S_t *space, size_t elmt_size,
MPI_Datatype *new_type, int *count, hbool_t *is_derived_type);
-static herr_t H5S_mpio_span_hyper_type(const H5S_t *space, size_t elmt_size,
+static herr_t H5S__mpio_span_hyper_type(const H5S_t *space, size_t elmt_size,
MPI_Datatype *new_type, int *count, hbool_t *is_derived_type);
-static herr_t H5S_obtain_datatype(const hsize_t down[], H5S_hyper_span_t* span,
- const MPI_Datatype *elmt_type, MPI_Datatype *span_type, size_t elmt_size);
-static herr_t H5S_mpio_create_large_type (hsize_t, MPI_Aint, MPI_Datatype , MPI_Datatype *);
+static herr_t H5S__release_datatype(H5S_mpio_mpitype_list_t *type_list);
+static herr_t H5S__obtain_datatype(H5S_hyper_span_info_t *spans, const hsize_t *down,
+ size_t elmt_size, const MPI_Datatype *elmt_type, MPI_Datatype *span_type,
+ H5S_mpio_mpitype_list_t *type_list, uint64_t op_gen);
+static herr_t H5S__mpio_create_large_type(hsize_t num_elements, MPI_Aint stride_bytes,
+ MPI_Datatype old_type, MPI_Datatype *new_type);
-#define H5S_MPIO_INITIAL_ALLOC_COUNT 256
+/*****************************/
+/* Library Private Variables */
+/*****************************/
-#define TWO_GIG_LIMIT 2147483648
-#ifndef H5S_MAX_MPI_COUNT
-#define H5S_MAX_MPI_COUNT 536870911 /* (2^29)-1 */
-#endif
+/*********************/
+/* Package Variables */
+/*********************/
+
+/*******************/
+/* Local Variables */
+/*******************/
static hsize_t bigio_count = H5S_MAX_MPI_COUNT;
+/* Declare a free list to manage the H5S_mpio_mpitype_node_t struct */
+H5FL_DEFINE_STATIC(H5S_mpio_mpitype_node_t);
+
+
+
/*-------------------------------------------------------------------------
* Function: H5S_mpio_set_bigio_count
*
@@ -75,7 +119,7 @@ static hsize_t bigio_count = H5S_MAX_MPI_COUNT;
* when we utilize derived datatypes. This is of
* particular interest for allowing nightly testing
*
- * Return: the current/previous value of bigio_count.
+ * Return: The current/previous value of bigio_count.
*
* Programmer: Richard Warren, March 10, 2017
*
@@ -85,19 +129,20 @@ hsize_t
H5S_mpio_set_bigio_count(hsize_t new_count)
{
hsize_t orig_count = bigio_count;
- if ((new_count > 0) && (new_count < TWO_GIG_LIMIT)) {
+
+ if((new_count > 0) && (new_count < TWO_GIG_LIMIT))
bigio_count = new_count;
- }
+
return orig_count;
-}
+} /* end H5S_mpio_set_bigio_count() */
/*-------------------------------------------------------------------------
- * Function: H5S_mpio_all_type
+ * Function: H5S__mpio_all_type
*
* Purpose: Translate an HDF5 "all" selection into an MPI type.
*
- * Return: non-negative on success, negative on failure.
+ * Return: Non-negative on success, negative on failure.
*
* Outputs: *new_type the MPI type corresponding to the selection
* *count how many objects of the new_type in selection
@@ -105,16 +150,11 @@ H5S_mpio_set_bigio_count(hsize_t new_count)
* *is_derived_type 0 if MPI primitive type, 1 if derived
*
* Programmer: rky 980813
- * Modifications:
- * Mohamad Chaarawi
- * Adding support for large datatypes (beyond the limit of a
- * 32 bit integer.
- *
*
*-------------------------------------------------------------------------
*/
static herr_t
-H5S_mpio_all_type(const H5S_t *space, size_t elmt_size,
+H5S__mpio_all_type(const H5S_t *space, size_t elmt_size,
MPI_Datatype *new_type, int *count, hbool_t *is_derived_type)
{
hsize_t total_bytes;
@@ -122,7 +162,7 @@ H5S_mpio_all_type(const H5S_t *space, size_t elmt_size,
hsize_t nelmts; /* Total number of elmts */
herr_t ret_value = SUCCEED; /* Return value */
- FUNC_ENTER_NOAPI_NOINIT
+ FUNC_ENTER_STATIC
/* Check args */
HDassert(space);
@@ -133,34 +173,33 @@ H5S_mpio_all_type(const H5S_t *space, size_t elmt_size,
H5_CHECKED_ASSIGN(nelmts, hsize_t, snelmts, hssize_t);
total_bytes = (hsize_t)elmt_size * nelmts;
+
/* Verify that the size can be expressed as a 32 bit integer */
if(bigio_count >= total_bytes) {
- /* fill in the return values */
- *new_type = MPI_BYTE;
- H5_CHECKED_ASSIGN(*count, int, total_bytes, hsize_t);
- *is_derived_type = FALSE;
- }
+ /* fill in the return values */
+ *new_type = MPI_BYTE;
+ H5_CHECKED_ASSIGN(*count, int, total_bytes, hsize_t);
+ *is_derived_type = FALSE;
+ } /* end if */
else {
- /* Create a LARGE derived datatype for this transfer */
- if (H5S_mpio_create_large_type (total_bytes, 0, MPI_BYTE, new_type) < 0) {
- HGOTO_ERROR(H5E_DATASPACE, H5E_BADTYPE, FAIL,
- "couldn't create a large datatype from the all selection")
- }
- *count = 1;
- *is_derived_type = TRUE;
- }
+ /* Create a LARGE derived datatype for this transfer */
+ if(H5S__mpio_create_large_type(total_bytes, 0, MPI_BYTE, new_type) < 0)
+ HGOTO_ERROR(H5E_DATASPACE, H5E_BADTYPE, FAIL, "couldn't create a large datatype from the all selection")
+ *count = 1;
+ *is_derived_type = TRUE;
+ } /* end else */
done:
FUNC_LEAVE_NOAPI(ret_value)
-} /* H5S_mpio_all_type() */
+} /* H5S__mpio_all_type() */
/*-------------------------------------------------------------------------
- * Function: H5S_mpio_none_type
+ * Function: H5S__mpio_none_type
*
* Purpose: Translate an HDF5 "none" selection into an MPI type.
*
- * Return: non-negative on success, negative on failure.
+ * Return: Non-negative on success, negative on failure.
*
* Outputs: *new_type the MPI type corresponding to the selection
* *count how many objects of the new_type in selection
@@ -172,9 +211,9 @@ done:
*-------------------------------------------------------------------------
*/
static herr_t
-H5S_mpio_none_type(MPI_Datatype *new_type, int *count, hbool_t *is_derived_type)
+H5S__mpio_none_type(MPI_Datatype *new_type, int *count, hbool_t *is_derived_type)
{
- FUNC_ENTER_NOAPI_NOINIT_NOERR
+ FUNC_ENTER_STATIC_NOERR
/* fill in the return values */
*new_type = MPI_BYTE;
@@ -182,15 +221,15 @@ H5S_mpio_none_type(MPI_Datatype *new_type, int *count, hbool_t *is_derived_type)
*is_derived_type = FALSE;
FUNC_LEAVE_NOAPI(SUCCEED)
-} /* H5S_mpio_none_type() */
+} /* H5S__mpio_none_type() */
/*-------------------------------------------------------------------------
- * Function: H5S_mpio_create_point_datatype
+ * Function: H5S__mpio_create_point_datatype
*
* Purpose: Create a derived datatype for point selections.
*
- * Return: non-negative on success, negative on failure.
+ * Return: Non-negative on success, negative on failure.
*
* Outputs: *new_type the MPI type corresponding to the selection
*
@@ -198,18 +237,23 @@ H5S_mpio_none_type(MPI_Datatype *new_type, int *count, hbool_t *is_derived_type)
*
*-------------------------------------------------------------------------
*/
-static herr_t
-H5S_mpio_create_point_datatype (size_t elmt_size, hsize_t num_points,
- MPI_Aint *disp, MPI_Datatype *new_type)
+static herr_t
+H5S__mpio_create_point_datatype(size_t elmt_size, hsize_t num_points,
+ MPI_Aint *disp, MPI_Datatype *new_type)
{
MPI_Datatype elmt_type; /* MPI datatype for individual element */
hbool_t elmt_type_created = FALSE; /* Whether the element MPI datatype was created */
- int mpi_code; /* MPI error code */
+ int *inner_blocks = NULL; /* Arrays for MPI datatypes when "large" datatype needed */
+ MPI_Aint *inner_disps = NULL;
+ MPI_Datatype *inner_types = NULL;
+#if MPI_VERSION < 3
int *blocks = NULL; /* Array of block sizes for MPI hindexed create call */
hsize_t u; /* Local index variable */
+#endif
+ int mpi_code; /* MPI error code */
herr_t ret_value = SUCCEED; /* Return value */
- FUNC_ENTER_NOAPI_NOINIT
+ FUNC_ENTER_STATIC
/* Create an MPI datatype for an element */
if(MPI_SUCCESS != (mpi_code = MPI_Type_contiguous((int)elmt_size, MPI_BYTE, &elmt_type)))
@@ -219,146 +263,127 @@ H5S_mpio_create_point_datatype (size_t elmt_size, hsize_t num_points,
/* Check whether standard or BIGIO processing will be employeed */
if(bigio_count >= num_points) {
#if MPI_VERSION >= 3
- /* Create an MPI datatype for the whole point selection */
- if(MPI_SUCCESS != (mpi_code = MPI_Type_create_hindexed_block((int)num_points, 1, disp, elmt_type, new_type)))
- HMPI_GOTO_ERROR(FAIL, "MPI_Type_create_indexed_block failed", mpi_code)
+ /* Create an MPI datatype for the whole point selection */
+ if(MPI_SUCCESS != (mpi_code = MPI_Type_create_hindexed_block((int)num_points, 1, disp, elmt_type, new_type)))
+ HMPI_GOTO_ERROR(FAIL, "MPI_Type_create_indexed_block failed", mpi_code)
#else
- /* Allocate block sizes for MPI datatype call */
- if(NULL == (blocks = (int *)H5MM_malloc(sizeof(int) * num_points)))
- HGOTO_ERROR(H5E_DATASPACE, H5E_CANTALLOC, FAIL, "can't allocate array of blocks")
+ /* Allocate block sizes for MPI datatype call */
+ if(NULL == (blocks = (int *)H5MM_malloc(sizeof(int) * num_points)))
+ HGOTO_ERROR(H5E_DATASPACE, H5E_CANTALLOC, FAIL, "can't allocate array of blocks")
- for(u = 0; u < num_points; u++)
- blocks[u] = 1;
+ for(u = 0; u < num_points; u++)
+ blocks[u] = 1;
- /* Create an MPI datatype for the whole point selection */
- if(MPI_SUCCESS != (mpi_code = MPI_Type_create_hindexed((int)num_points, blocks, disp, elmt_type, new_type)))
- HMPI_GOTO_ERROR(FAIL, "MPI_Type_create_hindexed failed", mpi_code)
+ /* Create an MPI datatype for the whole point selection */
+ if(MPI_SUCCESS != (mpi_code = MPI_Type_create_hindexed((int)num_points, blocks, disp, elmt_type, new_type)))
+ HMPI_GOTO_ERROR(FAIL, "MPI_Type_create_hindexed failed", mpi_code)
#endif
- /* Commit MPI datatype for later use */
- if(MPI_SUCCESS != (mpi_code = MPI_Type_commit(new_type)))
- HMPI_GOTO_ERROR(FAIL, "MPI_Type_commit failed", mpi_code)
- }
- else {
- /* use LARGE_DATATYPE::
- * We'll create an hindexed_block type for every 2G point count and then combine
- * those and any remaining points into a single large datatype.
- */
- int total_types, i;
- int remaining_points;
- int num_big_types;
- hsize_t leftover;
-
- int *inner_blocks;
- MPI_Aint *inner_disps;
- MPI_Datatype *inner_types = NULL;
+ /* Commit MPI datatype for later use */
+ if(MPI_SUCCESS != (mpi_code = MPI_Type_commit(new_type)))
+ HMPI_GOTO_ERROR(FAIL, "MPI_Type_commit failed", mpi_code)
+ } /* end if */
+ else {
+ /* use LARGE_DATATYPE::
+ * We'll create an hindexed_block type for every 2G point count and then combine
+ * those and any remaining points into a single large datatype.
+ */
+ int total_types, i;
+ int remaining_points;
+ int num_big_types;
+ hsize_t leftover;
- /* Calculate how many Big MPI datatypes are needed to represent the buffer */
- num_big_types = (int)(num_points/bigio_count);
+ /* Calculate how many Big MPI datatypes are needed to represent the buffer */
+ num_big_types = (int)(num_points / bigio_count);
- leftover = (hsize_t)num_points - (hsize_t)num_big_types * (hsize_t)bigio_count;
- H5_CHECKED_ASSIGN(remaining_points, int, leftover, hsize_t);
+ leftover = (hsize_t)num_points - (hsize_t)num_big_types * (hsize_t)bigio_count;
+ H5_CHECKED_ASSIGN(remaining_points, int, leftover, hsize_t);
- total_types = (int)(remaining_points) ? (num_big_types + 1) : num_big_types;
+ total_types = (int)(remaining_points) ? (num_big_types + 1) : num_big_types;
- /* Allocate array if MPI derived types needed */
- if(NULL == (inner_types = (MPI_Datatype *)H5MM_malloc((sizeof(MPI_Datatype) * (size_t)total_types))))
- HGOTO_ERROR(H5E_DATASPACE, H5E_CANTALLOC, FAIL, "can't allocate array of blocks")
+ /* Allocate array if MPI derived types needed */
+ if(NULL == (inner_types = (MPI_Datatype *)H5MM_malloc((sizeof(MPI_Datatype) * (size_t)total_types))))
+ HGOTO_ERROR(H5E_DATASPACE, H5E_CANTALLOC, FAIL, "can't allocate array of blocks")
- if(NULL == (inner_blocks = (int *)H5MM_malloc(sizeof(int) * (size_t)total_types)))
- HGOTO_ERROR(H5E_DATASPACE, H5E_CANTALLOC, FAIL, "can't allocate array of blocks")
+ if(NULL == (inner_blocks = (int *)H5MM_malloc(sizeof(int) * (size_t)total_types)))
+ HGOTO_ERROR(H5E_DATASPACE, H5E_CANTALLOC, FAIL, "can't allocate array of blocks")
- if(NULL == (inner_disps = (MPI_Aint *)H5MM_malloc(sizeof(MPI_Aint) * (size_t)total_types)))
- HGOTO_ERROR(H5E_DATASPACE, H5E_CANTALLOC, FAIL, "can't allocate array of blocks")
+ if(NULL == (inner_disps = (MPI_Aint *)H5MM_malloc(sizeof(MPI_Aint) * (size_t)total_types)))
+ HGOTO_ERROR(H5E_DATASPACE, H5E_CANTALLOC, FAIL, "can't allocate array of blocks")
#if MPI_VERSION < 3
- /* Allocate block sizes for MPI datatype call */
- if(NULL == (blocks = (int *)H5MM_malloc(sizeof(int) * bigio_count)))
- HGOTO_ERROR(H5E_DATASPACE, H5E_CANTALLOC, FAIL, "can't allocate array of blocks")
+ /* Allocate block sizes for MPI datatype call */
+ if(NULL == (blocks = (int *)H5MM_malloc(sizeof(int) * bigio_count)))
+ HGOTO_ERROR(H5E_DATASPACE, H5E_CANTALLOC, FAIL, "can't allocate array of blocks")
- for(u = 0; u < bigio_count; u++)
- blocks[u] = 1;
+ for(u = 0; u < bigio_count; u++)
+ blocks[u] = 1;
#endif
- for(i=0 ; i<num_big_types ; i++) {
+ for(i = 0; i < num_big_types; i++) {
#if MPI_VERSION >= 3
- if(MPI_SUCCESS != (mpi_code = MPI_Type_create_hindexed_block(bigio_count,
- 1,
- &disp[i*bigio_count],
- elmt_type,
- &inner_types[i]))) {
- HMPI_GOTO_ERROR(FAIL, "MPI_Type_create_hindexed_block failed", mpi_code);
- }
+ if(MPI_SUCCESS != (mpi_code = MPI_Type_create_hindexed_block(bigio_count,
+ 1, &disp[i*bigio_count], elmt_type, &inner_types[i])))
+ HMPI_GOTO_ERROR(FAIL, "MPI_Type_create_hindexed_block failed", mpi_code)
#else
- if(MPI_SUCCESS != (mpi_code = MPI_Type_create_hindexed((int)bigio_count,
- blocks,
- &disp[i*bigio_count],
- elmt_type,
- &inner_types[i]))) {
- HMPI_GOTO_ERROR(FAIL, "MPI_Type_create_hindexed failed", mpi_code)
- }
+ if(MPI_SUCCESS != (mpi_code = MPI_Type_create_hindexed((int)bigio_count,
+ blocks, &disp[i*bigio_count], elmt_type, &inner_types[i])))
+ HMPI_GOTO_ERROR(FAIL, "MPI_Type_create_hindexed failed", mpi_code)
#endif
- inner_blocks[i] = 1;
- inner_disps[i] = 0;
- }
+ inner_blocks[i] = 1;
+ inner_disps[i] = 0;
+ } /* end for*/
- if(remaining_points) {
+ if(remaining_points) {
#if MPI_VERSION >= 3
- if(MPI_SUCCESS != (mpi_code = MPI_Type_create_hindexed_block(remaining_points,
- 1,
- &disp[num_big_types*bigio_count],
- elmt_type,
- &inner_types[num_big_types]))) {
- HMPI_GOTO_ERROR(FAIL, "MPI_Type_create_hindexed_block failed", mpi_code);
- }
+ if(MPI_SUCCESS != (mpi_code = MPI_Type_create_hindexed_block(remaining_points,
+ 1, &disp[num_big_types*bigio_count], elmt_type, &inner_types[num_big_types])))
+ HMPI_GOTO_ERROR(FAIL, "MPI_Type_create_hindexed_block failed", mpi_code)
#else
- if(MPI_SUCCESS != (mpi_code = MPI_Type_create_hindexed((int)remaining_points,
- blocks,
- &disp[num_big_types*bigio_count],
- elmt_type,
- &inner_types[num_big_types]))) {
- HMPI_GOTO_ERROR(FAIL, "MPI_Type_create_hindexed failed", mpi_code)
- }
+ if(MPI_SUCCESS != (mpi_code = MPI_Type_create_hindexed((int)remaining_points,
+ blocks, &disp[num_big_types*bigio_count], elmt_type, &inner_types[num_big_types])))
+ HMPI_GOTO_ERROR(FAIL, "MPI_Type_create_hindexed failed", mpi_code)
#endif
- inner_blocks[num_big_types] = 1;
- inner_disps[num_big_types] = 0;
- }
-
- if(MPI_SUCCESS != (mpi_code = MPI_Type_create_struct(total_types,
- inner_blocks,
- inner_disps,
- inner_types,
- new_type))) {
- HMPI_GOTO_ERROR(FAIL, "MPI_Type_create_struct", mpi_code);
- }
- for(i=0 ; i<total_types ; i++)
- MPI_Type_free(&inner_types[i]);
-
- H5MM_free(inner_types);
- H5MM_free(inner_blocks);
- H5MM_free(inner_disps);
-
- /* Commit MPI datatype for later use */
- if(MPI_SUCCESS != (mpi_code = MPI_Type_commit(new_type)))
- HMPI_GOTO_ERROR(FAIL, "MPI_Type_commit failed", mpi_code)
- }
+ inner_blocks[num_big_types] = 1;
+ inner_disps[num_big_types] = 0;
+ } /* end if */
+
+ if(MPI_SUCCESS != (mpi_code = MPI_Type_create_struct(total_types,
+ inner_blocks, inner_disps, inner_types, new_type)))
+ HMPI_GOTO_ERROR(FAIL, "MPI_Type_create_struct", mpi_code)
+ for(i = 0; i < total_types; i++)
+ MPI_Type_free(&inner_types[i]);
+
+ /* Commit MPI datatype for later use */
+ if(MPI_SUCCESS != (mpi_code = MPI_Type_commit(new_type)))
+ HMPI_GOTO_ERROR(FAIL, "MPI_Type_commit failed", mpi_code)
+ } /* end else */
+
done:
if(elmt_type_created)
MPI_Type_free(&elmt_type);
+#if MPI_VERSION < 3
if(blocks)
H5MM_free(blocks);
+#endif
+ if(inner_types)
+ H5MM_free(inner_types);
+ if(inner_blocks)
+ H5MM_free(inner_blocks);
+ if(inner_disps)
+ H5MM_free(inner_disps);
FUNC_LEAVE_NOAPI(ret_value)
-} /* H5S_mpio_create_point_datatype() */
+} /* H5S__mpio_create_point_datatype() */
/*-------------------------------------------------------------------------
- * Function: H5S_mpio_point_type
+ * Function: H5S__mpio_point_type
*
* Purpose: Translate an HDF5 "point" selection into an MPI type.
* Create a permutation array to handle out-of-order point selections.
*
- * Return: non-negative on success, negative on failure.
+ * Return: Non-negative on success, negative on failure.
*
* Outputs: *new_type the MPI type corresponding to the selection
* *count how many objects of the new_type in selection
@@ -373,7 +398,7 @@ done:
*-------------------------------------------------------------------------
*/
static herr_t
-H5S_mpio_point_type(const H5S_t *space, size_t elmt_size, MPI_Datatype *new_type,
+H5S__mpio_point_type(const H5S_t *space, size_t elmt_size, MPI_Datatype *new_type,
int *count, hbool_t *is_derived_type, hbool_t do_permute, hsize_t **permute,
hbool_t *is_permuted)
{
@@ -384,7 +409,7 @@ H5S_mpio_point_type(const H5S_t *space, size_t elmt_size, MPI_Datatype *new_type
hsize_t u; /* Local index variable */
herr_t ret_value = SUCCEED; /* Return value */
- FUNC_ENTER_NOAPI_NOINIT
+ FUNC_ENTER_STATIC
/* Check args */
HDassert(space);
@@ -406,23 +431,23 @@ H5S_mpio_point_type(const H5S_t *space, size_t elmt_size, MPI_Datatype *new_type
/* Iterate through list of elements */
curr = space->select.sel_info.pnt_lst->head;
for(u = 0 ; u < num_points ; u++) {
- /* calculate the displacement of the current point */
+ /* Calculate the displacement of the current point */
disp[u] = H5VM_array_offset(space->extent.rank, space->extent.size, curr->pnt);
disp[u] *= elmt_size;
- /* This is a File Space used to set the file view, so adjust the displacements
+ /* This is a File Space used to set the file view, so adjust the displacements
* to have them monotonically non-decreasing.
- * Generate the permutation array by indicating at each point being selected,
- * the position it will shifted in the new displacement. Example:
- * Suppose 4 points with corresponding are selected
- * Pt 1: disp=6 ; Pt 2: disp=3 ; Pt 3: disp=0 ; Pt 4: disp=4
+ * Generate the permutation array by indicating at each point being selected,
+ * the position it will shifted in the new displacement. Example:
+ * Suppose 4 points with corresponding are selected
+ * Pt 1: disp=6 ; Pt 2: disp=3 ; Pt 3: disp=0 ; Pt 4: disp=4
* The permute map to sort the displacements in order will be:
* point 1: map[0] = L, indicating that this point is not moved (1st point selected)
- * point 2: map[1] = 0, indicating that this point is moved to the first position,
+ * point 2: map[1] = 0, indicating that this point is moved to the first position,
* since disp_pt1(6) > disp_pt2(3)
- * point 3: map[2] = 0, move to position 0, bec it has the lowest disp between
+ * point 3: map[2] = 0, move to position 0, bec it has the lowest disp between
* the points selected so far.
- * point 4: map[3] = 2, move the 2nd position since point 1 has a higher disp,
+ * point 4: map[3] = 2, move the 2nd position since point 1 has a higher disp,
* but points 2 and 3 have lower displacements.
*/
if(do_permute) {
@@ -447,7 +472,7 @@ H5S_mpio_point_type(const H5S_t *space, size_t elmt_size, MPI_Datatype *new_type
HDmemmove(disp + m + 1, disp + m, (u - m) * sizeof(MPI_Aint));
disp[m] = temp;
} /* end if */
- (*permute)[u] = m;
+ (*permute)[u] = m;
} /* end if */
else
(*permute)[u] = num_points;
@@ -455,7 +480,7 @@ H5S_mpio_point_type(const H5S_t *space, size_t elmt_size, MPI_Datatype *new_type
/* this is a memory space, and no permutation is necessary to create
the derived datatype */
else {
- ;/* do nothing */
+ ; /* do nothing */
} /* end else */
/* get the next point */
@@ -463,7 +488,7 @@ H5S_mpio_point_type(const H5S_t *space, size_t elmt_size, MPI_Datatype *new_type
} /* end for */
/* Create the MPI datatype for the set of element displacements */
- if(H5S_mpio_create_point_datatype(elmt_size, num_points, disp, new_type) < 0)
+ if(H5S__mpio_create_point_datatype(elmt_size, num_points, disp, new_type) < 0)
HGOTO_ERROR(H5E_DATASPACE, H5E_BADTYPE, FAIL, "couldn't create an MPI Datatype from point selection")
/* Set values about MPI datatype created */
@@ -481,11 +506,11 @@ done:
} /* end if */
FUNC_LEAVE_NOAPI(ret_value)
-} /* H5S_mpio_point_type() */
+} /* H5S__mpio_point_type() */
/*-------------------------------------------------------------------------
- * Function: H5S_mpio_permute_type
+ * Function: H5S__mpio_permute_type
*
* Purpose: Translate an HDF5 "all/hyper/point" selection into an MPI type,
* while applying the permutation map. This function is called if
@@ -496,7 +521,7 @@ done:
* Note: This routine is called from H5S_mpio_space_type(), which is
* called first for the file dataspace and creates
*
- * Return: non-negative on success, negative on failure.
+ * Return: Non-negative on success, negative on failure.
*
* Outputs: *new_type the MPI type corresponding to the selection
* *count how many objects of the new_type in selection
@@ -508,7 +533,7 @@ done:
*-------------------------------------------------------------------------
*/
static herr_t
-H5S_mpio_permute_type(const H5S_t *space, size_t elmt_size, hsize_t **permute,
+H5S__mpio_permute_type(const H5S_t *space, size_t elmt_size, hsize_t **permute,
MPI_Datatype *new_type, int *count, hbool_t *is_derived_type)
{
MPI_Aint *disp = NULL; /* Datatype displacement for each point*/
@@ -520,7 +545,7 @@ H5S_mpio_permute_type(const H5S_t *space, size_t elmt_size, hsize_t **permute,
hsize_t u; /* Local index variable */
herr_t ret_value = SUCCEED; /* Return value */
- FUNC_ENTER_NOAPI_NOINIT
+ FUNC_ENTER_STATIC
/* Check args */
HDassert(space);
@@ -535,7 +560,7 @@ H5S_mpio_permute_type(const H5S_t *space, size_t elmt_size, hsize_t **permute,
HGOTO_ERROR(H5E_DATASPACE, H5E_CANTALLOC, FAIL, "can't allocate array of displacements")
/* Initialize selection iterator */
- if(H5S_select_iter_init(&sel_iter, space, elmt_size) < 0)
+ if(H5S_select_iter_init(&sel_iter, space, elmt_size, 0) < 0)
HGOTO_ERROR(H5E_DATASPACE, H5E_CANTINIT, FAIL, "unable to initialize selection iterator")
sel_iter_init = TRUE; /* Selection iteration info has been initialized */
@@ -552,7 +577,7 @@ H5S_mpio_permute_type(const H5S_t *space, size_t elmt_size, hsize_t **permute,
size_t curr_seq; /* Current sequence being worked on */
/* Get the sequences of bytes */
- if(H5S_SELECT_GET_SEQ_LIST(space, 0, &sel_iter, (size_t)H5D_IO_VECTOR_SIZE, max_elem, &nseq, &nelem, off, len) < 0)
+ if(H5S_SELECT_ITER_GET_SEQ_LIST(&sel_iter, (size_t)H5D_IO_VECTOR_SIZE, max_elem, &nseq, &nelem, off, len) < 0)
HGOTO_ERROR(H5E_DATASPACE, H5E_UNSUPPORTED, FAIL, "sequence length generation failed")
/* Loop, while sequences left to process */
@@ -571,12 +596,12 @@ H5S_mpio_permute_type(const H5S_t *space, size_t elmt_size, hsize_t **permute,
/* Set the displacement of the current point */
disp[u] = curr_off;
- /* This is a memory displacement, so for each point selected,
+ /* This is a memory displacement, so for each point selected,
* apply the map that was generated by the file selection */
if((*permute)[u] != num_points) {
MPI_Aint temp = disp[u];
- HDmemmove(disp + (*permute)[u] + 1, disp + (*permute)[u],
+ HDmemmove(disp + (*permute)[u] + 1, disp + (*permute)[u],
(u - (*permute)[u]) * sizeof(MPI_Aint));
disp[(*permute)[u]] = temp;
} /* end if */
@@ -597,7 +622,7 @@ H5S_mpio_permute_type(const H5S_t *space, size_t elmt_size, hsize_t **permute,
} /* end while */
/* Create the MPI datatype for the set of element displacements */
- if(H5S_mpio_create_point_datatype(elmt_size, num_points, disp, new_type) < 0)
+ if(H5S__mpio_create_point_datatype(elmt_size, num_points, disp, new_type) < 0)
HGOTO_ERROR(H5E_DATASPACE, H5E_BADTYPE, FAIL, "couldn't create an MPI Datatype from point selection")
/* Set values about MPI datatype created */
@@ -619,15 +644,15 @@ done:
} /* end if */
FUNC_LEAVE_NOAPI(ret_value)
-} /* H5S_mpio_permute_type() */
+} /* H5S__mpio_permute_type() */
/*-------------------------------------------------------------------------
- * Function: H5S_mpio_hyper_type
+ * Function: H5S__mpio_reg_hyper_type
*
- * Purpose: Translate an HDF5 hyperslab selection into an MPI type.
+ * Purpose: Translate a regular HDF5 hyperslab selection into an MPI type.
*
- * Return: non-negative on success, negative on failure.
+ * Return: Non-negative on success, negative on failure.
*
* Outputs: *new_type the MPI type corresponding to the selection
* *count how many objects of the new_type in selection
@@ -635,14 +660,11 @@ done:
* *is_derived_type 0 if MPI primitive type, 1 if derived
*
* Programmer: rky 980813
- * Modifications:
- * Mohamad Chaarawi
- * Adding support for large datatypes (beyond the limit of a
- * 32 bit integer.
+ *
*-------------------------------------------------------------------------
*/
static herr_t
-H5S_mpio_hyper_type(const H5S_t *space, size_t elmt_size,
+H5S__mpio_reg_hyper_type(const H5S_t *space, size_t elmt_size,
MPI_Datatype *new_type, int *count, hbool_t *is_derived_type)
{
H5S_sel_iter_t sel_iter; /* Selection iteration info */
@@ -668,14 +690,14 @@ H5S_mpio_hyper_type(const H5S_t *space, size_t elmt_size,
int mpi_code; /* MPI return code */
herr_t ret_value = SUCCEED;
- FUNC_ENTER_NOAPI_NOINIT
+ FUNC_ENTER_STATIC
/* Check args */
HDassert(space);
HDassert(sizeof(MPI_Aint) >= sizeof(elmt_size));
/* Initialize selection iterator */
- if(H5S_select_iter_init(&sel_iter, space, elmt_size) < 0)
+ if(H5S_select_iter_init(&sel_iter, space, elmt_size, 0) < 0)
HGOTO_ERROR(H5E_DATASPACE, H5E_CANTINIT, FAIL, "unable to initialize selection iterator")
sel_iter_init = TRUE; /* Selection iteration info has been initialized */
@@ -683,16 +705,15 @@ H5S_mpio_hyper_type(const H5S_t *space, size_t elmt_size,
diminfo = sel_iter.u.hyp.diminfo;
HDassert(diminfo);
- /* make a local copy of the dimension info so we can operate with them */
+ /* Make a local copy of the dimension info so we can operate with them */
/* Check if this is a "flattened" regular hyperslab selection */
if(sel_iter.u.hyp.iter_rank != 0 && sel_iter.u.hyp.iter_rank < space->extent.rank) {
/* Flattened selection */
rank = sel_iter.u.hyp.iter_rank;
- HDassert(rank <= H5S_MAX_RANK); /* within array bounds */
#ifdef H5S_DEBUG
- if(H5DEBUG(S))
- HDfprintf(H5DEBUG(S), "%s: Flattened selection\n",FUNC);
+if(H5DEBUG(S))
+ HDfprintf(H5DEBUG(S), "%s: Flattened selection\n",FUNC);
#endif
for(u = 0; u < rank; ++u) {
H5_CHECK_OVERFLOW(diminfo[u].start, hsize_t, hssize_t)
@@ -701,33 +722,30 @@ H5S_mpio_hyper_type(const H5S_t *space, size_t elmt_size,
d[u].block = diminfo[u].block;
d[u].count = diminfo[u].count;
d[u].xtent = sel_iter.u.hyp.size[u];
+
#ifdef H5S_DEBUG
- if(H5DEBUG(S)){
- HDfprintf(H5DEBUG(S), "%s: start=%Hd stride=%Hu count=%Hu block=%Hu xtent=%Hu",
- FUNC, d[u].start, d[u].strid, d[u].count, d[u].block, d[u].xtent );
- if (u==0)
- HDfprintf(H5DEBUG(S), " rank=%u\n", rank );
- else
- HDfprintf(H5DEBUG(S), "\n" );
- }
+if(H5DEBUG(S)) {
+ HDfprintf(H5DEBUG(S), "%s: start=%Hd stride=%Hu count=%Hu block=%Hu xtent=%Hu",
+ FUNC, d[u].start, d[u].strid, d[u].count, d[u].block, d[u].xtent);
+ if(u == 0)
+ HDfprintf(H5DEBUG(S), " rank=%u\n", rank);
+ else
+ HDfprintf(H5DEBUG(S), "\n");
+}
#endif
- if(0 == d[u].block)
- goto empty;
- if(0 == d[u].count)
- goto empty;
- if(0 == d[u].xtent)
- goto empty;
+
+ /* Sanity check */
+ HDassert(d[u].block > 0);
+ HDassert(d[u].count > 0);
+ HDassert(d[u].xtent > 0);
} /* end for */
} /* end if */
else {
/* Non-flattened selection */
rank = space->extent.rank;
- HDassert(rank <= H5S_MAX_RANK); /* within array bounds */
- if(0 == rank)
- goto empty;
#ifdef H5S_DEBUG
- if(H5DEBUG(S))
- HDfprintf(H5DEBUG(S),"%s: Non-flattened selection\n",FUNC);
+if(H5DEBUG(S))
+ HDfprintf(H5DEBUG(S),"%s: Non-flattened selection\n",FUNC);
#endif
for(u = 0; u < rank; ++u) {
H5_CHECK_OVERFLOW(diminfo[u].start, hsize_t, hssize_t)
@@ -736,22 +754,22 @@ H5S_mpio_hyper_type(const H5S_t *space, size_t elmt_size,
d[u].block = diminfo[u].block;
d[u].count = diminfo[u].count;
d[u].xtent = space->extent.size[u];
+
#ifdef H5S_DEBUG
- if(H5DEBUG(S)){
+if(H5DEBUG(S)) {
HDfprintf(H5DEBUG(S), "%s: start=%Hd stride=%Hu count=%Hu block=%Hu xtent=%Hu",
- FUNC, d[u].start, d[u].strid, d[u].count, d[u].block, d[u].xtent );
- if (u==0)
- HDfprintf(H5DEBUG(S), " rank=%u\n", rank );
+ FUNC, d[u].start, d[u].strid, d[u].count, d[u].block, d[u].xtent);
+ if(u == 0)
+ HDfprintf(H5DEBUG(S), " rank=%u\n", rank);
else
- HDfprintf(H5DEBUG(S), "\n" );
- }
+ HDfprintf(H5DEBUG(S), "\n");
+}
#endif
- if(0 == d[u].block)
- goto empty;
- if(0 == d[u].count)
- goto empty;
- if(0 == d[u].xtent)
- goto empty;
+
+ /* Sanity check */
+ HDassert(d[u].block > 0);
+ HDassert(d[u].count > 0);
+ HDassert(d[u].xtent > 0);
} /* end for */
} /* end else */
@@ -762,56 +780,52 @@ H5S_mpio_hyper_type(const H5S_t *space, size_t elmt_size,
offset[rank - 1] = 1;
max_xtent[rank - 1] = d[rank - 1].xtent;
#ifdef H5S_DEBUG
- if(H5DEBUG(S)) {
- i = ((int)rank) - 1;
- HDfprintf(H5DEBUG(S), " offset[%2d]=%Hu; max_xtent[%2d]=%Hu\n",
- i, offset[i], i, max_xtent[i]);
- }
+if(H5DEBUG(S)) {
+ i = ((int)rank) - 1;
+ HDfprintf(H5DEBUG(S), " offset[%2d]=%Hu; max_xtent[%2d]=%Hu\n", i, offset[i], i, max_xtent[i]);
+}
#endif
for(i = ((int)rank) - 2; i >= 0; --i) {
offset[i] = offset[i + 1] * d[i + 1].xtent;
max_xtent[i] = max_xtent[i + 1] * d[i].xtent;
#ifdef H5S_DEBUG
- if(H5DEBUG(S))
- HDfprintf(H5DEBUG(S), " offset[%2d]=%Hu; max_xtent[%2d]=%Hu\n",
- i, offset[i], i, max_xtent[i]);
+if(H5DEBUG(S))
+ HDfprintf(H5DEBUG(S), " offset[%2d]=%Hu; max_xtent[%2d]=%Hu\n", i, offset[i], i, max_xtent[i]);
#endif
} /* end for */
/* Create a type covering the selected hyperslab.
* Multidimensional dataspaces are stored in row-major order.
* The type is built from the inside out, going from the
- * fastest-changing (i.e., inner) dimension * to the slowest (outer). */
+ * fastest-changing (i.e., inner) dimension * to the slowest (outer).
+ */
/*******************************************************
* Construct contig type for inner contig dims:
*******************************************************/
#ifdef H5S_DEBUG
- if(H5DEBUG(S)) {
+if(H5DEBUG(S)) {
HDfprintf(H5DEBUG(S), "%s: Making contig type %Zu MPI_BYTEs\n", FUNC, elmt_size);
for(i = ((int)rank) - 1; i >= 0; --i)
HDfprintf(H5DEBUG(S), "d[%d].xtent=%Hu \n", i, d[i].xtent);
- }
+}
#endif
/* LARGE_DATATYPE::
- * Check if the number of elements to form the inner type fits into a 32 bit integer.
+ * Check if the number of elements to form the inner type fits into a 32 bit integer.
* If yes then just create the innertype with MPI_Type_contiguous.
* Otherwise create a compound datatype by iterating as many times as needed
* for the innertype to be created.
*/
if(bigio_count >= elmt_size) {
- /* Use a single MPI datatype that has a 32 bit size */
- if(MPI_SUCCESS != (mpi_code = MPI_Type_contiguous((int)elmt_size, MPI_BYTE, &inner_type)))
- HMPI_GOTO_ERROR(FAIL, "MPI_Type_contiguous failed", mpi_code)
- }
- else {
- /* Create the compound datatype for this operation (> 2GB) */
- if (H5S_mpio_create_large_type (elmt_size, 0, MPI_BYTE, &inner_type) < 0) {
- HGOTO_ERROR(H5E_DATASPACE, H5E_BADTYPE, FAIL,
- "couldn't ccreate a large inner datatype in hyper selection")
- }
- }
+ /* Use a single MPI datatype that has a 32 bit size */
+ if(MPI_SUCCESS != (mpi_code = MPI_Type_contiguous((int)elmt_size, MPI_BYTE, &inner_type)))
+ HMPI_GOTO_ERROR(FAIL, "MPI_Type_contiguous failed", mpi_code)
+ } /* end if */
+ else
+ /* Create the compound datatype for this operation (> 2GB) */
+ if(H5S__mpio_create_large_type(elmt_size, 0, MPI_BYTE, &inner_type) < 0)
+ HGOTO_ERROR(H5E_DATASPACE, H5E_BADTYPE, FAIL, "couldn't create a large inner datatype in hyper selection")
/*******************************************************
* Construct the type by walking the hyperslab dims
@@ -819,64 +833,57 @@ H5S_mpio_hyper_type(const H5S_t *space, size_t elmt_size,
*******************************************************/
for(i = ((int)rank) - 1; i >= 0; --i) {
#ifdef H5S_DEBUG
- if(H5DEBUG(S))
- HDfprintf(H5DEBUG(S), "%s: Dimension i=%d \n"
- "start=%Hd count=%Hu block=%Hu stride=%Hu, xtent=%Hu max_xtent=%d\n",
- FUNC, i, d[i].start, d[i].count, d[i].block, d[i].strid, d[i].xtent, max_xtent[i]);
+if(H5DEBUG(S))
+ HDfprintf(H5DEBUG(S), "%s: Dimension i=%d \n"
+ "start=%Hd count=%Hu block=%Hu stride=%Hu, xtent=%Hu max_xtent=%d\n",
+ FUNC, i, d[i].start, d[i].count, d[i].block, d[i].strid, d[i].xtent, max_xtent[i]);
#endif
#ifdef H5S_DEBUG
- if(H5DEBUG(S))
- HDfprintf(H5DEBUG(S), "%s: i=%d Making vector-type \n", FUNC,i);
+if(H5DEBUG(S))
+ HDfprintf(H5DEBUG(S), "%s: i=%d Making vector-type \n", FUNC,i);
#endif
/****************************************
- * Build vector type of the selection.
- ****************************************/
- if (bigio_count >= d[i].count &&
- bigio_count >= d[i].block &&
- bigio_count >= d[i].strid) {
-
- /* All the parameters fit into 32 bit integers so create the vector type normally */
- mpi_code = MPI_Type_vector((int)(d[i].count), /* count */
- (int)(d[i].block), /* blocklength */
- (int)(d[i].strid), /* stride */
- inner_type, /* old type */
- &outer_type); /* new type */
-
- MPI_Type_free(&inner_type);
- if(mpi_code != MPI_SUCCESS)
- HMPI_GOTO_ERROR(FAIL, "couldn't create MPI vector type", mpi_code)
- }
+ * Build vector type of the selection.
+ ****************************************/
+ if(bigio_count >= d[i].count &&
+ bigio_count >= d[i].block && bigio_count >= d[i].strid) {
+ /* All the parameters fit into 32 bit integers so create the vector type normally */
+ mpi_code = MPI_Type_vector((int)(d[i].count), /* count */
+ (int)(d[i].block), /* blocklength */
+ (int)(d[i].strid), /* stride */
+ inner_type, /* old type */
+ &outer_type); /* new type */
+
+ MPI_Type_free(&inner_type);
+ if(mpi_code != MPI_SUCCESS)
+ HMPI_GOTO_ERROR(FAIL, "couldn't create MPI vector type", mpi_code)
+ } /* end if */
else {
- /* Things get a bit more complicated and require LARGE_DATATYPE processing
- * There are two MPI datatypes that need to be created:
- * 1) an internal contiguous block; and
- * 2) a collection of elements where an element is a contiguous block(1).
- * Remember that the input arguments to the MPI-IO functions use integer
- * values to represent element counts. We ARE allowed however, in the
- * more recent MPI implementations to use constructed datatypes whereby
- * the total number of bytes in a transfer could be :
- * (2GB-1)number_of_blocks * the_datatype_extent.
- */
+ /* Things get a bit more complicated and require LARGE_DATATYPE processing
+ * There are two MPI datatypes that need to be created:
+ * 1) an internal contiguous block; and
+ * 2) a collection of elements where an element is a contiguous block(1).
+ * Remember that the input arguments to the MPI-IO functions use integer
+ * values to represent element counts. We ARE allowed however, in the
+ * more recent MPI implementations to use constructed datatypes whereby
+ * the total number of bytes in a transfer could be :
+ * (2GB-1)number_of_blocks * the_datatype_extent.
+ */
+
MPI_Aint stride_in_bytes, inner_extent;
MPI_Datatype block_type;
- /* create a contiguous datatype inner_type x number of BLOCKS.
- * Again we need to check that the number of BLOCKS can fit into
+ /* Create a contiguous datatype inner_type x number of BLOCKS.
+ * Again we need to check that the number of BLOCKS can fit into
* a 32 bit integer */
- if (bigio_count < d[i].block) {
- if (H5S_mpio_create_large_type(d[i].block, 0, inner_type,
- &block_type) < 0) {
- HGOTO_ERROR(H5E_DATASPACE, H5E_BADTYPE, FAIL,
- "couldn't ccreate a large block datatype in hyper selection")
- }
- }
- else {
- if(MPI_SUCCESS != (mpi_code = MPI_Type_contiguous((int)d[i].block,
- inner_type,
- &block_type)))
+ if(bigio_count < d[i].block) {
+ if(H5S__mpio_create_large_type(d[i].block, 0, inner_type, &block_type) < 0)
+ HGOTO_ERROR(H5E_DATASPACE, H5E_BADTYPE, FAIL, "couldn't create a large block datatype in hyper selection")
+ } /* end if */
+ else
+ if(MPI_SUCCESS != (mpi_code = MPI_Type_contiguous((int)d[i].block, inner_type, &block_type)))
HMPI_GOTO_ERROR(FAIL, "MPI_Type_contiguous failed", mpi_code)
- }
/* 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
@@ -891,40 +898,38 @@ H5S_mpio_hyper_type(const H5S_t *space, size_t elmt_size,
/* If the element count is larger than what a 32 bit integer can hold,
* we call the large type creation function to handle that
*/
- if (bigio_count < d[i].count) {
- if (H5S_mpio_create_large_type (d[i].count, stride_in_bytes, block_type,
- &outer_type) < 0) {
- HGOTO_ERROR(H5E_DATASPACE, H5E_BADTYPE, FAIL,
- "couldn't create a large outer datatype in hyper selection")
- }
- }
+ if(bigio_count < d[i].count) {
+ if(H5S__mpio_create_large_type(d[i].count, stride_in_bytes, block_type, &outer_type) < 0)
+ HGOTO_ERROR(H5E_DATASPACE, H5E_BADTYPE, FAIL, "couldn't create a large outer datatype in hyper selection")
+ } /* end if */
/* otherwise a regular create_hvector will do */
- else {
- mpi_code = MPI_Type_create_hvector((int)d[i].count, /* count */
- 1, /* blocklength */
- stride_in_bytes, /* stride in bytes*/
- block_type, /* old type */
- &outer_type); /* new type */
- if(MPI_SUCCESS != mpi_code)
+ else
+ if(MPI_SUCCESS != (mpi_code = MPI_Type_create_hvector((int)d[i].count, /* count */
+ 1, /* blocklength */
+ stride_in_bytes, /* stride in bytes*/
+ block_type, /* old type */
+ &outer_type))) /* new type */
HMPI_GOTO_ERROR(FAIL, "MPI_Type_create_hvector failed", mpi_code)
- }
+
MPI_Type_free(&block_type);
MPI_Type_free(&inner_type);
- }
- /****************************************
- * Then build the dimension type as (start, vector type, xtent).
- ****************************************/
- /* calculate start and extent values of this dimension */
+ } /* end else */
+
+ /****************************************
+ * Then build the dimension type as (start, vector type, xtent).
+ ****************************************/
+
+ /* Calculate start and extent values of this dimension */
start_disp = d[i].start * offset[i] * elmt_size;
new_extent = (MPI_Aint)elmt_size * max_xtent[i];
if(MPI_SUCCESS != (mpi_code = MPI_Type_get_extent(outer_type, &lb, &extent_len)))
HMPI_GOTO_ERROR(FAIL, "MPI_Type_get_extent failed", mpi_code)
/*************************************************
- * Restructure this datatype ("outer_type")
- * so that it still starts at 0, but its extent
- * is the full extent in this dimension.
- *************************************************/
+ * Restructure this datatype ("outer_type")
+ * so that it still starts at 0, but its extent
+ * is the full extent in this dimension.
+ *************************************************/
if(start_disp > 0 || extent_len < new_extent) {
MPI_Datatype interm_type;
int block_len = 1;
@@ -956,13 +961,6 @@ H5S_mpio_hyper_type(const H5S_t *space, size_t elmt_size,
/* fill in the remaining return values */
*count = 1; /* only have to move one of these suckers! */
*is_derived_type = TRUE;
- HGOTO_DONE(SUCCEED);
-
-empty:
- /* special case: empty hyperslab */
- *new_type = MPI_BYTE;
- *count = 0;
- *is_derived_type = FALSE;
done:
/* Release selection iterator */
@@ -971,21 +969,20 @@ done:
HDONE_ERROR(H5E_DATASPACE, H5E_CANTRELEASE, FAIL, "unable to release selection iterator")
#ifdef H5S_DEBUG
- if(H5DEBUG(S))
- HDfprintf(H5DEBUG(S), "Leave %s, count=%ld is_derived_type=%t\n",
- FUNC, *count, *is_derived_type );
+if(H5DEBUG(S))
+ HDfprintf(H5DEBUG(S), "Leave %s, count=%ld is_derived_type=%t\n", FUNC, *count, *is_derived_type);
#endif
FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5S_mpio_hyper_type() */
+} /* end H5S__mpio_reg_hyper_type() */
/*-------------------------------------------------------------------------
- * Function: H5S_mpio_span_hyper_type
+ * Function: H5S__mpio_span_hyper_type
*
* Purpose: Translate an HDF5 irregular hyperslab selection into an
MPI type.
*
- * Return: non-negative on success, negative on failure.
+ * Return: Non-negative on success, negative on failure.
*
* Outputs: *new_type the MPI type corresponding to the selection
* *count how many objects of the new_type in selection
@@ -994,24 +991,22 @@ done:
*
* Programmer: kyang
*
- * Modifications:
- * Mohamad Chaarawi
- * Adding support for large datatypes (beyond the limit of a
- * 32 bit integer.
*-------------------------------------------------------------------------
*/
static herr_t
-H5S_mpio_span_hyper_type(const H5S_t *space, size_t elmt_size,
+H5S__mpio_span_hyper_type(const H5S_t *space, size_t elmt_size,
MPI_Datatype *new_type, int *count, hbool_t *is_derived_type)
{
+ H5S_mpio_mpitype_list_t type_list; /* List to track MPI data types created */
MPI_Datatype elmt_type; /* MPI datatype for an element */
hbool_t elmt_type_is_derived = FALSE; /* Whether the element type has been created */
MPI_Datatype span_type; /* MPI datatype for overall span tree */
hsize_t down[H5S_MAX_RANK]; /* 'down' sizes for each dimension */
+ uint64_t op_gen; /* Operation generation value */
int mpi_code; /* MPI return code */
herr_t ret_value = SUCCEED; /* Return value */
- FUNC_ENTER_NOAPI_NOINIT
+ FUNC_ENTER_STATIC
/* Check args */
HDassert(space);
@@ -1020,29 +1015,34 @@ H5S_mpio_span_hyper_type(const H5S_t *space, size_t elmt_size,
HDassert(space->select.sel_info.hslab->span_lst->head);
/* Create the base type for an element */
- if (bigio_count >= elmt_size) {
- if(MPI_SUCCESS != (mpi_code = MPI_Type_contiguous((int)elmt_size, MPI_BYTE, &elmt_type))) {
- HMPI_GOTO_ERROR(FAIL, "MPI_Type_contiguous failed", mpi_code)
- }
- }
- else {
- if (H5S_mpio_create_large_type (elmt_size, 0, MPI_BYTE, &elmt_type) < 0) {
- HGOTO_ERROR(H5E_DATASPACE, H5E_BADTYPE, FAIL,
- "couldn't create a large element datatype in span_hyper selection")
- }
- }
+ if(bigio_count >= elmt_size) {
+ if(MPI_SUCCESS != (mpi_code = MPI_Type_contiguous((int)elmt_size, MPI_BYTE, &elmt_type)))
+ HMPI_GOTO_ERROR(FAIL, "MPI_Type_contiguous failed", mpi_code)
+ } /* end if */
+ else
+ if(H5S__mpio_create_large_type(elmt_size, 0, MPI_BYTE, &elmt_type) < 0)
+ HGOTO_ERROR(H5E_DATASPACE, H5E_BADTYPE, FAIL, "couldn't create a large element datatype in span_hyper selection")
elmt_type_is_derived = TRUE;
/* Compute 'down' sizes for each dimension */
if(H5VM_array_down(space->extent.rank, space->extent.size, down) < 0)
HGOTO_ERROR(H5E_DATASPACE, H5E_CANTGETSIZE, FAIL, "couldn't compute 'down' dimension sizes")
- /* Obtain derived data type */
- if(H5S_obtain_datatype(down, space->select.sel_info.hslab->span_lst->head, &elmt_type, &span_type, elmt_size) < 0)
- HGOTO_ERROR(H5E_DATASPACE, H5E_BADTYPE, FAIL, "couldn't obtain MPI derived data type")
- if(MPI_SUCCESS != (mpi_code = MPI_Type_commit(&span_type)))
+ /* Acquire an operation generation value for creating MPI datatypes */
+ op_gen = H5S__hyper_get_op_gen();
+
+ /* Obtain derived MPI data type */
+ type_list.head = type_list.tail = NULL;
+ if(H5S__obtain_datatype(space->select.sel_info.hslab->span_lst, down, elmt_size, &elmt_type, &span_type, &type_list, op_gen) < 0)
+ HGOTO_ERROR(H5E_DATASPACE, H5E_BADTYPE, FAIL, "couldn't obtain MPI derived data type")
+ if(MPI_SUCCESS != (mpi_code = MPI_Type_dup(span_type, new_type)))
HMPI_GOTO_ERROR(FAIL, "MPI_Type_commit failed", mpi_code)
- *new_type = span_type;
+ if(MPI_SUCCESS != (mpi_code = MPI_Type_commit(new_type)))
+ HMPI_GOTO_ERROR(FAIL, "MPI_Type_commit failed", mpi_code)
+
+ /* Release MPI data types generated during span tree traversal */
+ if(H5S__release_datatype(&type_list) < 0)
+ HGOTO_ERROR(H5E_DATASPACE, H5E_CANTRELEASE, FAIL, "couldn't release MPI derived data type")
/* fill in the remaining return values */
*count = 1;
@@ -1055,16 +1055,62 @@ done:
HMPI_DONE_ERROR(FAIL, "MPI_Type_free failed", mpi_code)
FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5S_mpio_span_hyper_type() */
+} /* end H5S__mpio_span_hyper_type() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5S__release_datatype
+ *
+ * Purpose: Release the MPI derived datatypes for span-tree hyperslab selection
+ *
+ * Return: Non-negative on success, negative on failure.
+ *
+ * Programmer: Quincey Koziol, February 2, 2019
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5S__release_datatype(H5S_mpio_mpitype_list_t *type_list)
+{
+ H5S_mpio_mpitype_node_t *curr; /* Pointer to head of list */
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_STATIC
+
+ /* Sanity check */
+ HDassert(type_list);
+
+ /* Iterate over the list, freeing the MPI data types */
+ curr = type_list->head;
+ while(curr) {
+ H5S_mpio_mpitype_node_t *next; /* Pointer to next node in list */
+ int mpi_code; /* MPI return status code */
+
+ /* Release the MPI data type for this span tree */
+ if(MPI_SUCCESS != (mpi_code = MPI_Type_free(&curr->type)))
+ HMPI_GOTO_ERROR(FAIL, "MPI_Type_free failed", mpi_code)
+
+ /* Get pointer to next node in list */
+ next = curr->next;
+
+ /* Free the current node */
+ curr = H5FL_FREE(H5S_mpio_mpitype_node_t, curr);
+
+ /* Advance to next node */
+ curr = next;
+ } /* end while */
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5S__release_datatype() */
/*-------------------------------------------------------------------------
- * Function: H5S_obtain_datatype
+ * Function: H5S__obtain_datatype
*
- * Purpose: Obtain an MPI derived datatype based on span-tree
- * implementation
+ * Purpose: Obtain an MPI derived datatype for span-tree hyperslab selection
*
- * Return: non-negative on success, negative on failure.
+ * Return: Non-negative on success, negative on failure.
*
* Outputs: *span_type the MPI type corresponding to the selection
*
@@ -1073,208 +1119,219 @@ done:
*-------------------------------------------------------------------------
*/
static herr_t
-H5S_obtain_datatype(const hsize_t *down, H5S_hyper_span_t *span,
- const MPI_Datatype *elmt_type, MPI_Datatype *span_type, size_t elmt_size)
+H5S__obtain_datatype(H5S_hyper_span_info_t *spans, const hsize_t *down,
+ size_t elmt_size, const MPI_Datatype *elmt_type, MPI_Datatype *span_type,
+ H5S_mpio_mpitype_list_t *type_list, uint64_t op_gen)
{
+ H5S_hyper_span_t *span; /* Hyperslab span to iterate with */
size_t alloc_count = 0; /* Number of span tree nodes allocated at this level */
- size_t outercount = 0; /* Number of span tree nodes at this level */
+ size_t outercount; /* Number of span tree nodes at this level */
MPI_Datatype *inner_type = NULL;
hbool_t inner_types_freed = FALSE; /* Whether the inner_type MPI datatypes have been freed */
- hbool_t span_type_valid = FALSE; /* Whether the span_type MPI datatypes is valid */
- hbool_t large_block = FALSE; /* Wether the block length is larger than 32 bit integer */
int *blocklen = NULL;
MPI_Aint *disp = NULL;
- H5S_hyper_span_t *tspan = NULL; /* Temporary pointer to span tree node */
+ size_t u; /* Local index variable */
int mpi_code; /* MPI return status code */
herr_t ret_value = SUCCEED; /* Return value */
- FUNC_ENTER_NOAPI_NOINIT
+ FUNC_ENTER_STATIC
/* Sanity check */
- HDassert(span);
+ HDassert(spans);
+ HDassert(type_list);
+
+ /* Check if we've visited this span tree before */
+ if(spans->op_gen != op_gen) {
+ H5S_mpio_mpitype_node_t *type_node; /* Pointer to new node in MPI data type list */
+
+ /* Allocate the initial displacement & block length buffers */
+ alloc_count = H5S_MPIO_INITIAL_ALLOC_COUNT;
+ if(NULL == (disp = (MPI_Aint *)H5MM_malloc(alloc_count * sizeof(MPI_Aint))))
+ HGOTO_ERROR(H5E_DATASPACE, H5E_CANTALLOC, FAIL, "can't allocate array of displacements")
+ if(NULL == (blocklen = (int *)H5MM_malloc(alloc_count * sizeof(int))))
+ HGOTO_ERROR(H5E_DATASPACE, H5E_CANTALLOC, FAIL, "can't allocate array of block lengths")
+
+ /* If this is the fastest changing dimension, it is the base case for derived datatype. */
+ span = spans->head;
+ if(NULL == span->down) {
+ hbool_t large_block = FALSE; /* Wether the block length is larger than 32 bit integer */
+
+ outercount = 0;
+ while(span) {
+ hsize_t nelmts; /* # of elements covered by current span */
+
+ /* Check if we need to increase the size of the buffers */
+ if(outercount >= alloc_count) {
+ MPI_Aint *tmp_disp; /* Temporary pointer to new displacement buffer */
+ int *tmp_blocklen; /* Temporary pointer to new block length buffer */
+
+ /* Double the allocation count */
+ alloc_count *= 2;
+
+ /* Re-allocate the buffers */
+ if(NULL == (tmp_disp = (MPI_Aint *)H5MM_realloc(disp, alloc_count * sizeof(MPI_Aint))))
+ HGOTO_ERROR(H5E_DATASPACE, H5E_CANTALLOC, FAIL, "can't allocate array of displacements")
+ disp = tmp_disp;
+ if(NULL == (tmp_blocklen = (int *)H5MM_realloc(blocklen, alloc_count * sizeof(int))))
+ HGOTO_ERROR(H5E_DATASPACE, H5E_CANTALLOC, FAIL, "can't allocate array of block lengths")
+ blocklen = tmp_blocklen;
+ } /* end if */
- /* Allocate the initial displacement & block length buffers */
- alloc_count = H5S_MPIO_INITIAL_ALLOC_COUNT;
- if(NULL == (disp = (MPI_Aint *)H5MM_malloc(alloc_count * sizeof(MPI_Aint))))
- HGOTO_ERROR(H5E_DATASPACE, H5E_CANTALLOC, FAIL, "can't allocate array of displacements")
- if(NULL == (blocklen = (int *)H5MM_malloc(alloc_count * sizeof(int))))
- HGOTO_ERROR(H5E_DATASPACE, H5E_CANTALLOC, FAIL, "can't allocate array of block lengths")
-
- /* if this is the fastest changing dimension, it is the base case for derived datatype. */
- if(NULL == span->down) {
- tspan = span;
- outercount = 0;
- while(tspan) {
- /* Check if we need to increase the size of the buffers */
- if(outercount >= alloc_count) {
- MPI_Aint *tmp_disp; /* Temporary pointer to new displacement buffer */
- int *tmp_blocklen; /* Temporary pointer to new block length buffer */
-
- /* Double the allocation count */
- alloc_count *= 2;
-
- /* Re-allocate the buffers */
- if(NULL == (tmp_disp = (MPI_Aint *)H5MM_realloc(disp, alloc_count * sizeof(MPI_Aint))))
- HGOTO_ERROR(H5E_DATASPACE, H5E_CANTALLOC, FAIL, "can't allocate array of displacements")
- disp = tmp_disp;
- if(NULL == (tmp_blocklen = (int *)H5MM_realloc(blocklen, alloc_count * sizeof(int))))
- HGOTO_ERROR(H5E_DATASPACE, H5E_CANTALLOC, FAIL, "can't allocate array of block lengths")
- blocklen = tmp_blocklen;
- } /* end if */
+ /* Compute the number of elements to attempt in this span */
+ nelmts = (span->high - span->low) + 1;
- /* Store displacement & block length */
- disp[outercount] = (MPI_Aint)elmt_size * tspan->low;
- H5_CHECK_OVERFLOW(tspan->nelem, hsize_t, int)
- blocklen[outercount] = (int)tspan->nelem;
- tspan = tspan->next;
+ /* Store displacement & block length */
+ disp[outercount] = (MPI_Aint)elmt_size * span->low;
+ H5_CHECK_OVERFLOW(nelmts, hsize_t, int)
+ blocklen[outercount] = (int)nelmts;
- if (bigio_count < blocklen[outercount]) {
- large_block = TRUE; /* at least one block type is large, so set this flag to true */
- }
+ if(bigio_count < blocklen[outercount])
+ large_block = TRUE; /* at least one block type is large, so set this flag to true */
- outercount++;
- } /* end while */
+ span = span->next;
+ outercount++;
+ } /* end while */
- /* Everything fits into integers, so cast them and use hindexed */
- if (bigio_count >= outercount && large_block == FALSE) {
+ /* Everything fits into integers, so cast them and use hindexed */
+ if(bigio_count >= outercount && large_block == FALSE) {
+ if(MPI_SUCCESS != (mpi_code = MPI_Type_create_hindexed((int)outercount, blocklen, disp, *elmt_type, &spans->u.down_type)))
+ HMPI_GOTO_ERROR(FAIL, "MPI_Type_create_hindexed failed", mpi_code)
+ } /* end if */
+ else { /* LARGE_DATATYPE:: Something doesn't fit into a 32 bit integer */
+ for(u = 0 ; u < outercount; u++) {
+ MPI_Datatype temp_type = MPI_DATATYPE_NULL;
+
+ /* create the block type from elmt_type while checking the 32 bit int limit */
+ if(blocklen[u] > bigio_count) {
+ if(H5S__mpio_create_large_type(blocklen[u], 0, *elmt_type, &temp_type) < 0)
+ HGOTO_ERROR(H5E_DATASPACE, H5E_BADTYPE, FAIL, "couldn't create a large element datatype in span_hyper selection")
+ } /* end if */
+ else
+ if(MPI_SUCCESS != (mpi_code = MPI_Type_contiguous((int)blocklen[u], *elmt_type, &temp_type)))
+ HMPI_GOTO_ERROR(FAIL, "MPI_Type_contiguous failed", mpi_code)
+
+ /* Combine the current datatype that is created with this current block type */
+ if(0 == u) /* first iteration, there is no combined datatype yet */
+ spans->u.down_type = temp_type;
+ else {
+ int bl[2] = {1, 1};
+ MPI_Aint ds[2] = {disp[u - 1], disp[u]};
+ MPI_Datatype dt[2] = {spans->u.down_type, temp_type};
+
+ if(MPI_SUCCESS != (mpi_code = MPI_Type_create_struct(2, /* count */
+ bl, /* blocklength */
+ ds, /* stride in bytes*/
+ dt, /* old type */
+ &spans->u.down_type))) /* new type */
+ HMPI_GOTO_ERROR(FAIL, "MPI_Type_create_struct failed", mpi_code)
+
+ /* Release previous temporary datatype */
+ if(MPI_SUCCESS != (mpi_code = MPI_Type_free(&temp_type)))
+ HMPI_GOTO_ERROR(FAIL, "MPI_Type_free failed", mpi_code)
+ } /* end else */
+ } /* end for */
+ } /* end else (LARGE_DATATYPE::) */
+ } /* end if */
+ else {
+ MPI_Aint stride; /* Distance between inner MPI datatypes */
- if(MPI_SUCCESS != (mpi_code = MPI_Type_create_hindexed((int)outercount, blocklen, disp, *elmt_type, span_type)))
- HMPI_GOTO_ERROR(FAIL, "MPI_Type_create_hindexed failed", mpi_code)
- span_type_valid = TRUE;
- }
- else { /* LARGE_DATATYPE:: Something doesn't fit into a 32 bit integer */
- size_t i;
-
- for (i=0 ; i<outercount ; i++) {
- MPI_Datatype temp_type = MPI_DATATYPE_NULL, outer_type = MPI_DATATYPE_NULL;
- /* create the block type from elmt_type while checking the 32 bit int limit */
- if (blocklen[i] > bigio_count) {
- if (H5S_mpio_create_large_type (blocklen[i], 0, *elmt_type, &temp_type) < 0) {
- HGOTO_ERROR(H5E_DATASPACE, H5E_BADTYPE, FAIL,
- "couldn't create a large element datatype in span_hyper selection")
- }
- }
- else {
- if(MPI_SUCCESS != (mpi_code = MPI_Type_contiguous((int)blocklen[i],
- *elmt_type,
- &temp_type)))
- HMPI_GOTO_ERROR(FAIL, "MPI_Type_contiguous failed", mpi_code)
- }
-
- /* combine the current datatype that is created with this current block type */
- if (0 == i) { /* first iteration, there is no combined datatype yet */
- *span_type = temp_type;
- }
- else {
- int bl[2] = {1,1};
- MPI_Aint ds[2] = {disp[i-1],disp[i]};
- MPI_Datatype dt[2] = {*span_type, temp_type};
-
- if (MPI_SUCCESS != (mpi_code = MPI_Type_create_struct (2, /* count */
- bl, /* blocklength */
- ds, /* stride in bytes*/
- dt, /* old type */
- &outer_type))){ /* new type */
- HMPI_GOTO_ERROR(FAIL, "MPI_Type_create_struct failed", mpi_code)
- }
- *span_type = outer_type;
- }
-
- if (outer_type != MPI_DATATYPE_NULL)
- MPI_Type_free(&outer_type);
- /* temp_type shouldn't be freed here...
- * Note that we have simply copied it above (not MPI_Type_dup)
- * into the 'span_type' argument of the caller.
- * The caller needs to deal with it there!
- */
- }
- } /* end (LARGE_DATATYPE::) */
+ if(NULL == (inner_type = (MPI_Datatype *)H5MM_malloc(alloc_count * sizeof(MPI_Datatype))))
+ HGOTO_ERROR(H5E_DATASPACE, H5E_CANTALLOC, FAIL, "can't allocate array of inner MPI datatypes")
- } /* end if */
- else {
- size_t u; /* Local index variable */
+ /* Calculate the total bytes of the lower dimension */
+ stride = (*down) * elmt_size;
- if(NULL == (inner_type = (MPI_Datatype *)H5MM_malloc(alloc_count * sizeof(MPI_Datatype))))
- HGOTO_ERROR(H5E_DATASPACE, H5E_CANTALLOC, FAIL, "can't allocate array of inner MPI datatypes")
+ /* Loop over span nodes */
+ outercount = 0;
+ while(span) {
+ MPI_Datatype down_type; /* Temporary MPI datatype for a span tree node's children */
+ hsize_t nelmts; /* # of elements covered by current span */
+
+ /* Check if we need to increase the size of the buffers */
+ if(outercount >= alloc_count) {
+ MPI_Aint *tmp_disp; /* Temporary pointer to new displacement buffer */
+ int *tmp_blocklen; /* Temporary pointer to new block length buffer */
+ MPI_Datatype *tmp_inner_type; /* Temporary pointer to inner MPI datatype buffer */
+
+ /* Double the allocation count */
+ alloc_count *= 2;
+
+ /* Re-allocate the buffers */
+ if(NULL == (tmp_disp = (MPI_Aint *)H5MM_realloc(disp, alloc_count * sizeof(MPI_Aint))))
+ HGOTO_ERROR(H5E_DATASPACE, H5E_CANTALLOC, FAIL, "can't allocate array of displacements")
+ disp = tmp_disp;
+ if(NULL == (tmp_blocklen = (int *)H5MM_realloc(blocklen, alloc_count * sizeof(int))))
+ HGOTO_ERROR(H5E_DATASPACE, H5E_CANTALLOC, FAIL, "can't allocate array of block lengths")
+ blocklen = tmp_blocklen;
+ if(NULL == (tmp_inner_type = (MPI_Datatype *)H5MM_realloc(inner_type, alloc_count * sizeof(MPI_Datatype))))
+ HGOTO_ERROR(H5E_DATASPACE, H5E_CANTALLOC, FAIL, "can't allocate array of inner MPI datatypes")
+ inner_type = tmp_inner_type;
+ } /* end if */
- tspan = span;
- outercount = 0;
- while(tspan) {
- MPI_Datatype down_type; /* Temporary MPI datatype for a span tree node's children */
- MPI_Aint stride; /* Distance between inner MPI datatypes */
+ /* Displacement should be in byte and should have dimension information */
+ /* First using MPI Type vector to build derived data type for this span only */
+ /* Need to calculate the disp in byte for this dimension. */
+ disp[outercount] = span->low * stride;
+ blocklen[outercount] = 1;
- /* Check if we need to increase the size of the buffers */
- if(outercount >= alloc_count) {
- MPI_Aint *tmp_disp; /* Temporary pointer to new displacement buffer */
- int *tmp_blocklen; /* Temporary pointer to new block length buffer */
- MPI_Datatype *tmp_inner_type; /* Temporary pointer to inner MPI datatype buffer */
-
- /* Double the allocation count */
- alloc_count *= 2;
-
- /* Re-allocate the buffers */
- if(NULL == (tmp_disp = (MPI_Aint *)H5MM_realloc(disp, alloc_count * sizeof(MPI_Aint))))
- HGOTO_ERROR(H5E_DATASPACE, H5E_CANTALLOC, FAIL, "can't allocate array of displacements")
- disp = tmp_disp;
- if(NULL == (tmp_blocklen = (int *)H5MM_realloc(blocklen, alloc_count * sizeof(int))))
- HGOTO_ERROR(H5E_DATASPACE, H5E_CANTALLOC, FAIL, "can't allocate array of block lengths")
- blocklen = tmp_blocklen;
- if(NULL == (tmp_inner_type = (MPI_Datatype *)H5MM_realloc(inner_type, alloc_count * sizeof(MPI_Datatype))))
- HGOTO_ERROR(H5E_DATASPACE, H5E_CANTALLOC, FAIL, "can't allocate array of inner MPI datatypes")
- inner_type = tmp_inner_type;
- } /* end if */
+ /* Generate MPI datatype for next dimension down */
+ if(H5S__obtain_datatype(span->down, down + 1, elmt_size, elmt_type, &down_type, type_list, op_gen) < 0)
+ HGOTO_ERROR(H5E_DATASPACE, H5E_BADTYPE, FAIL, "couldn't obtain MPI derived data type")
- /* Displacement should be in byte and should have dimension information */
- /* First using MPI Type vector to build derived data type for this span only */
- /* Need to calculate the disp in byte for this dimension. */
- /* Calculate the total bytes of the lower dimension */
- disp[outercount] = tspan->low * (*down) * elmt_size;
- blocklen[outercount] = 1;
+ /* Compute the number of elements to attempt in this span */
+ nelmts = (span->high - span->low) + 1;
+
+ /* Build the MPI datatype for this node */
+ H5_CHECK_OVERFLOW(nelmts, hsize_t, int)
+ if(MPI_SUCCESS != (mpi_code = MPI_Type_create_hvector((int)nelmts, 1, stride, down_type, &inner_type[outercount])))
+ HMPI_GOTO_ERROR(FAIL, "MPI_Type_create_hvector failed", mpi_code)
- /* Generate MPI datatype for next dimension down */
- if(H5S_obtain_datatype(down + 1, tspan->down->head, elmt_type, &down_type, elmt_size) < 0)
- HGOTO_ERROR(H5E_DATASPACE, H5E_BADTYPE, FAIL, "couldn't obtain MPI derived data type")
+ span = span->next;
+ outercount++;
+ } /* end while */
- /* Build the MPI datatype for this node */
- stride = (*down) * elmt_size;
- H5_CHECK_OVERFLOW(tspan->nelem, hsize_t, int)
- if(MPI_SUCCESS != (mpi_code = MPI_Type_create_hvector((int)tspan->nelem, 1, stride, down_type, &inner_type[outercount]))) {
- MPI_Type_free(&down_type);
- HMPI_GOTO_ERROR(FAIL, "MPI_Type_create_hvector failed", mpi_code)
- } /* end if */
+ /* Building the whole vector datatype */
+ H5_CHECK_OVERFLOW(outercount, size_t, int)
+ if(MPI_SUCCESS != (mpi_code = MPI_Type_create_struct((int)outercount, blocklen, disp, inner_type, &spans->u.down_type)))
+ HMPI_GOTO_ERROR(FAIL, "MPI_Type_create_struct failed", mpi_code)
+
+ /* Release inner node types */
+ for(u = 0; u < outercount; u++)
+ if(MPI_SUCCESS != (mpi_code = MPI_Type_free(&inner_type[u])))
+ HMPI_GOTO_ERROR(FAIL, "MPI_Type_free failed", mpi_code)
+ inner_types_freed = TRUE;
+ } /* end else */
- /* Release MPI datatype for next dimension down */
- if(MPI_SUCCESS != (mpi_code = MPI_Type_free(&down_type)))
- HMPI_GOTO_ERROR(FAIL, "MPI_Type_free failed", mpi_code)
+ /* Allocate space for the MPI data type list node */
+ if(NULL == (type_node = H5FL_MALLOC(H5S_mpio_mpitype_node_t)))
+ HGOTO_ERROR(H5E_DATASPACE, H5E_CANTALLOC, FAIL, "can't allocate MPI data type list node")
- tspan = tspan->next;
- outercount++;
- } /* end while */
+ /* Set up MPI type node */
+ type_node->type = spans->u.down_type;
+ type_node->next = NULL;
- /* building the whole vector datatype */
- H5_CHECK_OVERFLOW(outercount, size_t, int)
- if(MPI_SUCCESS != (mpi_code = MPI_Type_create_struct((int)outercount, blocklen, disp, inner_type, span_type)))
- HMPI_GOTO_ERROR(FAIL, "MPI_Type_create_struct failed", mpi_code)
- span_type_valid = TRUE;
+ /* Add MPI type node to list */
+ if(type_list->head == NULL)
+ type_list->head = type_list->tail = type_node;
+ else {
+ type_list->tail->next = type_node;
+ type_list->tail = type_node;
+ } /* end else */
- /* Release inner node types */
- for(u = 0; u < outercount; u++)
- if(MPI_SUCCESS != (mpi_code = MPI_Type_free(&inner_type[u])))
- HMPI_GOTO_ERROR(FAIL, "MPI_Type_free failed", mpi_code)
- inner_types_freed = TRUE;
+ /* Remember that we've visited this span tree */
+ spans->op_gen = op_gen;
} /* end else */
+ /* Return MPI data type for span tree */
+ *span_type = spans->u.down_type;
+
done:
/* General cleanup */
if(inner_type != NULL) {
- if(!inner_types_freed) {
- size_t u; /* Local index variable */
-
+ if(!inner_types_freed)
for(u = 0; u < outercount; u++)
if(MPI_SUCCESS != (mpi_code = MPI_Type_free(&inner_type[u])))
HMPI_DONE_ERROR(FAIL, "MPI_Type_free failed", mpi_code)
- } /* end if */
-
H5MM_free(inner_type);
} /* end if */
if(blocklen != NULL)
@@ -1282,15 +1339,8 @@ done:
if(disp != NULL)
H5MM_free(disp);
- /* Error cleanup */
- if(ret_value < 0) {
- if(span_type_valid)
- if(MPI_SUCCESS != (mpi_code = MPI_Type_free(span_type)))
- HMPI_DONE_ERROR(FAIL, "MPI_Type_free failed", mpi_code)
- } /* end if */
-
FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5S_obtain_datatype() */
+} /* end H5S__obtain_datatype() */
/*-------------------------------------------------------------------------
@@ -1299,7 +1349,7 @@ done:
* Purpose: Translate an HDF5 dataspace selection into an MPI type.
* Currently handle only hyperslab and "all" selections.
*
- * Return: non-negative on success, negative on failure.
+ * Return: Non-negative on success, negative on failure.
*
* Outputs: *new_type the MPI type corresponding to the selection
* *count how many objects of the new_type in selection
@@ -1311,7 +1361,7 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5S_mpio_space_type(const H5S_t *space, size_t elmt_size, MPI_Datatype *new_type,
+H5S_mpio_space_type(const H5S_t *space, size_t elmt_size, MPI_Datatype *new_type,
int *count, hbool_t *is_derived_type, hbool_t do_permute, hsize_t **permute_map,
hbool_t *is_permuted)
{
@@ -1332,10 +1382,10 @@ H5S_mpio_space_type(const H5S_t *space, size_t elmt_size, MPI_Datatype *new_type
* out-of-order point selection, then permute this selection which
* should be a memory selection to match the file space permutation.
*/
- if(TRUE == *is_permuted) {
+ if(TRUE == *is_permuted) {
switch(H5S_GET_SELECT_TYPE(space)) {
case H5S_SEL_NONE:
- if(H5S_mpio_none_type(new_type, count, is_derived_type) < 0)
+ if(H5S__mpio_none_type(new_type, count, is_derived_type) < 0)
HGOTO_ERROR(H5E_DATASPACE, H5E_BADTYPE, FAIL, "couldn't convert 'none' selection to MPI type")
break;
@@ -1345,7 +1395,7 @@ H5S_mpio_space_type(const H5S_t *space, size_t elmt_size, MPI_Datatype *new_type
/* Sanity check */
HDassert(!do_permute);
- if(H5S_mpio_permute_type(space, elmt_size, permute_map, new_type, count, is_derived_type) < 0)
+ if(H5S__mpio_permute_type(space, elmt_size, permute_map, new_type, count, is_derived_type) < 0)
HGOTO_ERROR(H5E_DATASPACE, H5E_BADTYPE, FAIL, "couldn't convert 'all' selection to MPI type")
break;
@@ -1360,29 +1410,28 @@ H5S_mpio_space_type(const H5S_t *space, size_t elmt_size, MPI_Datatype *new_type
else {
switch(H5S_GET_SELECT_TYPE(space)) {
case H5S_SEL_NONE:
- if(H5S_mpio_none_type(new_type, count, is_derived_type) < 0)
+ if(H5S__mpio_none_type(new_type, count, is_derived_type) < 0)
HGOTO_ERROR(H5E_DATASPACE, H5E_BADTYPE, FAIL,"couldn't convert 'none' selection to MPI type")
break;
case H5S_SEL_ALL:
- if(H5S_mpio_all_type(space, elmt_size, new_type, count, is_derived_type) < 0)
+ if(H5S__mpio_all_type(space, elmt_size, new_type, count, is_derived_type) < 0)
HGOTO_ERROR(H5E_DATASPACE, H5E_BADTYPE, FAIL,"couldn't convert 'all' selection to MPI type")
break;
case H5S_SEL_POINTS:
- if(H5S_mpio_point_type(space, elmt_size, new_type, count, is_derived_type, do_permute, permute_map, is_permuted) < 0)
+ if(H5S__mpio_point_type(space, elmt_size, new_type, count, is_derived_type, do_permute, permute_map, is_permuted) < 0)
HGOTO_ERROR(H5E_DATASPACE, H5E_BADTYPE, FAIL, "couldn't convert 'point' selection to MPI type")
break;
case H5S_SEL_HYPERSLABS:
if((H5S_SELECT_IS_REGULAR(space) == TRUE)) {
- if(H5S_mpio_hyper_type(space, elmt_size, new_type, count, is_derived_type) < 0)
+ if(H5S__mpio_reg_hyper_type(space, elmt_size, new_type, count, is_derived_type) < 0)
HGOTO_ERROR(H5E_DATASPACE, H5E_BADTYPE, FAIL,"couldn't convert regular 'hyperslab' selection to MPI type")
} /* end if */
- else {
- if(H5S_mpio_span_hyper_type(space, elmt_size, new_type, count, is_derived_type) < 0)
+ else
+ if(H5S__mpio_span_hyper_type(space, elmt_size, new_type, count, is_derived_type) < 0)
HGOTO_ERROR(H5E_DATASPACE, H5E_BADTYPE, FAIL,"couldn't convert irregular 'hyperslab' selection to MPI type")
- } /* end else */
break;
case H5S_SEL_ERROR:
@@ -1406,12 +1455,12 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5S_mpio_create_large_type
+ * Function: H5S__mpio_create_large_type
*
- * Purpose: Create a large datatype of size larger than what a 32 bit integer
+ * Purpose: Create a large datatype of size larger than what a 32 bit integer
* can hold.
*
- * Return: non-negative on success, negative on failure.
+ * Return: Non-negative on success, negative on failure.
*
* *new_type the new datatype created
*
@@ -1419,10 +1468,9 @@ done:
*
*-------------------------------------------------------------------------
*/
-static herr_t H5S_mpio_create_large_type (hsize_t num_elements,
- MPI_Aint stride_bytes,
- MPI_Datatype old_type,
- MPI_Datatype *new_type)
+static herr_t
+H5S__mpio_create_large_type(hsize_t num_elements, MPI_Aint stride_bytes,
+ MPI_Datatype old_type, MPI_Datatype *new_type)
{
int num_big_types; /* num times the 2G datatype will be repeated */
int remaining_bytes; /* the number of bytes left that can be held in an int value */
@@ -1434,7 +1482,7 @@ static herr_t H5S_mpio_create_large_type (hsize_t num_elements,
MPI_Aint disp[2], old_extent;
herr_t ret_value = SUCCEED; /* Return value */
- FUNC_ENTER_NOAPI_NOINIT
+ FUNC_ENTER_STATIC
/* Calculate how many Big MPI datatypes are needed to represent the buffer */
num_big_types = (int)(num_elements/bigio_count);
@@ -1447,41 +1495,23 @@ static herr_t H5S_mpio_create_large_type (hsize_t num_elements,
* use type_hvector to create the type with the displacement provided
*/
if (0 == stride_bytes) {
- if(MPI_SUCCESS != (mpi_code = MPI_Type_contiguous(bigio_count,
- old_type,
- &inner_type))) {
+ if(MPI_SUCCESS != (mpi_code = MPI_Type_contiguous(bigio_count, old_type, &inner_type)))
HMPI_GOTO_ERROR(FAIL, "MPI_Type_contiguous failed", mpi_code)
- }
- }
- else {
- if(MPI_SUCCESS != (mpi_code = MPI_Type_create_hvector (bigio_count,
- 1,
- stride_bytes,
- old_type,
- &inner_type))) {
+ } /* end if */
+ else
+ if(MPI_SUCCESS != (mpi_code = MPI_Type_create_hvector(bigio_count, 1, stride_bytes, old_type, &inner_type)))
HMPI_GOTO_ERROR(FAIL, "MPI_Type_create_hvector failed", mpi_code)
- }
- }
/* Create a contiguous datatype of the buffer (minus the remaining < 2GB part)
* If a stride is present, use hvector type
*/
- if (0 == stride_bytes) {
- if(MPI_SUCCESS != (mpi_code = MPI_Type_contiguous(num_big_types,
- inner_type,
- &outer_type))) {
+ if(0 == stride_bytes) {
+ if(MPI_SUCCESS != (mpi_code = MPI_Type_contiguous(num_big_types, inner_type, &outer_type)))
HMPI_GOTO_ERROR(FAIL, "MPI_Type_contiguous failed", mpi_code)
- }
- }
- else {
- if(MPI_SUCCESS != (mpi_code = MPI_Type_create_hvector (num_big_types,
- 1,
- stride_bytes,
- inner_type,
- &outer_type))) {
+ } /* end if */
+ else
+ if(MPI_SUCCESS != (mpi_code = MPI_Type_create_hvector(num_big_types, 1, stride_bytes, inner_type, &outer_type)))
HMPI_GOTO_ERROR(FAIL, "MPI_Type_create_hvector failed", mpi_code)
- }
- }
MPI_Type_free(&inner_type);
@@ -1489,23 +1519,13 @@ static herr_t H5S_mpio_create_large_type (hsize_t num_elements,
* use a struct datatype to encapsulate everything.
*/
if(remaining_bytes) {
- if (stride_bytes == 0) {
- if(MPI_SUCCESS != (mpi_code = MPI_Type_contiguous (remaining_bytes,
- old_type,
- &leftover_type))) {
+ if(stride_bytes == 0) {
+ if(MPI_SUCCESS != (mpi_code = MPI_Type_contiguous(remaining_bytes, old_type, &leftover_type)))
HMPI_GOTO_ERROR(FAIL, "MPI_Type_contiguous failed", mpi_code)
- }
- }
- else {
- if(MPI_SUCCESS != (mpi_code = MPI_Type_create_hvector
- ((int)(num_elements - (hsize_t)num_big_types*bigio_count),
- 1,
- stride_bytes,
- old_type,
- &leftover_type))) {
+ } /* end if */
+ else
+ if(MPI_SUCCESS != (mpi_code = MPI_Type_create_hvector((int)(num_elements - (hsize_t)num_big_types * bigio_count), 1, stride_bytes, old_type, &leftover_type)))
HMPI_GOTO_ERROR(FAIL, "MPI_Type_create_hvector failed", mpi_code)
- }
- }
/* 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
@@ -1522,28 +1542,25 @@ static herr_t H5S_mpio_create_large_type (hsize_t num_elements,
block_len[0] = 1;
block_len[1] = 1;
disp[0] = 0;
- disp[1] = (old_extent+stride_bytes)*num_big_types*(MPI_Aint)bigio_count;
+ disp[1] = (old_extent + stride_bytes) * num_big_types * (MPI_Aint)bigio_count;
- if(MPI_SUCCESS != (mpi_code =
- MPI_Type_create_struct(2, block_len, disp, type, new_type))) {
+ if(MPI_SUCCESS != (mpi_code = MPI_Type_create_struct(2, block_len, disp, type, new_type)))
HMPI_GOTO_ERROR(FAIL, "MPI_Type_create_struct failed", mpi_code)
- }
MPI_Type_free(&outer_type);
MPI_Type_free(&leftover_type);
- }
- else {
+ } /* end if */
+ else
/* There are no remaining bytes so just set the new type to
* the outer type created */
*new_type = outer_type;
- }
if(MPI_SUCCESS != (mpi_code = MPI_Type_commit(new_type)))
HMPI_GOTO_ERROR(FAIL, "MPI_Type_commit failed", mpi_code)
done:
FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5S_mpio_create_large_type */
+} /* end H5S__mpio_create_large_type() */
#endif /* H5_HAVE_PARALLEL */
diff --git a/src/H5Snone.c b/src/H5Snone.c
index a8aaf7e..9d64e9d 100644
--- a/src/H5Snone.c
+++ b/src/H5Snone.c
@@ -18,166 +18,197 @@
* Purpose: "None" selection dataspace I/O functions.
*/
+/****************/
+/* Module Setup */
+/****************/
+
#include "H5Smodule.h" /* This source code file is part of the H5S module */
-#include "H5private.h"
-#include "H5Eprivate.h"
-#include "H5Iprivate.h"
-#include "H5Spkg.h"
-#include "H5VMprivate.h"
-#include "H5Dprivate.h"
+/***********/
+/* Headers */
+/***********/
+#include "H5private.h" /* Generic Functions */
+#include "H5Eprivate.h" /* Error handling */
+#include "H5Iprivate.h" /* ID Functions */
+#include "H5Spkg.h" /* Dataspace functions */
+#include "H5VMprivate.h" /* Vector functions */
+
+
+/****************/
+/* Local Macros */
+/****************/
+
+
+/******************/
+/* Local Typedefs */
+/******************/
+
-/* Static function prototypes */
+/********************/
+/* Local Prototypes */
+/********************/
/* Selection callbacks */
-static herr_t H5S_none_copy(H5S_t *dst, const H5S_t *src, hbool_t share_selection);
-static herr_t H5S_none_get_seq_list(const H5S_t *space, unsigned flags,
- H5S_sel_iter_t *iter, size_t maxseq, size_t maxbytes,
- size_t *nseq, size_t *nbytes, hsize_t *off, size_t *len);
-static herr_t H5S_none_release(H5S_t *space);
-static htri_t H5S_none_is_valid(const H5S_t *space);
-static hssize_t H5S_none_serial_size(const H5S_t *space);
-static herr_t H5S_none_serialize(const H5S_t *space, uint8_t **p);
-static herr_t H5S_none_deserialize(H5S_t *space, uint32_t version, uint8_t flags,
- const uint8_t **p);
-static herr_t H5S_none_bounds(const H5S_t *space, hsize_t *start, hsize_t *end);
-static herr_t H5S_none_offset(const H5S_t *space, hsize_t *off);
+static herr_t H5S__none_copy(H5S_t *dst, const H5S_t *src, hbool_t share_selection);
+static herr_t H5S__none_release(H5S_t *space);
+static htri_t H5S__none_is_valid(const H5S_t *space);
+static hssize_t H5S__none_serial_size(const H5S_t *space);
+static herr_t H5S__none_serialize(const H5S_t *space, uint8_t **p);
+static herr_t H5S__none_deserialize(H5S_t **space, const uint8_t **p);
+static herr_t H5S__none_bounds(const H5S_t *space, hsize_t *start, hsize_t *end);
+static herr_t H5S__none_offset(const H5S_t *space, hsize_t *off);
static int H5S__none_unlim_dim(const H5S_t *space);
-static htri_t H5S_none_is_contiguous(const H5S_t *space);
-static htri_t H5S_none_is_single(const H5S_t *space);
-static htri_t H5S_none_is_regular(const H5S_t *space);
-static herr_t H5S_none_adjust_u(H5S_t *space, const hsize_t *offset);
-static herr_t H5S_none_project_scalar(const H5S_t *space, hsize_t *offset);
-static herr_t H5S_none_project_simple(const H5S_t *space, H5S_t *new_space, hsize_t *offset);
-static herr_t H5S_none_iter_init(H5S_sel_iter_t *iter, const H5S_t *space);
+static htri_t H5S__none_is_contiguous(const H5S_t *space);
+static htri_t H5S__none_is_single(const H5S_t *space);
+static htri_t H5S__none_is_regular(const H5S_t *space);
+static htri_t H5S__none_shape_same(const H5S_t *space1, const H5S_t *space2);
+static herr_t H5S__none_adjust_u(H5S_t *space, const hsize_t *offset);
+static herr_t H5S__none_project_scalar(const H5S_t *space, hsize_t *offset);
+static herr_t H5S__none_project_simple(const H5S_t *space, H5S_t *new_space, hsize_t *offset);
+static herr_t H5S__none_iter_init(const H5S_t *space, H5S_sel_iter_t *iter);
/* Selection iteration callbacks */
-static herr_t H5S_none_iter_coords(const H5S_sel_iter_t *iter, hsize_t *coords);
-static herr_t H5S_none_iter_block(const H5S_sel_iter_t *iter, hsize_t *start, hsize_t *end);
-static hsize_t H5S_none_iter_nelmts(const H5S_sel_iter_t *iter);
-static htri_t H5S_none_iter_has_next_block(const H5S_sel_iter_t *iter);
-static herr_t H5S_none_iter_next(H5S_sel_iter_t *sel_iter, size_t nelem);
-static herr_t H5S_none_iter_next_block(H5S_sel_iter_t *sel_iter);
-static herr_t H5S_none_iter_release(H5S_sel_iter_t *sel_iter);
+static herr_t H5S__none_iter_coords(const H5S_sel_iter_t *iter, hsize_t *coords);
+static herr_t H5S__none_iter_block(const H5S_sel_iter_t *iter, hsize_t *start, hsize_t *end);
+static hsize_t H5S__none_iter_nelmts(const H5S_sel_iter_t *iter);
+static htri_t H5S__none_iter_has_next_block(const H5S_sel_iter_t *iter);
+static herr_t H5S__none_iter_next(H5S_sel_iter_t *sel_iter, size_t nelem);
+static herr_t H5S__none_iter_next_block(H5S_sel_iter_t *sel_iter);
+static herr_t H5S__none_iter_get_seq_list(H5S_sel_iter_t *iter, size_t maxseq,
+ size_t maxbytes, size_t *nseq, size_t *nbytes, hsize_t *off, size_t *len);
+static herr_t H5S__none_iter_release(H5S_sel_iter_t *sel_iter);
+
+
+/*****************************/
+/* Library Private Variables */
+/*****************************/
+
+
+/*********************/
+/* Package Variables */
+/*********************/
/* Selection properties for "none" selections */
const H5S_select_class_t H5S_sel_none[1] = {{
H5S_SEL_NONE,
/* Methods on selection */
- H5S_none_copy,
- H5S_none_get_seq_list,
- H5S_none_release,
- H5S_none_is_valid,
- H5S_none_serial_size,
- H5S_none_serialize,
- H5S_none_deserialize,
- H5S_none_bounds,
- H5S_none_offset,
+ H5S__none_copy,
+ H5S__none_release,
+ H5S__none_is_valid,
+ H5S__none_serial_size,
+ H5S__none_serialize,
+ H5S__none_deserialize,
+ H5S__none_bounds,
+ H5S__none_offset,
H5S__none_unlim_dim,
NULL,
- H5S_none_is_contiguous,
- H5S_none_is_single,
- H5S_none_is_regular,
- H5S_none_adjust_u,
- H5S_none_project_scalar,
- H5S_none_project_simple,
- H5S_none_iter_init,
+ H5S__none_is_contiguous,
+ H5S__none_is_single,
+ H5S__none_is_regular,
+ H5S__none_shape_same,
+ H5S__none_adjust_u,
+ H5S__none_project_scalar,
+ H5S__none_project_simple,
+ H5S__none_iter_init,
}};
+
+/*******************/
+/* Local Variables */
+/*******************/
+
/* Iteration properties for "none" selections */
static const H5S_sel_iter_class_t H5S_sel_iter_none[1] = {{
H5S_SEL_NONE,
/* Methods on selection iterator */
- H5S_none_iter_coords,
- H5S_none_iter_block,
- H5S_none_iter_nelmts,
- H5S_none_iter_has_next_block,
- H5S_none_iter_next,
- H5S_none_iter_next_block,
- H5S_none_iter_release,
+ H5S__none_iter_coords,
+ H5S__none_iter_block,
+ H5S__none_iter_nelmts,
+ H5S__none_iter_has_next_block,
+ H5S__none_iter_next,
+ H5S__none_iter_next_block,
+ H5S__none_iter_get_seq_list,
+ H5S__none_iter_release,
}};
+
/*-------------------------------------------------------------------------
- * Function: H5S_none_iter_init
+ * Function: H5S__none_iter_init
*
* Purpose: Initializes iteration information for "none" selection.
*
- * Return: non-negative on success, negative on failure.
+ * Return: Non-negative on success, negative on failure.
*
* Programmer: Quincey Koziol
* Tuesday, June 16, 1998
*
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
static herr_t
-H5S_none_iter_init(H5S_sel_iter_t *iter, const H5S_t H5_ATTR_UNUSED *space)
+H5S__none_iter_init(const H5S_t H5_ATTR_UNUSED *space, H5S_sel_iter_t *iter)
{
- FUNC_ENTER_NOAPI_NOINIT_NOERR
+ FUNC_ENTER_STATIC_NOERR
/* Check args */
- HDassert(space && H5S_SEL_NONE==H5S_GET_SELECT_TYPE(space));
+ HDassert(space && H5S_SEL_NONE == H5S_GET_SELECT_TYPE(space));
HDassert(iter);
/* Initialize type of selection iterator */
iter->type = H5S_sel_iter_none;
FUNC_LEAVE_NOAPI(SUCCEED)
-} /* H5S_none_iter_init() */
+} /* end H5S__none_iter_init() */
/*-------------------------------------------------------------------------
- * Function: H5S_none_iter_coords
+ * Function: H5S__none_iter_coords
*
* Purpose: Retrieve the current coordinates of iterator for current
* selection
*
- * Return: non-negative on success, negative on failure
+ * Return: Non-negative on success, negative on failure
*
* Programmer: Quincey Koziol
* Tuesday, April 22, 2003
*
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
static herr_t
-H5S_none_iter_coords(const H5S_sel_iter_t H5_ATTR_UNUSED *iter, hsize_t H5_ATTR_UNUSED *coords)
+H5S__none_iter_coords(const H5S_sel_iter_t H5_ATTR_UNUSED *iter,
+ hsize_t H5_ATTR_UNUSED *coords)
{
- FUNC_ENTER_NOAPI_NOINIT_NOERR
+ FUNC_ENTER_STATIC_NOERR
/* Check args */
HDassert(iter);
HDassert(coords);
FUNC_LEAVE_NOAPI(FAIL)
-} /* H5S_none_iter_coords() */
+} /* end H5S__none_iter_coords() */
/*-------------------------------------------------------------------------
- * Function: H5S_none_iter_block
+ * Function: H5S__none_iter_block
*
* Purpose: Retrieve the current block of iterator for current
* selection
*
- * Return: non-negative on success, negative on failure
+ * Return: Non-negative on success, negative on failure
*
* Programmer: Quincey Koziol
* Monday, June 2, 2003
*
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
static herr_t
-H5S_none_iter_block(const H5S_sel_iter_t H5_ATTR_UNUSED *iter, hsize_t H5_ATTR_UNUSED *start, hsize_t H5_ATTR_UNUSED *end)
+H5S__none_iter_block(const H5S_sel_iter_t H5_ATTR_UNUSED *iter,
+ hsize_t H5_ATTR_UNUSED *start, hsize_t H5_ATTR_UNUSED *end)
{
- FUNC_ENTER_NOAPI_NOINIT_NOERR
+ FUNC_ENTER_STATIC_NOERR
/* Check args */
HDassert(iter);
@@ -185,42 +216,40 @@ H5S_none_iter_block(const H5S_sel_iter_t H5_ATTR_UNUSED *iter, hsize_t H5_ATTR_U
HDassert(end);
FUNC_LEAVE_NOAPI(FAIL)
-} /* H5S_none_iter_block() */
+} /* end H5S__none_iter_block() */
/*-------------------------------------------------------------------------
- * Function: H5S_none_iter_nelmts
+ * Function: H5S__none_iter_nelmts
*
* Purpose: Return number of elements left to process in iterator
*
- * Return: non-negative number of elements on success, zero on failure
+ * Return: Non-negative number of elements on success, zero on failure
*
* Programmer: Quincey Koziol
* Tuesday, June 16, 1998
*
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
static hsize_t
-H5S_none_iter_nelmts(const H5S_sel_iter_t H5_ATTR_UNUSED *iter)
+H5S__none_iter_nelmts(const H5S_sel_iter_t H5_ATTR_UNUSED *iter)
{
- FUNC_ENTER_NOAPI_NOINIT_NOERR
+ FUNC_ENTER_STATIC_NOERR
/* Check args */
HDassert(iter);
FUNC_LEAVE_NOAPI(0)
-} /* H5S_none_iter_nelmts() */
+} /* end H5S__none_iter_nelmts() */
/*--------------------------------------------------------------------------
NAME
- H5S_none_iter_has_next_block
+ H5S__none_iter_has_next_block
PURPOSE
Check if there is another block left in the current iterator
USAGE
- htri_t H5S_none_iter_has_next_block(iter)
+ htri_t H5S__none_iter_has_next_block(iter)
const H5S_sel_iter_t *iter; IN: Pointer to selection iterator
RETURNS
Non-negative (TRUE/FALSE) on success/Negative on failure
@@ -232,24 +261,24 @@ H5S_none_iter_nelmts(const H5S_sel_iter_t H5_ATTR_UNUSED *iter)
REVISION LOG
--------------------------------------------------------------------------*/
static htri_t
-H5S_none_iter_has_next_block(const H5S_sel_iter_t H5_ATTR_UNUSED *iter)
+H5S__none_iter_has_next_block(const H5S_sel_iter_t H5_ATTR_UNUSED *iter)
{
- FUNC_ENTER_NOAPI_NOINIT_NOERR
+ FUNC_ENTER_STATIC_NOERR
/* Check args */
HDassert(iter);
FUNC_LEAVE_NOAPI(FAIL)
-} /* H5S_none_iter_has_next_block() */
+} /* end H5S__none_iter_has_next_block() */
/*--------------------------------------------------------------------------
NAME
- H5S_none_iter_next
+ H5S__none_iter_next
PURPOSE
Increment selection iterator
USAGE
- herr_t H5S_none_iter_next(iter, nelem)
+ herr_t H5S__none_iter_next(iter, nelem)
H5S_sel_iter_t *iter; IN: Pointer to selection iterator
size_t nelem; IN: Number of elements to advance by
RETURNS
@@ -262,25 +291,25 @@ H5S_none_iter_has_next_block(const H5S_sel_iter_t H5_ATTR_UNUSED *iter)
REVISION LOG
--------------------------------------------------------------------------*/
static herr_t
-H5S_none_iter_next(H5S_sel_iter_t H5_ATTR_UNUSED *iter, size_t H5_ATTR_UNUSED nelem)
+H5S__none_iter_next(H5S_sel_iter_t H5_ATTR_UNUSED *iter, size_t H5_ATTR_UNUSED nelem)
{
- FUNC_ENTER_NOAPI_NOINIT_NOERR
+ FUNC_ENTER_STATIC_NOERR
/* Check args */
HDassert(iter);
- HDassert(nelem>0);
+ HDassert(nelem > 0);
FUNC_LEAVE_NOAPI(SUCCEED)
-} /* H5S_none_iter_next() */
+} /* end H5S__none_iter_next() */
/*--------------------------------------------------------------------------
NAME
- H5S_none_iter_next_block
+ H5S__none_iter_next_block
PURPOSE
Increment selection iterator to next block
USAGE
- herr_t H5S_none_iter_next(iter)
+ herr_t H5S__none_iter_next(iter)
H5S_sel_iter_t *iter; IN: Pointer to selection iterator
RETURNS
Non-negative on success/Negative on failure
@@ -292,24 +321,79 @@ H5S_none_iter_next(H5S_sel_iter_t H5_ATTR_UNUSED *iter, size_t H5_ATTR_UNUSED ne
REVISION LOG
--------------------------------------------------------------------------*/
static herr_t
-H5S_none_iter_next_block(H5S_sel_iter_t H5_ATTR_UNUSED *iter)
+H5S__none_iter_next_block(H5S_sel_iter_t H5_ATTR_UNUSED *iter)
{
- FUNC_ENTER_NOAPI_NOINIT_NOERR
+ FUNC_ENTER_STATIC_NOERR
/* Check args */
HDassert(iter);
FUNC_LEAVE_NOAPI(FAIL)
-} /* H5S_none_iter_next_block() */
+} /* end H5S__none_iter_next_block() */
+
+
+/*--------------------------------------------------------------------------
+ NAME
+ H5S__none_iter_get_seq_list
+ PURPOSE
+ Create a list of offsets & lengths for a selection
+ USAGE
+ herr_t H5S__none_iter_get_seq_list(iter,maxseq,maxelem,nseq,nelem,off,len)
+ H5S_sel_iter_t *iter; IN/OUT: Selection iterator describing last
+ position of interest in selection.
+ size_t maxseq; IN: Maximum number of sequences to generate
+ size_t maxelem; IN: Maximum number of elements to include in the
+ generated sequences
+ size_t *nseq; OUT: Actual number of sequences generated
+ size_t *nelem; OUT: Actual number of elements in sequences generated
+ hsize_t *off; OUT: Array of offsets
+ size_t *len; OUT: Array of lengths
+ RETURNS
+ Non-negative on success/Negative on failure.
+ DESCRIPTION
+ Use the selection in the dataspace to generate a list of byte offsets and
+ lengths for the region(s) selected. Start/Restart from the position in the
+ ITER parameter. The number of sequences generated is limited by the MAXSEQ
+ parameter and the number of sequences actually generated is stored in the
+ NSEQ parameter.
+ GLOBAL VARIABLES
+ COMMENTS, BUGS, ASSUMPTIONS
+ EXAMPLES
+ REVISION LOG
+--------------------------------------------------------------------------*/
+static herr_t
+H5S__none_iter_get_seq_list(H5S_sel_iter_t H5_ATTR_UNUSED *iter,
+ size_t H5_ATTR_UNUSED maxseq, size_t H5_ATTR_UNUSED maxelem, size_t *nseq,
+ size_t *nelem, hsize_t H5_ATTR_UNUSED *off, size_t H5_ATTR_UNUSED *len)
+{
+ FUNC_ENTER_STATIC_NOERR
+
+ /* Check args */
+ HDassert(iter);
+ HDassert(maxseq > 0);
+ HDassert(maxelem > 0);
+ HDassert(nseq);
+ HDassert(nelem);
+ HDassert(off);
+ HDassert(len);
+
+ /* "none" selections don't generate sequences of bytes */
+ *nseq = 0;
+
+ /* They don't use any elements, either */
+ *nelem = 0;
+
+ FUNC_LEAVE_NOAPI(SUCCEED)
+} /* end H5S__none_iter_get_seq_list() */
/*--------------------------------------------------------------------------
NAME
- H5S_none_iter_release
+ H5S__none_iter_release
PURPOSE
Release "none" selection iterator information for a dataspace
USAGE
- herr_t H5S_none_iter_release(iter)
+ herr_t H5S__none_iter_release(iter)
H5S_sel_iter_t *iter; IN: Pointer to selection iterator
RETURNS
Non-negative on success/Negative on failure
@@ -321,24 +405,24 @@ H5S_none_iter_next_block(H5S_sel_iter_t H5_ATTR_UNUSED *iter)
REVISION LOG
--------------------------------------------------------------------------*/
static herr_t
-H5S_none_iter_release(H5S_sel_iter_t H5_ATTR_UNUSED * iter)
+H5S__none_iter_release(H5S_sel_iter_t H5_ATTR_UNUSED *iter)
{
- FUNC_ENTER_NOAPI_NOINIT_NOERR
+ FUNC_ENTER_STATIC_NOERR
/* Check args */
HDassert(iter);
FUNC_LEAVE_NOAPI(SUCCEED)
-} /* H5S_none_iter_release() */
+} /* end H5S__none_iter_release() */
/*--------------------------------------------------------------------------
NAME
- H5S_none_release
+ H5S__none_release
PURPOSE
Release none selection information for a dataspace
USAGE
- herr_t H5S_none_release(space)
+ herr_t H5S__none_release(space)
H5S_t *space; IN: Pointer to dataspace
RETURNS
Non-negative on success/Negative on failure
@@ -350,26 +434,27 @@ H5S_none_iter_release(H5S_sel_iter_t H5_ATTR_UNUSED * iter)
REVISION LOG
--------------------------------------------------------------------------*/
static herr_t
-H5S_none_release(H5S_t H5_ATTR_UNUSED * space)
+H5S__none_release(H5S_t H5_ATTR_UNUSED *space)
{
- FUNC_ENTER_NOAPI_NOINIT_NOERR
+ FUNC_ENTER_STATIC_NOERR
/* Check args */
HDassert(space);
FUNC_LEAVE_NOAPI(SUCCEED)
-} /* H5S_none_release() */
+} /* end H5S__none_release() */
/*--------------------------------------------------------------------------
NAME
- H5S_none_copy
+ H5S__none_copy
PURPOSE
Copy a selection from one dataspace to another
USAGE
- herr_t H5S_none_copy(dst, src)
+ herr_t H5S__none_copy(dst, src, share_selection)
H5S_t *dst; OUT: Pointer to the destination dataspace
H5S_t *src; IN: Pointer to the source dataspace
+ hbool_t; IN: Whether to share the selection between the dataspaces
RETURNS
Non-negative on success/Negative on failure
DESCRIPTION
@@ -381,9 +466,10 @@ H5S_none_release(H5S_t H5_ATTR_UNUSED * space)
REVISION LOG
--------------------------------------------------------------------------*/
static herr_t
-H5S_none_copy(H5S_t *dst, const H5S_t H5_ATTR_UNUSED *src, hbool_t H5_ATTR_UNUSED share_selection)
+H5S__none_copy(H5S_t *dst, const H5S_t H5_ATTR_UNUSED *src,
+ hbool_t H5_ATTR_UNUSED share_selection)
{
- FUNC_ENTER_NOAPI_NOINIT_NOERR
+ FUNC_ENTER_STATIC_NOERR
HDassert(src);
HDassert(dst);
@@ -392,17 +478,17 @@ H5S_none_copy(H5S_t *dst, const H5S_t H5_ATTR_UNUSED *src, hbool_t H5_ATTR_UNUSE
dst->select.num_elem = 0;
FUNC_LEAVE_NOAPI(SUCCEED)
-} /* end H5S_none_copy() */
+} /* end H5S__none_copy() */
/*--------------------------------------------------------------------------
NAME
- H5S_none_is_valid
+ H5S__none_is_valid
PURPOSE
Check whether the selection fits within the extent, with the current
offset defined.
USAGE
- htri_t H5S_none_is_valid(space);
+ htri_t H5S__none_is_valid(space);
H5S_t *space; IN: Dataspace pointer to query
RETURNS
TRUE if the selection fits within the extent, FALSE if it does not and
@@ -416,24 +502,24 @@ H5S_none_copy(H5S_t *dst, const H5S_t H5_ATTR_UNUSED *src, hbool_t H5_ATTR_UNUSE
REVISION LOG
--------------------------------------------------------------------------*/
static htri_t
-H5S_none_is_valid(const H5S_t H5_ATTR_UNUSED *space)
+H5S__none_is_valid(const H5S_t H5_ATTR_UNUSED *space)
{
- FUNC_ENTER_NOAPI_NOINIT_NOERR
+ FUNC_ENTER_STATIC_NOERR
HDassert(space);
FUNC_LEAVE_NOAPI(TRUE)
-} /* end H5S_none_is_valid() */
+} /* end H5S__none_is_valid() */
/*--------------------------------------------------------------------------
NAME
- H5S_none_serial_size
+ H5S__none_serial_size
PURPOSE
Determine the number of bytes needed to store the serialized "none"
selection information.
USAGE
- hssize_t H5S_none_serial_size(space)
+ hssize_t H5S__none_serial_size(space)
H5S_t *space; IN: Dataspace pointer to query
RETURNS
The number of bytes required on success, negative on an error.
@@ -446,9 +532,9 @@ H5S_none_is_valid(const H5S_t H5_ATTR_UNUSED *space)
REVISION LOG
--------------------------------------------------------------------------*/
static hssize_t
-H5S_none_serial_size(const H5S_t H5_ATTR_UNUSED *space)
+H5S__none_serial_size(const H5S_t H5_ATTR_UNUSED *space)
{
- FUNC_ENTER_NOAPI_NOINIT_NOERR
+ FUNC_ENTER_STATIC_NOERR
HDassert(space);
@@ -457,16 +543,16 @@ H5S_none_serial_size(const H5S_t H5_ATTR_UNUSED *space)
* <length (4 bytes)> = 16 bytes
*/
FUNC_LEAVE_NOAPI(16)
-} /* end H5S_none_serial_size() */
+} /* end H5S__none_serial_size() */
/*--------------------------------------------------------------------------
NAME
- H5S_none_serialize
+ H5S__none_serialize
PURPOSE
Serialize the current selection into a user-provided buffer.
USAGE
- herr_t H5S_none_serialize(space, p)
+ herr_t H5S__none_serialize(space, p)
const H5S_t *space; IN: Dataspace with selection to serialize
uint8_t **p; OUT: Pointer to buffer to put serialized
selection. Will be advanced to end of
@@ -482,11 +568,11 @@ H5S_none_serial_size(const H5S_t H5_ATTR_UNUSED *space)
REVISION LOG
--------------------------------------------------------------------------*/
static herr_t
-H5S_none_serialize(const H5S_t *space, uint8_t **p)
+H5S__none_serialize(const H5S_t *space, uint8_t **p)
{
uint8_t *pp = (*p); /* Local pointer for decoding */
- FUNC_ENTER_NOAPI_NOINIT_NOERR
+ FUNC_ENTER_STATIC_NOERR
/* Check args */
HDassert(space);
@@ -495,7 +581,7 @@ H5S_none_serialize(const H5S_t *space, uint8_t **p)
/* Store the preamble information */
UINT32ENCODE(pp, (uint32_t)H5S_GET_SELECT_TYPE(space)); /* Store the type of selection */
- UINT32ENCODE(pp, (uint32_t)1); /* Store the version number */
+ UINT32ENCODE(pp, (uint32_t)H5S_NONE_VERSION_1); /* Store the version number */
UINT32ENCODE(pp, (uint32_t)0); /* Store the un-used padding */
UINT32ENCODE(pp, (uint32_t)0); /* Store the additional information length */
@@ -503,20 +589,18 @@ H5S_none_serialize(const H5S_t *space, uint8_t **p)
*p = pp;
FUNC_LEAVE_NOAPI(SUCCEED)
-} /* H5S_none_serialize() */
+} /* end H5S__none_serialize() */
/*--------------------------------------------------------------------------
NAME
- H5S_none_deserialize
+ H5S__none_deserialize
PURPOSE
Deserialize the current selection from a user-provided buffer.
USAGE
- herr_t H5S_none_deserialize(space, version, flags, p)
- H5S_t *space; IN/OUT: Dataspace pointer to place
+ herr_t H5S__none_deserialize(space, version, flags, p)
+ H5S_t **space; IN/OUT: Dataspace pointer to place
selection into
- uint32_t version IN: Selection version
- uint8_t flags IN: Selection flags
uint8 **p; OUT: Pointer to buffer holding serialized
selection. Will be advanced to end of
serialized selection.
@@ -531,33 +615,61 @@ H5S_none_serialize(const H5S_t *space, uint8_t **p)
REVISION LOG
--------------------------------------------------------------------------*/
static herr_t
-H5S_none_deserialize(H5S_t *space, uint32_t H5_ATTR_UNUSED version, uint8_t H5_ATTR_UNUSED flags,
- const uint8_t H5_ATTR_UNUSED **p)
+H5S__none_deserialize(H5S_t **space, const uint8_t **p)
{
- herr_t ret_value = SUCCEED; /* return value */
+ H5S_t *tmp_space = NULL; /* Pointer to actual dataspace to use,
+ either *space or a newly allocated one */
+ uint32_t version; /* Version number */
+ herr_t ret_value = SUCCEED; /* return value */
- FUNC_ENTER_NOAPI_NOINIT
+ FUNC_ENTER_STATIC
- HDassert(space);
HDassert(p);
HDassert(*p);
+ /* As part of the efforts to push all selection-type specific coding
+ to the callbacks, the coding for the allocation of a null dataspace
+ is moved from H5S_select_deserialize() in H5Sselect.c to here.
+ This is needed for decoding virtual layout in H5O__layout_decode() */
+ /* Allocate space if not provided */
+ if(!*space) {
+ if(NULL == (tmp_space = H5S_create(H5S_SIMPLE)))
+ HGOTO_ERROR(H5E_DATASPACE, H5E_CANTCREATE, FAIL, "can't create dataspace")
+ } /* end if */
+ else
+ tmp_space = *space;
+
+ /* Decode version */
+ UINT32DECODE(*p, version);
+
+ /* Skip over the remainder of the header */
+ *p += 8;
+
/* Change to "none" selection */
- if(H5S_select_none(space) < 0)
+ if(H5S_select_none(tmp_space) < 0)
HGOTO_ERROR(H5E_DATASPACE, H5E_CANTDELETE, FAIL, "can't change selection")
+ /* Return space to the caller if allocated */
+ if(!*space)
+ *space = tmp_space;
+
done:
+ /* Free temporary space if not passed to caller (only happens on error) */
+ if(!*space && tmp_space)
+ if(H5S_close(tmp_space) < 0)
+ HDONE_ERROR(H5E_DATASPACE, H5E_CANTFREE, FAIL, "can't close dataspace")
+
FUNC_LEAVE_NOAPI(ret_value)
-} /* H5S_none_deserialize() */
+} /* end H5S__none_deserialize() */
/*--------------------------------------------------------------------------
NAME
- H5S_none_bounds
+ H5S__none_bounds
PURPOSE
Gets the bounding box containing the selection.
USAGE
- herr_t H5S_none_bounds(space, start, end)
+ herr_t H5S__none_bounds(space, start, end)
H5S_t *space; IN: Dataspace pointer of selection to query
hsize_t *start; OUT: Starting coordinate of bounding box
hsize_t *end; OUT: Opposite coordinate of bounding box
@@ -577,25 +689,26 @@ done:
REVISION LOG
--------------------------------------------------------------------------*/
static herr_t
-H5S_none_bounds(const H5S_t H5_ATTR_UNUSED *space, hsize_t H5_ATTR_UNUSED *start, hsize_t H5_ATTR_UNUSED *end)
+H5S__none_bounds(const H5S_t H5_ATTR_UNUSED *space, hsize_t H5_ATTR_UNUSED *start,
+ hsize_t H5_ATTR_UNUSED *end)
{
- FUNC_ENTER_NOAPI_NOINIT_NOERR
+ FUNC_ENTER_STATIC_NOERR
HDassert(space);
HDassert(start);
HDassert(end);
FUNC_LEAVE_NOAPI(FAIL)
-} /* H5Sget_none_bounds() */
+} /* end H5Sget_none_bounds() */
/*--------------------------------------------------------------------------
NAME
- H5S_none_offset
+ H5S__none_offset
PURPOSE
Gets the linear offset of the first element for the selection.
USAGE
- herr_t H5S_none_offset(space, offset)
+ herr_t H5S__none_offset(space, offset)
const H5S_t *space; IN: Dataspace pointer of selection to query
hsize_t *offset; OUT: Linear offset of first element in selection
RETURNS
@@ -610,15 +723,15 @@ H5S_none_bounds(const H5S_t H5_ATTR_UNUSED *space, hsize_t H5_ATTR_UNUSED *start
REVISION LOG
--------------------------------------------------------------------------*/
static herr_t
-H5S_none_offset(const H5S_t H5_ATTR_UNUSED *space, hsize_t H5_ATTR_UNUSED *offset)
+H5S__none_offset(const H5S_t H5_ATTR_UNUSED *space, hsize_t H5_ATTR_UNUSED *offset)
{
- FUNC_ENTER_NOAPI_NOINIT_NOERR
+ FUNC_ENTER_STATIC_NOERR
HDassert(space);
HDassert(offset);
FUNC_LEAVE_NOAPI(FAIL)
-} /* H5S_none_offset() */
+} /* end H5S__none_offset() */
/*--------------------------------------------------------------------------
@@ -651,11 +764,11 @@ H5S__none_unlim_dim(const H5S_t H5_ATTR_UNUSED *space)
/*--------------------------------------------------------------------------
NAME
- H5S_none_is_contiguous
+ H5S__none_is_contiguous
PURPOSE
Check if a "none" selection is contiguous within the dataspace extent.
USAGE
- htri_t H5S_none_is_contiguous(space)
+ htri_t H5S__none_is_contiguous(space)
H5S_t *space; IN: Dataspace pointer to check
RETURNS
TRUE/FALSE/FAIL
@@ -668,23 +781,23 @@ H5S__none_unlim_dim(const H5S_t H5_ATTR_UNUSED *space)
REVISION LOG
--------------------------------------------------------------------------*/
static htri_t
-H5S_none_is_contiguous(const H5S_t H5_ATTR_UNUSED *space)
+H5S__none_is_contiguous(const H5S_t H5_ATTR_UNUSED *space)
{
- FUNC_ENTER_NOAPI_NOINIT_NOERR
+ FUNC_ENTER_STATIC_NOERR
HDassert(space);
FUNC_LEAVE_NOAPI(FALSE)
-} /* H5S_none_is_contiguous() */
+} /* end H5S__none_is_contiguous() */
/*--------------------------------------------------------------------------
NAME
- H5S_none_is_single
+ H5S__none_is_single
PURPOSE
Check if a "none" selection is a single block within the dataspace extent.
USAGE
- htri_t H5S_none_is_single(space)
+ htri_t H5S__none_is_single(space)
H5S_t *space; IN: Dataspace pointer to check
RETURNS
TRUE/FALSE/FAIL
@@ -697,23 +810,23 @@ H5S_none_is_contiguous(const H5S_t H5_ATTR_UNUSED *space)
REVISION LOG
--------------------------------------------------------------------------*/
static htri_t
-H5S_none_is_single(const H5S_t H5_ATTR_UNUSED *space)
+H5S__none_is_single(const H5S_t H5_ATTR_UNUSED *space)
{
- FUNC_ENTER_NOAPI_NOINIT_NOERR
+ FUNC_ENTER_STATIC_NOERR
HDassert(space);
FUNC_LEAVE_NOAPI(FALSE)
-} /* H5S_none_is_single() */
+} /* end H5S__none_is_single() */
/*--------------------------------------------------------------------------
NAME
- H5S_none_is_regular
+ H5S__none_is_regular
PURPOSE
Check if a "none" selection is "regular"
USAGE
- htri_t H5S_none_is_regular(space)
+ htri_t H5S__none_is_regular(space)
const H5S_t *space; IN: Dataspace pointer to check
RETURNS
TRUE/FALSE/FAIL
@@ -727,24 +840,57 @@ H5S_none_is_single(const H5S_t H5_ATTR_UNUSED *space)
REVISION LOG
--------------------------------------------------------------------------*/
static htri_t
-H5S_none_is_regular(const H5S_t H5_ATTR_UNUSED *space)
+H5S__none_is_regular(const H5S_t H5_ATTR_UNUSED *space)
{
- FUNC_ENTER_NOAPI_NOINIT_NOERR
+ FUNC_ENTER_STATIC_NOERR
/* Check args */
HDassert(space);
FUNC_LEAVE_NOAPI(TRUE)
-} /* H5S_none_is_regular() */
+} /* end H5S__none_is_regular() */
/*--------------------------------------------------------------------------
NAME
- H5S_none_adjust_u
+ H5S__none_shape_same
+ PURPOSE
+ Check if a two "none" selections are the same shape
+ USAGE
+ htri_t H5S__none_shape_same(space1, space2)
+ const H5S_t *space1; IN: First dataspace to check
+ const H5S_t *space2; IN: Second dataspace to check
+ RETURNS
+ TRUE / FALSE / FAIL
+ DESCRIPTION
+ Checks to see if the current selection in each dataspace are the same
+ shape.
+ GLOBAL VARIABLES
+ COMMENTS, BUGS, ASSUMPTIONS
+ EXAMPLES
+ REVISION LOG
+--------------------------------------------------------------------------*/
+static htri_t
+H5S__none_shape_same(const H5S_t H5_ATTR_UNUSED *space1,
+ const H5S_t H5_ATTR_UNUSED *space2)
+{
+ FUNC_ENTER_STATIC_NOERR
+
+ /* Check args */
+ HDassert(space1);
+ HDassert(space2);
+
+ FUNC_LEAVE_NOAPI(TRUE)
+} /* end H5S__none_shape_same() */
+
+
+/*--------------------------------------------------------------------------
+ NAME
+ H5S__none_adjust_u
PURPOSE
Adjust an "none" selection by subtracting an offset
USAGE
- herr_t H5S_none_adjust_u(space, offset)
+ herr_t H5S__none_adjust_u(space, offset)
H5S_t *space; IN/OUT: Pointer to dataspace to adjust
const hsize_t *offset; IN: Offset to subtract
RETURNS
@@ -757,24 +903,24 @@ H5S_none_is_regular(const H5S_t H5_ATTR_UNUSED *space)
REVISION LOG
--------------------------------------------------------------------------*/
static herr_t
-H5S_none_adjust_u(H5S_t H5_ATTR_UNUSED *space, const hsize_t H5_ATTR_UNUSED *offset)
+H5S__none_adjust_u(H5S_t H5_ATTR_UNUSED *space, const hsize_t H5_ATTR_UNUSED *offset)
{
- FUNC_ENTER_NOAPI_NOINIT_NOERR
+ FUNC_ENTER_STATIC_NOERR
/* Check args */
HDassert(space);
HDassert(offset);
FUNC_LEAVE_NOAPI(SUCCEED)
-} /* H5S_none_adjust_u() */
+} /* end H5S__none_adjust_u() */
/*-------------------------------------------------------------------------
- * Function: H5S_none_project_scalar
+ * Function: H5S__none_project_scalar
*
* Purpose: Projects a 'none' selection into a scalar dataspace
*
- * Return: non-negative on success, negative on failure.
+ * Return: Non-negative on success, negative on failure.
*
* Programmer: Quincey Koziol
* Sunday, July 18, 2010
@@ -782,25 +928,25 @@ H5S_none_adjust_u(H5S_t H5_ATTR_UNUSED *space, const hsize_t H5_ATTR_UNUSED *off
*-------------------------------------------------------------------------
*/
static herr_t
-H5S_none_project_scalar(const H5S_t H5_ATTR_UNUSED *space, hsize_t H5_ATTR_UNUSED *offset)
+H5S__none_project_scalar(const H5S_t H5_ATTR_UNUSED *space, hsize_t H5_ATTR_UNUSED *offset)
{
- FUNC_ENTER_NOAPI_NOINIT_NOERR
+ FUNC_ENTER_STATIC_NOERR
/* Check args */
HDassert(space && H5S_SEL_NONE == H5S_GET_SELECT_TYPE(space));
HDassert(offset);
FUNC_LEAVE_NOAPI(FAIL)
-} /* H5S_none_project_scalar() */
+} /* end H5S__none_project_scalar() */
/*-------------------------------------------------------------------------
- * Function: H5S_none_project_simple
+ * Function: H5S__none_project_simple
*
* Purpose: Projects an 'none' selection onto/into a simple dataspace
* of a different rank
*
- * Return: non-negative on success, negative on failure.
+ * Return: Non-negative on success, negative on failure.
*
* Programmer: Quincey Koziol
* Sunday, July 18, 2010
@@ -808,11 +954,12 @@ H5S_none_project_scalar(const H5S_t H5_ATTR_UNUSED *space, hsize_t H5_ATTR_UNUSE
*-------------------------------------------------------------------------
*/
static herr_t
-H5S_none_project_simple(const H5S_t *base_space, H5S_t *new_space, hsize_t *offset)
+H5S__none_project_simple(const H5S_t H5_ATTR_UNUSED *base_space,
+ H5S_t *new_space, hsize_t H5_ATTR_UNUSED *offset)
{
herr_t ret_value = SUCCEED; /* Return value */
- FUNC_ENTER_NOAPI_NOINIT
+ FUNC_ENTER_STATIC
/* Check args */
HDassert(base_space && H5S_SEL_NONE == H5S_GET_SELECT_TYPE(base_space));
@@ -825,7 +972,7 @@ H5S_none_project_simple(const H5S_t *base_space, H5S_t *new_space, hsize_t *offs
done:
FUNC_LEAVE_NOAPI(ret_value)
-} /* H5S_none_project_simple() */
+} /* end H5S__none_project_simple() */
/*--------------------------------------------------------------------------
@@ -867,7 +1014,7 @@ H5S_select_none(H5S_t *space)
done:
FUNC_LEAVE_NOAPI(ret_value)
-} /* H5S_select_none() */
+} /* end H5S_select_none() */
/*--------------------------------------------------------------------------
@@ -906,63 +1053,5 @@ H5Sselect_none(hid_t spaceid)
done:
FUNC_LEAVE_API(ret_value)
-} /* H5Sselect_none() */
-
-
-/*--------------------------------------------------------------------------
- NAME
- H5S_none_get_seq_list
- PURPOSE
- Create a list of offsets & lengths for a selection
- USAGE
- herr_t H5S_none_get_seq_list(space,flags,iter,maxseq,maxelem,nseq,nelem,off,len)
- H5S_t *space; IN: Dataspace containing selection to use.
- unsigned flags; IN: Flags for extra information about operation
- H5S_sel_iter_t *iter; IN/OUT: Selection iterator describing last
- position of interest in selection.
- size_t maxseq; IN: Maximum number of sequences to generate
- size_t maxelem; IN: Maximum number of elements to include in the
- generated sequences
- size_t *nseq; OUT: Actual number of sequences generated
- size_t *nelem; OUT: Actual number of elements in sequences generated
- hsize_t *off; OUT: Array of offsets
- size_t *len; OUT: Array of lengths
- RETURNS
- Non-negative on success/Negative on failure.
- DESCRIPTION
- Use the selection in the dataspace to generate a list of byte offsets and
- lengths for the region(s) selected. Start/Restart from the position in the
- ITER parameter. The number of sequences generated is limited by the MAXSEQ
- parameter and the number of sequences actually generated is stored in the
- NSEQ parameter.
- GLOBAL VARIABLES
- COMMENTS, BUGS, ASSUMPTIONS
- EXAMPLES
- REVISION LOG
---------------------------------------------------------------------------*/
-static herr_t
-H5S_none_get_seq_list(const H5S_t H5_ATTR_UNUSED *space, unsigned H5_ATTR_UNUSED flags, H5S_sel_iter_t H5_ATTR_UNUSED *iter,
- size_t H5_ATTR_UNUSED maxseq, size_t H5_ATTR_UNUSED maxelem, size_t *nseq, size_t *nelem,
- hsize_t H5_ATTR_UNUSED *off, size_t H5_ATTR_UNUSED *len)
-{
- FUNC_ENTER_NOAPI_NOINIT_NOERR
-
- /* Check args */
- HDassert(space);
- HDassert(iter);
- HDassert(maxseq > 0);
- HDassert(maxelem > 0);
- HDassert(nseq);
- HDassert(nelem);
- HDassert(off);
- HDassert(len);
-
- /* "none" selections don't generate sequences of bytes */
- *nseq = 0;
-
- /* They don't use any elements, either */
- *nelem = 0;
-
- FUNC_LEAVE_NOAPI(SUCCEED)
-} /* end H5S_none_get_seq_list() */
+} /* end H5Sselect_none() */
diff --git a/src/H5Spkg.h b/src/H5Spkg.h
index 9ad97dc..4752c59 100644
--- a/src/H5Spkg.h
+++ b/src/H5Spkg.h
@@ -26,19 +26,53 @@
#ifndef _H5Spkg_H
#define _H5Spkg_H
+/* Get package's private header */
#include "H5Sprivate.h"
+/* Other private headers needed by this file */
+#include "H5Oprivate.h" /* Object headers */
+
/* Flags to indicate special dataspace features are active */
#define H5S_VALID_MAX 0x01
#define H5S_VALID_PERM 0x02
/* Flags for serialization of selections */
-#define H5S_SELECT_FLAG_UNLIM 0x01
-#define H5S_SELECT_FLAG_BITS (H5S_SELECT_FLAG_UNLIM)
+#define H5S_HYPER_REGULAR 0x01
+#define H5S_SELECT_FLAG_BITS (H5S_HYPER_REGULAR)
+
+/* Versions for H5S_SEL_HYPER selection info */
+#define H5S_HYPER_VERSION_1 1
+#define H5S_HYPER_VERSION_2 2
+#define H5S_HYPER_VERSION_3 3
+
+/* Versions for H5S_SEL_POINTS selection info */
+#define H5S_POINT_VERSION_1 1
+#define H5S_POINT_VERSION_2 2
+
+/* Versions for H5S_SEL_NONE selection info */
+#define H5S_NONE_VERSION_1 1
+
+/* Versions for H5S_SEL_ALL selection info */
+#define H5S_ALL_VERSION_1 1
+
+/* Encoded size of selection info for H5S_SEL_POINTS/H5S_SEL_HYPER */
+#define H5S_SELECT_INFO_ENC_SIZE_2 0x02 /* 2 bytes: 16 bits */
+#define H5S_SELECT_INFO_ENC_SIZE_4 0x04 /* 4 bytes: 32 bits */
+#define H5S_SELECT_INFO_ENC_SIZE_8 0x08 /* 8 bytes: 64 bits */
+#define H5S_SELECT_INFO_ENC_SIZE_BITS ( H5S_SELECT_INFO_ENC_SIZE_2 | \
+ H5S_SELECT_INFO_ENC_SIZE_4 | \
+ H5S_SELECT_INFO_ENC_SIZE_8 )
+
+#define H5S_UINT16_MAX 0x0000FFFF /* 2^16 - 1 = 65,535 */
+#define H5S_UINT32_MAX 0xFFFFFFFF /* 2^32 - 1 = 4,294,967,295 */
+#define H5S_UINT64_MAX ((hsize_t)(-1L)) /* 2^64 - 1 = 18,446,744,073,709,551,615 */
/* Length of stack-allocated sequences for "project intersect" routines */
#define H5S_PROJECT_INTERSECT_NSEQS 256
+/* Internal flags for initializing selection iterators */
+#define H5S_SEL_ITER_API_CALL 0x1000 /* Selection iterator created from API call */
+
/* Initial version of the dataspace information */
#define H5O_SDSPACE_VERSION_1 1
@@ -77,51 +111,100 @@ struct H5S_extent_t {
/*
* Dataspace selection information
*/
+
/* Node in point selection list (typedef'd in H5Sprivate.h) */
struct H5S_pnt_node_t {
- hsize_t *pnt; /* Pointer to a selected point */
- struct H5S_pnt_node_t *next; /* pointer to next point in list */
+ struct H5S_pnt_node_t *next; /* Pointer to next point in list */
+ hsize_t pnt[]; /* Selected point */
+ /* (NOTE: This uses the C99 "flexible array member" feature) */
};
-/* Information about point selection list */
-typedef struct {
+/* Information about point selection list (typedef'd in H5Sprivate.h) */
+struct H5S_pnt_list_t {
+ /* The following two fields defines the bounding box of the whole set of points, relative to the offset */
+ hsize_t low_bounds[H5S_MAX_RANK]; /* The smallest element selected in each dimension */
+ hsize_t high_bounds[H5S_MAX_RANK]; /* The largest element selected in each dimension */
+
H5S_pnt_node_t *head; /* Pointer to head of point list */
-} H5S_pnt_list_t;
+ H5S_pnt_node_t *tail; /* Pointer to tail of point list */
+};
-/* Information about new-style hyperslab spans */
+/* Information about hyperslab spans */
-/* Information a particular hyperslab span */
+/* Information a particular hyperslab span (typedef'd in H5Sprivate.h) */
struct H5S_hyper_span_t {
- hsize_t low, high; /* Low & high bounds of span */
- hsize_t nelem; /* Number of elements in span (only needed during I/O) */
- hsize_t pstride; /* Pseudo-stride from start of previous span (only used during I/O) */
- struct H5S_hyper_span_info_t *down; /* Pointer to list of spans in next dimension down */
- struct H5S_hyper_span_t *next; /* Pointer to next span in list */
+ hsize_t low, high; /* Low & high bounds of elements selected for span, inclusive */
+ struct H5S_hyper_span_info_t *down; /* Pointer to list of spans in next dimension down */
+ struct H5S_hyper_span_t *next; /* Pointer to next span in list */
};
-/* Information about a list of hyperslab spans in one dimension */
+/* Information about a list of hyperslab spans in one dimension (typedef'd in H5Sprivate.h) */
struct H5S_hyper_span_info_t {
- unsigned count; /* Ref. count of number of spans which share this span */
- struct H5S_hyper_span_info_t *scratch; /* Scratch pointer
- * (used during copies, as mark
- * during precomputes for I/O &
- * to point to the last span in a
- * list during single element adds)
- */
- struct H5S_hyper_span_t *head; /* Pointer to list of spans in next dimension down */
+ unsigned count; /* Ref. count of number of spans which share this span */
+
+ /* The following two fields define the bounding box of this set of spans
+ * and all lower dimensions, relative to the offset.
+ */
+ /* (NOTE: The bounds arrays are _relative_ to the depth of the span_info
+ * node in the span tree, so the top node in a 5-D span tree will
+ * use indices 0-4 in the arrays to store it's bounds information,
+ * but the next level down in the span tree will use indices 0-3.
+ * So, each level in the span tree will have the 0th index in the
+ * arrays correspond to the bounds in "this" dimension, even if
+ * it's not the highest level in the span tree.
+ */
+ hsize_t *low_bounds; /* The smallest element selected in each dimension */
+ hsize_t *high_bounds; /* The largest element selected in each dimension */
+
+ /* "Operation generation" fields */
+ /* (Used during copies, 'adjust', 'nelem', and 'rebuild' operations) */
+ uint64_t op_gen; /* Generation of the scratch info */
+ union {
+ struct H5S_hyper_span_info_t *copied; /* Pointer to already copied span tree */
+ hsize_t nelmts; /* # of elements */
+ hsize_t nblocks; /* # of blocks */
+#ifdef H5_HAVE_PARALLEL
+ MPI_Datatype down_type; /* MPI datatype for span tree */
+#endif /* H5_HAVE_PARALLEL */
+ }u;
+
+ struct H5S_hyper_span_t *head; /* Pointer to the first span of list of spans in the current dimension */
+ struct H5S_hyper_span_t *tail; /* Pointer to the last span of list of spans in the current dimension */
+ hsize_t bounds[]; /* Array for storing low & high bounds */
+ /* (NOTE: This uses the C99 "flexible array member" feature) */
};
-/* Information about new-style hyperslab selection */
+/* Enum for diminfo_valid field in H5S_hyper_sel_t */
+typedef enum {
+ H5S_DIMINFO_VALID_IMPOSSIBLE, /* 0: diminfo is not valid and can never be valid with the current selection */
+ H5S_DIMINFO_VALID_NO, /* 1: diminfo is not valid but may or may not be possible to constuct */
+ H5S_DIMINFO_VALID_YES /* 2: diminfo is valid */
+} H5S_diminfo_valid_t;
+
+/* Information about 'diminfo' form of hyperslab selection */
typedef struct {
- hbool_t diminfo_valid; /* Whether the dataset has valid diminfo */
- H5S_hyper_dim_t opt_diminfo[H5S_MAX_RANK]; /* per-dim selection info */
- H5S_hyper_dim_t app_diminfo[H5S_MAX_RANK]; /* per-dim selection info */
- /* 'opt_diminfo' points to a [potentially] optimized version of the user's
- * hyperslab information. 'app_diminfo' points to the actual parameters
- * that the application used for setting the hyperslab selection. These
- * are only used for re-gurgitating the original values used to set the
- * hyperslab to the application when it queries the hyperslab selection
- * information. */
+ /* 'opt' points to a [potentially] optimized version of the user's
+ * regular hyperslab information. 'app' points to the actual parameters
+ * that the application used for setting the hyperslab selection.
+ *
+ * The 'app' values are only used for regurgitating the original values
+ * used to set the hyperslab to the application when it queries the
+ * hyperslab selection information.
+ */
+ H5S_hyper_dim_t app[H5S_MAX_RANK]; /* Application-set per-dim selection info */
+ H5S_hyper_dim_t opt[H5S_MAX_RANK]; /* Optimized per-dim selection info */
+
+ /* The following two fields defines the bounding box of the diminfo selection */
+ /* (relative to the offset) */
+ hsize_t low_bounds[H5S_MAX_RANK]; /* The smallest element selected in each dimension */
+ hsize_t high_bounds[H5S_MAX_RANK]; /* The largest element selected in each dimension */
+} H5S_hyper_diminfo_t;
+
+/* Information about hyperslab selection */
+typedef struct {
+ H5S_diminfo_valid_t diminfo_valid; /* Whether the dataset has valid diminfo */
+
+ H5S_hyper_diminfo_t diminfo; /* Dimension info form of hyperslab selection */
int unlim_dim; /* Dimension where selection is unlimited, or -1 if none */
hsize_t num_elem_non_unlim; /* # of elements in a "slice" excluding the unlimited dimension */
H5S_hyper_span_info_t *span_lst; /* List of hyperslab span information of all dimensions */
@@ -130,10 +213,6 @@ typedef struct {
/* Selection information methods */
/* Method to copy a selection */
typedef herr_t (*H5S_sel_copy_func_t)(H5S_t *dst, const H5S_t *src, hbool_t share_selection);
-/* Method to retrieve a list of offset/length sequences for selection */
-typedef herr_t (*H5S_sel_get_seq_list_func_t)(const H5S_t *space, unsigned flags,
- H5S_sel_iter_t *iter, size_t maxseq, size_t maxbytes,
- size_t *nseq, size_t *nbytes, hsize_t *off, size_t *len);
/* Method to release current selection */
typedef herr_t (*H5S_sel_release_func_t)(H5S_t *space);
/* Method to determine if current selection is valid for dataspace */
@@ -143,8 +222,7 @@ typedef hssize_t (*H5S_sel_serial_size_func_t)(const H5S_t *space);
/* Method to store current selection in "serialized" form (a byte sequence suitable for storing on disk) */
typedef herr_t (*H5S_sel_serialize_func_t)(const H5S_t *space, uint8_t **p);
/* Method to create selection from "serialized" form (a byte sequence suitable for storing on disk) */
-typedef herr_t (*H5S_sel_deserialize_func_t)(H5S_t *space, uint32_t version, uint8_t flags,
- const uint8_t **p);
+typedef herr_t (*H5S_sel_deserialize_func_t)(H5S_t **space, const uint8_t **p);
/* Method to determine smallest n-D bounding box containing the current selection */
typedef herr_t (*H5S_sel_bounds_func_t)(const H5S_t *space, hsize_t *start, hsize_t *end);
/* Method to determine linear offset of initial element in selection within dataspace */
@@ -160,6 +238,8 @@ typedef htri_t (*H5S_sel_is_contiguous_func_t)(const H5S_t *space);
typedef htri_t (*H5S_sel_is_single_func_t)(const H5S_t *space);
/* Method to determine if current selection is "regular" */
typedef htri_t (*H5S_sel_is_regular_func_t)(const H5S_t *space);
+/* Method to determine if two dataspaces' selections are the same shape */
+typedef htri_t (*H5S_sel_shape_same_func_t)(const H5S_t *space1, const H5S_t *space2);
/* Method to adjust a selection by an offset */
typedef herr_t (*H5S_sel_adjust_u_func_t)(H5S_t *space, const hsize_t *offset);
/* Method to construct single element projection onto scalar dataspace */
@@ -167,7 +247,7 @@ typedef herr_t (*H5S_sel_project_scalar)(const H5S_t *space, hsize_t *offset);
/* Method to construct selection projection onto/into simple dataspace */
typedef herr_t (*H5S_sel_project_simple)(const H5S_t *space, H5S_t *new_space, hsize_t *offset);
/* Method to initialize iterator for current selection */
-typedef herr_t (*H5S_sel_iter_init_func_t)(H5S_sel_iter_t *sel_iter, const H5S_t *space);
+typedef herr_t (*H5S_sel_iter_init_func_t)(const H5S_t *space, H5S_sel_iter_t *sel_iter);
/* Selection class information */
typedef struct {
@@ -175,7 +255,6 @@ typedef struct {
/* Methods */
H5S_sel_copy_func_t copy; /* Method to make a copy of a selection */
- H5S_sel_get_seq_list_func_t get_seq_list; /* Method to retrieve a list of offset/length sequences for selection */
H5S_sel_release_func_t release; /* Method to release current selection */
H5S_sel_is_valid_func_t is_valid; /* Method to determine if current selection is valid for dataspace */
H5S_sel_serial_size_func_t serial_size; /* Method to determine number of bytes required to store current selection */
@@ -188,6 +267,7 @@ typedef struct {
H5S_sel_is_contiguous_func_t is_contiguous; /* Method to determine if current selection is contiguous */
H5S_sel_is_single_func_t is_single; /* Method to determine if current selection is a single block */
H5S_sel_is_regular_func_t is_regular; /* Method to determine if current selection is "regular" */
+ H5S_sel_shape_same_func_t shape_same; /* Method to determine if two dataspaces' selections are the same shape */
H5S_sel_adjust_u_func_t adjust_u; /* Method to adjust a selection by an offset */
H5S_sel_project_scalar project_scalar; /* Method to construct scalar dataspace projection */
H5S_sel_project_simple project_simple; /* Method to construct simple dataspace projection */
@@ -217,9 +297,11 @@ struct H5S_t {
/* Selection iteration methods */
/* Method to retrieve the current coordinates of iterator for current selection */
-typedef herr_t (*H5S_sel_iter_coords_func_t)(const H5S_sel_iter_t *iter, hsize_t *coords);
+typedef herr_t (*H5S_sel_iter_coords_func_t)(const H5S_sel_iter_t *iter,
+ hsize_t *coords);
/* Method to retrieve the current block of iterator for current selection */
-typedef herr_t (*H5S_sel_iter_block_func_t)(const H5S_sel_iter_t *iter, hsize_t *start, hsize_t *end);
+typedef herr_t (*H5S_sel_iter_block_func_t)(const H5S_sel_iter_t *iter,
+ hsize_t *start, hsize_t *end);
/* Method to determine number of elements left in iterator for current selection */
typedef hsize_t (*H5S_sel_iter_nelmts_func_t)(const H5S_sel_iter_t *iter);
/* Method to determine if there are more blocks left in the current selection */
@@ -228,6 +310,10 @@ typedef htri_t (*H5S_sel_iter_has_next_block_func_t)(const H5S_sel_iter_t *iter)
typedef herr_t (*H5S_sel_iter_next_func_t)(H5S_sel_iter_t *iter, size_t nelem);
/* Method to move selection iterator to the next block in the selection */
typedef herr_t (*H5S_sel_iter_next_block_func_t)(H5S_sel_iter_t *iter);
+/* Method to retrieve a list of offset/length sequences for selection iterator */
+typedef herr_t (*H5S_sel_iter_get_seq_list_func_t)(H5S_sel_iter_t *iter,
+ size_t maxseq, size_t maxbytes, size_t *nseq, size_t *nbytes, hsize_t *off,
+ size_t *len);
/* Method to release iterator for current selection */
typedef herr_t (*H5S_sel_iter_release_func_t)(H5S_sel_iter_t *iter);
@@ -242,6 +328,7 @@ typedef struct H5S_sel_iter_class_t {
H5S_sel_iter_has_next_block_func_t iter_has_next_block; /* Method to query if there is another block left in the selection */
H5S_sel_iter_next_func_t iter_next; /* Method to move selection iterator to the next element in the selection */
H5S_sel_iter_next_block_func_t iter_next_block; /* Method to move selection iterator to the next block in the selection */
+ H5S_sel_iter_get_seq_list_func_t iter_get_seq_list; /* Method to retrieve a list of offset/length sequences for selection iterator */
H5S_sel_iter_release_func_t iter_release; /* Method to release iterator for current selection */
} H5S_sel_iter_class_t;
@@ -269,19 +356,25 @@ H5_DLLVAR const H5S_select_class_t H5S_sel_point[1];
H5_DLLVAR const unsigned H5O_sdspace_ver_bounds[H5F_LIBVER_NBOUNDS];
/* Extent functions */
-H5_DLL herr_t H5S_extent_release(H5S_extent_t *extent);
-H5_DLL herr_t H5S_extent_copy_real(H5S_extent_t *dst, const H5S_extent_t *src,
+H5_DLL herr_t H5S__extent_release(H5S_extent_t *extent);
+H5_DLL herr_t H5S__extent_copy_real(H5S_extent_t *dst, const H5S_extent_t *src,
hbool_t copy_max);
-/* Operations on selections */
+/* Operations on hyperslab selections */
+H5_DLL uint64_t H5S__hyper_get_op_gen(void);
+H5_DLL void H5S__hyper_rebuild(H5S_t *space);
+H5_DLL herr_t H5S__modify_select(H5S_t *space1, H5S_seloper_t op, H5S_t *space2);
H5_DLL herr_t H5S__hyper_project_intersection(const H5S_t *src_space,
const H5S_t *dst_space, const H5S_t *src_intersect_space, H5S_t *proj_space);
-H5_DLL herr_t H5S__hyper_subtract(H5S_t *space, H5S_t *subtract_space);
/* Testing functions */
#ifdef H5S_TESTING
-H5_DLL htri_t H5S_select_shape_same_test(hid_t sid1, hid_t sid2);
-H5_DLL htri_t H5S_get_rebuild_status_test(hid_t space_id);
+H5_DLL htri_t H5S__select_shape_same_test(hid_t sid1, hid_t sid2);
+H5_DLL herr_t H5S__get_rebuild_status_test(hid_t space_id,
+ H5S_diminfo_valid_t *status1, H5S_diminfo_valid_t *status2);
+H5_DLL herr_t H5S__get_diminfo_status_test(hid_t space_id,
+ H5S_diminfo_valid_t *status);
+H5_DLL htri_t H5S__internal_consistency_test(hid_t space_id);
#endif /* H5S_TESTING */
#endif /*_H5Spkg_H*/
diff --git a/src/H5Spoint.c b/src/H5Spoint.c
index aea7d5c..875c018 100644
--- a/src/H5Spoint.c
+++ b/src/H5Spoint.c
@@ -18,182 +18,252 @@
* Purpose: Point selection dataspace I/O functions.
*/
+/****************/
+/* Module Setup */
+/****************/
+
#include "H5Smodule.h" /* This source code file is part of the H5S module */
-#include "H5private.h" /* Generic Functions */
-#include "H5Eprivate.h" /* Error handling */
-#include "H5FLprivate.h" /* Free Lists */
-#include "H5Iprivate.h" /* ID Functions */
-#include "H5MMprivate.h" /* Memory Management functions */
-#include "H5Spkg.h" /* Dataspace functions */
-#include "H5VMprivate.h" /* Vector functions */
+/***********/
+/* Headers */
+/***********/
+#include "H5private.h" /* Generic Functions */
+#include "H5CXprivate.h" /* API Contexts */
+#include "H5Eprivate.h" /* Error handling */
+#include "H5FLprivate.h" /* Free Lists */
+#include "H5Iprivate.h" /* ID Functions */
+#include "H5MMprivate.h" /* Memory management */
+#include "H5Spkg.h" /* Dataspace functions */
+#include "H5VMprivate.h" /* Vector functions */
+
+
+/****************/
+/* Local Macros */
+/****************/
+
-/* Static function prototypes */
+/******************/
+/* Local Typedefs */
+/******************/
+
+/* Define alias for hsize_t, for allocating H5S_pnt_node_t + point objects */
+/* (Makes it easier to understand the alloc / free calls) */
+typedef hsize_t hcoords_t;
+
+
+/********************/
+/* Local Prototypes */
+/********************/
+static herr_t H5S__point_add(H5S_t *space, H5S_seloper_t op, size_t num_elem,
+ const hsize_t *coord);
+static H5S_pnt_list_t *H5S__copy_pnt_list(const H5S_pnt_list_t *src,
+ unsigned rank);
+static void H5S__free_pnt_list(H5S_pnt_list_t *pnt_lst);
/* Selection callbacks */
-static herr_t H5S_point_copy(H5S_t *dst, const H5S_t *src, hbool_t share_selection);
-static herr_t H5S_point_get_seq_list(const H5S_t *space, unsigned flags,
- H5S_sel_iter_t *iter, size_t maxseq, size_t maxbytes,
- size_t *nseq, size_t *nbytes, hsize_t *off, size_t *len);
-static herr_t H5S_point_release(H5S_t *space);
-static htri_t H5S_point_is_valid(const H5S_t *space);
-static hssize_t H5S_point_serial_size(const H5S_t *space);
-static herr_t H5S_point_serialize(const H5S_t *space, uint8_t **p);
-static herr_t H5S_point_deserialize(H5S_t *space, uint32_t version, uint8_t flags,
- const uint8_t **p);
-static herr_t H5S_point_bounds(const H5S_t *space, hsize_t *start, hsize_t *end);
-static herr_t H5S_point_offset(const H5S_t *space, hsize_t *off);
+static herr_t H5S__point_copy(H5S_t *dst, const H5S_t *src, hbool_t share_selection);
+static herr_t H5S__point_release(H5S_t *space);
+static htri_t H5S__point_is_valid(const H5S_t *space);
+static hssize_t H5S__point_serial_size(const H5S_t *space);
+static herr_t H5S__point_serialize(const H5S_t *space, uint8_t **p);
+static herr_t H5S__point_deserialize(H5S_t **space, const uint8_t **p);
+static herr_t H5S__point_bounds(const H5S_t *space, hsize_t *start, hsize_t *end);
+static herr_t H5S__point_offset(const H5S_t *space, hsize_t *off);
static int H5S__point_unlim_dim(const H5S_t *space);
-static htri_t H5S_point_is_contiguous(const H5S_t *space);
-static htri_t H5S_point_is_single(const H5S_t *space);
-static htri_t H5S_point_is_regular(const H5S_t *space);
-static herr_t H5S_point_adjust_u(H5S_t *space, const hsize_t *offset);
-static herr_t H5S_point_project_scalar(const H5S_t *space, hsize_t *offset);
-static herr_t H5S_point_project_simple(const H5S_t *space, H5S_t *new_space, hsize_t *offset);
-static herr_t H5S_point_iter_init(H5S_sel_iter_t *iter, const H5S_t *space);
+static htri_t H5S__point_is_contiguous(const H5S_t *space);
+static htri_t H5S__point_is_single(const H5S_t *space);
+static htri_t H5S__point_is_regular(const H5S_t *space);
+static htri_t H5S__point_shape_same(const H5S_t *space1, const H5S_t *space2);
+static herr_t H5S__point_adjust_u(H5S_t *space, const hsize_t *offset);
+static herr_t H5S__point_project_scalar(const H5S_t *space, hsize_t *offset);
+static herr_t H5S__point_project_simple(const H5S_t *space, H5S_t *new_space,
+ hsize_t *offset);
+static herr_t H5S__point_iter_init(const H5S_t *space, H5S_sel_iter_t *iter);
+static herr_t H5S__point_get_version_enc_size(const H5S_t *space,
+ uint32_t *version, uint8_t *enc_size);
/* Selection iteration callbacks */
-static herr_t H5S_point_iter_coords(const H5S_sel_iter_t *iter, hsize_t *coords);
-static herr_t H5S_point_iter_block(const H5S_sel_iter_t *iter, hsize_t *start, hsize_t *end);
-static hsize_t H5S_point_iter_nelmts(const H5S_sel_iter_t *iter);
-static htri_t H5S_point_iter_has_next_block(const H5S_sel_iter_t *iter);
-static herr_t H5S_point_iter_next(H5S_sel_iter_t *sel_iter, size_t nelem);
-static herr_t H5S_point_iter_next_block(H5S_sel_iter_t *sel_iter);
-static herr_t H5S_point_iter_release(H5S_sel_iter_t *sel_iter);
+static herr_t H5S__point_iter_coords(const H5S_sel_iter_t *iter, hsize_t *coords);
+static herr_t H5S__point_iter_block(const H5S_sel_iter_t *iter, hsize_t *start,
+ hsize_t *end);
+static hsize_t H5S__point_iter_nelmts(const H5S_sel_iter_t *iter);
+static htri_t H5S__point_iter_has_next_block(const H5S_sel_iter_t *iter);
+static herr_t H5S__point_iter_next(H5S_sel_iter_t *sel_iter, size_t nelem);
+static herr_t H5S__point_iter_next_block(H5S_sel_iter_t *sel_iter);
+static herr_t H5S__point_iter_get_seq_list(H5S_sel_iter_t *iter, size_t maxseq,
+ size_t maxbytes, size_t *nseq, size_t *nbytes, hsize_t *off, size_t *len);
+static herr_t H5S__point_iter_release(H5S_sel_iter_t *sel_iter);
+
+
+/*****************************/
+/* Library Private Variables */
+/*****************************/
+
+
+/*********************/
+/* Package Variables */
+/*********************/
/* Selection properties for point selections */
const H5S_select_class_t H5S_sel_point[1] = {{
H5S_SEL_POINTS,
/* Methods on selection */
- H5S_point_copy,
- H5S_point_get_seq_list,
- H5S_point_release,
- H5S_point_is_valid,
- H5S_point_serial_size,
- H5S_point_serialize,
- H5S_point_deserialize,
- H5S_point_bounds,
- H5S_point_offset,
+ H5S__point_copy,
+ H5S__point_release,
+ H5S__point_is_valid,
+ H5S__point_serial_size,
+ H5S__point_serialize,
+ H5S__point_deserialize,
+ H5S__point_bounds,
+ H5S__point_offset,
H5S__point_unlim_dim,
NULL,
- H5S_point_is_contiguous,
- H5S_point_is_single,
- H5S_point_is_regular,
- H5S_point_adjust_u,
- H5S_point_project_scalar,
- H5S_point_project_simple,
- H5S_point_iter_init,
+ H5S__point_is_contiguous,
+ H5S__point_is_single,
+ H5S__point_is_regular,
+ H5S__point_shape_same,
+ H5S__point_adjust_u,
+ H5S__point_project_scalar,
+ H5S__point_project_simple,
+ H5S__point_iter_init,
}};
+/* Format version bounds for dataspace hyperslab selection */
+const unsigned H5O_sds_point_ver_bounds[] = {
+ H5S_POINT_VERSION_1, /* H5F_LIBVER_EARLIEST */
+ H5S_POINT_VERSION_1, /* H5F_LIBVER_V18 */
+ H5S_POINT_VERSION_1, /* H5F_LIBVER_V110 */
+ H5S_POINT_VERSION_2 /* H5F_LIBVER_LATEST */
+};
+
+/*******************/
+/* Local Variables */
+/*******************/
+
/* Iteration properties for point selections */
static const H5S_sel_iter_class_t H5S_sel_iter_point[1] = {{
H5S_SEL_POINTS,
/* Methods on selection iterator */
- H5S_point_iter_coords,
- H5S_point_iter_block,
- H5S_point_iter_nelmts,
- H5S_point_iter_has_next_block,
- H5S_point_iter_next,
- H5S_point_iter_next_block,
- H5S_point_iter_release,
+ H5S__point_iter_coords,
+ H5S__point_iter_block,
+ H5S__point_iter_nelmts,
+ H5S__point_iter_has_next_block,
+ H5S__point_iter_next,
+ H5S__point_iter_next_block,
+ H5S__point_iter_get_seq_list,
+ H5S__point_iter_release,
}};
-/* Declare a free list to manage the H5S_pnt_node_t struct */
-H5FL_DEFINE_STATIC(H5S_pnt_node_t);
+/* Declare a free list to manage the H5S_pnt_node_t + hcoords_t array struct */
+H5FL_BARR_DEFINE_STATIC(H5S_pnt_node_t, hcoords_t, H5S_MAX_RANK);
/* Declare a free list to manage the H5S_pnt_list_t struct */
H5FL_DEFINE_STATIC(H5S_pnt_list_t);
+
/*-------------------------------------------------------------------------
- * Function: H5S_point_iter_init
+ * Function: H5S__point_iter_init
*
* Purpose: Initializes iteration information for point selection.
*
- * Return: non-negative on success, negative on failure.
+ * Return: Non-negative on success, negative on failure.
*
* Programmer: Quincey Koziol
* Tuesday, June 16, 1998
*
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
static herr_t
-H5S_point_iter_init(H5S_sel_iter_t *iter, const H5S_t *space)
+H5S__point_iter_init(const H5S_t *space, H5S_sel_iter_t *iter)
{
- FUNC_ENTER_NOAPI_NOINIT_NOERR
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_STATIC
/* Check args */
- HDassert(space && H5S_SEL_POINTS==H5S_GET_SELECT_TYPE(space));
+ HDassert(space && H5S_SEL_POINTS == H5S_GET_SELECT_TYPE(space));
HDassert(iter);
- /* Initialize the number of points to iterate over */
- iter->elmt_left=space->select.num_elem;
+ /* If this iterator is created from an API call, by default we clone the
+ * selection now, as the dataspace could be modified or go out of scope.
+ *
+ * However, if the H5S_SEL_ITER_SHARE_WITH_DATASPACE flag is given,
+ * the selection is shared between the selection iterator and the
+ * dataspace. In this case, the application _must_not_ modify or
+ * close the dataspace that the iterator is operating on, or undefined
+ * behavior will occur.
+ */
+ if((iter->flags & H5S_SEL_ITER_API_CALL) &&
+ !(iter->flags & H5S_SEL_ITER_SHARE_WITH_DATASPACE)) {
+ /* Copy the point list */
+ if(NULL == (iter->u.pnt.pnt_lst = H5S__copy_pnt_list(space->select.sel_info.pnt_lst, space->extent.rank)))
+ HGOTO_ERROR(H5E_DATASPACE, H5E_CANTCOPY, FAIL, "can't copy point list")
+ } /* end if */
+ else
+ /* OK to share point list for internal iterations */
+ iter->u.pnt.pnt_lst = space->select.sel_info.pnt_lst;
/* Start at the head of the list of points */
- iter->u.pnt.curr=space->select.sel_info.pnt_lst->head;
+ iter->u.pnt.curr = iter->u.pnt.pnt_lst->head;
/* Initialize type of selection iterator */
- iter->type=H5S_sel_iter_point;
+ iter->type = H5S_sel_iter_point;
- FUNC_LEAVE_NOAPI(SUCCEED)
-} /* H5S_point_iter_init() */
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5S__point_iter_init() */
/*-------------------------------------------------------------------------
- * Function: H5S_point_iter_coords
+ * Function: H5S__point_iter_coords
*
* Purpose: Retrieve the current coordinates of iterator for current
* selection
*
- * Return: non-negative on success, negative on failure
+ * Return: Non-negative on success, negative on failure
*
* Programmer: Quincey Koziol
* Tuesday, April 22, 2003
*
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
static herr_t
-H5S_point_iter_coords (const H5S_sel_iter_t *iter, hsize_t *coords)
+H5S__point_iter_coords(const H5S_sel_iter_t *iter, hsize_t *coords)
{
- FUNC_ENTER_NOAPI_NOINIT_NOERR
+ FUNC_ENTER_STATIC_NOERR
/* Check args */
HDassert(iter);
HDassert(coords);
/* Copy the offset of the current point */
- HDmemcpy(coords,iter->u.pnt.curr->pnt,sizeof(hsize_t)*iter->rank);
+ H5MM_memcpy(coords, iter->u.pnt.curr->pnt, sizeof(hsize_t) * iter->rank);
FUNC_LEAVE_NOAPI(SUCCEED)
-} /* H5S_point_iter_coords() */
+} /* end H5S__point_iter_coords() */
/*-------------------------------------------------------------------------
- * Function: H5S_point_iter_block
+ * Function: H5S__point_iter_block
*
* Purpose: Retrieve the current block of iterator for current
* selection
*
- * Return: non-negative on success, negative on failure
+ * Return: Non-negative on success, negative on failure
*
* Programmer: Quincey Koziol
* Monday, June 2, 2003
*
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
static herr_t
-H5S_point_iter_block (const H5S_sel_iter_t *iter, hsize_t *start, hsize_t *end)
+H5S__point_iter_block(const H5S_sel_iter_t *iter, hsize_t *start, hsize_t *end)
{
- FUNC_ENTER_NOAPI_NOINIT_NOERR
+ FUNC_ENTER_STATIC_NOERR
/* Check args */
HDassert(iter);
@@ -201,46 +271,44 @@ H5S_point_iter_block (const H5S_sel_iter_t *iter, hsize_t *start, hsize_t *end)
HDassert(end);
/* Copy the current point as a block */
- HDmemcpy(start,iter->u.pnt.curr->pnt,sizeof(hsize_t)*iter->rank);
- HDmemcpy(end,iter->u.pnt.curr->pnt,sizeof(hsize_t)*iter->rank);
+ H5MM_memcpy(start, iter->u.pnt.curr->pnt, sizeof(hsize_t) * iter->rank);
+ H5MM_memcpy(end, iter->u.pnt.curr->pnt, sizeof(hsize_t) * iter->rank);
FUNC_LEAVE_NOAPI(SUCCEED)
-} /* H5S_point_iter_block() */
+} /* end H5S__point_iter_block() */
/*-------------------------------------------------------------------------
- * Function: H5S_point_iter_nelmts
+ * Function: H5S__point_iter_nelmts
*
* Purpose: Return number of elements left to process in iterator
*
- * Return: non-negative number of elements on success, zero on failure
+ * Return: Non-negative number of elements on success, zero on failure
*
* Programmer: Quincey Koziol
* Tuesday, June 16, 1998
*
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
static hsize_t
-H5S_point_iter_nelmts (const H5S_sel_iter_t *iter)
+H5S__point_iter_nelmts(const H5S_sel_iter_t *iter)
{
- FUNC_ENTER_NOAPI_NOINIT_NOERR
+ FUNC_ENTER_STATIC_NOERR
/* Check args */
HDassert(iter);
FUNC_LEAVE_NOAPI(iter->elmt_left)
-} /* H5S_point_iter_nelmts() */
+} /* end H5S__point_iter_nelmts() */
/*--------------------------------------------------------------------------
NAME
- H5S_point_iter_has_next_block
+ H5S__point_iter_has_next_block
PURPOSE
Check if there is another block left in the current iterator
USAGE
- htri_t H5S_point_iter_has_next_block(iter)
+ htri_t H5S__point_iter_has_next_block(iter)
const H5S_sel_iter_t *iter; IN: Pointer to selection iterator
RETURNS
Non-negative (TRUE/FALSE) on success/Negative on failure
@@ -252,31 +320,31 @@ H5S_point_iter_nelmts (const H5S_sel_iter_t *iter)
REVISION LOG
--------------------------------------------------------------------------*/
static htri_t
-H5S_point_iter_has_next_block(const H5S_sel_iter_t *iter)
+H5S__point_iter_has_next_block(const H5S_sel_iter_t *iter)
{
- htri_t ret_value=TRUE; /* Return value */
+ htri_t ret_value = TRUE; /* Return value */
- FUNC_ENTER_NOAPI_NOINIT_NOERR
+ FUNC_ENTER_STATIC_NOERR
/* Check args */
HDassert(iter);
/* Check if there is another point in the list */
- if(iter->u.pnt.curr->next==NULL)
+ if(iter->u.pnt.curr->next == NULL)
HGOTO_DONE(FALSE);
done:
FUNC_LEAVE_NOAPI(ret_value)
-} /* H5S_point_iter_has_next_block() */
+} /* end H5S__point_iter_has_next_block() */
/*--------------------------------------------------------------------------
NAME
- H5S_point_iter_next
+ H5S__point_iter_next
PURPOSE
Increment selection iterator
USAGE
- herr_t H5S_point_iter_next(iter, nelem)
+ herr_t H5S__point_iter_next(iter, nelem)
H5S_sel_iter_t *iter; IN: Pointer to selection iterator
size_t nelem; IN: Number of elements to advance by
RETURNS
@@ -289,31 +357,31 @@ done:
REVISION LOG
--------------------------------------------------------------------------*/
static herr_t
-H5S_point_iter_next(H5S_sel_iter_t *iter, size_t nelem)
+H5S__point_iter_next(H5S_sel_iter_t *iter, size_t nelem)
{
- FUNC_ENTER_NOAPI_NOINIT_NOERR
+ FUNC_ENTER_STATIC_NOERR
/* Check args */
HDassert(iter);
- HDassert(nelem>0);
+ HDassert(nelem > 0);
/* Increment the iterator */
- while(nelem>0) {
- iter->u.pnt.curr=iter->u.pnt.curr->next;
+ while(nelem > 0) {
+ iter->u.pnt.curr = iter->u.pnt.curr->next;
nelem--;
} /* end while */
FUNC_LEAVE_NOAPI(SUCCEED)
-} /* H5S_point_iter_next() */
+} /* end H5S__point_iter_next() */
/*--------------------------------------------------------------------------
NAME
- H5S_point_iter_next_block
+ H5S__point_iter_next_block
PURPOSE
Increment selection iterator to next block
USAGE
- herr_t H5S_point_iter_next_block(iter)
+ herr_t H5S__point_iter_next_block(iter)
H5S_sel_iter_t *iter; IN: Pointer to selection iterator
RETURNS
Non-negative on success/Negative on failure
@@ -325,27 +393,158 @@ H5S_point_iter_next(H5S_sel_iter_t *iter, size_t nelem)
REVISION LOG
--------------------------------------------------------------------------*/
static herr_t
-H5S_point_iter_next_block(H5S_sel_iter_t *iter)
+H5S__point_iter_next_block(H5S_sel_iter_t *iter)
{
- FUNC_ENTER_NOAPI_NOINIT_NOERR
+ FUNC_ENTER_STATIC_NOERR
/* Check args */
HDassert(iter);
/* Increment the iterator */
- iter->u.pnt.curr=iter->u.pnt.curr->next;
+ iter->u.pnt.curr = iter->u.pnt.curr->next;
FUNC_LEAVE_NOAPI(SUCCEED)
-} /* H5S_point_iter_next_block() */
+} /* end H5S__point_iter_next_block() */
+
+
+/*--------------------------------------------------------------------------
+ NAME
+ H5S__point_iter_get_seq_list
+ PURPOSE
+ Create a list of offsets & lengths for a selection
+ USAGE
+ herr_t H5S__point_iter_get_seq_list(iter,maxseq,maxelem,nseq,nelem,off,len)
+ H5S_sel_iter_t *iter; IN/OUT: Selection iterator describing last
+ position of interest in selection.
+ size_t maxseq; IN: Maximum number of sequences to generate
+ size_t maxelem; IN: Maximum number of elements to include in the
+ generated sequences
+ size_t *nseq; OUT: Actual number of sequences generated
+ size_t *nelem; OUT: Actual number of elements in sequences generated
+ hsize_t *off; OUT: Array of offsets (in bytes)
+ size_t *len; OUT: Array of lengths (in bytes)
+ RETURNS
+ Non-negative on success/Negative on failure.
+ DESCRIPTION
+ Use the selection in the dataspace to generate a list of byte offsets and
+ lengths for the region(s) selected. Start/Restart from the position in the
+ ITER parameter. The number of sequences generated is limited by the MAXSEQ
+ parameter and the number of sequences actually generated is stored in the
+ NSEQ parameter.
+ GLOBAL VARIABLES
+ COMMENTS, BUGS, ASSUMPTIONS
+ EXAMPLES
+ REVISION LOG
+--------------------------------------------------------------------------*/
+static herr_t
+H5S__point_iter_get_seq_list(H5S_sel_iter_t *iter, size_t maxseq, size_t maxelem,
+ size_t *nseq, size_t *nelem, hsize_t *off, size_t *len)
+{
+ size_t io_left; /* The number of bytes left in the selection */
+ size_t start_io_left; /* The initial number of bytes left in the selection */
+ H5S_pnt_node_t *node; /* Point node */
+ unsigned ndims; /* Dimensionality of dataspace*/
+ hsize_t acc; /* Coordinate accumulator */
+ hsize_t loc; /* Coordinate offset */
+ size_t curr_seq; /* Current sequence being operated on */
+ int i; /* Local index variable */
+ herr_t ret_value = SUCCEED; /* return value */
+
+ FUNC_ENTER_STATIC_NOERR
+
+ /* Check args */
+ HDassert(iter);
+ HDassert(maxseq > 0);
+ HDassert(maxelem > 0);
+ HDassert(nseq);
+ HDassert(nelem);
+ HDassert(off);
+ HDassert(len);
+
+ /* Choose the minimum number of bytes to sequence through */
+ H5_CHECK_OVERFLOW(iter->elmt_left, hsize_t, size_t);
+ start_io_left = io_left = (size_t)MIN(iter->elmt_left, maxelem);
+
+ /* Get the dataspace's rank */
+ ndims = iter->rank;
+
+ /* Walk through the points in the selection, starting at the current */
+ /* location in the iterator */
+ node = iter->u.pnt.curr;
+ curr_seq = 0;
+ while(NULL != node) {
+ /* Compute the offset of each selected point in the buffer */
+ for(i = (int)(ndims - 1), acc = iter->elmt_size, loc = 0; i >= 0; i--) {
+ loc += (hsize_t)((hssize_t)node->pnt[i] + iter->sel_off[i]) * acc;
+ acc *= iter->dims[i];
+ } /* end for */
+
+ /* Check if this is a later point in the selection */
+ if(curr_seq > 0) {
+ /* If a sorted sequence is requested, make certain we don't go backwards in the offset */
+ if((iter->flags & H5S_SEL_ITER_GET_SEQ_LIST_SORTED) && loc < off[curr_seq - 1])
+ break;
+
+ /* Check if this point extends the previous sequence */
+ /* (Unlikely, but possible) */
+ if(loc == (off[curr_seq - 1] + len[curr_seq - 1])) {
+ /* Extend the previous sequence */
+ len[curr_seq - 1] += iter->elmt_size;
+ } /* end if */
+ else {
+ /* Add a new sequence */
+ off[curr_seq] = loc;
+ len[curr_seq] = iter->elmt_size;
+
+ /* Increment sequence count */
+ curr_seq++;
+ } /* end else */
+ } /* end if */
+ else {
+ /* Add a new sequence */
+ off[curr_seq] = loc;
+ len[curr_seq] = iter->elmt_size;
+
+ /* Increment sequence count */
+ curr_seq++;
+ } /* end else */
+
+ /* Decrement number of elements left to process */
+ io_left--;
+
+ /* Move the iterator */
+ iter->u.pnt.curr = node->next;
+ iter->elmt_left--;
+
+ /* Check if we're finished with all sequences */
+ if(curr_seq == maxseq)
+ break;
+
+ /* Check if we're finished with all the elements available */
+ if(io_left == 0)
+ break;
+
+ /* Advance to the next point */
+ node = node->next;
+ } /* end while */
+
+ /* Set the number of sequences generated */
+ *nseq = curr_seq;
+
+ /* Set the number of elements used */
+ *nelem = start_io_left - io_left;
+
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5S__point_iter_get_seq_list() */
/*--------------------------------------------------------------------------
NAME
- H5S_point_iter_release
+ H5S__point_iter_release
PURPOSE
Release point selection iterator information for a dataspace
USAGE
- herr_t H5S_point_iter_release(iter)
+ herr_t H5S__point_iter_release(iter)
H5S_sel_iter_t *iter; IN: Pointer to selection iterator
RETURNS
Non-negative on success/Negative on failure
@@ -357,24 +556,29 @@ H5S_point_iter_next_block(H5S_sel_iter_t *iter)
REVISION LOG
--------------------------------------------------------------------------*/
static herr_t
-H5S_point_iter_release (H5S_sel_iter_t H5_ATTR_UNUSED * iter)
+H5S__point_iter_release(H5S_sel_iter_t * iter)
{
- FUNC_ENTER_NOAPI_NOINIT_NOERR
+ FUNC_ENTER_STATIC_NOERR
/* Check args */
HDassert(iter);
+ /* If this iterator copied the point list, we must free it */
+ if((iter->flags & H5S_SEL_ITER_API_CALL) &&
+ !(iter->flags & H5S_SEL_ITER_SHARE_WITH_DATASPACE))
+ H5S__free_pnt_list(iter->u.pnt.pnt_lst);
+
FUNC_LEAVE_NOAPI(SUCCEED)
-} /* H5S_point_iter_release() */
+} /* end H5S__point_iter_release() */
/*--------------------------------------------------------------------------
NAME
- H5S_point_add
+ H5S__point_add
PURPOSE
Add a series of elements to a point selection
USAGE
- herr_t H5S_point_add(space, num_elem, coord)
+ herr_t H5S__point_add(space, num_elem, coord)
H5S_t *space; IN: Dataspace of selection to modify
size_t num_elem; IN: Number of elements in COORD array.
const hsize_t *coord[]; IN: The location of each element selected
@@ -388,31 +592,32 @@ H5S_point_iter_release (H5S_sel_iter_t H5_ATTR_UNUSED * iter)
REVISION LOG
--------------------------------------------------------------------------*/
static herr_t
-H5S_point_add(H5S_t *space, H5S_seloper_t op, size_t num_elem, const hsize_t *coord)
+H5S__point_add(H5S_t *space, H5S_seloper_t op, size_t num_elem, const hsize_t *coord)
{
H5S_pnt_node_t *top = NULL, *curr = NULL, *new_node = NULL; /* Point selection nodes */
unsigned u; /* Counter */
herr_t ret_value = SUCCEED; /* Return value */
- FUNC_ENTER_NOAPI_NOINIT
+ FUNC_ENTER_STATIC
+ /* Sanity checks */
HDassert(space);
HDassert(num_elem > 0);
HDassert(coord);
HDassert(op == H5S_SELECT_SET || op == H5S_SELECT_APPEND || op == H5S_SELECT_PREPEND);
for(u = 0; u < num_elem; u++) {
+ unsigned dim; /* Counter for dimensions */
+
/* Allocate space for the new node */
- if(NULL == (new_node = H5FL_MALLOC(H5S_pnt_node_t)))
+ if(NULL == (new_node = (H5S_pnt_node_t *)H5FL_ARR_MALLOC(hcoords_t, space->extent.rank)))
HGOTO_ERROR(H5E_DATASPACE, H5E_CANTALLOC, FAIL, "can't allocate point node")
/* Initialize fields in node */
new_node->next = NULL;
- if(NULL == (new_node->pnt = (hsize_t *)H5MM_malloc(space->extent.rank * sizeof(hsize_t))))
- HGOTO_ERROR(H5E_DATASPACE, H5E_CANTALLOC, FAIL, "can't allocate coordinate information")
/* Copy over the coordinates */
- HDmemcpy(new_node->pnt, coord + (u * space->extent.rank), (space->extent.rank * sizeof(hsize_t)));
+ H5MM_memcpy(new_node->pnt, coord + (u * space->extent.rank), (space->extent.rank * sizeof(hsize_t)));
/* Link into list */
if(top == NULL)
@@ -420,6 +625,17 @@ H5S_point_add(H5S_t *space, H5S_seloper_t op, size_t num_elem, const hsize_t *co
else
curr->next = new_node;
curr = new_node;
+
+ /* Update bound box */
+ /* (Note: when op is H5S_SELECT_SET, the bound box has been reset
+ * inside H5S_select_elements, the only caller of this function.
+ * So the following bound box update procedure works correctly
+ * for the SET operation)
+ */
+ for(dim = 0; dim < space->extent.rank; dim++) {
+ space->select.sel_info.pnt_lst->low_bounds[dim] = MIN(space->select.sel_info.pnt_lst->low_bounds[dim], curr->pnt[dim]);
+ space->select.sel_info.pnt_lst->high_bounds[dim] = MAX(space->select.sel_info.pnt_lst->high_bounds[dim], curr->pnt[dim]);
+ } /* end for */
} /* end for */
new_node = NULL;
@@ -431,20 +647,22 @@ H5S_point_add(H5S_t *space, H5S_seloper_t op, size_t num_elem, const hsize_t *co
/* Put new list in point selection */
space->select.sel_info.pnt_lst->head = top;
+
+ /* Change the tail pointer if tail has not been set */
+ if(NULL == space->select.sel_info.pnt_lst->tail)
+ space->select.sel_info.pnt_lst->tail = curr;
} /* end if */
else { /* op==H5S_SELECT_APPEND */
H5S_pnt_node_t *tmp_node; /* Temporary point selection node */
tmp_node = space->select.sel_info.pnt_lst->head;
if(tmp_node != NULL) {
- while(tmp_node->next != NULL)
- tmp_node = tmp_node->next;
-
- /* Append new list to point selection */
- tmp_node->next = top;
+ HDassert(space->select.sel_info.pnt_lst->tail);
+ space->select.sel_info.pnt_lst->tail->next = top;
} /* end if */
else
space->select.sel_info.pnt_lst->head = top;
+ space->select.sel_info.pnt_lst->tail = curr;
} /* end else */
/* Set the number of elements in the new selection */
@@ -457,28 +675,27 @@ done:
if(ret_value < 0) {
/* Release possibly partially initialized new node */
if(new_node)
- new_node = H5FL_FREE(H5S_pnt_node_t, new_node);
+ new_node = (H5S_pnt_node_t *)H5FL_ARR_FREE(hcoords_t, new_node);
/* Release possible linked list of nodes */
while(top) {
- curr = top->next;
- H5MM_xfree(top->pnt);
- top = H5FL_FREE(H5S_pnt_node_t, top);
+ curr = top->next;
+ top = (H5S_pnt_node_t *)H5FL_ARR_FREE(hcoords_t, top);
top = curr;
} /* end while */
} /* end if */
FUNC_LEAVE_NOAPI(ret_value)
-} /* H5S_point_add() */
+} /* end H5S__point_add() */
/*--------------------------------------------------------------------------
NAME
- H5S_point_release
+ H5S__point_release
PURPOSE
Release point selection information for a dataspace
USAGE
- herr_t H5S_point_release(space)
+ herr_t H5S__point_release(space)
H5S_t *space; IN: Pointer to dataspace
RETURNS
Non-negative on success/Negative on failure
@@ -490,32 +707,24 @@ done:
REVISION LOG
--------------------------------------------------------------------------*/
static herr_t
-H5S_point_release (H5S_t *space)
+H5S__point_release(H5S_t *space)
{
- H5S_pnt_node_t *curr, *next; /* Point selection nodes */
-
- FUNC_ENTER_NOAPI_NOINIT_NOERR
+ FUNC_ENTER_STATIC_NOERR
/* Check args */
HDassert(space);
- /* Delete all the nodes from the list */
- curr = space->select.sel_info.pnt_lst->head;
- while(curr != NULL) {
- next = curr->next;
- H5MM_xfree(curr->pnt);
- curr = H5FL_FREE(H5S_pnt_node_t, curr);
- curr = next;
- } /* end while */
+ /* Free the point list */
+ H5S__free_pnt_list(space->select.sel_info.pnt_lst);
- /* Free & reset the point list header */
- space->select.sel_info.pnt_lst = H5FL_FREE(H5S_pnt_list_t, space->select.sel_info.pnt_lst);
+ /* Reset the point list header */
+ space->select.sel_info.pnt_lst = NULL;
/* Reset the number of elements in the selection */
space->select.num_elem = 0;
FUNC_LEAVE_NOAPI(SUCCEED)
-} /* H5S_point_release() */
+} /* end H5S__point_release() */
/*--------------------------------------------------------------------------
@@ -539,10 +748,7 @@ H5S_point_release (H5S_t *space)
array elements are iterated through when I/O is performed. Duplicate
coordinates are not checked for. The selection operator, OP, determines
how the new selection is to be combined with the existing selection for
- the dataspace. Currently, only H5S_SELECT_SET is supported, which replaces
- the existing selection with the one defined in this call. When operators
- other than H5S_SELECT_SET are used to combine a new selection with an
- existing selection, the selection ordering is reset to 'C' array ordering.
+ the dataspace.
GLOBAL VARIABLES
COMMENTS, BUGS, ASSUMPTIONS
EXAMPLES
@@ -552,9 +758,9 @@ herr_t
H5S_select_elements(H5S_t *space, H5S_seloper_t op, size_t num_elem,
const hsize_t *coord)
{
- herr_t ret_value = SUCCEED; /* return value */
+ herr_t ret_value = SUCCEED; /* Return value */
- FUNC_ENTER_NOAPI_NOINIT
+ FUNC_ENTER_NOAPI(FAIL)
/* Check args */
HDassert(space);
@@ -568,12 +774,19 @@ H5S_select_elements(H5S_t *space, H5S_seloper_t op, size_t num_elem,
HGOTO_ERROR(H5E_DATASPACE, H5E_CANTDELETE, FAIL, "can't release point selection")
/* Allocate space for the point selection information if necessary */
- if(H5S_GET_SELECT_TYPE(space) != H5S_SEL_POINTS || space->select.sel_info.pnt_lst == NULL)
+ if(H5S_GET_SELECT_TYPE(space) != H5S_SEL_POINTS || space->select.sel_info.pnt_lst == NULL) {
+ hsize_t tmp = HSIZET_MAX;
+
if(NULL == (space->select.sel_info.pnt_lst = H5FL_CALLOC(H5S_pnt_list_t)))
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "can't allocate element information")
+ /* Set the bound box to the default value */
+ H5VM_array_fill(space->select.sel_info.pnt_lst->low_bounds, &tmp, sizeof(hsize_t), space->extent.rank);
+ HDmemset(space->select.sel_info.pnt_lst->high_bounds, 0, sizeof(hsize_t) * space->extent.rank);
+ } /* end if */
+
/* Add points to selection */
- if(H5S_point_add(space, op, num_elem, coord) < 0)
+ if(H5S__point_add(space, op, num_elem, coord) < 0)
HGOTO_ERROR(H5E_DATASPACE, H5E_CANTINSERT, FAIL, "can't insert elements")
/* Set selection type */
@@ -581,61 +794,61 @@ H5S_select_elements(H5S_t *space, H5S_seloper_t op, size_t num_elem,
done:
FUNC_LEAVE_NOAPI(ret_value)
-} /* H5S_select_elements() */
+} /* end H5S_select_elements() */
/*--------------------------------------------------------------------------
NAME
- H5S_point_copy
+ H5S__copy_pnt_list
PURPOSE
- Copy a selection from one dataspace to another
+ Copy a point selection list
USAGE
- herr_t H5S_point_copy(dst, src)
- H5S_t *dst; OUT: Pointer to the destination dataspace
- H5S_t *src; IN: Pointer to the source dataspace
+ H5S_pnt_list_t *H5S__copy_pnt_list(src)
+ const H5S_pnt_list_t *src; IN: Pointer to the source point list
+ unsigned rank; IN: # of dimensions for points
RETURNS
- Non-negative on success/Negative on failure
+ Non-NULL pointer to new point list on success / NULL on failure
DESCRIPTION
- Copies all the point selection information from the source
- dataspace to the destination dataspace.
+ Copies point selection information from the source point list to newly
+ created point list.
GLOBAL VARIABLES
COMMENTS, BUGS, ASSUMPTIONS
EXAMPLES
REVISION LOG
--------------------------------------------------------------------------*/
-static herr_t
-H5S_point_copy(H5S_t *dst, const H5S_t *src, hbool_t H5_ATTR_UNUSED share_selection)
+static H5S_pnt_list_t *
+H5S__copy_pnt_list(const H5S_pnt_list_t *src, unsigned rank)
{
- H5S_pnt_node_t *curr, *new_node, *new_tail; /* Point information nodes */
- herr_t ret_value = SUCCEED; /* Return value */
+ H5S_pnt_list_t *dst = NULL; /* New point list */
+ H5S_pnt_node_t *curr, *new_tail; /* Point information nodes */
+ H5S_pnt_list_t *ret_value = NULL; /* Return value */
- FUNC_ENTER_NOAPI_NOINIT
+ FUNC_ENTER_STATIC
+ /* Sanity checks */
HDassert(src);
- HDassert(dst);
+ HDassert(rank > 0);
/* Allocate room for the head of the point list */
- if(NULL == (dst->select.sel_info.pnt_lst = H5FL_MALLOC(H5S_pnt_list_t)))
- HGOTO_ERROR(H5E_DATASPACE, H5E_CANTALLOC, FAIL, "can't allocate point list node")
+ if(NULL == (dst = H5FL_MALLOC(H5S_pnt_list_t)))
+ HGOTO_ERROR(H5E_DATASPACE, H5E_CANTALLOC, NULL, "can't allocate point list node")
- curr = src->select.sel_info.pnt_lst->head;
+ curr = src->head;
new_tail = NULL;
while(curr) {
+ H5S_pnt_node_t *new_node; /* New point information node */
+
/* Create new point */
- if(NULL == (new_node = H5FL_MALLOC(H5S_pnt_node_t)))
- HGOTO_ERROR(H5E_DATASPACE, H5E_CANTALLOC, FAIL, "can't allocate point node")
+ if(NULL == (new_node = (H5S_pnt_node_t *)H5FL_ARR_MALLOC(hcoords_t, rank)))
+ HGOTO_ERROR(H5E_DATASPACE, H5E_CANTALLOC, NULL, "can't allocate point node")
new_node->next = NULL;
- if(NULL == (new_node->pnt = (hsize_t *)H5MM_malloc(src->extent.rank * sizeof(hsize_t)))) {
- new_node = H5FL_FREE(H5S_pnt_node_t, new_node);
- HGOTO_ERROR(H5E_DATASPACE, H5E_CANTALLOC, FAIL, "can't allocate coordinate information")
- } /* end if */
/* Copy over the point's coordinates */
- HDmemcpy(new_node->pnt, curr->pnt, (src->extent.rank * sizeof(hsize_t)));
+ H5MM_memcpy(new_node->pnt, curr->pnt, (rank * sizeof(hsize_t)));
/* Keep the order the same when copying */
if(NULL == new_tail)
- new_tail = dst->select.sel_info.pnt_lst->head = new_node;
+ new_tail = dst->head = new_node;
else {
new_tail->next = new_node;
new_tail = new_node;
@@ -643,35 +856,114 @@ H5S_point_copy(H5S_t *dst, const H5S_t *src, hbool_t H5_ATTR_UNUSED share_select
curr = curr->next;
} /* end while */
+ dst->tail = new_tail;
+
+ /* Copy the selection bounds */
+ H5MM_memcpy(dst->high_bounds, src->high_bounds, (rank * sizeof(hsize_t)));
+ H5MM_memcpy(dst->low_bounds, src->low_bounds, (rank * sizeof(hsize_t)));
+
+ /* Set return value */
+ ret_value = dst;
done:
- if(ret_value < 0 && dst->select.sel_info.pnt_lst) {
- /* Traverse the (incomplete?) dst list, freeing all memory */
- curr = dst->select.sel_info.pnt_lst->head;
- while(curr) {
- H5S_pnt_node_t *tmp_node = curr;
-
- curr->pnt = (hsize_t *)H5MM_xfree(curr->pnt);
- curr = curr->next;
- tmp_node = H5FL_FREE(H5S_pnt_node_t, tmp_node);
- } /* end while */
+ if(NULL == ret_value && dst)
+ H5S__free_pnt_list(dst);
- dst->select.sel_info.pnt_lst = H5FL_FREE(H5S_pnt_list_t, dst->select.sel_info.pnt_lst);
- } /* end if */
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5S__copy_pnt_list() */
+
+/*--------------------------------------------------------------------------
+ NAME
+ H5S__free_pnt_list
+ PURPOSE
+ Free a point selection list
+ USAGE
+ void H5S__free_pnt_list(pnt_lst)
+ H5S_pnt_list_t *pnt_lst; IN: Pointer to the point list to free
+ RETURNS
+ None
+ DESCRIPTION
+ Frees point selection information from the point list
+ GLOBAL VARIABLES
+ COMMENTS, BUGS, ASSUMPTIONS
+ EXAMPLES
+ REVISION LOG
+--------------------------------------------------------------------------*/
+static void
+H5S__free_pnt_list(H5S_pnt_list_t *pnt_lst)
+{
+ H5S_pnt_node_t *curr; /* Point information nodes */
+
+ FUNC_ENTER_STATIC_NOERR
+
+ /* Sanity checks */
+ HDassert(pnt_lst);
+
+ /* Traverse the list, freeing all memory */
+ curr = pnt_lst->head;
+ while(curr) {
+ H5S_pnt_node_t *tmp_node = curr;
+
+ curr = curr->next;
+ tmp_node = (H5S_pnt_node_t *)H5FL_ARR_FREE(hcoords_t, tmp_node);
+ } /* end while */
+
+ H5FL_FREE(H5S_pnt_list_t, pnt_lst);
+
+ FUNC_LEAVE_NOAPI_VOID
+} /* end H5S__free_pnt_list() */
+
+
+/*--------------------------------------------------------------------------
+ NAME
+ H5S__point_copy
+ PURPOSE
+ Copy a selection from one dataspace to another
+ USAGE
+ herr_t H5S__point_copy(dst, src, share_selection)
+ H5S_t *dst; OUT: Pointer to the destination dataspace
+ H5S_t *src; IN: Pointer to the source dataspace
+ hbool_t share_selection; IN: Whether to share the selection between the dataspaces
+ RETURNS
+ Non-negative on success/Negative on failure
+ DESCRIPTION
+ Copies all the point selection information from the source
+ dataspace to the destination dataspace.
+ GLOBAL VARIABLES
+ COMMENTS, BUGS, ASSUMPTIONS
+ EXAMPLES
+ REVISION LOG
+--------------------------------------------------------------------------*/
+static herr_t
+H5S__point_copy(H5S_t *dst, const H5S_t *src, hbool_t H5_ATTR_UNUSED share_selection)
+{
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_STATIC
+
+ /* Sanity check */
+ HDassert(src);
+ HDassert(dst);
+
+ /* Allocate room for the head of the point list */
+ if(NULL == (dst->select.sel_info.pnt_lst = H5S__copy_pnt_list(src->select.sel_info.pnt_lst, src->extent.rank)))
+ HGOTO_ERROR(H5E_DATASPACE, H5E_CANTCOPY, FAIL, "can't copy point list")
+
+done:
FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5S_point_copy() */
+} /* end H5S__point_copy() */
/*--------------------------------------------------------------------------
NAME
- H5S_point_is_valid
+ H5S__point_is_valid
PURPOSE
Check whether the selection fits within the extent, with the current
offset defined.
USAGE
- htri_t H5S_point_is_valid(space);
- H5S_t *space; IN: Dataspace pointer to query
+ htri_t H5S__point_is_valid(space);
+ const H5S_t *space; IN: Dataspace pointer to query
RETURNS
TRUE if the selection fits within the extent, FALSE if it does not and
Negative on an error.
@@ -684,34 +976,27 @@ done:
REVISION LOG
--------------------------------------------------------------------------*/
static htri_t
-H5S_point_is_valid (const H5S_t *space)
+H5S__point_is_valid(const H5S_t *space)
{
- H5S_pnt_node_t *curr; /* Point information nodes */
unsigned u; /* Counter */
htri_t ret_value = TRUE; /* Return value */
- FUNC_ENTER_NOAPI_NOINIT_NOERR
+ FUNC_ENTER_STATIC_NOERR
HDassert(space);
- /* Check each point to determine whether selection+offset is within extent */
- curr = space->select.sel_info.pnt_lst->head;
- while(curr != NULL) {
- /* Check each dimension */
- for(u = 0; u < space->extent.rank; u++) {
- /* Check if an offset has been defined */
- /* Bounds check the selected point + offset against the extent */
- if(((curr->pnt[u] + (hsize_t)space->select.offset[u]) > space->extent.size[u])
- || (((hssize_t)curr->pnt[u] + space->select.offset[u]) < 0))
- HGOTO_DONE(FALSE)
- } /* end for */
-
- curr = curr->next;
- } /* end while */
+ /* Check each dimension */
+ for(u = 0; u < space->extent.rank; u++) {
+ /* Bounds check the selected point + offset against the extent */
+ if((space->select.sel_info.pnt_lst->high_bounds[u] + (hsize_t)space->select.offset[u]) > space->extent.size[u])
+ HGOTO_DONE(FALSE)
+ if(((hssize_t)space->select.sel_info.pnt_lst->low_bounds[u] + space->select.offset[u]) < 0)
+ HGOTO_DONE(FALSE)
+ } /* end for */
done:
FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5S_point_is_valid() */
+} /* end H5S__point_is_valid() */
/*--------------------------------------------------------------------------
@@ -750,18 +1035,136 @@ H5Sget_select_elem_npoints(hid_t spaceid)
done:
FUNC_LEAVE_API(ret_value)
-} /* H5Sget_select_elem_npoints() */
+} /* end H5Sget_select_elem_npoints() */
/*--------------------------------------------------------------------------
NAME
- H5S_point_serial_size
+ H5S__point_get_version_enc_size
+ PURPOSE
+ Determine the version and the size (2, 4 or 8 bytes) to encode point selection info
+ USAGE
+ hssize_t H5S__point_set_enc_size(space, version, enc_size)
+ const H5S_t *space: IN: Dataspace ID of selection to query
+ uint32_t *version: OUT: The version to use for encoding
+ uint8_t *enc_size: OUT: The size to use for encoding
+ RETURNS
+ The version and the size to encode point selection info
+ DESCRIPTION
+ Determine the version to use for encoding points selection info based
+ on the following:
+ (1) the low/high bounds setting in fapl
+ (2) whether the number of points or selection high bounds exceeds H5S_UINT32_MAX or not
+
+ Determine the encoded size based on version:
+ --For version 2, the encoded size of point selection info is determined
+ by the maximum size for:
+ (a) storing the number of points
+ (b) storing the selection high bounds
+
+ GLOBAL VARIABLES
+ COMMENTS, BUGS, ASSUMPTIONS
+ EXAMPLES
+ REVISION LOG
+--------------------------------------------------------------------------*/
+static herr_t
+H5S__point_get_version_enc_size(const H5S_t *space, uint32_t *version, uint8_t *enc_size)
+{
+ hbool_t count_up_version = FALSE; /* Whether number of points exceed H5S_UINT32_MAX */
+ hbool_t bound_up_version = FALSE; /* Whether high bounds exceed H5S_UINT32_MAX */
+ H5F_libver_t low_bound; /* The 'low' bound of library format versions */
+ H5F_libver_t high_bound; /* The 'high' bound of library format versions */
+ uint32_t tmp_version; /* Local temporary version */
+ hsize_t bounds_start[H5S_MAX_RANK]; /* Starting coordinate of bounding box */
+ hsize_t bounds_end[H5S_MAX_RANK]; /* Opposite coordinate of bounding box */
+ hsize_t max_size = 0; /* Maximum selection size */
+ unsigned u; /* Local index veriable */
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_STATIC
+
+ /* Get bounding box for the selection */
+ HDmemset(bounds_end, 0, sizeof(bounds_end));
+ if(H5S__point_bounds(space, bounds_start, bounds_end) < 0)
+ HGOTO_ERROR(H5E_DATASPACE, H5E_CANTGET, FAIL, "can't get selection bounds")
+
+ /* Determine whether number of points or high bounds exceeds (2^32 - 1) */
+ if(space->select.num_elem > H5S_UINT32_MAX)
+ count_up_version = TRUE;
+ else
+ for(u = 0; u < space->extent.rank; u++)
+ if(bounds_end[u] > H5S_UINT32_MAX) {
+ bound_up_version = TRUE;
+ break;
+ } /* end if */
+
+ /* If exceed (2^32 -1) */
+ if(count_up_version || bound_up_version)
+ tmp_version = H5S_POINT_VERSION_2;
+ else
+ tmp_version = H5S_POINT_VERSION_1;
+
+ /* Get the file's low/high bounds */
+ if(H5CX_get_libver_bounds(&low_bound, &high_bound) < 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get low/high bounds from API context")
+
+ /* Upgrade to the version indicated by the file's low bound if higher */
+ tmp_version = MAX(tmp_version, H5O_sds_point_ver_bounds[low_bound]);
+
+ /* Version bounds check */
+ if(tmp_version > H5O_sds_point_ver_bounds[high_bound]) {
+ if(count_up_version)
+ HGOTO_ERROR(H5E_DATASPACE, H5E_BADVALUE, FAIL, "The number of points in point selection exceeds 2^32")
+ else if(bound_up_version)
+ HGOTO_ERROR(H5E_DATASPACE, H5E_BADVALUE, FAIL, "The end of bounding box in point selection exceeds 2^32")
+ else
+ HGOTO_ERROR(H5E_DATASPACE, H5E_BADRANGE, FAIL, "Dataspace point selection version out of bounds")
+ } /* end if */
+
+ /* Set the version to return */
+ *version = tmp_version;
+
+ /* Get the encoded size use based on version */
+ switch(tmp_version) {
+ case H5S_POINT_VERSION_1:
+ *enc_size = H5S_SELECT_INFO_ENC_SIZE_4;
+ break;
+
+ case H5S_POINT_VERSION_2:
+ /* Find max for num_elem and bounds_end[] */
+ max_size = space->select.num_elem;
+ for(u = 0; u < space->extent.rank; u++)
+ if(bounds_end[u] > max_size)
+ max_size = bounds_end[u];
+
+ /* Determine the encoding size */
+ if(max_size > H5S_UINT32_MAX)
+ *enc_size = H5S_SELECT_INFO_ENC_SIZE_8;
+ else if(max_size > H5S_UINT16_MAX)
+ *enc_size = H5S_SELECT_INFO_ENC_SIZE_4;
+ else
+ *enc_size = H5S_SELECT_INFO_ENC_SIZE_2;
+ break;
+
+ default:
+ HGOTO_ERROR(H5E_DATASPACE, H5E_UNSUPPORTED, FAIL, "unknown point info size")
+ break;
+ } /* end switch */
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* H5S__point_get_version_enc_size() */
+
+
+/*--------------------------------------------------------------------------
+ NAME
+ H5S__point_serial_size
PURPOSE
Determine the number of bytes needed to store the serialized point selection
information.
USAGE
- hssize_t H5S_point_serial_size(space)
- H5S_t *space; IN: Dataspace pointer to query
+ hssize_t H5S__point_serial_size(space)
+ const H5S_t *space; IN: Dataspace pointer to query
RETURNS
The number of bytes required on success, negative on an error.
DESCRIPTION
@@ -773,35 +1176,52 @@ done:
REVISION LOG
--------------------------------------------------------------------------*/
static hssize_t
-H5S_point_serial_size (const H5S_t *space)
+H5S__point_serial_size(const H5S_t *space)
{
+ uint32_t version; /* Version number */
+ uint8_t enc_size; /* Encoded size of point selection info */
hssize_t ret_value = -1; /* Return value */
- FUNC_ENTER_NOAPI_NOINIT_NOERR
+ FUNC_ENTER_STATIC
HDassert(space);
- /* Basic number of bytes required to serialize point selection:
- * <type (4 bytes)> + <version (4 bytes)> + <padding (4 bytes)> +
- * <length (4 bytes)> + <rank (4 bytes)> + <# of points (4 bytes)> = 24 bytes
- */
- ret_value = 24;
+ /* Determine the version and encoded size for point selection */
+ if(H5S__point_get_version_enc_size(space, &version, &enc_size) < 0)
+ HGOTO_ERROR(H5E_DATASPACE, H5E_CANTGET, FAIL, "can't determine hyper version")
+
+ /* Basic number of bytes required to serialize point selection: */
+ if(version >= H5S_POINT_VERSION_2)
+ /*
+ * <type (4 bytes)> + <version (4 bytes)> +
+ * <size of point info (1 byte)> + rank (4 bytes)>
+ */
+ ret_value=13;
+ else
+ /*
+ * <type (4 bytes)> + <version (4 bytes)> + <padding (4 bytes)> +
+ * <length (4 bytes)> + <rank (4 bytes)>
+ */
+ ret_value = 20;
+
+ /* <num points (depend on enc_size)> */
+ ret_value += enc_size;
/* Count points in selection */
- /* (Add 4 bytes times the rank for each element selected) */
- ret_value += (4 * space->extent.rank) * (hssize_t)H5S_GET_SELECT_NPOINTS(space);
+ ret_value += (hssize_t) (enc_size * space->extent.rank * space->select.num_elem);
+done:
FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5S_point_serial_size() */
+} /* end H5S__point_serial_size() */
/*--------------------------------------------------------------------------
NAME
- H5S_point_serialize
+ H5S__point_serialize
PURPOSE
Serialize the current selection into a user-provided buffer.
USAGE
- herr_t H5S_point_serialize(space, p)
+ herr_t H5S__point_serialize(space, p)
const H5S_t *space; IN: Dataspace with selection to serialize
uint8_t **p; OUT: Pointer to buffer to put serialized
selection. Will be advanced to end of
@@ -817,70 +1237,126 @@ H5S_point_serial_size (const H5S_t *space)
REVISION LOG
--------------------------------------------------------------------------*/
static herr_t
-H5S_point_serialize (const H5S_t *space, uint8_t **p)
+H5S__point_serialize(const H5S_t *space, uint8_t **p)
{
H5S_pnt_node_t *curr; /* Point information nodes */
- uint8_t *pp = (*p); /* Local pointer for decoding */
- uint8_t *lenp; /* pointer to length location for later storage */
+ uint8_t *pp; /* Local pointer for decoding */
+ uint8_t *lenp = NULL; /* pointer to length location for later storage */
uint32_t len=0; /* number of bytes used */
unsigned u; /* local counting variable */
+ uint32_t version; /* Version number */
+ uint8_t enc_size; /* Encoded size of point selection info */
+ herr_t ret_value = SUCCEED; /* Return value */
- FUNC_ENTER_NOAPI_NOINIT_NOERR
+ FUNC_ENTER_STATIC
/* Check args */
HDassert(space);
HDassert(p);
+ pp = (*p);
HDassert(pp);
+ /* Determine the version and encoded size for point selection info */
+ if(H5S__point_get_version_enc_size(space, &version, &enc_size) < 0)
+ HGOTO_ERROR(H5E_DATASPACE, H5E_CANTGET, FAIL, "can't determine hyper version")
+
/* Store the preamble information */
UINT32ENCODE(pp, (uint32_t)H5S_GET_SELECT_TYPE(space)); /* Store the type of selection */
- UINT32ENCODE(pp, (uint32_t)1); /* Store the version number */
- UINT32ENCODE(pp, (uint32_t)0); /* Store the un-used padding */
- lenp = pp; /* Keep the pointer to the length location for later */
- pp += 4; /* Skip over space for length */
+
+ UINT32ENCODE(pp, version); /* Store the version number */
+ if(version >= 2) {
+ *(pp)++ = enc_size; /* Store size of point info */
+ } else {
+ HDassert(version == H5S_POINT_VERSION_1);
+ UINT32ENCODE(pp, (uint32_t)0); /* Store the un-used padding */
+ lenp = pp; /* Keep the pointer to the length location for later */
+ pp += 4; /* Skip over space for length */
+ len += 8; /* Add in advance # of bytes for num of dimensions and num elements */
+ }
/* Encode number of dimensions */
UINT32ENCODE(pp, (uint32_t)space->extent.rank);
- len+=4;
- /* Encode number of elements */
- UINT32ENCODE(pp, (uint32_t)space->select.num_elem);
- len+=4;
+ switch(enc_size) {
+ case H5S_SELECT_INFO_ENC_SIZE_2:
+ HDassert(version == H5S_POINT_VERSION_2);
+
+ /* Encode number of elements */
+ UINT16ENCODE(pp, (uint16_t)space->select.num_elem);
+
+ /* Encode each point in selection */
+ curr=space->select.sel_info.pnt_lst->head;
+ while(curr!=NULL) {
+ /* Encode each point */
+ for(u=0; u<space->extent.rank; u++)
+ UINT16ENCODE(pp, (uint16_t)curr->pnt[u]);
+ curr=curr->next;
+ } /* end while */
+ break;
+
+ case H5S_SELECT_INFO_ENC_SIZE_4:
+ HDassert(version == H5S_POINT_VERSION_1 || version == H5S_POINT_VERSION_2);
- /* Encode each point in selection */
- curr=space->select.sel_info.pnt_lst->head;
- while(curr!=NULL) {
- /* Add 4 bytes times the rank for each element selected */
- len+=4*space->extent.rank;
+ /* Encode number of elements */
+ UINT32ENCODE(pp, (uint32_t)space->select.num_elem);
- /* Encode each point */
- for(u=0; u<space->extent.rank; u++)
- UINT32ENCODE(pp, (uint32_t)curr->pnt[u]);
+ /* Encode each point in selection */
+ curr=space->select.sel_info.pnt_lst->head;
+ while(curr!=NULL) {
+ /* Encode each point */
+ for(u=0; u<space->extent.rank; u++)
+ UINT32ENCODE(pp, (uint32_t)curr->pnt[u]);
+ curr=curr->next;
+ } /* end while */
- curr=curr->next;
- } /* end while */
+ /* Add 4 bytes times the rank for each element selected */
+ if(version == H5S_POINT_VERSION_1)
+ len += (uint32_t)space->select.num_elem * 4 * space->extent.rank;
+ break;
+
+ case H5S_SELECT_INFO_ENC_SIZE_8:
+ HDassert(version == H5S_POINT_VERSION_2);
+
+ /* Encode number of elements */
+ UINT64ENCODE(pp, space->select.num_elem);
+
+ /* Encode each point in selection */
+ curr=space->select.sel_info.pnt_lst->head;
+ while(curr!=NULL) {
+ /* Encode each point */
+ for(u=0; u<space->extent.rank; u++)
+ UINT64ENCODE(pp, curr->pnt[u]);
+ curr=curr->next;
+ } /* end while */
+ break;
+
+ default:
+ HGOTO_ERROR(H5E_DATASPACE, H5E_UNSUPPORTED, FAIL, "unknown point info size")
+ break;
+
+ } /* end switch */
- /* Encode length */
- UINT32ENCODE(lenp, (uint32_t)len); /* Store the length of the extra information */
+ if(version == H5S_POINT_VERSION_1)
+ UINT32ENCODE(lenp, (uint32_t)len); /* Store the length of the extra information */
/* Update encoding pointer */
*p = pp;
- FUNC_LEAVE_NOAPI(SUCCEED)
-} /* H5S_point_serialize() */
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* H5S__point_serialize() */
+
/*--------------------------------------------------------------------------
NAME
- H5S_point_deserialize
+ H5S__point_deserialize
PURPOSE
Deserialize the current selection from a user-provided buffer.
USAGE
- herr_t H5S_point_deserialize(space, p)
- H5S_t *space; IN/OUT: Dataspace pointer to place
+ herr_t H5S__point_deserialize(space, p)
+ H5S_t **space; IN/OUT: Dataspace pointer to place
selection into
- uint32_t version IN: Selection version
- uint8_t flags IN: Selection flags
uint8 **p; OUT: Pointer to buffer holding serialized
selection. Will be advanced to end of
serialized selection.
@@ -895,28 +1371,85 @@ H5S_point_serialize (const H5S_t *space, uint8_t **p)
REVISION LOG
--------------------------------------------------------------------------*/
static herr_t
-H5S_point_deserialize(H5S_t *space, uint32_t H5_ATTR_UNUSED version, uint8_t H5_ATTR_UNUSED flags,
- const uint8_t **p)
+H5S__point_deserialize(H5S_t **space, const uint8_t **p)
{
- H5S_seloper_t op = H5S_SELECT_SET; /* Selection operation */
+ H5S_t *tmp_space = NULL; /* Pointer to actual dataspace to use,
+ either *space or a newly allocated one */
+ hsize_t dims[H5S_MAX_RANK]; /* Dimension sizes */
+ uint32_t version; /* Version number */
+ uint8_t enc_size = 0; /* Encoded size of selection info */
hsize_t *coord = NULL, *tcoord; /* Pointer to array of elements */
- const uint8_t *pp = (*p); /* Local pointer for decoding */
- size_t num_elem = 0; /* Number of elements in selection */
+ const uint8_t *pp; /* Local pointer for decoding */
+ uint64_t num_elem = 0; /* Number of elements in selection */
unsigned rank; /* Rank of points */
unsigned i, j; /* local counting variables */
herr_t ret_value = SUCCEED; /* Return value */
- FUNC_ENTER_NOAPI_NOINIT
+ FUNC_ENTER_STATIC
/* Check args */
- HDassert(space);
HDassert(p);
+ pp = (*p);
HDassert(pp);
- /* Deserialize points to select */
- /* (The header and rank have already beed decoded) */
- rank = space->extent.rank; /* Retrieve rank from space */
- UINT32DECODE(pp, num_elem); /* decode the number of points */
+ /* As part of the efforts to push all selection-type specific coding
+ to the callbacks, the coding for the allocation of a null dataspace
+ is moved from H5S_select_deserialize() in H5Sselect.c to here.
+ This is needed for decoding virtual layout in H5O__layout_decode() */
+ /* Allocate space if not provided */
+ if(!*space) {
+ if(NULL == (tmp_space = H5S_create(H5S_SIMPLE)))
+ HGOTO_ERROR(H5E_DATASPACE, H5E_CANTCREATE, FAIL, "can't create dataspace")
+ } /* end if */
+ else
+ tmp_space = *space;
+
+ /* Decode version */
+ UINT32DECODE(pp, version);
+
+ if(version >= (uint32_t)H5S_POINT_VERSION_2)
+ /* Decode size of point info */
+ enc_size = *(pp)++;
+ else {
+ /* Skip over the remainder of the header */
+ pp += 8;
+ enc_size = H5S_SELECT_INFO_ENC_SIZE_4;
+ }
+
+ /* Check encoded size */
+ if(enc_size & ~H5S_SELECT_INFO_ENC_SIZE_BITS)
+ HGOTO_ERROR(H5E_DATASPACE, H5E_CANTLOAD, FAIL, "unknown size of point/offset info for selection")
+
+ /* Decode the rank of the point selection */
+ UINT32DECODE(pp,rank);
+
+ if(!*space) {
+ /* Patch the rank of the allocated dataspace */
+ (void)HDmemset(dims, 0, (size_t)rank * sizeof(dims[0]));
+ if(H5S_set_extent_simple(tmp_space, rank, dims, NULL) < 0)
+ HGOTO_ERROR(H5E_DATASPACE, H5E_CANTINIT, FAIL, "can't set dimensions")
+ } /* end if */
+ else
+ /* Verify the rank of the provided dataspace */
+ if(rank != tmp_space->extent.rank)
+ HGOTO_ERROR(H5E_DATASPACE, H5E_BADRANGE, FAIL, "rank of serialized selection does not match dataspace")
+
+ /* decode the number of points */
+ switch(enc_size) {
+ case H5S_SELECT_INFO_ENC_SIZE_2:
+ UINT16DECODE(pp, num_elem);
+ break;
+ case H5S_SELECT_INFO_ENC_SIZE_4:
+ UINT32DECODE(pp, num_elem);
+ break;
+ case H5S_SELECT_INFO_ENC_SIZE_8:
+ UINT64DECODE(pp, num_elem);
+ break;
+ default:
+ HGOTO_ERROR(H5E_DATASPACE, H5E_UNSUPPORTED, FAIL, "unknown point info size")
+ break;
+ } /* end switch */
+
/* Allocate space for the coordinates */
if(NULL == (coord = (hsize_t *)H5MM_malloc(num_elem * rank * sizeof(hsize_t))))
@@ -925,32 +1458,56 @@ H5S_point_deserialize(H5S_t *space, uint32_t H5_ATTR_UNUSED version, uint8_t H5_
/* Retrieve the coordinates from the buffer */
for(tcoord = coord, i = 0; i < num_elem; i++)
for(j = 0; j < (unsigned)rank; j++, tcoord++)
- UINT32DECODE(pp, *tcoord);
+ switch(enc_size) {
+ case H5S_SELECT_INFO_ENC_SIZE_2:
+ UINT16DECODE(pp, *tcoord);
+ break;
+
+ case H5S_SELECT_INFO_ENC_SIZE_4:
+ UINT32DECODE(pp, *tcoord);
+ break;
+
+ case H5S_SELECT_INFO_ENC_SIZE_8:
+ UINT64DECODE(pp, *tcoord);
+ break;
+ default:
+ HGOTO_ERROR(H5E_DATASPACE, H5E_UNSUPPORTED, FAIL, "unknown point info size")
+ break;
+ } /* end switch */
/* Select points */
- if(H5S_select_elements(space, op, num_elem, (const hsize_t *)coord) < 0)
+ if(H5S_select_elements(tmp_space, H5S_SELECT_SET, num_elem, (const hsize_t *)coord) < 0)
HGOTO_ERROR(H5E_DATASPACE, H5E_CANTDELETE, FAIL, "can't change selection")
/* Update decoding pointer */
*p = pp;
+ /* Return space to the caller if allocated */
+ if(!*space)
+ *space = tmp_space;
+
done:
+ /* Free temporary space if not passed to caller (only happens on error) */
+ if(!*space && tmp_space)
+ if(H5S_close(tmp_space) < 0)
+ HDONE_ERROR(H5E_DATASPACE, H5E_CANTFREE, FAIL, "can't close dataspace")
+
/* Free the coordinate array if necessary */
if(coord != NULL)
H5MM_xfree(coord);
FUNC_LEAVE_NOAPI(ret_value)
-} /* H5S_point_deserialize() */
+} /* end H5S__point_deserialize() */
/*--------------------------------------------------------------------------
NAME
- H5S_get_select_elem_pointlist
+ H5S__get_select_elem_pointlist
PURPOSE
Get the list of element points currently selected
USAGE
- herr_t H5S_get_select_elem_pointlist(space, hsize_t *buf)
- H5S_t *space; IN: Dataspace pointer of selection to query
+ herr_t H5S__get_select_elem_pointlist(space, hsize_t *buf)
+ const H5S_t *space; IN: Dataspace pointer of selection to query
hsize_t startpoint; IN: Element point to start with
hsize_t numpoints; IN: Number of element points to get
hsize_t *buf; OUT: List of element points selected
@@ -973,12 +1530,13 @@ done:
REVISION LOG
--------------------------------------------------------------------------*/
static herr_t
-H5S_get_select_elem_pointlist(H5S_t *space, hsize_t startpoint, hsize_t numpoints, hsize_t *buf)
+H5S__get_select_elem_pointlist(const H5S_t *space, hsize_t startpoint,
+ hsize_t numpoints, hsize_t *buf)
{
H5S_pnt_node_t *node; /* Point node */
unsigned rank; /* Dataspace rank */
- FUNC_ENTER_NOAPI_NOINIT_NOERR
+ FUNC_ENTER_STATIC_NOERR
HDassert(space);
HDassert(buf);
@@ -997,14 +1555,14 @@ H5S_get_select_elem_pointlist(H5S_t *space, hsize_t startpoint, hsize_t numpoint
/* Iterate through the node, copying each point's information */
while(node != NULL && numpoints > 0) {
- HDmemcpy(buf, node->pnt, sizeof(hsize_t) * rank);
+ H5MM_memcpy(buf, node->pnt, sizeof(hsize_t) * rank);
buf += rank;
numpoints--;
node = node->next;
} /* end while */
FUNC_LEAVE_NOAPI(SUCCEED)
-} /* H5S_get_select_elem_pointlist() */
+} /* end H5S__get_select_elem_pointlist() */
/*--------------------------------------------------------------------------
@@ -1054,20 +1612,20 @@ H5Sget_select_elem_pointlist(hid_t spaceid, hsize_t startpoint,
if(H5S_GET_SELECT_TYPE(space) != H5S_SEL_POINTS)
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a point selection")
- ret_value = H5S_get_select_elem_pointlist(space, startpoint, numpoints, buf);
+ ret_value = H5S__get_select_elem_pointlist(space, startpoint, numpoints, buf);
done:
FUNC_LEAVE_API(ret_value)
-} /* H5Sget_select_elem_pointlist() */
+} /* end H5Sget_select_elem_pointlist() */
/*--------------------------------------------------------------------------
NAME
- H5S_point_bounds
+ H5S__point_bounds
PURPOSE
Gets the bounding box containing the selection.
USAGE
- herr_t H5S_point_bounds(space, start, end)
+ herr_t H5S__point_bounds(space, start, end)
H5S_t *space; IN: Dataspace pointer of selection to query
hsize_t *start; OUT: Starting coordinate of bounding box
hsize_t *end; OUT: Opposite coordinate of bounding box
@@ -1088,57 +1646,44 @@ done:
REVISION LOG
--------------------------------------------------------------------------*/
static herr_t
-H5S_point_bounds(const H5S_t *space, hsize_t *start, hsize_t *end)
+H5S__point_bounds(const H5S_t *space, hsize_t *start, hsize_t *end)
{
- H5S_pnt_node_t *node; /* Point node */
- unsigned rank; /* Dataspace rank */
unsigned u; /* Local index variable */
herr_t ret_value = SUCCEED; /* Return value */
- FUNC_ENTER_NOAPI_NOINIT
+ FUNC_ENTER_STATIC
/* Sanity check */
HDassert(space);
HDassert(start);
HDassert(end);
- /* Get the dataspace extent rank */
- rank = space->extent.rank;
-
- /* Set the start and end arrays up */
- for(u = 0; u < rank; u++) {
- start[u] = HSIZET_MAX;
- end[u] = 0;
- } /* end for */
+ /* Loop over dimensions */
+ for(u = 0; u < space->extent.rank; u++) {
+ /* Sanity check */
+ HDassert(space->select.sel_info.pnt_lst->low_bounds[u] <= space->select.sel_info.pnt_lst->high_bounds[u]);
- /* Iterate through the node, checking the bounds on each element */
- node = space->select.sel_info.pnt_lst->head;
- while(node != NULL) {
- for(u = 0; u < rank; u++) {
- /* Check for offset moving selection negative */
- if(((hssize_t)node->pnt[u] + space->select.offset[u]) < 0)
- HGOTO_ERROR(H5E_DATASPACE, H5E_BADRANGE, FAIL, "offset moves selection out of bounds")
+ /* Check for offset moving selection negative */
+ if(((hssize_t)space->select.sel_info.pnt_lst->low_bounds[u] + space->select.offset[u]) < 0)
+ HGOTO_ERROR(H5E_DATASPACE, H5E_BADRANGE, FAIL, "offset moves selection out of bounds")
- if(start[u] > (hsize_t)((hssize_t)node->pnt[u] + space->select.offset[u]))
- start[u] = (hsize_t)((hssize_t)node->pnt[u] + space->select.offset[u]);
- if(end[u] < (hsize_t)((hssize_t)node->pnt[u] + space->select.offset[u]))
- end[u] = (hsize_t)((hssize_t)node->pnt[u] + space->select.offset[u]);
- } /* end for */
- node = node->next;
- } /* end while */
+ /* Set the low & high bounds in this dimension */
+ start[u] = (hsize_t)((hssize_t)space->select.sel_info.pnt_lst->low_bounds[u] + space->select.offset[u]);
+ end[u] = (hsize_t)((hssize_t)space->select.sel_info.pnt_lst->high_bounds[u] + space->select.offset[u]);
+ } /* end for */
done:
FUNC_LEAVE_NOAPI(ret_value)
-} /* H5S_point_bounds() */
+} /* end H5S__point_bounds() */
/*--------------------------------------------------------------------------
NAME
- H5S_point_offset
+ H5S__point_offset
PURPOSE
Gets the linear offset of the first element for the selection.
USAGE
- herr_t H5S_point_offset(space, offset)
+ herr_t H5S__point_offset(space, offset)
const H5S_t *space; IN: Dataspace pointer of selection to query
hsize_t *offset; OUT: Linear offset of first element in selection
RETURNS
@@ -1153,7 +1698,7 @@ done:
REVISION LOG
--------------------------------------------------------------------------*/
static herr_t
-H5S_point_offset(const H5S_t *space, hsize_t *offset)
+H5S__point_offset(const H5S_t *space, hsize_t *offset)
{
const hsize_t *pnt; /* Pointer to a selected point's coordinates */
const hssize_t *sel_offset; /* Pointer to the selection's offset */
@@ -1162,7 +1707,7 @@ H5S_point_offset(const H5S_t *space, hsize_t *offset)
int i; /* index variable */
herr_t ret_value = SUCCEED; /* Return value */
- FUNC_ENTER_NOAPI(FAIL)
+ FUNC_ENTER_STATIC
HDassert(space);
HDassert(offset);
@@ -1193,7 +1738,7 @@ H5S_point_offset(const H5S_t *space, hsize_t *offset)
done:
FUNC_LEAVE_NOAPI(ret_value)
-} /* H5S_point_offset() */
+} /* end H5S__point_offset() */
/*--------------------------------------------------------------------------
@@ -1227,11 +1772,11 @@ H5S__point_unlim_dim(const H5S_t H5_ATTR_UNUSED *space)
/*--------------------------------------------------------------------------
NAME
- H5S_point_is_contiguous
+ H5S__point_is_contiguous
PURPOSE
Check if a point selection is contiguous within the dataspace extent.
USAGE
- htri_t H5S_point_is_contiguous(space)
+ htri_t H5S__point_is_contiguous(space)
H5S_t *space; IN: Dataspace pointer to check
RETURNS
TRUE/FALSE/FAIL
@@ -1247,31 +1792,31 @@ H5S__point_unlim_dim(const H5S_t H5_ATTR_UNUSED *space)
REVISION LOG
--------------------------------------------------------------------------*/
static htri_t
-H5S_point_is_contiguous(const H5S_t *space)
+H5S__point_is_contiguous(const H5S_t *space)
{
htri_t ret_value = FAIL; /* Return value */
- FUNC_ENTER_NOAPI_NOINIT_NOERR
+ FUNC_ENTER_STATIC_NOERR
HDassert(space);
/* One point is definitely contiguous */
- if(space->select.num_elem==1)
- ret_value=TRUE;
+ if(space->select.num_elem == 1)
+ ret_value = TRUE;
else /* More than one point might be contiguous, but it's complex to check and we don't need it right now */
- ret_value=FALSE;
+ ret_value = FALSE;
FUNC_LEAVE_NOAPI(ret_value)
-} /* H5S_point_is_contiguous() */
+} /* end H5S__point_is_contiguous() */
/*--------------------------------------------------------------------------
NAME
- H5S_point_is_single
+ H5S__point_is_single
PURPOSE
Check if a point selection is single within the dataspace extent.
USAGE
- htri_t H5S_point_is_single(space)
+ htri_t H5S__point_is_single(space)
H5S_t *space; IN: Dataspace pointer to check
RETURNS
TRUE/FALSE/FAIL
@@ -1284,31 +1829,31 @@ H5S_point_is_contiguous(const H5S_t *space)
REVISION LOG
--------------------------------------------------------------------------*/
static htri_t
-H5S_point_is_single(const H5S_t *space)
+H5S__point_is_single(const H5S_t *space)
{
htri_t ret_value = FAIL; /* Return value */
- FUNC_ENTER_NOAPI_NOINIT_NOERR
+ FUNC_ENTER_STATIC_NOERR
HDassert(space);
/* One point is definitely 'single' :-) */
- if(space->select.num_elem==1)
- ret_value=TRUE;
+ if(space->select.num_elem == 1)
+ ret_value = TRUE;
else
- ret_value=FALSE;
+ ret_value = FALSE;
FUNC_LEAVE_NOAPI(ret_value)
-} /* H5S_point_is_single() */
+} /* end H5S__point_is_single() */
/*--------------------------------------------------------------------------
NAME
- H5S_point_is_regular
+ H5S__point_is_regular
PURPOSE
Check if a point selection is "regular"
USAGE
- htri_t H5S_point_is_regular(space)
+ htri_t H5S__point_is_regular(space)
const H5S_t *space; IN: Dataspace pointer to check
RETURNS
TRUE/FALSE/FAIL
@@ -1324,32 +1869,140 @@ H5S_point_is_single(const H5S_t *space)
REVISION LOG
--------------------------------------------------------------------------*/
static htri_t
-H5S_point_is_regular(const H5S_t *space)
+H5S__point_is_regular(const H5S_t *space)
{
htri_t ret_value = FAIL; /* Return value */
- FUNC_ENTER_NOAPI_NOINIT_NOERR
+ FUNC_ENTER_STATIC_NOERR
/* Check args */
HDassert(space);
/* Only simple check for regular points for now... */
- if(space->select.num_elem==1)
- ret_value=TRUE;
+ if(space->select.num_elem == 1)
+ ret_value = TRUE;
else
- ret_value=FALSE;
+ ret_value = FALSE;
FUNC_LEAVE_NOAPI(ret_value)
-} /* H5S_point_is_regular() */
+} /* end H5S__point_is_regular() */
/*--------------------------------------------------------------------------
NAME
- H5S_point_adjust_u
+ H5S__point_shape_same
+ PURPOSE
+ Check if a two "point" selections are the same shape
+ USAGE
+ htri_t H5S__point_shape_same(space1, space2)
+ const H5S_t *space1; IN: First dataspace to check
+ const H5S_t *space2; IN: Second dataspace to check
+ RETURNS
+ TRUE / FALSE / FAIL
+ DESCRIPTION
+ Checks to see if the current selection in each dataspace are the same
+ shape.
+ GLOBAL VARIABLES
+ COMMENTS, BUGS, ASSUMPTIONS
+ EXAMPLES
+ REVISION LOG
+--------------------------------------------------------------------------*/
+static htri_t
+H5S__point_shape_same(const H5S_t *space1, const H5S_t *space2)
+{
+ H5S_pnt_node_t *pnt1, *pnt2; /* Point information nodes */
+ hssize_t offset[H5S_MAX_RANK]; /* Offset between the selections */
+ unsigned space1_rank; /* Number of dimensions of first dataspace */
+ unsigned space2_rank; /* Number of dimensions of second dataspace */
+ int space1_dim; /* Current dimension in first dataspace */
+ int space2_dim; /* Current dimension in second dataspace */
+ htri_t ret_value = TRUE; /* Return value */
+
+ FUNC_ENTER_STATIC_NOERR
+
+ /* Check args */
+ HDassert(space1);
+ HDassert(space2);
+
+ /* Get dataspace ranks */
+ space1_rank = space1->extent.rank;
+ space2_rank = space2->extent.rank;
+
+ /* Sanity check */
+ HDassert(space1_rank >= space2_rank);
+ HDassert(space2_rank > 0);
+
+ /* Initialize dimensions */
+ space1_dim = (int)space1_rank - 1;
+ space2_dim = (int)space2_rank - 1;
+
+ /* Look at first point in each selection to compute the offset for common
+ * dimensions.
+ */
+ pnt1 = space1->select.sel_info.pnt_lst->head;
+ pnt2 = space2->select.sel_info.pnt_lst->head;
+ while(space2_dim >= 0) {
+ /* Set the relative locations of the selections */
+ offset[space1_dim] = (hssize_t)pnt2->pnt[space2_dim] - (hssize_t)pnt1->pnt[space1_dim];
+
+ space1_dim--;
+ space2_dim--;
+ } /* end while */
+
+ /* For dimensions that appear only in space1: */
+ while(space1_dim >= 0) {
+ /* Set the absolute offset of the remaining dimensions */
+ offset[space1_dim] = (hssize_t)pnt1->pnt[space1_dim];
+
+ space1_dim--;
+ } /* end while */
+
+ /* Advance to next point */
+ pnt1 = pnt1->next;
+ pnt2 = pnt2->next;
+
+ /* Loop over remaining points */
+ while(pnt1 && pnt2) {
+ /* Initialize dimensions */
+ space1_dim = (int)space1_rank - 1;
+ space2_dim = (int)space2_rank - 1;
+
+ /* Compare locations in common dimensions, including relative offset */
+ while(space2_dim >= 0) {
+ if((hsize_t)((hssize_t)pnt1->pnt[space1_dim] + offset[space1_dim]) != pnt2->pnt[space2_dim])
+ HGOTO_DONE(FALSE)
+
+ space1_dim--;
+ space2_dim--;
+ } /* end while */
+
+ /* For dimensions that appear only in space1: */
+ while(space1_dim >= 0) {
+ /* Compare the absolute offset in the remaining dimensions */
+ if((hssize_t)pnt1->pnt[space1_dim] != offset[space1_dim])
+ HGOTO_DONE(FALSE)
+
+ space1_dim--;
+ } /* end while */
+
+
+ /* Advance to next point */
+ pnt1 = pnt1->next;
+ pnt2 = pnt2->next;
+ } /* end while */
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5S__point_shape_same() */
+
+
+/*--------------------------------------------------------------------------
+ NAME
+ H5S__point_adjust_u
PURPOSE
Adjust a "point" selection by subtracting an offset
USAGE
- herr_t H5S_point_adjust_u(space, offset)
+ herr_t H5S__point_adjust_u(space, offset)
H5S_t *space; IN/OUT: Pointer to dataspace to adjust
const hsize_t *offset; IN: Offset to subtract
RETURNS
@@ -1362,12 +2015,13 @@ H5S_point_is_regular(const H5S_t *space)
REVISION LOG
--------------------------------------------------------------------------*/
static herr_t
-H5S_point_adjust_u(H5S_t *space, const hsize_t *offset)
+H5S__point_adjust_u(H5S_t *space, const hsize_t *offset)
{
H5S_pnt_node_t *node; /* Point node */
unsigned rank; /* Dataspace rank */
+ unsigned u; /* Local index variable */
- FUNC_ENTER_NOAPI_NOINIT_NOERR
+ FUNC_ENTER_STATIC_NOERR
HDassert(space);
HDassert(offset);
@@ -1376,8 +2030,6 @@ H5S_point_adjust_u(H5S_t *space, const hsize_t *offset)
node = space->select.sel_info.pnt_lst->head;
rank = space->extent.rank;
while(node) {
- unsigned u; /* Local index variable */
-
/* Adjust each coordinate for point node */
for(u = 0; u < rank; u++) {
/* Check for offset moving selection negative */
@@ -1391,17 +2043,23 @@ H5S_point_adjust_u(H5S_t *space, const hsize_t *offset)
node = node->next;
} /* end while */
+ /* update the bound box of the selection */
+ for(u = 0; u < rank; u++) {
+ space->select.sel_info.pnt_lst->low_bounds[u] -= offset[u];
+ space->select.sel_info.pnt_lst->high_bounds[u] -= offset[u];
+ } /* end for */
+
FUNC_LEAVE_NOAPI(SUCCEED)
-} /* H5S_point_adjust_u() */
+} /* end H5S__point_adjust_u() */
/*-------------------------------------------------------------------------
- * Function: H5S_point_project_scalar
+ * Function: H5S__point_project_scalar
*
* Purpose: Projects a single element point selection into a scalar
* dataspace
*
- * Return: non-negative on success, negative on failure.
+ * Return: Non-negative on success, negative on failure.
*
* Programmer: Quincey Koziol
* Sunday, July 18, 2010
@@ -1409,12 +2067,12 @@ H5S_point_adjust_u(H5S_t *space, const hsize_t *offset)
*-------------------------------------------------------------------------
*/
static herr_t
-H5S_point_project_scalar(const H5S_t *space, hsize_t *offset)
+H5S__point_project_scalar(const H5S_t *space, hsize_t *offset)
{
const H5S_pnt_node_t *node; /* Point node */
herr_t ret_value = SUCCEED; /* Return value */
- FUNC_ENTER_NOAPI_NOINIT
+ FUNC_ENTER_STATIC
/* Check args */
HDassert(space && H5S_SEL_POINTS == H5S_GET_SELECT_TYPE(space));
@@ -1428,20 +2086,20 @@ H5S_point_project_scalar(const H5S_t *space, hsize_t *offset)
HGOTO_ERROR(H5E_DATASPACE, H5E_BADRANGE, FAIL, "point selection of one element has more than one node!")
/* Calculate offset of selection in projected buffer */
- *offset = H5VM_array_offset(space->extent.rank, space->extent.size, node->pnt);
+ *offset = H5VM_array_offset(space->extent.rank, space->extent.size, node->pnt);
done:
FUNC_LEAVE_NOAPI(ret_value)
-} /* H5S_point_project_scalar() */
+} /* end H5S__point_project_scalar() */
/*-------------------------------------------------------------------------
- * Function: H5S_point_project_simple
+ * Function: H5S__point_project_simple
*
* Purpose: Projects a point selection onto/into a simple dataspace
* of a different rank
*
- * Return: non-negative on success, negative on failure.
+ * Return: Non-negative on success, negative on failure.
*
* Programmer: Quincey Koziol
* Sunday, July 18, 2010
@@ -1449,15 +2107,16 @@ done:
*-------------------------------------------------------------------------
*/
static herr_t
-H5S_point_project_simple(const H5S_t *base_space, H5S_t *new_space, hsize_t *offset)
+H5S__point_project_simple(const H5S_t *base_space, H5S_t *new_space, hsize_t *offset)
{
const H5S_pnt_node_t *base_node; /* Point node in base space */
H5S_pnt_node_t *new_node; /* Point node in new space */
H5S_pnt_node_t *prev_node; /* Previous point node in new space */
unsigned rank_diff; /* Difference in ranks between spaces */
+ unsigned u; /* Local index variable */
herr_t ret_value = SUCCEED; /* Return value */
- FUNC_ENTER_NOAPI_NOINIT
+ FUNC_ENTER_STATIC
/* Check args */
HDassert(base_space && H5S_SEL_POINTS == H5S_GET_SELECT_TYPE(base_space));
@@ -1481,24 +2140,20 @@ H5S_point_project_simple(const H5S_t *base_space, H5S_t *new_space, hsize_t *off
/* Calculate offset of selection in projected buffer */
HDmemset(block, 0, sizeof(block));
- HDmemcpy(block, base_space->select.sel_info.pnt_lst->head->pnt, sizeof(hsize_t) * rank_diff);
- *offset = H5VM_array_offset(base_space->extent.rank, base_space->extent.size, block);
+ H5MM_memcpy(block, base_space->select.sel_info.pnt_lst->head->pnt, sizeof(hsize_t) * rank_diff);
+ *offset = H5VM_array_offset(base_space->extent.rank, base_space->extent.size, block);
/* Iterate through base space's point nodes, copying the point information */
base_node = base_space->select.sel_info.pnt_lst->head;
prev_node = NULL;
while(base_node) {
/* Create new point */
- if(NULL == (new_node = H5FL_MALLOC(H5S_pnt_node_t)))
+ if(NULL == (new_node = (H5S_pnt_node_t *)H5FL_ARR_MALLOC(hcoords_t, new_space->extent.rank)))
HGOTO_ERROR(H5E_DATASPACE, H5E_CANTALLOC, FAIL, "can't allocate point node")
new_node->next = NULL;
- if(NULL == (new_node->pnt = (hsize_t *)H5MM_malloc(new_space->extent.rank * sizeof(hsize_t)))) {
- new_node = H5FL_FREE(H5S_pnt_node_t, new_node);
- HGOTO_ERROR(H5E_DATASPACE, H5E_CANTALLOC, FAIL, "can't allocate coordinate information")
- } /* end if */
/* Copy over the point's coordinates */
- HDmemcpy(new_node->pnt, &base_node->pnt[rank_diff], (new_space->extent.rank * sizeof(hsize_t)));
+ H5MM_memcpy(new_node->pnt, &base_node->pnt[rank_diff], (new_space->extent.rank * sizeof(hsize_t)));
/* Keep the order the same when copying */
if(NULL == prev_node)
@@ -1511,6 +2166,12 @@ H5S_point_project_simple(const H5S_t *base_space, H5S_t *new_space, hsize_t *off
/* Advance to next node */
base_node = base_node->next;
} /* end while */
+
+ /* Update the bounding box */
+ for(u = 0; u < new_space->extent.rank; u++) {
+ new_space->select.sel_info.pnt_lst->low_bounds[u] = base_space->select.sel_info.pnt_lst->low_bounds[u + rank_diff];
+ new_space->select.sel_info.pnt_lst->high_bounds[u] = base_space->select.sel_info.pnt_lst->high_bounds[u + rank_diff];
+ } /* end for */
} /* end if */
else {
HDassert(new_space->extent.rank > base_space->extent.rank);
@@ -1526,17 +2187,13 @@ H5S_point_project_simple(const H5S_t *base_space, H5S_t *new_space, hsize_t *off
prev_node = NULL;
while(base_node) {
/* Create new point */
- if(NULL == (new_node = H5FL_MALLOC(H5S_pnt_node_t)))
+ if(NULL == (new_node = (H5S_pnt_node_t *)H5FL_ARR_MALLOC(hcoords_t, new_space->extent.rank)))
HGOTO_ERROR(H5E_DATASPACE, H5E_CANTALLOC, FAIL, "can't allocate point node")
new_node->next = NULL;
- if(NULL == (new_node->pnt = (hsize_t *)H5MM_malloc(new_space->extent.rank * sizeof(hsize_t)))) {
- new_node = H5FL_FREE(H5S_pnt_node_t, new_node);
- HGOTO_ERROR(H5E_DATASPACE, H5E_CANTALLOC, FAIL, "can't allocate coordinate information")
- } /* end if */
/* Copy over the point's coordinates */
HDmemset(new_node->pnt, 0, sizeof(hsize_t) * rank_diff);
- HDmemcpy(&new_node->pnt[rank_diff], base_node->pnt, (new_space->extent.rank * sizeof(hsize_t)));
+ H5MM_memcpy(&new_node->pnt[rank_diff], base_node->pnt, (new_space->extent.rank * sizeof(hsize_t)));
/* Keep the order the same when copying */
if(NULL == prev_node)
@@ -1549,6 +2206,16 @@ H5S_point_project_simple(const H5S_t *base_space, H5S_t *new_space, hsize_t *off
/* Advance to next node */
base_node = base_node->next;
} /* end while */
+
+ /* Update the bounding box */
+ for(u = 0; u < rank_diff; u++) {
+ new_space->select.sel_info.pnt_lst->low_bounds[u] = 0;
+ new_space->select.sel_info.pnt_lst->high_bounds[u] = 0;
+ } /* end for */
+ for(; u < new_space->extent.rank; u++) {
+ new_space->select.sel_info.pnt_lst->low_bounds[u] = base_space->select.sel_info.pnt_lst->low_bounds[u - rank_diff];
+ new_space->select.sel_info.pnt_lst->high_bounds[u] = base_space->select.sel_info.pnt_lst->high_bounds[u - rank_diff];
+ } /* end for */
} /* end else */
/* Number of elements selected will be the same */
@@ -1559,7 +2226,7 @@ H5S_point_project_simple(const H5S_t *base_space, H5S_t *new_space, hsize_t *off
done:
FUNC_LEAVE_NOAPI(ret_value)
-} /* H5S_point_project_simple() */
+} /* end H5S__point_project_simple() */
/*--------------------------------------------------------------------------
@@ -1620,143 +2287,5 @@ H5Sselect_elements(hid_t spaceid, H5S_seloper_t op, size_t num_elem,
done:
FUNC_LEAVE_API(ret_value)
-} /* H5Sselect_elements() */
-
-
-/*--------------------------------------------------------------------------
- NAME
- H5S_point_get_seq_list
- PURPOSE
- Create a list of offsets & lengths for a selection
- USAGE
- herr_t H5S_point_get_seq_list(space,flags,iter,maxseq,maxelem,nseq,nelem,off,len)
- H5S_t *space; IN: Dataspace containing selection to use.
- unsigned flags; IN: Flags for extra information about operation
- H5S_sel_iter_t *iter; IN/OUT: Selection iterator describing last
- position of interest in selection.
- size_t maxseq; IN: Maximum number of sequences to generate
- size_t maxelem; IN: Maximum number of elements to include in the
- generated sequences
- size_t *nseq; OUT: Actual number of sequences generated
- size_t *nelem; OUT: Actual number of elements in sequences generated
- hsize_t *off; OUT: Array of offsets
- size_t *len; OUT: Array of lengths
- RETURNS
- Non-negative on success/Negative on failure.
- DESCRIPTION
- Use the selection in the dataspace to generate a list of byte offsets and
- lengths for the region(s) selected. Start/Restart from the position in the
- ITER parameter. The number of sequences generated is limited by the MAXSEQ
- parameter and the number of sequences actually generated is stored in the
- NSEQ parameter.
- GLOBAL VARIABLES
- COMMENTS, BUGS, ASSUMPTIONS
- EXAMPLES
- REVISION LOG
---------------------------------------------------------------------------*/
-static herr_t
-H5S_point_get_seq_list(const H5S_t *space, unsigned flags, H5S_sel_iter_t *iter,
- size_t maxseq, size_t maxelem, size_t *nseq, size_t *nelem,
- hsize_t *off, size_t *len)
-{
- size_t io_left; /* The number of bytes left in the selection */
- size_t start_io_left; /* The initial number of bytes left in the selection */
- H5S_pnt_node_t *node; /* Point node */
- hsize_t dims[H5O_LAYOUT_NDIMS]; /* Total size of memory buf */
- int ndims; /* Dimensionality of space*/
- hsize_t acc; /* Coordinate accumulator */
- hsize_t loc; /* Coordinate offset */
- size_t curr_seq; /* Current sequence being operated on */
- int i; /* Local index variable */
- herr_t ret_value=SUCCEED; /* return value */
-
- FUNC_ENTER_NOAPI_NOINIT
-
- /* Check args */
- HDassert(space);
- HDassert(iter);
- HDassert(maxseq > 0);
- HDassert(maxelem > 0);
- HDassert(nseq);
- HDassert(nelem);
- HDassert(off);
- HDassert(len);
-
- /* Choose the minimum number of bytes to sequence through */
- H5_CHECK_OVERFLOW(iter->elmt_left, hsize_t, size_t);
- start_io_left = io_left = (size_t)MIN(iter->elmt_left, maxelem);
-
- /* Get the dataspace dimensions */
- if((ndims = H5S_get_simple_extent_dims (space, dims, NULL)) < 0)
- HGOTO_ERROR(H5E_DATASPACE, H5E_CANTINIT, FAIL, "unable to retrieve dataspace dimensions")
-
- /* Walk through the points in the selection, starting at the current */
- /* location in the iterator */
- node = iter->u.pnt.curr;
- curr_seq = 0;
- while(NULL != node) {
- /* Compute the offset of each selected point in the buffer */
- for(i = ndims - 1, acc = iter->elmt_size, loc = 0; i >= 0; i--) {
- loc += (hsize_t)((hssize_t)node->pnt[i] + space->select.offset[i]) * acc;
- acc *= dims[i];
- } /* end for */
-
- /* Check if this is a later point in the selection */
- if(curr_seq>0) {
- /* If a sorted sequence is requested, make certain we don't go backwards in the offset */
- if((flags&H5S_GET_SEQ_LIST_SORTED) && loc<off[curr_seq-1])
- break;
-
- /* Check if this point extends the previous sequence */
- /* (Unlikely, but possible) */
- if(loc==(off[curr_seq-1]+len[curr_seq-1])) {
- /* Extend the previous sequence */
- len[curr_seq-1]+=iter->elmt_size;
- } /* end if */
- else {
- /* Add a new sequence */
- off[curr_seq]=loc;
- len[curr_seq]=iter->elmt_size;
-
- /* Increment sequence count */
- curr_seq++;
- } /* end else */
- } /* end if */
- else {
- /* Add a new sequence */
- off[curr_seq]=loc;
- len[curr_seq]=iter->elmt_size;
-
- /* Increment sequence count */
- curr_seq++;
- } /* end else */
-
- /* Decrement number of elements left to process */
- io_left--;
-
- /* Move the iterator */
- iter->u.pnt.curr=node->next;
- iter->elmt_left--;
-
- /* Check if we're finished with all sequences */
- if(curr_seq==maxseq)
- break;
-
- /* Check if we're finished with all the elements available */
- if(io_left==0)
- break;
-
- /* Advance to the next point */
- node=node->next;
- } /* end while */
-
- /* Set the number of sequences generated */
- *nseq=curr_seq;
-
- /* Set the number of elements used */
- *nelem=start_io_left-io_left;
-
-done:
- FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5S_point_get_seq_list() */
+} /* end H5Sselect_elements() */
diff --git a/src/H5Sprivate.h b/src/H5Sprivate.h
index 32ac51a..6646f84 100644
--- a/src/H5Sprivate.h
+++ b/src/H5Sprivate.h
@@ -17,9 +17,6 @@
#ifndef _H5Sprivate_H
#define _H5Sprivate_H
-/* Early typedefs to avoid circular dependencies */
-typedef struct H5S_t H5S_t;
-
/* Include package's public header */
#include "H5Spublic.h"
@@ -30,7 +27,6 @@ typedef struct H5S_t H5S_t;
#include "H5private.h" /* Generic Functions */
#include "H5Fprivate.h" /* Files */
#include "H5Gprivate.h" /* Groups */
-#include "H5Oprivate.h" /* Object headers */
#include "H5Pprivate.h" /* Property lists */
#include "H5Tprivate.h" /* Datatypes */
@@ -43,12 +39,10 @@ typedef struct H5S_t H5S_t;
#define H5S_CONV_STORAGE_CHUNKED 0x0004 /* i.e. '2' */
#define H5S_CONV_STORAGE_MASK 0x0006
-/* Flags for "get_seq_list" methods */
-#define H5S_GET_SEQ_LIST_SORTED 0x0001
-
/* Forward references of package typedefs */
typedef struct H5S_extent_t H5S_extent_t;
typedef struct H5S_pnt_node_t H5S_pnt_node_t;
+typedef struct H5S_pnt_list_t H5S_pnt_list_t;
typedef struct H5S_hyper_span_t H5S_hyper_span_t;
typedef struct H5S_hyper_span_info_t H5S_hyper_span_info_t;
@@ -62,20 +56,22 @@ typedef struct H5S_hyper_dim_t {
/* Point selection iteration container */
typedef struct {
- H5S_pnt_node_t *curr; /* Pointer to next node to output */
+ H5S_pnt_list_t *pnt_lst; /* Pointer to point list */
+ H5S_pnt_node_t *curr; /* Pointer to next node to output */
} H5S_point_iter_t;
/* Hyperslab selection iteration container */
typedef struct {
/* Common fields for all hyperslab selections */
- hsize_t off[H5S_MAX_RANK]; /* Offset in span node (used as position for regular hyperslabs) */
+ hsize_t off[H5S_MAX_RANK]; /* Offset in span node (used as position for regular hyperslabs) */
+ hsize_t slab[H5S_MAX_RANK]; /* Cumulative size of each dimension in bytes */
unsigned iter_rank; /* Rank of iterator information */
/* (This should always be the same as the dataspace
- * rank, except for regular hyperslab selections in
- * which there are contiguous regions in the lower
- * dimensions which have been "flattened" out
+ * rank, except for regular hyperslab selections in
+ * which there are contiguous regions in the lower
+ * dimensions that have been "flattened")
*/
- hbool_t diminfo_valid; /* Whether the dimension information is valid */
+ hbool_t diminfo_valid; /* Whether the dimension information is valid */
/* "Flattened" regular hyperslab selection fields */
H5S_hyper_dim_t diminfo[H5S_MAX_RANK]; /* "Flattened" regular selection information */
@@ -84,6 +80,7 @@ typedef struct {
hbool_t flattened[H5S_MAX_RANK]; /* Whether this dimension has been flattened */
/* Irregular hyperslab selection fields */
+ hsize_t loc_off[H5S_MAX_RANK]; /* Byte offset in buffer, for each dimension's current offset */
H5S_hyper_span_info_t *spans; /* Pointer to copy of the span tree */
H5S_hyper_span_t *span[H5S_MAX_RANK];/* Array of pointers to span nodes */
} H5S_hyper_iter_t;
@@ -104,9 +101,11 @@ typedef struct H5S_sel_iter_t {
/* Information common to all iterators */
unsigned rank; /* Rank of dataspace the selection iterator is operating on */
- hsize_t *dims; /* Dimensions of dataspace the selection is operating on */
+ hsize_t dims[H5S_MAX_RANK]; /* Dimensions of dataspace the selection is operating on */
+ hssize_t sel_off[H5S_MAX_RANK]; /* Selection offset in dataspace */
hsize_t elmt_left; /* Number of elements left to iterate over */
size_t elmt_size; /* Size of elements to iterate over */
+ unsigned flags; /* Flags controlling iterator behavior */
/* Information specific to each type of iterator */
union {
@@ -146,7 +145,6 @@ typedef struct H5S_sel_iter_op_t {
#define H5S_GET_EXTENT_NPOINTS(S) ((S)->extent.nelem)
#define H5S_GET_SELECT_NPOINTS(S) ((S)->select.num_elem)
#define H5S_GET_SELECT_TYPE(S) ((S)->select.type->type)
-#define H5S_SELECT_GET_SEQ_LIST(S,FLAGS,ITER,MAXSEQ,MAXBYTES,NSEQ,NBYTES,OFF,LEN) ((*(S)->select.type->get_seq_list)(S,FLAGS,ITER,MAXSEQ,MAXBYTES,NSEQ,NBYTES,OFF,LEN))
#define H5S_SELECT_VALID(S) ((*(S)->select.type->is_valid)(S))
#define H5S_SELECT_SERIAL_SIZE(S) ((*(S)->select.type->serial_size)(S))
#define H5S_SELECT_SERIALIZE(S,BUF) ((*(S)->select.type->serialize)(S,BUF))
@@ -164,6 +162,7 @@ typedef struct H5S_sel_iter_op_t {
#define H5S_SELECT_ITER_HAS_NEXT_BLOCK(ITER) ((*(ITER)->type->iter_has_next_block)(ITER))
#define H5S_SELECT_ITER_NEXT(ITER,NELEM)((*(ITER)->type->iter_next)(ITER,NELEM))
#define H5S_SELECT_ITER_NEXT_BLOCK(ITER) ((*(ITER)->type->iter_next_block)(ITER))
+#define H5S_SELECT_ITER_GET_SEQ_LIST(ITER,MAXSEQ,MAXBYTES,NSEQ,NBYTES,OFF,LEN) ((*(ITER)->type->iter_get_seq_list)(ITER,MAXSEQ,MAXBYTES,NSEQ,NBYTES,OFF,LEN))
#define H5S_SELECT_ITER_RELEASE(ITER) ((*(ITER)->type->iter_release)(ITER))
#else /* H5S_MODULE */
#define H5S_GET_EXTENT_TYPE(S) (H5S_get_simple_extent_type(S))
@@ -171,7 +170,6 @@ typedef struct H5S_sel_iter_op_t {
#define H5S_GET_EXTENT_NPOINTS(S) (H5S_get_simple_extent_npoints(S))
#define H5S_GET_SELECT_NPOINTS(S) (H5S_get_select_npoints(S))
#define H5S_GET_SELECT_TYPE(S) (H5S_get_select_type(S))
-#define H5S_SELECT_GET_SEQ_LIST(S,FLAGS,ITER,MAXSEQ,MAXBYTES,NSEQ,NBYTES,OFF,LEN) (H5S_select_get_seq_list(S,FLAGS,ITER,MAXSEQ,MAXBYTES,NSEQ,NBYTES,OFF,LEN))
#define H5S_SELECT_VALID(S) (H5S_select_valid(S))
#define H5S_SELECT_SERIAL_SIZE(S) (H5S_select_serial_size(S))
#define H5S_SELECT_SERIALIZE(S,BUF) (H5S_select_serialize(S,BUF))
@@ -189,6 +187,7 @@ typedef struct H5S_sel_iter_op_t {
#define H5S_SELECT_ITER_HAS_NEXT_BLOCK(ITER) (H5S_select_iter_has_next_block(ITER))
#define H5S_SELECT_ITER_NEXT(ITER,NELEM)(H5S_select_iter_next(ITER,NELEM))
#define H5S_SELECT_ITER_NEXT_BLOCK(ITER) (H5S_select_iter_next_block(ITER))
+#define H5S_SELECT_ITER_GET_SEQ_LIST(ITER,MAXSEQ,MAXBYTES,NSEQ,NBYTES,OFF,LEN) (H5S_select_iter_get_seq_list(ITER,MAXSEQ,MAXBYTES,NSEQ,NBYTES,OFF,LEN))
#define H5S_SELECT_ITER_RELEASE(ITER) (H5S_select_iter_release(ITER))
#endif /* H5S_MODULE */
/* Handle these callbacks in a special way, since they have prologs that need to be executed */
@@ -196,6 +195,12 @@ typedef struct H5S_sel_iter_op_t {
#define H5S_SELECT_RELEASE(S) (H5S_select_release(S))
#define H5S_SELECT_DESERIALIZE(S,BUF) (H5S_select_deserialize(S,BUF))
+/* Forward declaration of structs used below */
+struct H5O_t;
+struct H5O_loc_t;
+
+/* Early typedef to avoid circular dependencies */
+typedef struct H5S_t H5S_t;
/* Operations on dataspaces */
H5_DLL H5S_t *H5S_copy(const H5S_t *src, hbool_t share_selection, hbool_t copy_max);
@@ -207,7 +212,7 @@ H5_DLL hbool_t H5S_has_extent(const H5S_t *ds);
H5_DLL int H5S_get_simple_extent_ndims(const H5S_t *ds);
H5_DLL int H5S_get_simple_extent_dims(const H5S_t *ds, hsize_t dims[]/*out*/,
hsize_t max_dims[]/*out*/);
-H5_DLL herr_t H5S_write(H5F_t *f, H5O_t *oh, unsigned update_flags, H5S_t *ds);
+H5_DLL herr_t H5S_write(H5F_t *f, struct H5O_t *oh, unsigned update_flags, H5S_t *ds);
H5_DLL herr_t H5S_append(H5F_t *f, struct H5O_t *oh, H5S_t *ds);
H5_DLL H5S_t *H5S_read(const struct H5O_loc_t *loc);
H5_DLL htri_t H5S_set_extent(H5S_t *space, const hsize_t *size);
@@ -251,9 +256,6 @@ H5_DLL herr_t H5S_select_construct_projection(const H5S_t *base_space,
H5S_t **new_space_ptr, unsigned new_space_rank, const void *buf,
void const **adj_buf_ptr, hsize_t element_size);
H5_DLL herr_t H5S_select_release(H5S_t *ds);
-H5_DLL herr_t H5S_select_get_seq_list(const H5S_t *space, unsigned flags,
- H5S_sel_iter_t *iter, size_t maxseq, size_t maxbytes,
- size_t *nseq, size_t *nbytes, hsize_t *off, size_t *len);
H5_DLL hssize_t H5S_select_serial_size(const H5S_t *space);
H5_DLL herr_t H5S_select_serialize(const H5S_t *space, uint8_t **p);
H5_DLL htri_t H5S_select_is_contiguous(const H5S_t *space);
@@ -280,13 +282,11 @@ H5_DLL herr_t H5S_select_elements(H5S_t *space, H5S_seloper_t op,
/* Operations on hyperslab selections */
H5_DLL herr_t H5S_select_hyperslab(H5S_t *space, H5S_seloper_t op, const hsize_t start[],
const hsize_t *stride, const hsize_t count[], const hsize_t *block);
+H5_DLL herr_t H5S_combine_hyperslab(H5S_t *old_space, H5S_seloper_t op,
+ const hsize_t start[], const hsize_t *stride, const hsize_t count[],
+ const hsize_t *block, H5S_t **new_space);
H5_DLL herr_t H5S_hyper_add_span_element(H5S_t *space, unsigned rank,
const hsize_t *coords);
-H5_DLL herr_t H5S_hyper_reset_scratch(H5S_t *space);
-H5_DLL herr_t H5S_hyper_convert(H5S_t *space);
-#ifdef LATER
-H5_DLL htri_t H5S_hyper_intersect (H5S_t *space1, H5S_t *space2);
-#endif /* LATER */
H5_DLL htri_t H5S_hyper_intersect_block(H5S_t *space, const hsize_t *start, const hsize_t *end);
H5_DLL herr_t H5S_hyper_adjust_s(H5S_t *space, const hssize_t *offset);
H5_DLL htri_t H5S_hyper_normalize_offset(H5S_t *space, hssize_t *old_offset);
@@ -302,11 +302,15 @@ H5_DLL hsize_t H5S_hyper_get_first_inc_block(const H5S_t *space,
hsize_t clip_size, hbool_t *partial);
/* Operations on selection iterators */
-H5_DLL herr_t H5S_select_iter_init(H5S_sel_iter_t *iter, const H5S_t *space, size_t elmt_size);
+H5_DLL herr_t H5S_select_iter_init(H5S_sel_iter_t *iter, const H5S_t *space,
+ size_t elmt_size, unsigned flags);
H5_DLL herr_t H5S_select_iter_coords(const H5S_sel_iter_t *sel_iter, hsize_t *coords);
H5_DLL hsize_t H5S_select_iter_nelmts(const H5S_sel_iter_t *sel_iter);
H5_DLL herr_t H5S_select_iter_next(H5S_sel_iter_t *sel_iter, size_t nelem);
+H5_DLL herr_t H5S_select_iter_get_seq_list(H5S_sel_iter_t *iter, size_t maxseq,
+ size_t maxbytes, size_t *nseq, size_t *nbytes, hsize_t *off, size_t *len);
H5_DLL herr_t H5S_select_iter_release(H5S_sel_iter_t *sel_iter);
+H5_DLL herr_t H5S_sel_iter_close(H5S_sel_iter_t *sel_iter);
#ifdef H5_HAVE_PARALLEL
H5_DLL hsize_t H5S_mpio_set_bigio_count(hsize_t new_count);
@@ -314,7 +318,7 @@ H5_DLL herr_t H5S_mpio_space_type(const H5S_t *space, size_t elmt_size,
/* out: */ MPI_Datatype *new_type,
int *count,
hbool_t *is_derived_type,
- hbool_t do_permute,
+ hbool_t do_permute,
hsize_t **permute_map,
hbool_t * is_permuted);
#endif /* H5_HAVE_PARALLEL */
diff --git a/src/H5Spublic.h b/src/H5Spublic.h
index d7a5d29..23e6846 100644
--- a/src/H5Spublic.h
+++ b/src/H5Spublic.h
@@ -28,6 +28,35 @@
/* Define user-level maximum number of dimensions */
#define H5S_MAX_RANK 32
+/* Flags for selection iterators */
+#define H5S_SEL_ITER_GET_SEQ_LIST_SORTED 0x0001 /* Retrieve elements from iterator
+ * in increasing offset order, for
+ * each call to retrieve sequences.
+ * Currently, this only applies to
+ * point selections, as hyperslab
+ * selections are always returned
+ * in increasing offset order.
+ *
+ * Note that the order is only
+ * increasing for each call to
+ * get_seq_list, the next set of
+ * sequences could start with an
+ * earlier offset than the previous
+ * one.
+ */
+#define H5S_SEL_ITER_SHARE_WITH_DATASPACE 0x0002 /* Don't copy the dataspace
+ * selection when creating the
+ * selection iterator.
+ *
+ * This can improve performance
+ * of creating the iterator, but
+ * the dataspace _MUST_NOT_ be
+ * modified or closed until the
+ * selection iterator is closed
+ * or the iterator's behavior
+ * will be undefined.
+ */
+
/* Different types of dataspaces */
typedef enum H5S_class_t {
H5S_NO_CLASS = -1, /*error */
@@ -79,75 +108,81 @@ typedef enum H5S_seloper_t {
typedef enum {
H5S_SEL_ERROR = -1, /* Error */
H5S_SEL_NONE = 0, /* Nothing selected */
- H5S_SEL_POINTS = 1, /* Sequence of points selected */
- H5S_SEL_HYPERSLABS = 2, /* "New-style" hyperslab selection defined */
+ H5S_SEL_POINTS = 1, /* Points / elements selected */
+ H5S_SEL_HYPERSLABS = 2, /* Hyperslab selected */
H5S_SEL_ALL = 3, /* Entire extent selected */
H5S_SEL_N /*THIS MUST BE LAST */
-}H5S_sel_type;
+} H5S_sel_type;
#ifdef __cplusplus
extern "C" {
#endif
-/* Functions in H5S.c */
+/* Operations on dataspaces */
H5_DLL hid_t H5Screate(H5S_class_t type);
H5_DLL hid_t H5Screate_simple(int rank, const hsize_t dims[],
- const hsize_t maxdims[]);
+ const hsize_t maxdims[]);
H5_DLL herr_t H5Sset_extent_simple(hid_t space_id, int rank,
- const hsize_t dims[],
- const hsize_t max[]);
+ const hsize_t dims[], const hsize_t max[]);
H5_DLL hid_t H5Scopy(hid_t space_id);
H5_DLL herr_t H5Sclose(hid_t space_id);
-H5_DLL herr_t H5Sencode(hid_t obj_id, void *buf, size_t *nalloc);
+H5_DLL herr_t H5Sencode2(hid_t obj_id, void *buf, size_t *nalloc, hid_t fapl);
H5_DLL hid_t H5Sdecode(const void *buf);
H5_DLL hssize_t H5Sget_simple_extent_npoints(hid_t space_id);
H5_DLL int H5Sget_simple_extent_ndims(hid_t space_id);
H5_DLL int H5Sget_simple_extent_dims(hid_t space_id, hsize_t dims[],
- hsize_t maxdims[]);
+ hsize_t maxdims[]);
H5_DLL htri_t H5Sis_simple(hid_t space_id);
-H5_DLL hssize_t H5Sget_select_npoints(hid_t spaceid);
-H5_DLL herr_t H5Sselect_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[]);
-/* #define NEW_HYPERSLAB_API */
-/* Note that these haven't been working for a while and were never
- * publicly released - QAK */
-#ifdef NEW_HYPERSLAB_API
-H5_DLL 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,
- hid_t space2_id);
-H5_DLL hid_t H5Scombine_select(hid_t space1_id, H5S_seloper_t op,
- hid_t space2_id);
-#endif /* NEW_HYPERSLAB_API */
-H5_DLL herr_t H5Sselect_elements(hid_t space_id, H5S_seloper_t op,
- size_t num_elem, const hsize_t *coord);
H5_DLL H5S_class_t H5Sget_simple_extent_type(hid_t space_id);
H5_DLL herr_t H5Sset_extent_none(hid_t space_id);
H5_DLL herr_t H5Sextent_copy(hid_t dst_id,hid_t src_id);
H5_DLL htri_t H5Sextent_equal(hid_t sid1, hid_t sid2);
+
+/* Operations on dataspace selections */
+H5_DLL H5S_sel_type H5Sget_select_type(hid_t spaceid);
+H5_DLL hssize_t H5Sget_select_npoints(hid_t spaceid);
H5_DLL herr_t H5Sselect_copy(hid_t dst_id, hid_t src_id);
+H5_DLL htri_t H5Sselect_valid(hid_t spaceid);
+H5_DLL herr_t H5Sget_select_bounds(hid_t spaceid, hsize_t start[],
+ hsize_t end[]);
+H5_DLL herr_t H5Soffset_simple(hid_t space_id, const hssize_t *offset);
H5_DLL herr_t H5Sselect_all(hid_t spaceid);
H5_DLL herr_t H5Sselect_none(hid_t spaceid);
-H5_DLL herr_t H5Soffset_simple(hid_t space_id, const hssize_t *offset);
-H5_DLL htri_t H5Sselect_valid(hid_t spaceid);
+H5_DLL herr_t H5Sselect_elements(hid_t space_id, H5S_seloper_t op,
+ size_t num_elem, const hsize_t *coord);
+H5_DLL hssize_t H5Sget_select_elem_npoints(hid_t spaceid);
+H5_DLL herr_t H5Sget_select_elem_pointlist(hid_t spaceid, hsize_t startpoint,
+ hsize_t numpoints, hsize_t buf[/*numpoints*/]);
+H5_DLL herr_t H5Sselect_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 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 H5Smodify_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 space2_id);
H5_DLL htri_t H5Sis_regular_hyperslab(hid_t spaceid);
H5_DLL htri_t H5Sget_regular_hyperslab(hid_t spaceid, hsize_t start[],
hsize_t stride[], hsize_t count[], hsize_t block[]);
H5_DLL hssize_t H5Sget_select_hyper_nblocks(hid_t spaceid);
-H5_DLL hssize_t H5Sget_select_elem_npoints(hid_t spaceid);
H5_DLL herr_t H5Sget_select_hyper_blocklist(hid_t spaceid, hsize_t startblock,
hsize_t numblocks, hsize_t buf[/*numblocks*/]);
-H5_DLL herr_t H5Sget_select_elem_pointlist(hid_t spaceid, hsize_t startpoint,
- hsize_t numpoints, hsize_t buf[/*numpoints*/]);
-H5_DLL herr_t H5Sget_select_bounds(hid_t spaceid, hsize_t start[],
- hsize_t end[]);
-H5_DLL H5S_sel_type H5Sget_select_type(hid_t spaceid);
+
+/* Operations on dataspace selection iterators */
+H5_DLL hid_t H5Ssel_iter_create(hid_t spaceid, size_t elmt_size, unsigned flags);
+H5_DLL herr_t H5Ssel_iter_get_seq_list(hid_t sel_iter_id, size_t maxseq,
+ size_t maxbytes, size_t *nseq, size_t *nbytes, hsize_t *off, size_t *len);
+H5_DLL herr_t H5Ssel_iter_close(hid_t sel_iter_id);
+
+/* Symbols defined for compatibility with previous versions of the HDF5 API.
+ *
+ * Use of these symbols is deprecated.
+ */
+#ifndef H5_NO_DEPRECATED_SYMBOLS
+/* Function prototypes */
+H5_DLL herr_t H5Sencode1(hid_t obj_id, void *buf, size_t *nalloc);
+
+#endif /* H5_NO_DEPRECATED_SYMBOLS */
#ifdef __cplusplus
}
diff --git a/src/H5Sselect.c b/src/H5Sselect.c
index 6e6ca76..fdd897c 100644
--- a/src/H5Sselect.c
+++ b/src/H5Sselect.c
@@ -17,26 +17,59 @@
* Purpose: Dataspace selection functions.
*/
+/****************/
+/* Module Setup */
+/****************/
+
#include "H5Smodule.h" /* This source code file is part of the H5S module */
+/***********/
+/* Headers */
+/***********/
#include "H5private.h" /* Generic Functions */
#include "H5Dprivate.h" /* Datasets */
#include "H5Eprivate.h" /* Error handling */
#include "H5FLprivate.h" /* Free Lists */
#include "H5Iprivate.h" /* IDs */
-#include "H5MMprivate.h" /* Memory management */
#include "H5Spkg.h" /* Dataspaces */
-#include "H5VMprivate.h" /* Vector and array functions */
-#include "H5WBprivate.h" /* Wrapped Buffers */
+#include "H5VMprivate.h" /* Vector and array functions */
+
+
+/****************/
+/* Local Macros */
+/****************/
+
+/* All the valid public flags to H5Ssel_iter_create() */
+#define H5S_SEL_ITER_ALL_PUBLIC_FLAGS (H5S_SEL_ITER_GET_SEQ_LIST_SORTED | \
+ H5S_SEL_ITER_SHARE_WITH_DATASPACE)
+
+
+/******************/
+/* Local Typedefs */
+/******************/
+
+
+/********************/
+/* Local Prototypes */
+/********************/
-/* Local functions */
#ifdef LATER
static herr_t H5S_select_iter_block(const H5S_sel_iter_t *iter, hsize_t *start, hsize_t *end);
static htri_t H5S_select_iter_has_next_block(const H5S_sel_iter_t *iter);
static herr_t H5S_select_iter_next_block(H5S_sel_iter_t *iter);
#endif /* LATER */
+
+/*****************************/
+/* Library Private Variables */
+/*****************************/
+
+
+/*********************/
+/* Package Variables */
+/*********************/
+
/* Declare a free list to manage the H5S_sel_iter_t struct */
H5FL_DEFINE(H5S_sel_iter_t);
@@ -47,6 +80,11 @@ H5FL_SEQ_EXTERN(size_t);
H5FL_SEQ_EXTERN(hsize_t);
+/*******************/
+/* Local Variables */
+/*******************/
+
+
/*--------------------------------------------------------------------------
NAME
@@ -78,13 +116,56 @@ H5S_select_offset(H5S_t *space, const hssize_t *offset)
HDassert(offset);
/* Copy the offset over */
- HDmemcpy(space->select.offset, offset, sizeof(hssize_t)*space->extent.rank);
+ H5MM_memcpy(space->select.offset, offset, sizeof(hssize_t) * space->extent.rank);
/* Indicate that the offset was changed */
space->select.offset_changed = TRUE;
FUNC_LEAVE_NOAPI(SUCCEED)
-} /* H5S_select_offset() */
+} /* end H5S_select_offset() */
+
+
+/*--------------------------------------------------------------------------
+ NAME
+ H5Soffset_simple
+ PURPOSE
+ Changes the offset of a selection within a simple dataspace extent
+ USAGE
+ herr_t H5Soffset_simple(space_id, offset)
+ hid_t space_id; IN: Dataspace object to reset
+ const hssize_t *offset; IN: Offset to position the selection at
+ RETURNS
+ Non-negative on success/Negative on failure
+ DESCRIPTION
+ This function creates an offset for the selection within an extent, allowing
+ the same shaped selection to be moved to different locations within a
+ dataspace without requiring it to be re-defined.
+--------------------------------------------------------------------------*/
+herr_t
+H5Soffset_simple(hid_t space_id, const hssize_t *offset)
+{
+ H5S_t *space; /* Dataspace to query */
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_API(FAIL)
+ H5TRACE2("e", "i*Hs", space_id, offset);
+
+ /* Check args */
+ if(NULL == (space = (H5S_t *)H5I_object_verify(space_id, H5I_DATASPACE)))
+ HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "not a dataspace")
+ if(space->extent.rank == 0 || (H5S_GET_EXTENT_TYPE(space) == H5S_SCALAR
+ || H5S_GET_EXTENT_TYPE(space) == H5S_NULL))
+ HGOTO_ERROR(H5E_ATOM, H5E_UNSUPPORTED, FAIL, "can't set offset on scalar or null dataspace")
+ if(offset == NULL)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no offset specified")
+
+ /* Set the selection offset */
+ if(H5S_select_offset(space, offset) < 0)
+ HGOTO_ERROR(H5E_DATASPACE, H5E_CANTINIT, FAIL, "can't set offset")
+
+done:
+ FUNC_LEAVE_API(ret_value)
+} /* end H5Soffset_simple() */
/*--------------------------------------------------------------------------
@@ -139,9 +220,10 @@ done:
PURPOSE
Copy a selection from one dataspace to another
USAGE
- herr_t H5S_select_copy(dst, src)
+ herr_t H5S_select_copy(dst, src, share_selection)
H5S_t *dst; OUT: Pointer to the destination dataspace
H5S_t *src; IN: Pointer to the source dataspace
+ hbool_t; IN: Whether to share the selection between the dataspaces
RETURNS
Non-negative on success/Negative on failure
DESCRIPTION
@@ -177,7 +259,7 @@ H5S_select_copy(H5S_t *dst, const H5S_t *src, hbool_t share_selection)
done:
FUNC_LEAVE_NOAPI(ret_value)
-} /* H5S_select_copy() */
+} /* end H5S_select_copy() */
/*-------------------------------------------------------------------------
@@ -211,44 +293,7 @@ H5S_select_release(H5S_t *ds)
done:
FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5S_select_release() */
-
-
-/*-------------------------------------------------------------------------
- * Function: H5S_select_get_seq_list
- *
- * Purpose: Retrieves the next sequence of offset/length pairs for an
- * iterator on a dataspace
- *
- * Return: Non-negative on success/Negative on failure
- *
- * Programmer: Quincey Koziol
- * Tuesday, May 18, 2004
- *
- * Note: This routine participates in the "Inlining C function pointers"
- * pattern, don't call it directly, use the appropriate macro
- * defined in H5Sprivate.h.
- *
- *-------------------------------------------------------------------------
- */
-herr_t
-H5S_select_get_seq_list(const H5S_t *space, unsigned flags,
- H5S_sel_iter_t *iter, size_t maxseq, size_t maxbytes,
- size_t *nseq, size_t *nbytes, hsize_t *off, size_t *len)
-{
- herr_t ret_value = FAIL; /* Return value */
-
- FUNC_ENTER_NOAPI_NOINIT
-
- HDassert(space);
-
- /* Call the selection type's get_seq_list function */
- if((ret_value = (*space->select.type->get_seq_list)(space, flags, iter, maxseq, maxbytes, nseq, nbytes, off, len)) < 0)
- HGOTO_ERROR(H5E_DATASPACE, H5E_CANTGET, FAIL, "unable to get selection sequence list")
-
-done:
- FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5S_select_get_seq_list() */
+} /* end H5S_select_release() */
/*-------------------------------------------------------------------------
@@ -278,10 +323,10 @@ H5S_select_serial_size(const H5S_t *space)
HDassert(space);
/* Call the selection type's serial_size function */
- ret_value=(*space->select.type->serial_size)(space);
+ ret_value = (*space->select.type->serial_size)(space);
FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5S_select_serial_size() */
+} /* end H5S_select_serial_size() */
/*--------------------------------------------------------------------------
@@ -311,7 +356,7 @@ H5S_select_serial_size(const H5S_t *space)
herr_t
H5S_select_serialize(const H5S_t *space, uint8_t **p)
{
- herr_t ret_value=SUCCEED; /* Return value */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI_NOINIT_NOERR
@@ -319,10 +364,10 @@ H5S_select_serialize(const H5S_t *space, uint8_t **p)
HDassert(p);
/* Call the selection type's serialize function */
- ret_value=(*space->select.type->serialize)(space,p);
+ ret_value = (*space->select.type->serialize)(space, p);
FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5S_select_serialize() */
+} /* end H5S_select_serialize() */
/*--------------------------------------------------------------------------
@@ -359,7 +404,7 @@ H5Sget_select_npoints(hid_t spaceid)
done:
FUNC_LEAVE_API(ret_value)
-} /* H5Sget_select_npoints() */
+} /* H5Sget_select_npoints() */
/*--------------------------------------------------------------------------
@@ -382,7 +427,7 @@ done:
EXAMPLES
REVISION LOG
--------------------------------------------------------------------------*/
-hssize_t
+H5_ATTR_PURE hssize_t
H5S_get_select_npoints(const H5S_t *space)
{
FUNC_ENTER_NOAPI_NOINIT_NOERR
@@ -391,7 +436,7 @@ H5S_get_select_npoints(const H5S_t *space)
HDassert(space);
FUNC_LEAVE_NOAPI((hssize_t)space->select.num_elem)
-} /* H5S_get_select_npoints() */
+} /* end H5S_get_select_npoints() */
/*--------------------------------------------------------------------------
@@ -413,8 +458,6 @@ H5S_get_select_npoints(const H5S_t *space)
COMMENTS, BUGS, ASSUMPTIONS
EXAMPLES
REVISION LOG
- Christian Chilan 01/17/2007
- Changed the error return value from 0 to FAIL.
--------------------------------------------------------------------------*/
htri_t
H5Sselect_valid(hid_t spaceid)
@@ -433,7 +476,7 @@ H5Sselect_valid(hid_t spaceid)
done:
FUNC_LEAVE_API(ret_value)
-} /* H5Sselect_valid() */
+} /* end H5Sselect_valid() */
/*--------------------------------------------------------------------------
@@ -471,7 +514,7 @@ H5S_select_valid(const H5S_t *space)
ret_value = (*space->select.type->is_valid)(space);
FUNC_LEAVE_NOAPI(ret_value)
-} /* H5S_select_valid() */
+} /* end H5S_select_valid() */
/*--------------------------------------------------------------------------
@@ -503,103 +546,46 @@ H5S_select_valid(const H5S_t *space)
herr_t
H5S_select_deserialize(H5S_t **space, const uint8_t **p)
{
- H5S_t *tmp_space = NULL; /* Pointer to actual dataspace to use, either
- *space or a newly allocated one */
uint32_t sel_type; /* Pointer to the selection type */
- uint32_t version; /* Version number */
- uint8_t flags = 0; /* Flags */
herr_t ret_value = FAIL; /* Return value */
FUNC_ENTER_NOAPI(FAIL)
HDassert(space);
- /* Allocate space if not provided */
- if(!*space) {
- if(NULL == (tmp_space = H5S_create(H5S_SIMPLE)))
- HGOTO_ERROR(H5E_DATASPACE, H5E_CANTCREATE, FAIL, "can't create dataspace")
- } /* end if */
- else
- tmp_space = *space;
+ /* Selection-type specific coding is moved to the callbacks. */
/* Decode selection type */
UINT32DECODE(*p, sel_type);
- /* Decode version */
- UINT32DECODE(*p, version);
-
- if(version >= (uint32_t)2) {
- /* Decode flags */
- flags = *(*p)++;
-
- /* Check for unknown flags */
- if(flags & ~H5S_SELECT_FLAG_BITS)
- HGOTO_ERROR(H5E_DATASPACE, H5E_CANTLOAD, FAIL, "unknown flag for selection")
-
- /* Skip over the remainder of the header */
- *p += 4;
- } /* end if */
- else
- /* Skip over the remainder of the header */
- *p += 8;
-
- /* Decode and check or patch rank for point and hyperslab selections */
- if((sel_type == H5S_SEL_POINTS) || (sel_type == H5S_SEL_HYPERSLABS)) {
- uint32_t rank; /* Rank of dataspace */
-
- /* Decode the rank of the point selection */
- UINT32DECODE(*p,rank);
-
- if(!*space) {
- hsize_t dims[H5S_MAX_RANK];
-
- /* Patch the rank of the allocated dataspace */
- (void)HDmemset(dims, 0, (size_t)rank * sizeof(dims[0]));
- if(H5S_set_extent_simple(tmp_space, rank, dims, NULL) < 0)
- HGOTO_ERROR(H5E_DATASPACE, H5E_CANTINIT, FAIL, "can't set dimensions")
- } /* end if */
- else
- /* Verify the rank of the provided dataspace */
- if(rank != tmp_space->extent.rank)
- HGOTO_ERROR(H5E_DATASPACE, H5E_BADRANGE, FAIL, "rank of serialized selection does not match dataspace")
- } /* end if */
-
/* Make routine for selection type */
switch(sel_type) {
case H5S_SEL_POINTS: /* Sequence of points selected */
- ret_value = (*H5S_sel_point->deserialize)(tmp_space, version, flags, p);
+ ret_value = (*H5S_sel_point->deserialize)(space, p);
break;
case H5S_SEL_HYPERSLABS: /* Hyperslab selection defined */
- ret_value = (*H5S_sel_hyper->deserialize)(tmp_space, version, flags, p);
+ ret_value = (*H5S_sel_hyper->deserialize)(space, p);
break;
case H5S_SEL_ALL: /* Entire extent selected */
- ret_value = (*H5S_sel_all->deserialize)(tmp_space, version, flags, p);
+ ret_value = (*H5S_sel_all->deserialize)(space, p);
break;
case H5S_SEL_NONE: /* Nothing selected */
- ret_value = (*H5S_sel_none->deserialize)(tmp_space, version, flags, p);
+ ret_value = (*H5S_sel_none->deserialize)(space, p);
break;
default:
break;
- }
+ } /* end switch */
+
if(ret_value < 0)
HGOTO_ERROR(H5E_DATASPACE, H5E_CANTLOAD, FAIL, "can't deserialize selection")
- /* Return space to the caller if allocated */
- if(!*space)
- *space = tmp_space;
-
done:
- /* Free temporary space if not passed to caller (only happens on error) */
- if(!*space && tmp_space)
- if(H5S_close(tmp_space) < 0)
- HDONE_ERROR(H5E_DATASPACE, H5E_CANTFREE, FAIL, "can't close dataspace")
-
FUNC_LEAVE_NOAPI(ret_value)
-} /* H5S_select_deserialize() */
+} /* end H5S_select_deserialize() */
/*--------------------------------------------------------------------------
@@ -651,7 +637,7 @@ H5Sget_select_bounds(hid_t spaceid, hsize_t start[], hsize_t end[])
done:
FUNC_LEAVE_API(ret_value)
-} /* H5Sget_select_bounds() */
+} /* end H5Sget_select_bounds() */
/*--------------------------------------------------------------------------
@@ -693,10 +679,10 @@ H5S_get_select_bounds(const H5S_t *space, hsize_t *start, hsize_t *end)
HDassert(start);
HDassert(end);
- ret_value = (*space->select.type->bounds)(space,start,end);
+ ret_value = (*space->select.type->bounds)(space, start, end);
FUNC_LEAVE_NOAPI(ret_value)
-} /* H5S_get_select_bounds() */
+} /* end H5S_get_select_bounds() */
/*--------------------------------------------------------------------------
@@ -736,7 +722,7 @@ H5S_get_select_offset(const H5S_t *space, hsize_t *offset)
ret_value = (*space->select.type->offset)(space, offset);
FUNC_LEAVE_NOAPI(ret_value)
-} /* H5S_get_select_offset() */
+} /* end H5S_get_select_offset() */
/*--------------------------------------------------------------------------
@@ -774,7 +760,7 @@ H5S_get_select_unlim_dim(const H5S_t *space)
ret_value = (*space->select.type->unlim_dim)(space);
FUNC_LEAVE_NOAPI(ret_value)
-} /* H5S_get_select_unlim_dim() */
+} /* end H5S_get_select_unlim_dim() */
/*--------------------------------------------------------------------------
@@ -819,7 +805,7 @@ H5S_get_select_num_elem_non_unlim(const H5S_t *space,
done:
FUNC_LEAVE_NOAPI(ret_value)
-} /* H5S_get_select_unlim_dim() */
+} /* end H5S_get_select_unlim_dim() */
/*--------------------------------------------------------------------------
@@ -856,7 +842,7 @@ H5S_select_is_contiguous(const H5S_t *space)
ret_value = (*space->select.type->is_contiguous)(space);
FUNC_LEAVE_NOAPI(ret_value)
-} /* H5S_select_is_contiguous() */
+} /* end H5S_select_is_contiguous() */
/*--------------------------------------------------------------------------
@@ -893,7 +879,7 @@ H5S_select_is_single(const H5S_t *space)
ret_value = (*space->select.type->is_single)(space);
FUNC_LEAVE_NOAPI(ret_value)
-} /* H5S_select_is_single() */
+} /* end H5S_select_is_single() */
/*--------------------------------------------------------------------------
@@ -930,7 +916,7 @@ H5S_select_is_regular(const H5S_t *space)
ret_value = (*space->select.type->is_regular)(space);
FUNC_LEAVE_NOAPI(ret_value)
-} /* H5S_select_is_regular() */
+} /* end H5S_select_is_regular() */
/*--------------------------------------------------------------------------
@@ -957,7 +943,9 @@ H5S_select_is_regular(const H5S_t *space)
herr_t
H5S_select_adjust_u(H5S_t *space, const hsize_t *offset)
{
- herr_t ret_value = FAIL; /* Return value */
+ hbool_t non_zero_offset = FALSE; /* Whether any offset is non-zero */
+ unsigned u; /* Local index variable */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI_NOINIT_NOERR
@@ -965,10 +953,19 @@ H5S_select_adjust_u(H5S_t *space, const hsize_t *offset)
HDassert(space);
HDassert(offset);
- ret_value = (*space->select.type->adjust_u)(space, offset);
+ /* Check for an all-zero offset vector */
+ for(u = 0; u < space->extent.rank; u++)
+ if(0 != offset[u]) {
+ non_zero_offset = TRUE;
+ break;
+ } /* end if */
+
+ /* Only perform operation if the offset is non-zero */
+ if(non_zero_offset)
+ ret_value = (*space->select.type->adjust_u)(space, offset);
FUNC_LEAVE_NOAPI(ret_value)
-} /* H5S_select_adjust_u() */
+} /* end H5S_select_adjust_u() */
/*--------------------------------------------------------------------------
@@ -1007,7 +1004,7 @@ H5S_select_project_scalar(const H5S_t *space, hsize_t *offset)
ret_value = (*space->select.type->project_scalar)(space, offset);
FUNC_LEAVE_NOAPI(ret_value)
-} /* H5S_select_project_scalar() */
+} /* end H5S_select_project_scalar() */
/*--------------------------------------------------------------------------
@@ -1048,7 +1045,7 @@ H5S_select_project_simple(const H5S_t *space, H5S_t *new_space, hsize_t *offset)
ret_value = (*space->select.type->project_simple)(space, new_space, offset);
FUNC_LEAVE_NOAPI(ret_value)
-} /* H5S_select_project_simple() */
+} /* end H5S_select_project_simple() */
/*--------------------------------------------------------------------------
@@ -1057,11 +1054,12 @@ H5S_select_project_simple(const H5S_t *space, H5S_t *new_space, hsize_t *offset)
PURPOSE
Initializes iteration information for a selection.
USAGE
- herr_t H5S_select_iter_init(sel_iter, space, elmt_size)
+ herr_t H5S_select_iter_init(sel_iter, space, elmt_size, flags)
H5S_sel_iter_t *sel_iter; OUT: Selection iterator to initialize.
H5S_t *space; IN: Dataspace object containing selection to
iterate over
size_t elmt_size; IN: Size of elements in the selection
+ unsigned flags; IN: Flags to control iteration behavior
RETURNS
Non-negative on success, negative on failure.
DESCRIPTION
@@ -1069,7 +1067,8 @@ H5S_select_project_simple(const H5S_t *space, H5S_t *new_space, hsize_t *offset)
in the dataspace's selection.
--------------------------------------------------------------------------*/
herr_t
-H5S_select_iter_init(H5S_sel_iter_t *sel_iter, const H5S_t *space, size_t elmt_size)
+H5S_select_iter_init(H5S_sel_iter_t *sel_iter, const H5S_t *space,
+ size_t elmt_size, unsigned flags)
{
herr_t ret_value = FAIL; /* Return value */
@@ -1084,21 +1083,27 @@ H5S_select_iter_init(H5S_sel_iter_t *sel_iter, const H5S_t *space, size_t elmt_s
/* Save the dataspace's rank */
sel_iter->rank = space->extent.rank;
- /* Point to the dataspace dimensions, if there are any */
- if(sel_iter->rank > 0)
- sel_iter->dims = space->extent.size;
- else
- sel_iter->dims = NULL;
+ /* If dims > 0, copy the dataspace dimensions & selection offset */
+ if(sel_iter->rank > 0) {
+ H5MM_memcpy(sel_iter->dims, space->extent.size, sizeof(hsize_t) * space->extent.rank);
+ H5MM_memcpy(sel_iter->sel_off, space->select.offset, sizeof(hsize_t) * space->extent.rank);
+ } /* end if */
/* Save the element size */
sel_iter->elmt_size = elmt_size;
+ /* Initialize the number of elements to iterate over */
+ sel_iter->elmt_left = space->select.num_elem;
+
+ /* Set the flags for the iterator */
+ sel_iter->flags = flags;
+
/* Call initialization routine for selection type */
- ret_value = (*space->select.type->iter_init)(sel_iter, space);
+ ret_value = (*space->select.type->iter_init)(space, sel_iter);
HDassert(sel_iter->type);
FUNC_LEAVE_NOAPI(ret_value)
-} /* H5S_select_iter_init() */
+} /* end H5S_select_iter_init() */
/*--------------------------------------------------------------------------
@@ -1135,10 +1140,10 @@ H5S_select_iter_coords(const H5S_sel_iter_t *sel_iter, hsize_t *coords)
HDassert(coords);
/* Call iter_coords routine for selection type */
- ret_value = (*sel_iter->type->iter_coords)(sel_iter,coords);
+ ret_value = (*sel_iter->type->iter_coords)(sel_iter, coords);
FUNC_LEAVE_NOAPI(ret_value)
-} /* H5S_select_iter_coords() */
+} /* end H5S_select_iter_coords() */
#ifdef LATER
@@ -1170,7 +1175,7 @@ H5S_select_iter_block(const H5S_sel_iter_t *iter, hsize_t *start, hsize_t *end)
{
herr_t ret_value; /* return value */
- FUNC_ENTER_NOAPI_NOINIT_NOINIT_NOERR
+ FUNC_ENTER_NOAPI_NOINIT_NOERR
/* Check args */
HDassert(iter);
@@ -1178,10 +1183,10 @@ H5S_select_iter_block(const H5S_sel_iter_t *iter, hsize_t *start, hsize_t *end)
HDassert(end);
/* Call iter_block routine for selection type */
- ret_value = (*iter->type->iter_block)(iter,start,end);
+ ret_value = (*iter->type->iter_block)(iter, start, end);
FUNC_LEAVE_NOAPI(ret_value)
-} /* H5S_select_iter_block() */
+} /* end H5S_select_iter_block() */
#endif /* LATER */
@@ -1219,7 +1224,7 @@ H5S_select_iter_nelmts(const H5S_sel_iter_t *sel_iter)
ret_value = (*sel_iter->type->iter_nelmts)(sel_iter);
FUNC_LEAVE_NOAPI(ret_value)
-} /* H5S_select_iter_nelmts() */
+} /* end H5S_select_iter_nelmts() */
#ifdef LATER
@@ -1249,7 +1254,7 @@ H5S_select_iter_has_next_block(const H5S_sel_iter_t *iter)
{
herr_t ret_value; /* return value */
- FUNC_ENTER_NOAPI_NOINIT_NOINIT_NOERR
+ FUNC_ENTER_NOAPI_NOINIT_NOERR
/* Check args */
HDassert(iter);
@@ -1258,7 +1263,7 @@ H5S_select_iter_has_next_block(const H5S_sel_iter_t *iter)
ret_value = (*iter->type->iter_has_next_block)(iter);
FUNC_LEAVE_NOAPI(ret_value)
-} /* H5S_select_iter_has_next_block() */
+} /* end H5S_select_iter_has_next_block() */
#endif /* LATER */
@@ -1296,13 +1301,13 @@ H5S_select_iter_next(H5S_sel_iter_t *iter, size_t nelem)
HDassert(nelem>0);
/* Call iter_next routine for selection type */
- ret_value = (*iter->type->iter_next)(iter,nelem);
+ ret_value = (*iter->type->iter_next)(iter, nelem);
/* Decrement the number of elements left in selection */
iter->elmt_left-=nelem;
FUNC_LEAVE_NOAPI(ret_value)
-} /* H5S_select_iter_next() */
+} /* end H5S_select_iter_next() */
#ifdef LATER
@@ -1343,17 +1348,54 @@ H5S_select_iter_next_block(H5S_sel_iter_t *iter)
ret_value = (*iter->type->iter_next_block)(iter);
FUNC_LEAVE_NOAPI(ret_value)
-} /* H5S_select_iter_next_block() */
+} /* end H5S_select_iter_next_block() */
#endif /* LATER */
+/*-------------------------------------------------------------------------
+ * Function: H5S_select_iter_get_seq_list
+ *
+ * Purpose: Retrieves the next sequence of offset/length pairs for an
+ * iterator on a dataspace
+ *
+ * Return: Non-negative on success/Negative on failure
+ *
+ * Programmer: Quincey Koziol
+ * Tuesday, May 18, 2004
+ *
+ * Note: This routine participates in the "Inlining C function pointers"
+ * pattern, don't call it directly, use the appropriate macro
+ * defined in H5Sprivate.h.
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5S_select_iter_get_seq_list(H5S_sel_iter_t *iter, size_t maxseq, size_t maxelmts,
+ size_t *nseq, size_t *nelmts, hsize_t *off, size_t *len)
+{
+ herr_t ret_value = FAIL; /* Return value */
+
+ FUNC_ENTER_NOAPI_NOINIT
+
+ /* Sanity check */
+ HDassert(iter);
+
+ /* Call the selection type's get_seq_list function */
+ if((ret_value = (*iter->type->iter_get_seq_list)(iter, maxseq, maxelmts, nseq, nelmts, off, len)) < 0)
+ HGOTO_ERROR(H5E_DATASPACE, H5E_CANTGET, FAIL, "unable to get selection sequence list")
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5S_select_iter_get_seq_list() */
+
+
/*--------------------------------------------------------------------------
NAME
H5S_select_iter_release
PURPOSE
Release a selection iterator's resources.
USAGE
- hssize_t H5S_select_iter_release(sel_iter)
+ herr_t H5S_select_iter_release(sel_iter)
H5S_sel_iter_t *sel_iter; IN: Selection iterator to query
RETURNS
The number of elements in selection on success, 0 on failure
@@ -1381,7 +1423,7 @@ H5S_select_iter_release(H5S_sel_iter_t *sel_iter)
ret_value = (*sel_iter->type->iter_release)(sel_iter);
FUNC_LEAVE_NOAPI(ret_value)
-} /* H5S_select_iter_release() */
+} /* end H5S_select_iter_release() */
/*--------------------------------------------------------------------------
@@ -1421,7 +1463,7 @@ H5S_select_iterate(void *buf, const H5T_t *type, const H5S_t *space,
hsize_t *off = NULL; /* Array to store sequence offsets */
size_t *len = NULL; /* Array to store sequence lengths */
hssize_t nelmts; /* Number of elements in selection */
- hsize_t space_size[H5O_LAYOUT_NDIMS]; /* Dataspace size */
+ hsize_t space_size[H5S_MAX_RANK]; /* Dataspace size */
size_t max_elem; /* Maximum number of elements allowed in sequences */
size_t elmt_size; /* Datatype size */
unsigned ndims; /* Number of dimensions in dataspace */
@@ -1445,7 +1487,7 @@ H5S_select_iterate(void *buf, const H5T_t *type, const H5S_t *space,
HGOTO_ERROR(H5E_DATASPACE, H5E_CANTALLOC, FAIL, "can't allocate selection iterator")
/* Initialize iterator */
- if(H5S_select_iter_init(iter, space, elmt_size) < 0)
+ if(H5S_select_iter_init(iter, space, elmt_size, 0) < 0)
HGOTO_ERROR(H5E_DATASPACE, H5E_CANTINIT, FAIL, "unable to initialize selection iterator")
iter_init = TRUE; /* Selection iteration info has been initialized */
@@ -1459,7 +1501,7 @@ H5S_select_iterate(void *buf, const H5T_t *type, const H5S_t *space,
if(ndims > 0) {
/* Copy the size of the space */
HDassert(space->extent.size);
- HDmemcpy(space_size, space->extent.size, ndims * sizeof(hsize_t));
+ H5MM_memcpy(space_size, space->extent.size, ndims * sizeof(hsize_t));
} /* end if */
space_size[ndims] = elmt_size;
@@ -1479,7 +1521,7 @@ H5S_select_iterate(void *buf, const H5T_t *type, const H5S_t *space,
size_t curr_seq; /* Current sequence being worked on */
/* Get the sequences of bytes */
- if(H5S_SELECT_GET_SEQ_LIST(space, 0, iter, (size_t)H5D_IO_VECTOR_SIZE, max_elem, &nseq, &nelem, off, len) < 0)
+ if(H5S_SELECT_ITER_GET_SEQ_LIST(iter, (size_t)H5D_IO_VECTOR_SIZE, max_elem, &nseq, &nelem, off, len) < 0)
HGOTO_ERROR(H5E_INTERNAL, H5E_UNSUPPORTED, FAIL, "sequence length generation failed")
/* Loop, while sequences left to process */
@@ -1495,7 +1537,7 @@ H5S_select_iterate(void *buf, const H5T_t *type, const H5S_t *space,
/* Loop, while bytes left in sequence */
while(curr_len > 0 && user_ret == 0) {
- hsize_t coords[H5O_LAYOUT_NDIMS]; /* Coordinates of element in dataspace */
+ hsize_t coords[H5S_MAX_RANK]; /* Coordinates of element in dataspace */
hsize_t tmp_off; /* Temporary offset within sequence */
uint8_t *loc; /* Current element location in buffer */
int i; /* Local Index variable */
@@ -1558,7 +1600,7 @@ done:
iter = H5FL_FREE(H5S_sel_iter_t, iter);
FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5S_select_iterate() */
+} /* end H5S_select_iterate() */
/*--------------------------------------------------------------------------
@@ -1594,7 +1636,7 @@ H5Sget_select_type(hid_t space_id)
done:
FUNC_LEAVE_API(ret_value)
-} /* end H5Sget_select_type() */
+} /* end H5Sget_select_type() */
/*--------------------------------------------------------------------------
@@ -1616,7 +1658,7 @@ done:
pattern, don't call it directly, use the appropriate macro
defined in H5Sprivate.h.
--------------------------------------------------------------------------*/
-H5S_sel_type
+H5_ATTR_PURE H5S_sel_type
H5S_get_select_type(const H5S_t *space)
{
H5S_sel_type ret_value = H5S_SEL_ERROR; /* Return value */
@@ -1627,10 +1669,10 @@ H5S_get_select_type(const H5S_t *space)
HDassert(space);
/* Set return value */
- ret_value=H5S_GET_SELECT_TYPE(space);
+ ret_value = H5S_GET_SELECT_TYPE(space);
FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5S_get_select_type() */
+} /* end H5S_get_select_type() */
/*--------------------------------------------------------------------------
@@ -1650,20 +1692,17 @@ H5S_get_select_type(const H5S_t *space)
This is primarily used for reading the entire selection in one swoop.
GLOBAL VARIABLES
COMMENTS, BUGS, ASSUMPTIONS
- Assumes that there is only a single "block" for hyperslab selections.
EXAMPLES
REVISION LOG
- Modified function to view identical shapes with different dimensions
- as being the same under some circumstances.
--------------------------------------------------------------------------*/
htri_t
H5S_select_shape_same(const H5S_t *space1, const H5S_t *space2)
{
H5S_sel_iter_t *iter_a = NULL; /* Selection a iteration info */
H5S_sel_iter_t *iter_b = NULL; /* Selection b iteration info */
- hbool_t iter_a_init = FALSE; /* Selection a iteration info has been initialized */
- hbool_t iter_b_init = FALSE; /* Selection b iteration info has been initialized */
- htri_t ret_value = TRUE; /* Return value */
+ hbool_t iter_a_init = FALSE; /* Selection a iteration info has been initialized */
+ hbool_t iter_b_init = FALSE; /* Selection b iteration info has been initialized */
+ htri_t ret_value = TRUE; /* Return value */
FUNC_ENTER_NOAPI(FAIL)
@@ -1684,124 +1723,98 @@ H5S_select_shape_same(const H5S_t *space1, const H5S_t *space2)
const H5S_t *space_b; /* Dataspace with smaller rank */
unsigned space_a_rank; /* Number of dimensions of dataspace A */
unsigned space_b_rank; /* Number of dimensions of dataspace B */
+ int space_a_dim; /* Current dimension in dataspace A */
+ int space_b_dim; /* Current dimension in dataspace B */
+ H5S_sel_type sel_a_type; /* Selection type for dataspace A */
+ H5S_sel_type sel_b_type; /* Selection type for dataspace B */
- /* need to be able to handle spaces of different rank:
+ /* Need to be able to handle spaces of different rank:
*
* To simplify logic, let space_a point to the element of the set
- * {space1, space2} with the largest rank or space1 if the ranks
+ * {space1, space2} with the largest rank or space1 if the ranks
* are identical.
*
* Similarly, let space_b point to the element of {space1, space2}
* with the smallest rank, or space2 if they are identical.
*
- * Let: space_a_rank be the rank of space_a,
+ * Let: space_a_rank be the rank of space_a,
* space_b_rank be the rank of space_b,
- * delta_rank = space_a_rank - space_b_rank.
*
- * Set all this up below.
+ * Set all this up here.
*/
if(space1->extent.rank >= space2->extent.rank) {
space_a = space1;
- space_a_rank = space_a->extent.rank;
-
space_b = space2;
- space_b_rank = space_b->extent.rank;
} /* end if */
else {
space_a = space2;
- space_a_rank = space_a->extent.rank;
-
space_b = space1;
- space_b_rank = space_b->extent.rank;
} /* end else */
+ space_a_rank = space_a->extent.rank;
+ space_b_rank = space_b->extent.rank;
HDassert(space_a_rank >= space_b_rank);
HDassert(space_b_rank > 0);
- /* Check for "easy" cases before getting into generalized block iteration code */
- if((H5S_GET_SELECT_TYPE(space_a) == H5S_SEL_ALL) && (H5S_GET_SELECT_TYPE(space_b) == H5S_SEL_ALL)) {
- hsize_t dims1[H5O_LAYOUT_NDIMS]; /* End point of selection block in dataspace #1 */
- hsize_t dims2[H5O_LAYOUT_NDIMS]; /* End point of selection block in dataspace #2 */
- int space_a_dim; /* Current dimension in dataspace A */
- int space_b_dim; /* Current dimension in dataspace B */
+ /* Get selection type for both dataspaces */
+ sel_a_type = H5S_GET_SELECT_TYPE(space_a);
+ sel_b_type = H5S_GET_SELECT_TYPE(space_b);
- if(H5S_get_simple_extent_dims(space_a, dims1, NULL) < 0)
- HGOTO_ERROR(H5E_DATASPACE, H5E_CANTGET, FAIL, "unable to get dimensionality")
- if(H5S_get_simple_extent_dims(space_b, dims2, NULL) < 0)
- HGOTO_ERROR(H5E_DATASPACE, H5E_CANTGET, FAIL, "unable to get dimensionality")
+ /* If selections aren't "none", compare their bounds */
+ if(sel_a_type != H5S_SEL_NONE && sel_b_type != H5S_SEL_NONE) {
+ hsize_t low_a[H5S_MAX_RANK]; /* Low bound of selection in dataspace a */
+ hsize_t low_b[H5S_MAX_RANK]; /* Low bound of selection in dataspace b */
+ hsize_t high_a[H5S_MAX_RANK]; /* High bound of selection in dataspace a */
+ hsize_t high_b[H5S_MAX_RANK]; /* High bound of selection in dataspace b */
- space_a_dim = (int)space_a_rank - 1;
- space_b_dim = (int)space_b_rank - 1;
-
- /* recall that space_a_rank >= space_b_rank.
- *
- * In the following while loop, we test to see if space_a and space_b
- * have identical size in all dimensions they have in common.
- */
- while(space_b_dim >= 0) {
- if(dims1[space_a_dim] != dims2[space_b_dim])
- HGOTO_DONE(FALSE)
-
- space_a_dim--;
- space_b_dim--;
- } /* end while */
-
- /* Since we are selecting the entire space, we must also verify that space_a
- * has size 1 in all dimensions that it does not share with space_b.
- */
- while(space_a_dim >= 0) {
- if(dims1[space_a_dim] != 1)
- HGOTO_DONE(FALSE)
-
- space_a_dim--;
- } /* end while */
- } /* end if */
- else if((H5S_GET_SELECT_TYPE(space1) == H5S_SEL_NONE) || (H5S_GET_SELECT_TYPE(space2) == H5S_SEL_NONE)) {
- /* (Both must be, at this point, if one is) */
- HGOTO_DONE(TRUE)
- } /* end if */
- else if((H5S_GET_SELECT_TYPE(space_a) == H5S_SEL_HYPERSLABS && space_a->select.sel_info.hslab->diminfo_valid)
- && (H5S_GET_SELECT_TYPE(space_b) == H5S_SEL_HYPERSLABS && space_b->select.sel_info.hslab->diminfo_valid)) {
- int space_a_dim; /* Current dimension in dataspace A */
- int space_b_dim; /* Current dimension in dataspace B */
+ /* Get low & high bounds for both dataspaces */
+ if(H5S_SELECT_BOUNDS(space_a, low_a, high_a) < 0)
+ HGOTO_ERROR(H5E_DATASPACE, H5E_CANTGET, FAIL, "can't get selection bounds for first dataspace")
+ if(H5S_SELECT_BOUNDS(space_b, low_b, high_b) < 0)
+ HGOTO_ERROR(H5E_DATASPACE, H5E_CANTGET, FAIL, "can't get selection bounds for second dataspace")
+ /* Check that the range between the low & high bounds are the same */
space_a_dim = (int)space_a_rank - 1;
space_b_dim = (int)space_b_rank - 1;
-
- /* check that the shapes are the same in the common dimensions, and that
- * block == 1 in all dimensions that appear only in space_a.
- */
while(space_b_dim >= 0) {
- if(space_a->select.sel_info.hslab->opt_diminfo[space_a_dim].stride !=
- space_b->select.sel_info.hslab->opt_diminfo[space_b_dim].stride)
- HGOTO_DONE(FALSE)
+ /* Sanity check */
+ HDassert(low_a[space_a_dim] <= high_a[space_a_dim]);
+ HDassert(low_a[space_b_dim] <= high_a[space_b_dim]);
- if(space_a->select.sel_info.hslab->opt_diminfo[space_a_dim].count !=
- space_b->select.sel_info.hslab->opt_diminfo[space_b_dim].count)
- HGOTO_DONE(FALSE)
-
- if(space_a->select.sel_info.hslab->opt_diminfo[space_a_dim].block !=
- space_b->select.sel_info.hslab->opt_diminfo[space_b_dim].block)
+ /* Verify that the ranges are the same */
+ if((high_a[space_a_dim] - low_a[space_a_dim])
+ != (high_b[space_b_dim] - low_b[space_b_dim]))
HGOTO_DONE(FALSE)
+ /* Go to next dimension */
space_a_dim--;
space_b_dim--;
} /* end while */
+ /* Check that the rest of the ranges in space a are "flat" */
while(space_a_dim >= 0) {
- if(space_a->select.sel_info.hslab->opt_diminfo[space_a_dim].block != 1)
+ /* Sanity check */
+ HDassert(low_a[space_a_dim] <= high_a[space_a_dim]);
+
+ /* This range should be flat to be the same in a lower dimension */
+ if(low_a[space_a_dim] != high_a[space_a_dim])
HGOTO_DONE(FALSE)
space_a_dim--;
} /* end while */
} /* end if */
- /* Iterate through all the blocks in the selection */
+
+ /* If the dataspaces have the same selection type, use the selection's
+ * shape_same operator.
+ */
+ if(sel_a_type == sel_b_type)
+ ret_value = (*space_a->select.type->shape_same)(space_a, space_b);
+ /* Otherwise, iterate through all the blocks in the selection */
else {
hsize_t start_a[H5S_MAX_RANK]; /* Start point of selection block in dataspace a */
hsize_t start_b[H5S_MAX_RANK]; /* Start point of selection block in dataspace b */
hsize_t end_a[H5S_MAX_RANK]; /* End point of selection block in dataspace a */
hsize_t end_b[H5S_MAX_RANK]; /* End point of selection block in dataspace b */
- hsize_t off_a[H5S_MAX_RANK]; /* Offset of selection a blocks */
- hsize_t off_b[H5S_MAX_RANK]; /* Offset of selection b blocks */
+ hssize_t offset[H5S_MAX_RANK]; /* Offset of selection b blocks relative to selection a blocks */
hbool_t first_block = TRUE; /* Flag to indicate the first block */
/* Allocate the selection iterators */
@@ -1815,17 +1828,15 @@ H5S_select_shape_same(const H5S_t *space1, const H5S_t *space2)
* that the selection iterator shouldn't be "flattened", since we
* aren't actually going to be doing I/O with the iterators.
*/
- if(H5S_select_iter_init(iter_a, space_a, (size_t)0) < 0)
+ if(H5S_select_iter_init(iter_a, space_a, (size_t)0, 0) < 0)
HGOTO_ERROR(H5E_DATASPACE, H5E_CANTINIT, FAIL, "unable to initialize selection iterator a")
iter_a_init = TRUE;
- if(H5S_select_iter_init(iter_b, space_b, (size_t)0) < 0)
+ if(H5S_select_iter_init(iter_b, space_b, (size_t)0, 0) < 0)
HGOTO_ERROR(H5E_DATASPACE, H5E_CANTINIT, FAIL, "unable to initialize selection iterator b")
iter_b_init = TRUE;
/* Iterate over all the blocks in each selection */
while(1) {
- int space_a_dim; /* Current dimension in dataspace A */
- int space_b_dim; /* Current dimension in dataspace B */
htri_t status_a, status_b; /* Status from next block checks */
/* Get the current block for each selection iterator */
@@ -1837,11 +1848,11 @@ H5S_select_shape_same(const H5S_t *space1, const H5S_t *space2)
space_a_dim = (int)space_a_rank - 1;
space_b_dim = (int)space_b_rank - 1;
- /* The first block only compares the sizes and sets the
- * relative offsets for later blocks
+ /* The first block only compares the sizes and sets the
+ * relative offsets for later blocks
*/
if(first_block) {
- /* If the block sizes in the common dimensions from
+ /* If the block sizes in the common dimensions from
* each selection don't match, get out
*/
while(space_b_dim >= 0) {
@@ -1850,23 +1861,19 @@ H5S_select_shape_same(const H5S_t *space1, const H5S_t *space2)
HGOTO_DONE(FALSE)
/* Set the relative locations of the selections */
- off_a[space_a_dim] = start_a[space_a_dim];
- off_b[space_b_dim] = start_b[space_b_dim];
+ offset[space_a_dim] = (hssize_t)start_b[space_b_dim] - (hssize_t)start_a[space_a_dim];
space_a_dim--;
space_b_dim--;
} /* end while */
- /* similarly, if the block size in any dimension that appears only
+ /* Similarly, if the block size in any dimension that appears only
* in space_a is not equal to 1, get out.
*/
while(space_a_dim >= 0) {
- if((end_a[space_a_dim] - start_a[space_a_dim]) != 0)
+ if(start_a[space_a_dim] != end_a[space_a_dim])
HGOTO_DONE(FALSE)
- /* Set the relative locations of the selections */
- off_a[space_a_dim] = start_a[space_a_dim];
-
space_a_dim--;
} /* end while */
@@ -1875,11 +1882,10 @@ H5S_select_shape_same(const H5S_t *space1, const H5S_t *space2)
} /* end if */
/* Check over the blocks for each selection */
else {
- /* for dimensions that space_a and space_b have in common: */
+ /* For dimensions that space_a and space_b have in common: */
while(space_b_dim >= 0) {
/* Check if the blocks are in the same relative location */
- if((start_a[space_a_dim] - off_a[space_a_dim]) !=
- (start_b[space_b_dim] - off_b[space_b_dim]))
+ if((hsize_t)((hssize_t)start_a[space_a_dim] + offset[space_a_dim]) != start_b[space_b_dim])
HGOTO_DONE(FALSE)
/* If the block sizes from each selection doesn't match, get out */
@@ -1894,7 +1900,7 @@ H5S_select_shape_same(const H5S_t *space1, const H5S_t *space2)
/* For dimensions that appear only in space_a: */
while(space_a_dim >= 0) {
/* If the block size isn't 1, get out */
- if((end_a[space_a_dim] - start_a[space_a_dim]) != 0)
+ if(start_a[space_a_dim] != end_a[space_a_dim])
HGOTO_DONE(FALSE)
space_a_dim--;
@@ -1936,7 +1942,7 @@ done:
iter_b = H5FL_FREE(H5S_sel_iter_t, iter_b);
FUNC_LEAVE_NOAPI(ret_value)
-} /* H5S_select_shape_same() */
+} /* end H5S_select_shape_same() */
/*--------------------------------------------------------------------------
@@ -1945,24 +1951,24 @@ done:
PURPOSE
Given a dataspace a of rank n with some selection, construct a new
- dataspace b of rank m (m != n), with the selection in a being
- topologically identical to that in b (as verified by
+ dataspace b of rank m (m != n), with the selection in a being
+ topologically identical to that in b (as verified by
H5S_select_shape_same().
- This function exists, as some I/O code chokes on topologically
- identical selections with different ranks. At least to begin
+ This function exists, as some I/O code chokes on topologically
+ identical selections with different ranks. At least to begin
with, we will deal with the issue by constructing projections
- of the memory dataspace with ranks equaling those of the file
+ of the memory dataspace with ranks equaling those of the file
dataspace.
- Note that if m > n, it is possible that the starting point in the
- buffer associated with the memory dataspace will have to be
+ Note that if m > n, it is possible that the starting point in the
+ buffer associated with the memory dataspace will have to be
adjusted to match the projected dataspace. If the buf parameter
is not NULL, the function must return an adjusted buffer base
address in *adj_buf_ptr.
USAGE
- htri_t H5S_select_construct_projection(base_space,
+ htri_t H5S_select_construct_projection(base_space,
new_space_ptr,
new_space_rank,
buf,
@@ -1971,30 +1977,30 @@ done:
H5S_t ** new_space_ptr; OUT: Ptr to location in which to return
the address of the projected space
int new_space_rank; IN: Rank of the projected space.
- const void * buf; IN: Base address of the buffer
+ const void * buf; IN: Base address of the buffer
associated with the base space.
May be NULL.
void ** adj_buf_ptr; OUT: If buf != NULL, store the base
- address of the section of buf
+ address of the section of buf
that is described by *new_space_ptr
in *adj_buf_ptr.
-
+
RETURNS
Non-negative on success/Negative on failure.
DESCRIPTION
- Construct a new dataspace and associated selection which is a
- projection of the supplied dataspace and associated selection into
+ Construct a new dataspace and associated selection which is a
+ projection of the supplied dataspace and associated selection into
the specified rank. Return it in *new_space_ptr.
- If buf is supplied, computes the base address of the projected
+ If buf is supplied, computes the base address of the projected
selection in buf, and stores the base address in *adj_buf_ptr.
-
+
GLOBAL VARIABLES
COMMENTS, BUGS, ASSUMPTIONS
- The selection in the supplied base_space has thickness 1 in all
+ The selection in the supplied base_space has thickness 1 in all
dimensions greater than new_space_rank. Note that here we count
- dimensions from the fastest changing coordinate to the slowest
+ dimensions from the fastest changing coordinate to the slowest
changing changing coordinate.
EXAMPLES
REVISION LOG
@@ -2040,28 +2046,28 @@ H5S_select_construct_projection(const H5S_t *base_space, H5S_t **new_space_ptr,
/* Create new scalar dataspace */
if(NULL == (new_space = H5S_create(H5S_SCALAR)))
HGOTO_ERROR(H5E_DATASPACE, H5E_CANTCREATE, FAIL, "unable to create scalar dataspace")
-
+
/* No need to register the dataspace(i.e. get an ID) as
* we will just be discarding it shortly.
*/
- /* Selection for the new space will be either all or
+ /* Selection for the new space will be either all or
* none, depending on whether the base space has 0 or
* 1 elements selected.
*
- * Observe that the base space can't have more than
+ * Observe that the base space can't have more than
* one selected element, since its selection has the
- * same shape as the file dataspace, and that data
+ * same shape as the file dataspace, and that data
* space is scalar.
*/
if(1 == npoints) {
/* Assuming that the selection in the base dataspace is not
- * empty, we must compute the offset of the selected item in
+ * empty, we must compute the offset of the selected item in
* the buffer associated with the base dataspace.
*
- * Since the new space rank is zero, we know that the
- * the base space must have rank at least 1 -- and
- * hence it is a simple dataspace. However, the
+ * Since the new space rank is zero, we know that the
+ * the base space must have rank at least 1 -- and
+ * hence it is a simple dataspace. However, the
* selection, may be either point, hyperspace, or all.
*
*/
@@ -2079,25 +2085,25 @@ H5S_select_construct_projection(const H5S_t *base_space, H5S_t **new_space_ptr,
hsize_t new_space_dims[H5S_MAX_RANK]; /* Current dimensions for new dataspace */
hsize_t new_space_maxdims[H5S_MAX_RANK];/* Maximum dimensions for new dataspace */
unsigned rank_diff; /* Difference in ranks */
-
+
/* Set up the dimensions of the new, projected dataspace.
*
- * How we do this depends on whether we are projecting up into
- * increased dimensions, or down into a reduced number of
+ * How we do this depends on whether we are projecting up into
+ * increased dimensions, or down into a reduced number of
* dimensions.
*
- * If we are projecting up (the first half of the following
- * if statement), we copy the dimensions of the base data
- * space into the fastest changing dimensions of the new
+ * If we are projecting up (the first half of the following
+ * if statement), we copy the dimensions of the base data
+ * space into the fastest changing dimensions of the new
* projected dataspace, and set the remaining dimensions to
* one.
*
* If we are projecting down (the second half of the following
- * if statement), we just copy the dimensions with the most
+ * if statement), we just copy the dimensions with the most
* quickly changing dimensions into the dims for the projected
* data set.
*
- * This works, because H5S_select_shape_same() will return
+ * This works, because H5S_select_shape_same() will return
* true on selections of different rank iff:
*
* 1) the selection in the lower rank dataspace matches that
@@ -2105,37 +2111,37 @@ H5S_select_construct_projection(const H5S_t *base_space, H5S_t **new_space_ptr,
* the larger rank dataspace, and
*
* 2) the selection has thickness 1 in all ranks that appear
- * only in the higher rank dataspace (i.e. those with
+ * only in the higher rank dataspace (i.e. those with
* more slowly changing indicies).
- */
+ */
if(new_space_rank > base_space_rank) {
hsize_t tmp_dim_size = 1; /* Temporary dimension value, for filling arrays */
- /* we must copy the dimensions of the base space into
+ /* we must copy the dimensions of the base space into
* the fastest changing dimensions of the new space,
* and set the remaining dimensions to 1
*/
rank_diff = new_space_rank - base_space_rank;
H5VM_array_fill(new_space_dims, &tmp_dim_size, sizeof(tmp_dim_size), rank_diff);
H5VM_array_fill(new_space_maxdims, &tmp_dim_size, sizeof(tmp_dim_size), rank_diff);
- HDmemcpy(&new_space_dims[rank_diff], base_space_dims, sizeof(new_space_dims[0]) * base_space_rank);
- HDmemcpy(&new_space_maxdims[rank_diff], base_space_maxdims, sizeof(new_space_maxdims[0]) * base_space_rank);
+ H5MM_memcpy(&new_space_dims[rank_diff], base_space_dims, sizeof(new_space_dims[0]) * base_space_rank);
+ H5MM_memcpy(&new_space_maxdims[rank_diff], base_space_maxdims, sizeof(new_space_maxdims[0]) * base_space_rank);
} /* end if */
else { /* new_space_rank < base_space_rank */
- /* we must copy the fastest changing dimension of the
+ /* we must copy the fastest changing dimension of the
* base space into the dimensions of the new space.
*/
rank_diff = base_space_rank - new_space_rank;
- HDmemcpy(new_space_dims, &base_space_dims[rank_diff], sizeof(new_space_dims[0]) * new_space_rank);
- HDmemcpy(new_space_maxdims, &base_space_maxdims[rank_diff], sizeof(new_space_maxdims[0]) * new_space_rank);
+ H5MM_memcpy(new_space_dims, &base_space_dims[rank_diff], sizeof(new_space_dims[0]) * new_space_rank);
+ H5MM_memcpy(new_space_maxdims, &base_space_maxdims[rank_diff], sizeof(new_space_maxdims[0]) * new_space_rank);
} /* end else */
- /* now have the new space rank and dimensions set up --
+ /* now have the new space rank and dimensions set up --
* so we can create the new simple dataspace.
*/
if(NULL == (new_space = H5S_create_simple(new_space_rank, new_space_dims, new_space_maxdims)))
HGOTO_ERROR(H5E_DATASPACE, H5E_CANTCREATE, FAIL, "can't create simple dataspace")
-
+
/* No need to register the dataspace(i.e. get an ID) as
* we will just be discarding it shortly.
*/
@@ -2146,22 +2152,22 @@ H5S_select_construct_projection(const H5S_t *base_space, H5S_t **new_space_ptr,
*/
if(H5S_SELECT_PROJECT_SIMPLE(base_space, new_space, &projected_space_element_offset) < 0)
HGOTO_ERROR(H5E_DATASPACE, H5E_CANTSET, FAIL, "unable to project simple selection")
-
+
/* If we get this far, we have created the new dataspace, and projected
* the selection in the base dataspace into the new dataspace.
*
- * If the base dataspace is simple, check to see if the
- * offset_changed flag on the base selection has been set -- if so,
- * project the offset into the new dataspace and set the
+ * If the base dataspace is simple, check to see if the
+ * offset_changed flag on the base selection has been set -- if so,
+ * project the offset into the new dataspace and set the
* offset_changed flag.
*/
if(H5S_GET_EXTENT_TYPE(base_space) == H5S_SIMPLE && base_space->select.offset_changed) {
if(new_space_rank > base_space_rank) {
HDmemset(new_space->select.offset, 0, sizeof(new_space->select.offset[0]) * rank_diff);
- HDmemcpy(&new_space->select.offset[rank_diff], base_space->select.offset, sizeof(new_space->select.offset[0]) * base_space_rank);
+ H5MM_memcpy(&new_space->select.offset[rank_diff], base_space->select.offset, sizeof(new_space->select.offset[0]) * base_space_rank);
} /* end if */
else
- HDmemcpy(new_space->select.offset, &base_space->select.offset[rank_diff], sizeof(new_space->select.offset[0]) * new_space_rank);
+ H5MM_memcpy(new_space->select.offset, &base_space->select.offset[rank_diff], sizeof(new_space->select.offset[0]) * new_space_rank);
/* Propagate the offset changed flag into the new dataspace. */
new_space->select.offset_changed = TRUE;
@@ -2184,12 +2190,12 @@ H5S_select_construct_projection(const H5S_t *base_space, H5S_t **new_space_ptr,
* Since we can't do pointer arithmetic on void pointers, we first
* cast buf to a pointer to byte -- i.e. uint8_t.
*
- * We then multiply the projected space element offset we
- * calculated earlier by the supplied element size, add this
- * value to the type cast buf pointer, cast the result back
+ * We then multiply the projected space element offset we
+ * calculated earlier by the supplied element size, add this
+ * value to the type cast buf pointer, cast the result back
* to a pointer to void, and assign the result to *adj_buf_ptr.
*/
- *adj_buf_ptr = (const void *)(((const uint8_t *)buf) +
+ *adj_buf_ptr = (const void *)(((const uint8_t *)buf) +
((size_t)(projected_space_element_offset * element_size)));
} /* end if */
else
@@ -2204,7 +2210,7 @@ done:
HDONE_ERROR(H5E_DATASPACE, H5E_CANTRELEASE, FAIL, "unable to release dataspace")
FUNC_LEAVE_NOAPI(ret_value)
-} /* H5S_select_construct_projection() */
+} /* end H5S_select_construct_projection() */
/*--------------------------------------------------------------------------
@@ -2235,7 +2241,7 @@ herr_t
H5S_select_fill(const void *fill, size_t fill_size, const H5S_t *space, void *_buf)
{
H5S_sel_iter_t *iter = NULL; /* Selection iteration info */
- hbool_t iter_init = 0; /* Selection iteration info has been initialized */
+ hbool_t iter_init = FALSE; /* Selection iteration info has been initialized */
hsize_t *off = NULL; /* Array to store sequence offsets */
size_t *len = NULL; /* Array to store sequence lengths */
hssize_t nelmts; /* Number of elements in selection */
@@ -2255,9 +2261,9 @@ H5S_select_fill(const void *fill, size_t fill_size, const H5S_t *space, void *_b
HGOTO_ERROR(H5E_DATASPACE, H5E_CANTALLOC, FAIL, "can't allocate selection iterator")
/* Initialize iterator */
- if(H5S_select_iter_init(iter, space, fill_size) < 0)
+ if(H5S_select_iter_init(iter, space, fill_size, 0) < 0)
HGOTO_ERROR(H5E_DATASPACE, H5E_CANTINIT, FAIL, "unable to initialize selection iterator")
- iter_init = 1; /* Selection iteration info has been initialized */
+ iter_init = TRUE; /* Selection iteration info has been initialized */
/* Get the number of elements in selection */
if((nelmts = (hssize_t)H5S_GET_SELECT_NPOINTS(space)) < 0)
@@ -2279,7 +2285,7 @@ H5S_select_fill(const void *fill, size_t fill_size, const H5S_t *space, void *_b
size_t nelem; /* Number of elements used in sequences */
/* Get the sequences of bytes */
- if(H5S_SELECT_GET_SEQ_LIST(space, 0, iter, (size_t)H5D_IO_VECTOR_SIZE, max_elem, &nseq, &nelem, off, len) < 0)
+ if(H5S_SELECT_ITER_GET_SEQ_LIST(iter, (size_t)H5D_IO_VECTOR_SIZE, max_elem, &nseq, &nelem, off, len) < 0)
HGOTO_ERROR(H5E_INTERNAL, H5E_UNSUPPORTED, FAIL, "sequence length generation failed")
/* Loop over sequences */
@@ -2312,7 +2318,7 @@ done:
iter = H5FL_FREE(H5S_sel_iter_t, iter);
FUNC_LEAVE_NOAPI(ret_value)
-} /* H5S_select_fill() */
+} /* end H5S_select_fill() */
/*--------------------------------------------------------------------------
@@ -2339,7 +2345,7 @@ done:
src_intersect_space within the selection of src_space as a selection
within the selection of dst_space. The result is placed in the
selection of new_space_ptr.
-
+
GLOBAL VARIABLES
COMMENTS, BUGS, ASSUMPTIONS
EXAMPLES
@@ -2363,7 +2369,7 @@ H5S_select_project_intersection(const H5S_t *src_space, const H5S_t *dst_space,
/* Create new space, using dst extent. Start with "all" selection. */
if(NULL == (new_space = H5S_create(H5S_SIMPLE)))
HGOTO_ERROR(H5E_DATASPACE, H5E_CANTCREATE, FAIL, "unable to create output dataspace")
- if(H5S_extent_copy_real(&new_space->extent, &dst_space->extent, TRUE) < 0)
+ if(H5S__extent_copy_real(&new_space->extent, &dst_space->extent, TRUE) < 0)
HGOTO_ERROR(H5E_DATASPACE, H5E_CANTCOPY, FAIL, "unable to copy destination space extent")
/* If the intersecting space is "all", the intersection must be equal to the
@@ -2373,22 +2379,25 @@ H5S_select_project_intersection(const H5S_t *src_space, const H5S_t *dst_space,
if(H5S_select_copy(new_space, dst_space, FALSE) < 0)
HGOTO_ERROR(H5E_DATASPACE, H5E_CANTCOPY, FAIL, "can't copy destination space selection")
} /* end if */
- /* If any of the spaces are "none", the projection must also be "none" */
- else if((src_intersect_space->select.type->type == H5S_SEL_NONE)
- || (src_space->select.type->type == H5S_SEL_NONE)
- || (dst_space->select.type->type == H5S_SEL_NONE)) {
+ /* If any of the selections contain no elements, the projection must be
+ * "none" */
+ else if((H5S_GET_SELECT_NPOINTS(src_intersect_space) == 0)
+ || (H5S_GET_SELECT_NPOINTS(src_space) == 0)
+ || (H5S_GET_SELECT_NPOINTS(dst_space) == 0)) {
/* Change to "none" selection */
if(H5S_select_none(new_space) < 0)
HGOTO_ERROR(H5E_DATASPACE, H5E_CANTDELETE, FAIL, "can't change selection")
} /* end if */
- /* If any of the spaces use point selection, fall back to general algorithm
- */
+ /* If any of the spaces use point selection, fall back to general algorithm */
else if((src_intersect_space->select.type->type == H5S_SEL_POINTS)
|| (src_space->select.type->type == H5S_SEL_POINTS)
|| (dst_space->select.type->type == H5S_SEL_POINTS))
HGOTO_ERROR(H5E_DATASPACE, H5E_UNSUPPORTED, FAIL, "point selections not currently supported")
else {
HDassert(src_intersect_space->select.type->type == H5S_SEL_HYPERSLABS);
+ HDassert(src_space->select.type->type != H5S_SEL_NONE);
+ HDassert(dst_space->select.type->type != H5S_SEL_NONE);
+
/* Intersecting space is hyperslab selection. Call the hyperslab
* routine to project to another hyperslab selection. */
if(H5S__hyper_project_intersection(src_space, dst_space, src_intersect_space, new_space) < 0)
@@ -2405,7 +2414,7 @@ done:
HDONE_ERROR(H5E_DATASPACE, H5E_CANTRELEASE, FAIL, "unable to release dataspace")
FUNC_LEAVE_NOAPI(ret_value)
-} /* H5S_select_project_intersection() */
+} /* end H5S_select_project_intersection() */
/*--------------------------------------------------------------------------
@@ -2427,7 +2436,7 @@ done:
Removes any and all portions of space that are also present in
subtract_space. In essence, performs an A_NOT_B operation with the
two selections.
-
+
GLOBAL VARIABLES
COMMENTS, BUGS, ASSUMPTIONS
EXAMPLES
@@ -2454,12 +2463,13 @@ H5S_select_subtract(H5S_t *space, H5S_t *subtract_space)
if(H5S_select_none(space) < 0)
HGOTO_ERROR(H5E_DATASPACE, H5E_CANTDELETE, FAIL, "can't change selection")
} /* end if */
+ /* If either selection is a point selection, fail currently */
+ else if((subtract_space->select.type->type == H5S_SEL_POINTS) ||
+ (space->select.type->type == H5S_SEL_POINTS)) {
+ HGOTO_ERROR(H5E_DATASPACE, H5E_UNSUPPORTED, FAIL, "point selections not currently supported")
+ } /* end if */
else {
- /* Check for point selection in subtract_space, convert to hyperslab */
- if(subtract_space->select.type->type == H5S_SEL_POINTS)
- HGOTO_ERROR(H5E_DATASPACE, H5E_UNSUPPORTED, FAIL, "point selections not currently supported")
-
- /* Check for point or all selection in space, convert to hyperslab */
+ /* Check for all selection in space, convert to hyperslab */
if(space->select.type->type == H5S_SEL_ALL) {
/* Convert current "all" selection to "real" hyperslab selection */
/* Then allow operation to proceed */
@@ -2481,19 +2491,231 @@ H5S_select_subtract(H5S_t *space, H5S_t *subtract_space)
if(H5S_select_hyperslab(space, H5S_SELECT_SET, tmp_start, tmp_stride, tmp_count, tmp_block) < 0)
HGOTO_ERROR(H5E_DATASPACE, H5E_CANTSELECT, FAIL, "can't convert selection")
} /* end if */
- else if(space->select.type->type == H5S_SEL_POINTS)
- HGOTO_ERROR(H5E_DATASPACE, H5E_UNSUPPORTED, FAIL, "point selections not currently supported")
HDassert(space->select.type->type == H5S_SEL_HYPERSLABS);
HDassert(subtract_space->select.type->type == H5S_SEL_HYPERSLABS);
/* Both spaces are now hyperslabs, perform the operation */
- if(H5S__hyper_subtract(space, subtract_space) < 0)
+ if(H5S__modify_select(space, H5S_SELECT_NOTB, subtract_space) < 0)
HGOTO_ERROR(H5E_DATASPACE, H5E_CANTCLIP, FAIL, "can't subtract hyperslab")
} /* end else */
} /* end if */
done:
FUNC_LEAVE_NOAPI(ret_value)
-} /* H5S_select_subtract() */
+} /* end H5S_select_subtract() */
+
+
+/*--------------------------------------------------------------------------
+ NAME
+ H5Ssel_iter_create
+ PURPOSE
+ Create a dataspace selection iterator for a dataspace's selection
+ USAGE
+ hid_t H5Ssel_iter_create(space)
+ hid_t space; IN: ID of the dataspace with selection to iterate over
+ RETURNS
+ Valid dataspace selection iterator ID on success, H5I_INVALID_HID on failure
+ DESCRIPTION
+ Creates a selection iterator and initializes it to start at the first
+ element selected in the dataspace.
+ PROGRAMMER
+ Quincey Koziol - February 11, 2019
+ GLOBAL VARIABLES
+ COMMENTS, BUGS, ASSUMPTIONS
+ EXAMPLES
+ REVISION LOG
+--------------------------------------------------------------------------*/
+hid_t
+H5Ssel_iter_create(hid_t space_id, size_t elmt_size, unsigned flags)
+{
+ H5S_t *space; /* Dataspace with selection to iterate over */
+ H5S_sel_iter_t *sel_iter; /* Selection iterator created */
+ hid_t ret_value; /* Return value */
+
+ FUNC_ENTER_API(H5I_INVALID_HID)
+ H5TRACE3("i", "izIu", space_id, elmt_size, flags);
+
+ /* Check args */
+ if(NULL == (space = (H5S_t *)H5I_object_verify(space_id, H5I_DATASPACE)))
+ HGOTO_ERROR(H5E_DATASPACE, H5E_BADTYPE, H5I_INVALID_HID, "not a dataspace")
+ if(elmt_size == 0)
+ HGOTO_ERROR(H5E_DATASPACE, H5E_BADVALUE, H5I_INVALID_HID, "element size must be greater than 0")
+ if(flags != (flags & H5S_SEL_ITER_ALL_PUBLIC_FLAGS))
+ HGOTO_ERROR(H5E_DATASPACE, H5E_BADVALUE, H5I_INVALID_HID, "invalid selection iterator flag")
+
+ /* Allocate the iterator */
+ if(NULL == (sel_iter = H5FL_MALLOC(H5S_sel_iter_t)))
+ HGOTO_ERROR(H5E_DATASPACE, H5E_CANTALLOC, H5I_INVALID_HID, "can't allocate selection iterator")
+
+ /* Add flag to indicate that this iterator is from an API call */
+ flags |= H5S_SEL_ITER_API_CALL;
+
+ /* Initialize the selection iterator */
+ if(H5S_select_iter_init(sel_iter, space, elmt_size, flags) < 0)
+ HGOTO_ERROR(H5E_DATASPACE, H5E_CANTINIT, H5I_INVALID_HID, "unable to initialize selection iterator")
+
+ /* Atomize */
+ if((ret_value = H5I_register(H5I_SPACE_SEL_ITER, sel_iter, TRUE)) < 0)
+ HGOTO_ERROR(H5E_DATASPACE, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register dataspace selection iterator atom")
+
+done:
+ FUNC_LEAVE_API(ret_value)
+} /* end H5Ssel_iter_create() */
+
+
+/*--------------------------------------------------------------------------
+ NAME
+ H5Ssel_iter_get_seq_list
+ PURPOSE
+ Retrieve a list of offset / length sequences for the elements in an iterator
+ USAGE
+ herr_t H5Ssel_iter_get_seq_list(sel_iter_id, maxseq, maxbytes, nseq, nbytes, off, len)
+ hid_t sel_iter_id; IN: ID of the dataspace selection iterator to retrieve sequence from
+ size_t maxseq; IN: Max. # of sequences to retrieve
+ size_t maxbytes; IN: Max. # of bytes to retrieve in sequences
+ size_t *nseq; OUT: # of sequences retrieved
+ size_t *nbytes; OUT: # of bytes retrieved, in all sequences
+ hsize_t *off; OUT: Array of sequence offsets
+ size_t *len; OUT: Array of sequence lengths
+ RETURNS
+ Non-negative on success / Negative on failure
+ DESCRIPTION
+ Retrieve a list of offset / length pairs (a list of "sequences") matching
+ the selected elements for an iterator, according to the iteration order for
+ the iterator. The lengths returned are in _bytes_, not elements.
+
+ Note that the iteration order for "all" and "hyperslab" selections is
+ row-major (i.e. "C-ordered"), but the iteration order for "point"
+ selections is "in order selected", unless the H5S_SEL_ITER_GET_SEQ_LIST_SORTED
+ flag is passed to H5Sset_iter_create for a point selection.
+
+ MAXSEQ and MAXBYTES specify the most sequences or bytes possible to
+ place into the OFF and LEN arrays. *NSEQ and *NBYTES return the actual
+ number of sequences and bytes put into the arrays.
+
+ Each call to H5Ssel_iter_get_seq_list() will retrieve the next set
+ of sequences for the selection being iterated over.
+
+ The total number of bytes possible to retrieve from a selection iterator
+ is the 'elmt_size' passed to H5Ssel_iter_create multiplied by the number
+ of elements selected in the dataspace the iterator was created from
+ (which can be retrieved with H5Sget_select_npoints). When there are no
+ further sequences of elements to retrieve, calls to this routine will
+ set *NSEQ and *NBYTES to zero.
+ PROGRAMMER
+ Quincey Koziol - February 11, 2019
+ GLOBAL VARIABLES
+ COMMENTS, BUGS, ASSUMPTIONS
+ EXAMPLES
+ REVISION LOG
+--------------------------------------------------------------------------*/
+herr_t
+H5Ssel_iter_get_seq_list(hid_t sel_iter_id, size_t maxseq, size_t maxbytes,
+ size_t *nseq, size_t *nbytes, hsize_t *off, size_t *len)
+{
+ H5S_sel_iter_t *sel_iter; /* Dataspace selection iterator to operate on */
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_API(FAIL)
+ H5TRACE7("e", "izz*z*z*h*z", sel_iter_id, maxseq, maxbytes, nseq, nbytes, off,
+ len);
+
+ /* Check args */
+ if(NULL == (sel_iter = (H5S_sel_iter_t *)H5I_object_verify(sel_iter_id, H5I_SPACE_SEL_ITER)))
+ HGOTO_ERROR(H5E_DATASPACE, H5E_BADTYPE, FAIL, "not a dataspace selection iterator")
+ if(NULL == nseq)
+ HGOTO_ERROR(H5E_DATASPACE, H5E_BADVALUE, FAIL, "'nseq' pointer is NULL")
+ if(NULL == nbytes)
+ HGOTO_ERROR(H5E_DATASPACE, H5E_BADVALUE, FAIL, "'nbytes' pointer is NULL")
+ if(NULL == off)
+ HGOTO_ERROR(H5E_DATASPACE, H5E_BADVALUE, FAIL, "offset array pointer is NULL")
+ if(NULL == len)
+ HGOTO_ERROR(H5E_DATASPACE, H5E_BADVALUE, FAIL, "length array pointer is NULL")
+
+ /* Get the sequences of bytes */
+ if(maxseq > 0 && maxbytes > 0) {
+ if(H5S_SELECT_ITER_GET_SEQ_LIST(sel_iter, maxseq, maxbytes, nseq, nbytes, off, len) < 0)
+ HGOTO_ERROR(H5E_DATASPACE, H5E_CANTGET, FAIL, "sequence length generation failed")
+ } /* end if */
+ else
+ *nseq = *nbytes = 0;
+
+done:
+ FUNC_LEAVE_API(ret_value)
+} /* end H5Ssel_iter_get_seq_list() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5S_sel_iter_close
+ *
+ * Purpose: Releases a dataspace selection iterator and its memory.
+ *
+ * Return: Non-negative on success / Negative on failure
+ *
+ * Programmer: Quincey Koziol
+ * Monday, February 11, 2019
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5S_sel_iter_close(H5S_sel_iter_t *sel_iter)
+{
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_NOAPI(FAIL)
+
+ /* Sanity check */
+ HDassert(sel_iter);
+
+ /* Call selection type-specific release routine */
+ if(H5S_SELECT_ITER_RELEASE(sel_iter) < 0)
+ HGOTO_ERROR(H5E_DATASPACE, H5E_CANTRELEASE, FAIL, "problem releasing a selection iterator's type-specific info")
+
+ /* Release the structure */
+ sel_iter = H5FL_FREE(H5S_sel_iter_t, sel_iter);
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5S_sel_iter_close() */
+
+
+/*--------------------------------------------------------------------------
+ NAME
+ H5Ssel_iter_close
+ PURPOSE
+ Close a dataspace selection iterator
+ USAGE
+ herr_t H5Ssel_iter_close(sel_iter_id)
+ hid_t sel_iter_id; IN: ID of the dataspace selection iterator to close
+ RETURNS
+ Non-negative on success / Negative on failure
+ DESCRIPTION
+ Close a dataspace selection iterator, releasing its state.
+ PROGRAMMER
+ Quincey Koziol - February 11, 2019
+ GLOBAL VARIABLES
+ COMMENTS, BUGS, ASSUMPTIONS
+ EXAMPLES
+ REVISION LOG
+--------------------------------------------------------------------------*/
+herr_t
+H5Ssel_iter_close(hid_t sel_iter_id)
+{
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_API(FAIL)
+ H5TRACE1("e", "i", sel_iter_id);
+
+ /* Check args */
+ if(NULL == H5I_object_verify(sel_iter_id, H5I_SPACE_SEL_ITER))
+ HGOTO_ERROR(H5E_DATASPACE, H5E_BADTYPE, FAIL, "not a dataspace selection iterator")
+
+ /* When the reference count reaches zero the resources are freed */
+ if(H5I_dec_app_ref(sel_iter_id) < 0)
+ HGOTO_ERROR(H5E_DATASPACE, H5E_CANTDEC, FAIL, "problem freeing dataspace selection iterator ID")
+
+done:
+ FUNC_LEAVE_API(ret_value)
+} /* end H5Ssel_iter_close() */
diff --git a/src/H5Stest.c b/src/H5Stest.c
index a7bee2b..2c42713 100644
--- a/src/H5Stest.c
+++ b/src/H5Stest.c
@@ -17,23 +17,60 @@
* Purpose: Dataspace selection testing functions.
*/
+/****************/
+/* Module Setup */
+/****************/
+
#include "H5Smodule.h" /* This source code file is part of the H5S module */
#define H5S_TESTING /*suppress warning about H5S testing funcs*/
+/***********/
+/* Headers */
+/***********/
#include "H5private.h" /* Generic Functions */
#include "H5Eprivate.h" /* Error handling */
#include "H5Iprivate.h" /* IDs */
#include "H5Spkg.h" /* Dataspaces */
+/****************/
+/* Local Macros */
+/****************/
+
+
+/******************/
+/* Local Typedefs */
+/******************/
+
+
+/********************/
+/* Local Prototypes */
+/********************/
+
+
+/*****************************/
+/* Library Private Variables */
+/*****************************/
+
+
+/*********************/
+/* Package Variables */
+/*********************/
+
+
+/*******************/
+/* Local Variables */
+/*******************/
+
+
/*--------------------------------------------------------------------------
NAME
- H5S_select_shape_same_test
+ H5S__select_shape_same_test
PURPOSE
Determine if two dataspace selections are the same shape
USAGE
- htri_t H5S_select_shape_same_test(sid1, sid2)
+ htri_t H5S__select_shape_same_test(sid1, sid2)
hid_t sid1; IN: 1st dataspace to compare
hid_t sid2; IN: 2nd dataspace to compare
RETURNS
@@ -48,13 +85,13 @@
REVISION LOG
--------------------------------------------------------------------------*/
htri_t
-H5S_select_shape_same_test(hid_t sid1, hid_t sid2)
+H5S__select_shape_same_test(hid_t sid1, hid_t sid2)
{
H5S_t *space1; /* Pointer to 1st dataspace */
H5S_t *space2; /* Pointer to 2nd dataspace */
htri_t ret_value = FAIL; /* Return value */
- FUNC_ENTER_NOAPI(FAIL)
+ FUNC_ENTER_PACKAGE
/* Get dataspace structures */
if(NULL == (space1 = (H5S_t *)H5I_object_verify(sid1, H5I_DATASPACE)))
@@ -68,19 +105,25 @@ H5S_select_shape_same_test(hid_t sid1, hid_t sid2)
done:
FUNC_LEAVE_NOAPI(ret_value)
-} /* H5S_select_shape_same_test() */
+} /* H5S__select_shape_same_test() */
/*--------------------------------------------------------------------------
NAME
- H5S_get_rebuild_status_test
+ H5S__get_rebuild_status_test
PURPOSE
- Determine the status of hyperslab rebuild
+ Determine the status of the diminfo_valid field (whether we know the
+ selection information for an equivalent single hyperslab selection)
+ before and after calling H5S__hyper_rebuild.
USAGE
- htri_t H5S_inquiry_rebuild_status(hid_t space_id)
+ herr_t H5S__get_rebuild_status_test(space_id, status1, status2)
hid_t space_id; IN: dataspace id
+ H5S_diminfo_valid_t *status1; OUT: status before calling
+ H5S__hyper_rebuild
+ H5S_diminfo_valid_t *status2; OUT: status after calling
+ H5S__hyper_rebuild
RETURNS
- Non-negative TRUE/FALSE on success, negative on failure
+ Non-negative on success, negative on failure
DESCRIPTION
Query the status of rebuilding the hyperslab
GLOBAL VARIABLES
@@ -89,21 +132,283 @@ done:
EXAMPLES
REVISION LOG
--------------------------------------------------------------------------*/
+herr_t
+H5S__get_rebuild_status_test(hid_t space_id, H5S_diminfo_valid_t *status1,
+ H5S_diminfo_valid_t *status2)
+{
+ H5S_t *space; /* Pointer to 1st dataspace */
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_PACKAGE
+
+ HDassert(status1);
+ HDassert(status2);
+
+ /* Get dataspace structures */
+ if(NULL == (space = (H5S_t *)H5I_object_verify(space_id, H5I_DATASPACE)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataspace")
+
+ *status1 = space->select.sel_info.hslab->diminfo_valid;
+
+ /* Fully rebuild diminfo, if necessary */
+ if(*status1 == H5S_DIMINFO_VALID_NO)
+ H5S__hyper_rebuild(space);
+
+ *status2 = space->select.sel_info.hslab->diminfo_valid;
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* H5S__get_rebuild_status_test() */
+
+
+/*--------------------------------------------------------------------------
+ NAME
+ H5S__get_diminfo_status_test
+ PURPOSE
+ Determine the status of the diminfo_valid field (whether we know the
+ selection information for an equivalent single hyperslab selection)
+ USAGE
+ herr_t H5S__get_diminfo_status_test(space_id, status)
+ hid_t space_id; IN: dataspace id
+ H5S_diminfo_valid_t *status; OUT: status of diminfo_valid
+ RETURNS
+ Non-negative on success, negative on failure
+ DESCRIPTION
+ Query the status of rebuilding the hyperslab
+ GLOBAL VARIABLES
+ COMMENTS, BUGS, ASSUMPTIONS
+ DO NOT USE THIS FUNCTION FOR ANYTHING EXCEPT TESTING
+ EXAMPLES
+ REVISION LOG
+--------------------------------------------------------------------------*/
+herr_t
+H5S__get_diminfo_status_test(hid_t space_id, H5S_diminfo_valid_t *status)
+{
+ H5S_t *space; /* Pointer to 1st dataspace */
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_PACKAGE
+
+ HDassert(status);
+
+ /* Get dataspace structures */
+ if(NULL == (space = (H5S_t *)H5I_object_verify(space_id, H5I_DATASPACE)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataspace")
+
+ *status = space->select.sel_info.hslab->diminfo_valid;
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* H5S__get_diminfo_status_test() */
+
+/*--------------------------------------------------------------------------
+ NAME
+ H5S__check_spans_tail_ptr
+ PURPOSE
+ Determine if the tail pointer of the spans are correctly set
+ USAGE
+ herr_t H5S__check_spans_tail_ptr(span_lst)
+ const H5S_hyper_span_info_t *span_lst; IN: the spans to check for taill pointers
+ RETURNS
+ SUCCEED/FAIL
+ DESCRIPTION
+ Checks to see if the current selection in the dataspaces has tail pointers of each
+ dimension correctly set.
+ GLOBAL VARIABLES
+ COMMENTS, BUGS, ASSUMPTIONS
+ Only check the hyperslab selection
+ EXAMPLES
+ REVISION LOG
+--------------------------------------------------------------------------*/
+static herr_t
+H5S__check_spans_tail_ptr(const H5S_hyper_span_info_t *span_lst)
+{
+ H5S_hyper_span_t *cur_elem;
+ H5S_hyper_span_t *actual_tail = NULL;
+ htri_t ret_value = TRUE; /* Return value */
+
+ FUNC_ENTER_STATIC
+
+ HDassert(span_lst);
+
+ cur_elem = span_lst->head;
+ while(cur_elem) {
+ actual_tail = cur_elem;
+
+ /* check the next dimension of lower order */
+ if(NULL != cur_elem->down)
+ if((ret_value = H5S__check_spans_tail_ptr(cur_elem->down)) < 0)
+ HGOTO_ERROR(H5E_DATASPACE, H5E_INCONSISTENTSTATE, FAIL, "the seletion has inconsistent tail pointers")
+
+ cur_elem = cur_elem->next;
+ } /* end while */
+ if(actual_tail != span_lst->tail)
+ HGOTO_ERROR(H5E_DATASPACE, H5E_INCONSISTENTSTATE, FAIL, "the seletion has inconsistent tail pointers")
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* H5S__check_spans_tail_ptr */
+
+/*--------------------------------------------------------------------------
+ NAME
+ H5S__check_points_tail_ptr
+ PURPOSE
+ Determine if the tail pointer of the points list are correctly set
+ USAGE
+ herr_t H5S__check_points_tail_ptr(pnt_lst)
+ const H5S_pnt_list_t *pnt_lst; IN: the points list to check for taill pointers
+ RETURNS
+ SUCCEED/FAIL
+ DESCRIPTION
+ Checks to see if the current selection in the dataspaces has tail pointers correctly set.
+ GLOBAL VARIABLES
+ COMMENTS, BUGS, ASSUMPTIONS
+ Only check the points selection
+ EXAMPLES
+ REVISION LOG
+--------------------------------------------------------------------------*/
+static herr_t
+H5S__check_points_tail_ptr(const H5S_pnt_list_t *pnt_lst)
+{
+ H5S_pnt_node_t *cur_elem;
+ H5S_pnt_node_t *actual_tail = NULL;
+ htri_t ret_value = TRUE; /* Return value */
+
+ FUNC_ENTER_STATIC
+
+ HDassert(pnt_lst);
+
+ cur_elem = pnt_lst->head;
+ while(cur_elem) {
+ actual_tail = cur_elem;
+ cur_elem = cur_elem->next;
+ } /* end while */
+ if(actual_tail != pnt_lst->tail)
+ HGOTO_ERROR(H5E_DATASPACE, H5E_INCONSISTENTSTATE, FAIL, "the seletion has inconsistent tail pointers")
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* H5S__check_points_tail_ptr */
+
+
+/*--------------------------------------------------------------------------
+ NAME
+ H5S__check_internal_consistency
+ PURPOSE
+ Determine if internal data structures are consistent
+ USAGE
+ herr_t H5S__check_internal_consistency(space)
+ const H5S_t *space; IN: 1st Dataspace pointer to compare
+ RETURNS
+ SUCCEED/FAIL
+ DESCRIPTION
+ Checks to see if the current selection in the dataspaces has consistent
+ state of internal data structure.
+ GLOBAL VARIABLES
+ COMMENTS, BUGS, ASSUMPTIONS
+ Currently only check the hyperslab selection
+ EXAMPLES
+ REVISION LOG
+--------------------------------------------------------------------------*/
+static herr_t
+H5S__check_internal_consistency(const H5S_t *space)
+{
+ hsize_t low_bounds[H5S_MAX_RANK];
+ hsize_t high_bounds[H5S_MAX_RANK];
+ unsigned u;
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_STATIC
+
+ /* Check args */
+ HDassert(space);
+
+ if(space->select.type->type == H5S_SEL_NONE)
+ HGOTO_DONE(ret_value);
+
+ /* Initialize the inputs */
+ for(u = 0; u < space->extent.rank; u++) {
+ low_bounds[u] = HSIZET_MAX;
+ high_bounds[u] = 0;
+ } /* end for */
+
+ /* Check the bound box */
+ if(H5S_get_select_bounds(space, low_bounds, high_bounds) < 0)
+ HGOTO_ERROR(H5E_DATASPACE, H5E_INCONSISTENTSTATE, FAIL, "the bound box could not be retrieved")
+
+ if(space->select.type->type == H5S_SEL_HYPERSLABS) {
+ H5S_hyper_sel_t *hslab = space->select.sel_info.hslab;
+
+ if(space->select.sel_info.hslab->diminfo_valid == H5S_DIMINFO_VALID_YES) {
+ for(u = 0; u < space->extent.rank; u++) {
+ if((hsize_t)((hssize_t)hslab->diminfo.low_bounds[u] + space->select.offset[u]) != low_bounds[u])
+ HGOTO_ERROR(H5E_DATASPACE, H5E_INCONSISTENTSTATE, FAIL, "the lower bound box of the selection is inconsistent")
+ if((hsize_t)((hssize_t)hslab->diminfo.high_bounds[u] + space->select.offset[u]) != high_bounds[u])
+ HGOTO_ERROR(H5E_DATASPACE, H5E_INCONSISTENTSTATE, FAIL, "the higher bound box of the selection is inconsistent")
+ } /* end for */
+ } /* end if */
+ else {
+ for(u = 0; u < space->extent.rank; u++) {
+ if((hsize_t)((hssize_t)hslab->span_lst->low_bounds[u] + space->select.offset[u]) != low_bounds[u])
+ HGOTO_ERROR(H5E_DATASPACE, H5E_INCONSISTENTSTATE, FAIL, "the lower bound box of the selection is inconsistent")
+ if((hsize_t)((hssize_t)hslab->span_lst->high_bounds[u] + space->select.offset[u]) != high_bounds[u])
+ HGOTO_ERROR(H5E_DATASPACE, H5E_INCONSISTENTSTATE, FAIL, "the higher bound box of the selection is inconsistent")
+ } /* end for */
+ } /* end else */
+
+ /* check the tail pointer */
+ if((NULL != hslab) && (NULL != hslab->span_lst))
+ if(H5S__check_spans_tail_ptr(hslab->span_lst) < 0)
+ HGOTO_ERROR(H5E_DATASPACE, H5E_INCONSISTENTSTATE, FAIL, "the seletion has inconsistent tail pointers")
+ } /* end if */
+ else if(space->select.type->type == H5S_SEL_POINTS) {
+ H5S_pnt_list_t *pnt_lst = space->select.sel_info.pnt_lst;
+
+ if(NULL != pnt_lst)
+ if(H5S__check_points_tail_ptr(pnt_lst) < 0)
+ HGOTO_ERROR(H5E_DATASPACE, H5E_INCONSISTENTSTATE, FAIL, "the seletion has inconsistent tail pointers")
+ } /* end else-if */
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* H5S__check_internal_consistency */
+
+/*--------------------------------------------------------------------------
+ NAME
+ H5S__internal_consistency_test
+ PURPOSE
+ Determine if states of internal data structures are consistent
+ USAGE
+ htri_t H5S__internal_consistency_test(hid_t space_id)
+ hid_t space_id; IN: dataspace id
+ RETURNS
+ Non-negative TRUE/FALSE on success, negative on failure
+ DESCRIPTION
+ Check the states of internal data structures of the hyperslab, and see
+ whether they are consistent or not
+ GLOBAL VARIABLES
+ COMMENTS, BUGS, ASSUMPTIONS
+ DO NOT USE THIS FUNCTION FOR ANYTHING EXCEPT TESTING
+ EXAMPLES
+ REVISION LOG
+--------------------------------------------------------------------------*/
htri_t
-H5S_get_rebuild_status_test(hid_t space_id)
+H5S__internal_consistency_test(hid_t space_id)
{
H5S_t *space; /* Pointer to 1st dataspace */
- htri_t ret_value = FAIL; /* Return value */
+ htri_t ret_value = TRUE; /* Return value */
- FUNC_ENTER_NOAPI(FAIL)
+ FUNC_ENTER_PACKAGE
/* Get dataspace structures */
if(NULL == (space = (H5S_t *)H5I_object_verify(space_id, H5I_DATASPACE)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataspace")
- ret_value = (htri_t)space->select.sel_info.hslab->diminfo_valid;
+ /* Check if the dataspace selections are the same shape */
+ if(FAIL == H5S__check_internal_consistency(space))
+ HGOTO_ERROR(H5E_DATASPACE, H5E_INCONSISTENTSTATE, FAIL, "The dataspace has inconsistent internal state")
done:
FUNC_LEAVE_NOAPI(ret_value)
-} /* H5S_get_rebuild_status_test() */
+} /* H5S__internal_consistency_test() */
diff --git a/src/H5T.c b/src/H5T.c
index 9544488..6fe291e 100644
--- a/src/H5T.c
+++ b/src/H5T.c
@@ -513,6 +513,7 @@ H5FL_DEFINE(H5T_shared_t);
const unsigned H5O_dtype_ver_bounds[] = {
H5O_DTYPE_VERSION_1, /* H5F_LIBVER_EARLIEST */
H5O_DTYPE_VERSION_3, /* H5F_LIBVER_V18 */
+ H5O_DTYPE_VERSION_3, /* H5F_LIBVER_V110 */
H5O_DTYPE_VERSION_LATEST /* H5F_LIBVER_LATEST */
};
@@ -1397,7 +1398,7 @@ H5T_top_term_package(void)
if((path->conv.u.lib_func)((hid_t)FAIL, (hid_t)FAIL, &(path->cdata), (size_t)0, (size_t)0, (size_t)0, NULL, NULL) < 0) {
#ifdef H5T_DEBUG
if (H5DEBUG(T)) {
- fprintf(H5DEBUG(T), "H5T: conversion function "
+ HDfprintf(H5DEBUG(T), "H5T: conversion function "
"0x%08lx failed to free private data for "
"%s (ignored)\n",
(unsigned long)(path->conv.u.lib_func), path->name);
@@ -1696,33 +1697,42 @@ done:
*-------------------------------------------------------------------------
*/
hid_t
-H5Tcopy(hid_t type_id)
+H5Tcopy(hid_t obj_id)
{
- H5T_t *dt = NULL; /* Pointer to the datatype to copy */
- H5T_t *new_dt = NULL;
- hid_t ret_value = H5I_INVALID_HID; /* Return value */
+ H5T_t *dt = NULL; /* Pointer to the datatype to copy */
+ H5T_t *new_dt = NULL; /* Pointer to the new datatype */
+ hid_t dset_tid = H5I_INVALID_HID; /* Datatype ID from dataset */
+ hid_t ret_value = H5I_INVALID_HID; /* Return value */
FUNC_ENTER_API(H5I_INVALID_HID)
- H5TRACE1("i", "i", type_id);
+ H5TRACE1("i", "i", obj_id);
- switch(H5I_get_type(type_id)) {
+ switch(H5I_get_type(obj_id)) {
case H5I_DATATYPE:
- /* The argument is a datatype handle */
- if(NULL == (dt = (H5T_t *)H5I_object(type_id)))
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not a datatype")
+ if(NULL == (dt = (H5T_t *)H5I_object(obj_id)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "type_id is not a datatype ID")
break;
case H5I_DATASET:
- {
- H5D_t *dset; /* Dataset for datatype */
+ {
+ H5VL_object_t *vol_obj = NULL; /* Dataset structure */
+
+ /* Check args */
+ if(NULL == (vol_obj = (H5VL_object_t *)H5I_object_verify(obj_id, H5I_DATASET)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "type_id is not a dataset ID")
+
+ /* Get the datatype from the dataset
+ * NOTE: This will have to be closed after we're done with it.
+ */
+ if(H5VL_dataset_get(vol_obj, H5VL_DATASET_GET_TYPE, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, &dset_tid) < 0)
+ HGOTO_ERROR(H5E_DATATYPE, H5E_CANTGET, H5I_INVALID_HID, "unable to get datatype from the dataset")
+
+ /* Unwrap the type ID */
+ if(NULL == (dt = (H5T_t *)H5I_object(dset_tid)))
+ HGOTO_ERROR(H5E_DATATYPE, H5E_BADTYPE, H5I_INVALID_HID, "received invalid datatype from the dataset")
- /* The argument is a dataset handle */
- if(NULL == (dset = (H5D_t *)H5VL_object(type_id)))
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not a dataset")
- if(NULL == (dt = H5D_typeof(dset)))
- HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, H5I_INVALID_HID, "unable to get the dataset datatype")
- }
break;
+ }
case H5I_UNINIT:
case H5I_BADID:
@@ -1737,6 +1747,7 @@ H5Tcopy(hid_t type_id)
case H5I_ERROR_CLASS:
case H5I_ERROR_MSG:
case H5I_ERROR_STACK:
+ case H5I_SPACE_SEL_ITER:
case H5I_NTYPES:
default:
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not a datatype or dataset")
@@ -1746,11 +1757,18 @@ H5Tcopy(hid_t type_id)
if(NULL == (new_dt = H5T_copy(dt, H5T_COPY_TRANSIENT)))
HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, H5I_INVALID_HID, "unable to copy")
- /* Atomize result */
+ /* Get an ID for the copied datatype */
if((ret_value = H5I_register(H5I_DATATYPE, new_dt, TRUE)) < 0)
HGOTO_ERROR(H5E_DATATYPE, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register datatype atom")
done:
+
+ /* If we got a type ID from a passed-in dataset, we need to close that */
+ if(dset_tid != H5I_INVALID_HID)
+ if(H5I_dec_app_ref(dset_tid) < 0)
+ HGOTO_ERROR(H5E_DATATYPE, H5E_BADATOM, FAIL, "problem freeing temporary dataset type ID")
+
+ /* Close the new datatype on errors */
if(H5I_INVALID_HID == ret_value)
if(new_dt && H5T_close_real(new_dt) < 0)
HDONE_ERROR(H5E_DATATYPE, H5E_CANTRELEASE, H5I_INVALID_HID, "unable to release datatype info")
@@ -3338,7 +3356,7 @@ H5T_copy(H5T_t *old_dt, H5T_copy_t method)
if (NULL == new_dt->shared->u.compnd.memb)
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed")
- HDmemcpy(new_dt->shared->u.compnd.memb, old_dt->shared->u.compnd.memb,
+ H5MM_memcpy(new_dt->shared->u.compnd.memb, old_dt->shared->u.compnd.memb,
new_dt->shared->u.compnd.nmembs * sizeof(H5T_cmemb_t));
} /* end if */
@@ -3404,7 +3422,7 @@ H5T_copy(H5T_t *old_dt, H5T_copy_t method)
(uint8_t *)H5MM_malloc(new_dt->shared->u.enumer.nalloc * new_dt->shared->size);
if(NULL == new_dt->shared->u.enumer.value)
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed")
- HDmemcpy(new_dt->shared->u.enumer.value, old_dt->shared->u.enumer.value,
+ H5MM_memcpy(new_dt->shared->u.enumer.value, old_dt->shared->u.enumer.value,
new_dt->shared->u.enumer.nmembs * new_dt->shared->size);
for(i = 0; i < new_dt->shared->u.enumer.nmembs; i++) {
s = old_dt->shared->u.enumer.name[i];
diff --git a/src/H5Tcommit.c b/src/H5Tcommit.c
index 712b264..c6b85a5 100644
--- a/src/H5Tcommit.c
+++ b/src/H5Tcommit.c
@@ -1211,7 +1211,7 @@ H5T_save_refresh_state(hid_t tid, H5O_shared_t *cached_H5O_shared)
HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINC, FAIL, "can't increment object count")
/* Cache the H5O_shared_t data */
- HDmemcpy(cached_H5O_shared, &(vol_dt->sh_loc), sizeof(H5O_shared_t));
+ H5MM_memcpy(cached_H5O_shared, &(vol_dt->sh_loc), sizeof(H5O_shared_t));
done:
FUNC_LEAVE_NOAPI(ret_value)
@@ -1245,7 +1245,7 @@ H5T_restore_refresh_state(hid_t tid, H5O_shared_t *cached_H5O_shared)
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "tid is not not a named datatype ID")
/* Restore the H5O_shared_t data */
- HDmemcpy(&(vol_dt->sh_loc), cached_H5O_shared, sizeof(H5O_shared_t));
+ H5MM_memcpy(&(vol_dt->sh_loc), cached_H5O_shared, sizeof(H5O_shared_t));
/* Decrement the ref. count for this object in the top file */
if(H5FO_top_decr(vol_dt->sh_loc.file, vol_dt->sh_loc.u.loc.oh_addr) < 0)
diff --git a/src/H5Tconv.c b/src/H5Tconv.c
index e6d83bb..7d47483 100644
--- a/src/H5Tconv.c
+++ b/src/H5Tconv.c
@@ -828,7 +828,7 @@ done: \
/* Macro defining action on source data which needs to be aligned (before main action) */
#define H5T_CONV_LOOP_PRE_SALIGN(ST) { \
- HDmemcpy(&src_aligned, src, sizeof(ST)); \
+ H5MM_memcpy(&src_aligned, src, sizeof(ST)); \
}
/* Macro defining action on source data which doesn't need to be aligned (before main action) */
@@ -854,7 +854,7 @@ done: \
/* Macro defining action on destination data which needs to be aligned (after main action) */
#define H5T_CONV_LOOP_POST_DALIGN(DT) { \
- HDmemcpy(dst, &dst_aligned, sizeof(DT)); \
+ H5MM_memcpy(dst, &dst_aligned, sizeof(DT)); \
}
/* Macro defining action on destination data which doesn't need to be aligned (after main action) */
@@ -1797,7 +1797,7 @@ H5T__conv_b_b(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts,
* should copy the value to the true destination buffer.
*/
if(d == dbuf)
- HDmemcpy(dp, d, dst->shared->size);
+ H5MM_memcpy(dp, d, dst->shared->size);
if(buf_stride) {
sp += direction * (ssize_t)buf_stride; /* Note that cast is checked with H5_CHECK_OVERFLOW, above */
dp += direction * (ssize_t)buf_stride; /* Note that cast is checked with H5_CHECK_OVERFLOW, above */
@@ -2771,7 +2771,7 @@ H5T__conv_enum(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts,
case H5T_CONV_FREE:
#ifdef H5T_DEBUG
if (H5DEBUG(T)) {
- fprintf(H5DEBUG(T), " Using %s mapping function%s\n",
+ HDfprintf(H5DEBUG(T), " Using %s mapping function%s\n",
priv->length?"O(1)":"O(log N)",
priv->length?"":", where N is the number of enum members");
}
@@ -2852,7 +2852,7 @@ H5T__conv_enum(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts,
else if(except_ret == H5T_CONV_ABORT)
HGOTO_ERROR(H5E_DATATYPE, H5E_CANTCONVERT, FAIL, "can't handle conversion exception")
} else
- HDmemcpy(d,
+ H5MM_memcpy(d,
dst->shared->u.enumer.value + (unsigned)priv->src2dst[n] * dst->shared->size,
dst->shared->size);
} /* end if */
@@ -2888,7 +2888,7 @@ H5T__conv_enum(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts,
} /* end if */
else {
HDassert(priv->src2dst[md] >= 0);
- HDmemcpy(d,
+ H5MM_memcpy(d,
dst->shared->u.enumer.value + (unsigned)priv->src2dst[md] * dst->shared->size,
dst->shared->size);
} /* end else */
@@ -3846,7 +3846,7 @@ H5T__conv_i_i(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts,
* should copy the value to the true destination buffer.
*/
if(d==dbuf)
- HDmemcpy(dp, d, dst->shared->size);
+ H5MM_memcpy(dp, d, dst->shared->size);
/* Advance source & destination pointers by delta amounts */
sp += src_delta;
@@ -4432,7 +4432,7 @@ H5T__conv_f_f(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts,
*/
next:
if(d == dbuf)
- HDmemcpy(dp, d, dst_p->shared->size);
+ H5MM_memcpy(dp, d, dst_p->shared->size);
/* Advance source & destination pointers by delta amounts */
sp += src_delta;
@@ -4604,7 +4604,7 @@ H5T__conv_s_s(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts,
--nchars;
nchars = MIN(dst->shared->size, nchars);
if(d != s)
- HDmemcpy(d, s, nchars);
+ H5MM_memcpy(d, s, nchars);
break;
case H5T_STR_RESERVED_3:
@@ -4666,7 +4666,7 @@ H5T__conv_s_s(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts,
* should copy the value to the true destination buffer.
*/
if(d == dbuf)
- HDmemcpy(dp, d, dst->shared->size);
+ H5MM_memcpy(dp, d, dst->shared->size);
/* Advance source & destination pointers by delta amounts */
sp += src_delta;
@@ -8825,7 +8825,7 @@ H5T__conv_f_i(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts,
* should copy the value to the true destination buffer.
*/
if (d==dbuf)
- HDmemcpy (dp, d, dst_p->shared->size);
+ H5MM_memcpy (dp, d, dst_p->shared->size);
if (buf_stride) {
sp += direction * (ssize_t) buf_stride;
dp += direction * (ssize_t) buf_stride;
@@ -9235,7 +9235,7 @@ H5T__conv_i_f(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts,
* should copy the value to the true destination buffer.
*/
if (d==dbuf)
- HDmemcpy (dp, d, dst_p->shared->size);
+ H5MM_memcpy (dp, d, dst_p->shared->size);
if (buf_stride) {
sp += direction * (ssize_t) buf_stride;
dp += direction * (ssize_t) buf_stride;
diff --git a/src/H5Tenum.c b/src/H5Tenum.c
index 0ed1775..ff88fab 100644
--- a/src/H5Tenum.c
+++ b/src/H5Tenum.c
@@ -223,7 +223,7 @@ H5T__enum_insert(const H5T_t *dt, const char *name, const void *value)
dt->shared->u.enumer.sorted = H5T_SORT_NONE;
i = dt->shared->u.enumer.nmembs++;
dt->shared->u.enumer.name[i] = H5MM_xstrdup(name);
- HDmemcpy(dt->shared->u.enumer.value+i*dt->shared->size, value, dt->shared->size);
+ H5MM_memcpy(dt->shared->u.enumer.value+i*dt->shared->size, value, dt->shared->size);
done:
FUNC_LEAVE_NOAPI(ret_value)
@@ -298,7 +298,7 @@ H5T__get_member_value(const H5T_t *dt, unsigned membno, void *value/*out*/)
HDassert(dt);
HDassert(value);
- HDmemcpy(value, dt->shared->u.enumer.value + membno*dt->shared->size, dt->shared->size);
+ H5MM_memcpy(value, dt->shared->u.enumer.value + membno*dt->shared->size, dt->shared->size);
FUNC_LEAVE_NOAPI(SUCCEED)
}
@@ -569,7 +569,7 @@ H5T_enum_valueof(const H5T_t *dt, const char *name, void *value/*out*/)
if (cmp!=0)
HGOTO_ERROR(H5E_DATATYPE, H5E_NOTFOUND, FAIL, "string doesn't exist in the enumeration type")
- HDmemcpy(value, copied_dt->shared->u.enumer.value+md*copied_dt->shared->size, copied_dt->shared->size);
+ H5MM_memcpy(value, copied_dt->shared->u.enumer.value+md*copied_dt->shared->size, copied_dt->shared->size);
done:
if(copied_dt)
diff --git a/src/H5Tfields.c b/src/H5Tfields.c
index be62d85..8202c2c 100644
--- a/src/H5Tfields.c
+++ b/src/H5Tfields.c
@@ -351,10 +351,10 @@ H5T__sort_value(const H5T_t *dt, int *map)
dt->shared->u.enumer.name[j + 1] = tmp;
/* Swap values */
- HDmemcpy(tbuf, dt->shared->u.enumer.value + (j * size), size);
- HDmemcpy(dt->shared->u.enumer.value + (j * size),
+ H5MM_memcpy(tbuf, dt->shared->u.enumer.value + (j * size), size);
+ H5MM_memcpy(dt->shared->u.enumer.value + (j * size),
dt->shared->u.enumer.value + ((j + 1) * size), size);
- HDmemcpy(dt->shared->u.enumer.value + ((j + 1) * size), tbuf, size);
+ H5MM_memcpy(dt->shared->u.enumer.value + ((j + 1) * size), tbuf, size);
/* Swap map */
if(map) {
@@ -457,10 +457,10 @@ H5T__sort_name(const H5T_t *dt, int *map)
dt->shared->u.enumer.name[j+1] = tmp;
/* Swap values */
- HDmemcpy(tbuf, dt->shared->u.enumer.value+j*size, size);
- HDmemcpy(dt->shared->u.enumer.value+j*size,
+ H5MM_memcpy(tbuf, dt->shared->u.enumer.value+j*size, size);
+ H5MM_memcpy(dt->shared->u.enumer.value+j*size,
dt->shared->u.enumer.value+(j+1)*size, size);
- HDmemcpy(dt->shared->u.enumer.value+(j+1)*size, tbuf, size);
+ H5MM_memcpy(dt->shared->u.enumer.value+(j+1)*size, tbuf, size);
/* Swap map */
if (map) {
diff --git a/src/H5Tnative.c b/src/H5Tnative.c
index c9ad01a..d213c45 100644
--- a/src/H5Tnative.c
+++ b/src/H5Tnative.c
@@ -369,7 +369,7 @@ H5T__get_native_type(H5T_t *dtype, H5T_direction_t direction, size_t *struct_ali
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "cannot get member name")
if(H5T__get_member_value(dtype, u, tmp_memb_value) < 0)
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "cannot get member value")
- HDmemcpy(memb_value, tmp_memb_value, H5T_get_size(super_type));
+ H5MM_memcpy(memb_value, tmp_memb_value, H5T_get_size(super_type));
if(H5T_convert(tpath, super_type_id, nat_super_type_id, (size_t)1, (size_t)0, (size_t)0, memb_value, NULL) < 0)
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "cannot get member value")
@@ -515,6 +515,9 @@ done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5T__get_native_type() */
+/* Disable warning for intentional identical branches here -QAK */
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wduplicated-branches"
/*-------------------------------------------------------------------------
* Function: H5T__get_native_integer
@@ -655,7 +658,11 @@ H5T__get_native_integer(size_t prec, H5T_sign_t sign, H5T_direction_t direction,
done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5T__get_native_integer() */
+#pragma GCC diagnostic pop
+/* Disable warning for intentional identical branches here -QAK */
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wduplicated-branches"
/*-------------------------------------------------------------------------
* Function: H5T__get_native_float
@@ -780,7 +787,11 @@ H5T__get_native_float(size_t size, H5T_direction_t direction, size_t *struct_ali
done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5T__get_native_float() */
+#pragma GCC diagnostic pop
+/* Disable warning for intentional identical branches here -QAK */
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wduplicated-branches"
/*-------------------------------------------------------------------------
* Function: H5T__get_native_bitfield
@@ -866,6 +877,7 @@ H5T__get_native_bitfield(size_t prec, H5T_direction_t direction,
done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5T__get_native_bitfield() */
+#pragma GCC diagnostic pop
/*-------------------------------------------------------------------------
diff --git a/src/H5Torder.c b/src/H5Torder.c
index d687d03..62662d6 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/H5Tvlen.c b/src/H5Tvlen.c
index 841637d..bafb47f 100644
--- a/src/H5Tvlen.c
+++ b/src/H5Tvlen.c
@@ -302,7 +302,7 @@ H5T_vlen_seq_mem_getlen(const void *_vl)
FUNC_LEAVE_NOAPI((ssize_t)vl->len)
#else
HDassert(_vl);
- HDmemcpy(&vl, _vl, sizeof(hvl_t));
+ H5MM_memcpy(&vl, _vl, sizeof(hvl_t));
FUNC_LEAVE_NOAPI((ssize_t)vl.len)
#endif
@@ -339,7 +339,7 @@ H5T_vlen_seq_mem_getptr(void *_vl)
FUNC_LEAVE_NOAPI(vl->p)
#else
HDassert(_vl);
- HDmemcpy(&vl, _vl, sizeof(hvl_t));
+ H5MM_memcpy(&vl, _vl, sizeof(hvl_t));
FUNC_LEAVE_NOAPI(vl.p)
#endif
@@ -376,7 +376,7 @@ H5T_vlen_seq_mem_isnull(const H5F_t H5_ATTR_UNUSED *f, void *_vl)
FUNC_LEAVE_NOAPI((vl->len==0 || vl->p==NULL) ? TRUE : FALSE)
#else
HDassert(_vl);
- HDmemcpy(&vl, _vl, sizeof(hvl_t));
+ H5MM_memcpy(&vl, _vl, sizeof(hvl_t));
FUNC_LEAVE_NOAPI((vl.len==0 || vl.p==NULL) ? TRUE : FALSE)
#endif
@@ -411,13 +411,13 @@ H5T_vlen_seq_mem_read(H5F_t H5_ATTR_UNUSED *f, void *_vl, void *buf, size_t len)
#ifdef H5_NO_ALIGNMENT_RESTRICTIONS
HDassert(vl && vl->p);
- HDmemcpy(buf,vl->p,len);
+ H5MM_memcpy(buf,vl->p,len);
#else
HDassert(_vl);
- HDmemcpy(&vl, _vl, sizeof(hvl_t));
+ H5MM_memcpy(&vl, _vl, sizeof(hvl_t));
HDassert(vl.p);
- HDmemcpy(buf,vl.p,len);
+ H5MM_memcpy(buf,vl.p,len);
#endif
FUNC_LEAVE_NOAPI(SUCCEED)
@@ -463,7 +463,7 @@ H5T_vlen_seq_mem_write(H5F_t H5_ATTR_UNUSED *f, const H5T_vlen_alloc_info_t *vl_
} /* end else */
/* Copy the data into the newly allocated buffer */
- HDmemcpy(vl.p,buf,len);
+ H5MM_memcpy(vl.p,buf,len);
} /* end if */
else
@@ -473,7 +473,7 @@ H5T_vlen_seq_mem_write(H5F_t H5_ATTR_UNUSED *f, const H5T_vlen_alloc_info_t *vl_
vl.len=seq_len;
/* Set pointer in user's buffer with memcpy, to avoid alignment issues */
- HDmemcpy(_vl,&vl,sizeof(hvl_t));
+ H5MM_memcpy(_vl,&vl,sizeof(hvl_t));
done:
FUNC_LEAVE_NOAPI(ret_value)
@@ -507,7 +507,7 @@ H5T_vlen_seq_mem_setnull(H5F_t H5_ATTR_UNUSED *f, void *_vl, void H5_ATTR_UNUSED
vl.p=NULL;
/* Set pointer in user's buffer with memcpy, to avoid alignment issues */
- HDmemcpy(_vl,&vl,sizeof(hvl_t));
+ H5MM_memcpy(_vl,&vl,sizeof(hvl_t));
FUNC_LEAVE_NOAPI(SUCCEED)
} /* end H5T_vlen_seq_mem_setnull() */
@@ -541,7 +541,7 @@ H5T_vlen_str_mem_getlen(const void *_vl)
HDassert(s);
#else
HDassert(_vl);
- HDmemcpy(&s, _vl, sizeof(char *));
+ H5MM_memcpy(&s, _vl, sizeof(char *));
#endif
FUNC_LEAVE_NOAPI((ssize_t)HDstrlen(s))
@@ -576,7 +576,7 @@ H5T_vlen_str_mem_getptr(void *_vl)
HDassert(s);
#else
HDassert(_vl);
- HDmemcpy(&s, _vl, sizeof(char *));
+ H5MM_memcpy(&s, _vl, sizeof(char *));
#endif
FUNC_LEAVE_NOAPI(s)
@@ -607,7 +607,7 @@ H5T_vlen_str_mem_isnull(const H5F_t H5_ATTR_UNUSED *f, void *_vl)
FUNC_ENTER_NOAPI_NOINIT_NOERR
#ifndef H5_NO_ALIGNMENT_RESTRICTIONS
- HDmemcpy(&s, _vl, sizeof(char *));
+ H5MM_memcpy(&s, _vl, sizeof(char *));
#endif
FUNC_LEAVE_NOAPI(s==NULL ? TRUE : FALSE)
@@ -644,10 +644,10 @@ H5T_vlen_str_mem_read(H5F_t H5_ATTR_UNUSED *f, void *_vl, void *buf, size_t len)
HDassert(s);
#else
HDassert(_vl);
- HDmemcpy(&s, _vl, sizeof(char *));
+ H5MM_memcpy(&s, _vl, sizeof(char *));
#endif
- HDmemcpy(buf,s,len);
+ H5MM_memcpy(buf,s,len);
} /* end if */
FUNC_LEAVE_NOAPI(SUCCEED)
@@ -690,11 +690,11 @@ H5T_vlen_str_mem_write(H5F_t H5_ATTR_UNUSED *f, const H5T_vlen_alloc_info_t *vl_
} /* end else */
len=(seq_len*base_size);
- HDmemcpy(t,buf,len);
+ H5MM_memcpy(t,buf,len);
t[len]='\0';
/* Set pointer in user's buffer with memcpy, to avoid alignment issues */
- HDmemcpy(_vl,&t,sizeof(char *));
+ H5MM_memcpy(_vl,&t,sizeof(char *));
done:
FUNC_LEAVE_NOAPI(ret_value) /*lint !e429 The pointer in 't' has been copied */
@@ -721,7 +721,7 @@ H5T_vlen_str_mem_setnull(H5F_t H5_ATTR_UNUSED *f, void *_vl, void H5_ATTR_UNUSED
FUNC_ENTER_NOAPI_NOINIT_NOERR
/* Set pointer in user's buffer with memcpy, to avoid alignment issues */
- HDmemcpy(_vl,&t,sizeof(char *));
+ H5MM_memcpy(_vl,&t,sizeof(char *));
FUNC_LEAVE_NOAPI(SUCCEED) /*lint !e429 The pointer in 't' has been copied */
} /* end H5T_vlen_str_mem_setnull() */
diff --git a/src/H5VL.c b/src/H5VL.c
index 37ad187..5c62f6f 100644
--- a/src/H5VL.c
+++ b/src/H5VL.c
@@ -29,13 +29,13 @@
/***********/
#include "H5private.h" /* Generic Functions */
-#include "H5Aprivate.h" /* Attributes */
#include "H5Eprivate.h" /* Error handling */
#include "H5Iprivate.h" /* IDs */
-#include "H5MMprivate.h" /* Memory management */
-#include "H5PLprivate.h" /* Plugins */
+#include "H5Pprivate.h" /* Property lists */
#include "H5VLpkg.h" /* Virtual Object Layer */
+/* VOL connectors */
+#include "H5VLnative.h" /* Native VOL connector */
/****************/
/* Local Macros */
@@ -46,29 +46,10 @@
/* Local Typedefs */
/******************/
-/* Information needed for iterating over the registered VOL connector hid_t IDs.
- * The name or value of the new VOL connector that is being registered is
- * stored in the name (or value) field and the found_id field is initialized to
- * H5I_INVALID_HID (-1). If we find a VOL connector with the same name / value,
- * we set the found_id field to the existing ID for return to the function.
- */
-typedef struct {
- /* IN */
- H5VL_get_connector_kind_t kind; /* Which kind of connector search to make */
- union {
- const char *name; /* The name of the VOL connector to check */
- H5VL_class_value_t value; /* The value of the VOL connector to check */
- } u;
-
- /* OUT */
- hid_t found_id; /* The connector ID, if we found a match */
-} H5VL_get_connector_ud_t;
-
/********************/
/* Local Prototypes */
/********************/
-static int H5VL__get_connector_cb(void *obj, hid_t id, void *_op_data);
/*********************/
@@ -88,50 +69,14 @@ static int H5VL__get_connector_cb(void *obj, hid_t id, void *_op_data);
/*-------------------------------------------------------------------------
- * Function: H5VL__get_connector_cb
- *
- * Purpose: Callback routine to search through registered VOLs
- *
- * Return: Success: H5_ITER_STOP if the class and op_data name
- * members match. H5_ITER_CONT otherwise.
- *
- * Failure: Can't fail
- *
- *-------------------------------------------------------------------------
- */
-static int
-H5VL__get_connector_cb(void *obj, hid_t id, void *_op_data)
-{
- H5VL_get_connector_ud_t *op_data = (H5VL_get_connector_ud_t *)_op_data; /* User data for callback */
- H5VL_class_t *cls = (H5VL_class_t *)obj;
- int ret_value = H5_ITER_CONT; /* Callback return value */
-
- FUNC_ENTER_STATIC_NOERR
-
- if(H5VL_GET_CONNECTOR_BY_NAME == op_data->kind) {
- if(0 == HDstrcmp(cls->name, op_data->u.name)) {
- op_data->found_id = id;
- ret_value = H5_ITER_STOP;
- } /* end if */
- } /* end if */
- else {
- HDassert(H5VL_GET_CONNECTOR_BY_VALUE == op_data->kind);
- if(cls->value == op_data->u.value) {
- op_data->found_id = id;
- ret_value = H5_ITER_STOP;
- } /* end if */
- } /* end else */
-
- FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5VL__get_connector_cb() */
-
-
-/*-------------------------------------------------------------------------
* Function: H5VLregister_connector
*
* Purpose: Registers a new VOL connector as a member of the virtual object
* layer class.
*
+ * VIPL_ID is a VOL initialization property list which must be
+ * created with H5Pcreate(H5P_VOL_INITIALIZE) (or H5P_DEFAULT).
+ *
* Return: Success: A VOL connector ID which is good until the
* library is closed or the connector is
* unregistered.
@@ -143,8 +88,7 @@ H5VL__get_connector_cb(void *obj, hid_t id, void *_op_data)
hid_t
H5VLregister_connector(const H5VL_class_t *cls, hid_t vipl_id)
{
- H5VL_get_connector_ud_t op_data; /* Callback info for connector search */
- hid_t ret_value = H5I_INVALID_HID;
+ hid_t ret_value = H5I_INVALID_HID; /* Return value */
FUNC_ENTER_API(H5I_INVALID_HID)
H5TRACE2("i", "*xi", cls, vipl_id);
@@ -156,30 +100,21 @@ H5VLregister_connector(const H5VL_class_t *cls, hid_t vipl_id)
HGOTO_ERROR(H5E_VOL, H5E_CANTREGISTER, H5I_INVALID_HID, "VOL connector class name cannot be the NULL pointer")
if (0 == HDstrlen(cls->name))
HGOTO_ERROR(H5E_VOL, H5E_CANTREGISTER, H5I_INVALID_HID, "VOL connector class name cannot be the empty string")
- if (cls->info_copy && !cls->info_free)
+ if (cls->info_cls.copy && !cls->info_cls.free)
HGOTO_ERROR(H5E_VOL, H5E_CANTREGISTER, H5I_INVALID_HID, "VOL connector must provide free callback for VOL info objects when a copy callback is provided")
- if (cls->get_wrap_ctx && !cls->free_wrap_ctx)
+ if (cls->wrap_cls.get_wrap_ctx && !cls->wrap_cls.free_wrap_ctx)
HGOTO_ERROR(H5E_VOL, H5E_CANTREGISTER, H5I_INVALID_HID, "VOL connector must provide free callback for object wrapping contexts when a get callback is provided")
- op_data.kind = H5VL_GET_CONNECTOR_BY_NAME;
- op_data.u.name = cls->name;
- op_data.found_id = H5I_INVALID_HID;
-
- /* check if connector is already registered */
- if (H5I_iterate(H5I_VOL, H5VL__get_connector_cb, &op_data, TRUE) < 0)
- HGOTO_ERROR(H5E_VOL, H5E_BADITER, H5I_INVALID_HID, "can't iterate over VOL IDs")
-
- /* Increment the ref count on the existing VOL connector ID, if it's already registered */
- if(op_data.found_id != H5I_INVALID_HID) {
- if (H5I_inc_ref(op_data.found_id, TRUE) < 0)
- HGOTO_ERROR(H5E_VOL, H5E_CANTINC, H5I_INVALID_HID, "unable to increment ref count on VOL connector")
- ret_value = op_data.found_id;
- } /* end if */
- else {
- /* Create a new class ID */
- if ((ret_value = H5VL_register_connector(cls, TRUE, vipl_id)) < 0)
- HGOTO_ERROR(H5E_VOL, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register VOL connector")
- } /* end else */
+ /* Check VOL initialization property list */
+ if(H5P_DEFAULT == vipl_id)
+ vipl_id = H5P_VOL_INITIALIZE_DEFAULT;
+ else
+ if(TRUE != H5P_isa_class(vipl_id, H5P_VOL_INITIALIZE))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not a VOL initialize property list")
+
+ /* Register connector */
+ if((ret_value = H5VL__register_connector(cls, TRUE, vipl_id)) < 0)
+ HGOTO_ERROR(H5E_VOL, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register VOL connector")
done:
FUNC_LEAVE_API(ret_value)
@@ -192,6 +127,9 @@ done:
* Purpose: Registers a new VOL connector as a member of the virtual object
* layer class.
*
+ * VIPL_ID is a VOL initialization property list which must be
+ * created with H5Pcreate(H5P_VOL_INITIALIZE) (or H5P_DEFAULT).
+ *
* Return: Success: A VOL connector ID which is good until the
* library is closed or the connector is
* unregistered.
@@ -203,8 +141,7 @@ done:
hid_t
H5VLregister_connector_by_name(const char *name, hid_t vipl_id)
{
- H5VL_get_connector_ud_t op_data; /* Callback info for connector search */
- hid_t ret_value = H5I_INVALID_HID;
+ hid_t ret_value = H5I_INVALID_HID; /* Return value */
FUNC_ENTER_API(H5I_INVALID_HID)
H5TRACE2("i", "*si", name, vipl_id);
@@ -215,34 +152,16 @@ H5VLregister_connector_by_name(const char *name, hid_t vipl_id)
if (0 == HDstrlen(name))
HGOTO_ERROR(H5E_ARGS, H5E_UNINITIALIZED, H5I_INVALID_HID, "zero-length VOL connector name is disallowed")
- op_data.kind = H5VL_GET_CONNECTOR_BY_NAME;
- op_data.u.name = name;
- op_data.found_id = H5I_INVALID_HID;
-
- /* Check if connector is already registered */
- if(H5I_iterate(H5I_VOL, H5VL__get_connector_cb, &op_data, TRUE) < 0)
- HGOTO_ERROR(H5E_VOL, H5E_BADITER, H5I_INVALID_HID, "can't iterate over VOL ids")
-
- /* If connector alread registered, increment ref count on ID and return ID */
- if(op_data.found_id != H5I_INVALID_HID) {
- if(H5I_inc_ref(op_data.found_id, TRUE) < 0)
- HGOTO_ERROR(H5E_VOL, H5E_CANTINC, H5I_INVALID_HID, "unable to increment ref count on VOL connector")
- ret_value = op_data.found_id;
- } /* end if */
- else {
- H5PL_key_t key;
- const H5VL_class_t *cls;
-
- /* Try loading the connector */
- key.vol.kind = H5VL_GET_CONNECTOR_BY_NAME;
- key.vol.u.name = name;
- if(NULL == (cls = (const H5VL_class_t *)H5PL_load(H5PL_TYPE_VOL, &key)))
- HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, H5I_INVALID_HID, "unable to load VOL connector")
-
- /* Register the connector we loaded */
- if((ret_value = H5VL_register_connector(cls, TRUE, vipl_id)) < 0)
- HGOTO_ERROR(H5E_VOL, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register VOL connector ID")
- } /* end else */
+ /* Check VOL initialization property list */
+ if(H5P_DEFAULT == vipl_id)
+ vipl_id = H5P_VOL_INITIALIZE_DEFAULT;
+ else
+ if(TRUE != H5P_isa_class(vipl_id, H5P_VOL_INITIALIZE))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not a VOL initialize property list")
+
+ /* Register connector */
+ if((ret_value = H5VL__register_connector_by_name(name, TRUE, vipl_id)) < 0)
+ HGOTO_ERROR(H5E_VOL, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register VOL connector")
done:
FUNC_LEAVE_API(ret_value)
@@ -255,6 +174,9 @@ done:
* Purpose: Registers a new VOL connector as a member of the virtual object
* layer class.
*
+ * VIPL_ID is a VOL initialization property list which must be
+ * created with H5Pcreate(H5P_VOL_INITIALIZE) (or H5P_DEFAULT).
+ *
* Return: Success: A VOL connector ID which is good until the
* library is closed or the connector is
* unregistered.
@@ -266,8 +188,7 @@ done:
hid_t
H5VLregister_connector_by_value(H5VL_class_value_t value, hid_t vipl_id)
{
- H5VL_get_connector_ud_t op_data; /* Callback info for connector search */
- hid_t ret_value = H5I_INVALID_HID;
+ hid_t ret_value = H5I_INVALID_HID; /* Return value */
FUNC_ENTER_API(H5I_INVALID_HID)
H5TRACE2("i", "VCi", value, vipl_id);
@@ -276,34 +197,16 @@ H5VLregister_connector_by_value(H5VL_class_value_t value, hid_t vipl_id)
if(value < 0)
HGOTO_ERROR(H5E_ARGS, H5E_UNINITIALIZED, H5I_INVALID_HID, "negative VOL connector value is disallowed")
- op_data.kind = H5VL_GET_CONNECTOR_BY_VALUE;
- op_data.u.value = value;
- op_data.found_id = H5I_INVALID_HID;
-
- /* Check if connector is already registered */
- if(H5I_iterate(H5I_VOL, H5VL__get_connector_cb, &op_data, TRUE) < 0)
- HGOTO_ERROR(H5E_VOL, H5E_BADITER, H5I_INVALID_HID, "can't iterate over VOL ids")
-
- /* If connector alread registered, increment ref count on ID and return ID */
- if(op_data.found_id != H5I_INVALID_HID) {
- if(H5I_inc_ref(op_data.found_id, TRUE) < 0)
- HGOTO_ERROR(H5E_VOL, H5E_CANTINC, H5I_INVALID_HID, "unable to increment ref count on VOL connector")
- ret_value = op_data.found_id;
- } /* end if */
- else {
- H5PL_key_t key;
- const H5VL_class_t *cls;
-
- /* Try loading the connector */
- key.vol.kind = H5VL_GET_CONNECTOR_BY_VALUE;
- key.vol.u.value = value;
- if(NULL == (cls = (const H5VL_class_t *)H5PL_load(H5PL_TYPE_VOL, &key)))
- HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, H5I_INVALID_HID, "unable to load VOL connector")
-
- /* Register the connector we loaded */
- if((ret_value = H5VL_register_connector(cls, TRUE, vipl_id)) < 0)
- HGOTO_ERROR(H5E_VOL, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register VOL connector ID")
- } /* end else */
+ /* Check VOL initialization property list */
+ if(H5P_DEFAULT == vipl_id)
+ vipl_id = H5P_VOL_INITIALIZE_DEFAULT;
+ else
+ if(TRUE != H5P_isa_class(vipl_id, H5P_VOL_INITIALIZE))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not a VOL initialize property list")
+
+ /* Register connector */
+ if((ret_value = H5VL__register_connector_by_value(value, TRUE, vipl_id)) < 0)
+ HGOTO_ERROR(H5E_VOL, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register VOL connector")
done:
FUNC_LEAVE_API(ret_value)
@@ -315,33 +218,26 @@ done:
*
* Purpose: Tests whether a VOL class has been registered or not
*
- * Return: Positive if the VOL class has been registered
- *
- * Zero if it is unregistered
+ * Return: >0 if a VOL connector with that name has been registered
+ * 0 if a VOL connector with that name has NOT been registered
+ * <0 on errors
*
- * Negative on error (if the class is not a valid class ID)
+ * Programmer: Dana Robinson
+ * June 17, 2017
*
*-------------------------------------------------------------------------
*/
htri_t
H5VLis_connector_registered(const char *name)
{
- H5VL_get_connector_ud_t op_data; /* Callback info for connector search */
htri_t ret_value = FALSE; /* Return value */
FUNC_ENTER_API(FAIL)
H5TRACE1("t", "*s", name);
- op_data.kind = H5VL_GET_CONNECTOR_BY_NAME;
- op_data.u.name = name;
- op_data.found_id = H5I_INVALID_HID;
-
- /* Check arguments */
- if (H5I_iterate(H5I_VOL, H5VL__get_connector_cb, &op_data, TRUE) < 0)
- HGOTO_ERROR(H5E_VOL, H5E_BADITER, FAIL, "can't iterate over VOL ids")
-
- if (op_data.found_id != H5I_INVALID_HID)
- ret_value = TRUE;
+ /* Check if connector with this name is registered */
+ if((ret_value = H5VL__is_connector_registered(name)) < 0)
+ HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "can't check for VOL")
done:
FUNC_LEAVE_API(ret_value)
@@ -353,33 +249,29 @@ done:
*
* Purpose: Retrieves the ID for a registered VOL connector.
*
- * Return: Positive if the VOL class has been registered
- * Negative on error (if the class is not a valid class or not registered)
+ * Return: A valid VOL connector ID if a connector by that name has
+ * been registered. This ID will need to be closed using
+ * H5VLclose().
+ *
+ * H5I_INVALID_HID on error or if a VOL connector of that
+ * name has not been registered.
+ *
+ * Programmer: Dana Robinson
+ * June 17, 2017
*
*-------------------------------------------------------------------------
*/
hid_t
H5VLget_connector_id(const char *name)
{
- H5VL_get_connector_ud_t op_data; /* Callback info for connector search */
hid_t ret_value = H5I_INVALID_HID; /* Return value */
FUNC_ENTER_API(H5I_INVALID_HID)
H5TRACE1("i", "*s", name);
- op_data.kind = H5VL_GET_CONNECTOR_BY_NAME;
- op_data.u.name = name;
- op_data.found_id = H5I_INVALID_HID;
-
- /* Check arguments */
- if (H5I_iterate(H5I_VOL, H5VL__get_connector_cb, &op_data, TRUE) < 0)
- HGOTO_ERROR(H5E_VOL, H5E_BADITER, H5I_INVALID_HID, "can't iterate over VOL connector IDs")
-
- if (op_data.found_id != H5I_INVALID_HID) {
- if (H5I_inc_ref(op_data.found_id, TRUE) < 0)
- HGOTO_ERROR(H5E_FILE, H5E_CANTINC, H5I_INVALID_HID, "unable to increment ref count on VOL connector")
- ret_value = op_data.found_id;
- } /* end if */
+ /* Get connector ID with this name */
+ if((ret_value = H5VL__get_connector_id(name, TRUE)) < 0)
+ HGOTO_ERROR(H5E_VOL, H5E_CANTGET, H5I_INVALID_HID, "can't get VOL id")
done:
FUNC_LEAVE_API(ret_value)
@@ -390,7 +282,12 @@ done:
* Function: H5VLget_connector_name
*
* Purpose: Returns the connector name for the VOL associated with the
- * object or file ID
+ * object or file ID.
+ *
+ * This works like other calls where the caller must provide a
+ * buffer of the appropriate size for the library to fill in.
+ * i.e., passing in a NULL pointer for NAME will return the
+ * required size of the buffer.
*
* Return: Success: The length of the connector name
*
@@ -406,7 +303,8 @@ H5VLget_connector_name(hid_t obj_id, char *name/*out*/, size_t size)
FUNC_ENTER_API(FAIL)
H5TRACE3("Zs", "ixz", obj_id, name, size);
- if ((ret_value = H5VL_get_connector_name(obj_id, name, size)) < 0)
+ /* Call internal routine */
+ if((ret_value = H5VL__get_connector_name(obj_id, name, size)) < 0)
HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "Can't get connector name")
done:
@@ -456,6 +354,9 @@ done:
* this VOL connector or files which are already opened under with
* this connector.
*
+ * The native VOL connector cannot be unregistered and attempts
+ * to do so are considered an error.
+ *
* Return: Success: Non-negative
*
* Failure: Negative
@@ -465,6 +366,7 @@ done:
herr_t
H5VLunregister_connector(hid_t vol_id)
{
+ hid_t native_id = H5I_INVALID_HID;
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(FAIL)
@@ -472,13 +374,23 @@ H5VLunregister_connector(hid_t vol_id)
/* Check arguments */
if(NULL == H5I_object_verify(vol_id, H5I_VOL))
- HGOTO_ERROR(H5E_VOL, H5E_BADTYPE, FAIL, "not a VOL connector")
+ HGOTO_ERROR(H5E_VOL, H5E_BADTYPE, FAIL, "not a VOL connector ID")
+
+ /* For the time being, we disallow unregistering the native VOL connector */
+ if(H5I_INVALID_HID == (native_id = H5VL__get_connector_id(H5VL_NATIVE_NAME, FALSE)))
+ HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "unable to find the native VOL connector ID")
+ if(vol_id == native_id)
+ HGOTO_ERROR(H5E_VOL, H5E_BADVALUE, FAIL, "unregistering the native VOL connector is not allowed")
/* The H5VL_class_t struct will be freed by this function */
- if (H5I_dec_app_ref(vol_id) < 0)
+ if(H5I_dec_app_ref(vol_id) < 0)
HGOTO_ERROR(H5E_VOL, H5E_CANTDEC, FAIL, "unable to unregister VOL connector")
done:
+ if(native_id != H5I_INVALID_HID)
+ if(H5I_dec_ref(native_id) < 0)
+ HGOTO_ERROR(H5E_VOL, H5E_CANTDEC, FAIL, "unable to decrement count on native_id")
+
FUNC_LEAVE_API(ret_value)
} /* end H5VLunregister_connector() */
@@ -488,6 +400,9 @@ done:
*
* Purpose: Compares two connector classes (based on their value field)
*
+ * Note: This routine is _only_ for HDF5 VOL connector authors! It is
+ * _not_ part of the public API for HDF5 application developers.
+ *
* Return: Success: Non-negative, *cmp set to a value like strcmp
*
* Failure: Negative, *cmp unset
@@ -522,11 +437,11 @@ done:
* Function: H5VLwrap_register
*
* Purpose: Wrap an internal object with a "wrap context" and register an
- * hid_t for the resulting object.
+ * hid_t for the resulting object.
*
- * Note: This routine is mainly targeted toward wrapping objects for
- * iteration routine callbacks (i.e. the callbacks from H5Aiterate*,
- * H5Literate* / H5Lvisit*, and H5Ovisit* ).
+ * Note: This routine is mainly targeted toward wrapping objects for
+ * iteration routine callbacks (i.e. the callbacks from H5Aiterate*,
+ * H5Literate* / H5Lvisit*, and H5Ovisit* ).
*
* Return: Success: Non-negative hid_t for the object.
* Failure: Negative (H5I_INVALID_HID)
@@ -561,10 +476,10 @@ done:
* Function: H5VLobject
*
* Purpose: Retrieve the object pointer associated with an hid_t for a.
- * VOL object.
+ * VOL object.
*
- * Note: This routine is mainly targeted toward unwrapping objects for
- * testing.
+ * Note: This routine is mainly targeted toward unwrapping objects for
+ * testing.
*
* Return: Success: Object pointer
* Failure: NULL
@@ -587,3 +502,159 @@ done:
FUNC_LEAVE_API(ret_value)
} /* H5VLobject() */
+
+/*---------------------------------------------------------------------------
+ * Function: H5VLretrieve_lib_state
+ *
+ * Purpose: Retrieves a copy of the internal state of the HDF5 library,
+ * so that it can be restored later.
+ *
+ * Note: This routine is _only_ for HDF5 VOL connector authors! It is
+ * _not_ part of the public API for HDF5 application developers.
+ *
+ * Return: Success: Non-negative, *state set
+ * Failure: Negative, *state unset
+ *
+ * Programmer: Quincey Koziol
+ * Thursday, January 10, 2019
+ *
+ *---------------------------------------------------------------------------
+ */
+herr_t
+H5VLretrieve_lib_state(void **state)
+{
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ /* Must use this, to avoid modifying the API context stack in FUNC_ENTER */
+ FUNC_ENTER_API_NOINIT
+ H5TRACE1("e", "**x", state);
+
+ /* Check args */
+ if(NULL == state)
+ HGOTO_ERROR(H5E_VOL, H5E_BADVALUE, FAIL, "invalid state pointer")
+
+ /* Retrieve the library state */
+ if(H5VL_retrieve_lib_state(state) < 0)
+ HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "can't retrieve library state")
+
+done:
+ FUNC_LEAVE_API_NOINIT(ret_value)
+} /* H5VLretrieve_lib_state() */
+
+
+/*---------------------------------------------------------------------------
+ * Function: H5VLrestore_lib_state
+ *
+ * Purpose: Restores the internal state of the HDF5 library.
+ *
+ * Note: This routine is _only_ for HDF5 VOL connector authors! It is
+ * _not_ part of the public API for HDF5 application developers.
+ *
+ * Return: Success: Non-negative
+ * Failure: Negative
+ *
+ * Programmer: Quincey Koziol
+ * Thursday, January 10, 2019
+ *
+ *---------------------------------------------------------------------------
+ */
+herr_t
+H5VLrestore_lib_state(const void *state)
+{
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ /* Must use this, to avoid modifying the API context stack in FUNC_ENTER */
+ FUNC_ENTER_API_NOINIT
+ H5TRACE1("e", "*x", state);
+
+ /* Check args */
+ if(NULL == state)
+ HGOTO_ERROR(H5E_VOL, H5E_BADVALUE, FAIL, "invalid state pointer")
+
+ /* Restore the library state */
+ if(H5VL_restore_lib_state(state) < 0)
+ HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "can't restore library state")
+
+done:
+ FUNC_LEAVE_API_NOINIT(ret_value)
+} /* H5VLrestore_lib_state() */
+
+
+/*---------------------------------------------------------------------------
+ * Function: H5VLreset_lib_state
+ *
+ * Purpose: Resets the internal state of the HDF5 library, undoing the
+ * affects of H5VLrestore_lib_state.
+ *
+ * Note: This routine is _only_ for HDF5 VOL connector authors! It is
+ * _not_ part of the public API for HDF5 application developers.
+ *
+ * Note: This routine must be called as a "pair" with
+ * H5VLrestore_lib_state. It can be called before / after /
+ * independently of H5VLfree_lib_state.
+ *
+ * Return: Success: Non-negative
+ * Failure: Negative
+ *
+ * Programmer: Quincey Koziol
+ * Saturday, February 23, 2019
+ *
+ *---------------------------------------------------------------------------
+ */
+herr_t
+H5VLreset_lib_state(void)
+{
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ /* Must use this, to avoid modifying the API context stack in FUNC_ENTER */
+ FUNC_ENTER_API_NOINIT
+ H5TRACE0("e","");
+
+ /* Reset the library state */
+ if(H5VL_reset_lib_state() < 0)
+ HGOTO_ERROR(H5E_VOL, H5E_CANTRESET, FAIL, "can't reset library state")
+
+done:
+ FUNC_LEAVE_API_NOINIT(ret_value)
+} /* H5VLreset_lib_state() */
+
+
+/*---------------------------------------------------------------------------
+ * Function: H5VLfree_lib_state
+ *
+ * Purpose: Free a retrieved library state.
+ *
+ * Note: This routine is _only_ for HDF5 VOL connector authors! It is
+ * _not_ part of the public API for HDF5 application developers.
+ *
+ * Note: This routine must be called as a "pair" with
+ * H5VLretrieve_lib_state.
+ *
+ * Return: Success: Non-negative
+ * Failure: Negative
+ *
+ * Programmer: Quincey Koziol
+ * Thursday, January 10, 2019
+ *
+ *---------------------------------------------------------------------------
+ */
+herr_t
+H5VLfree_lib_state(void *state)
+{
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_API(FAIL)
+ H5TRACE1("e", "*x", state);
+
+ /* Check args */
+ if(NULL == state)
+ HGOTO_ERROR(H5E_VOL, H5E_BADVALUE, FAIL, "invalid state pointer")
+
+ /* Free the library state */
+ if(H5VL_free_lib_state(state) < 0)
+ HGOTO_ERROR(H5E_VOL, H5E_CANTRELEASE, FAIL, "can't free library state")
+
+done:
+ FUNC_LEAVE_API(ret_value)
+} /* H5VLfree_lib_state() */
+
diff --git a/src/H5VLcallback.c b/src/H5VLcallback.c
index 2d6ac33..696ccab 100644
--- a/src/H5VLcallback.c
+++ b/src/H5VLcallback.c
@@ -57,8 +57,8 @@
/* Local Prototypes */
/********************/
static void *H5VL__attr_create(void *obj, const H5VL_loc_params_t *loc_params,
- const H5VL_class_t *cls, const char *name, hid_t acpl_id, hid_t aapl_id,
- hid_t dxpl_id, void **req);
+ const H5VL_class_t *cls, const char *name, hid_t type_id, hid_t space_id,
+ hid_t acpl_id, hid_t aapl_id, hid_t dxpl_id, void **req);
static void *H5VL__attr_open(void *obj, const H5VL_loc_params_t *loc_params,
const H5VL_class_t *cls, const char *name, hid_t aapl_id, hid_t dxpl_id,
void **req);
@@ -76,8 +76,8 @@ static herr_t H5VL__attr_optional(void *obj, const H5VL_class_t *cls, hid_t dxpl
static herr_t H5VL__attr_close(void *obj, const H5VL_class_t *cls, hid_t dxpl_id,
void **req);
static void *H5VL__dataset_create(void *obj, const H5VL_loc_params_t *loc_params,
- const H5VL_class_t *cls, const char *name, hid_t dcpl_id, hid_t dapl_id,
- hid_t dxpl_id, void **req);
+ const H5VL_class_t *cls, const char *name, hid_t lcpl_id, hid_t type_id,
+ hid_t space_id, hid_t dcpl_id, hid_t dapl_id, hid_t dxpl_id, void **req);
static void *H5VL__dataset_open(void *obj, const H5VL_loc_params_t *loc_params,
const H5VL_class_t *cls, const char *name, hid_t dapl_id, hid_t dxpl_id,
void **req);
@@ -108,8 +108,8 @@ static herr_t H5VL__file_optional(void *obj, const H5VL_class_t *cls, hid_t dxpl
static herr_t H5VL__file_close(void *obj, const H5VL_class_t *cls, hid_t dxpl_id,
void **req);
static void *H5VL__group_create(void *obj, const H5VL_loc_params_t *loc_params,
- const H5VL_class_t *cls, const char *name, hid_t gcpl_id, hid_t gapl_id,
- hid_t dxpl_id, void **req);
+ const H5VL_class_t *cls, const char *name, hid_t lcpl_id, hid_t gcpl_id,
+ hid_t gapl_id, hid_t dxpl_id, void **req);
static void *H5VL__group_open(void *obj, const H5VL_loc_params_t *loc_params,
const H5VL_class_t *cls, const char *name, hid_t gapl_id, hid_t dxpl_id,
void **req);
@@ -123,7 +123,7 @@ static herr_t H5VL__group_close(void *obj, const H5VL_class_t *cls,
hid_t dxpl_id, void **req);
static herr_t H5VL__link_create(H5VL_link_create_type_t create_type, void *obj,
const H5VL_loc_params_t *loc_params, const H5VL_class_t *cls, hid_t lcpl_id,
- hid_t lapl_id, hid_t dxpl_id, void **req);
+ hid_t lapl_id, hid_t dxpl_id, void **req, va_list arguments);
static herr_t H5VL__link_copy(void *src_obj, const H5VL_loc_params_t *loc_params1,
void *dst_obj, const H5VL_loc_params_t *loc_params2, const H5VL_class_t *cls,
hid_t lcpl_id, hid_t lapl_id, hid_t dxpl_id, void **req);
@@ -348,14 +348,14 @@ H5VL_copy_connector_info(const H5VL_class_t *connector, void **dst_info,
/* Check for actual source info */
if(src_info) {
/* Allow the connector to copy or do it ourselves */
- if(connector->info_copy) {
- if(NULL == (new_connector_info = (connector->info_copy)(src_info)))
+ if(connector->info_cls.copy) {
+ if(NULL == (new_connector_info = (connector->info_cls.copy)(src_info)))
HGOTO_ERROR(H5E_VOL, H5E_CANTCOPY, FAIL, "connector info copy callback failed")
} /* end if */
- else if(connector->info_size > 0) {
- if(NULL == (new_connector_info = H5MM_malloc(connector->info_size)))
+ else if(connector->info_cls.size > 0) {
+ if(NULL == (new_connector_info = H5MM_malloc(connector->info_cls.size)))
HGOTO_ERROR(H5E_VOL, H5E_CANTALLOC, FAIL, "connector info allocation failed")
- HDmemcpy(new_connector_info, src_info, connector->info_size);
+ H5MM_memcpy(new_connector_info, src_info, connector->info_cls.size);
} /* end else-if */
else
HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "no way to copy connector info")
@@ -444,13 +444,13 @@ H5VL_cmp_connector_info(const H5VL_class_t *connector, int *cmp_value,
* if there is a a callback, otherwise just compare the info objects as
* memory buffers
*/
- if(connector->info_cmp) {
- if((connector->info_cmp)(cmp_value, info1, info2) < 0)
+ if(connector->info_cls.cmp) {
+ if((connector->info_cls.cmp)(cmp_value, info1, info2) < 0)
HGOTO_ERROR(H5E_VOL, H5E_CANTCOMPARE, FAIL, "can't compare connector info")
} /* end if */
else {
- HDassert(connector->info_size > 0);
- *cmp_value = HDmemcmp(info1, info2, connector->info_size);
+ HDassert(connector->info_cls.size > 0);
+ *cmp_value = HDmemcmp(info1, info2, connector->info_cls.size);
} /* end else */
done:
@@ -506,20 +506,25 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5VL_free_connector_info(const H5VL_class_t *connector, void *info)
+H5VL_free_connector_info(hid_t connector_id, void *info)
{
- herr_t ret_value = SUCCEED; /* Return value */
+ H5VL_class_t *cls; /* VOL connector's class struct */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(FAIL)
- /* Sanity checks */
- HDassert(connector);
+ /* Sanity check */
+ HDassert(connector_id > 0);
+
+ /* Check args and get class pointer */
+ if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(connector_id, H5I_VOL)))
+ HGOTO_ERROR(H5E_VOL, H5E_BADTYPE, FAIL, "not a VOL connector ID")
/* Only free info object, if it's non-NULL */
if(info) {
/* Allow the connector to free info or do it ourselves */
- if(connector->info_free) {
- if((connector->info_free)(info) < 0)
+ if(cls->info_cls.free) {
+ if((cls->info_cls.free)(info) < 0)
HGOTO_ERROR(H5E_VOL, H5E_CANTRELEASE, FAIL, "connector info free request failed")
} /* end if */
else
@@ -544,18 +549,13 @@ done:
herr_t
H5VLfree_connector_info(hid_t connector_id, void *info)
{
- H5VL_class_t *cls; /* VOL connector's class struct */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API_NOINIT
H5TRACE2("e", "i*x", connector_id, info);
- /* Check args and get class pointer */
- if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(connector_id, H5I_VOL)))
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL connector ID")
-
/* Free the VOL connector info object */
- if(H5VL_free_connector_info(cls, info) < 0)
+ if(H5VL_free_connector_info(connector_id, info) < 0)
HGOTO_ERROR(H5E_VOL, H5E_CANTRELEASE, FAIL, "unable to release VOL connector info object")
done:
@@ -590,8 +590,8 @@ H5VLconnector_info_to_str(const void *info, hid_t connector_id, char **str)
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL connector ID")
/* Allow the connector to serialize info */
- if(cls->info_to_str) {
- if((cls->info_to_str)(info, str) < 0)
+ if(cls->info_cls.to_str) {
+ if((cls->info_cls.to_str)(info, str) < 0)
HGOTO_ERROR(H5E_VOL, H5E_CANTSERIALIZE, FAIL, "can't serialize connector info")
} /* end if */
else
@@ -623,24 +623,9 @@ H5VLconnector_str_to_info(const char *str, hid_t connector_id, void **info)
FUNC_ENTER_API_NOINIT
H5TRACE3("e", "*si**x", str, connector_id, info);
- /* Only deserialize string, if it's non-NULL */
- if(str) {
- H5VL_class_t *cls; /* VOL connector's class struct */
-
- /* Check args and get class pointer */
- if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(connector_id, H5I_VOL)))
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL connector ID")
-
- /* Allow the connector to deserialize info */
- if(cls->str_to_info) {
- if((cls->str_to_info)(str, info) < 0)
- HGOTO_ERROR(H5E_VOL, H5E_CANTUNSERIALIZE, FAIL, "can't deserialize connector info")
- } /* end if */
- else
- *info = NULL;
- } /* end if */
- else
- *info = NULL;
+ /* Call internal routine */
+ if(H5VL__connector_str_to_info(str, connector_id, info) < 0)
+ HGOTO_ERROR(H5E_VOL, H5E_CANTDECODE, FAIL, "can't deserialize connector info")
done:
FUNC_LEAVE_API_NOINIT(ret_value)
@@ -673,8 +658,8 @@ H5VLget_object(void *obj, hid_t connector_id)
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a VOL connector ID")
/* Check for 'get_object' callback in connector */
- if(cls->get_object)
- ret_value = (cls->get_object)(obj);
+ if(cls->wrap_cls.get_object)
+ ret_value = (cls->wrap_cls.get_object)(obj);
else
ret_value = obj;
@@ -706,12 +691,12 @@ H5VL_get_wrap_ctx(const H5VL_class_t *connector, void *obj, void **wrap_ctx)
HDassert(wrap_ctx);
/* Allow the connector to copy or do it ourselves */
- if(connector->get_wrap_ctx) {
+ if(connector->wrap_cls.get_wrap_ctx) {
/* Sanity check */
- HDassert(connector->free_wrap_ctx);
+ HDassert(connector->wrap_cls.free_wrap_ctx);
/* Invoke connector's callback */
- if((connector->get_wrap_ctx)(obj, wrap_ctx) < 0)
+ if((connector->wrap_cls.get_wrap_ctx)(obj, wrap_ctx) < 0)
HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "connector wrap context callback failed")
} /* end if */
else
@@ -755,84 +740,89 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5VL_free_wrap_ctx
+ * Function: H5VL_wrap_object
*
- * Purpose: Free object wrapping context for a connector
+ * Purpose: Wrap an object with connector
*
- * Return: Success: Non-negative
- * Failure: Negative
+ * Return: Success: Non-NULL
+ * Failure: NULL
*
*-------------------------------------------------------------------------
*/
-herr_t
-H5VL_free_wrap_ctx(const H5VL_class_t *connector, void *wrap_ctx)
+void *
+H5VL_wrap_object(const H5VL_class_t *connector, void *wrap_ctx, void *obj,
+ H5I_type_t obj_type)
{
- herr_t ret_value = SUCCEED; /* Return value */
+ void *ret_value = NULL; /* Return value */
- FUNC_ENTER_NOAPI(FAIL)
+ FUNC_ENTER_NOAPI(NULL)
/* Sanity checks */
HDassert(connector);
+ HDassert(obj);
- /* Only free wrap context, if it's non-NULL */
+ /* Only wrap object if there's a wrap context */
if(wrap_ctx) {
- /* Free the connector's object wrapping context */
- if((connector->free_wrap_ctx)(wrap_ctx) < 0)
- HGOTO_ERROR(H5E_VOL, H5E_CANTRELEASE, FAIL, "connector wrap context free request failed")
+ /* Ask the connector to wrap the object */
+ if(NULL == (ret_value = (connector->wrap_cls.wrap_object)(obj, obj_type, wrap_ctx)))
+ HGOTO_ERROR(H5E_VOL, H5E_CANTGET, NULL, "can't wrap object")
} /* end if */
+ else
+ ret_value = obj;
done:
FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5VL_free_wrap_ctx() */
+} /* end H5VL_wrap_object() */
/*---------------------------------------------------------------------------
- * Function: H5VLfree_wrap_ctx
+ * Function: H5VLwrap_object
*
- * Purpose: Release a VOL connector's object wrapping context
+ * Purpose: Asks a connector to wrap an underlying object.
*
- * Return: Success: Non-negative
- * Failure: Negative
+ * Return: Success: Non-NULL
+ * Failure: NULL
*
*---------------------------------------------------------------------------
*/
-herr_t
-H5VLfree_wrap_ctx(void *wrap_ctx, hid_t connector_id)
+void *
+H5VLwrap_object(void *obj, H5I_type_t obj_type, hid_t connector_id, void *wrap_ctx)
{
- H5VL_class_t *cls; /* VOL connector's class struct */
- herr_t ret_value = SUCCEED; /* Return value */
+ H5VL_class_t *cls; /* VOL connector's class struct */
+ void *ret_value = NULL; /* Return value */
FUNC_ENTER_API_NOINIT
- H5TRACE2("e", "*xi", wrap_ctx, connector_id);
+ H5TRACE4("*x", "*xIti*x", obj, obj_type, connector_id, wrap_ctx);
/* Check args and get class pointer */
+ if(NULL == obj)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "invalid object")
if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(connector_id, H5I_VOL)))
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL connector ID")
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a VOL connector ID")
- /* Release the VOL connector's object wrapper */
- if(H5VL_free_wrap_ctx(cls, wrap_ctx) < 0)
- HGOTO_ERROR(H5E_VOL, H5E_CANTRELEASE, FAIL, "unable to release VOL connector object wrap context")
+ /* Wrap the object */
+ if(NULL == (ret_value = H5VL_wrap_object(cls, wrap_ctx, obj, obj_type)))
+ HGOTO_ERROR(H5E_VOL, H5E_CANTGET, NULL, "unable to wrap object")
done:
FUNC_LEAVE_API_NOINIT(ret_value)
-} /* H5VLfree_wrap_ctx() */
+} /* H5VLwrap_object */
/*-------------------------------------------------------------------------
- * Function: H5VL_wrap_object
+ * Function: H5VL_unwrap_object
*
- * Purpose: Wrap an object with connector
+ * Purpose: Unwrap an object from connector
*
- * Return: Success: Non-negative
- * Failure: Negative
+ * Return: Success: Non-NULL
+ * Failure: NULL
*
*-------------------------------------------------------------------------
*/
void *
-H5VL_wrap_object(const H5VL_class_t *connector, void *wrap_ctx, void *obj,
- H5I_type_t obj_type)
+H5VL_unwrap_object(const H5VL_class_t *connector, void *obj)
{
- void *ret_value = SUCCEED; /* Return value */
+ void *ret_value = NULL; /* Return value */
FUNC_ENTER_NOAPI(NULL)
@@ -840,24 +830,24 @@ H5VL_wrap_object(const H5VL_class_t *connector, void *wrap_ctx, void *obj,
HDassert(connector);
HDassert(obj);
- /* Only wrap object if there's a wrap context */
- if(wrap_ctx) {
- /* Ask the connector to wrap the object */
- if(NULL == (ret_value = (connector->wrap_object)(obj, obj_type, wrap_ctx)))
- HGOTO_ERROR(H5E_VOL, H5E_CANTGET, NULL, "can't wrap object")
+ /* Only unwrap object if there's an unwrap callback */
+ if(connector->wrap_cls.wrap_object) {
+ /* Ask the connector to unwrap the object */
+ if(NULL == (ret_value = (connector->wrap_cls.unwrap_object)(obj)))
+ HGOTO_ERROR(H5E_VOL, H5E_CANTGET, NULL, "can't unwrap object")
} /* end if */
else
ret_value = obj;
done:
FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5VL_wrap_object() */
+} /* end H5VL_unwrap_object() */
/*---------------------------------------------------------------------------
- * Function: H5VLwrap_object
+ * Function: H5VLunwrap_object
*
- * Purpose: Asks a connector to wrap an underlying object.
+ * Purpose: Unwrap an object from connector
*
* Return: Success: Non-NULL
* Failure: NULL
@@ -865,13 +855,13 @@ done:
*---------------------------------------------------------------------------
*/
void *
-H5VLwrap_object(void *obj, H5I_type_t obj_type, hid_t connector_id, void *wrap_ctx)
+H5VLunwrap_object(void *obj, hid_t connector_id)
{
H5VL_class_t *cls; /* VOL connector's class struct */
void *ret_value = NULL; /* Return value */
FUNC_ENTER_API_NOINIT
- H5TRACE4("*x", "*xIti*x", obj, obj_type, connector_id, wrap_ctx);
+ H5TRACE2("*x", "*xi", obj, connector_id);
/* Check args and get class pointer */
if(NULL == obj)
@@ -879,13 +869,77 @@ H5VLwrap_object(void *obj, H5I_type_t obj_type, hid_t connector_id, void *wrap_c
if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(connector_id, H5I_VOL)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a VOL connector ID")
- /* Wrap the object */
- if(NULL == (ret_value = H5VL_wrap_object(cls, wrap_ctx, obj, obj_type)))
- HGOTO_ERROR(H5E_VOL, H5E_CANTGET, NULL, "unable to wrap object")
+ /* Unwrap the object */
+ if(NULL == (ret_value = H5VL_unwrap_object(cls, obj)))
+ HGOTO_ERROR(H5E_VOL, H5E_CANTGET, NULL, "unable to unwrap object")
done:
FUNC_LEAVE_API_NOINIT(ret_value)
-} /* H5VLwrap_object */
+} /* H5VLunwrap_object */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VL_free_wrap_ctx
+ *
+ * Purpose: Free object wrapping context for a connector
+ *
+ * Return: Success: Non-negative
+ * Failure: Negative
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5VL_free_wrap_ctx(const H5VL_class_t *connector, void *wrap_ctx)
+{
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_NOAPI(FAIL)
+
+ /* Sanity checks */
+ HDassert(connector);
+
+ /* Only free wrap context, if it's non-NULL */
+ if(wrap_ctx) {
+ /* Free the connector's object wrapping context */
+ if((connector->wrap_cls.free_wrap_ctx)(wrap_ctx) < 0)
+ HGOTO_ERROR(H5E_VOL, H5E_CANTRELEASE, FAIL, "connector wrap context free request failed")
+ } /* end if */
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5VL_free_wrap_ctx() */
+
+
+/*---------------------------------------------------------------------------
+ * Function: H5VLfree_wrap_ctx
+ *
+ * Purpose: Release a VOL connector's object wrapping context
+ *
+ * Return: Success: Non-negative
+ * Failure: Negative
+ *
+ *---------------------------------------------------------------------------
+ */
+herr_t
+H5VLfree_wrap_ctx(void *wrap_ctx, hid_t connector_id)
+{
+ H5VL_class_t *cls; /* VOL connector's class struct */
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_API_NOINIT
+ H5TRACE2("e", "*xi", wrap_ctx, connector_id);
+
+ /* Check args and get class pointer */
+ if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(connector_id, H5I_VOL)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL connector ID")
+
+ /* Release the VOL connector's object wrapper */
+ if(H5VL_free_wrap_ctx(cls, wrap_ctx) < 0)
+ HGOTO_ERROR(H5E_VOL, H5E_CANTRELEASE, FAIL, "unable to release VOL connector object wrap context")
+
+done:
+ FUNC_LEAVE_API_NOINIT(ret_value)
+} /* H5VLfree_wrap_ctx() */
/*-------------------------------------------------------------------------
@@ -900,7 +954,8 @@ done:
*/
static void *
H5VL__attr_create(void *obj, const H5VL_loc_params_t *loc_params, const H5VL_class_t *cls,
- const char *name, hid_t acpl_id, hid_t aapl_id, hid_t dxpl_id, void **req)
+ const char *name, hid_t type_id, hid_t space_id, hid_t acpl_id,
+ hid_t aapl_id, hid_t dxpl_id, void **req)
{
void *ret_value = NULL; /* Return value */
@@ -911,12 +966,12 @@ H5VL__attr_create(void *obj, const H5VL_loc_params_t *loc_params, const H5VL_cla
HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, NULL, "VOL connector has no 'attr create' method")
/* Call the corresponding VOL callback */
- if(NULL == (ret_value = (cls->attr_cls.create)(obj, loc_params, name, acpl_id, aapl_id, dxpl_id, req)))
+ if(NULL == (ret_value = (cls->attr_cls.create)(obj, loc_params, name, type_id, space_id, acpl_id, aapl_id, dxpl_id, req)))
HGOTO_ERROR(H5E_VOL, H5E_CANTCREATE, NULL, "attribute create failed")
done:
FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5VL_attr_create() */
+} /* end H5VL__attr_create() */
/*-------------------------------------------------------------------------
@@ -931,7 +986,8 @@ done:
*/
void *
H5VL_attr_create(const H5VL_object_t *vol_obj, const H5VL_loc_params_t *loc_params,
- const char *name, hid_t acpl_id, hid_t aapl_id, hid_t dxpl_id, void **req)
+ const char *name, hid_t type_id, hid_t space_id, hid_t acpl_id,
+ hid_t aapl_id, hid_t dxpl_id, void **req)
{
hbool_t vol_wrapper_set = FALSE; /* Whether the VOL object wrapping context was set up */
void *ret_value = NULL; /* Return value */
@@ -944,7 +1000,7 @@ H5VL_attr_create(const H5VL_object_t *vol_obj, const H5VL_loc_params_t *loc_para
vol_wrapper_set = TRUE;
/* Call the corresponding internal VOL routine */
- if(NULL == (ret_value = H5VL__attr_create(vol_obj->data, loc_params, vol_obj->connector->cls, name, acpl_id, aapl_id, dxpl_id, req)))
+ if(NULL == (ret_value = H5VL__attr_create(vol_obj->data, loc_params, vol_obj->connector->cls, name, type_id, space_id, acpl_id, aapl_id, dxpl_id, req)))
HGOTO_ERROR(H5E_VOL, H5E_CANTCREATE, NULL, "attribute create failed")
done:
@@ -968,14 +1024,15 @@ done:
*/
void *
H5VLattr_create(void *obj, const H5VL_loc_params_t *loc_params, hid_t connector_id,
- const char *name, hid_t acpl_id, hid_t aapl_id, hid_t dxpl_id, void **req)
+ const char *name, hid_t type_id, hid_t space_id, hid_t acpl_id,
+ hid_t aapl_id, hid_t dxpl_id, void **req)
{
H5VL_class_t *cls; /* VOL connector's class struct */
void *ret_value = NULL; /* Return value */
FUNC_ENTER_API_NOINIT
- H5TRACE8("*x", "*x*xi*siii**x", obj, loc_params, connector_id, name, acpl_id,
- aapl_id, dxpl_id, req);
+ H5TRACE10("*x", "*x*xi*siiiii**x", obj, loc_params, connector_id, name,
+ type_id, space_id, acpl_id, aapl_id, dxpl_id, req);
/* Check args and get class pointer */
if(NULL == obj)
@@ -984,7 +1041,7 @@ H5VLattr_create(void *obj, const H5VL_loc_params_t *loc_params, hid_t connector_
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a VOL connector ID")
/* Call the corresponding internal VOL routine */
- if(NULL == (ret_value = H5VL__attr_create(obj, loc_params, cls, name, acpl_id, aapl_id, dxpl_id, req)))
+ if(NULL == (ret_value = H5VL__attr_create(obj, loc_params, cls, name, type_id, space_id, acpl_id, aapl_id, dxpl_id, req)))
HGOTO_ERROR(H5E_VOL, H5E_CANTCREATE, NULL, "unable to create attribute")
done:
@@ -1740,7 +1797,8 @@ done:
*/
static void *
H5VL__dataset_create(void *obj, const H5VL_loc_params_t *loc_params, const H5VL_class_t *cls,
- const char *name, hid_t dcpl_id, hid_t dapl_id, hid_t dxpl_id, void **req)
+ const char *name, hid_t lcpl_id, hid_t type_id, hid_t space_id,
+ hid_t dcpl_id, hid_t dapl_id, hid_t dxpl_id, void **req)
{
void *ret_value = NULL; /* Return value */
@@ -1751,7 +1809,7 @@ H5VL__dataset_create(void *obj, const H5VL_loc_params_t *loc_params, const H5VL_
HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, NULL, "VOL connector has no 'dataset create' method")
/* Call the corresponding VOL callback */
- if(NULL == (ret_value = (cls->dataset_cls.create)(obj, loc_params, name, dcpl_id, dapl_id, dxpl_id, req)))
+ if(NULL == (ret_value = (cls->dataset_cls.create)(obj, loc_params, name, lcpl_id, type_id, space_id, dcpl_id, dapl_id, dxpl_id, req)))
HGOTO_ERROR(H5E_VOL, H5E_CANTCREATE, NULL, "dataset create failed")
done:
@@ -1771,7 +1829,8 @@ done:
*/
void *
H5VL_dataset_create(const H5VL_object_t *vol_obj, const H5VL_loc_params_t *loc_params,
- const char *name, hid_t dcpl_id, hid_t dapl_id, hid_t dxpl_id, void **req)
+ const char *name, hid_t lcpl_id, hid_t type_id, hid_t space_id,
+ hid_t dcpl_id, hid_t dapl_id, hid_t dxpl_id, void **req)
{
hbool_t vol_wrapper_set = FALSE; /* Whether the VOL object wrapping context was set up */
void *ret_value = NULL; /* Return value */
@@ -1784,7 +1843,7 @@ H5VL_dataset_create(const H5VL_object_t *vol_obj, const H5VL_loc_params_t *loc_p
vol_wrapper_set = TRUE;
/* Call the corresponding internal VOL routine */
- if(NULL == (ret_value = H5VL__dataset_create(vol_obj->data, loc_params, vol_obj->connector->cls, name, dcpl_id, dapl_id, dxpl_id, req)))
+ if(NULL == (ret_value = H5VL__dataset_create(vol_obj->data, loc_params, vol_obj->connector->cls, name, lcpl_id, type_id, space_id, dcpl_id, dapl_id, dxpl_id, req)))
HGOTO_ERROR(H5E_VOL, H5E_CANTCREATE, NULL, "dataset create failed")
done:
@@ -1808,14 +1867,15 @@ done:
*/
void *
H5VLdataset_create(void *obj, const H5VL_loc_params_t *loc_params, hid_t connector_id,
- const char *name, hid_t dcpl_id, hid_t dapl_id, hid_t dxpl_id, void **req)
+ const char *name, hid_t lcpl_id, hid_t type_id, hid_t space_id,
+ hid_t dcpl_id, hid_t dapl_id, hid_t dxpl_id, void **req)
{
H5VL_class_t *cls; /* VOL connector's class struct */
void *ret_value = NULL; /* Return value */
FUNC_ENTER_API_NOINIT
- H5TRACE8("*x", "*x*xi*siii**x", obj, loc_params, connector_id, name, dcpl_id,
- dapl_id, dxpl_id, req);
+ H5TRACE11("*x", "*x*xi*siiiiii**x", obj, loc_params, connector_id, name,
+ lcpl_id, type_id, space_id, dcpl_id, dapl_id, dxpl_id, req);
/* Check args and get class pointer */
if(NULL == obj)
@@ -1824,7 +1884,7 @@ H5VLdataset_create(void *obj, const H5VL_loc_params_t *loc_params, hid_t connect
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a VOL connector ID")
/* Call the corresponding internal VOL routine */
- if(NULL == (ret_value = H5VL__dataset_create(obj, loc_params, cls, name, dcpl_id, dapl_id, dxpl_id, req)))
+ if(NULL == (ret_value = H5VL__dataset_create(obj, loc_params, cls, name, lcpl_id, type_id, space_id, dcpl_id, dapl_id, dxpl_id, req)))
HGOTO_ERROR(H5E_VOL, H5E_CANTCREATE, NULL, "unable to create dataset")
done:
@@ -2981,7 +3041,7 @@ H5VL_file_specific(const H5VL_object_t *vol_obj, H5VL_file_specific_t specific_t
arg_started = TRUE;
/* Special treatment of file access check */
- if(specific_type == H5VL_FILE_IS_ACCESSIBLE) {
+ if(specific_type == H5VL_FILE_IS_ACCESSIBLE || specific_type == H5VL_FILE_DELETE) {
H5P_genplist_t *plist; /* Property list pointer */
H5VL_connector_prop_t connector_prop; /* Property for VOL connector ID & info */
va_list tmp_args; /* argument list passed from the API call */
@@ -2989,7 +3049,7 @@ H5VL_file_specific(const H5VL_object_t *vol_obj, H5VL_file_specific_t specific_t
/* Get the file access property list to access the file */
HDva_copy(tmp_args, arguments);
- fapl_id = va_arg(tmp_args, hid_t);
+ fapl_id = HDva_arg(tmp_args, hid_t);
HDva_end(tmp_args);
/* Get the VOL info from the FAPL */
@@ -3294,7 +3354,8 @@ done:
*/
static void *
H5VL__group_create(void *obj, const H5VL_loc_params_t *loc_params, const H5VL_class_t *cls,
- const char *name, hid_t gcpl_id, hid_t gapl_id, hid_t dxpl_id, void **req)
+ const char *name, hid_t lcpl_id, hid_t gcpl_id, hid_t gapl_id,
+ hid_t dxpl_id, void **req)
{
void *ret_value = NULL; /* Return value */
@@ -3305,7 +3366,7 @@ H5VL__group_create(void *obj, const H5VL_loc_params_t *loc_params, const H5VL_cl
HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, NULL, "VOL connector has no 'group create' method")
/* Call the corresponding VOL callback */
- if(NULL == (ret_value = (cls->group_cls.create)(obj, loc_params, name, gcpl_id, gapl_id, dxpl_id, req)))
+ if(NULL == (ret_value = (cls->group_cls.create)(obj, loc_params, name, lcpl_id, gcpl_id, gapl_id, dxpl_id, req)))
HGOTO_ERROR(H5E_VOL, H5E_CANTCREATE, NULL, "group create failed")
done:
@@ -3325,7 +3386,8 @@ done:
*/
void *
H5VL_group_create(const H5VL_object_t *vol_obj, const H5VL_loc_params_t *loc_params,
- const char *name, hid_t gcpl_id, hid_t gapl_id, hid_t dxpl_id, void **req)
+ const char *name, hid_t lcpl_id, hid_t gcpl_id, hid_t gapl_id, hid_t dxpl_id,
+ void **req)
{
hbool_t vol_wrapper_set = FALSE; /* Whether the VOL object wrapping context was set up */
void *ret_value = NULL; /* Return value */
@@ -3338,7 +3400,7 @@ H5VL_group_create(const H5VL_object_t *vol_obj, const H5VL_loc_params_t *loc_par
vol_wrapper_set = TRUE;
/* Call the corresponding internal VOL routine */
- if(NULL == (ret_value = H5VL__group_create(vol_obj->data, loc_params, vol_obj->connector->cls, name, gcpl_id, gapl_id, dxpl_id, req)))
+ if(NULL == (ret_value = H5VL__group_create(vol_obj->data, loc_params, vol_obj->connector->cls, name, lcpl_id, gcpl_id, gapl_id, dxpl_id, req)))
HGOTO_ERROR(H5E_VOL, H5E_CANTCREATE, NULL, "group create failed")
done:
@@ -3361,15 +3423,16 @@ done:
*-------------------------------------------------------------------------
*/
void *
-H5VLgroup_create(void *obj, const H5VL_loc_params_t *loc_params, hid_t connector_id, const char *name,
- hid_t gcpl_id, hid_t gapl_id, hid_t dxpl_id, void **req)
+H5VLgroup_create(void *obj, const H5VL_loc_params_t *loc_params, hid_t connector_id,
+ const char *name, hid_t lcpl_id, hid_t gcpl_id, hid_t gapl_id,hid_t dxpl_id,
+ void **req)
{
H5VL_class_t *cls; /* VOL connector's class struct */
void *ret_value = NULL; /* Return value */
FUNC_ENTER_API_NOINIT
- H5TRACE8("*x", "*x*xi*siii**x", obj, loc_params, connector_id, name, gcpl_id,
- gapl_id, dxpl_id, req);
+ H5TRACE9("*x", "*x*xi*siiii**x", obj, loc_params, connector_id, name, lcpl_id,
+ gcpl_id, gapl_id, dxpl_id, req);
/* Check args and get class pointer */
if(NULL == obj)
@@ -3378,7 +3441,7 @@ H5VLgroup_create(void *obj, const H5VL_loc_params_t *loc_params, hid_t connector
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a VOL connector ID")
/* Call the corresponding internal VOL routine */
- if(NULL == (ret_value = H5VL__group_create(obj, loc_params, cls, name, gcpl_id, gapl_id, dxpl_id, req)))
+ if(NULL == (ret_value = H5VL__group_create(obj, loc_params, cls, name, lcpl_id, gcpl_id, gapl_id, dxpl_id, req)))
HGOTO_ERROR(H5E_VOL, H5E_CANTCREATE, NULL, "unable to create group")
done:
@@ -3942,7 +4005,8 @@ done:
*/
static herr_t
H5VL__link_create(H5VL_link_create_type_t create_type, void *obj, const H5VL_loc_params_t *loc_params,
- const H5VL_class_t *cls, hid_t lcpl_id, hid_t lapl_id, hid_t dxpl_id, void **req)
+ const H5VL_class_t *cls, hid_t lcpl_id, hid_t lapl_id, hid_t dxpl_id, void **req,
+ va_list arguments)
{
herr_t ret_value = SUCCEED; /* Return value */
@@ -3953,7 +4017,7 @@ H5VL__link_create(H5VL_link_create_type_t create_type, void *obj, const H5VL_loc
HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL connector has no 'link create' method")
/* Call the corresponding VOL callback */
- if((cls->link_cls.create)(create_type, obj, loc_params, lcpl_id, lapl_id, dxpl_id, req) < 0)
+ if((cls->link_cls.create)(create_type, obj, loc_params, lcpl_id, lapl_id, dxpl_id, req, arguments) < 0)
HGOTO_ERROR(H5E_VOL, H5E_CANTCREATE, FAIL, "link create failed")
done:
@@ -3974,23 +4038,28 @@ done:
herr_t
H5VL_link_create(H5VL_link_create_type_t create_type, const H5VL_object_t *vol_obj,
const H5VL_loc_params_t *loc_params, hid_t lcpl_id, hid_t lapl_id, hid_t dxpl_id,
- void **req)
+ void **req, ...)
{
H5VL_object_t tmp_vol_obj; /* Temporary object token of */
+ va_list arguments; /* Argument list passed from the API call */
+ hbool_t arg_started = FALSE; /* Whether the va_list has been started */
hbool_t vol_wrapper_set = FALSE; /* Whether the VOL object wrapping context was set up */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(FAIL)
+ /* Start the varargs, so they can be copied */
+ HDva_start(arguments, req);
+ arg_started = TRUE;
+
/* Special case for hard links */
if(H5VL_LINK_CREATE_HARD == create_type && NULL == vol_obj->data) {
- H5P_genplist_t *plist; /* Property list pointer */
+ va_list tmp_arguments; /* Copy of argument list passed in */
- /* Get the VOL data pointer from the fapl */
- if(NULL == (plist = (H5P_genplist_t *)H5I_object(lcpl_id)))
- HGOTO_ERROR(H5E_VOL, H5E_BADTYPE, FAIL, "not a file access property list")
- if(H5P_peek(plist, H5VL_PROP_LINK_TARGET, &tmp_vol_obj.data) < 0)
- HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "can't get VOL connector info")
+ /* Get the VOL data pointer from the varargs */
+ HDva_copy(tmp_arguments, arguments);
+ tmp_vol_obj.data = HDva_arg(tmp_arguments, void *);
+ HDva_end(tmp_arguments);
} /* end if */
else
/* Use the VOL object passed in */
@@ -4003,10 +4072,14 @@ H5VL_link_create(H5VL_link_create_type_t create_type, const H5VL_object_t *vol_o
vol_wrapper_set = TRUE;
/* Call the corresponding internal VOL routine */
- if(H5VL__link_create(create_type, vol_obj->data, loc_params, vol_obj->connector->cls, lcpl_id, lapl_id, dxpl_id, req) < 0)
+ if(H5VL__link_create(create_type, vol_obj->data, loc_params, vol_obj->connector->cls, lcpl_id, lapl_id, dxpl_id, req, arguments) < 0)
HGOTO_ERROR(H5E_VOL, H5E_CANTCREATE, FAIL, "link create failed")
done:
+ /* End access to the va_list, if we started it */
+ if(arg_started)
+ HDva_end(arguments);
+
/* Reset object wrapping info in API context */
if(vol_wrapper_set && H5VL_reset_vol_wrapper() < 0)
HDONE_ERROR(H5E_VOL, H5E_CANTRESET, FAIL, "can't reset VOL wrapper info")
@@ -4029,21 +4102,22 @@ done:
*/
herr_t
H5VLlink_create(H5VL_link_create_type_t create_type, void *obj, const H5VL_loc_params_t *loc_params,
- hid_t connector_id, hid_t lcpl_id, hid_t lapl_id, hid_t dxpl_id, void **req)
+ hid_t connector_id, hid_t lcpl_id, hid_t lapl_id, hid_t dxpl_id, void **req,
+ va_list arguments)
{
H5VL_class_t *cls; /* VOL connector's class struct */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API_NOINIT
- H5TRACE8("e", "Vk*x*xiiii**x", create_type, obj, loc_params, connector_id,
- lcpl_id, lapl_id, dxpl_id, req);
+ H5TRACE9("e", "Vk*x*xiiii**xx", create_type, obj, loc_params, connector_id,
+ lcpl_id, lapl_id, dxpl_id, req, arguments);
/* Get class pointer */
if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(connector_id, H5I_VOL)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL connector ID")
/* Call the corresponding internal VOL routine */
- if(H5VL__link_create(create_type, obj, loc_params, cls, lcpl_id, lapl_id, dxpl_id, req) < 0)
+ if(H5VL__link_create(create_type, obj, loc_params, cls, lcpl_id, lapl_id, dxpl_id, req, arguments) < 0)
HGOTO_ERROR(H5E_VOL, H5E_CANTCREATE, FAIL, "unable to create link")
done:
diff --git a/src/H5VLconnector.h b/src/H5VLconnector.h
new file mode 100644
index 0000000..9de518f
--- /dev/null
+++ b/src/H5VLconnector.h
@@ -0,0 +1,417 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * 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. *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+/*
+ * This file contains public declarations for authoring VOL connectors.
+ */
+
+#ifndef _H5VLconnector_H
+#define _H5VLconnector_H
+
+/* Public headers needed by this file */
+#include "H5public.h" /* Generic Functions */
+#include "H5Apublic.h" /* Attributes */
+#include "H5ESpublic.h" /* Event Stack */
+#include "H5Fpublic.h" /* Files */
+#include "H5Ipublic.h" /* IDs */
+#include "H5Lpublic.h" /* Links */
+#include "H5Opublic.h" /* Objects */
+#include "H5Rpublic.h" /* References */
+#include "H5VLpublic.h" /* Virtual Object Layer */
+
+
+/*****************/
+/* Public Macros */
+/*****************/
+
+/* Capability flags for connector */
+#define H5VL_CAP_FLAG_NONE 0 /* No special connector capabilities */
+#define H5VL_CAP_FLAG_THREADSAFE 0x01 /* Connector is threadsafe */
+
+
+/*******************/
+/* Public Typedefs */
+/*******************/
+
+/* types for attribute GET callback */
+typedef enum H5VL_attr_get_t {
+ H5VL_ATTR_GET_ACPL, /* creation property list */
+ H5VL_ATTR_GET_INFO, /* info */
+ H5VL_ATTR_GET_NAME, /* access property list */
+ H5VL_ATTR_GET_SPACE, /* dataspace */
+ H5VL_ATTR_GET_STORAGE_SIZE, /* storage size */
+ H5VL_ATTR_GET_TYPE /* datatype */
+} H5VL_attr_get_t;
+
+/* types for attribute SPECFIC callback */
+typedef enum H5VL_attr_specific_t {
+ H5VL_ATTR_DELETE, /* H5Adelete(_by_name/idx) */
+ H5VL_ATTR_EXISTS, /* H5Aexists(_by_name) */
+ H5VL_ATTR_ITER, /* H5Aiterate(_by_name) */
+ H5VL_ATTR_RENAME /* H5Arename(_by_name) */
+} H5VL_attr_specific_t;
+
+/* types for dataset GET callback */
+typedef enum H5VL_dataset_get_t {
+ H5VL_DATASET_GET_DAPL, /* access property list */
+ H5VL_DATASET_GET_DCPL, /* creation property list */
+ H5VL_DATASET_GET_OFFSET, /* offset */
+ H5VL_DATASET_GET_SPACE, /* dataspace */
+ H5VL_DATASET_GET_SPACE_STATUS, /* space status */
+ H5VL_DATASET_GET_STORAGE_SIZE, /* storage size */
+ H5VL_DATASET_GET_TYPE /* datatype */
+} H5VL_dataset_get_t;
+
+/* types for dataset SPECFIC callback */
+typedef enum H5VL_dataset_specific_t {
+ H5VL_DATASET_SET_EXTENT, /* H5Dset_extent */
+ H5VL_DATASET_FLUSH, /* H5Dflush */
+ H5VL_DATASET_REFRESH /* H5Drefresh */
+} H5VL_dataset_specific_t;
+
+/* types for datatype GET callback */
+typedef enum H5VL_datatype_get_t {
+ H5VL_DATATYPE_GET_BINARY, /* get serialized form of transient type */
+ H5VL_DATATYPE_GET_TCPL /* datatype creation property list */
+} H5VL_datatype_get_t;
+
+/* types for datatype SPECFIC callback */
+typedef enum H5VL_datatype_specific_t {
+ H5VL_DATATYPE_FLUSH,
+ H5VL_DATATYPE_REFRESH
+} H5VL_datatype_specific_t;
+
+/* types for file GET callback */
+typedef enum H5VL_file_get_t {
+ H5VL_FILE_GET_FAPL, /* file access property list */
+ H5VL_FILE_GET_FCPL, /* file creation property list */
+ H5VL_FILE_GET_INTENT, /* file intent */
+ H5VL_FILE_GET_FILENO, /* file number */
+ H5VL_FILE_GET_NAME, /* file name */
+ H5VL_FILE_GET_OBJ_COUNT, /* object count in file */
+ H5VL_FILE_GET_OBJ_IDS /* object ids in file */
+} H5VL_file_get_t;
+
+/* types for file SPECIFIC callback */
+typedef enum H5VL_file_specific_t {
+ H5VL_FILE_FLUSH, /* Flush file */
+ H5VL_FILE_REOPEN, /* Reopen the file */
+ H5VL_FILE_MOUNT, /* Mount a file */
+ H5VL_FILE_UNMOUNT, /* Unmount a file */
+ H5VL_FILE_IS_ACCESSIBLE, /* Check if a file is accessible */
+ H5VL_FILE_DELETE /* Delete a file */
+} H5VL_file_specific_t;
+
+/* types for group GET callback */
+typedef enum H5VL_group_get_t {
+ H5VL_GROUP_GET_GCPL, /* group creation property list */
+ H5VL_GROUP_GET_INFO /* group info */
+} H5VL_group_get_t;
+
+/* types for group SPECFIC callback */
+typedef enum H5VL_group_specific_t {
+ H5VL_GROUP_FLUSH,
+ H5VL_GROUP_REFRESH
+} H5VL_group_specific_t;
+
+/* link create types for VOL */
+typedef enum H5VL_link_create_type_t {
+ H5VL_LINK_CREATE_HARD,
+ H5VL_LINK_CREATE_SOFT,
+ H5VL_LINK_CREATE_UD
+} H5VL_link_create_type_t;
+
+/* types for link GET callback */
+typedef enum H5VL_link_get_t {
+ H5VL_LINK_GET_INFO, /* link info */
+ H5VL_LINK_GET_NAME, /* link name */
+ H5VL_LINK_GET_VAL /* link value */
+} H5VL_link_get_t;
+
+/* types for link SPECIFIC callback */
+typedef enum H5VL_link_specific_t {
+ H5VL_LINK_DELETE, /* H5Ldelete(_by_idx) */
+ H5VL_LINK_EXISTS, /* link existence */
+ H5VL_LINK_ITER /* H5Literate/visit(_by_name) */
+} H5VL_link_specific_t;
+
+/* types for object GET callback */
+typedef enum H5VL_object_get_t {
+ H5VL_REF_GET_NAME, /* object name, for reference */
+ H5VL_REF_GET_REGION, /* dataspace of region */
+ H5VL_REF_GET_TYPE, /* type of object */
+ H5VL_OBJECT_GET_NAME /* object name */
+} H5VL_object_get_t;
+
+/* types for object SPECIFIC callback */
+typedef enum H5VL_object_specific_t {
+ H5VL_OBJECT_CHANGE_REF_COUNT, /* H5Oincr/decr_refcount */
+ H5VL_OBJECT_EXISTS, /* H5Oexists_by_name */
+ H5VL_OBJECT_VISIT, /* H5Ovisit(_by_name) */
+ H5VL_REF_CREATE, /* H5Rcreate */
+ H5VL_OBJECT_FLUSH, /* H5{D|G|O|T}flush */
+ H5VL_OBJECT_REFRESH /* H5{D|G|O|T}refresh */
+} H5VL_object_specific_t;
+
+/* types for async request SPECIFIC callback */
+typedef enum H5VL_request_specific_t {
+ H5VL_REQUEST_WAITANY, /* Wait until any request completes */
+ H5VL_REQUEST_WAITSOME, /* Wait until at least one requesst completes */
+ H5VL_REQUEST_WAITALL /* Wait until all requests complete */
+} H5VL_request_specific_t;
+
+/* types for different ways that objects are located in an HDF5 container */
+typedef enum H5VL_loc_type_t {
+ H5VL_OBJECT_BY_SELF,
+ H5VL_OBJECT_BY_NAME,
+ H5VL_OBJECT_BY_IDX,
+ H5VL_OBJECT_BY_ADDR,
+ H5VL_OBJECT_BY_REF
+} H5VL_loc_type_t;
+
+struct H5VL_loc_by_name {
+ const char *name;
+ hid_t lapl_id;
+};
+
+struct H5VL_loc_by_idx {
+ const char *name;
+ H5_index_t idx_type;
+ H5_iter_order_t order;
+ hsize_t n;
+ hid_t lapl_id;
+};
+
+struct H5VL_loc_by_addr {
+ haddr_t addr;
+};
+
+struct H5VL_loc_by_ref {
+ H5R_type_t ref_type;
+ const void *_ref;
+ hid_t lapl_id;
+};
+
+/* Structure to hold parameters for object locations.
+ * either: BY_ADDR, BY_ID, BY_NAME, BY_IDX, BY_REF
+ *
+ * Note: Leave loc_by_addr as the first union member so we
+ * can perform the simplest initialization of the struct
+ * without raising warnings.
+ */
+typedef struct H5VL_loc_params_t {
+ H5I_type_t obj_type;
+ H5VL_loc_type_t type;
+ union{
+ struct H5VL_loc_by_addr loc_by_addr;
+ struct H5VL_loc_by_name loc_by_name;
+ struct H5VL_loc_by_idx loc_by_idx;
+ struct H5VL_loc_by_ref loc_by_ref;
+ } loc_data;
+} H5VL_loc_params_t;
+
+/* VOL connector info fields & callbacks */
+typedef struct H5VL_info_class_t {
+ size_t size; /* Size of the VOL info */
+ void * (*copy)(const void *info); /* Callback to create a copy of the VOL info */
+ herr_t (*cmp)(int *cmp_value, const void *info1, const void *info2); /* Callback to compare VOL info */
+ herr_t (*free)(void *info); /* Callback to release a VOL info */
+ herr_t (*to_str)(const void *info, char **str); /* Callback to serialize connector's info into a string */
+ herr_t (*from_str)(const char *str, void **info); /* Callback to deserialize a string into connector's info */
+} H5VL_info_class_t;
+
+/* VOL object wrap / retrieval callbacks */
+/* (These only need to be implemented by "pass through" VOL connectors) */
+typedef struct H5VL_wrap_class_t {
+ void * (*get_object)(const void *obj); /* Callback to retrieve underlying object */
+ herr_t (*get_wrap_ctx)(const void *obj, void **wrap_ctx); /* Callback to retrieve the object wrapping context for the connector */
+ void * (*wrap_object)(void *obj, H5I_type_t obj_type, void *wrap_ctx); /* Callback to wrap a library object */
+ void * (*unwrap_object)(void *obj); /* Callback to unwrap a library object */
+ herr_t (*free_wrap_ctx)(void *wrap_ctx); /* Callback to release the object wrapping context for the connector */
+} H5VL_wrap_class_t;
+
+/* H5A routines */
+typedef struct H5VL_attr_class_t {
+ void *(*create)(void *obj, const H5VL_loc_params_t *loc_params, const char *attr_name,
+ hid_t type_id, hid_t space_id, hid_t acpl_id, hid_t aapl_id,
+ hid_t dxpl_id, void **req);
+ void *(*open)(void *obj, const H5VL_loc_params_t *loc_params, const char *attr_name,
+ hid_t aapl_id, hid_t dxpl_id, void **req);
+ herr_t (*read)(void *attr, hid_t mem_type_id, void *buf, hid_t dxpl_id, void **req);
+ herr_t (*write)(void *attr, hid_t mem_type_id, const void *buf, hid_t dxpl_id, void **req);
+ herr_t (*get)(void *obj, H5VL_attr_get_t get_type, hid_t dxpl_id, void **req, va_list arguments);
+ herr_t (*specific)(void *obj, const H5VL_loc_params_t *loc_params, H5VL_attr_specific_t specific_type,
+ hid_t dxpl_id, void **req, va_list arguments);
+ herr_t (*optional)(void *obj, hid_t dxpl_id, void **req, va_list arguments);
+ herr_t (*close) (void *attr, hid_t dxpl_id, void **req);
+} H5VL_attr_class_t;
+
+/* H5D routines */
+typedef struct H5VL_dataset_class_t {
+ void *(*create)(void *obj, const H5VL_loc_params_t *loc_params, const char *name,
+ hid_t lcpl_id, hid_t type_id, hid_t space_id, hid_t dcpl_id,
+ hid_t dapl_id, hid_t dxpl_id, void **req);
+ void *(*open)(void *obj, const H5VL_loc_params_t *loc_params, const char *name,
+ hid_t dapl_id, hid_t dxpl_id, void **req);
+ herr_t (*read)(void *dset, hid_t mem_type_id, hid_t mem_space_id, hid_t file_space_id,
+ hid_t xfer_plist_id, void * buf, void **req);
+ herr_t (*write)(void *dset, hid_t mem_type_id, hid_t mem_space_id, hid_t file_space_id,
+ hid_t xfer_plist_id, const void * buf, void **req);
+ herr_t (*get)(void *obj, H5VL_dataset_get_t get_type, hid_t dxpl_id, void **req, va_list arguments);
+ herr_t (*specific)(void *obj, H5VL_dataset_specific_t specific_type,
+ hid_t dxpl_id, void **req, va_list arguments);
+ herr_t (*optional)(void *obj, hid_t dxpl_id, void **req, va_list arguments);
+ herr_t (*close) (void *dset, hid_t dxpl_id, void **req);
+} H5VL_dataset_class_t;
+
+/* H5T routines*/
+typedef struct H5VL_datatype_class_t {
+ void *(*commit)(void *obj, const H5VL_loc_params_t *loc_params, const char *name, hid_t type_id,
+ hid_t lcpl_id, hid_t tcpl_id, hid_t tapl_id, hid_t dxpl_id, void **req);
+ void *(*open)(void *obj, const H5VL_loc_params_t *loc_params, const char * name,
+ hid_t tapl_id, hid_t dxpl_id, void **req);
+ herr_t (*get) (void *obj, H5VL_datatype_get_t get_type, hid_t dxpl_id, void **req, va_list arguments);
+ herr_t (*specific)(void *obj, H5VL_datatype_specific_t specific_type,
+ hid_t dxpl_id, void **req, va_list arguments);
+ herr_t (*optional)(void *obj, hid_t dxpl_id, void **req, va_list arguments);
+ herr_t (*close) (void *dt, hid_t dxpl_id, void **req);
+} H5VL_datatype_class_t;
+
+/* H5F routines */
+typedef struct H5VL_file_class_t {
+ void *(*create)(const char *name, unsigned flags, hid_t fcpl_id,
+ hid_t fapl_id, hid_t dxpl_id, void **req);
+ void *(*open)(const char *name, unsigned flags, hid_t fapl_id, hid_t dxpl_id, void **req);
+ herr_t (*get)(void *obj, H5VL_file_get_t get_type, hid_t dxpl_id, void **req, va_list arguments);
+ herr_t (*specific)(void *obj, H5VL_file_specific_t specific_type,
+ hid_t dxpl_id, void **req, va_list arguments);
+ herr_t (*optional)(void *obj, hid_t dxpl_id, void **req, va_list arguments);
+ herr_t (*close) (void *file, hid_t dxpl_id, void **req);
+} H5VL_file_class_t;
+
+/* H5G routines */
+typedef struct H5VL_group_class_t {
+ void *(*create)(void *obj, const H5VL_loc_params_t *loc_params, const char *name,
+ hid_t lcpl_id, hid_t gcpl_id, hid_t gapl_id, hid_t dxpl_id, void **req);
+ void *(*open)(void *obj, const H5VL_loc_params_t *loc_params, const char *name,
+ hid_t gapl_id, hid_t dxpl_id, void **req);
+ herr_t (*get)(void *obj, H5VL_group_get_t get_type, hid_t dxpl_id, void **req, va_list arguments);
+ herr_t (*specific)(void *obj, H5VL_group_specific_t specific_type,
+ hid_t dxpl_id, void **req, va_list arguments);
+ herr_t (*optional)(void *obj, hid_t dxpl_id, void **req, va_list arguments);
+ herr_t (*close) (void *grp, hid_t dxpl_id, void **req);
+} H5VL_group_class_t;
+
+/* H5L routines */
+typedef struct H5VL_link_class_t {
+ herr_t (*create)(H5VL_link_create_type_t create_type, void *obj, const H5VL_loc_params_t *loc_params,
+ hid_t lcpl_id, hid_t lapl_id, hid_t dxpl_id, void **req, va_list argumenmts);
+ herr_t (*copy)(void *src_obj, const H5VL_loc_params_t *loc_params1,
+ void *dst_obj, const H5VL_loc_params_t *loc_params2,
+ hid_t lcpl, hid_t lapl, hid_t dxpl_id, void **req);
+ herr_t (*move)(void *src_obj, const H5VL_loc_params_t *loc_params1,
+ void *dst_obj, const H5VL_loc_params_t *loc_params2,
+ hid_t lcpl, hid_t lapl, hid_t dxpl_id, void **req);
+ herr_t (*get)(void *obj, const H5VL_loc_params_t *loc_params, H5VL_link_get_t get_type,
+ hid_t dxpl_id, void **req, va_list arguments);
+ herr_t (*specific)(void *obj, const H5VL_loc_params_t *loc_params, H5VL_link_specific_t specific_type,
+ hid_t dxpl_id, void **req, va_list arguments);
+ herr_t (*optional)(void *obj, hid_t dxpl_id, void **req, va_list arguments);
+} H5VL_link_class_t;
+
+/* H5O routines */
+typedef struct H5VL_object_class_t {
+ void *(*open)(void *obj, const H5VL_loc_params_t *loc_params, H5I_type_t *opened_type,
+ hid_t dxpl_id, void **req);
+ herr_t (*copy)(void *src_obj, const H5VL_loc_params_t *loc_params1, const char *src_name,
+ void *dst_obj, const H5VL_loc_params_t *loc_params2, const char *dst_name,
+ hid_t ocpypl_id, hid_t lcpl_id, hid_t dxpl_id, void **req);
+ herr_t (*get)(void *obj, const H5VL_loc_params_t *loc_params, H5VL_object_get_t get_type,
+ hid_t dxpl_id, void **req, va_list arguments);
+ herr_t (*specific)(void *obj, const H5VL_loc_params_t *loc_params, H5VL_object_specific_t specific_type,
+ hid_t dxpl_id, void **req, va_list arguments);
+ herr_t (*optional)(void *obj, hid_t dxpl_id, void **req, va_list arguments);
+} H5VL_object_class_t;
+
+/* Asynchronous request 'notify' callback */
+typedef herr_t (*H5VL_request_notify_t)(void *ctx, H5ES_status_t status);
+
+/* Async request operation routines */
+typedef struct H5VL_request_class_t {
+ herr_t (*wait)(void *req, uint64_t timeout, H5ES_status_t *status);
+ herr_t (*notify)(void *req, H5VL_request_notify_t cb, void *ctx);
+ herr_t (*cancel)(void *req);
+ herr_t (*specific)(void *req, H5VL_request_specific_t specific_type, va_list arguments);
+ herr_t (*optional)(void *req, va_list arguments);
+ herr_t (*free)(void *req);
+} H5VL_request_class_t;
+
+/*
+ * VOL connector identifiers. Values 0 through 255 are for connectors defined
+ * by the HDF5 library. Values 256 through 511 are available for testing new
+ * filters. Subsequent values should be obtained from the HDF5 development
+ * team at help@hdfgroup.org.
+ */
+typedef int H5VL_class_value_t;
+
+/* Class information for each VOL connector */
+typedef struct H5VL_class_t {
+ /* Overall connector fields & callbacks */
+ unsigned int version; /* VOL connector class struct version # */
+ H5VL_class_value_t value; /* Value to identify connector */
+ const char *name; /* Connector name (MUST be unique!) */
+ unsigned cap_flags; /* Capability flags for connector */
+ herr_t (*initialize)(hid_t vipl_id); /* Connector initialization callback */
+ herr_t (*terminate)(void); /* Connector termination callback */
+
+ /* VOL framework */
+ H5VL_info_class_t info_cls; /* VOL info fields & callbacks */
+ H5VL_wrap_class_t wrap_cls; /* VOL object wrap / retrieval callbacks */
+
+ /* Data Model */
+ H5VL_attr_class_t attr_cls; /* Attribute (H5A*) class callbacks */
+ H5VL_dataset_class_t dataset_cls; /* Dataset (H5D*) class callbacks */
+ H5VL_datatype_class_t datatype_cls; /* Datatype (H5T*) class callbacks */
+ H5VL_file_class_t file_cls; /* File (H5F*) class callbacks */
+ H5VL_group_class_t group_cls; /* Group (H5G*) class callbacks */
+ H5VL_link_class_t link_cls; /* Link (H5L*) class callbacks */
+ H5VL_object_class_t object_cls; /* Object (H5O*) class callbacks */
+
+ /* Services */
+ H5VL_request_class_t request_cls; /* Asynchronous request class callbacks */
+
+ /* Catch-all */
+ herr_t (*optional)(void *obj, hid_t dxpl_id, void **req, va_list arguments); /* Optional callback */
+} H5VL_class_t;
+
+
+/********************/
+/* Public Variables */
+/********************/
+
+/*********************/
+/* Public Prototypes */
+/*********************/
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/* Helper routines for VOL connector authors */
+H5_DLL void *H5VLobject(hid_t obj_id);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _H5VLconnector_H */
+
diff --git a/src/H5VLconnector_passthru.h b/src/H5VLconnector_passthru.h
new file mode 100644
index 0000000..9a2bd52
--- /dev/null
+++ b/src/H5VLconnector_passthru.h
@@ -0,0 +1,166 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * 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. *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+/*
+ * This file contains public declarations for authoring VOL connectors
+ * which act as "passthrough" connectors that forward their API calls to
+ * an underlying connector.
+ *
+ * An example of this might be a logging connector, which creates log messages
+ * and then passes the call on to an underlying VOL connector.
+ *
+ * The functionality required to implement such a connector is specialized
+ * and non-trivial so it has been split into this header in an effort to keep
+ * the H5VLconnector.h header easier to understand.
+ */
+
+#ifndef _H5VLconnector_passthru_H
+#define _H5VLconnector_passthru_H
+
+/* Public headers needed by this file */
+#include "H5public.h" /* Generic Functions */
+#include "H5Ipublic.h" /* IDs */
+#include "H5VLpublic.h" /* Virtual Object Layer */
+
+/* Semi-public headers mainly for VOL connector authors */
+#include "H5VLconnector.h"
+
+
+/*****************/
+/* Public Macros */
+/*****************/
+
+/*******************/
+/* Public Typedefs */
+/*******************/
+
+/********************/
+/* Public Variables */
+/********************/
+
+/*********************/
+/* Public Prototypes */
+/*********************/
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/* Helper routines for VOL connector authors */
+H5_DLL herr_t H5VLcmp_connector_cls(int *cmp, hid_t connector_id1, hid_t connector_id2);
+H5_DLL hid_t H5VLwrap_register(void *obj, H5I_type_t type);
+H5_DLL herr_t H5VLretrieve_lib_state(void **state);
+H5_DLL herr_t H5VLrestore_lib_state(const void *state);
+H5_DLL herr_t H5VLreset_lib_state(void);
+H5_DLL herr_t H5VLfree_lib_state(void *state);
+
+/* Pass-through callbacks */
+H5_DLL void *H5VLget_object(void *obj, hid_t connector_id);
+H5_DLL herr_t H5VLget_wrap_ctx(void *obj, hid_t connector_id, void **wrap_ctx);
+H5_DLL void *H5VLwrap_object(void *obj, H5I_type_t obj_type, hid_t connector_id,
+ void *wrap_ctx);
+H5_DLL void *H5VLunwrap_object(void *obj, hid_t connector_id);
+H5_DLL herr_t H5VLfree_wrap_ctx(void *wrap_ctx, hid_t connector_id);
+
+/* Public wrappers for generic callbacks */
+H5_DLL herr_t H5VLinitialize(hid_t connector_id, hid_t vipl_id);
+H5_DLL herr_t H5VLterminate(hid_t connector_id);
+H5_DLL herr_t H5VLget_cap_flags(hid_t connector_id, unsigned *cap_flags);
+H5_DLL herr_t H5VLget_value(hid_t connector_id, H5VL_class_value_t *conn_value);
+
+/* Public wrappers for info fields and callbacks */
+H5_DLL herr_t H5VLcopy_connector_info(hid_t connector_id, void **dst_vol_info, void *src_vol_info);
+H5_DLL herr_t H5VLcmp_connector_info(int *cmp, hid_t connector_id, const void *info1,
+ const void *info2);
+H5_DLL herr_t H5VLfree_connector_info(hid_t connector_id, void *vol_info);
+H5_DLL herr_t H5VLconnector_info_to_str(const void *info, hid_t connector_id, char **str);
+H5_DLL herr_t H5VLconnector_str_to_info(const char *str, hid_t connector_id, void **info);
+
+/* Public wrappers for attribute callbacks */
+H5_DLL void *H5VLattr_create(void *obj, const H5VL_loc_params_t *loc_params, hid_t connector_id, const char *attr_name, hid_t type_id, hid_t space_id, hid_t acpl_id, hid_t aapl_id, hid_t dxpl_id, void **req);
+H5_DLL void *H5VLattr_open(void *obj, const H5VL_loc_params_t *loc_params, hid_t connector_id, const char *name, hid_t aapl_id, hid_t dxpl_id, void **req);
+H5_DLL herr_t H5VLattr_read(void *attr, hid_t connector_id, hid_t dtype_id, void *buf, hid_t dxpl_id, void **req);
+H5_DLL herr_t H5VLattr_write(void *attr, hid_t connector_id, hid_t dtype_id, const void *buf, hid_t dxpl_id, void **req);
+H5_DLL herr_t H5VLattr_get(void *obj, hid_t connector_id, H5VL_attr_get_t get_type, hid_t dxpl_id, void **req, va_list arguments);
+H5_DLL herr_t H5VLattr_specific(void *obj, const H5VL_loc_params_t *loc_params, hid_t connector_id, H5VL_attr_specific_t specific_type, hid_t dxpl_id, void **req, va_list arguments);
+H5_DLL herr_t H5VLattr_optional(void *obj, hid_t connector_id, hid_t dxpl_id, void **req, va_list arguments);
+H5_DLL herr_t H5VLattr_close(void *attr, hid_t connector_id, hid_t dxpl_id, void **req);
+
+/* Public wrappers for dataset callbacks */
+H5_DLL void *H5VLdataset_create(void *obj, const H5VL_loc_params_t *loc_params, hid_t connector_id, const char *name, hid_t lcpl_id, hid_t type_id, hid_t space_id, hid_t dcpl_id, hid_t dapl_id, hid_t dxpl_id, void **req);
+H5_DLL void *H5VLdataset_open(void *obj, const H5VL_loc_params_t *loc_params, hid_t connector_id, const char *name, hid_t dapl_id, hid_t dxpl_id, void **req);
+H5_DLL herr_t H5VLdataset_read(void *dset, hid_t connector_id, hid_t mem_type_id, hid_t mem_space_id, hid_t file_space_id, hid_t plist_id, void *buf, void **req);
+H5_DLL herr_t H5VLdataset_write(void *dset, hid_t connector_id, hid_t mem_type_id, hid_t mem_space_id, hid_t file_space_id, hid_t plist_id, const void *buf, void **req);
+H5_DLL herr_t H5VLdataset_get(void *dset, hid_t connector_id, H5VL_dataset_get_t get_type, hid_t dxpl_id, void **req, va_list arguments);
+H5_DLL herr_t H5VLdataset_specific(void *obj, hid_t connector_id, H5VL_dataset_specific_t specific_type, hid_t dxpl_id, void **req, va_list arguments);
+H5_DLL herr_t H5VLdataset_optional(void *obj, hid_t connector_id, hid_t dxpl_id, void **req, va_list arguments);
+H5_DLL herr_t H5VLdataset_close(void *dset, hid_t connector_id, hid_t dxpl_id, void **req);
+
+/* Public wrappers for file callbacks */
+H5_DLL void *H5VLfile_create(const char *name, unsigned flags, hid_t fcpl_id, hid_t fapl_id, hid_t dxpl_id, void **req);
+H5_DLL void *H5VLfile_open(const char *name, unsigned flags, hid_t fapl_id, hid_t dxpl_id, void **req);
+H5_DLL herr_t H5VLfile_get(void *file, hid_t connector_id, H5VL_file_get_t get_type, hid_t dxpl_id, void **req, va_list arguments);
+H5_DLL herr_t H5VLfile_specific(void *obj, hid_t connector_id, H5VL_file_specific_t specific_type, hid_t dxpl_id, void **req, va_list arguments);
+H5_DLL herr_t H5VLfile_optional(void *obj, hid_t connector_id, hid_t dxpl_id, void **req, va_list arguments);
+H5_DLL herr_t H5VLfile_close(void *file, hid_t connector_id, hid_t dxpl_id, void **req);
+
+/* Public wrappers for group callbacks */
+H5_DLL void *H5VLgroup_create(void *obj, const H5VL_loc_params_t *loc_params, hid_t connector_id, const char *name, hid_t lcpl_id, hid_t gcpl_id, hid_t gapl_id, hid_t dxpl_id, void **req);
+H5_DLL void *H5VLgroup_open(void *obj, const H5VL_loc_params_t *loc_params, hid_t connector_id, const char *name, hid_t gapl_id, hid_t dxpl_id, void **req);
+H5_DLL herr_t H5VLgroup_get(void *obj, hid_t connector_id, H5VL_group_get_t get_type, hid_t dxpl_id, void **req, va_list arguments);
+H5_DLL herr_t H5VLgroup_specific(void *obj, hid_t connector_id, H5VL_group_specific_t specific_type, hid_t dxpl_id, void **req, va_list arguments);
+H5_DLL herr_t H5VLgroup_optional(void *obj, hid_t connector_id, hid_t dxpl_id, void **req, va_list arguments);
+H5_DLL herr_t H5VLgroup_close(void *grp, hid_t connector_id, hid_t dxpl_id, void **req);
+
+/* Public wrappers for link callbacks */
+H5_DLL herr_t H5VLlink_create(H5VL_link_create_type_t create_type, void *obj, const H5VL_loc_params_t *loc_params, hid_t connector_id, hid_t lcpl_id, hid_t lapl_id, hid_t dxpl_id, void **req, va_list arguments);
+H5_DLL herr_t H5VLlink_copy(void *src_obj, const H5VL_loc_params_t *loc_params1,
+ void *dst_obj, const H5VL_loc_params_t *loc_params2, hid_t connector_id,
+ hid_t lcpl_id, hid_t lapl_id, hid_t dxpl_id, void **req);
+H5_DLL herr_t H5VLlink_move(void *src_obj, const H5VL_loc_params_t *loc_params1,
+ void *dst_obj, const H5VL_loc_params_t *loc_params2, hid_t connector_id,
+ hid_t lcpl_id, hid_t lapl_id, hid_t dxpl_id, void **req);
+H5_DLL herr_t H5VLlink_get(void *obj, const H5VL_loc_params_t *loc_params, hid_t connector_id, H5VL_link_get_t get_type, hid_t dxpl_id, void **req, va_list arguments);
+H5_DLL herr_t H5VLlink_specific(void *obj, const H5VL_loc_params_t *loc_params, hid_t connector_id, H5VL_link_specific_t specific_type, hid_t dxpl_id, void **req, va_list arguments);
+H5_DLL herr_t H5VLlink_optional(void *obj, hid_t connector_id, hid_t dxpl_id, void **req, va_list arguments);
+
+/* Public wrappers for object callbacks */
+H5_DLL void *H5VLobject_open(void *obj, const H5VL_loc_params_t *loc_params, hid_t connector_id, H5I_type_t *opened_type, hid_t dxpl_id, void **req);
+H5_DLL herr_t H5VLobject_copy(void *src_obj, const H5VL_loc_params_t *loc_params1, const char *src_name,
+ void *dst_obj, const H5VL_loc_params_t *loc_params2, const char *dst_name,
+ hid_t connector_id, hid_t ocpypl_id, hid_t lcpl_id, hid_t dxpl_id, void **req);
+H5_DLL herr_t H5VLobject_get(void *obj, const H5VL_loc_params_t *loc_params, hid_t connector_id, H5VL_object_get_t get_type, hid_t dxpl_id, void **req, va_list arguments);
+H5_DLL herr_t H5VLobject_specific(void *obj, const H5VL_loc_params_t *loc_params, hid_t connector_id, H5VL_object_specific_t specific_type, hid_t dxpl_id, void **req, va_list arguments);
+H5_DLL herr_t H5VLobject_optional(void *obj, hid_t connector_id, hid_t dxpl_id, void **req, va_list arguments);
+
+/* Public wrappers for named datatype callbacks */
+H5_DLL void *H5VLdatatype_commit(void *obj, const H5VL_loc_params_t *loc_params, hid_t connector_id, const char *name, hid_t type_id, hid_t lcpl_id, hid_t tcpl_id, hid_t tapl_id, hid_t dxpl_id, void **req);
+H5_DLL void *H5VLdatatype_open(void *obj, const H5VL_loc_params_t *loc_params, hid_t connector_id, const char *name, hid_t tapl_id, hid_t dxpl_id, void **req);
+H5_DLL herr_t H5VLdatatype_get(void *dt, hid_t connector_id, H5VL_datatype_get_t get_type, hid_t dxpl_id, void **req, va_list arguments);
+H5_DLL herr_t H5VLdatatype_specific(void *obj, hid_t connector_id, H5VL_datatype_specific_t specific_type, hid_t dxpl_id, void **req, va_list arguments);
+H5_DLL herr_t H5VLdatatype_optional(void *obj, hid_t connector_id, hid_t dxpl_id, void **req, va_list arguments);
+H5_DLL herr_t H5VLdatatype_close(void *dt, hid_t connector_id, hid_t dxpl_id, void **req);
+
+/* Public wrappers for asynchronous request callbacks */
+H5_DLL herr_t H5VLrequest_wait(void *req, hid_t connector_id, uint64_t timeout, H5ES_status_t *status);
+H5_DLL herr_t H5VLrequest_notify(void *req, hid_t connector_id, H5VL_request_notify_t cb, void *ctx);
+H5_DLL herr_t H5VLrequest_cancel(void *req, hid_t connector_id);
+H5_DLL herr_t H5VLrequest_specific(void *req, hid_t connector_id, H5VL_request_specific_t specific_type, va_list arguments);
+H5_DLL herr_t H5VLrequest_optional(void *req, hid_t connector_id, va_list arguments);
+H5_DLL herr_t H5VLrequest_free(void *req, hid_t connector_id);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _H5VLconnector_passthru_H */
+
diff --git a/src/H5VLint.c b/src/H5VLint.c
index f22fdb6..884b2f6 100644
--- a/src/H5VLint.c
+++ b/src/H5VLint.c
@@ -29,14 +29,19 @@
/* Headers */
/***********/
-#include "H5private.h" /* Generic Functions */
-#include "H5CXprivate.h" /* API Contexts */
-#include "H5Eprivate.h" /* Error handling */
-#include "H5FLprivate.h" /* Free lists */
-#include "H5Iprivate.h" /* IDs */
-#include "H5MMprivate.h" /* Memory management */
-#include "H5Tprivate.h" /* Datatypes */
-#include "H5VLpkg.h" /* Virtual Object Layer */
+#include "H5private.h" /* Generic Functions */
+#include "H5CXprivate.h" /* API Contexts */
+#include "H5Eprivate.h" /* Error handling */
+#include "H5FLprivate.h" /* Free lists */
+#include "H5Iprivate.h" /* IDs */
+#include "H5MMprivate.h" /* Memory management */
+#include "H5PLprivate.h" /* Plugins */
+#include "H5Tprivate.h" /* Datatypes */
+#include "H5VLpkg.h" /* Virtual Object Layer */
+
+/* VOL connectors */
+#include "H5VLnative.h" /* Native VOL connector */
+#include "H5VLpassthru.h" /* Pass-through VOL connector */
/****************/
@@ -51,10 +56,28 @@
/* Object wrapping context info */
typedef struct H5VL_wrap_ctx_t {
unsigned rc; /* Ref. count for the # of times the context was set / reset */
- const H5VL_t *connector; /* VOL connector for "outermost" class to start wrap */
+ H5VL_t *connector; /* VOL connector for "outermost" class to start wrap */
void *obj_wrap_ctx; /* "wrap context" for outermost connector */
} H5VL_wrap_ctx_t;
+/* Information needed for iterating over the registered VOL connector hid_t IDs.
+ * The name or value of the new VOL connector that is being registered is
+ * stored in the name (or value) field and the found_id field is initialized to
+ * H5I_INVALID_HID (-1). If we find a VOL connector with the same name / value,
+ * we set the found_id field to the existing ID for return to the function.
+ */
+typedef struct {
+ /* IN */
+ H5VL_get_connector_kind_t kind; /* Which kind of connector search to make */
+ union {
+ const char *name; /* The name of the VOL connector to check */
+ H5VL_class_value_t value; /* The value of the VOL connector to check */
+ } u;
+
+ /* OUT */
+ hid_t found_id; /* The connector ID, if we found a match */
+} H5VL_get_connector_ud_t;
+
/********************/
/* Package Typedefs */
@@ -65,10 +88,15 @@ typedef struct H5VL_wrap_ctx_t {
/* Local Prototypes */
/********************/
static herr_t H5VL__free_cls(H5VL_class_t *cls);
+static int H5VL__get_connector_cb(void *obj, hid_t id, void *_op_data);
+static herr_t H5VL__set_def_conn(void);
static void *H5VL__wrap_obj(void *obj, H5I_type_t obj_type);
static H5VL_object_t *H5VL__new_vol_obj(H5I_type_t type, void *object,
H5VL_t *vol_connector, hbool_t wrap_obj);
+static int64_t H5VL__conn_inc_rc(H5VL_t *connector);
+static int64_t H5VL__conn_dec_rc(H5VL_t *connector);
static void *H5VL__object(hid_t id, H5I_type_t obj_type);
+static herr_t H5VL__free_vol_wrapper(H5VL_wrap_ctx_t *vol_wrap_ctx);
/*********************/
@@ -83,6 +111,7 @@ hbool_t H5_PKG_INIT_VAR = FALSE;
/* Library Private Variables */
/*****************************/
+
/*******************/
/* Local Variables */
/*******************/
@@ -107,21 +136,27 @@ H5FL_DEFINE(H5VL_object_t);
/* Declare a free list to manage the H5VL_wrap_ctx_t struct */
H5FL_DEFINE_STATIC(H5VL_wrap_ctx_t);
+/* Default VOL connector */
+static H5VL_connector_prop_t H5VL_def_conn_s = {-1, NULL};
+
/*-------------------------------------------------------------------------
- * Function: H5VL_init
+ * Function: H5VL_init_phase1
*
- * Purpose: Initialize the interface from some other package
+ * Purpose: Initialize the interface from some other package. This should
+ * be followed with a call to H5VL_init_phase2 after the H5P
+ * interface is completely set up, finish setting up the H5VL
+ * information.
*
- * Return: Success: Non-negative
*
+ * Return: Success: Non-negative
* Failure: Negative
*
*-------------------------------------------------------------------------
*/
herr_t
-H5VL_init(void)
+H5VL_init_phase1(void)
{
herr_t ret_value = SUCCEED; /* Return value */
@@ -131,7 +166,36 @@ H5VL_init(void)
done:
FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5VL_init() */
+} /* end H5VL_init_phase1() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VL_init_phase2
+ *
+ * Purpose: Finish initializing the interface from some other package.
+ *
+ * Note: This is broken out as a separate routine to avoid a circular
+ * reference with the H5P package.
+ *
+ * Return: Success: Non-negative
+ * Failure: Negative
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5VL_init_phase2(void)
+{
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_NOAPI(FAIL)
+
+ /* Set up the default VOL connector in the default FAPL */
+ if(H5VL__set_def_conn() < 0)
+ HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "unable to set default VOL connector")
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5VL_init_phase2() */
/*-------------------------------------------------------------------------
@@ -148,12 +212,12 @@ done:
herr_t
H5VL__init_package(void)
{
- herr_t ret_value = SUCCEED; /* Return value */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_PACKAGE
/* Initialize the atom group for the VL IDs */
- if (H5I_register_type(H5I_VOL_CLS) < 0)
+ if(H5I_register_type(H5I_VOL_CLS) < 0)
HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, FAIL, "unable to initialize H5VL interface")
done:
@@ -180,17 +244,27 @@ H5VL_term_package(void)
FUNC_ENTER_NOAPI_NOINIT_NOERR
if(H5_PKG_INIT_VAR) {
- if (H5I_nmembers(H5I_VOL) > 0) {
- (void)H5I_clear_type(H5I_VOL, FALSE, FALSE);
+ if(H5VL_def_conn_s.connector_id > 0) {
+ /* Release the default VOL connector */
+ (void)H5VL_conn_free(&H5VL_def_conn_s);
+ H5VL_def_conn_s.connector_id = -1;
+ H5VL_def_conn_s.connector_info = NULL;
n++;
} /* end if */
else {
- /* Destroy the VOL connector ID group */
- n += (H5I_dec_type_ref(H5I_VOL) > 0);
-
- /* Mark interface as closed */
- if (0 == n)
- H5_PKG_INIT_VAR = FALSE;
+ if(H5I_nmembers(H5I_VOL) > 0) {
+ /* Unregister all VOL connectors */
+ (void)H5I_clear_type(H5I_VOL, FALSE, FALSE);
+ n++;
+ } /* end if */
+ else {
+ /* Destroy the VOL connector ID group */
+ n += (H5I_dec_type_ref(H5I_VOL) > 0);
+
+ /* Mark interface as closed */
+ if(0 == n)
+ H5_PKG_INIT_VAR = FALSE;
+ } /* end else */
} /* end else */
} /* end if */
@@ -234,6 +308,182 @@ done:
/*-------------------------------------------------------------------------
+ * Function: H5VL__get_connector_cb
+ *
+ * Purpose: Callback routine to search through registered VOLs
+ *
+ * Return: Success: H5_ITER_STOP if the class and op_data name
+ * members match. H5_ITER_CONT otherwise.
+ * Failure: Can't fail
+ *
+ * Programmer: Dana Robinson
+ * June 22, 2017
+ *
+ *-------------------------------------------------------------------------
+ */
+static int
+H5VL__get_connector_cb(void *obj, hid_t id, void *_op_data)
+{
+ H5VL_get_connector_ud_t *op_data = (H5VL_get_connector_ud_t *)_op_data; /* User data for callback */
+ H5VL_class_t *cls = (H5VL_class_t *)obj;
+ int ret_value = H5_ITER_CONT; /* Callback return value */
+
+ FUNC_ENTER_STATIC_NOERR
+
+ if(H5VL_GET_CONNECTOR_BY_NAME == op_data->kind) {
+ if(0 == HDstrcmp(cls->name, op_data->u.name)) {
+ op_data->found_id = id;
+ ret_value = H5_ITER_STOP;
+ } /* end if */
+ } /* end if */
+ else {
+ HDassert(H5VL_GET_CONNECTOR_BY_VALUE == op_data->kind);
+ if(cls->value == op_data->u.value) {
+ op_data->found_id = id;
+ ret_value = H5_ITER_STOP;
+ } /* end if */
+ } /* end else */
+
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5VL__get_connector_cb() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VL__set_def_conn
+ *
+ * Purpose: Parses a string that contains the default VOL connector for
+ * the library.
+ *
+ * Note: Usually from the environment variable "HDF5_VOL_CONNECTOR",
+ * but could be from elsewhere.
+ *
+ * Return: Success: 0
+ * Failure: -1
+ *
+ * Programmer: Jordan Henderson
+ * November 2018
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5VL__set_def_conn(void)
+{
+ H5P_genplist_t *def_fapl; /* Default file access property list */
+ H5P_genclass_t *def_fapclass; /* Default file access property class */
+ const char *env_var; /* Environment variable for default VOL connector */
+ char *buf = NULL; /* Buffer for tokenizing string */
+ hid_t connector_id = -1; /* VOL conntector ID */
+ void *vol_info = NULL; /* VOL connector info */
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_STATIC
+
+ /* Sanity check */
+ HDassert(H5VL_def_conn_s.connector_id == (-1));
+ HDassert(H5VL_def_conn_s.connector_info == NULL);
+
+ /* Check for environment variable set */
+ env_var = HDgetenv("HDF5_VOL_CONNECTOR");
+
+ /* Only parse the string if it's set */
+ if(env_var && *env_var) {
+ char *lasts = NULL; /* Context pointer for strtok_r() call */
+ const char *tok = NULL; /* Token from strtok_r call */
+ htri_t connector_is_registered; /* Whether connector is already registered */
+
+ /* Duplicate the string to parse, as it is modified as we go */
+ if(NULL == (buf = H5MM_strdup(env_var)))
+ HGOTO_ERROR(H5E_VOL, H5E_CANTALLOC, FAIL, "can't allocate memory for environment variable string")
+
+ /* Get the first 'word' of the environment variable.
+ * If it's nothing (environment variable was whitespace) return error.
+ */
+ if(NULL == (tok = HDstrtok_r(buf, " \t\n\r", &lasts)))
+ HGOTO_ERROR(H5E_VOL, H5E_BADVALUE, FAIL, "VOL connector environment variable set empty?")
+
+ /* First, check to see if the connector is already registered */
+ if((connector_is_registered = H5VL__is_connector_registered(tok)) < 0)
+ HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "can't check if VOL connector already registered")
+ else if(connector_is_registered) {
+ /* Retrieve the ID of the already-registered VOL connector */
+ if((connector_id = H5VL__get_connector_id(tok, FALSE)) < 0)
+ HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "can't get VOL connector ID")
+ } /* end else-if */
+ else {
+ /* Check for VOL connectors that ship with the library */
+ if(!HDstrcmp(tok, "native")) {
+ connector_id = H5VL_NATIVE;
+ if(H5I_inc_ref(connector_id, FALSE) < 0)
+ HGOTO_ERROR(H5E_VOL, H5E_CANTINC, FAIL, "can't increment VOL connector refcount")
+ } /* end if */
+ else if(!HDstrcmp(tok, "pass_through")) {
+ connector_id = H5VL_PASSTHRU;
+ if(H5I_inc_ref(connector_id, FALSE) < 0)
+ HGOTO_ERROR(H5E_VOL, H5E_CANTINC, FAIL, "can't increment VOL connector refcount")
+ } /* end else-if */
+ else {
+ /* Register the VOL connector */
+ /* (NOTE: No provisions for vipl_id currently) */
+ if((connector_id = H5VL__register_connector_by_name(tok, FALSE, H5P_DEFAULT)) < 0)
+ HGOTO_ERROR(H5E_VOL, H5E_CANTREGISTER, FAIL, "can't register connector")
+ } /* end else */
+ } /* end else */
+
+ /* Was there any connector info specified in the environment variable? */
+ if(NULL != (tok = HDstrtok_r(NULL, " \t\n\r", &lasts)))
+ if(H5VL__connector_str_to_info(tok, connector_id, &vol_info) < 0)
+ HGOTO_ERROR(H5E_VOL, H5E_CANTDECODE, FAIL, "can't deserialize connector info")
+
+ /* Set the default VOL connector */
+ H5VL_def_conn_s.connector_id = connector_id;
+ H5VL_def_conn_s.connector_info = vol_info;
+ } /* end if */
+ else {
+ /* Set the default VOL connector */
+ H5VL_def_conn_s.connector_id = H5_DEFAULT_VOL;
+ H5VL_def_conn_s.connector_info = NULL;
+
+ /* Increment the ref count on the default connector */
+ if(H5I_inc_ref(H5VL_def_conn_s.connector_id, FALSE) < 0)
+ HGOTO_ERROR(H5E_VOL, H5E_CANTINC, FAIL, "can't increment VOL connector refcount")
+ } /* end else */
+
+ /* Get default file access pclass */
+ if(NULL == (def_fapclass = (H5P_genclass_t *)H5I_object(H5P_FILE_ACCESS)))
+ HGOTO_ERROR(H5E_VOL, H5E_BADATOM, FAIL, "can't find object for default file access property class ID")
+
+ /* Change the default VOL for the default file access pclass */
+ if(H5P_reset_vol_class(def_fapclass, &H5VL_def_conn_s) < 0)
+ HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "can't set default VOL connector for default file access property class")
+
+ /* Get default file access plist */
+ if(NULL == (def_fapl = (H5P_genplist_t *)H5I_object(H5P_FILE_ACCESS_DEFAULT)))
+ HGOTO_ERROR(H5E_VOL, H5E_BADATOM, FAIL, "can't find object for default fapl ID")
+
+ /* Change the default VOL for the default FAPL */
+ if(H5P_set_vol(def_fapl, H5VL_def_conn_s.connector_id, H5VL_def_conn_s.connector_info) < 0)
+ HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "can't set default VOL connector for default FAPL")
+
+done:
+ /* Clean up on error */
+ if(ret_value < 0) {
+ if(vol_info)
+ if(H5VL_free_connector_info(connector_id, vol_info) < 0)
+ HDONE_ERROR(H5E_VOL, H5E_CANTRELEASE, FAIL, "can't free VOL connector info")
+ if(connector_id >= 0)
+ /* The H5VL_class_t struct will be freed by this function */
+ if(H5I_dec_ref(connector_id) < 0)
+ HDONE_ERROR(H5E_VOL, H5E_CANTDEC, FAIL, "unable to unregister VOL connector")
+ } /* end if */
+
+ /* Clean up */
+ H5MM_xfree(buf);
+
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5VL__set_def_conn() */
+
+
+/*-------------------------------------------------------------------------
* Function: H5VL__wrap_obj
*
* Purpose: Wraps a library object with possible VOL connector wrappers, to
@@ -317,7 +567,7 @@ H5VL__new_vol_obj(H5I_type_t type, void *object, H5VL_t *vol_connector, hbool_t
new_vol_obj->data = object;
/* Bump the reference count on the VOL connector */
- vol_connector->nrefs++;
+ H5VL__conn_inc_rc(vol_connector);
/* If this is a datatype, we have to hide the VOL object under the H5T_t pointer */
if(H5I_DATATYPE == type) {
@@ -393,29 +643,22 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5VL_conn_free(const H5VL_connector_prop_t *info)
+H5VL_conn_free(const H5VL_connector_prop_t *connector_prop)
{
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(FAIL)
- if(info) {
+ if(connector_prop) {
/* Free the connector info (if it exists) and decrement the ID */
- if(info->connector_id > 0) {
- if(info->connector_info) {
- H5VL_class_t *connector; /* Pointer to connector */
-
- /* Retrieve the connector for the ID */
- if(NULL == (connector = (H5VL_class_t *)H5I_object(info->connector_id)))
- HGOTO_ERROR(H5E_VOL, H5E_BADTYPE, FAIL, "not a VOL connector ID")
-
+ if(connector_prop->connector_id > 0) {
+ if(connector_prop->connector_info)
/* Free the connector info */
- if(H5VL_free_connector_info(connector, (void *)info->connector_info) < 0) /* Casting away const OK - QAK */
+ if(H5VL_free_connector_info(connector_prop->connector_id, (void *)connector_prop->connector_info) < 0) /* Casting away const OK - QAK */
HGOTO_ERROR(H5E_VOL, H5E_CANTRELEASE, FAIL, "unable to release VOL connector info object")
- } /* end if */
/* Decrement reference count for connector ID */
- if(H5I_dec_ref(info->connector_id) < 0)
+ if(H5I_dec_ref(connector_prop->connector_id) < 0)
HGOTO_ERROR(H5E_VOL, H5E_CANTDEC, FAIL, "can't decrement reference count for connector ID")
} /* end if */
} /* end if */
@@ -550,6 +793,76 @@ done:
/*-------------------------------------------------------------------------
+ * Function: H5VL__conn_inc_rc
+ *
+ * Purpose: Wrapper to increment the ref. count on a connector.
+ *
+ * Return: Current ref. count (can't fail)
+ *
+ * Programmer: Quincey Koziol
+ * February 23, 2019
+ *
+ *-------------------------------------------------------------------------
+ */
+static int64_t
+H5VL__conn_inc_rc(H5VL_t *connector)
+{
+ FUNC_ENTER_STATIC_NOERR
+
+ /* Check arguments */
+ HDassert(connector);
+
+ /* Increment refcount for connector */
+ connector->nrefs++;
+
+ FUNC_LEAVE_NOAPI(connector->nrefs)
+} /* end H5VL__conn_inc_rc() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VL__conn_dec_rc
+ *
+ * Purpose: Wrapper to decrement the ref. count on a connector.
+ *
+ * Return: Current ref. count (>=0) on success, <0 on failure
+ *
+ * Programmer: Quincey Koziol
+ * February 23, 2019
+ *
+ *-------------------------------------------------------------------------
+ */
+static int64_t
+H5VL__conn_dec_rc(H5VL_t *connector)
+{
+ int64_t ret_value = -1; /* Return value */
+
+ FUNC_ENTER_STATIC
+
+ /* Check arguments */
+ HDassert(connector);
+
+ /* Decrement refcount for connector */
+ connector->nrefs--;
+
+ /* Check for last reference */
+ if(0 == connector->nrefs) {
+ if(H5I_dec_ref(connector->id) < 0)
+ HGOTO_ERROR(H5E_VOL, H5E_CANTDEC, FAIL, "unable to decrement ref count on VOL connector")
+ H5FL_FREE(H5VL_t, connector);
+
+ /* Set return value */
+ ret_value = 0;
+ } /* end if */
+ else
+ /* Set return value */
+ ret_value = connector->nrefs;
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5VL__conn_dec_rc() */
+
+
+/*-------------------------------------------------------------------------
* Function: H5VL_free_object
*
* Purpose: Wrapper to unregister an object ID with a VOL aux struct
@@ -562,20 +875,16 @@ done:
herr_t
H5VL_free_object(H5VL_object_t *vol_obj)
{
- herr_t ret_value = SUCCEED;
+ herr_t ret_value = SUCCEED; /* Return value */
- FUNC_ENTER_NOAPI(SUCCEED)
+ FUNC_ENTER_NOAPI(FAIL)
/* Check arguments */
HDassert(vol_obj);
- vol_obj->connector->nrefs --;
-
- if(0 == vol_obj->connector->nrefs) {
- if(H5I_dec_ref(vol_obj->connector->id) < 0)
- HGOTO_ERROR(H5E_VOL, H5E_CANTDEC, FAIL, "unable to decrement ref count on VOL connector")
- vol_obj->connector = H5FL_FREE(H5VL_t, vol_obj->connector);
- } /* end if */
+ /* Decrement refcount on connector */
+ if(H5VL__conn_dec_rc(vol_obj->connector) < 0)
+ HGOTO_ERROR(H5E_VOL, H5E_CANTDEC, FAIL, "unable to decrement ref count on VOL connector")
vol_obj = H5FL_FREE(H5VL_object_t, vol_obj);
@@ -595,6 +904,9 @@ done:
*
* Failure: H5I_INVALID_HID
*
+ * Programmer: Dana Robinson
+ * June 22, 2017
+ *
*-------------------------------------------------------------------------
*/
hid_t
@@ -610,9 +922,9 @@ H5VL_register_connector(const void *_cls, hbool_t app_ref, hid_t vipl_id)
HDassert(cls);
/* Copy the class structure so the caller can reuse or free it */
- if (NULL == (saved = H5FL_CALLOC(H5VL_class_t)))
+ if(NULL == (saved = H5FL_MALLOC(H5VL_class_t)))
HGOTO_ERROR(H5E_VOL, H5E_CANTALLOC, H5I_INVALID_HID, "memory allocation failed for VOL connector class struct")
- HDmemcpy(saved, cls, sizeof(H5VL_class_t));
+ H5MM_memcpy(saved, cls, sizeof(H5VL_class_t));
if(NULL == (saved->name = H5MM_strdup(cls->name)))
HGOTO_ERROR(H5E_VOL, H5E_CANTALLOC, H5I_INVALID_HID, "memory allocation failed for VOL connector name")
@@ -621,23 +933,319 @@ H5VL_register_connector(const void *_cls, hbool_t app_ref, hid_t vipl_id)
HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, H5I_INVALID_HID, "unable to init VOL connector")
/* Create the new class ID */
- if ((ret_value = H5I_register(H5I_VOL, saved, app_ref)) < 0)
+ if((ret_value = H5I_register(H5I_VOL, saved, app_ref)) < 0)
HGOTO_ERROR(H5E_VOL, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register VOL connector ID")
done:
- if (ret_value < 0 && saved) {
- if (saved->name)
+ if(ret_value < 0 && saved) {
+ if(saved->name)
H5MM_xfree((void *)(saved->name)); /* Casting away const OK -QAK */
H5FL_FREE(H5VL_class_t, saved);
- }
+ } /* end if */
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5VL_register_connector() */
/*-------------------------------------------------------------------------
- * Function: H5VL_get_connector_name
+ * Function: H5VL__register_connector
+ *
+ * Purpose: Registers a new VOL connector as a member of the virtual object
+ * layer class.
+ *
+ * Return: Success: A VOL connector ID which is good until the
+ * library is closed or the connector is
+ * unregistered.
+ *
+ * Failure: H5I_INVALID_HID
+ *
+ * Programmer: Dana Robinson
+ * June 22, 2017
+ *
+ *-------------------------------------------------------------------------
+ */
+hid_t
+H5VL__register_connector(const H5VL_class_t *cls, hbool_t app_ref, hid_t vipl_id)
+{
+ H5VL_get_connector_ud_t op_data; /* Callback info for connector search */
+ hid_t ret_value = H5I_INVALID_HID; /* Return value */
+
+ FUNC_ENTER_PACKAGE
+
+ /* Set up op data for iteration */
+ op_data.kind = H5VL_GET_CONNECTOR_BY_NAME;
+ op_data.u.name = cls->name;
+ op_data.found_id = H5I_INVALID_HID;
+
+ /* Check if connector is already registered */
+ if(H5I_iterate(H5I_VOL, H5VL__get_connector_cb, &op_data, TRUE) < 0)
+ HGOTO_ERROR(H5E_VOL, H5E_BADITER, H5I_INVALID_HID, "can't iterate over VOL IDs")
+
+ /* Increment the ref count on the existing VOL connector ID, if it's already registered */
+ if(op_data.found_id != H5I_INVALID_HID) {
+ if(H5I_inc_ref(op_data.found_id, app_ref) < 0)
+ HGOTO_ERROR(H5E_VOL, H5E_CANTINC, H5I_INVALID_HID, "unable to increment ref count on VOL connector")
+ ret_value = op_data.found_id;
+ } /* end if */
+ else {
+ /* Create a new class ID */
+ if((ret_value = H5VL_register_connector(cls, app_ref, vipl_id)) < 0)
+ HGOTO_ERROR(H5E_VOL, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register VOL connector")
+ } /* end else */
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5VL__register_connector() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VL__register_connector_by_name
+ *
+ * Purpose: Registers a new VOL connector as a member of the virtual object
+ * layer class.
+ *
+ * Return: Success: A VOL connector ID which is good until the
+ * library is closed or the connector is
+ * unregistered.
+ *
+ * Failure: H5I_INVALID_HID
+ *
+ * Programmer: Dana Robinson
+ * June 22, 2017
+ *
+ *-------------------------------------------------------------------------
+ */
+hid_t
+H5VL__register_connector_by_name(const char *name, hbool_t app_ref, hid_t vipl_id)
+{
+ H5VL_get_connector_ud_t op_data; /* Callback info for connector search */
+ hid_t ret_value = H5I_INVALID_HID; /* Return value */
+
+ FUNC_ENTER_PACKAGE
+
+ /* Set up op data for iteration */
+ op_data.kind = H5VL_GET_CONNECTOR_BY_NAME;
+ op_data.u.name = name;
+ op_data.found_id = H5I_INVALID_HID;
+
+ /* Check if connector is already registered */
+ if(H5I_iterate(H5I_VOL, H5VL__get_connector_cb, &op_data, TRUE) < 0)
+ HGOTO_ERROR(H5E_VOL, H5E_BADITER, H5I_INVALID_HID, "can't iterate over VOL ids")
+
+ /* If connector alread registered, increment ref count on ID and return ID */
+ if(op_data.found_id != H5I_INVALID_HID) {
+ if(H5I_inc_ref(op_data.found_id, app_ref) < 0)
+ HGOTO_ERROR(H5E_VOL, H5E_CANTINC, H5I_INVALID_HID, "unable to increment ref count on VOL connector")
+ ret_value = op_data.found_id;
+ } /* end if */
+ else {
+ H5PL_key_t key;
+ const H5VL_class_t *cls;
+
+ /* Try loading the connector */
+ key.vol.kind = H5VL_GET_CONNECTOR_BY_NAME;
+ key.vol.u.name = name;
+ if(NULL == (cls = (const H5VL_class_t *)H5PL_load(H5PL_TYPE_VOL, &key)))
+ HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, H5I_INVALID_HID, "unable to load VOL connector")
+
+ /* Register the connector we loaded */
+ if((ret_value = H5VL_register_connector(cls, app_ref, vipl_id)) < 0)
+ HGOTO_ERROR(H5E_VOL, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register VOL connector ID")
+ } /* end else */
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5VL__register_connector_by_name() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VL__register_connector_by_value
+ *
+ * Purpose: Registers a new VOL connector as a member of the virtual object
+ * layer class.
+ *
+ * Return: Success: A VOL connector ID which is good until the
+ * library is closed or the connector is
+ * unregistered.
+ *
+ * Failure: H5I_INVALID_HID
+ *
+ * Programmer: Dana Robinson
+ * June 22, 2017
+ *
+ *-------------------------------------------------------------------------
+ */
+hid_t
+H5VL__register_connector_by_value(H5VL_class_value_t value, hbool_t app_ref, hid_t vipl_id)
+{
+ H5VL_get_connector_ud_t op_data; /* Callback info for connector search */
+ hid_t ret_value = H5I_INVALID_HID; /* Return value */
+
+ FUNC_ENTER_PACKAGE
+
+ /* Set up op data for iteration */
+ op_data.kind = H5VL_GET_CONNECTOR_BY_VALUE;
+ op_data.u.value = value;
+ op_data.found_id = H5I_INVALID_HID;
+
+ /* Check if connector is already registered */
+ if(H5I_iterate(H5I_VOL, H5VL__get_connector_cb, &op_data, TRUE) < 0)
+ HGOTO_ERROR(H5E_VOL, H5E_BADITER, H5I_INVALID_HID, "can't iterate over VOL ids")
+
+ /* If connector alread registered, increment ref count on ID and return ID */
+ if(op_data.found_id != H5I_INVALID_HID) {
+ if(H5I_inc_ref(op_data.found_id, app_ref) < 0)
+ HGOTO_ERROR(H5E_VOL, H5E_CANTINC, H5I_INVALID_HID, "unable to increment ref count on VOL connector")
+ ret_value = op_data.found_id;
+ } /* end if */
+ else {
+ H5PL_key_t key;
+ const H5VL_class_t *cls;
+
+ /* Try loading the connector */
+ key.vol.kind = H5VL_GET_CONNECTOR_BY_VALUE;
+ key.vol.u.value = value;
+ if(NULL == (cls = (const H5VL_class_t *)H5PL_load(H5PL_TYPE_VOL, &key)))
+ HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, H5I_INVALID_HID, "unable to load VOL connector")
+
+ /* Register the connector we loaded */
+ if((ret_value = H5VL_register_connector(cls, app_ref, vipl_id)) < 0)
+ HGOTO_ERROR(H5E_VOL, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register VOL connector ID")
+ } /* end else */
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5VL__register_connector_by_value() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VL__is_connector_registered
+ *
+ * Purpose: Checks if a connector with a particular name is registered.
+ *
+ * Return: Success: 0
+ * Failure: -1
+ *
+ * Programmer: Dana Robinson
+ * June 17, 2017
+ *
+ *-------------------------------------------------------------------------
+ */
+htri_t
+H5VL__is_connector_registered(const char *name)
+{
+ H5VL_get_connector_ud_t op_data; /* Callback info for connector search */
+ htri_t ret_value = FALSE; /* Return value */
+
+ FUNC_ENTER_PACKAGE
+
+ /* Set up op data for iteration */
+ op_data.kind = H5VL_GET_CONNECTOR_BY_NAME;
+ op_data.u.name = name;
+ op_data.found_id = H5I_INVALID_HID;
+
+ /* Find connector with name */
+ if(H5I_iterate(H5I_VOL, H5VL__get_connector_cb, &op_data, TRUE) < 0)
+ HGOTO_ERROR(H5E_VOL, H5E_BADITER, FAIL, "can't iterate over VOL connectors")
+
+ /* Found a connector with that name */
+ if(op_data.found_id != H5I_INVALID_HID)
+ ret_value = TRUE;
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5VL__is_connector_registered() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VL__get_connector_id
+ *
+ * Purpose: Retrieves the ID for a registered VOL connector.
+ *
+ * Return: Positive if the VOL class has been registered
+ * Negative on error (if the class is not a valid class or not registered)
+ *
+ * Programmer: Dana Robinson
+ * June 17, 2017
+ *
+ *-------------------------------------------------------------------------
+ */
+hid_t
+H5VL__get_connector_id(const char *name, hbool_t is_api)
+{
+ H5VL_get_connector_ud_t op_data; /* Callback info for connector search */
+ hid_t ret_value = H5I_INVALID_HID; /* Return value */
+
+ FUNC_ENTER_PACKAGE
+
+ /* Set up op data for iteration */
+ op_data.kind = H5VL_GET_CONNECTOR_BY_NAME;
+ op_data.u.name = name;
+ op_data.found_id = H5I_INVALID_HID;
+
+ /* Find connector with name */
+ if(H5I_iterate(H5I_VOL, H5VL__get_connector_cb, &op_data, TRUE) < 0)
+ HGOTO_ERROR(H5E_VOL, H5E_BADITER, H5I_INVALID_HID, "can't iterate over VOL connectors")
+
+ /* Found a connector with that name */
+ if(op_data.found_id != H5I_INVALID_HID) {
+ if(H5I_inc_ref(op_data.found_id, is_api) < 0)
+ HGOTO_ERROR(H5E_FILE, H5E_CANTINC, H5I_INVALID_HID, "unable to increment ref count on VOL connector")
+ ret_value = op_data.found_id;
+ } /* end if */
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5VL__get_connector_id() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VL__connector_str_to_info
+ *
+ * Purpose: Deserializes a string into a connector's info object
+ *
+ * Return: Success: Non-negative
+ * Failure: Negative
+ *
+ * Programmer: Quincey Koziol
+ * March 2, 2019
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5VL__connector_str_to_info(const char *str, hid_t connector_id, void **info)
+{
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_PACKAGE
+
+ /* Only deserialize string, if it's non-NULL */
+ if(str) {
+ H5VL_class_t *cls; /* VOL connector's class struct */
+
+ /* Check args and get class pointer */
+ if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(connector_id, H5I_VOL)))
+ HGOTO_ERROR(H5E_VOL, H5E_BADTYPE, FAIL, "not a VOL connector ID")
+
+ /* Allow the connector to deserialize info */
+ if(cls->info_cls.from_str) {
+ if((cls->info_cls.from_str)(str, info) < 0)
+ HGOTO_ERROR(H5E_VOL, H5E_CANTUNSERIALIZE, FAIL, "can't deserialize connector info")
+ } /* end if */
+ else
+ *info = NULL;
+ } /* end if */
+ else
+ *info = NULL;
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5VL__connector_str_to_info() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VL__get_connector_name
*
* Purpose: Private version of H5VLget_connector_name
*
@@ -647,14 +1255,14 @@ done:
*-------------------------------------------------------------------------
*/
ssize_t
-H5VL_get_connector_name(hid_t id, char *name /*out*/, size_t size)
+H5VL__get_connector_name(hid_t id, char *name /*out*/, size_t size)
{
H5VL_object_t *vol_obj;
const H5VL_class_t *cls;
size_t len;
ssize_t ret_value = -1;
- FUNC_ENTER_NOAPI(FAIL)
+ FUNC_ENTER_PACKAGE
/* get the object pointer */
if (NULL == (vol_obj = H5VL_vol_object(id)))
@@ -674,7 +1282,7 @@ H5VL_get_connector_name(hid_t id, char *name /*out*/, size_t size)
done:
FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5VL_get_connector_name() */
+} /* end H5VL__get_connector_name() */
/*-------------------------------------------------------------------------
@@ -740,8 +1348,8 @@ H5VL_object_data(const H5VL_object_t *vol_obj)
FUNC_ENTER_NOAPI_NOINIT_NOERR
/* Check for 'get_object' callback in connector */
- if(vol_obj->connector->cls->get_object)
- ret_value = (vol_obj->connector->cls->get_object)(vol_obj->data);
+ if(vol_obj->connector->cls->wrap_cls.get_object)
+ ret_value = (vol_obj->connector->cls->wrap_cls.get_object)(vol_obj->data);
else
ret_value = vol_obj->data;
@@ -750,6 +1358,32 @@ H5VL_object_data(const H5VL_object_t *vol_obj)
/*-------------------------------------------------------------------------
+ * Function: H5VL_object_unwrap
+ *
+ * Purpose: Correctly unwrap the 'data' field for a VOL object (H5VL_object),
+ * even for nested / stacked VOL connectors.
+ *
+ * Return: Success: Object pointer
+ * Failure: NULL
+ *
+ *-------------------------------------------------------------------------
+ */
+void *
+H5VL_object_unwrap(const H5VL_object_t *vol_obj)
+{
+ void *ret_value = NULL;
+
+ FUNC_ENTER_NOAPI(NULL)
+
+ if(NULL == (ret_value = H5VL_unwrap_object(vol_obj->connector->cls, vol_obj->data)))
+ HGOTO_ERROR(H5E_VOL, H5E_CANTGET, NULL, "can't unwrap object")
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5VL_object_unwrap() */
+
+
+/*-------------------------------------------------------------------------
* Function: H5VL__object
*
* Purpose: Internal function to return the VOL object pointer associated
@@ -803,6 +1437,7 @@ H5VL__object(hid_t id, H5I_type_t obj_type)
case H5I_ERROR_CLASS:
case H5I_ERROR_MSG:
case H5I_ERROR_STACK:
+ case H5I_SPACE_SEL_ITER:
case H5I_NTYPES:
default:
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "unknown data object type")
@@ -836,7 +1471,7 @@ H5VL_object(hid_t id)
/* Get the underlying object */
if(NULL == (ret_value = H5VL__object(id, H5I_get_type(id))))
- HGOTO_ERROR(H5E_ARGS, H5E_CANTGET, NULL, "can't retrieve object for ID")
+ HGOTO_ERROR(H5E_VOL, H5E_CANTGET, NULL, "can't retrieve object for ID")
done:
FUNC_LEAVE_NOAPI(ret_value)
@@ -933,15 +1568,15 @@ H5VL_cmp_connector_cls(int *cmp_value, const H5VL_class_t *cls1, const H5VL_clas
HDassert(cls1->version == cls2->version);
/* Compare connector info */
- if(cls1->info_size < cls2->info_size) {
+ if(cls1->info_cls.size < cls2->info_cls.size) {
*cmp_value = -1;
HGOTO_DONE(SUCCEED)
} /* end if */
- if(cls1->info_size > cls2->info_size) {
+ if(cls1->info_cls.size > cls2->info_cls.size) {
*cmp_value = 1;
HGOTO_DONE(SUCCEED)
} /* end if */
- HDassert(cls1->info_size == cls2->info_size);
+ HDassert(cls1->info_cls.size == cls2->info_cls.size);
/* Set comparison value to 'equal' */
*cmp_value = 0;
@@ -952,6 +1587,189 @@ done:
/*-------------------------------------------------------------------------
+ * Function: H5VL_retrieve_lib_state
+ *
+ * Purpose: Retrieve the state of the library.
+ *
+ * Note: Currently just retrieves the API context state, but could be
+ * expanded in the future.
+ *
+ * Return: Success: Non-negative, *state set
+ * Failure: Negative, *state unset
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5VL_retrieve_lib_state(void **state)
+{
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_NOAPI(FAIL)
+
+ /* Sanity checks */
+ HDassert(state);
+
+ /* Retrieve the API context state */
+ if(H5CX_retrieve_state((H5CX_state_t **)state) < 0)
+ HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "can't get API context state")
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5VL_retrieve_lib_state() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VL_restore_lib_state
+ *
+ * Purpose: Restore the state of the library.
+ *
+ * Note: Currently just restores the API context state, but could be
+ * expanded in the future.
+ *
+ * Return: SUCCEED / FAIL
+ *
+ * Programmer: Quincey Koziol
+ * Thursday, January 10, 2019
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5VL_restore_lib_state(const void *state)
+{
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_NOAPI(FAIL)
+
+ /* Sanity checks */
+ HDassert(state);
+
+ /* Push a new API context on the stack */
+ if(H5CX_push() < 0)
+ HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "can't push API context")
+
+ /* Restore the API context state */
+ if(H5CX_restore_state((const H5CX_state_t *)state) < 0)
+ HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "can't set API context state")
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5VL_restore_lib_state() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VL_reset_lib_state
+ *
+ * Purpose: Reset the state of the library, undoing affects of
+ * H5VL_restore_lib_state.
+ *
+ * Note: Currently just resets the API context state, but could be
+ * expanded in the future.
+ *
+ * Note: This routine must be called as a "pair" with
+ * H5VL_restore_lib_state. It can be called before / after /
+ * independently of H5VL_free_lib_state.
+ *
+ * Return: SUCCEED / FAIL
+ *
+ * Programmer: Quincey Koziol
+ * Saturday, February 23, 2019
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5VL_reset_lib_state(void)
+{
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_NOAPI(FAIL)
+
+ /* Pop the API context off the stack */
+ if(H5CX_pop() < 0)
+ HGOTO_ERROR(H5E_VOL, H5E_CANTRESET, FAIL, "can't pop API context")
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5VL_reset_lib_state() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VL_free_lib_state
+ *
+ * Purpose: Free a library state.
+ *
+ * Note: This routine must be called as a "pair" with
+ * H5VL_retrieve_lib_state.
+ *
+ * Return: SUCCEED / FAIL
+ *
+ * Programmer: Quincey Koziol
+ * Thursday, January 10, 2019
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5VL_free_lib_state(void *state)
+{
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_NOAPI(FAIL)
+
+ /* Sanity checks */
+ HDassert(state);
+
+ /* Free the API context state */
+ if(H5CX_free_state((H5CX_state_t *)state) < 0)
+ HGOTO_ERROR(H5E_VOL, H5E_CANTRELEASE, FAIL, "can't free API context state")
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5VL_free_lib_state() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VL__free_vol_wrapper
+ *
+ * Purpose: Free object wrapping context for VOL connector
+ *
+ * Return: SUCCEED / FAIL
+ *
+ * Programmer: Quincey Koziol
+ * Wednesday, January 9, 2019
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5VL__free_vol_wrapper(H5VL_wrap_ctx_t *vol_wrap_ctx)
+{
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_STATIC
+
+ /* Sanity check */
+ HDassert(vol_wrap_ctx);
+ HDassert(0 == vol_wrap_ctx->rc);
+ HDassert(vol_wrap_ctx->connector);
+ HDassert(vol_wrap_ctx->connector->cls);
+
+ /* If there is a VOL connector object wrapping context, release it */
+ if(vol_wrap_ctx->obj_wrap_ctx)
+ /* Release the VOL connector's object wrapping context */
+ if((*vol_wrap_ctx->connector->cls->wrap_cls.free_wrap_ctx)(vol_wrap_ctx->obj_wrap_ctx) < 0)
+ HGOTO_ERROR(H5E_VOL, H5E_CANTRELEASE, FAIL, "unable to release connector's object wrapping context")
+
+ /* Decrement refcount on connector */
+ if(H5VL__conn_dec_rc(vol_wrap_ctx->connector) < 0)
+ HGOTO_ERROR(H5E_VOL, H5E_CANTDEC, FAIL, "unable to decrement ref count on VOL connector")
+
+ /* Release object wrapping context */
+ H5FL_FREE(H5VL_wrap_ctx_t, vol_wrap_ctx);
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5VL__free_vol_wrapper() */
+
+
+/*-------------------------------------------------------------------------
* Function: H5VL_set_vol_wrapper
*
* Purpose: Set up object wrapping context for current VOL connector
@@ -961,7 +1779,7 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5VL_set_vol_wrapper(void *obj, const H5VL_t *connector)
+H5VL_set_vol_wrapper(void *obj, H5VL_t *connector)
{
H5VL_wrap_ctx_t *vol_wrap_ctx = NULL; /* Object wrapping context */
void *obj_wrap_ctx = NULL; /* VOL connector's wrapping context */
@@ -980,12 +1798,12 @@ H5VL_set_vol_wrapper(void *obj, const H5VL_t *connector)
/* Check for existing wrapping context */
if(NULL == vol_wrap_ctx) {
/* Check if the connector can create a wrap context */
- if(connector->cls->get_wrap_ctx) {
+ if(connector->cls->wrap_cls.get_wrap_ctx) {
/* Sanity check */
- HDassert(connector->cls->free_wrap_ctx);
+ HDassert(connector->cls->wrap_cls.free_wrap_ctx);
/* Get the wrap context from the connector */
- if((connector->cls->get_wrap_ctx)(obj, &obj_wrap_ctx) < 0)
+ if((connector->cls->wrap_cls.get_wrap_ctx)(obj, &obj_wrap_ctx) < 0)
HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "can't retrieve VOL connector's object wrap context")
} /* end if */
@@ -993,8 +1811,11 @@ H5VL_set_vol_wrapper(void *obj, const H5VL_t *connector)
if(NULL == (vol_wrap_ctx = H5FL_MALLOC(H5VL_wrap_ctx_t)))
HGOTO_ERROR(H5E_VOL, H5E_CANTALLOC, FAIL, "can't allocate VOL wrap context")
+ /* Increment the outstanding objects that are using the connector */
+ H5VL__conn_inc_rc(connector);
+
/* Set up VOL object wrapper context */
- vol_wrap_ctx->rc = 1;;
+ vol_wrap_ctx->rc = 1;
vol_wrap_ctx->connector = connector;
vol_wrap_ctx->obj_wrap_ctx = obj_wrap_ctx;
} /* end if */
@@ -1016,6 +1837,80 @@ done:
/*-------------------------------------------------------------------------
+ * Function: H5VL_inc_vol_wrapper
+ *
+ * Purpose: Increment refcount on object wrapping context
+ *
+ * Return: SUCCEED / FAIL
+ *
+ * Programmer: Quincey Koziol
+ * Wednesday, January 9, 2019
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5VL_inc_vol_wrapper(void *_vol_wrap_ctx)
+{
+ H5VL_wrap_ctx_t *vol_wrap_ctx = (H5VL_wrap_ctx_t *)_vol_wrap_ctx; /* VOL object wrapping context */
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_NOAPI(FAIL)
+
+ /* Check for valid, active VOL object wrap context */
+ if(NULL == vol_wrap_ctx)
+ HGOTO_ERROR(H5E_VOL, H5E_BADVALUE, FAIL, "no VOL object wrap context?")
+ if(0 == vol_wrap_ctx->rc)
+ HGOTO_ERROR(H5E_VOL, H5E_BADVALUE, FAIL, "bad VOL object wrap context refcount?")
+
+ /* Increment ref count on wrapping context */
+ vol_wrap_ctx->rc++;
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5VL_inc_vol_wrapper() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VL_dec_vol_wrapper
+ *
+ * Purpose: Decrement refcount on object wrapping context, releasing it
+ * if the refcount drops to zero.
+ *
+ * Return: SUCCEED / FAIL
+ *
+ * Programmer: Quincey Koziol
+ * Wednesday, January 9, 2019
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5VL_dec_vol_wrapper(void *_vol_wrap_ctx)
+{
+ H5VL_wrap_ctx_t *vol_wrap_ctx = (H5VL_wrap_ctx_t *)_vol_wrap_ctx; /* VOL object wrapping context */
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_NOAPI(FAIL)
+
+ /* Check for valid, active VOL object wrap context */
+ if(NULL == vol_wrap_ctx)
+ HGOTO_ERROR(H5E_VOL, H5E_BADVALUE, FAIL, "no VOL object wrap context?")
+ if(0 == vol_wrap_ctx->rc)
+ HGOTO_ERROR(H5E_VOL, H5E_BADVALUE, FAIL, "bad VOL object wrap context refcount?")
+
+ /* Decrement ref count on wrapping context */
+ vol_wrap_ctx->rc--;
+
+ /* Release context if the ref count drops to zero */
+ if(0 == vol_wrap_ctx->rc)
+ if(H5VL__free_vol_wrapper(vol_wrap_ctx) < 0)
+ HGOTO_ERROR(H5E_VOL, H5E_CANTRELEASE, FAIL, "unable to release VOL object wrapping context")
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5VL_dec_vol_wrapper() */
+
+
+/*-------------------------------------------------------------------------
* Function: H5VL_reset_vol_wrapper
*
* Purpose: Reset object wrapping context for current VOL connector
@@ -1045,25 +1940,18 @@ H5VL_reset_vol_wrapper(void)
/* Release context if the ref count drops to zero */
if(0 == vol_wrap_ctx->rc) {
- /* If there is a VOL connector object wrapping context, release it */
- if(vol_wrap_ctx->obj_wrap_ctx) {
- /* Release the VOL connector's object wrapping context */
- if((*vol_wrap_ctx->connector->cls->free_wrap_ctx)(vol_wrap_ctx->obj_wrap_ctx) < 0)
- HGOTO_ERROR(H5E_VOL, H5E_CANTRELEASE, FAIL, "unable to release connector's object wrapping context")
- } /* end if */
-
/* Release object wrapping context */
- H5FL_FREE(H5VL_wrap_ctx_t, vol_wrap_ctx);
+ if(H5VL__free_vol_wrapper(vol_wrap_ctx) < 0)
+ HGOTO_ERROR(H5E_VOL, H5E_CANTRELEASE, FAIL, "unable to release VOL object wrapping context")
/* Reset the wrapper context */
if(H5CX_set_vol_wrap_ctx(NULL) < 0)
HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "can't set VOL object wrap context")
} /* end if */
- else {
+ else
/* Save the updated wrapper context */
if(H5CX_set_vol_wrap_ctx(vol_wrap_ctx) < 0)
HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "can't set VOL object wrap context")
- } /* end else */
done:
FUNC_LEAVE_NOAPI(ret_value)
diff --git a/src/H5VLnative.c b/src/H5VLnative.c
index fe0fd4e..7848c5d 100644
--- a/src/H5VLnative.c
+++ b/src/H5VLnative.c
@@ -38,16 +38,21 @@ static H5VL_class_t H5VL_native_cls_g = {
0, /* capability flags */
NULL, /* initialize */
H5VL__native_term, /* terminate */
- (size_t)0, /* info size */
- NULL, /* info copy */
- NULL, /* info compare */
- NULL, /* info free */
- NULL, /* info to str */
- NULL, /* str to info */
- NULL, /* get_object */
- NULL, /* get_wrap_ctx */
- NULL, /* wrap_object */
- NULL, /* free_wrap_ctx */
+ { /* info_cls */
+ (size_t)0, /* info size */
+ NULL, /* info copy */
+ NULL, /* info compare */
+ NULL, /* info free */
+ NULL, /* info to str */
+ NULL /* str to info */
+ },
+ { /* wrap_cls */
+ NULL, /* get_object */
+ NULL, /* get_wrap_ctx */
+ NULL, /* wrap_object */
+ NULL, /* unwrap_object */
+ NULL /* free_wrap_ctx */
+ },
{ /* attribute_cls */
H5VL__native_attr_create, /* create */
H5VL__native_attr_open, /* open */
diff --git a/src/H5VLnative_attr.c b/src/H5VLnative_attr.c
index 7d9f0ac..85af320 100644
--- a/src/H5VLnative_attr.c
+++ b/src/H5VLnative_attr.c
@@ -44,14 +44,12 @@
*/
void *
H5VL__native_attr_create(void *obj, const H5VL_loc_params_t *loc_params, const char *attr_name,
- hid_t acpl_id, hid_t H5_ATTR_UNUSED aapl_id, hid_t H5_ATTR_UNUSED dxpl_id,
- void H5_ATTR_UNUSED **req)
+ hid_t type_id, hid_t space_id, hid_t acpl_id, hid_t H5_ATTR_UNUSED aapl_id,
+ hid_t H5_ATTR_UNUSED dxpl_id, void H5_ATTR_UNUSED **req)
{
H5G_loc_t loc; /* Object location */
H5G_loc_t obj_loc; /* Location used to open group */
hbool_t loc_found = FALSE;
- H5P_genplist_t *plist; /* Property list pointer */
- hid_t type_id, space_id;
H5T_t *type, *dt; /* Datatype to use for attribute */
H5S_t *space; /* Dataspace to use for attribute */
H5A_t *attr = NULL;
@@ -59,16 +57,6 @@ H5VL__native_attr_create(void *obj, const H5VL_loc_params_t *loc_params, const c
FUNC_ENTER_PACKAGE
- /* Get the plist structure */
- if(NULL == (plist = (H5P_genplist_t *)H5I_object(acpl_id)))
- HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, NULL, "can't find object for ID")
-
- /* get creation properties */
- if(H5P_get(plist, H5VL_PROP_ATTR_TYPE_ID, &type_id) < 0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, NULL, "can't get property value for datatype id")
- if(H5P_get(plist, H5VL_PROP_ATTR_SPACE_ID, &space_id) < 0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, NULL, "can't get property value for space id")
-
if(H5G_loc_real(obj, loc_params->obj_type, &loc) < 0)
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a file or file object")
if(0 == (H5F_INTENT(loc.oloc->file) & H5F_ACC_RDWR))
diff --git a/src/H5VLnative_dataset.c b/src/H5VLnative_dataset.c
index 8f7351c..1e3d263 100644
--- a/src/H5VLnative_dataset.c
+++ b/src/H5VLnative_dataset.c
@@ -43,32 +43,17 @@
*/
void *
H5VL__native_dataset_create(void *obj, const H5VL_loc_params_t *loc_params,
- const char *name, hid_t dcpl_id, hid_t dapl_id, hid_t H5_ATTR_UNUSED dxpl_id,
+ const char *name, hid_t lcpl_id, hid_t type_id, hid_t space_id,
+ hid_t dcpl_id, hid_t dapl_id, hid_t H5_ATTR_UNUSED dxpl_id,
void H5_ATTR_UNUSED **req)
{
- H5P_genplist_t *plist; /* Property list pointer */
H5G_loc_t loc; /* Object location to insert dataset into */
- hid_t type_id = H5I_INVALID_HID;
- hid_t space_id = H5I_INVALID_HID;
- hid_t lcpl_id = H5I_INVALID_HID;
H5D_t *dset = NULL; /* New dataset's info */
const H5S_t *space; /* Dataspace for dataset */
void *ret_value;
FUNC_ENTER_PACKAGE
- /* Get the plist structure */
- if(NULL == (plist = (H5P_genplist_t *)H5I_object(dcpl_id)))
- HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, NULL, "can't find object for ID")
-
- /* Get creation properties */
- if(H5P_get(plist, H5VL_PROP_DSET_TYPE_ID, &type_id) < 0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, NULL, "can't get property value for datatype id")
- if(H5P_get(plist, H5VL_PROP_DSET_SPACE_ID, &space_id) < 0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, NULL, "can't get property value for space id")
- if(H5P_get(plist, H5VL_PROP_DSET_LCPL_ID, &lcpl_id) < 0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, NULL, "can't get property value for lcpl id")
-
/* Check arguments */
if(H5G_loc_real(obj, loc_params->obj_type, &loc) < 0)
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a file or file object")
diff --git a/src/H5VLnative_file.c b/src/H5VLnative_file.c
index e7f27e1..eeaade6 100644
--- a/src/H5VLnative_file.c
+++ b/src/H5VLnative_file.c
@@ -228,6 +228,19 @@ H5VL__native_file_get(void *obj, H5VL_file_get_t get_type,
break;
}
+ /* H5Fget_fileno */
+ case H5VL_FILE_GET_FILENO:
+ {
+ unsigned long *fileno = HDva_arg(arguments, unsigned long *);
+ unsigned long my_fileno = 0;
+
+ f = (H5F_t *)obj;
+ H5F_GET_FILENO(f, my_fileno);
+ *fileno = my_fileno; /* sigh */
+
+ break;
+ }
+
/* H5Fget_name */
case H5VL_FILE_GET_NAME:
{
@@ -373,10 +386,16 @@ H5VL__native_file_specific(void *obj, H5VL_file_specific_t specific_type,
/* Call private routine */
if((*ret = H5F__is_hdf5(name, fapl_id)) < 0)
- HGOTO_ERROR(H5E_IO, H5E_CANTINIT, FAIL, "error in HDF5 file check")
+ HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, FAIL, "error in HDF5 file check")
break;
}
+ /* H5Fdelete */
+ case H5VL_FILE_DELETE:
+ {
+ HGOTO_ERROR(H5E_FILE, H5E_UNSUPPORTED, FAIL, "H5Fdelete() is currently not supported in the native VOL connector")
+ break;
+ }
default:
@@ -755,7 +774,7 @@ H5VL__native_file_optional(void *obj, hid_t H5_ATTR_UNUSED dxpl_id, void H5_ATTR
/* H5Fget_dset_no_attrs_hint */
case H5VL_NATIVE_FILE_GET_MIN_DSET_OHDR_FLAG:
{
- hbool_t *minimize = va_arg(arguments, hbool_t *);
+ hbool_t *minimize = HDva_arg(arguments, hbool_t *);
*minimize = H5F_GET_MIN_DSET_OHDR(f);
break;
}
@@ -763,7 +782,7 @@ H5VL__native_file_optional(void *obj, hid_t H5_ATTR_UNUSED dxpl_id, void H5_ATTR
/* H5Fset_dset_no_attrs_hint */
case H5VL_NATIVE_FILE_SET_MIN_DSET_OHDR_FLAG:
{
- int minimize = va_arg(arguments, int);
+ int minimize = HDva_arg(arguments, int);
if(H5F_set_min_dset_ohdr(f, (hbool_t)minimize) < 0)
HGOTO_ERROR(H5E_FILE, H5E_CANTSET, FAIL, "cannot set file's dataset object header minimization flag")
break;
diff --git a/src/H5VLnative_group.c b/src/H5VLnative_group.c
index 9c07b3d..b6bef7f 100644
--- a/src/H5VLnative_group.c
+++ b/src/H5VLnative_group.c
@@ -41,25 +41,15 @@
*/
void *
H5VL__native_group_create(void *obj, const H5VL_loc_params_t *loc_params, const char *name,
- hid_t gcpl_id, hid_t H5_ATTR_UNUSED gapl_id, hid_t H5_ATTR_UNUSED dxpl_id,
- void H5_ATTR_UNUSED **req)
+ hid_t lcpl_id, hid_t gcpl_id, hid_t H5_ATTR_UNUSED gapl_id,
+ hid_t H5_ATTR_UNUSED dxpl_id, void H5_ATTR_UNUSED **req)
{
- H5P_genplist_t *plist; /* Property list pointer */
H5G_loc_t loc; /* Location to create group */
H5G_t *grp = NULL; /* New group created */
- hid_t lcpl_id;
void *ret_value;
FUNC_ENTER_PACKAGE
- /* Get the property list structure */
- if(NULL == (plist = (H5P_genplist_t *)H5I_object(gcpl_id)))
- HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, NULL, "can't find object for ID")
-
- /* Get creation properties */
- if(H5P_get(plist, H5VL_PROP_GRP_LCPL_ID, &lcpl_id) < 0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, NULL, "can't get property value for lcpl id")
-
/* Set up the location */
if(H5G_loc_real(obj, loc_params->obj_type, &loc) < 0)
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a file or file object")
diff --git a/src/H5VLnative_link.c b/src/H5VLnative_link.c
index 98d2ccd..4709eb3 100644
--- a/src/H5VLnative_link.c
+++ b/src/H5VLnative_link.c
@@ -41,7 +41,7 @@
herr_t
H5VL__native_link_create(H5VL_link_create_type_t create_type, void *obj,
const H5VL_loc_params_t *loc_params, hid_t lcpl_id, hid_t H5_ATTR_UNUSED lapl_id,
- hid_t H5_ATTR_UNUSED dxpl_id, void H5_ATTR_UNUSED **req)
+ hid_t H5_ATTR_UNUSED dxpl_id, void H5_ATTR_UNUSED **req, va_list arguments)
{
H5P_genplist_t *plist; /* Property list pointer */
herr_t ret_value = SUCCEED; /* Return value */
@@ -57,13 +57,8 @@ H5VL__native_link_create(H5VL_link_create_type_t create_type, void *obj,
{
H5G_loc_t cur_loc;
H5G_loc_t link_loc;
- void *cur_obj;
- H5VL_loc_params_t cur_params;
-
- if(H5P_get(plist, H5VL_PROP_LINK_TARGET, &cur_obj) < 0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get property value for current location id")
- if(H5P_get(plist, H5VL_PROP_LINK_TARGET_LOC_PARAMS, &cur_params) < 0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get property value for current name")
+ void *cur_obj = HDva_arg(arguments, void *);
+ H5VL_loc_params_t cur_params = HDva_arg(arguments, H5VL_loc_params_t);
if(NULL != cur_obj && H5G_loc_real(cur_obj, cur_params.obj_type, &cur_loc) < 0)
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file or file object")
@@ -99,15 +94,12 @@ H5VL__native_link_create(H5VL_link_create_type_t create_type, void *obj,
case H5VL_LINK_CREATE_SOFT:
{
- char *target_name;
+ char *target_name = HDva_arg(arguments, char *);
H5G_loc_t link_loc; /* Group location for new link */
if(H5G_loc_real(obj, loc_params->obj_type, &link_loc) < 0)
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file or file object")
- if(H5P_get(plist, H5VL_PROP_LINK_TARGET_NAME, &target_name) < 0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get property value for targe name")
-
/* Create the link */
if((ret_value = H5L_create_soft(target_name, &link_loc, loc_params->loc_data.loc_by_name.name, lcpl_id)) < 0)
HGOTO_ERROR(H5E_LINK, H5E_CANTINIT, FAIL, "unable to create link")
@@ -117,23 +109,15 @@ H5VL__native_link_create(H5VL_link_create_type_t create_type, void *obj,
case H5VL_LINK_CREATE_UD:
{
H5G_loc_t link_loc; /* Group location for new link */
- H5L_type_t link_type;
- void *udata;
- size_t udata_size;
+ H5L_type_t link_type = (H5L_type_t)HDva_arg(arguments, int);
+ void *udata = HDva_arg(arguments, void *);
+ size_t udata_size = HDva_arg(arguments, size_t);
if(H5G_loc_real(obj, loc_params->obj_type, &link_loc) < 0)
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file or file object")
- if(H5P_get(plist, H5VL_PROP_LINK_TYPE, &link_type) < 0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get property value for link type")
- if(H5P_get(plist, H5VL_PROP_LINK_UDATA, &udata) < 0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get property value for udata")
- if(H5P_get(plist, H5VL_PROP_LINK_UDATA_SIZE, &udata_size) < 0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get property value for udata size")
-
/* Create link */
- if(H5L__create_ud(&link_loc, loc_params->loc_data.loc_by_name.name, udata, udata_size,
- link_type, lcpl_id) < 0)
+ if(H5L__create_ud(&link_loc, loc_params->loc_data.loc_by_name.name, udata, udata_size, link_type, lcpl_id) < 0)
HGOTO_ERROR(H5E_LINK, H5E_CANTINIT, FAIL, "unable to create link")
break;
}
diff --git a/src/H5VLnative_object.c b/src/H5VLnative_object.c
index 0b1d73a..de2a8a5 100644
--- a/src/H5VLnative_object.c
+++ b/src/H5VLnative_object.c
@@ -213,17 +213,32 @@ H5VL__native_object_get(void *obj, const H5VL_loc_params_t *loc_params, H5VL_obj
break;
}
- /* H5Iget_name */
- case H5VL_ID_GET_NAME:
+ /* Object name */
+ case H5VL_OBJECT_GET_NAME:
{
ssize_t *ret = HDva_arg(arguments, ssize_t *);
char *name = HDva_arg(arguments, char *);
size_t size = HDva_arg(arguments, size_t);
- /* Retrieve object's name */
- if((*ret = H5G_get_name(&loc, name, size, NULL)) < 0)
- HGOTO_ERROR(H5E_ATOM, H5E_CANTGET, FAIL, "can't retrieve object name")
+ if(loc_params->type == H5VL_OBJECT_BY_SELF) {
+ /* Retrieve object's name */
+ if((*ret = H5G_get_name(&loc, name, size, NULL)) < 0)
+ HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "can't retrieve object name")
+ } /* end if */
+ else if(loc_params->type == H5VL_OBJECT_BY_ADDR) {
+ H5O_loc_t obj_oloc; /* Object location */
+
+ /* Initialize the object location */
+ H5O_loc_reset(&obj_oloc);
+ obj_oloc.file = loc.oloc->file;
+ obj_oloc.addr = loc_params->loc_data.loc_by_addr.addr;
+ /* Retrieve object's name */
+ if((*ret = H5G_get_name_by_addr(loc.oloc->file, &obj_oloc, name, size)) < 0)
+ HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "can't determine object name")
+ } /* end else-if */
+ else
+ HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "unknown get_name parameters")
break;
}
diff --git a/src/H5VLnative_private.h b/src/H5VLnative_private.h
index 1bf4da2..714b73c 100644
--- a/src/H5VLnative_private.h
+++ b/src/H5VLnative_private.h
@@ -24,7 +24,7 @@ extern "C" {
#endif
/* Atrribute callbacks */
-H5_DLL void *H5VL__native_attr_create(void *obj, const H5VL_loc_params_t *loc_params, const char *attr_name, hid_t acpl_id, hid_t aapl_id, hid_t dxpl_id, void **req);
+H5_DLL void *H5VL__native_attr_create(void *obj, const H5VL_loc_params_t *loc_params, const char *attr_name, hid_t type_id, hid_t space_id, hid_t acpl_id, hid_t aapl_id, hid_t dxpl_id, void **req);
void *H5VL__native_attr_open(void *obj, const H5VL_loc_params_t *loc_params, const char *attr_name, hid_t aapl_id, hid_t dxpl_id, void **req);
H5_DLL herr_t H5VL__native_attr_read(void *attr, hid_t dtype_id, void *buf, hid_t dxpl_id, void **req);
H5_DLL herr_t H5VL__native_attr_write(void *attr, hid_t dtype_id, const void *buf, hid_t dxpl_id, void **req);
@@ -34,7 +34,7 @@ H5_DLL herr_t H5VL__native_attr_optional(void *obj, hid_t dxpl_id, void **req, v
H5_DLL herr_t H5VL__native_attr_close(void *attr, hid_t dxpl_id, void **req);
/* Dataset callbacks */
-H5_DLL void *H5VL__native_dataset_create(void *obj, const H5VL_loc_params_t *loc_params, const char *name, hid_t dcpl_id, hid_t dapl_id, hid_t dxpl_id, void **req);
+H5_DLL void *H5VL__native_dataset_create(void *obj, const H5VL_loc_params_t *loc_params, const char *name, hid_t lcpl_id, hid_t type_id, hid_t space_id, hid_t dcpl_id, hid_t dapl_id, hid_t dxpl_id, void **req);
H5_DLL void *H5VL__native_dataset_open(void *obj, const H5VL_loc_params_t *loc_params, const char *name, hid_t dapl_id, hid_t dxpl_id, void **req);
H5_DLL herr_t H5VL__native_dataset_read(void *dset, hid_t mem_type_id, hid_t mem_space_id, hid_t file_space_id, hid_t plist_id, void *buf, void **req);
H5_DLL herr_t H5VL__native_dataset_write(void *dset, hid_t mem_type_id, hid_t mem_space_id, hid_t file_space_id, hid_t plist_id, const void *buf, void **req);
@@ -52,7 +52,7 @@ H5_DLL herr_t H5VL__native_file_optional(void *file, hid_t dxpl_id, void **req,
H5_DLL herr_t H5VL__native_file_close(void *file, hid_t dxpl_id, void **req);
/* Group callbacks */
-H5_DLL void *H5VL__native_group_create(void *obj, const H5VL_loc_params_t *loc_params, const char *name, hid_t gcpl_id, hid_t gapl_id, hid_t dxpl_id, void **req);
+H5_DLL void *H5VL__native_group_create(void *obj, const H5VL_loc_params_t *loc_params, const char *name, hid_t lcpl_id, hid_t gcpl_id, hid_t gapl_id, hid_t dxpl_id, void **req);
H5_DLL void *H5VL__native_group_open(void *obj, const H5VL_loc_params_t *loc_params, const char *name, hid_t gapl_id, hid_t dxpl_id, void **req);
H5_DLL herr_t H5VL__native_group_get(void *obj, H5VL_group_get_t get_type, hid_t dxpl_id, void **req, va_list arguments);
H5_DLL herr_t H5VL__native_group_specific(void *obj, H5VL_group_specific_t specific_type, hid_t dxpl_id, void **req, va_list arguments);
@@ -60,7 +60,7 @@ H5_DLL herr_t H5VL__native_group_optional(void *obj, hid_t dxpl_id, void **req,
H5_DLL herr_t H5VL__native_group_close(void *grp, hid_t dxpl_id, void **req);
/* Link callbacks */
-H5_DLL herr_t H5VL__native_link_create(H5VL_link_create_type_t create_type, void *obj, const H5VL_loc_params_t *loc_params, hid_t lcpl_id, hid_t lapl_id, hid_t dxpl_id, void **req);
+H5_DLL herr_t H5VL__native_link_create(H5VL_link_create_type_t create_type, void *obj, const H5VL_loc_params_t *loc_params, hid_t lcpl_id, hid_t lapl_id, hid_t dxpl_id, void **req, va_list arguments);
H5_DLL herr_t H5VL__native_link_copy(void *src_obj, const H5VL_loc_params_t *loc_params1, void *dst_obj, const H5VL_loc_params_t *loc_params2, hid_t lcpl_id, hid_t lapl_id, hid_t dxpl_id, void **req);
H5_DLL herr_t H5VL__native_link_move(void *src_obj, const H5VL_loc_params_t *loc_params1, void *dst_obj, const H5VL_loc_params_t *loc_params2, hid_t lcpl_id, hid_t lapl_id, hid_t dxpl_id, void **req);
H5_DLL herr_t H5VL__native_link_get(void *obj, const H5VL_loc_params_t *loc_params, H5VL_link_get_t get_type, hid_t dxpl_id, void **req, va_list arguments);
diff --git a/src/H5VLpassthru.c b/src/H5VLpassthru.c
index f7f9058..eecdac2 100644
--- a/src/H5VLpassthru.c
+++ b/src/H5VLpassthru.c
@@ -20,17 +20,26 @@
* include _any_ private HDF5 header files. This connector should
* therefore only make public HDF5 API calls and use standard C /
* POSIX calls.
+ *
+ * Note that the HDF5 error stack must be preserved on code paths
+ * that could be invoked when the underlying VOL connector's
+ * callback can fail.
+ *
*/
/* Header files needed */
-/* (Public HDF5 and standard C / POSIX only) */
+/* Do NOT include private HDF5 files here! */
#include <assert.h>
#include <stdarg.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
+
+/* Public HDF5 file */
#include "hdf5.h"
+
+/* This connector's header */
#include "H5VLpassthru.h"
@@ -75,6 +84,9 @@ static herr_t H5VL_pass_through_file_specific_reissue(void *obj, hid_t connector
H5VL_file_specific_t specific_type, hid_t dxpl_id, void **req, ...);
static herr_t H5VL_pass_through_request_specific_reissue(void *obj, hid_t connector_id,
H5VL_request_specific_t specific_type, ...);
+static herr_t H5VL_pass_through_link_create_reissue(H5VL_link_create_type_t create_type,
+ void *obj, const H5VL_loc_params_t *loc_params, hid_t connector_id,
+ hid_t lcpl_id, hid_t lapl_id, hid_t dxpl_id, void **req, ...);
static H5VL_pass_through_t *H5VL_pass_through_new_obj(void *under_obj,
hid_t under_vol_id);
static herr_t H5VL_pass_through_free_obj(H5VL_pass_through_t *obj);
@@ -82,19 +94,24 @@ static herr_t H5VL_pass_through_free_obj(H5VL_pass_through_t *obj);
/* "Management" callbacks */
static herr_t H5VL_pass_through_init(hid_t vipl_id);
static herr_t H5VL_pass_through_term(void);
+
+/* VOL info callbacks */
static void *H5VL_pass_through_info_copy(const void *info);
static herr_t H5VL_pass_through_info_cmp(int *cmp_value, const void *info1, const void *info2);
static herr_t H5VL_pass_through_info_free(void *info);
static herr_t H5VL_pass_through_info_to_str(const void *info, char **str);
static herr_t H5VL_pass_through_str_to_info(const char *str, void **info);
+
+/* VOL object wrap / retrieval callbacks */
static void *H5VL_pass_through_get_object(const void *obj);
static herr_t H5VL_pass_through_get_wrap_ctx(const void *obj, void **wrap_ctx);
-static herr_t H5VL_pass_through_free_wrap_ctx(void *obj);
static void *H5VL_pass_through_wrap_object(void *obj, H5I_type_t obj_type,
void *wrap_ctx);
+static void *H5VL_pass_through_unwrap_object(void *obj);
+static herr_t H5VL_pass_through_free_wrap_ctx(void *obj);
/* Attribute callbacks */
-static void *H5VL_pass_through_attr_create(void *obj, const H5VL_loc_params_t *loc_params, const char *name, hid_t acpl_id, hid_t aapl_id, hid_t dxpl_id, void **req);
+static void *H5VL_pass_through_attr_create(void *obj, const H5VL_loc_params_t *loc_params, const char *name, hid_t type_id, hid_t space_id, hid_t acpl_id, hid_t aapl_id, hid_t dxpl_id, void **req);
static void *H5VL_pass_through_attr_open(void *obj, const H5VL_loc_params_t *loc_params, const char *name, hid_t aapl_id, hid_t dxpl_id, void **req);
static herr_t H5VL_pass_through_attr_read(void *attr, hid_t mem_type_id, void *buf, hid_t dxpl_id, void **req);
static herr_t H5VL_pass_through_attr_write(void *attr, hid_t mem_type_id, const void *buf, hid_t dxpl_id, void **req);
@@ -104,7 +121,7 @@ static herr_t H5VL_pass_through_attr_optional(void *obj, hid_t dxpl_id, void **r
static herr_t H5VL_pass_through_attr_close(void *attr, hid_t dxpl_id, void **req);
/* Dataset callbacks */
-static void *H5VL_pass_through_dataset_create(void *obj, const H5VL_loc_params_t *loc_params, const char *name, hid_t dcpl_id, hid_t dapl_id, hid_t dxpl_id, void **req);
+static void *H5VL_pass_through_dataset_create(void *obj, const H5VL_loc_params_t *loc_params, const char *name, hid_t lcpl_id, hid_t type_id, hid_t space_id, hid_t dcpl_id, hid_t dapl_id, hid_t dxpl_id, void **req);
static void *H5VL_pass_through_dataset_open(void *obj, const H5VL_loc_params_t *loc_params, const char *name, hid_t dapl_id, hid_t dxpl_id, void **req);
static herr_t H5VL_pass_through_dataset_read(void *dset, hid_t mem_type_id, hid_t mem_space_id,
hid_t file_space_id, hid_t plist_id, void *buf, void **req);
@@ -131,7 +148,7 @@ static herr_t H5VL_pass_through_file_optional(void *file, hid_t dxpl_id, void **
static herr_t H5VL_pass_through_file_close(void *file, hid_t dxpl_id, void **req);
/* Group callbacks */
-static void *H5VL_pass_through_group_create(void *obj, const H5VL_loc_params_t *loc_params, const char *name, hid_t gcpl_id, hid_t gapl_id, hid_t dxpl_id, void **req);
+static void *H5VL_pass_through_group_create(void *obj, const H5VL_loc_params_t *loc_params, const char *name, hid_t lcpl_id, hid_t gcpl_id, hid_t gapl_id, hid_t dxpl_id, void **req);
static void *H5VL_pass_through_group_open(void *obj, const H5VL_loc_params_t *loc_params, const char *name, hid_t gapl_id, hid_t dxpl_id, void **req);
static herr_t H5VL_pass_through_group_get(void *obj, H5VL_group_get_t get_type, hid_t dxpl_id, void **req, va_list arguments);
static herr_t H5VL_pass_through_group_specific(void *obj, H5VL_group_specific_t specific_type, hid_t dxpl_id, void **req, va_list arguments);
@@ -139,7 +156,7 @@ static herr_t H5VL_pass_through_group_optional(void *obj, hid_t dxpl_id, void **
static herr_t H5VL_pass_through_group_close(void *grp, hid_t dxpl_id, void **req);
/* Link callbacks */
-static herr_t H5VL_pass_through_link_create(H5VL_link_create_type_t create_type, void *obj, const H5VL_loc_params_t *loc_params, hid_t lcpl_id, hid_t lapl_id, hid_t dxpl_id, void **req);
+static herr_t H5VL_pass_through_link_create(H5VL_link_create_type_t create_type, void *obj, const H5VL_loc_params_t *loc_params, hid_t lcpl_id, hid_t lapl_id, hid_t dxpl_id, void **req, va_list arguments);
static herr_t H5VL_pass_through_link_copy(void *src_obj, const H5VL_loc_params_t *loc_params1, void *dst_obj, const H5VL_loc_params_t *loc_params2, hid_t lcpl_id, hid_t lapl_id, hid_t dxpl_id, void **req);
static herr_t H5VL_pass_through_link_move(void *src_obj, const H5VL_loc_params_t *loc_params1, void *dst_obj, const H5VL_loc_params_t *loc_params2, hid_t lcpl_id, hid_t lapl_id, hid_t dxpl_id, void **req);
static herr_t H5VL_pass_through_link_get(void *obj, const H5VL_loc_params_t *loc_params, H5VL_link_get_t get_type, hid_t dxpl_id, void **req, va_list arguments);
@@ -173,82 +190,87 @@ static const H5VL_class_t H5VL_pass_through_g = {
0, /* capability flags */
H5VL_pass_through_init, /* initialize */
H5VL_pass_through_term, /* terminate */
- sizeof(H5VL_pass_through_info_t), /* info size */
- H5VL_pass_through_info_copy, /* info copy */
- H5VL_pass_through_info_cmp, /* info compare */
- H5VL_pass_through_info_free, /* info free */
- H5VL_pass_through_info_to_str, /* info to str */
- H5VL_pass_through_str_to_info, /* str to info */
- H5VL_pass_through_get_object, /* get_object */
- H5VL_pass_through_get_wrap_ctx, /* get_wrap_ctx */
- H5VL_pass_through_wrap_object, /* wrap_object */
- H5VL_pass_through_free_wrap_ctx, /* free_wrap_ctx */
+ { /* info_cls */
+ sizeof(H5VL_pass_through_info_t), /* size */
+ H5VL_pass_through_info_copy, /* copy */
+ H5VL_pass_through_info_cmp, /* compare */
+ H5VL_pass_through_info_free, /* free */
+ H5VL_pass_through_info_to_str, /* to_str */
+ H5VL_pass_through_str_to_info, /* from_str */
+ },
+ { /* wrap_cls */
+ H5VL_pass_through_get_object, /* get_object */
+ H5VL_pass_through_get_wrap_ctx, /* get_wrap_ctx */
+ H5VL_pass_through_wrap_object, /* wrap_object */
+ H5VL_pass_through_unwrap_object, /* unwrap_object */
+ H5VL_pass_through_free_wrap_ctx, /* free_wrap_ctx */
+ },
{ /* attribute_cls */
- H5VL_pass_through_attr_create, /* create */
- H5VL_pass_through_attr_open, /* open */
- H5VL_pass_through_attr_read, /* read */
- H5VL_pass_through_attr_write, /* write */
- H5VL_pass_through_attr_get, /* get */
- H5VL_pass_through_attr_specific, /* specific */
- H5VL_pass_through_attr_optional, /* optional */
- H5VL_pass_through_attr_close /* close */
+ H5VL_pass_through_attr_create, /* create */
+ H5VL_pass_through_attr_open, /* open */
+ H5VL_pass_through_attr_read, /* read */
+ H5VL_pass_through_attr_write, /* write */
+ H5VL_pass_through_attr_get, /* get */
+ H5VL_pass_through_attr_specific, /* specific */
+ H5VL_pass_through_attr_optional, /* optional */
+ H5VL_pass_through_attr_close /* close */
},
{ /* dataset_cls */
- H5VL_pass_through_dataset_create, /* create */
- H5VL_pass_through_dataset_open, /* open */
- H5VL_pass_through_dataset_read, /* read */
- H5VL_pass_through_dataset_write, /* write */
- H5VL_pass_through_dataset_get, /* get */
- H5VL_pass_through_dataset_specific, /* specific */
- H5VL_pass_through_dataset_optional, /* optional */
- H5VL_pass_through_dataset_close /* close */
+ H5VL_pass_through_dataset_create, /* create */
+ H5VL_pass_through_dataset_open, /* open */
+ H5VL_pass_through_dataset_read, /* read */
+ H5VL_pass_through_dataset_write, /* write */
+ H5VL_pass_through_dataset_get, /* get */
+ H5VL_pass_through_dataset_specific, /* specific */
+ H5VL_pass_through_dataset_optional, /* optional */
+ H5VL_pass_through_dataset_close /* close */
},
- { /* datatype_cls */
- H5VL_pass_through_datatype_commit, /* commit */
- H5VL_pass_through_datatype_open, /* open */
- H5VL_pass_through_datatype_get, /* get_size */
- H5VL_pass_through_datatype_specific, /* specific */
- H5VL_pass_through_datatype_optional, /* optional */
- H5VL_pass_through_datatype_close /* close */
+ { /* datatype_cls */
+ H5VL_pass_through_datatype_commit, /* commit */
+ H5VL_pass_through_datatype_open, /* open */
+ H5VL_pass_through_datatype_get, /* get_size */
+ H5VL_pass_through_datatype_specific, /* specific */
+ H5VL_pass_through_datatype_optional, /* optional */
+ H5VL_pass_through_datatype_close /* close */
},
{ /* file_cls */
- H5VL_pass_through_file_create, /* create */
- H5VL_pass_through_file_open, /* open */
- H5VL_pass_through_file_get, /* get */
- H5VL_pass_through_file_specific, /* specific */
- H5VL_pass_through_file_optional, /* optional */
- H5VL_pass_through_file_close /* close */
+ H5VL_pass_through_file_create, /* create */
+ H5VL_pass_through_file_open, /* open */
+ H5VL_pass_through_file_get, /* get */
+ H5VL_pass_through_file_specific, /* specific */
+ H5VL_pass_through_file_optional, /* optional */
+ H5VL_pass_through_file_close /* close */
},
{ /* group_cls */
- H5VL_pass_through_group_create, /* create */
- H5VL_pass_through_group_open, /* open */
- H5VL_pass_through_group_get, /* get */
- H5VL_pass_through_group_specific, /* specific */
- H5VL_pass_through_group_optional, /* optional */
- H5VL_pass_through_group_close /* close */
+ H5VL_pass_through_group_create, /* create */
+ H5VL_pass_through_group_open, /* open */
+ H5VL_pass_through_group_get, /* get */
+ H5VL_pass_through_group_specific, /* specific */
+ H5VL_pass_through_group_optional, /* optional */
+ H5VL_pass_through_group_close /* close */
},
{ /* link_cls */
- H5VL_pass_through_link_create, /* create */
- H5VL_pass_through_link_copy, /* copy */
- H5VL_pass_through_link_move, /* move */
- H5VL_pass_through_link_get, /* get */
- H5VL_pass_through_link_specific, /* specific */
- H5VL_pass_through_link_optional, /* optional */
+ H5VL_pass_through_link_create, /* create */
+ H5VL_pass_through_link_copy, /* copy */
+ H5VL_pass_through_link_move, /* move */
+ H5VL_pass_through_link_get, /* get */
+ H5VL_pass_through_link_specific, /* specific */
+ H5VL_pass_through_link_optional, /* optional */
},
{ /* object_cls */
- H5VL_pass_through_object_open, /* open */
- H5VL_pass_through_object_copy, /* copy */
- H5VL_pass_through_object_get, /* get */
- H5VL_pass_through_object_specific, /* specific */
- H5VL_pass_through_object_optional, /* optional */
+ H5VL_pass_through_object_open, /* open */
+ H5VL_pass_through_object_copy, /* copy */
+ H5VL_pass_through_object_get, /* get */
+ H5VL_pass_through_object_specific, /* specific */
+ H5VL_pass_through_object_optional, /* optional */
},
{ /* request_cls */
- H5VL_pass_through_request_wait, /* wait */
- H5VL_pass_through_request_notify, /* notify */
- H5VL_pass_through_request_cancel, /* cancel */
- H5VL_pass_through_request_specific, /* specific */
- H5VL_pass_through_request_optional, /* optional */
- H5VL_pass_through_request_free /* free */
+ H5VL_pass_through_request_wait, /* wait */
+ H5VL_pass_through_request_notify, /* notify */
+ H5VL_pass_through_request_cancel, /* cancel */
+ H5VL_pass_through_request_specific, /* specific */
+ H5VL_pass_through_request_optional, /* optional */
+ H5VL_pass_through_request_free /* free */
},
NULL /* optional */
};
@@ -289,6 +311,9 @@ H5VL_pass_through_new_obj(void *under_obj, hid_t under_vol_id)
*
* Purpose: Release a pass through object
*
+ * Note: Take care to preserve the current HDF5 error stack
+ * when calling HDF5 API calls.
+ *
* Return: Success: 0
* Failure: -1
*
@@ -300,7 +325,14 @@ H5VL_pass_through_new_obj(void *under_obj, hid_t under_vol_id)
static herr_t
H5VL_pass_through_free_obj(H5VL_pass_through_t *obj)
{
+ hid_t err_id;
+
+ err_id = H5Eget_current_stack();
+
H5Idec_ref(obj->under_vol_id);
+
+ H5Eset_current_stack(err_id);
+
free(obj);
return 0;
@@ -324,11 +356,8 @@ H5VL_pass_through_free_obj(H5VL_pass_through_t *obj)
hid_t
H5VL_pass_through_register(void)
{
- /* Clear the error stack */
- H5Eclear2(H5E_DEFAULT);
-
/* Singleton register the pass-through VOL connector ID */
- if(H5I_VOL != H5Iget_type(H5VL_PASSTHRU_g))
+ if(H5VL_PASSTHRU_g < 0)
H5VL_PASSTHRU_g = H5VLregister_connector(&H5VL_pass_through_g, H5P_DEFAULT);
return H5VL_PASSTHRU_g;
@@ -468,6 +497,9 @@ H5VL_pass_through_info_cmp(int *cmp_value, const void *_info1, const void *_info
*
* Purpose: Release an info object for the connector.
*
+ * Note: Take care to preserve the current HDF5 error stack
+ * when calling HDF5 API calls.
+ *
* Return: Success: 0
* Failure: -1
*
@@ -477,16 +509,21 @@ static herr_t
H5VL_pass_through_info_free(void *_info)
{
H5VL_pass_through_info_t *info = (H5VL_pass_through_info_t *)_info;
+ hid_t err_id;
#ifdef ENABLE_PASSTHRU_LOGGING
printf("------- PASS THROUGH VOL INFO Free\n");
#endif
+ err_id = H5Eget_current_stack();
+
/* Release underlying VOL ID and info */
if(info->under_vol_info)
H5VLfree_connector_info(info->under_vol_id, info->under_vol_info);
H5Idec_ref(info->under_vol_id);
+ H5Eset_current_stack(err_id);
+
/* Free pass through info object itself */
free(info);
@@ -655,8 +692,8 @@ H5VL_pass_through_get_wrap_ctx(const void *obj, void **wrap_ctx)
*
* Purpose: Use a "wrapper context" to wrap a data object
*
- * Return: Success: 0
- * Failure: -1
+ * Return: Success: Pointer to wrapped object
+ * Failure: NULL
*
*---------------------------------------------------------------------------
*/
@@ -683,10 +720,44 @@ H5VL_pass_through_wrap_object(void *obj, H5I_type_t obj_type, void *_wrap_ctx)
/*---------------------------------------------------------------------------
+ * Function: H5VL_pass_through_unwrap_object
+ *
+ * Purpose: Unwrap a wrapped object, discarding the wrapper, but returning
+ * underlying object.
+ *
+ * Return: Success: Pointer to unwrapped object
+ * Failure: NULL
+ *
+ *---------------------------------------------------------------------------
+ */
+static void *
+H5VL_pass_through_unwrap_object(void *obj)
+{
+ H5VL_pass_through_t *o = (H5VL_pass_through_t *)obj;
+ void *under;
+
+#ifdef ENABLE_PASSTHRU_LOGGING
+ printf("------- PASS THROUGH VOL UNWRAP Object\n");
+#endif
+
+ /* Unrap the object with the underlying VOL */
+ under = H5VLunwrap_object(o->under_object, o->under_vol_id);
+
+ if(under)
+ H5VL_pass_through_free_obj(o);
+
+ return under;
+} /* end H5VL_pass_through_unwrap_object() */
+
+
+/*---------------------------------------------------------------------------
* Function: H5VL_pass_through_free_wrap_ctx
*
* Purpose: Release a "wrapper context" for an object
*
+ * Note: Take care to preserve the current HDF5 error stack
+ * when calling HDF5 API calls.
+ *
* Return: Success: 0
* Failure: -1
*
@@ -696,16 +767,21 @@ static herr_t
H5VL_pass_through_free_wrap_ctx(void *_wrap_ctx)
{
H5VL_pass_through_wrap_ctx_t *wrap_ctx = (H5VL_pass_through_wrap_ctx_t *)_wrap_ctx;
+ hid_t err_id;
#ifdef ENABLE_PASSTHRU_LOGGING
printf("------- PASS THROUGH VOL WRAP CTX Free\n");
#endif
+ err_id = H5Eget_current_stack();
+
/* Release underlying VOL ID and wrap context */
if(wrap_ctx->under_wrap_ctx)
H5VLfree_wrap_ctx(wrap_ctx->under_wrap_ctx, wrap_ctx->under_vol_id);
H5Idec_ref(wrap_ctx->under_vol_id);
+ H5Eset_current_stack(err_id);
+
/* Free pass through wrap context object itself */
free(wrap_ctx);
@@ -725,7 +801,8 @@ H5VL_pass_through_free_wrap_ctx(void *_wrap_ctx)
*/
static void *
H5VL_pass_through_attr_create(void *obj, const H5VL_loc_params_t *loc_params,
- const char *name, hid_t acpl_id, hid_t aapl_id, hid_t dxpl_id, void **req)
+ const char *name, hid_t type_id, hid_t space_id, hid_t acpl_id,
+ hid_t aapl_id, hid_t dxpl_id, void **req)
{
H5VL_pass_through_t *attr;
H5VL_pass_through_t *o = (H5VL_pass_through_t *)obj;
@@ -735,7 +812,7 @@ H5VL_pass_through_attr_create(void *obj, const H5VL_loc_params_t *loc_params,
printf("------- PASS THROUGH VOL ATTRIBUTE Create\n");
#endif
- under = H5VLattr_create(o->under_object, loc_params, o->under_vol_id, name, acpl_id, aapl_id, dxpl_id, req);
+ under = H5VLattr_create(o->under_object, loc_params, o->under_vol_id, name, type_id, space_id, acpl_id, aapl_id, dxpl_id, req);
if(under) {
attr = H5VL_pass_through_new_obj(under, o->under_vol_id);
@@ -988,7 +1065,8 @@ H5VL_pass_through_attr_close(void *attr, hid_t dxpl_id, void **req)
*/
static void *
H5VL_pass_through_dataset_create(void *obj, const H5VL_loc_params_t *loc_params,
- const char *name, hid_t dcpl_id, hid_t dapl_id, hid_t dxpl_id, void **req)
+ const char *name, hid_t lcpl_id, hid_t type_id, hid_t space_id,
+ hid_t dcpl_id, hid_t dapl_id, hid_t dxpl_id, void **req)
{
H5VL_pass_through_t *dset;
H5VL_pass_through_t *o = (H5VL_pass_through_t *)obj;
@@ -998,7 +1076,7 @@ H5VL_pass_through_dataset_create(void *obj, const H5VL_loc_params_t *loc_params,
printf("------- PASS THROUGH VOL DATASET Create\n");
#endif
- under = H5VLdataset_create(o->under_object, loc_params, o->under_vol_id, name, dcpl_id, dapl_id, dxpl_id, req);
+ under = H5VLdataset_create(o->under_object, loc_params, o->under_vol_id, name, lcpl_id, type_id, space_id, dcpl_id, dapl_id, dxpl_id, req);
if(under) {
dset = H5VL_pass_through_new_obj(under, o->under_vol_id);
@@ -1158,17 +1236,22 @@ H5VL_pass_through_dataset_specific(void *obj, H5VL_dataset_specific_t specific_t
hid_t dxpl_id, void **req, va_list arguments)
{
H5VL_pass_through_t *o = (H5VL_pass_through_t *)obj;
+ hid_t under_vol_id;
herr_t ret_value;
#ifdef ENABLE_PASSTHRU_LOGGING
printf("------- PASS THROUGH VOL H5Dspecific\n");
#endif
+ // Save copy of underlying VOL connector ID and prov helper, in case of
+ // refresh destroying the current object
+ under_vol_id = o->under_vol_id;
+
ret_value = H5VLdataset_specific(o->under_object, o->under_vol_id, specific_type, dxpl_id, req, arguments);
/* Check for async request */
if(req && *req)
- *req = H5VL_pass_through_new_obj(*req, o->under_vol_id);
+ *req = H5VL_pass_through_new_obj(*req, under_vol_id);
return ret_value;
} /* end H5VL_pass_through_dataset_specific() */
@@ -1360,17 +1443,22 @@ H5VL_pass_through_datatype_specific(void *obj, H5VL_datatype_specific_t specific
hid_t dxpl_id, void **req, va_list arguments)
{
H5VL_pass_through_t *o = (H5VL_pass_through_t *)obj;
+ hid_t under_vol_id;
herr_t ret_value;
#ifdef ENABLE_PASSTHRU_LOGGING
printf("------- PASS THROUGH VOL DATATYPE Specific\n");
#endif
+ // Save copy of underlying VOL connector ID and prov helper, in case of
+ // refresh destroying the current object
+ under_vol_id = o->under_vol_id;
+
ret_value = H5VLdatatype_specific(o->under_object, o->under_vol_id, specific_type, dxpl_id, req, arguments);
/* Check for async request */
if(req && *req)
- *req = H5VL_pass_through_new_obj(*req, o->under_vol_id);
+ *req = H5VL_pass_through_new_obj(*req, under_vol_id);
return ret_value;
} /* end H5VL_pass_through_datatype_specific() */
@@ -1649,7 +1737,7 @@ H5VL_pass_through_file_specific(void *file, H5VL_file_specific_t specific_type,
/* Re-issue 'file specific' call, using the unwrapped pieces */
ret_value = H5VL_pass_through_file_specific_reissue(o->under_object, o->under_vol_id, specific_type, dxpl_id, req, (int)loc_type, name, child_file->under_object, plist_id);
} /* end if */
- else if(specific_type == H5VL_FILE_IS_ACCESSIBLE) {
+ else if(specific_type == H5VL_FILE_IS_ACCESSIBLE || specific_type == H5VL_FILE_DELETE) {
H5VL_pass_through_info_t *info;
hid_t fapl_id, under_fapl_id;
const char *name;
@@ -1792,7 +1880,8 @@ H5VL_pass_through_file_close(void *file, hid_t dxpl_id, void **req)
*/
static void *
H5VL_pass_through_group_create(void *obj, const H5VL_loc_params_t *loc_params,
- const char *name, hid_t gcpl_id, hid_t gapl_id, hid_t dxpl_id, void **req)
+ const char *name, hid_t lcpl_id, hid_t gcpl_id, hid_t gapl_id,
+ hid_t dxpl_id, void **req)
{
H5VL_pass_through_t *group;
H5VL_pass_through_t *o = (H5VL_pass_through_t *)obj;
@@ -1802,7 +1891,7 @@ H5VL_pass_through_group_create(void *obj, const H5VL_loc_params_t *loc_params,
printf("------- PASS THROUGH VOL GROUP Create\n");
#endif
- under = H5VLgroup_create(o->under_object, loc_params, o->under_vol_id, name, gcpl_id, gapl_id, dxpl_id, req);
+ under = H5VLgroup_create(o->under_object, loc_params, o->under_vol_id, name, lcpl_id, gcpl_id, gapl_id, dxpl_id, req);
if(under) {
group = H5VL_pass_through_new_obj(under, o->under_vol_id);
@@ -1900,17 +1989,22 @@ H5VL_pass_through_group_specific(void *obj, H5VL_group_specific_t specific_type,
hid_t dxpl_id, void **req, va_list arguments)
{
H5VL_pass_through_t *o = (H5VL_pass_through_t *)obj;
+ hid_t under_vol_id;
herr_t ret_value;
#ifdef ENABLE_PASSTHRU_LOGGING
printf("------- PASS THROUGH VOL GROUP Specific\n");
#endif
+ // Save copy of underlying VOL connector ID and prov helper, in case of
+ // refresh destroying the current object
+ under_vol_id = o->under_vol_id;
+
ret_value = H5VLgroup_specific(o->under_object, o->under_vol_id, specific_type, dxpl_id, req, arguments);
/* Check for async request */
if(req && *req)
- *req = H5VL_pass_through_new_obj(*req, o->under_vol_id);
+ *req = H5VL_pass_through_new_obj(*req, under_vol_id);
return ret_value;
} /* end H5VL_pass_through_group_specific() */
@@ -1982,6 +2076,32 @@ H5VL_pass_through_group_close(void *grp, hid_t dxpl_id, void **req)
/*-------------------------------------------------------------------------
+ * Function: H5VL_pass_through_link_create_reissue
+ *
+ * Purpose: Re-wrap vararg arguments into a va_list and reissue the
+ * link create callback to the underlying VOL connector.
+ *
+ * Return: Success: 0
+ * Failure: -1
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5VL_pass_through_link_create_reissue(H5VL_link_create_type_t create_type,
+ void *obj, const H5VL_loc_params_t *loc_params, hid_t connector_id,
+ hid_t lcpl_id, hid_t lapl_id, hid_t dxpl_id, void **req, ...)
+{
+ va_list arguments;
+ herr_t ret_value;
+
+ va_start(arguments, req);
+ ret_value = H5VLlink_create(create_type, obj, loc_params, connector_id, lcpl_id, lapl_id, dxpl_id, req, arguments);
+ va_end(arguments);
+
+ return ret_value;
+} /* end H5VL_pass_through_link_create_reissue() */
+
+/*-------------------------------------------------------------------------
* Function: H5VL_pass_through_link_create
*
* Purpose: Creates a hard / soft / UD / external link.
@@ -1992,7 +2112,9 @@ H5VL_pass_through_group_close(void *grp, hid_t dxpl_id, void **req)
*-------------------------------------------------------------------------
*/
static herr_t
-H5VL_pass_through_link_create(H5VL_link_create_type_t create_type, void *obj, const H5VL_loc_params_t *loc_params, hid_t lcpl_id, hid_t lapl_id, hid_t dxpl_id, void **req)
+H5VL_pass_through_link_create(H5VL_link_create_type_t create_type, void *obj,
+ const H5VL_loc_params_t *loc_params, hid_t lcpl_id, hid_t lapl_id,
+ hid_t dxpl_id, void **req, va_list arguments)
{
H5VL_pass_through_t *o = (H5VL_pass_through_t *)obj;
hid_t under_vol_id = -1;
@@ -2009,9 +2131,11 @@ H5VL_pass_through_link_create(H5VL_link_create_type_t create_type, void *obj, co
/* Fix up the link target object for hard link creation */
if(H5VL_LINK_CREATE_HARD == create_type) {
void *cur_obj;
+ H5VL_loc_params_t cur_params;
- /* Retrieve the object for the link target */
- H5Pget(lcpl_id, H5VL_PROP_LINK_TARGET, &cur_obj);
+ /* Retrieve the object & loc params for the link target */
+ cur_obj = va_arg(arguments, void *);
+ cur_params = va_arg(arguments, H5VL_loc_params_t);
/* If it's a non-NULL pointer, find the 'under object' and re-set the property */
if(cur_obj) {
@@ -2020,11 +2144,14 @@ H5VL_pass_through_link_create(H5VL_link_create_type_t create_type, void *obj, co
under_vol_id = ((H5VL_pass_through_t *)cur_obj)->under_vol_id;
/* Set the object for the link target */
- H5Pset(lcpl_id, H5VL_PROP_LINK_TARGET, &(((H5VL_pass_through_t *)cur_obj)->under_object));
+ cur_obj = ((H5VL_pass_through_t *)cur_obj)->under_object;
} /* end if */
- } /* end if */
- ret_value = H5VLlink_create(create_type, (o ? o->under_object : NULL), loc_params, under_vol_id, lcpl_id, lapl_id, dxpl_id, req);
+ /* Re-issue 'link create' call, using the unwrapped pieces */
+ ret_value = H5VL_pass_through_link_create_reissue(create_type, (o ? o->under_object : NULL), loc_params, under_vol_id, lcpl_id, lapl_id, dxpl_id, req, cur_obj, cur_params);
+ } /* end if */
+ else
+ ret_value = H5VLlink_create(create_type, (o ? o->under_object : NULL), loc_params, under_vol_id, lcpl_id, lapl_id, dxpl_id, req, arguments);
/* Check for async request */
if(req && *req)
@@ -2336,17 +2463,22 @@ H5VL_pass_through_object_specific(void *obj, const H5VL_loc_params_t *loc_params
va_list arguments)
{
H5VL_pass_through_t *o = (H5VL_pass_through_t *)obj;
+ hid_t under_vol_id;
herr_t ret_value;
#ifdef ENABLE_PASSTHRU_LOGGING
printf("------- PASS THROUGH VOL OBJECT Specific\n");
#endif
+ // Save copy of underlying VOL connector ID and prov helper, in case of
+ // refresh destroying the current object
+ under_vol_id = o->under_vol_id;
+
ret_value = H5VLobject_specific(o->under_object, loc_params, o->under_vol_id, specific_type, dxpl_id, req, arguments);
/* Check for async request */
if(req && *req)
- *req = H5VL_pass_through_new_obj(*req, o->under_vol_id);
+ *req = H5VL_pass_through_new_obj(*req, under_vol_id);
return ret_value;
} /* end H5VL_pass_through_object_specific() */
diff --git a/src/H5VLpkg.h b/src/H5VLpkg.h
index bbdb0cc..69e51c2 100644
--- a/src/H5VLpkg.h
+++ b/src/H5VLpkg.h
@@ -28,21 +28,36 @@
/* Other private headers needed by this file */
+
/**************************/
/* Package Private Macros */
/**************************/
+
/****************************/
/* Package Private Typedefs */
/****************************/
+
/*****************************/
/* Package Private Variables */
/*****************************/
+
/******************************/
/* Package Private Prototypes */
/******************************/
+H5_DLL hid_t H5VL__register_connector(const H5VL_class_t *cls, hbool_t app_ref,
+ hid_t vipl_id);
+H5_DLL hid_t H5VL__register_connector_by_name(const char *name, hbool_t app_ref,
+ hid_t vipl_id);
+H5_DLL hid_t H5VL__register_connector_by_value(H5VL_class_value_t value,
+ hbool_t app_ref, hid_t vipl_id);
+H5_DLL htri_t H5VL__is_connector_registered(const char *name);
+H5_DLL hid_t H5VL__get_connector_id(const char *name, hbool_t is_api);
+H5_DLL herr_t H5VL__connector_str_to_info(const char *str, hid_t connector_id,
+ void **info);
+H5_DLL ssize_t H5VL__get_connector_name(hid_t id, char *name/*out*/, size_t size);
#endif /* _H5VLpkg_H */
diff --git a/src/H5VLprivate.h b/src/H5VLprivate.h
index 283c77a..91fa762 100644
--- a/src/H5VLprivate.h
+++ b/src/H5VLprivate.h
@@ -18,10 +18,12 @@
/* Private headers needed by this file */
+
/**************************/
/* Library Private Macros */
/**************************/
+
/****************************/
/* Library Private Typedefs */
/****************************/
@@ -41,8 +43,8 @@ typedef struct H5VL_object_t {
/* Internal structure to hold the connector ID & info for FAPLs */
typedef struct H5VL_connector_prop_t {
- hid_t connector_id; /* VOL connector's ID */
- const void *connector_info; /* VOL connector info, for open callbacks */
+ hid_t connector_id; /* VOL connector's ID */
+ void *connector_info; /* VOL connector info, for open callbacks */
} H5VL_connector_prop_t;
/* Which kind of VOL connector field to use for searching */
@@ -62,14 +64,14 @@ typedef enum H5VL_get_connector_kind_t {
/******************************/
/* Utility functions */
-H5_DLL herr_t H5VL_init(void);
+H5_DLL herr_t H5VL_init_phase1(void);
+H5_DLL herr_t H5VL_init_phase2(void);
H5_DLL herr_t H5VL_cmp_connector_cls(int *cmp_value, const H5VL_class_t *cls1, const H5VL_class_t *cls2);
H5_DLL herr_t H5VL_conn_copy(H5VL_connector_prop_t *value);
H5_DLL herr_t H5VL_conn_free(const H5VL_connector_prop_t *info);
/* Functions that deal with VOL connectors */
H5_DLL hid_t H5VL_register_connector(const void *cls, hbool_t app_ref, hid_t vipl_id);
-H5_DLL ssize_t H5VL_get_connector_name(hid_t id, char *name/*out*/, size_t size);
/* NOTE: The object and ID functions below deal in VOL objects (i.e.;
* H5VL_object_t). Similar non-VOL calls exist in H5Iprivate.h. Use
@@ -84,6 +86,7 @@ H5_DLL ssize_t H5VL_get_connector_name(hid_t id, char *name/*out*/, size_t size)
/* Functions that manipulate VOL objects */
H5_DLL void *H5VL_object(hid_t id);
H5_DLL void *H5VL_object_data(const H5VL_object_t *vol_obj);
+H5_DLL void *H5VL_object_unwrap(const H5VL_object_t *vol_obj);
H5_DLL void *H5VL_object_verify(hid_t id, H5I_type_t obj_type);
H5_DLL H5VL_object_t *H5VL_vol_object(hid_t id);
H5_DLL herr_t H5VL_free_object(H5VL_object_t *obj);
@@ -91,11 +94,20 @@ H5_DLL herr_t H5VL_free_object(H5VL_object_t *obj);
/* Functions that wrap / unwrap VOL objects */
H5_DLL herr_t H5VL_get_wrap_ctx(const H5VL_class_t *connector, void *obj,
void **wrap_ctx);
-H5_DLL herr_t H5VL_free_wrap_ctx(const H5VL_class_t *connector, void *wrap_ctx);
-H5_DLL herr_t H5VL_set_vol_wrapper(void *obj, const H5VL_t *vol_connector);
-H5_DLL herr_t H5VL_reset_vol_wrapper(void);
H5_DLL void * H5VL_wrap_object(const H5VL_class_t *connector, void *wrap_ctx,
void *obj, H5I_type_t obj_type);
+H5_DLL void * H5VL_unwrap_object(const H5VL_class_t *connector, void *obj);
+H5_DLL herr_t H5VL_free_wrap_ctx(const H5VL_class_t *connector, void *wrap_ctx);
+H5_DLL herr_t H5VL_set_vol_wrapper(void *obj, H5VL_t *vol_connector);
+H5_DLL herr_t H5VL_inc_vol_wrapper(void *vol_wrap_ctx);
+H5_DLL herr_t H5VL_dec_vol_wrapper(void *vol_wrap_ctx);
+H5_DLL herr_t H5VL_reset_vol_wrapper(void);
+
+/* Library state functions */
+H5_DLL herr_t H5VL_retrieve_lib_state(void **state);
+H5_DLL herr_t H5VL_restore_lib_state(const void *state);
+H5_DLL herr_t H5VL_reset_lib_state(void);
+H5_DLL herr_t H5VL_free_lib_state(void *state);
/* ID registration functions */
H5_DLL hid_t H5VL_register(H5I_type_t type, void *object, H5VL_t *vol_connector, hbool_t app_ref);
@@ -112,10 +124,10 @@ H5_DLL int H5VL_copy_connector_info(const H5VL_class_t *connector, void **dst_in
const void *src_info);
H5_DLL herr_t H5VL_cmp_connector_info(const H5VL_class_t *connector, int *cmp_value,
const void *info1, const void *info2);
-H5_DLL herr_t H5VL_free_connector_info(const H5VL_class_t *connector, void *info);
+H5_DLL herr_t H5VL_free_connector_info(hid_t connector_id, void *info);
/* Attribute functions */
-H5_DLL void *H5VL_attr_create(const H5VL_object_t *vol_obj, const H5VL_loc_params_t *loc_params, const char *attr_name, hid_t acpl_id, hid_t aapl_id, hid_t dxpl_id, void **req);
+H5_DLL void *H5VL_attr_create(const H5VL_object_t *vol_obj, const H5VL_loc_params_t *loc_params, const char *attr_name, hid_t type_id, hid_t space_id, hid_t acpl_id, hid_t aapl_id, hid_t dxpl_id, void **req);
H5_DLL void *H5VL_attr_open(const H5VL_object_t *vol_obj, const H5VL_loc_params_t *loc_params, const char *name, hid_t aapl_id, hid_t dxpl_id, void **req);
H5_DLL herr_t H5VL_attr_read(const H5VL_object_t *vol_obj, hid_t dtype_id, void *buf, hid_t dxpl_id, void **req);
H5_DLL herr_t H5VL_attr_write(const H5VL_object_t *vol_obj, hid_t dtype_id, const void *buf, hid_t dxpl_id, void **req);
@@ -125,7 +137,7 @@ H5_DLL herr_t H5VL_attr_optional(const H5VL_object_t *vol_obj, hid_t dxpl_id, vo
H5_DLL herr_t H5VL_attr_close(const H5VL_object_t *vol_obj, hid_t dxpl_id, void **req);
/* Dataset functions */
-H5_DLL void *H5VL_dataset_create(const H5VL_object_t *vol_obj, const H5VL_loc_params_t *loc_params, const char *name, hid_t dcpl_id, hid_t dapl_id, hid_t dxpl_id, void **req);
+H5_DLL void *H5VL_dataset_create(const H5VL_object_t *vol_obj, const H5VL_loc_params_t *loc_params, const char *name, hid_t lcpl_id, hid_t type_id, hid_t space_id, hid_t dcpl_id, hid_t dapl_id, hid_t dxpl_id, void **req);
H5_DLL void *H5VL_dataset_open(const H5VL_object_t *vol_obj, const H5VL_loc_params_t *loc_params, const char *name, hid_t dapl_id, hid_t dxpl_id, void **req);
H5_DLL herr_t H5VL_dataset_read(const H5VL_object_t *vol_obj, hid_t mem_type_id, hid_t mem_space_id, hid_t file_space_id, hid_t plist_id, void *buf, void **req);
H5_DLL herr_t H5VL_dataset_write(const H5VL_object_t *vol_obj, hid_t mem_type_id, hid_t mem_space_id, hid_t file_space_id, hid_t plist_id, const void *buf, void **req);
@@ -143,7 +155,7 @@ H5_DLL herr_t H5VL_file_optional(const H5VL_object_t *vol_obj, hid_t dxpl_id, vo
H5_DLL herr_t H5VL_file_close(const H5VL_object_t *vol_obj, hid_t dxpl_id, void **req);
/* Group functions */
-H5_DLL void *H5VL_group_create(const H5VL_object_t *vol_obj, const H5VL_loc_params_t *loc_params, const char *name, hid_t gcpl_id, hid_t gapl_id, hid_t dxpl_id, void **req);
+H5_DLL void *H5VL_group_create(const H5VL_object_t *vol_obj, const H5VL_loc_params_t *loc_params, const char *name, hid_t lcpl_id, hid_t gcpl_id, hid_t gapl_id, hid_t dxpl_id, void **req);
H5_DLL void *H5VL_group_open(const H5VL_object_t *vol_obj, const H5VL_loc_params_t *loc_params, const char *name, hid_t gapl_id, hid_t dxpl_id, void **req);
H5_DLL herr_t H5VL_group_get(const H5VL_object_t *vol_obj, H5VL_group_get_t get_type, hid_t dxpl_id, void **req, ...);
H5_DLL herr_t H5VL_group_specific(const H5VL_object_t *vol_obj, H5VL_group_specific_t specific_type, hid_t dxpl_id, void **req, ...);
@@ -151,7 +163,7 @@ H5_DLL herr_t H5VL_group_optional(const H5VL_object_t *vol_obj, hid_t dxpl_id, v
H5_DLL herr_t H5VL_group_close(const H5VL_object_t *vol_obj, hid_t dxpl_id, void **req);
/* Link functions */
-H5_DLL herr_t H5VL_link_create(H5VL_link_create_type_t create_type, const H5VL_object_t *vol_obj, const H5VL_loc_params_t *loc_params, hid_t lcpl_id, hid_t lapl_id, hid_t dxpl_id, void **req);
+H5_DLL herr_t H5VL_link_create(H5VL_link_create_type_t create_type, const H5VL_object_t *vol_obj, const H5VL_loc_params_t *loc_params, hid_t lcpl_id, hid_t lapl_id, hid_t dxpl_id, void **req, ...);
H5_DLL herr_t H5VL_link_copy(const H5VL_object_t *src_vol_obj, const H5VL_loc_params_t *loc_params1, const H5VL_object_t *dst_vol_obj, const H5VL_loc_params_t *loc_params2, hid_t lcpl_id, hid_t lapl_id, hid_t dxpl_id, void **req);
H5_DLL herr_t H5VL_link_move(const H5VL_object_t *src_vol_obj, const H5VL_loc_params_t *loc_params1, const H5VL_object_t *dst_vol_obj, const H5VL_loc_params_t *loc_params2, hid_t lcpl_id, hid_t lapl_id, hid_t dxpl_id, void **req);
H5_DLL herr_t H5VL_link_get(const H5VL_object_t *vol_obj, const H5VL_loc_params_t *loc_params, H5VL_link_get_t get_type, hid_t dxpl_id, void **req, ...);
diff --git a/src/H5VLpublic.h b/src/H5VLpublic.h
index 6ea9fc1..12448b6 100644
--- a/src/H5VLpublic.h
+++ b/src/H5VLpublic.h
@@ -19,390 +19,29 @@
/* Public headers needed by this file */
#include "H5public.h" /* Generic Functions */
-#include "H5Apublic.h" /* Attributes */
-#include "H5ESpublic.h" /* Event Stack */
-#include "H5Fpublic.h" /* Files */
-#include "H5Ipublic.h" /* IDs */
-#include "H5Lpublic.h" /* Links */
-#include "H5Opublic.h" /* Objects */
-#include "H5Rpublic.h" /* References */
+#include "H5Ipublic.h" /* IDs */
+
+/* Semi-public headers mainly for VOL connector authors */
+#include "H5VLconnector.h"
+#include "H5VLconnector_passthru.h"
/*****************/
/* Public Macros */
/*****************/
-/* Dataset creation property names */
-#define H5VL_PROP_DSET_TYPE_ID "dataset_type_id"
-#define H5VL_PROP_DSET_SPACE_ID "dataset_space_id"
-#define H5VL_PROP_DSET_LCPL_ID "dataset_lcpl_id"
-
-/* Attribute creation property names */
-#define H5VL_PROP_ATTR_TYPE_ID "attr_type_id"
-#define H5VL_PROP_ATTR_SPACE_ID "attr_space_id"
-#define H5VL_PROP_ATTR_LOC_PARAMS "attr_location"
-
-/* Link creation property names */
-#define H5VL_PROP_LINK_TARGET "target_location_object"
-#define H5VL_PROP_LINK_TARGET_LOC_PARAMS "target_params"
-#define H5VL_PROP_LINK_TARGET_NAME "target_name"
-#define H5VL_PROP_LINK_TYPE "link type"
-#define H5VL_PROP_LINK_UDATA "udata"
-#define H5VL_PROP_LINK_UDATA_SIZE "udata size"
-
-/* Group creation property names */
-#define H5VL_PROP_GRP_LCPL_ID "group_lcpl_id"
-
-/* Default VOL connector value */
-#define H5VL_VOL_DEFAULT 0
-
-
-/*******************/
-/* Public Typedefs */
-/*******************/
-
-/* types for attribute GET callback */
-typedef enum H5VL_attr_get_t {
- H5VL_ATTR_GET_ACPL, /* creation property list */
- H5VL_ATTR_GET_INFO, /* info */
- H5VL_ATTR_GET_NAME, /* access property list */
- H5VL_ATTR_GET_SPACE, /* dataspace */
- H5VL_ATTR_GET_STORAGE_SIZE, /* storage size */
- H5VL_ATTR_GET_TYPE /* datatype */
-} H5VL_attr_get_t;
-
-/* types for attribute SPECFIC callback */
-typedef enum H5VL_attr_specific_t {
- H5VL_ATTR_DELETE, /* H5Adelete(_by_name/idx) */
- H5VL_ATTR_EXISTS, /* H5Aexists(_by_name) */
- H5VL_ATTR_ITER, /* H5Aiterate(_by_name) */
- H5VL_ATTR_RENAME /* H5Arename(_by_name) */
-} H5VL_attr_specific_t;
-
-/* types for dataset GET callback */
-typedef enum H5VL_dataset_get_t {
- H5VL_DATASET_GET_DAPL, /* access property list */
- H5VL_DATASET_GET_DCPL, /* creation property list */
- H5VL_DATASET_GET_OFFSET, /* offset */
- H5VL_DATASET_GET_SPACE, /* dataspace */
- H5VL_DATASET_GET_SPACE_STATUS, /* space status */
- H5VL_DATASET_GET_STORAGE_SIZE, /* storage size */
- H5VL_DATASET_GET_TYPE /* datatype */
-} H5VL_dataset_get_t;
-
-/* types for dataset SPECFIC callback */
-typedef enum H5VL_dataset_specific_t {
- H5VL_DATASET_SET_EXTENT, /* H5Dset_extent */
- H5VL_DATASET_FLUSH, /* H5Dflush */
- H5VL_DATASET_REFRESH /* H5Drefresh */
-} H5VL_dataset_specific_t;
-
-/* types for datatype GET callback */
-typedef enum H5VL_datatype_get_t {
- H5VL_DATATYPE_GET_BINARY, /* get serialized form of transient type */
- H5VL_DATATYPE_GET_TCPL /* datatype creation property list */
-} H5VL_datatype_get_t;
-
-/* types for datatype SPECFIC callback */
-typedef enum H5VL_datatype_specific_t {
- H5VL_DATATYPE_FLUSH,
- H5VL_DATATYPE_REFRESH
-} H5VL_datatype_specific_t;
-
-/* types for file GET callback */
-typedef enum H5VL_file_get_t {
- H5VL_FILE_GET_FAPL, /* file access property list */
- H5VL_FILE_GET_FCPL, /* file creation property list */
- H5VL_FILE_GET_INTENT, /* file intent */
- H5VL_FILE_GET_NAME, /* file name */
- H5VL_FILE_GET_OBJ_COUNT, /* object count in file */
- H5VL_FILE_GET_OBJ_IDS /* object ids in file */
-} H5VL_file_get_t;
-
-/* types for file SPECIFIC callback */
-typedef enum H5VL_file_specific_t {
- H5VL_FILE_FLUSH, /* Flush file */
- H5VL_FILE_REOPEN, /* Reopen the file */
- H5VL_FILE_MOUNT, /* Mount a file */
- H5VL_FILE_UNMOUNT, /* Unmount a file */
- H5VL_FILE_IS_ACCESSIBLE /* Check if a file is accessible */
-} H5VL_file_specific_t;
-
-/* types for group GET callback */
-typedef enum H5VL_group_get_t {
- H5VL_GROUP_GET_GCPL, /* group creation property list */
- H5VL_GROUP_GET_INFO /* group info */
-} H5VL_group_get_t;
-
-/* types for group SPECFIC callback */
-typedef enum H5VL_group_specific_t {
- H5VL_GROUP_FLUSH,
- H5VL_GROUP_REFRESH
-} H5VL_group_specific_t;
-
-/* link create types for VOL */
-typedef enum H5VL_link_create_type_t {
- H5VL_LINK_CREATE_HARD,
- H5VL_LINK_CREATE_SOFT,
- H5VL_LINK_CREATE_UD
-} H5VL_link_create_type_t;
-
-/* types for link GET callback */
-typedef enum H5VL_link_get_t {
- H5VL_LINK_GET_INFO, /* link info */
- H5VL_LINK_GET_NAME, /* link name */
- H5VL_LINK_GET_VAL /* link value */
-} H5VL_link_get_t;
-
-/* types for link SPECIFIC callback */
-typedef enum H5VL_link_specific_t {
- H5VL_LINK_DELETE, /* H5Ldelete(_by_idx) */
- H5VL_LINK_EXISTS, /* link existence */
- H5VL_LINK_ITER /* H5Literate/visit(_by_name) */
-} H5VL_link_specific_t;
-
-/* types for object GET callback */
-typedef enum H5VL_object_get_t {
- H5VL_REF_GET_NAME, /* object name, for reference */
- H5VL_REF_GET_REGION, /* dataspace of region */
- H5VL_REF_GET_TYPE, /* type of object */
- H5VL_ID_GET_NAME /* object name, for hid_t */
-} H5VL_object_get_t;
-
-/* types for object SPECIFIC callback */
-typedef enum H5VL_object_specific_t {
- H5VL_OBJECT_CHANGE_REF_COUNT, /* H5Oincr/decr_refcount */
- H5VL_OBJECT_EXISTS, /* H5Oexists_by_name */
- H5VL_OBJECT_VISIT, /* H5Ovisit(_by_name) */
- H5VL_REF_CREATE, /* H5Rcreate */
- H5VL_OBJECT_FLUSH, /* H5{D|G|O|T}flush */
- H5VL_OBJECT_REFRESH /* H5{D|G|O|T}refresh */
-} H5VL_object_specific_t;
-
-/* types for async request SPECIFIC callback */
-typedef enum H5VL_request_specific_t {
- H5VL_REQUEST_WAITANY, /* Wait until any request completes */
- H5VL_REQUEST_WAITSOME, /* Wait until at least one requesst completes */
- H5VL_REQUEST_WAITALL /* Wait until all requests complete */
-} H5VL_request_specific_t;
-
-/* types for different ways that objects are located in an HDF5 container */
-typedef enum H5VL_loc_type_t {
- H5VL_OBJECT_BY_SELF,
- H5VL_OBJECT_BY_NAME,
- H5VL_OBJECT_BY_IDX,
- H5VL_OBJECT_BY_ADDR,
- H5VL_OBJECT_BY_REF
-} H5VL_loc_type_t;
-
-struct H5VL_loc_by_name {
- const char *name;
- hid_t lapl_id;
-};
-
-struct H5VL_loc_by_idx {
- const char *name;
- H5_index_t idx_type;
- H5_iter_order_t order;
- hsize_t n;
- hid_t lapl_id;
-};
-
-struct H5VL_loc_by_addr {
- haddr_t addr;
-};
-
-struct H5VL_loc_by_ref {
- H5R_type_t ref_type;
- const void *_ref;
- hid_t lapl_id;
-};
-
-/* Structure to hold parameters for object locations.
- * either: BY_ADDR, BY_ID, BY_NAME, BY_IDX, BY_REF
- *
- * Note: Leave loc_by_addr as the first union member so we
- * can perform the simplest initialization of the struct
- * without raising warnings.
- */
-typedef struct H5VL_loc_params_t {
- H5I_type_t obj_type;
- H5VL_loc_type_t type;
- union{
- struct H5VL_loc_by_addr loc_by_addr;
- struct H5VL_loc_by_name loc_by_name;
- struct H5VL_loc_by_idx loc_by_idx;
- struct H5VL_loc_by_ref loc_by_ref;
- } loc_data;
-} H5VL_loc_params_t;
-
-/* H5A routines */
-typedef struct H5VL_attr_class_t {
- void *(*create)(void *obj, const H5VL_loc_params_t *loc_params, const char *attr_name,
- hid_t acpl_id, hid_t aapl_id, hid_t dxpl_id, void **req);
- void *(*open)(void *obj, const H5VL_loc_params_t *loc_params, const char *attr_name,
- hid_t aapl_id, hid_t dxpl_id, void **req);
- herr_t (*read)(void *attr, hid_t mem_type_id, void *buf, hid_t dxpl_id, void **req);
- herr_t (*write)(void *attr, hid_t mem_type_id, const void *buf, hid_t dxpl_id, void **req);
- herr_t (*get)(void *obj, H5VL_attr_get_t get_type, hid_t dxpl_id, void **req, va_list arguments);
- herr_t (*specific)(void *obj, const H5VL_loc_params_t *loc_params, H5VL_attr_specific_t specific_type,
- hid_t dxpl_id, void **req, va_list arguments);
- herr_t (*optional)(void *obj, hid_t dxpl_id, void **req, va_list arguments);
- herr_t (*close) (void *attr, hid_t dxpl_id, void **req);
-} H5VL_attr_class_t;
-
-/* H5D routines */
-typedef struct H5VL_dataset_class_t {
- void *(*create)(void *obj, const H5VL_loc_params_t *loc_params, const char *name,
- hid_t dcpl_id, hid_t dapl_id, hid_t dxpl_id, void **req);
- void *(*open)(void *obj, const H5VL_loc_params_t *loc_params, const char *name,
- hid_t dapl_id, hid_t dxpl_id, void **req);
- herr_t (*read)(void *dset, hid_t mem_type_id, hid_t mem_space_id, hid_t file_space_id,
- hid_t xfer_plist_id, void * buf, void **req);
- herr_t (*write)(void *dset, hid_t mem_type_id, hid_t mem_space_id, hid_t file_space_id,
- hid_t xfer_plist_id, const void * buf, void **req);
- herr_t (*get)(void *obj, H5VL_dataset_get_t get_type, hid_t dxpl_id, void **req, va_list arguments);
- herr_t (*specific)(void *obj, H5VL_dataset_specific_t specific_type,
- hid_t dxpl_id, void **req, va_list arguments);
- herr_t (*optional)(void *obj, hid_t dxpl_id, void **req, va_list arguments);
- herr_t (*close) (void *dset, hid_t dxpl_id, void **req);
-} H5VL_dataset_class_t;
-
-/* H5T routines*/
-typedef struct H5VL_datatype_class_t {
- void *(*commit)(void *obj, const H5VL_loc_params_t *loc_params, const char *name, hid_t type_id,
- hid_t lcpl_id, hid_t tcpl_id, hid_t tapl_id, hid_t dxpl_id, void **req);
- void *(*open)(void *obj, const H5VL_loc_params_t *loc_params, const char * name,
- hid_t tapl_id, hid_t dxpl_id, void **req);
- herr_t (*get) (void *obj, H5VL_datatype_get_t get_type, hid_t dxpl_id, void **req, va_list arguments);
- herr_t (*specific)(void *obj, H5VL_datatype_specific_t specific_type,
- hid_t dxpl_id, void **req, va_list arguments);
- herr_t (*optional)(void *obj, hid_t dxpl_id, void **req, va_list arguments);
- herr_t (*close) (void *dt, hid_t dxpl_id, void **req);
-} H5VL_datatype_class_t;
-
-/* H5F routines */
-typedef struct H5VL_file_class_t {
- void *(*create)(const char *name, unsigned flags, hid_t fcpl_id,
- hid_t fapl_id, hid_t dxpl_id, void **req);
- void *(*open)(const char *name, unsigned flags, hid_t fapl_id, hid_t dxpl_id, void **req);
- herr_t (*get)(void *obj, H5VL_file_get_t get_type, hid_t dxpl_id, void **req, va_list arguments);
- herr_t (*specific)(void *obj, H5VL_file_specific_t specific_type,
- hid_t dxpl_id, void **req, va_list arguments);
- herr_t (*optional)(void *obj, hid_t dxpl_id, void **req, va_list arguments);
- herr_t (*close) (void *file, hid_t dxpl_id, void **req);
-} H5VL_file_class_t;
-
-/* H5G routines */
-typedef struct H5VL_group_class_t {
- void *(*create)(void *obj, const H5VL_loc_params_t *loc_params, const char *name,
- hid_t gcpl_id, hid_t gapl_id, hid_t dxpl_id, void **req);
- void *(*open)(void *obj, const H5VL_loc_params_t *loc_params, const char *name,
- hid_t gapl_id, hid_t dxpl_id, void **req);
- herr_t (*get)(void *obj, H5VL_group_get_t get_type, hid_t dxpl_id, void **req, va_list arguments);
- herr_t (*specific)(void *obj, H5VL_group_specific_t specific_type,
- hid_t dxpl_id, void **req, va_list arguments);
- herr_t (*optional)(void *obj, hid_t dxpl_id, void **req, va_list arguments);
- herr_t (*close) (void *grp, hid_t dxpl_id, void **req);
-} H5VL_group_class_t;
-
-/* H5L routines */
-typedef struct H5VL_link_class_t {
- herr_t (*create)(H5VL_link_create_type_t create_type, void *obj, const H5VL_loc_params_t *loc_params,
- hid_t lcpl_id, hid_t lapl_id, hid_t dxpl_id, void **req);
- herr_t (*copy)(void *src_obj, const H5VL_loc_params_t *loc_params1,
- void *dst_obj, const H5VL_loc_params_t *loc_params2,
- hid_t lcpl, hid_t lapl, hid_t dxpl_id, void **req);
- herr_t (*move)(void *src_obj, const H5VL_loc_params_t *loc_params1,
- void *dst_obj, const H5VL_loc_params_t *loc_params2,
- hid_t lcpl, hid_t lapl, hid_t dxpl_id, void **req);
- herr_t (*get)(void *obj, const H5VL_loc_params_t *loc_params, H5VL_link_get_t get_type,
- hid_t dxpl_id, void **req, va_list arguments);
- herr_t (*specific)(void *obj, const H5VL_loc_params_t *loc_params, H5VL_link_specific_t specific_type,
- hid_t dxpl_id, void **req, va_list arguments);
- herr_t (*optional)(void *obj, hid_t dxpl_id, void **req, va_list arguments);
-} H5VL_link_class_t;
-
-/* H5O routines */
-typedef struct H5VL_object_class_t {
- void *(*open)(void *obj, const H5VL_loc_params_t *loc_params, H5I_type_t *opened_type,
- hid_t dxpl_id, void **req);
- herr_t (*copy)(void *src_obj, const H5VL_loc_params_t *loc_params1, const char *src_name,
- void *dst_obj, const H5VL_loc_params_t *loc_params2, const char *dst_name,
- hid_t ocpypl_id, hid_t lcpl_id, hid_t dxpl_id, void **req);
- herr_t (*get)(void *obj, const H5VL_loc_params_t *loc_params, H5VL_object_get_t get_type,
- hid_t dxpl_id, void **req, va_list arguments);
- herr_t (*specific)(void *obj, const H5VL_loc_params_t *loc_params, H5VL_object_specific_t specific_type,
- hid_t dxpl_id, void **req, va_list arguments);
- herr_t (*optional)(void *obj, hid_t dxpl_id, void **req, va_list arguments);
-} H5VL_object_class_t;
-
-/* Asynchronous request 'notify' callback */
-typedef herr_t (*H5VL_request_notify_t)(void *ctx, H5ES_status_t status);
-
-/* Async request operation routines */
-typedef struct H5VL_request_class_t {
- herr_t (*wait)(void *req, uint64_t timeout, H5ES_status_t *status);
- herr_t (*notify)(void *req, H5VL_request_notify_t cb, void *ctx);
- herr_t (*cancel)(void *req);
- herr_t (*specific)(void *req, H5VL_request_specific_t specific_type, va_list arguments);
- herr_t (*optional)(void *req, va_list arguments);
- herr_t (*free)(void *req);
-} H5VL_request_class_t;
-
-/*
- * VOL connector identifiers. Values 0 through 255 are for connectors defined
- * by the HDF5 library. Values 256 through 511 are available for testing new
- * filters. Subsequent values should be obtained from the HDF5 development
- * team at help@hdfgroup.org.
+/* VOL connector identifier values
+ * These are H5VL_class_value_t values, NOT hid_t values!
*/
-typedef int H5VL_class_value_t;
-
-/* VOL connector identifier values */
#define H5_VOL_INVALID (-1) /* Invalid ID for VOL connector iD */
-#define H5_VOL_NATIVE 0 /* Native HDF5 file formnat VOL connector */
+#define H5_VOL_NATIVE 0 /* Native HDF5 file format VOL connector */
#define H5_VOL_RESERVED 256 /* VOL connector IDs below this value are reserved for library use */
-#define H5_VOL_MAX 65535 /* Maximum VOL connector ID */
-
-/* Capability flags for connector */
-#define H5VL_CAP_FLAG_NONE 0 /* No special connector capabilities */
-#define H5VL_CAP_FLAG_THREADSAFE 0x01 /* Connector is threadsafe */
+#define H5_VOL_MAX 65535 /* Maximum VOL connector ID */
-/* Class information for each VOL connector */
-typedef struct H5VL_class_t {
- unsigned int version; /* VOL connector class struct version # */
- H5VL_class_value_t value; /* Value to identify connector */
- const char *name; /* Connector name (MUST be unique!) */
- unsigned cap_flags; /* Capability flags for connector */
- herr_t (*initialize)(hid_t vipl_id); /* Connector initialization callback */
- herr_t (*terminate)(void); /* Connector termination callback */
- size_t info_size; /* Size of the VOL info */
- void * (*info_copy)(const void *info); /* Callback to create a copy of the VOL info */
- herr_t (*info_cmp)(int *cmp_value, const void *info1, const void *info2); /* Callback to compare VOL info */
- herr_t (*info_free)(void *info); /* Callback to release the VOL info copy */
- herr_t (*info_to_str)(const void *info, char **str); /* Callback to serialize connector's info into a string */
- herr_t (*str_to_info)(const char *str, void **info); /* Callback to deserialize a string into connector's info */
- void * (*get_object)(const void *obj); /* Callback to retrieve underlying object */
- herr_t (*get_wrap_ctx)(const void *obj, void **wrap_ctx); /* Callback to retrieve the object wrapping context for the connector */
- void* (*wrap_object)(void *obj, H5I_type_t obj_type, void *wrap_ctx); /* Callback to wrap a library object */
- herr_t (*free_wrap_ctx)(void *wrap_ctx); /* Callback to release the object wrapping context for the connector */
-
- /* Data Model */
- H5VL_attr_class_t attr_cls; /* attribute class callbacks */
- H5VL_dataset_class_t dataset_cls; /* dataset class callbacks */
- H5VL_datatype_class_t datatype_cls; /* datatype class callbacks */
- H5VL_file_class_t file_cls; /* file class callbacks */
- H5VL_group_class_t group_cls; /* group class callbacks */
- H5VL_link_class_t link_cls; /* link class callbacks */
- H5VL_object_class_t object_cls; /* object class callbacks */
-
- /* Services */
- H5VL_request_class_t request_cls; /* asynchronous request class callbacks */
-
- /* Catch-all */
- herr_t (*optional)(void *obj, hid_t dxpl_id, void **req, va_list arguments); /* Optional callback */
-} H5VL_class_t;
+/*******************/
+/* Public Typedefs */
+/*******************/
/********************/
/* Public Variables */
@@ -416,7 +55,10 @@ typedef struct H5VL_class_t {
extern "C" {
#endif
-/* VOL Connector Functionality */
+/* The H5VL types uses in the API calls are not opaque - they are defined in
+ * H5VLconnector.h, which is included at the top of this file.
+ */
+
H5_DLL hid_t H5VLregister_connector(const H5VL_class_t *cls, hid_t vipl_id);
H5_DLL hid_t H5VLregister_connector_by_name(const char *connector_name, hid_t vipl_id);
H5_DLL hid_t H5VLregister_connector_by_value(H5VL_class_value_t connector_value, hid_t vipl_id);
@@ -427,107 +69,6 @@ H5_DLL herr_t H5VLclose(hid_t connector_id);
H5_DLL herr_t H5VLunregister_connector(hid_t connector_id);
-/*****************************************************************************
- * VOL callback wrappers and helper routines, for _VOL_connector_ authors only! *
- * (Not part of the public API for _application_ developers) *
- *****************************************************************************/
-
-/* Helper routines for VOL connector authors */
-H5_DLL herr_t H5VLcmp_connector_cls(int *cmp, hid_t connector_id1, hid_t connector_id2);
-H5_DLL hid_t H5VLwrap_register(void *obj, H5I_type_t type);
-H5_DLL void *H5VLobject(hid_t obj_id);
-
-
-/* Public wrappers for generic callbacks */
-H5_DLL herr_t H5VLinitialize(hid_t connector_id, hid_t vipl_id);
-H5_DLL herr_t H5VLterminate(hid_t connector_id);
-H5_DLL herr_t H5VLget_cap_flags(hid_t connector_id, unsigned *cap_flags);
-H5_DLL herr_t H5VLget_value(hid_t connector_id, H5VL_class_value_t *conn_value);
-H5_DLL herr_t H5VLcopy_connector_info(hid_t connector_id, void **dst_vol_info, void *src_vol_info);
-H5_DLL herr_t H5VLcmp_connector_info(int *cmp, hid_t connector_id, const void *info1,
- const void *info2);
-H5_DLL herr_t H5VLfree_connector_info(hid_t connector_id, void *vol_info);
-H5_DLL herr_t H5VLconnector_info_to_str(const void *info, hid_t connector_id, char **str);
-H5_DLL herr_t H5VLconnector_str_to_info(const char *str, hid_t connector_id, void **info);
-H5_DLL void *H5VLget_object(void *obj, hid_t connector_id);
-H5_DLL herr_t H5VLget_wrap_ctx(void *obj, hid_t connector_id, void **wrap_ctx);
-H5_DLL void *H5VLwrap_object(void *obj, H5I_type_t obj_type, hid_t connector_id,
- void *wrap_ctx);
-H5_DLL herr_t H5VLfree_wrap_ctx(void *wrap_ctx, hid_t connector_id);
-
-/* Public wrappers for attribute callbacks */
-H5_DLL void *H5VLattr_create(void *obj, const H5VL_loc_params_t *loc_params, hid_t connector_id, const char *attr_name, hid_t acpl_id, hid_t aapl_id, hid_t dxpl_id, void **req);
-H5_DLL void *H5VLattr_open(void *obj, const H5VL_loc_params_t *loc_params, hid_t connector_id, const char *name, hid_t aapl_id, hid_t dxpl_id, void **req);
-H5_DLL herr_t H5VLattr_read(void *attr, hid_t connector_id, hid_t dtype_id, void *buf, hid_t dxpl_id, void **req);
-H5_DLL herr_t H5VLattr_write(void *attr, hid_t connector_id, hid_t dtype_id, const void *buf, hid_t dxpl_id, void **req);
-H5_DLL herr_t H5VLattr_get(void *obj, hid_t connector_id, H5VL_attr_get_t get_type, hid_t dxpl_id, void **req, va_list arguments);
-H5_DLL herr_t H5VLattr_specific(void *obj, const H5VL_loc_params_t *loc_params, hid_t connector_id, H5VL_attr_specific_t specific_type, hid_t dxpl_id, void **req, va_list arguments);
-H5_DLL herr_t H5VLattr_optional(void *obj, hid_t connector_id, hid_t dxpl_id, void **req, va_list arguments);
-H5_DLL herr_t H5VLattr_close(void *attr, hid_t connector_id, hid_t dxpl_id, void **req);
-
-/* Public wrappers for dataset callbacks */
-H5_DLL void *H5VLdataset_create(void *obj, const H5VL_loc_params_t *loc_params, hid_t connector_id, const char *name, hid_t dcpl_id, hid_t dapl_id, hid_t dxpl_id, void **req);
-H5_DLL void *H5VLdataset_open(void *obj, const H5VL_loc_params_t *loc_params, hid_t connector_id, const char *name, hid_t dapl_id, hid_t dxpl_id, void **req);
-H5_DLL herr_t H5VLdataset_read(void *dset, hid_t connector_id, hid_t mem_type_id, hid_t mem_space_id, hid_t file_space_id, hid_t plist_id, void *buf, void **req);
-H5_DLL herr_t H5VLdataset_write(void *dset, hid_t connector_id, hid_t mem_type_id, hid_t mem_space_id, hid_t file_space_id, hid_t plist_id, const void *buf, void **req);
-H5_DLL herr_t H5VLdataset_get(void *dset, hid_t connector_id, H5VL_dataset_get_t get_type, hid_t dxpl_id, void **req, va_list arguments);
-H5_DLL herr_t H5VLdataset_specific(void *obj, hid_t connector_id, H5VL_dataset_specific_t specific_type, hid_t dxpl_id, void **req, va_list arguments);
-H5_DLL herr_t H5VLdataset_optional(void *obj, hid_t connector_id, hid_t dxpl_id, void **req, va_list arguments);
-H5_DLL herr_t H5VLdataset_close(void *dset, hid_t connector_id, hid_t dxpl_id, void **req);
-
-/* Public wrappers for file callbacks */
-H5_DLL void *H5VLfile_create(const char *name, unsigned flags, hid_t fcpl_id, hid_t fapl_id, hid_t dxpl_id, void **req);
-H5_DLL void *H5VLfile_open(const char *name, unsigned flags, hid_t fapl_id, hid_t dxpl_id, void **req);
-H5_DLL herr_t H5VLfile_get(void *file, hid_t connector_id, H5VL_file_get_t get_type, hid_t dxpl_id, void **req, va_list arguments);
-H5_DLL herr_t H5VLfile_specific(void *obj, hid_t connector_id, H5VL_file_specific_t specific_type, hid_t dxpl_id, void **req, va_list arguments);
-H5_DLL herr_t H5VLfile_optional(void *obj, hid_t connector_id, hid_t dxpl_id, void **req, va_list arguments);
-H5_DLL herr_t H5VLfile_close(void *file, hid_t connector_id, hid_t dxpl_id, void **req);
-
-/* Public wrappers for group callbacks */
-H5_DLL void *H5VLgroup_create(void *obj, const H5VL_loc_params_t *loc_params, hid_t connector_id, const char *name, hid_t gcpl_id, hid_t gapl_id, hid_t dxpl_id, void **req);
-H5_DLL void *H5VLgroup_open(void *obj, const H5VL_loc_params_t *loc_params, hid_t connector_id, const char *name, hid_t gapl_id, hid_t dxpl_id, void **req);
-H5_DLL herr_t H5VLgroup_get(void *obj, hid_t connector_id, H5VL_group_get_t get_type, hid_t dxpl_id, void **req, va_list arguments);
-H5_DLL herr_t H5VLgroup_specific(void *obj, hid_t connector_id, H5VL_group_specific_t specific_type, hid_t dxpl_id, void **req, va_list arguments);
-H5_DLL herr_t H5VLgroup_optional(void *obj, hid_t connector_id, hid_t dxpl_id, void **req, va_list arguments);
-H5_DLL herr_t H5VLgroup_close(void *grp, hid_t connector_id, hid_t dxpl_id, void **req);
-
-/* Public wrappers for link callbacks */
-H5_DLL herr_t H5VLlink_create(H5VL_link_create_type_t create_type, void *obj, const H5VL_loc_params_t *loc_params, hid_t connector_id, hid_t lcpl_id, hid_t lapl_id, hid_t dxpl_id, void **req);
-H5_DLL herr_t H5VLlink_copy(void *src_obj, const H5VL_loc_params_t *loc_params1,
- void *dst_obj, const H5VL_loc_params_t *loc_params2, hid_t connector_id,
- hid_t lcpl_id, hid_t lapl_id, hid_t dxpl_id, void **req);
-H5_DLL herr_t H5VLlink_move(void *src_obj, const H5VL_loc_params_t *loc_params1,
- void *dst_obj, const H5VL_loc_params_t *loc_params2, hid_t connector_id,
- hid_t lcpl_id, hid_t lapl_id, hid_t dxpl_id, void **req);
-H5_DLL herr_t H5VLlink_get(void *obj, const H5VL_loc_params_t *loc_params, hid_t connector_id, H5VL_link_get_t get_type, hid_t dxpl_id, void **req, va_list arguments);
-H5_DLL herr_t H5VLlink_specific(void *obj, const H5VL_loc_params_t *loc_params, hid_t connector_id, H5VL_link_specific_t specific_type, hid_t dxpl_id, void **req, va_list arguments);
-H5_DLL herr_t H5VLlink_optional(void *obj, hid_t connector_id, hid_t dxpl_id, void **req, va_list arguments);
-
-/* Public wrappers for object callbacks */
-H5_DLL void *H5VLobject_open(void *obj, const H5VL_loc_params_t *loc_params, hid_t connector_id, H5I_type_t *opened_type, hid_t dxpl_id, void **req);
-H5_DLL herr_t H5VLobject_copy(void *src_obj, const H5VL_loc_params_t *loc_params1, const char *src_name,
- void *dst_obj, const H5VL_loc_params_t *loc_params2, const char *dst_name,
- hid_t connector_id, hid_t ocpypl_id, hid_t lcpl_id, hid_t dxpl_id, void **req);
-H5_DLL herr_t H5VLobject_get(void *obj, const H5VL_loc_params_t *loc_params, hid_t connector_id, H5VL_object_get_t get_type, hid_t dxpl_id, void **req, va_list arguments);
-H5_DLL herr_t H5VLobject_specific(void *obj, const H5VL_loc_params_t *loc_params, hid_t connector_id, H5VL_object_specific_t specific_type, hid_t dxpl_id, void **req, va_list arguments);
-H5_DLL herr_t H5VLobject_optional(void *obj, hid_t connector_id, hid_t dxpl_id, void **req, va_list arguments);
-
-/* Public wrappers for named datatype callbacks */
-H5_DLL void *H5VLdatatype_commit(void *obj, const H5VL_loc_params_t *loc_params, hid_t connector_id, const char *name, hid_t type_id, hid_t lcpl_id, hid_t tcpl_id, hid_t tapl_id, hid_t dxpl_id, void **req);
-H5_DLL void *H5VLdatatype_open(void *obj, const H5VL_loc_params_t *loc_params, hid_t connector_id, const char *name, hid_t tapl_id, hid_t dxpl_id, void **req);
-H5_DLL herr_t H5VLdatatype_get(void *dt, hid_t connector_id, H5VL_datatype_get_t get_type, hid_t dxpl_id, void **req, va_list arguments);
-H5_DLL herr_t H5VLdatatype_specific(void *obj, hid_t connector_id, H5VL_datatype_specific_t specific_type, hid_t dxpl_id, void **req, va_list arguments);
-H5_DLL herr_t H5VLdatatype_optional(void *obj, hid_t connector_id, hid_t dxpl_id, void **req, va_list arguments);
-H5_DLL herr_t H5VLdatatype_close(void *dt, hid_t connector_id, hid_t dxpl_id, void **req);
-
-/* Public wrappers for asynchronous request callbacks */
-H5_DLL herr_t H5VLrequest_wait(void *req, hid_t connector_id, uint64_t timeout, H5ES_status_t *status);
-H5_DLL herr_t H5VLrequest_notify(void *req, hid_t connector_id, H5VL_request_notify_t cb, void *ctx);
-H5_DLL herr_t H5VLrequest_cancel(void *req, hid_t connector_id);
-H5_DLL herr_t H5VLrequest_specific(void *req, hid_t connector_id, H5VL_request_specific_t specific_type, va_list arguments);
-H5_DLL herr_t H5VLrequest_optional(void *req, hid_t connector_id, va_list arguments);
-H5_DLL herr_t H5VLrequest_free(void *req, hid_t connector_id);
-
#ifdef __cplusplus
}
#endif
diff --git a/src/H5VM.c b/src/H5VM.c
index 452d378..f78da96 100644
--- a/src/H5VM.c
+++ b/src/H5VM.c
@@ -19,6 +19,7 @@
#include "H5private.h"
#include "H5Eprivate.h"
+#include "H5MMprivate.h" /* Memory management */
#include "H5Oprivate.h"
#include "H5VMprivate.h"
@@ -732,7 +733,7 @@ H5VM_stride_copy(unsigned n, hsize_t elmt_size, const hsize_t *size,
/* Copy an element */
H5_CHECK_OVERFLOW(elmt_size,hsize_t,size_t);
- HDmemcpy(dst, src, (size_t)elmt_size); /*lint !e671 The elmt_size will be OK */
+ H5MM_memcpy(dst, src, (size_t)elmt_size); /*lint !e671 The elmt_size will be OK */
/* Decrement indices and advance pointers */
for (j=(int)(n-1), carry=TRUE; j>=0 && carry; --j) {
@@ -749,7 +750,7 @@ H5VM_stride_copy(unsigned n, hsize_t elmt_size, const hsize_t *size,
}
} else {
H5_CHECK_OVERFLOW(elmt_size,hsize_t,size_t);
- HDmemcpy (dst, src, (size_t)elmt_size); /*lint !e671 The elmt_size will be OK */
+ H5MM_memcpy (dst, src, (size_t)elmt_size); /*lint !e671 The elmt_size will be OK */
}
FUNC_LEAVE_NOAPI(SUCCEED)
@@ -801,7 +802,7 @@ H5VM_stride_copy_s(unsigned n, hsize_t elmt_size, const hsize_t *size,
/* Copy an element */
H5_CHECK_OVERFLOW(elmt_size,hsize_t,size_t);
- HDmemcpy(dst, src, (size_t)elmt_size); /*lint !e671 The elmt_size will be OK */
+ H5MM_memcpy(dst, src, (size_t)elmt_size); /*lint !e671 The elmt_size will be OK */
/* Decrement indices and advance pointers */
for (j=(int)(n-1), carry=TRUE; j>=0 && carry; --j) {
@@ -818,7 +819,7 @@ H5VM_stride_copy_s(unsigned n, hsize_t elmt_size, const hsize_t *size,
}
} else {
H5_CHECK_OVERFLOW(elmt_size,hsize_t,size_t);
- HDmemcpy (dst, src, (size_t)elmt_size); /*lint !e671 The elmt_size will be OK */
+ H5MM_memcpy (dst, src, (size_t)elmt_size); /*lint !e671 The elmt_size will be OK */
}
FUNC_LEAVE_NOAPI(SUCCEED)
@@ -877,7 +878,7 @@ H5VM_stride_copy2(hsize_t nelmts, hsize_t elmt_size,
/* Copy an element */
H5_CHECK_OVERFLOW(elmt_size,hsize_t,size_t);
- HDmemcpy(dst, src, (size_t)elmt_size); /*lint !e671 The elmt_size will be OK */
+ H5MM_memcpy(dst, src, (size_t)elmt_size); /*lint !e671 The elmt_size will be OK */
/* Decrement indices and advance pointers */
for (j=(int)(dst_n-1), carry=TRUE; j>=0 && carry; --j) {
@@ -936,7 +937,7 @@ H5VM_array_fill(void *_dst, const void *src, size_t size, size_t count)
HDassert(size < SIZET_MAX && size > 0);
HDassert(count < SIZET_MAX && count > 0);
- HDmemcpy(dst, src, size); /* copy first item */
+ H5MM_memcpy(dst, src, size); /* copy first item */
/* Initialize counters, etc. while compensating for first element copied */
copy_size = size;
@@ -947,7 +948,7 @@ H5VM_array_fill(void *_dst, const void *src, size_t size, size_t count)
/* copy until we've copied at least half of the items */
while (items_left >= copy_items)
{
- HDmemcpy(dst, _dst, copy_size); /* copy the current chunk */
+ H5MM_memcpy(dst, _dst, copy_size); /* copy the current chunk */
dst += copy_size; /* move the offset for the next chunk */
items_left -= copy_items; /* decrement the number of items left */
@@ -955,7 +956,7 @@ H5VM_array_fill(void *_dst, const void *src, size_t size, size_t count)
copy_items *= 2; /* increase the count of items we are copying */
} /* end while */
if (items_left > 0) /* if there are any items left to copy */
- HDmemcpy(dst, _dst, items_left * size);
+ H5MM_memcpy(dst, _dst, items_left * size);
FUNC_LEAVE_NOAPI(SUCCEED)
} /* H5VM_array_fill() */
@@ -1623,7 +1624,7 @@ src_smaller:
acc_len = 0;
do {
/* Copy data */
- HDmemcpy(dst, src, tmp_src_len);
+ H5MM_memcpy(dst, src, tmp_src_len);
/* Accumulate number of bytes copied */
acc_len += tmp_src_len;
@@ -1666,7 +1667,7 @@ dst_smaller:
acc_len = 0;
do {
/* Copy data */
- HDmemcpy(dst, src, tmp_dst_len);
+ H5MM_memcpy(dst, src, tmp_dst_len);
/* Accumulate number of bytes copied */
acc_len += tmp_dst_len;
@@ -1709,7 +1710,7 @@ equal:
acc_len = 0;
do {
/* Copy data */
- HDmemcpy(dst, src, tmp_dst_len);
+ H5MM_memcpy(dst, src, tmp_dst_len);
/* Accumulate number of bytes copied */
acc_len += tmp_dst_len;
diff --git a/src/H5VMprivate.h b/src/H5VMprivate.h
index decac7e..26f59e2 100644
--- a/src/H5VMprivate.h
+++ b/src/H5VMprivate.h
@@ -21,6 +21,7 @@
/* Private headers needed by this file */
#include "H5private.h" /* Generic Functions */
#include "H5Eprivate.h" /* Error handling */
+#include "H5MMprivate.h" /* Memory management */
/* Vector-Vector sequence operation callback */
typedef herr_t (*H5VM_opvv_func_t)(hsize_t dst_off, hsize_t src_off,
@@ -41,7 +42,7 @@ typedef herr_t (*H5VM_opvv_func_t)(hsize_t dst_off, hsize_t src_off,
/* Other functions */
#define H5VM_vector_cpy(N,DST,SRC) { \
HDassert(sizeof(*(DST))==sizeof(*(SRC))); \
- if (SRC) HDmemcpy (DST, SRC, (N)*sizeof(*(DST))); \
+ if (SRC) H5MM_memcpy (DST, SRC, (N)*sizeof(*(DST))); \
else HDmemset (DST, 0, (N)*sizeof(*(DST))); \
}
diff --git a/src/H5Z.c b/src/H5Z.c
index f41588f..b703958 100644
--- a/src/H5Z.c
+++ b/src/H5Z.c
@@ -322,7 +322,7 @@ H5Z_register (const H5Z_class2_t *cls)
/* Initialize */
i = H5Z_table_used_g++;
- HDmemcpy(H5Z_table_g+i, cls, sizeof(H5Z_class2_t));
+ H5MM_memcpy(H5Z_table_g+i, cls, sizeof(H5Z_class2_t));
#ifdef H5Z_DEBUG
HDmemset(H5Z_stat_table_g+i, 0, sizeof(H5Z_stats_t));
#endif /* H5Z_DEBUG */
@@ -330,7 +330,7 @@ H5Z_register (const H5Z_class2_t *cls)
/* Filter already registered */
else {
/* Replace old contents */
- HDmemcpy(H5Z_table_g+i, cls, sizeof(H5Z_class2_t));
+ H5MM_memcpy(H5Z_table_g+i, cls, sizeof(H5Z_class2_t));
} /* end else */
done:
@@ -611,7 +611,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/H5Zfletcher32.c b/src/H5Zfletcher32.c
index 4cd77ef..4d75d14 100644
--- a/src/H5Zfletcher32.c
+++ b/src/H5Zfletcher32.c
@@ -108,7 +108,7 @@ H5Z_filter_fletcher32 (unsigned flags, size_t H5_ATTR_UNUSED cd_nelmts, const un
* system. We'll check both the correct checksum and the wrong
* checksum to be consistent with Release 1.6.2 and before.
*/
- HDmemcpy(c, &fletcher, (size_t)4);
+ H5MM_memcpy(c, &fletcher, (size_t)4);
tmp = c[1];
c[1] = c[0];
@@ -118,7 +118,7 @@ H5Z_filter_fletcher32 (unsigned flags, size_t H5_ATTR_UNUSED cd_nelmts, const un
c[3] = c[2];
c[2] = tmp;
- HDmemcpy(&reversed_fletcher, c, (size_t)4);
+ H5MM_memcpy(&reversed_fletcher, c, (size_t)4);
/* Verify computed checksum matches stored checksum */
if(stored_fletcher != fletcher && stored_fletcher != reversed_fletcher)
@@ -140,7 +140,7 @@ H5Z_filter_fletcher32 (unsigned flags, size_t H5_ATTR_UNUSED cd_nelmts, const un
dst = (unsigned char *) outbuf;
/* Copy raw data */
- HDmemcpy((void*)dst, (void*)(*buf), nbytes);
+ H5MM_memcpy((void*)dst, (void*)(*buf), nbytes);
/* Append checksum to raw data for storage */
dst += nbytes;
diff --git a/src/H5Zscaleoffset.c b/src/H5Zscaleoffset.c
index cdf31a4..d3e8fc0 100644
--- a/src/H5Zscaleoffset.c
+++ b/src/H5Zscaleoffset.c
@@ -141,7 +141,7 @@ H5Z_class2_t H5Z_SCALEOFFSET[1] = {{
} /* end if */ \
\
/* Copy the value */ \
- HDmemcpy(&_cd_value, _fv_p, _copy_size); \
+ H5MM_memcpy(&_cd_value, _fv_p, _copy_size); \
(cd_values)[_i] = (unsigned)_cd_value; \
\
/* Next field */ \
@@ -158,7 +158,7 @@ H5Z_class2_t H5Z_SCALEOFFSET[1] = {{
_fv_p = ((char *)&(fill_val)) + sizeof(type) - MIN(4, _size_rem); \
while(_size_rem >= 4) { \
/* Copy the value */ \
- HDmemcpy(&_cd_value, _fv_p, _copy_size); \
+ H5MM_memcpy(&_cd_value, _fv_p, _copy_size); \
(cd_values)[_i] = (unsigned)_cd_value; \
\
/* Next field */ \
@@ -176,7 +176,7 @@ H5Z_class2_t H5Z_SCALEOFFSET[1] = {{
* _cd_value as it will not be fully overwritten and copy to the end \
* of _cd value as it is BE. */ \
_cd_value = (uint32_t)0; \
- HDmemcpy((char *)&_cd_value + 4 - _size_rem, _fv_p, _size_rem); \
+ H5MM_memcpy((char *)&_cd_value + 4 - _size_rem, _fv_p, _size_rem); \
(cd_values)[_i] = (unsigned)_cd_value; \
} /* end if */ \
} /* end else */ \
@@ -269,7 +269,7 @@ H5Z_class2_t H5Z_SCALEOFFSET[1] = {{
\
/* Copy the value */ \
_cd_value = (uint32_t)(cd_values)[_i]; \
- HDmemcpy(_fv_p, &_cd_value, _copy_size); \
+ H5MM_memcpy(_fv_p, &_cd_value, _copy_size); \
\
/* Next field */ \
_i++; \
@@ -286,7 +286,7 @@ H5Z_class2_t H5Z_SCALEOFFSET[1] = {{
while(_size_rem >= 4) { \
/* Copy the value */ \
_cd_value = (uint32_t)(cd_values)[_i]; \
- HDmemcpy(_fv_p, &_cd_value, _copy_size); \
+ H5MM_memcpy(_fv_p, &_cd_value, _copy_size); \
\
/* Next field */ \
_i++; \
@@ -303,7 +303,7 @@ H5Z_class2_t H5Z_SCALEOFFSET[1] = {{
* _cd_value as it will not be fully overwritten and copy to the end \
* of _cd value as it is BE. */ \
_cd_value = (uint32_t)(cd_values)[_i]; \
- HDmemcpy(_fv_p, (char *)&_cd_value + 4 - _size_rem, _size_rem); \
+ H5MM_memcpy(_fv_p, (char *)&_cd_value + 4 - _size_rem, _size_rem); \
} /* end if */ \
} /* end else */ \
}
@@ -529,10 +529,10 @@ H5Z_class2_t H5Z_SCALEOFFSET[1] = {{
* account for offset in BE if sizes differ \
*/ \
if(H5T_native_order_g == H5T_ORDER_LE) \
- HDmemcpy(minval, &min, sizeof(type)); \
+ H5MM_memcpy(minval, &min, sizeof(type)); \
else { \
HDassert(H5T_native_order_g == H5T_ORDER_BE); \
- HDmemcpy(((char *)minval) + (sizeof(long long) - sizeof(type)), \
+ H5MM_memcpy(((char *)minval) + (sizeof(long long) - sizeof(type)), \
&min, sizeof(type)); \
} /* end else */ \
else \
@@ -604,10 +604,10 @@ H5Z_class2_t H5Z_SCALEOFFSET[1] = {{
* account for offset in BE if sizes differ \
*/ \
if(H5T_native_order_g == H5T_ORDER_LE) \
- HDmemcpy(&min, &minval, sizeof(type)); \
+ H5MM_memcpy(&min, &minval, sizeof(type)); \
else { \
HDassert(H5T_native_order_g == H5T_ORDER_BE); \
- HDmemcpy(&min, ((char *)&minval) + (sizeof(long long) \
+ H5MM_memcpy(&min, ((char *)&minval) + (sizeof(long long) \
- sizeof(type)), sizeof(type)); \
} /* end else */ \
else \
@@ -1173,7 +1173,9 @@ H5Z_filter_scaleoffset(unsigned flags, size_t cd_nelmts, const unsigned cd_value
/* special case: minbits equal to full precision */
if(minbits == p.size * 8) {
- HDmemcpy(outbuf, (unsigned char*)(*buf)+buf_offset, size_out);
+ H5MM_memcpy(outbuf, (unsigned char*)(*buf)+buf_offset, size_out);
+ /* free the original buffer */
+ H5MM_xfree(*buf);
/* convert to dataset datatype endianness order if needed */
if(need_convert)
@@ -1271,7 +1273,10 @@ H5Z_filter_scaleoffset(unsigned flags, size_t cd_nelmts, const unsigned cd_value
/* special case: minbits equal to full precision */
if(minbits == p.size * 8) {
- HDmemcpy(outbuf + buf_offset, *buf, nbytes);
+ H5MM_memcpy(outbuf + buf_offset, *buf, nbytes);
+ /* free the original buffer */
+ H5MM_xfree(*buf);
+
*buf = outbuf;
outbuf = NULL;
*buf_size = size_out;
diff --git a/src/H5Zshuffle.c b/src/H5Zshuffle.c
index 1fef1c1..b1d0722 100644
--- a/src/H5Zshuffle.c
+++ b/src/H5Zshuffle.c
@@ -185,18 +185,25 @@ H5Z_filter_shuffle(unsigned flags, size_t cd_nelmts, const unsigned cd_values[],
do
{
DUFF_GUTS
+ H5_ATTR_FALLTHROUGH
case 7:
DUFF_GUTS
+ H5_ATTR_FALLTHROUGH
case 6:
DUFF_GUTS
+ H5_ATTR_FALLTHROUGH
case 5:
DUFF_GUTS
+ H5_ATTR_FALLTHROUGH
case 4:
DUFF_GUTS
+ H5_ATTR_FALLTHROUGH
case 3:
DUFF_GUTS
+ H5_ATTR_FALLTHROUGH
case 2:
DUFF_GUTS
+ H5_ATTR_FALLTHROUGH
case 1:
DUFF_GUTS
} while (--duffs_index > 0);
@@ -210,7 +217,7 @@ H5Z_filter_shuffle(unsigned flags, size_t cd_nelmts, const unsigned cd_values[],
if(leftover>0) {
/* Adjust back to end of shuffled bytes */
_dest -= (bytesoftype - 1); /*lint !e794 _dest is initialized */
- HDmemcpy((void*)_dest, (void*)_src, leftover);
+ H5MM_memcpy((void*)_dest, (void*)_src, leftover);
}
} /* end if */
else {
@@ -243,18 +250,25 @@ H5Z_filter_shuffle(unsigned flags, size_t cd_nelmts, const unsigned cd_values[],
do
{
DUFF_GUTS
+ H5_ATTR_FALLTHROUGH
case 7:
DUFF_GUTS
+ H5_ATTR_FALLTHROUGH
case 6:
DUFF_GUTS
+ H5_ATTR_FALLTHROUGH
case 5:
DUFF_GUTS
+ H5_ATTR_FALLTHROUGH
case 4:
DUFF_GUTS
+ H5_ATTR_FALLTHROUGH
case 3:
DUFF_GUTS
+ H5_ATTR_FALLTHROUGH
case 2:
DUFF_GUTS
+ H5_ATTR_FALLTHROUGH
case 1:
DUFF_GUTS
} while (--duffs_index > 0);
@@ -268,7 +282,7 @@ H5Z_filter_shuffle(unsigned flags, size_t cd_nelmts, const unsigned cd_values[],
if(leftover>0) {
/* Adjust back to end of shuffled bytes */
_src -= (bytesoftype - 1); /*lint !e794 _src is initialized */
- HDmemcpy((void*)_dest, (void*)_src, leftover);
+ H5MM_memcpy((void*)_dest, (void*)_src, leftover);
}
} /* end else */
diff --git a/src/H5Ztrans.c b/src/H5Ztrans.c
index 67646a0..6d07513 100644
--- a/src/H5Ztrans.c
+++ b/src/H5Ztrans.c
@@ -850,7 +850,7 @@ H5Z_parse_factor(H5Z_token *current, H5Z_datval_ptrs* dat_val_pointers)
if (!factor)
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "Unable to allocate new node")
- sscanf(current->tok_begin, "%ld", &factor->value.int_val);
+ HDsscanf(current->tok_begin, "%ld", &factor->value.int_val);
break;
case H5Z_XFORM_FLOAT:
@@ -858,7 +858,7 @@ H5Z_parse_factor(H5Z_token *current, H5Z_datval_ptrs* dat_val_pointers)
if (!factor)
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "Unable to allocate new node")
- sscanf(current->tok_begin, "%lf", &factor->value.float_val);
+ HDsscanf(current->tok_begin, "%lf", &factor->value.float_val);
break;
case H5Z_XFORM_SYMBOL:
@@ -1078,7 +1078,7 @@ H5Z_xform_eval(H5Z_data_xform_t *data_xform_prop, void* array, size_t array_size
if(NULL == (data_xform_prop->dat_val_pointers->ptr_dat_val[i] = (void*)H5MM_malloc(array_size * H5T_get_size((H5T_t *)H5I_object(array_type)))))
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "Ran out of memory trying to allocate space for data in data transform")
- HDmemcpy(data_xform_prop->dat_val_pointers->ptr_dat_val[i], array, array_size * H5T_get_size((H5T_t *)H5I_object(array_type)));
+ H5MM_memcpy(data_xform_prop->dat_val_pointers->ptr_dat_val[i], array, array_size * H5T_get_size((H5T_t *)H5I_object(array_type)));
} /* end for */
} /* end else */
@@ -1086,7 +1086,7 @@ H5Z_xform_eval(H5Z_data_xform_t *data_xform_prop, void* array, size_t array_size
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "error while performing data transform")
if(data_xform_prop->dat_val_pointers->num_ptrs > 1)
- HDmemcpy(array, res.value.dat_val, array_size * H5T_get_size((H5T_t *)H5I_object(array_type)));
+ H5MM_memcpy(array, res.value.dat_val, array_size * H5T_get_size((H5T_t *)H5I_object(array_type)));
/* Free the temporary arrays we used */
if(data_xform_prop->dat_val_pointers->num_ptrs > 1)
diff --git a/src/H5checksum.c b/src/H5checksum.c
index 64d527e..4e98976 100644
--- a/src/H5checksum.c
+++ b/src/H5checksum.c
@@ -407,16 +407,27 @@ H5_checksum_lookup3(const void *key, size_t length, uint32_t initval)
switch(length) /* all the case statements fall through */
{
case 12: c+=((uint32_t)k[11])<<24;
+ H5_ATTR_FALLTHROUGH
case 11: c+=((uint32_t)k[10])<<16;
+ H5_ATTR_FALLTHROUGH
case 10: c+=((uint32_t)k[9])<<8;
+ H5_ATTR_FALLTHROUGH
case 9 : c+=k[8];
+ H5_ATTR_FALLTHROUGH
case 8 : b+=((uint32_t)k[7])<<24;
+ H5_ATTR_FALLTHROUGH
case 7 : b+=((uint32_t)k[6])<<16;
+ H5_ATTR_FALLTHROUGH
case 6 : b+=((uint32_t)k[5])<<8;
+ H5_ATTR_FALLTHROUGH
case 5 : b+=k[4];
+ H5_ATTR_FALLTHROUGH
case 4 : a+=((uint32_t)k[3])<<24;
+ H5_ATTR_FALLTHROUGH
case 3 : a+=((uint32_t)k[2])<<16;
+ H5_ATTR_FALLTHROUGH
case 2 : a+=((uint32_t)k[1])<<8;
+ H5_ATTR_FALLTHROUGH
case 1 : a+=k[0];
break;
case 0 : goto done;
diff --git a/src/H5dbg.c b/src/H5dbg.c
index dd50034..4939bca 100644
--- a/src/H5dbg.c
+++ b/src/H5dbg.c
@@ -113,7 +113,7 @@ H5_buffer_dump(FILE *stream, int indent, const uint8_t *buf,
} /* end else */
} /* end if */
else
- fprintf(stream, " ");
+ HDfprintf(stream, " ");
if(7 == v)
HDfputc(' ', stream);
} /* end for */
diff --git a/src/H5err.txt b/src/H5err.txt
index 93a3abd..d4edfba 100644
--- a/src/H5err.txt
+++ b/src/H5err.txt
@@ -134,6 +134,7 @@ MINOR, FILEACC, H5E_NOTHDF5, Not an HDF5 file
MINOR, FILEACC, H5E_BADFILE, Bad file ID accessed
MINOR, FILEACC, H5E_TRUNCATED, File has been truncated
MINOR, FILEACC, H5E_MOUNT, File mount error
+MINOR, FILEACC, H5E_CANTDELETEFILE, Unable to delete file
# Generic low-level file I/O errors
MINOR, FILE, H5E_SEEKERROR, Seek failed
@@ -226,6 +227,7 @@ MINOR, DSPACE, H5E_CANTSELECT, Can't select hyperslab
MINOR, DSPACE, H5E_CANTNEXT, Can't move to next iterator location
MINOR, DSPACE, H5E_BADSELECT, Invalid selection
MINOR, DSPACE, H5E_CANTCOMPARE, Can't compare objects
+MINOR, DSPACE, H5E_INCONSISTENTSTATE, Internal states are inconsistent
MINOR, DSPACE, H5E_CANTAPPEND, Can't append object
# Property list errors
diff --git a/src/H5private.h b/src/H5private.h
index 8b6253d..86cd615 100644
--- a/src/H5private.h
+++ b/src/H5private.h
@@ -309,6 +309,7 @@
# define H5_ATTR_NORETURN /*void*/
# define H5_ATTR_CONST /*void*/
# define H5_ATTR_PURE /*void*/
+# define H5_ATTR_FALLTHROUGH /*void*/
#else /* __cplusplus */
#if defined(H5_HAVE_ATTRIBUTE) && !defined(__SUNPRO_C)
# define H5_ATTR_FORMAT(X,Y,Z) __attribute__((format(X, Y, Z)))
@@ -316,12 +317,14 @@
# define H5_ATTR_NORETURN __attribute__((noreturn))
# define H5_ATTR_CONST __attribute__((const))
# define H5_ATTR_PURE __attribute__((pure))
+# define H5_ATTR_FALLTHROUGH __attribute__((fallthrough));
#else
# define H5_ATTR_FORMAT(X,Y,Z) /*void*/
# define H5_ATTR_UNUSED /*void*/
# define H5_ATTR_NORETURN /*void*/
# define H5_ATTR_CONST /*void*/
# define H5_ATTR_PURE /*void*/
+# define H5_ATTR_FALLTHROUGH /*void*/
#endif
#endif /* __cplusplus */
@@ -1104,12 +1107,8 @@ typedef off_t h5_stat_size_t;
#ifndef HDmemcmp
#define HDmemcmp(X,Y,Z) memcmp(X,Y,Z)
#endif /* HDmemcmp */
-/*
- * The (char*) casts are required for the DEC when optimizations are turned
- * on and the source and/or destination are not aligned.
- */
#ifndef HDmemcpy
- #define HDmemcpy(X,Y,Z) memcpy((char*)(X),(const char*)(Y),Z)
+ #define HDmemcpy(X,Y,Z) memcpy(X,Y,Z)
#endif /* HDmemcpy */
#ifndef HDmemmove
#define HDmemmove(X,Y,Z) memmove((char*)(X),(const char*)(Y),Z)
@@ -1340,8 +1339,9 @@ typedef off_t h5_stat_size_t;
#define HDsrandom(S) srand(S)
#endif /* HDsrandom */
#endif /* H5_HAVE_RAND_R */
-/* sscanf() variable arguments */
-
+#ifndef HDsscanf
+ #define HDsscanf(S,FMT,...) sscanf(S,FMT,__VA_ARGS__)
+#endif /* HDsscanf */
#ifndef HDstrcat
#define HDstrcat(X,Y) strcat(X,Y)
#endif /* HDstrcat */
diff --git a/src/H5public.h b/src/H5public.h
index 353ff16..a7e21f6 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 11 /* For minor interface/format changes */
-#define H5_VERS_RELEASE 4 /* For tweaks, bug-fixes, or development */
+#define H5_VERS_RELEASE 6 /* 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.11.4" /* Full version string */
+#define H5_VERS_INFO "HDF5 library version: 1.11.6" /* Full version string */
#define H5check() H5check_version(H5_VERS_MAJOR,H5_VERS_MINOR, \
H5_VERS_RELEASE)
diff --git a/src/H5system.c b/src/H5system.c
index f47d057..35123db 100644
--- a/src/H5system.c
+++ b/src/H5system.c
@@ -985,6 +985,132 @@ Wroundf(float arg)
return (float)(arg < 0.0F ? HDceil(arg - 0.5F) : HDfloor(arg + 0.5F));
}
+/*-------------------------------------------------------------------------
+* Function: H5_get_utf16_str
+*
+* Purpose: Gets a UTF-16 string from an UTF-8 (or ASCII) string.
+*
+* Return: Success: A pointer to a UTF-16 string
+* This must be freed by the caller using H5MM_xfree()
+* Failure: NULL
+*
+* Programmer: Dana Robinson
+* Spring 2019
+*
+*-------------------------------------------------------------------------
+*/
+const wchar_t *
+H5_get_utf16_str(const char *s)
+{
+ int nwchars = -1; /* Length of the UTF-16 buffer */
+ wchar_t *ret_s = NULL; /* UTF-16 version of the string */
+
+ /* Get the number of UTF-16 characters needed */
+ if(0 == (nwchars = MultiByteToWideChar(CP_UTF8, 0, s, -1, NULL, 0)))
+ goto error;
+
+ /* Allocate a buffer for the UTF-16 string */
+ if(NULL == (ret_s = (wchar_t *)H5MM_calloc(sizeof(wchar_t) * (size_t)nwchars)))
+ goto error;
+
+ /* Convert the input UTF-8 string to UTF-16 */
+ if(0 == MultiByteToWideChar(CP_UTF8, 0, s, -1, ret_s, nwchars))
+ goto error;
+
+ return ret_s;
+
+error:
+ if(ret_s)
+ H5MM_xfree((void *)ret_s);
+ return NULL;
+} /* end H5_get_utf16_str() */
+
+/*-------------------------------------------------------------------------
+ * Function: Wopen_utf8
+ *
+ * Purpose: UTF-8 equivalent of open(2) for use on Windows.
+ * Converts a UTF-8 input path to UTF-16 and then opens the
+ * file via _wopen() under the hood
+ *
+ * Return: Success: A POSIX file descriptor
+ * Failure: -1
+ *
+ * Programmer: Dana Robinson
+ * Spring 2019
+ *
+ *-------------------------------------------------------------------------
+ */
+int
+Wopen_utf8(const char *path, int oflag, ...)
+{
+ int fd = -1; /* POSIX file descriptor to be returned */
+ wchar_t *wpath = NULL; /* UTF-16 version of the path */
+ int pmode = 0; /* mode (optionally set via variable args) */
+
+ /* Convert the input UTF-8 path to UTF-16 */
+ if(NULL == (wpath = H5_get_utf16_str(path)))
+ goto done;
+
+ /* _O_BINARY must be set in Windows to avoid CR-LF <-> LF EOL
+ * transformations when performing I/O. Note that this will
+ * produce Unix-style text files, though.
+ */
+ oflag |= _O_BINARY;
+
+ /* Get the mode, if O_CREAT was specified */
+ if(oflag & O_CREAT) {
+ va_list vl;
+
+ HDva_start(vl, oflag);
+ pmode = HDva_arg(vl, int);
+ HDva_end(vl);
+ }
+
+ /* Open the file */
+ fd = _wopen(wpath, oflag, pmode);
+
+done:
+ if(wpath)
+ H5MM_xfree((void *)wpath);
+
+ return fd;
+} /* end Wopen_utf8() */
+
+/*-------------------------------------------------------------------------
+ * Function: Wremove_utf8
+ *
+ * Purpose: UTF-8 equivalent of remove(3) for use on Windows.
+ * Converts a UTF-8 input path to UTF-16 and then opens the
+ * file via _wremove() under the hood
+ *
+ * Return: Success: 0
+ * Failure: -1
+ *
+ * Programmer: Dana Robinson
+ * Spring 2019
+ *
+ *-------------------------------------------------------------------------
+ */
+int
+Wremove_utf8(const char *path)
+{
+ wchar_t *wpath = NULL; /* UTF-16 version of the path */
+ int ret;
+
+ /* Convert the input UTF-8 path to UTF-16 */
+ if(NULL == (wpath = H5_get_utf16_str(path)))
+ goto done;
+
+ /* Open the file */
+ ret = _wremove(wpath);
+
+done:
+ if(wpath)
+ H5MM_xfree((void *)wpath);
+
+ return ret;
+} /* end Wremove_utf8() */
+
#endif /* H5_HAVE_WIN32_API */
@@ -1130,13 +1256,13 @@ H5_combine_path(const char* path1, const char* path2, char **full_name /*out*/)
FUNC_ENTER_NOAPI_NOINIT
- HDassert(path1);
HDassert(path2);
- path1_len = HDstrlen(path1);
+ if(path1)
+ path1_len = HDstrlen(path1);
path2_len = HDstrlen(path2);
- if(*path1 == '\0' || H5_CHECK_ABSOLUTE(path2)) {
+ if(path1 == NULL || *path1 == '\0' || H5_CHECK_ABSOLUTE(path2)) {
/* If path1 is empty or path2 is absolute, simply use path2 */
if(NULL == (*full_name = (char *)H5MM_strdup(path2)))
diff --git a/src/H5timer.c b/src/H5timer.c
index 0ba8bd1..4b1ec06 100644
--- a/src/H5timer.c
+++ b/src/H5timer.c
@@ -213,26 +213,26 @@ H5_bandwidth(char *buf/*out*/, double nbytes, double nseconds)
if(H5_DBL_ABS_EQUAL(bw, (double)0.0F))
HDstrcpy(buf, "0.000 B/s");
else if(bw < (double)1.0F)
- sprintf(buf, "%10.4e", bw);
+ HDsprintf(buf, "%10.4e", bw);
else if(bw < (double)H5_KB) {
- sprintf(buf, "%05.4f", bw);
+ HDsprintf(buf, "%05.4f", bw);
HDstrcpy(buf+5, " B/s");
} else if(bw < (double)H5_MB) {
- sprintf(buf, "%05.4f", bw / (double)H5_KB);
+ HDsprintf(buf, "%05.4f", bw / (double)H5_KB);
HDstrcpy(buf+5, " kB/s");
} else if(bw < (double)H5_GB) {
- sprintf(buf, "%05.4f", bw / (double)H5_MB);
+ HDsprintf(buf, "%05.4f", bw / (double)H5_MB);
HDstrcpy(buf+5, " MB/s");
} else if(bw < (double)H5_TB) {
- sprintf(buf, "%05.4f", bw / (double)H5_GB);
+ HDsprintf(buf, "%05.4f", bw / (double)H5_GB);
HDstrcpy(buf+5, " GB/s");
} else if(bw < (double)H5_PB) {
- sprintf(buf, "%05.4f", bw / (double)H5_TB);
+ HDsprintf(buf, "%05.4f", bw / (double)H5_TB);
HDstrcpy(buf+5, " TB/s");
} else {
- sprintf(buf, "%10.4e", bw);
+ HDsprintf(buf, "%10.4e", bw);
if(HDstrlen(buf) > 10)
- sprintf(buf, "%10.3e", bw);
+ HDsprintf(buf, "%10.3e", bw);
}
}
} /* end H5_bandwidth() */
diff --git a/src/H5trace.c b/src/H5trace.c
index 9a13193..c5d14f5 100644
--- a/src/H5trace.c
+++ b/src/H5trace.c
@@ -173,7 +173,7 @@ H5_trace(const double *returning, const char *func, const char *type, ...)
if(current_depth < last_call_depth) {
/* We are at the beginning of a line */
if(H5_debug_g.ttimes) {
- char tmp[128];
+ char tmp[320];
HDsprintf(tmp, "%.6f", event_time.etime-first_time.etime);
HDfprintf(out, " %*s ", (int)HDstrlen(tmp), "");
@@ -1054,7 +1054,11 @@ H5_trace(const double *returning, const char *func, const char *type, ...)
break;
case H5F_LIBVER_V110:
- HDcompile_assert(H5F_LIBVER_LATEST == H5F_LIBVER_V110);
+ HDfprintf(out, "H5F_LIBVER_V110");
+ break;
+
+ case H5F_LIBVER_V112:
+ HDcompile_assert(H5F_LIBVER_LATEST == H5F_LIBVER_V112);
HDfprintf(out, "H5F_LIBVER_LATEST");
break;
@@ -1383,6 +1387,10 @@ H5_trace(const double *returning, const char *func, const char *type, ...)
HDfprintf(out, "%ld (err stack)", (long)obj);
break;
+ case H5I_SPACE_SEL_ITER:
+ HDfprintf(out, "%ld (dataspace selection iterator)", (long)obj);
+ break;
+
case H5I_NTYPES:
HDfprintf (out, "%ld (ntypes - error)", (long)obj);
break;
@@ -1564,6 +1572,10 @@ H5_trace(const double *returning, const char *func, const char *type, ...)
HDfprintf(out, "H5I_ERROR_STACK");
break;
+ case H5I_SPACE_SEL_ITER:
+ HDfprintf(out, "H5I_SPACE_SEL_ITER");
+ break;
+
case H5I_NTYPES:
HDfprintf(out, "H5I_NTYPES");
break;
@@ -2710,6 +2722,9 @@ H5_trace(const double *returning, const char *func, const char *type, ...)
case H5VL_FILE_GET_INTENT:
HDfprintf(out, "H5VL_FILE_GET_INTENT");
break;
+ case H5VL_FILE_GET_FILENO:
+ HDfprintf(out, "H5VL_FILE_GET_FILENO");
+ break;
case H5VL_FILE_GET_NAME:
HDfprintf(out, "H5VL_FILE_GET_NAME");
break;
@@ -2751,6 +2766,9 @@ H5_trace(const double *returning, const char *func, const char *type, ...)
case H5VL_FILE_IS_ACCESSIBLE:
HDfprintf(out, "H5VL_FILE_IS_ACCESSIBLE");
break;
+ case H5VL_FILE_DELETE:
+ HDfprintf(out, "H5VL_FILE_DELETE");
+ break;
default:
HDfprintf(out, "%ld", (long)specific);
break;
@@ -2901,8 +2919,8 @@ H5_trace(const double *returning, const char *func, const char *type, ...)
case H5VL_REF_GET_NAME:
HDfprintf(out, "H5VL_REF_GET_NAME");
break;
- case H5VL_ID_GET_NAME:
- HDfprintf(out, "H5VL_ID_GET_NAME");
+ case H5VL_OBJECT_GET_NAME:
+ HDfprintf(out, "H5VL_OBJECT_GET_NAME");
break;
default:
HDfprintf(out, "%ld", (long)get);
diff --git a/src/H5vers.txt b/src/H5vers.txt
index 914c30e..22117c3 100644
--- a/src/H5vers.txt
+++ b/src/H5vers.txt
@@ -61,12 +61,14 @@ 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: H5Pencode; ; v110, v112
FUNCTION: H5Pget_filter; ; v10, v18
FUNCTION: H5Pget_filter_by_id; ; v16, v18
FUNCTION: H5Pinsert; ; v14, v18
FUNCTION: H5Pregister; ; v14, v18
FUNCTION: H5Rdereference; ; v10, v110
FUNCTION: H5Rget_obj_type; ; v16, v18
+FUNCTION: H5Sencode; ; v18, v112
FUNCTION: H5Tarray_create; ; v14, v18
FUNCTION: H5Tcommit; ; v10, v18
FUNCTION: H5Tget_array_dims; ; v14, v18
diff --git a/src/H5win32defs.h b/src/H5win32defs.h
index 140afc3..2ae2575 100644
--- a/src/H5win32defs.h
+++ b/src/H5win32defs.h
@@ -34,6 +34,7 @@ typedef __int64 h5_stat_size_t;
#define HDaccess(F,M) _access(F,M)
#define HDchdir(S) _chdir(S)
#define HDclose(F) _close(F)
+#define HDcreat(S,M) Wopen_utf8(S,O_CREAT|O_TRUNC|O_RDWR,M)
#define HDdup(F) _dup(F)
#define HDfdopen(N,S) _fdopen(N,S)
#define HDfileno(F) _fileno(F)
@@ -47,15 +48,13 @@ typedef __int64 h5_stat_size_t;
#define HDmkdir(S,M) _mkdir(S)
#define HDnanosleep(N, O) Wnanosleep(N, O)
#define HDoff_t __int64
-/* _O_BINARY must be set in Windows to avoid CR-LF <-> LF EOL
- * transformations when performing I/O. Note that this will
- * produce Unix-style text files, though.
- *
- * Also note that the variadic macro is using a VC++ extension
+
+/* Note that the variadic HDopen macro is using a VC++ extension
* where the comma is dropped if nothing is passed to the ellipsis.
*/
-#define HDopen(S,F,...) _open(S, F | _O_BINARY, __VA_ARGS__)
+#define HDopen(S,F,...) Wopen_utf8(S,F,__VA_ARGS__)
#define HDread(F,M,Z) _read(F,M,Z)
+#define HDremove(S) Wremove_utf8(S)
#define HDrmdir(S) _rmdir(S)
#define HDsetvbuf(F,S,M,Z) setvbuf(F,S,M,(Z>1?Z:2))
#define HDsleep(S) Sleep(S*1000)
@@ -128,6 +127,9 @@ extern "C" {
H5_DLL int c99_vsnprintf(char* str, size_t size, const char* format, va_list ap);
H5_DLL int Wnanosleep(const struct timespec *req, struct timespec *rem);
H5_DLL herr_t H5_expand_windows_env_vars(char **env_var);
+ H5_DLL const wchar_t *H5_get_utf16_str(const char *s);
+ H5_DLL int Wopen_utf8(const char *path, int oflag, ...);
+ H5_DLL int Wremove_utf8(const char *path);
/* Round functions only needed for VS2012 and earlier.
* They are always built to ensure they don't go stale and
diff --git a/src/Makefile.am b/src/Makefile.am
index 5532655..0eaae1a 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -102,7 +102,7 @@ libhdf5_la_SOURCES= H5.c H5checksum.c H5dbg.c H5system.c H5timer.c H5trace.c \
H5R.c H5Rint.c H5Rdeprec.c \
H5UC.c \
H5RS.c \
- H5S.c H5Sall.c H5Sdbg.c H5Shyper.c H5Snone.c H5Spoint.c \
+ H5S.c H5Sall.c H5Sdbg.c H5Sdeprec.c H5Shyper.c H5Snone.c H5Spoint.c \
H5Sselect.c H5Stest.c \
H5SL.c \
H5SM.c H5SMbtree2.c H5SMcache.c H5SMmessage.c H5SMtest.c \
@@ -115,9 +115,9 @@ libhdf5_la_SOURCES= H5.c H5checksum.c H5dbg.c H5system.c H5timer.c H5trace.c \
H5Torder.c \
H5Tpad.c H5Tprecis.c H5Tstrpad.c H5Tvisit.c H5Tvlen.c H5TS.c \
H5VL.c H5VLcallback.c H5VLint.c H5VLnative.c \
- H5VLnative_attr.c H5VLnative_dataset.c H5VLnative_datatype.c \
- H5VLnative_file.c H5VLnative_group.c H5VLnative_link.c H5VLnative_object.c \
- H5VLpassthru.c \
+ H5VLnative_attr.c H5VLnative_dataset.c H5VLnative_datatype.c \
+ H5VLnative_file.c H5VLnative_group.c H5VLnative_link.c H5VLnative_object.c \
+ H5VLpassthru.c \
H5VM.c H5WB.c H5Z.c \
H5Zdeflate.c H5Zfletcher32.c H5Znbit.c H5Zshuffle.c \
H5Zscaleoffset.c H5Zszip.c H5Ztrans.c
@@ -144,7 +144,9 @@ include_HEADERS = hdf5.h H5api_adpt.h H5overflow.h H5pubconf.h H5public.h H5vers
H5MMpublic.h H5Opublic.h H5Ppublic.h \
H5PLextern.h H5PLpublic.h \
H5Rpublic.h H5Spublic.h H5Tpublic.h \
- H5VLnative.h H5VLpassthru.h H5VLpublic.h H5Zpublic.h
+ H5VLconnector.h H5VLconnector_passthru.h \
+ H5VLnative.h H5VLpassthru.h H5VLpublic.h \
+ H5Zpublic.h
# install libhdf5.settings in lib directory
settingsdir=$(libdir)
@@ -209,3 +211,4 @@ trace: $(libhdf5_la_SOURCES)
done
include $(top_srcdir)/config/conclude.am
+
diff --git a/src/libhdf5.settings.in b/src/libhdf5.settings.in
index 9d0e29f..37957a2 100644
--- a/src/libhdf5.settings.in
+++ b/src/libhdf5.settings.in
@@ -71,6 +71,8 @@ Features:
Parallel Filtered Dataset Writes: @PARALLEL_FILTERED_WRITES@
Large Parallel I/O: @LARGE_PARALLEL_IO@
High-level library: @HDF5_HL@
+ Build HDF5 Tests: @HDF5_TESTS@
+ Build HDF5 TOOLS: @HDF5_TOOLS@
Threadsafety: @THREADSAFE@
Default API mapping: @DEFAULT_API_VERSION@
With deprecated public symbols: @DEPRECATED_SYMBOLS@
diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt
index 0d67485..15d10a7 100644
--- a/test/CMakeLists.txt
+++ b/test/CMakeLists.txt
@@ -14,38 +14,43 @@ set (TEST_LIB_SOURCES
${HDF5_TEST_SOURCE_DIR}/h5test.c
${HDF5_TEST_SOURCE_DIR}/testframe.c
${HDF5_TEST_SOURCE_DIR}/cache_common.c
+ ${HDF5_TEST_SOURCE_DIR}/external_common.c
${HDF5_TEST_SOURCE_DIR}/swmr_common.c
)
set (TEST_LIB_HEADERS
${HDF5_TEST_SOURCE_DIR}/h5test.h
${HDF5_TEST_SOURCE_DIR}/cache_common.h
+ ${HDF5_TEST_SOURCE_DIR}/external_common.h
${HDF5_TEST_SOURCE_DIR}/swmr_common.h
)
-add_library (${HDF5_TEST_LIB_TARGET} STATIC ${TEST_LIB_SOURCES} ${TEST_LIB_HEADERS})
-target_include_directories(${HDF5_TEST_LIB_TARGET}
- PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};${HDF5_TEST_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>"
- INTERFACE "$<INSTALL_INTERFACE:$<INSTALL_PREFIX>/include>"
-)
-TARGET_C_PROPERTIES (${HDF5_TEST_LIB_TARGET} STATIC)
-target_link_libraries (${HDF5_TEST_LIB_TARGET}
- PUBLIC ${LINK_LIBS} ${HDF5_LIB_TARGET}
- PRIVATE $<$<PLATFORM_ID:Windows>:ws2_32.lib>
-)
-if (MINGW)
- target_link_libraries (${HDF5_TEST_LIB_TARGET} PRIVATE "wsock32.lib")
+if (NOT ONLY_SHARED_LIBS)
+ add_library (${HDF5_TEST_LIB_TARGET} STATIC ${TEST_LIB_SOURCES} ${TEST_LIB_HEADERS})
+ target_include_directories (${HDF5_TEST_LIB_TARGET}
+ PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};${HDF5_TEST_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>"
+ INTERFACE "$<INSTALL_INTERFACE:$<INSTALL_PREFIX>/include>"
+ )
+ TARGET_C_PROPERTIES (${HDF5_TEST_LIB_TARGET} STATIC)
+ target_link_libraries (${HDF5_TEST_LIB_TARGET}
+ PUBLIC ${LINK_LIBS} ${HDF5_LIB_TARGET}
+ PRIVATE $<$<PLATFORM_ID:Windows>:ws2_32.lib>
+ )
+ if (MINGW)
+ target_link_libraries (${HDF5_TEST_LIB_TARGET} PRIVATE "wsock32.lib")
+ endif ()
+ H5_SET_LIB_OPTIONS (${HDF5_TEST_LIB_TARGET} ${HDF5_TEST_LIB_NAME} STATIC 0)
+ set_target_properties (${HDF5_TEST_LIB_TARGET} PROPERTIES FOLDER libraries/test)
endif ()
-H5_SET_LIB_OPTIONS (${HDF5_TEST_LIB_TARGET} ${HDF5_TEST_LIB_NAME} STATIC 0)
if (BUILD_SHARED_LIBS)
add_library (${HDF5_TEST_LIBSH_TARGET} SHARED ${TEST_LIB_SOURCES} ${TEST_LIB_HEADERS})
- target_include_directories(${HDF5_TEST_LIBSH_TARGET}
+ target_include_directories (${HDF5_TEST_LIBSH_TARGET}
PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};${HDF5_TEST_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>"
INTERFACE "$<INSTALL_INTERFACE:$<INSTALL_PREFIX>/include>"
)
target_compile_definitions(${HDF5_TEST_LIBSH_TARGET}
- PUBLIC "H5_BUILT_AS_DYNAMIC_LIB" $<$<BOOL:${HDF5_ENABLE_THREADSAFE}>:H5_HAVE_THREADSAFE>
+ PUBLIC "H5_BUILT_AS_DYNAMIC_LIB"
)
TARGET_C_PROPERTIES (${HDF5_TEST_LIBSH_TARGET} SHARED)
target_link_libraries (${HDF5_TEST_LIBSH_TARGET}
@@ -60,7 +65,7 @@ if (BUILD_SHARED_LIBS)
endif ()
#################################################################################
-# If filter plugin tests can be tested
+# If filter and vol plugin tests can be tested
#################################################################################
if (BUILD_SHARED_LIBS)
# make plugins dir
@@ -85,9 +90,9 @@ if (BUILD_SHARED_LIBS)
set (HDF5_TEST_PLUGIN_TARGET ${HDF5_TEST_PLUGIN_CORENAME})
add_library (${HDF5_TEST_PLUGIN_TARGET} SHARED ${HDF5_TEST_SOURCE_DIR}/${plugin_name}.c)
- target_include_directories(${HDF5_TEST_PLUGIN_TARGET} PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>")
+ target_include_directories (${HDF5_TEST_PLUGIN_TARGET} PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>")
TARGET_C_PROPERTIES (${HDF5_TEST_PLUGIN_TARGET} SHARED)
- target_link_libraries (${HDF5_TEST_PLUGIN_TARGET} PUBLIC ${HDF5_TEST_LIB_TARGET})
+ target_link_libraries (${HDF5_TEST_PLUGIN_TARGET} PUBLIC ${HDF5_TEST_LIBSH_TARGET})
H5_SET_LIB_OPTIONS (${HDF5_TEST_PLUGIN_TARGET} ${HDF5_TEST_PLUGIN_NAME} SHARED "LIB")
set_target_properties (${HDF5_TEST_PLUGIN_TARGET} PROPERTIES FOLDER libraries/TEST_PLUGIN)
@@ -110,9 +115,9 @@ if (BUILD_SHARED_LIBS)
set (HDF5_TEST_PLUGIN_TARGET ${HDF5_TEST_PLUGIN_CORENAME})
add_library (${HDF5_TEST_PLUGIN_TARGET} SHARED ${HDF5_TEST_SOURCE_DIR}/${plugin_name}.c)
- target_include_directories(${HDF5_TEST_PLUGIN_TARGET} PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>")
+ target_include_directories (${HDF5_TEST_PLUGIN_TARGET} PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>")
TARGET_C_PROPERTIES (${HDF5_TEST_PLUGIN_TARGET} SHARED)
- target_link_libraries (${HDF5_TEST_PLUGIN_TARGET} PUBLIC ${HDF5_TEST_LIB_TARGET})
+ target_link_libraries (${HDF5_TEST_PLUGIN_TARGET} PUBLIC ${HDF5_TEST_LIBSH_TARGET})
H5_SET_LIB_OPTIONS (${HDF5_TEST_PLUGIN_TARGET} ${HDF5_TEST_PLUGIN_NAME} SHARED "LIB")
set_target_properties (${HDF5_TEST_PLUGIN_TARGET} PROPERTIES FOLDER libraries/TEST_PLUGIN)
@@ -129,6 +134,11 @@ if (BUILD_SHARED_LIBS)
)
endforeach ()
+ #################################################################################
+ # make vol plugins dir
+ #################################################################################
+ file (MAKE_DIRECTORY "${CMAKE_BINARY_DIR}/null_vol_plugin_dir")
+
#-----------------------------------------------------------------------------
# Define VOL Plugin Test Sources
#-----------------------------------------------------------------------------
@@ -142,9 +152,9 @@ if (BUILD_SHARED_LIBS)
set (HDF5_VOL_PLUGIN_LIB_TARGET ${HDF5_VOL_PLUGIN_LIB_CORENAME})
add_library (${HDF5_VOL_PLUGIN_LIB_TARGET} SHARED ${HDF5_TEST_SOURCE_DIR}/${vol_lib}.c)
- target_include_directories(${HDF5_VOL_PLUGIN_LIB_TARGET} PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>")
+ target_include_directories (${HDF5_VOL_PLUGIN_LIB_TARGET} PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>")
TARGET_C_PROPERTIES (${HDF5_VOL_PLUGIN_LIB_TARGET} SHARED)
- target_link_libraries (${HDF5_VOL_PLUGIN_LIB_TARGET} PUBLIC ${HDF5_TEST_LIB_TARGET})
+ target_link_libraries (${HDF5_VOL_PLUGIN_LIB_TARGET} PUBLIC ${HDF5_TEST_LIBSH_TARGET})
H5_SET_LIB_OPTIONS (${HDF5_VOL_PLUGIN_LIB_TARGET} ${HDF5_VOL_PLUGIN_LIB_NAME} SHARED "LIB")
set_target_properties (${HDF5_VOL_PLUGIN_LIB_TARGET} PROPERTIES FOLDER libraries/TEST_PLUGIN)
@@ -157,7 +167,7 @@ if (BUILD_SHARED_LIBS)
COMMAND ${CMAKE_COMMAND}
ARGS -E copy_if_different
"$<TARGET_FILE:${HDF5_VOL_PLUGIN_LIB_TARGET}>"
- "${CMAKE_BINARY_DIR}/vol/$<TARGET_FILE_NAME:${HDF5_VOL_PLUGIN_LIB_TARGET}>"
+ "${CMAKE_BINARY_DIR}/null_vol_plugin_dir/$<TARGET_FILE_NAME:${HDF5_VOL_PLUGIN_LIB_TARGET}>"
)
endforeach ()
endif ()
@@ -236,6 +246,7 @@ set (H5_TESTS
extend
direct_chunk # compression lib link
external
+ external_env
efc
objcopy
links
@@ -263,6 +274,7 @@ set (H5_TESTS
freespace
mf
vds
+ vds_env
file_image
unregister
cache_logging
@@ -273,17 +285,15 @@ set (H5_TESTS
macro (ADD_H5_EXE file)
add_executable (${file} ${HDF5_TEST_SOURCE_DIR}/${file}.c)
- target_include_directories(${file} PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};${HDF5_TEST_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>")
- TARGET_C_PROPERTIES (${file} STATIC)
- target_link_libraries (${file} PRIVATE ${HDF5_TEST_LIB_TARGET})
- set_target_properties (${file} PROPERTIES FOLDER test)
- if (BUILD_SHARED_LIBS)
- add_executable (${file}-shared ${HDF5_TEST_SOURCE_DIR}/${file}.c)
- target_include_directories(${file}-shared PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};${HDF5_TEST_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>")
- TARGET_C_PROPERTIES (${file}-shared SHARED)
- target_link_libraries (${file}-shared PRIVATE ${HDF5_TEST_LIBSH_TARGET})
- set_target_properties (${file}-shared PROPERTIES FOLDER test)
+ target_include_directories (${file} PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};${HDF5_TEST_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>")
+ if (NOT BUILD_SHARED_LIBS)
+ TARGET_C_PROPERTIES (${file} STATIC)
+ target_link_libraries (${file} PRIVATE ${HDF5_TEST_LIB_TARGET})
+ else ()
+ TARGET_C_PROPERTIES (${file} SHARED)
+ target_link_libraries (${file} PRIVATE ${HDF5_TEST_LIBSH_TARGET})
endif ()
+ set_target_properties (${file} PROPERTIES FOLDER test)
endmacro ()
set (H5_TESTS_MULTIPLE
@@ -293,9 +303,9 @@ set (H5_TESTS_MULTIPLE
ttsafe
)
# Only build single source tests here
-foreach (test ${H5_TESTS})
- if (NOT ${test} IN_LIST H5_TESTS_MULTIPLE)
- ADD_H5_EXE(${test})
+foreach (h5_test ${H5_TESTS})
+ if (NOT h5_test IN_LIST H5_TESTS_MULTIPLE)
+ ADD_H5_EXE(${h5_test})
endif ()
endforeach ()
@@ -305,61 +315,58 @@ endforeach ()
######### Also special handling of link libs #############
#-- Adding test for direct_chunk
add_executable (direct_chunk ${HDF5_TEST_SOURCE_DIR}/direct_chunk.c)
-target_include_directories(direct_chunk PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};${HDF5_TEST_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>")
-TARGET_C_PROPERTIES (direct_chunk STATIC)
-target_link_libraries (direct_chunk PRIVATE ${HDF5_TEST_LIB_TARGET} ${LINK_COMP_LIBS})
-set_target_properties (direct_chunk PROPERTIES FOLDER test)
-if (BUILD_SHARED_LIBS)
- add_executable (direct_chunk-shared ${HDF5_TEST_SOURCE_DIR}/direct_chunk.c)
- target_include_directories(direct_chunk-shared PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};${HDF5_TEST_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>")
- TARGET_C_PROPERTIES (direct_chunk-shared SHARED)
- target_link_libraries (direct_chunk-shared PRIVATE ${HDF5_TEST_LIBSH_TARGET} ${LINK_COMP_LIBS})
- set_target_properties (direct_chunk-shared PROPERTIES FOLDER test)
+target_include_directories (direct_chunk PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};${HDF5_TEST_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>")
+if (NOT BUILD_SHARED_LIBS)
+ TARGET_C_PROPERTIES (direct_chunk STATIC)
+ target_link_libraries (direct_chunk PRIVATE ${HDF5_TEST_LIB_TARGET} ${LINK_COMP_LIBS})
+else ()
+ TARGET_C_PROPERTIES (direct_chunk SHARED)
+ target_link_libraries (direct_chunk PRIVATE ${HDF5_TEST_LIBSH_TARGET} ${LINK_COMP_LIBS})
endif ()
+set_target_properties (direct_chunk PROPERTIES FOLDER test)
######### Special handling for multiple sources #############
#-- Adding test for testhdf5
add_executable (testhdf5 ${testhdf5_SOURCES})
-target_include_directories(testhdf5 PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>")
-TARGET_C_PROPERTIES (testhdf5 STATIC)
-target_link_libraries (testhdf5 PRIVATE ${HDF5_TEST_LIB_TARGET})
-set_target_properties (testhdf5 PROPERTIES FOLDER test)
-if (BUILD_SHARED_LIBS)
- add_executable (testhdf5-shared ${testhdf5_SOURCES})
- target_include_directories(testhdf5-shared PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>")
- TARGET_C_PROPERTIES (testhdf5-shared SHARED)
- target_link_libraries (testhdf5-shared PRIVATE ${HDF5_TEST_LIBSH_TARGET})
- set_target_properties (testhdf5-shared PROPERTIES FOLDER test)
+target_include_directories (testhdf5 PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>")
+if (NOT BUILD_SHARED_LIBS)
+ TARGET_C_PROPERTIES (testhdf5 STATIC)
+ target_link_libraries (testhdf5 PRIVATE ${HDF5_TEST_LIB_TARGET})
+else ()
+ TARGET_C_PROPERTIES (testhdf5 SHARED)
+ target_link_libraries (testhdf5 PRIVATE ${HDF5_TEST_LIBSH_TARGET})
endif ()
+set_target_properties (testhdf5 PROPERTIES FOLDER test)
#-- Adding test for cache_image
add_executable (cache_image ${cache_image_SOURCES})
-target_include_directories(cache_image PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>")
-TARGET_C_PROPERTIES (cache_image STATIC)
-target_link_libraries (cache_image PRIVATE ${HDF5_LIB_TARGET} ${HDF5_TEST_LIB_TARGET})
-set_target_properties (cache_image PROPERTIES FOLDER test)
-if (BUILD_SHARED_LIBS)
- add_executable (cache_image-shared ${cache_image_SOURCES})
- target_include_directories(cache_image-shared PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>")
- TARGET_C_PROPERTIES (cache_image-shared SHARED)
- target_link_libraries (cache_image-shared PRIVATE ${HDF5_TEST_LIBSH_TARGET} ${HDF5_LIBSH_TARGET})
- set_target_properties (cache_image-shared PROPERTIES FOLDER test)
+target_include_directories (cache_image PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>")
+if (NOT BUILD_SHARED_LIBS)
+ TARGET_C_PROPERTIES (cache_image STATIC)
+ target_link_libraries (cache_image PRIVATE ${HDF5_TEST_LIB_TARGET})
+else ()
+ TARGET_C_PROPERTIES (cache_image SHARED)
+ target_link_libraries (cache_image PRIVATE ${HDF5_TEST_LIBSH_TARGET})
endif ()
+set_target_properties (cache_image PROPERTIES FOLDER test)
#-- Adding test for ttsafe
add_executable (ttsafe ${ttsafe_SOURCES})
-target_include_directories(ttsafe PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>")
-TARGET_C_PROPERTIES (ttsafe STATIC)
-target_link_libraries (ttsafe PRIVATE ${HDF5_LIB_TARGET} ${HDF5_TEST_LIB_TARGET})
-set_target_properties (ttsafe PROPERTIES FOLDER test)
-if (BUILD_SHARED_LIBS)
- add_executable (ttsafe-shared ${ttsafe_SOURCES})
- target_include_directories(ttsafe-shared PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>")
- TARGET_C_PROPERTIES (ttsafe-shared SHARED)
- target_link_libraries (ttsafe-shared PRIVATE ${HDF5_TEST_LIBSH_TARGET} ${HDF5_LIBSH_TARGET})
- set_target_properties (ttsafe-shared PROPERTIES FOLDER test)
+target_include_directories (ttsafe PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>")
+if (NOT BUILD_SHARED_LIBS)
+ TARGET_C_PROPERTIES (ttsafe STATIC)
+ target_link_libraries (ttsafe PRIVATE ${HDF5_TEST_LIB_TARGET})
+ if (NOT WIN32)
+ target_link_libraries (ttsafe
+ PRIVATE $<$<BOOL:${HDF5_ENABLE_THREADSAFE}>:Threads::Threads>
+ )
+ endif ()
+else ()
+ TARGET_C_PROPERTIES (ttsafe SHARED)
+ target_link_libraries (ttsafe PRIVATE ${HDF5_TEST_LIBSH_TARGET} $<$<BOOL:${HDF5_ENABLE_THREADSAFE}>:Threads::Threads>)
endif ()
+set_target_properties (ttsafe PROPERTIES FOLDER test)
##############################################################################
### A D D I T I O N A L T E S T S ###
@@ -378,15 +385,15 @@ set (H5_CHECK_TESTS
flushrefresh
)
-foreach (test ${H5_CHECK_TESTS})
- ADD_H5_EXE(${test})
+foreach (h5_test ${H5_CHECK_TESTS})
+ ADD_H5_EXE(${h5_test})
endforeach ()
#-- Adding test for libinfo
set (GREP_RUNNER ${PROJECT_BINARY_DIR}/GrepRunner.cmake)
file (WRITE ${GREP_RUNNER}
"file (STRINGS \${TEST_PROGRAM} TEST_RESULT REGEX \"SUMMARY OF THE HDF5 CONFIGURATION\")
-if (\${TEST_RESULT} STREQUAL \"0\")
+if (NOT TEST_RESULT)
message (FATAL_ERROR \"Failed: The output: \${TEST_RESULT} of \${TEST_PROGRAM} did not contain SUMMARY OF THE HDF5 CONFIGURATION\")
else ()
message (STATUS \"COMMAND Result: \${TEST_RESULT}\")
@@ -411,8 +418,8 @@ set (H5_SWMR_TESTS
swmr_writer
)
-foreach (test ${H5_SWMR_TESTS})
- ADD_H5_EXE(${test})
+foreach (h5_test ${H5_SWMR_TESTS})
+ ADD_H5_EXE(${h5_test})
endforeach ()
set (H5_VDS_SWMR_TESTS
@@ -421,40 +428,42 @@ set (H5_VDS_SWMR_TESTS
vds_swmr_writer
)
-foreach (test ${H5_VDS_SWMR_TESTS})
- ADD_H5_EXE(${test})
+foreach (h5_test ${H5_VDS_SWMR_TESTS})
+ ADD_H5_EXE(${h5_test})
endforeach ()
#-- Adding test for accum_swmr_reader
# This has to be copied to the test directory for execve() to find it
# and it can't be renamed (i.e., no <foo>-shared).
add_executable (accum_swmr_reader ${HDF5_TEST_SOURCE_DIR}/accum_swmr_reader.c)
-target_include_directories(accum_swmr_reader PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>")
-TARGET_C_PROPERTIES (accum_swmr_reader STATIC)
-target_link_libraries (accum_swmr_reader PRIVATE ${HDF5_LIB_TARGET} ${HDF5_TEST_LIB_TARGET})
+target_include_directories (accum_swmr_reader PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>")
+if (NOT BUILD_SHARED_LIBS)
+ TARGET_C_PROPERTIES (accum_swmr_reader STATIC)
+ target_link_libraries (accum_swmr_reader PRIVATE ${HDF5_TEST_LIB_TARGET} ${HDF5_LIB_TARGET})
+else ()
+ TARGET_C_PROPERTIES (accum_swmr_reader SHARED)
+ target_link_libraries (accum_swmr_reader PRIVATE ${HDF5_TEST_LIBSH_TARGET} ${HDF5_LIBSH_TARGET})
+endif ()
set_target_properties (accum_swmr_reader PROPERTIES FOLDER test)
#-- Set accum dependencies
set_target_properties (accum PROPERTIES DEPENDS accum_swmr_reader)
-if (BUILD_SHARED_LIBS)
- set_target_properties (accum-shared PROPERTIES DEPENDS accum_swmr_reader)
-endif ()
##############################################################################
### P L U G I N T E S T S
##############################################################################
if (BUILD_SHARED_LIBS)
add_executable (filter_plugin ${HDF5_TEST_SOURCE_DIR}/filter_plugin.c)
- target_include_directories(filter_plugin PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>")
+ target_include_directories (filter_plugin PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>")
TARGET_C_PROPERTIES (filter_plugin SHARED)
- target_link_libraries (filter_plugin PRIVATE ${HDF5_TEST_LIB_TARGET})
- set_target_properties (filter_plugin PROPERTIES FOLDER test)
-else ()
- add_executable (filter_plugin ${HDF5_TEST_SOURCE_DIR}/filter_plugin.c)
- target_include_directories(filter_plugin PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>")
- TARGET_C_PROPERTIES (filter_plugin STATIC)
- target_link_libraries (filter_plugin PRIVATE ${HDF5_TEST_LIB_TARGET})
+ target_link_libraries (filter_plugin PRIVATE ${HDF5_TEST_LIBSH_TARGET})
set_target_properties (filter_plugin PROPERTIES FOLDER test)
+
+ add_executable (vol_plugin ${HDF5_TEST_SOURCE_DIR}/vol_plugin.c)
+ target_include_directories (vol_plugin PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>")
+ TARGET_C_PROPERTIES (vol_plugin SHARED)
+ target_link_libraries (vol_plugin PRIVATE ${HDF5_TEST_LIBSH_TARGET})
+ set_target_properties (vol_plugin PROPERTIES FOLDER test)
endif ()
##############################################################################
@@ -462,44 +471,38 @@ endif ()
##############################################################################
set (use_append_chunk_SOURCES ${HDF5_TEST_SOURCE_DIR}/use_append_chunk.c ${HDF5_TEST_SOURCE_DIR}/use_common.c)
add_executable (use_append_chunk ${use_append_chunk_SOURCES})
-target_include_directories(use_append_chunk PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>")
-TARGET_C_PROPERTIES (use_append_chunk STATIC)
-target_link_libraries (use_append_chunk PRIVATE ${HDF5_LIB_TARGET} ${HDF5_TEST_LIB_TARGET})
-set_target_properties (use_append_chunk PROPERTIES FOLDER test)
-if (BUILD_SHARED_LIBS)
- add_executable (use_append_chunk-shared ${use_append_chunk_SOURCES})
- target_include_directories(use_append_chunk-shared PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>")
- TARGET_C_PROPERTIES (use_append_chunk-shared SHARED)
- target_link_libraries (use_append_chunk-shared PRIVATE ${HDF5_TEST_LIBSH_TARGET} ${HDF5_LIBSH_TARGET})
- set_target_properties (use_append_chunk-shared PROPERTIES FOLDER test)
+target_include_directories (use_append_chunk PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>")
+if (NOT BUILD_SHARED_LIBS)
+ TARGET_C_PROPERTIES (use_append_chunk STATIC)
+ target_link_libraries (use_append_chunk PRIVATE ${HDF5_TEST_LIB_TARGET})
+else ()
+ TARGET_C_PROPERTIES (use_append_chunk SHARED)
+ target_link_libraries (use_append_chunk PRIVATE ${HDF5_TEST_LIBSH_TARGET})
endif ()
+set_target_properties (use_append_chunk PROPERTIES FOLDER test)
set (use_append_mchunks_SOURCES ${HDF5_TEST_SOURCE_DIR}/use_append_mchunks.c ${HDF5_TEST_SOURCE_DIR}/use_common.c)
add_executable (use_append_mchunks ${use_append_mchunks_SOURCES})
-target_include_directories(use_append_mchunks PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>")
-TARGET_C_PROPERTIES (use_append_mchunks STATIC)
-target_link_libraries (use_append_mchunks PRIVATE ${HDF5_LIB_TARGET} ${HDF5_TEST_LIB_TARGET})
-set_target_properties (use_append_mchunks PROPERTIES FOLDER test)
-if (BUILD_SHARED_LIBS)
- add_executable (use_append_mchunks-shared ${use_append_mchunks_SOURCES})
- target_include_directories(use_append_mchunks-shared PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>")
- TARGET_C_PROPERTIES (use_append_mchunks-shared SHARED)
- target_link_libraries (use_append_mchunks-shared PRIVATE ${HDF5_TEST_LIBSH_TARGET} ${HDF5_LIBSH_TARGET})
- set_target_properties (use_append_mchunks-shared PROPERTIES FOLDER test)
+target_include_directories (use_append_mchunks PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>")
+if (NOT BUILD_SHARED_LIBS)
+ TARGET_C_PROPERTIES (use_append_mchunks STATIC)
+ target_link_libraries (use_append_mchunks PRIVATE ${HDF5_TEST_LIB_TARGET})
+else ()
+ TARGET_C_PROPERTIES (use_append_mchunks SHARED)
+ target_link_libraries (use_append_mchunks PRIVATE ${HDF5_TEST_LIBSH_TARGET})
endif ()
+set_target_properties (use_append_mchunks PROPERTIES FOLDER test)
set (use_disable_mdc_flushes_SOURCES ${HDF5_TEST_SOURCE_DIR}/use_disable_mdc_flushes.c)
add_executable (use_disable_mdc_flushes ${use_disable_mdc_flushes_SOURCES})
-target_include_directories(use_disable_mdc_flushes PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>")
-TARGET_C_PROPERTIES (use_disable_mdc_flushes STATIC)
-target_link_libraries (use_disable_mdc_flushes PRIVATE ${HDF5_LIB_TARGET} ${HDF5_TEST_LIB_TARGET})
-set_target_properties (use_disable_mdc_flushes PROPERTIES FOLDER test)
-if (BUILD_SHARED_LIBS)
- add_executable (use_disable_mdc_flushes-shared ${use_disable_mdc_flushes_SOURCES})
- target_include_directories(use_disable_mdc_flushes-shared PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>")
- TARGET_C_PROPERTIES (use_disable_mdc_flushes-shared SHARED)
- target_link_libraries (use_disable_mdc_flushes-shared PRIVATE ${HDF5_TEST_LIBSH_TARGET} ${HDF5_LIBSH_TARGET})
- set_target_properties (use_disable_mdc_flushes-shared PROPERTIES FOLDER test)
+target_include_directories (use_disable_mdc_flushes PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>")
+if (NOT BUILD_SHARED_LIBS)
+ TARGET_C_PROPERTIES (use_disable_mdc_flushes STATIC)
+ target_link_libraries (use_disable_mdc_flushes PRIVATE ${HDF5_TEST_LIB_TARGET})
+else ()
+ TARGET_C_PROPERTIES (use_disable_mdc_flushes SHARED)
+ target_link_libraries (use_disable_mdc_flushes PRIVATE ${HDF5_TEST_LIBSH_TARGET})
endif ()
+set_target_properties (use_disable_mdc_flushes PROPERTIES FOLDER test)
include (CMakeTests.cmake)
diff --git a/test/CMakeVOLTests.cmake b/test/CMakePassthroughVOLTests.cmake
index fdd7ba0..24a0201 100644
--- a/test/CMakeVOLTests.cmake
+++ b/test/CMakePassthroughVOLTests.cmake
@@ -31,37 +31,23 @@ foreach (voltest ${VOL_LIST})
file (MAKE_DIRECTORY "${PROJECT_BINARY_DIR}/${voltest}")
file (MAKE_DIRECTORY "${PROJECT_BINARY_DIR}/${voltest}/testfiles")
file (MAKE_DIRECTORY "${PROJECT_BINARY_DIR}/${voltest}/testfiles/plist_files")
- if (BUILD_SHARED_LIBS)
- file (MAKE_DIRECTORY "${PROJECT_BINARY_DIR}/${voltest}-shared")
- file (MAKE_DIRECTORY "${PROJECT_BINARY_DIR}/${voltest}-shared/testfiles")
- file (MAKE_DIRECTORY "${PROJECT_BINARY_DIR}/${voltest}-shared/testfiles/plist_files")
- endif ()
endforeach ()
foreach (voltest ${VOL_LIST})
foreach (h5_tfile ${HDF5_TEST_FILES})
HDFTEST_COPY_FILE("${HDF5_TOOLS_DIR}/testfiles/${h5_tfile}" "${PROJECT_BINARY_DIR}/${voltest}/${h5_tfile}" "HDF5_VOLTEST_LIB_files")
- if (BUILD_SHARED_LIBS)
- HDFTEST_COPY_FILE("${HDF5_TOOLS_DIR}/testfiles/${h5_tfile}" "${PROJECT_BINARY_DIR}/${voltest}-shared/${h5_tfile}" "HDF5_VOLTEST_LIBSH_files")
- endif ()
endforeach ()
endforeach ()
foreach (voltest ${VOL_LIST})
foreach (ref_file ${HDF5_REFERENCE_FILES})
HDFTEST_COPY_FILE("${HDF5_TEST_SOURCE_DIR}/testfiles/${ref_file}" "${PROJECT_BINARY_DIR}/${voltest}/${ref_file}" "HDF5_VOLTEST_LIB_files")
- if (BUILD_SHARED_LIBS)
- HDFTEST_COPY_FILE("${HDF5_TEST_SOURCE_DIR}/testfiles/${ref_file}" "${PROJECT_BINARY_DIR}/${voltest}-shared/${ref_file}" "HDF5_VOLTEST_LIBSH_files")
- endif ()
endforeach ()
endforeach ()
foreach (voltest ${VOL_LIST})
foreach (h5_file ${HDF5_REFERENCE_TEST_FILES})
HDFTEST_COPY_FILE("${HDF5_TEST_SOURCE_DIR}/${h5_file}" "${HDF5_TEST_BINARY_DIR}/${voltest}/${h5_file}" "HDF5_VOLTEST_LIB_files")
- if (BUILD_SHARED_LIBS)
- HDFTEST_COPY_FILE("${HDF5_TEST_SOURCE_DIR}/${h5_file}" "${HDF5_TEST_BINARY_DIR}/${voltest}-shared/${h5_file}" "HDF5_VOLTEST_LIBSH_files")
- endif ()
endforeach ()
endforeach ()
@@ -69,17 +55,10 @@ foreach (voltest ${VOL_LIST})
foreach (plistfile ${HDF5_REFERENCE_PLIST_FILES})
HDFTEST_COPY_FILE("${HDF5_TEST_SOURCE_DIR}/testfiles/plist_files/${plistfile}" "${PROJECT_BINARY_DIR}/${voltest}/testfiles/plist_files/${plistfile}" "HDF5_VOLTEST_LIB_files")
HDFTEST_COPY_FILE("${HDF5_TEST_SOURCE_DIR}/testfiles/plist_files/def_${plistfile}" "${PROJECT_BINARY_DIR}/${voltest}/testfiles/plist_files/def_${plistfile}" "HDF5_VOLTEST_LIB_files")
- if (BUILD_SHARED_LIBS)
- HDFTEST_COPY_FILE("${HDF5_TEST_SOURCE_DIR}/testfiles/plist_files/${plistfile}" "${PROJECT_BINARY_DIR}/${voltest}-shared/testfiles/plist_files/${plistfile}" "HDF5_VOLTEST_LIBSH_files")
- HDFTEST_COPY_FILE("${HDF5_TEST_SOURCE_DIR}/testfiles/plist_files/def_${plistfile}" "${PROJECT_BINARY_DIR}/${voltest}-shared/testfiles/plist_files/def_${plistfile}" "HDF5_VOLTEST_LIBSH_files")
- endif ()
endforeach ()
endforeach ()
add_custom_target(HDF5_VOLTEST_LIB_files ALL COMMENT "Copying files needed by HDF5_VOLTEST_LIB tests" DEPENDS ${HDF5_VOLTEST_LIB_files_list})
-if (BUILD_SHARED_LIBS)
- add_custom_target(HDF5_VOLTEST_LIBSH_files ALL COMMENT "Copying files needed by HDF5_VOLTEST_LIBSH tests" DEPENDS ${HDF5_VOLTEST_LIBSH_files_list})
-endif ()
##############################################################################
##############################################################################
@@ -89,6 +68,7 @@ endif ()
set (H5_VOL_SKIP_TESTS
cache
+ cache_image
accum
fheap
big
@@ -98,6 +78,8 @@ endif ()
tcheck_version
testmeta
links_env
+ external_env
+ vds_env
)
if (NOT CYGWIN)
list (REMOVE_ITEM H5_VOL_SKIP_TESTS big cache)
@@ -108,154 +90,117 @@ endif ()
if ("${voltest}" STREQUAL "flush1" OR "${voltest}" STREQUAL "flush2")
if ("${volname}" STREQUAL "multi" OR "${volname}" STREQUAL "split")
if (NOT BUILD_SHARED_LIBS AND NOT ${HDF_CFG_NAME} MATCHES "Debug")
+ add_test (
+ NAME VOL-${volname}-${voltest}-clear-objects
+ COMMAND ${CMAKE_COMMAND}
+ -E remove
+ ${volname}/${volname}-${voltest}.out
+ ${volname}/${volname}-${voltest}.out.err
+ )
add_test (NAME VOL-${volname}-${voltest}
COMMAND "${CMAKE_COMMAND}"
-D "TEST_PROGRAM=$<TARGET_FILE:${voltest}>"
-D "TEST_ARGS:STRING="
-D "TEST_VOL:STRING=${volinfo}"
-D "TEST_EXPECT=${resultcode}"
- -D "TEST_OUTPUT=${volname}-${voltest}"
+ -D "TEST_OUTPUT=${volname}-${voltest}.out"
-D "TEST_FOLDER=${PROJECT_BINARY_DIR}/${volname}"
-P "${HDF_RESOURCES_DIR}/volTest.cmake"
)
set_tests_properties (VOL-${volname}-${voltest} PROPERTIES
+ DEPENDS VOL-${volname}-${voltest}-clear-objects
ENVIRONMENT "srcdir=${HDF5_TEST_BINARY_DIR}/${volname}"
WORKING_DIRECTORY ${HDF5_TEST_BINARY_DIR}/${volname}
)
- if (BUILD_SHARED_LIBS)
- add_test (NAME VOL-${volname}-${test}-shared
- COMMAND "${CMAKE_COMMAND}"
- -D "TEST_PROGRAM=$<TARGET_FILE:${voltest}-shared>"
- -D "TEST_ARGS:STRING="
- -D "TEST_VOL:STRING=${volinfo}"
- -D "TEST_EXPECT=${resultcode}"
- -D "TEST_OUTPUT=${volname}-${voltest}-shared"
- -D "TEST_FOLDER=${PROJECT_BINARY_DIR}/${volname}-shared"
- -P "${HDF_RESOURCES_DIR}/volTest.cmake"
- )
- set_tests_properties (VOL-${volname}-${voltest}-shared PROPERTIES
- ENVIRONMENT "srcdir=${HDF5_TEST_BINARY_DIR}/${volname}-shared"
- WORKING_DIRECTORY ${HDF5_TEST_BINARY_DIR}/${volname}-shared
- )
- endif ()
else ()
add_test (NAME VOL-${volname}-${voltest}
COMMAND ${CMAKE_COMMAND} -E echo "SKIP VOL-${volname}-${voltest}"
)
- if (BUILD_SHARED_LIBS)
- add_test (NAME VOL-${volname}-${test}-shared
- COMMAND ${CMAKE_COMMAND} -E echo "SKIP VOL-${volname}-${voltest}-shared"
- )
- endif ()
endif ()
else ()
+ add_test (
+ NAME VOL-${volname}-${voltest}-clear-objects
+ COMMAND ${CMAKE_COMMAND}
+ -E remove
+ ${volname}/${volname}-${voltest}.out
+ ${volname}/${volname}-${voltest}.out.err
+ )
add_test (NAME VOL-${volname}-${voltest}
COMMAND "${CMAKE_COMMAND}"
-D "TEST_PROGRAM=$<TARGET_FILE:${voltest}>"
-D "TEST_ARGS:STRING="
-D "TEST_VOL:STRING=${volinfo}"
-D "TEST_EXPECT=${resultcode}"
- -D "TEST_OUTPUT=${volname}-${voltest}"
+ -D "TEST_OUTPUT=${volname}-${voltest}.out"
-D "TEST_FOLDER=${PROJECT_BINARY_DIR}/${volname}"
-P "${HDF_RESOURCES_DIR}/volTest.cmake"
)
set_tests_properties (VOL-${volname}-${voltest} PROPERTIES
+ DEPENDS VOL-${volname}-${voltest}-clear-objects
ENVIRONMENT "srcdir=${HDF5_TEST_BINARY_DIR}/${volname}"
WORKING_DIRECTORY ${HDF5_TEST_BINARY_DIR}/${volname}
)
- if (BUILD_SHARED_LIBS)
- add_test (NAME VOL-${volname}-${test}-shared
- COMMAND "${CMAKE_COMMAND}"
- -D "TEST_PROGRAM=$<TARGET_FILE:${voltest}-shared>"
- -D "TEST_ARGS:STRING="
- -D "TEST_VOL:STRING=${volinfo}"
- -D "TEST_EXPECT=${resultcode}"
- -D "TEST_OUTPUT=${volname}-${voltest}-shared"
- -D "TEST_FOLDER=${PROJECT_BINARY_DIR}/${volname}-shared"
- -P "${HDF_RESOURCES_DIR}/volTest.cmake"
- )
- set_tests_properties (VOL-${volname}-${voltest}-shared PROPERTIES
- ENVIRONMENT "srcdir=${HDF5_TEST_BINARY_DIR}/${volname}-shared"
- WORKING_DIRECTORY ${HDF5_TEST_BINARY_DIR}/${volname}-shared
- )
- endif ()
endif ()
else ()
+ add_test (
+ NAME VOL-${volname}-${voltest}-clear-objects
+ COMMAND ${CMAKE_COMMAND}
+ -E remove
+ ${volname}/${volname}-${voltest}.out
+ ${volname}/${volname}-${voltest}.out.err
+ )
add_test (NAME VOL-${volname}-${voltest}
COMMAND "${CMAKE_COMMAND}"
-D "TEST_PROGRAM=$<TARGET_FILE:${voltest}>"
-D "TEST_ARGS:STRING="
-D "TEST_VOL:STRING=${volinfo}"
-D "TEST_EXPECT=${resultcode}"
- -D "TEST_OUTPUT=${volname}-${voltest}"
+ -D "TEST_OUTPUT=${volname}-${voltest}.out"
-D "TEST_FOLDER=${PROJECT_BINARY_DIR}/${volname}"
-P "${HDF_RESOURCES_DIR}/volTest.cmake"
)
set_tests_properties (VOL-${volname}-${voltest} PROPERTIES
+ DEPENDS VOL-${volname}-${voltest}-clear-objects
ENVIRONMENT "srcdir=${HDF5_TEST_BINARY_DIR}/${volname};HDF5TestExpress=${HDF_TEST_EXPRESS}"
WORKING_DIRECTORY ${HDF5_TEST_BINARY_DIR}/${volname}
)
- if (BUILD_SHARED_LIBS AND NOT "${voltest}" STREQUAL "cache")
- add_test (NAME VOL-${volname}-${voltest}-shared
- COMMAND "${CMAKE_COMMAND}"
- -D "TEST_PROGRAM=$<TARGET_FILE:${voltest}-shared>"
- -D "TEST_ARGS:STRING="
- -D "TEST_VOL:STRING=${volinfo}"
- -D "TEST_EXPECT=${resultcode}"
- -D "TEST_OUTPUT=${volname}-${voltest}-shared"
- -D "TEST_FOLDER=${PROJECT_BINARY_DIR}/${volname}-shared"
- -P "${HDF_RESOURCES_DIR}/volTest.cmake"
- )
- set_tests_properties (VOL-${volname}-${voltest}-shared PROPERTIES
- ENVIRONMENT "srcdir=${HDF5_TEST_BINARY_DIR}/${volname}-shared;HDF5TestExpress=${HDF_TEST_EXPRESS}"
- WORKING_DIRECTORY ${HDF5_TEST_BINARY_DIR}/${volname}-shared
- )
- endif ()
endif ()
endmacro ()
macro (DO_VOL_TEST voltest volname volinfo resultcode)
#message(STATUS "${voltest}-${volname} with ${volinfo}")
+ add_test (
+ NAME VOL-${volname}-${voltest}-clear-objects
+ COMMAND ${CMAKE_COMMAND}
+ -E remove
+ ${volname}/${volname}-${voltest}.out
+ ${volname}/${volname}-${voltest}.out.err
+ )
add_test (NAME VOL-${volname}-${voltest}
COMMAND "${CMAKE_COMMAND}"
-D "TEST_PROGRAM=$<TARGET_FILE:${voltest}>"
-D "TEST_ARGS:STRING="
-D "TEST_VOL:STRING=${volinfo}"
-D "TEST_EXPECT=${resultcode}"
- -D "TEST_OUTPUT=${volname}-${voltest}"
+ -D "TEST_OUTPUT=${volname}-${voltest}.out"
-D "TEST_FOLDER=${PROJECT_BINARY_DIR}/${volname}"
-P "${HDF_RESOURCES_DIR}/volTest.cmake"
)
set_tests_properties (VOL-${volname}-${voltest} PROPERTIES
+ DEPENDS VOL-${volname}-${voltest}-clear-objects
ENVIRONMENT "srcdir=${HDF5_TEST_BINARY_DIR}/${volname}"
WORKING_DIRECTORY ${HDF5_TEST_BINARY_DIR}/${volname}
)
- if (BUILD_SHARED_LIBS)
- add_test (NAME VOL-${volname}-${voltest}-shared
- COMMAND "${CMAKE_COMMAND}"
- -D "TEST_PROGRAM=$<TARGET_FILE:${voltest}-shared>"
- -D "TEST_ARGS:STRING="
- -D "TEST_VOL:STRING=${volinfo}"
- -D "TEST_EXPECT=${resultcode}"
- -D "TEST_OUTPUT=${volname}-${voltest}-shared"
- -D "TEST_FOLDER=${PROJECT_BINARY_DIR}/${volname}-shared"
- -P "${HDF_RESOURCES_DIR}/volTest.cmake"
- )
- set_tests_properties (VOL-${volname}-${voltest}-shared PROPERTIES
- ENVIRONMENT "srcdir=${HDF5_TEST_BINARY_DIR}/${volname}-shared"
- WORKING_DIRECTORY ${HDF5_TEST_BINARY_DIR}/${volname}-shared
- )
- endif ()
endmacro ()
macro (ADD_VOL_TEST volname volinfo resultcode)
#message(STATUS "volname=${volname} volinfo=${volinfo}")
- foreach (test ${H5_TESTS})
- if (NOT ${test} IN_LIST H5_VOL_SKIP_TESTS)
+ foreach (h5_test ${H5_TESTS})
+ if (NOT h5_test IN_LIST H5_VOL_SKIP_TESTS)
if (WIN32)
- CHECK_VOL_TEST (${test} ${volname} "${volinfo}" ${resultcode})
+ CHECK_VOL_TEST (${h5_test} ${volname} "${volinfo}" ${resultcode})
else ()
- DO_VOL_TEST (${test} ${volname} "${volinfo}" ${resultcode})
+ DO_VOL_TEST (${h5_test} ${volname} "${volinfo}" ${resultcode})
endif ()
endif ()
endforeach ()
@@ -266,48 +211,30 @@ endif ()
if (NOT CYGWIN)
set_tests_properties (VOL-${volname}-cache PROPERTIES TIMEOUT ${CTEST_VERY_LONG_TIMEOUT})
endif ()
- if (BUILD_SHARED_LIBS)
- set_tests_properties (VOL-${volname}-flush2-shared PROPERTIES DEPENDS VOL-${volname}-flush1-shared)
- set_tests_properties (VOL-${volname}-flush1-shared PROPERTIES TIMEOUT 10)
- set_tests_properties (VOL-${volname}-flush2-shared PROPERTIES TIMEOUT 10)
- set_tests_properties (VOL-${volname}-istore-shared PROPERTIES TIMEOUT ${CTEST_VERY_LONG_TIMEOUT})
- if (NOT CYGWIN AND NOT WIN32)
- set_tests_properties (VOL-${volname}-cache-shared PROPERTIES TIMEOUT ${CTEST_VERY_LONG_TIMEOUT})
- endif ()
- endif ()
- if (HDF5_TEST_FHEAP_VOL)
+ if (HDF5_TEST_FHEAP_PASSTHROUGH_VOL)
+ add_test (
+ NAME VOL-${volname}-fheap-clear-objects
+ COMMAND ${CMAKE_COMMAND}
+ -E remove
+ ${volname}/${volname}-fheap.out
+ ${volname}/${volname}-fheap.out.err
+ )
add_test (NAME VOL-${volname}-fheap
COMMAND "${CMAKE_COMMAND}"
-D "TEST_PROGRAM=$<TARGET_FILE:fheap>"
-D "TEST_ARGS:STRING="
-D "TEST_VOL:STRING=${volinfo}"
-D "TEST_EXPECT=${resultcode}"
- -D "TEST_OUTPUT=${volname}-fheap"
+ -D "TEST_OUTPUT=${volname}-fheap.out"
-D "TEST_FOLDER=${PROJECT_BINARY_DIR}/${volname}"
-P "${HDF_RESOURCES_DIR}/volTest.cmake"
)
set_tests_properties (VOL-${volname}-fheap PROPERTIES
+ DEPENDS VOL-${volname}-fheap-clear-objects
TIMEOUT ${CTEST_VERY_LONG_TIMEOUT}
ENVIRONMENT "srcdir=${HDF5_TEST_BINARY_DIR}/${volname};HDF5TestExpress=${HDF_TEST_EXPRESS}"
WORKING_DIRECTORY ${HDF5_TEST_BINARY_DIR}/${volname}
)
- if (BUILD_SHARED_LIBS)
- add_test (NAME VOL-${volname}-fheap-shared
- COMMAND "${CMAKE_COMMAND}"
- -D "TEST_PROGRAM=$<TARGET_FILE:fheap-shared>"
- -D "TEST_ARGS:STRING="
- -D "TEST_VOL:STRING=${volinfo}"
- -D "TEST_EXPECT=${resultcode}"
- -D "TEST_OUTPUT=${volname}-fheap-shared"
- -D "TEST_FOLDER=${PROJECT_BINARY_DIR}/${volname}-shared"
- -P "${HDF_RESOURCES_DIR}/volTest.cmake"
- )
- set_tests_properties (VOL-${volname}-fheap-shared PROPERTIES
- TIMEOUT ${CTEST_VERY_LONG_TIMEOUT}
- ENVIRONMENT "srcdir=${HDF5_TEST_BINARY_DIR}/${volname}-shared;HDF5TestExpress=${HDF_TEST_EXPRESS}"
- WORKING_DIRECTORY ${HDF5_TEST_BINARY_DIR}/${volname}-shared
- )
- endif ()
endif ()
endmacro ()
diff --git a/test/CMakeTests.cmake b/test/CMakeTests.cmake
index ba72e3a..3d986d2 100644
--- a/test/CMakeTests.cmake
+++ b/test/CMakeTests.cmake
@@ -20,11 +20,6 @@
file (MAKE_DIRECTORY "${PROJECT_BINARY_DIR}/H5TEST")
file (MAKE_DIRECTORY "${PROJECT_BINARY_DIR}/H5TEST/testfiles")
file (MAKE_DIRECTORY "${PROJECT_BINARY_DIR}/H5TEST/testfiles/plist_files")
-if (BUILD_SHARED_LIBS)
- file (MAKE_DIRECTORY "${PROJECT_BINARY_DIR}/H5TEST-shared")
- file (MAKE_DIRECTORY "${PROJECT_BINARY_DIR}/H5TEST-shared/testfiles")
- file (MAKE_DIRECTORY "${PROJECT_BINARY_DIR}/H5TEST-shared/testfiles/plist_files")
-endif ()
# --------------------------------------------------------------------
# Copy all the HDF5 files from the source directory into the test directory
@@ -39,20 +34,9 @@ add_custom_command (
COMMAND ${CMAKE_COMMAND}
ARGS -E copy_if_different "$<TARGET_FILE:accum_swmr_reader>" "${PROJECT_BINARY_DIR}/H5TEST/accum_swmr_reader"
)
-if (BUILD_SHARED_LIBS)
- add_custom_command (
- TARGET accum_swmr_reader
- POST_BUILD
- COMMAND ${CMAKE_COMMAND}
- ARGS -E copy_if_different "$<TARGET_FILE:accum_swmr_reader>" "${PROJECT_BINARY_DIR}/H5TEST-shared/accum_swmr_reader"
- )
-endif ()
foreach (h5_tfile ${HDF5_TEST_FILES})
HDFTEST_COPY_FILE("${HDF5_TOOLS_DIR}/testfiles/${h5_tfile}" "${PROJECT_BINARY_DIR}/H5TEST/${h5_tfile}" "HDF5_TEST_LIB_files")
- if (BUILD_SHARED_LIBS)
- HDFTEST_COPY_FILE("${HDF5_TOOLS_DIR}/testfiles/${h5_tfile}" "${PROJECT_BINARY_DIR}/H5TEST-shared/${h5_tfile}" "HDF5_TEST_LIBSH_files")
- endif ()
endforeach ()
# --------------------------------------------------------------------
@@ -68,9 +52,6 @@ set (HDF5_REFERENCE_FILES
foreach (ref_file ${HDF5_REFERENCE_FILES})
HDFTEST_COPY_FILE("${HDF5_TEST_SOURCE_DIR}/testfiles/${ref_file}" "${PROJECT_BINARY_DIR}/H5TEST/${ref_file}" "HDF5_TEST_LIB_files")
- if (BUILD_SHARED_LIBS)
- HDFTEST_COPY_FILE("${HDF5_TEST_SOURCE_DIR}/testfiles/${ref_file}" "${PROJECT_BINARY_DIR}/H5TEST-shared/${ref_file}" "HDF5_TEST_LIBSH_files")
- endif ()
endforeach ()
# --------------------------------------------------------------------
@@ -130,10 +111,6 @@ set (HDF5_REFERENCE_PLIST_FILES
foreach (plistfile ${HDF5_REFERENCE_PLIST_FILES})
HDFTEST_COPY_FILE("${HDF5_TEST_SOURCE_DIR}/testfiles/plist_files/${plistfile}" "${PROJECT_BINARY_DIR}/H5TEST/testfiles/plist_files/${plistfile}" "HDF5_TEST_LIB_files")
HDFTEST_COPY_FILE("${HDF5_TEST_SOURCE_DIR}/testfiles/plist_files/def_${plistfile}" "${PROJECT_BINARY_DIR}/H5TEST/testfiles/plist_files/def_${plistfile}" "HDF5_TEST_LIB_files")
- if (BUILD_SHARED_LIBS)
- HDFTEST_COPY_FILE("${HDF5_TEST_SOURCE_DIR}/testfiles/plist_files/${plistfile}" "${PROJECT_BINARY_DIR}/H5TEST-shared/testfiles/plist_files/${plistfile}" "HDF5_TEST_LIBSH_files")
- HDFTEST_COPY_FILE("${HDF5_TEST_SOURCE_DIR}/testfiles/plist_files/def_${plistfile}" "${PROJECT_BINARY_DIR}/H5TEST-shared/testfiles/plist_files/def_${plistfile}" "HDF5_TEST_LIBSH_files")
- endif ()
endforeach ()
# --------------------------------------------------------------------
@@ -158,6 +135,7 @@ set (HDF5_REFERENCE_TEST_FILES
filespace_1_6.h5
filespace_1_8.h5
fill_old.h5
+ fill18.h5
filter_error.h5
fsm_aggr_nopersist.h5
fsm_aggr_persist.h5
@@ -194,127 +172,64 @@ set (HDF5_REFERENCE_TEST_FILES
foreach (h5_file ${HDF5_REFERENCE_TEST_FILES})
HDFTEST_COPY_FILE("${HDF5_TEST_SOURCE_DIR}/${h5_file}" "${HDF5_TEST_BINARY_DIR}/H5TEST/${h5_file}" "HDF5_TEST_LIB_files")
- if (BUILD_SHARED_LIBS)
- HDFTEST_COPY_FILE("${HDF5_TEST_SOURCE_DIR}/${h5_file}" "${HDF5_TEST_BINARY_DIR}/H5TEST-shared/${h5_file}" "HDF5_TEST_LIBSH_files")
- endif ()
endforeach ()
add_custom_target(HDF5_TEST_LIB_files ALL COMMENT "Copying files needed by HDF5_TEST_LIB tests" DEPENDS ${HDF5_TEST_LIB_files_list})
-if (BUILD_SHARED_LIBS)
- add_custom_target(HDF5_TEST_LIBSH_files ALL COMMENT "Copying files needed by HDF5_TEST_LIBSH tests" DEPENDS ${HDF5_TEST_LIBSH_files_list})
-endif ()
+
+set (testhdf5_CLEANFILES
+ coord.h5
+ dtypes10.h5
+ sys_file1
+ tattr.h5
+ tfile1.h5
+ tfile2.h5
+ tfile3.h5
+ tfile4.h5
+ tfile5.h5
+ tfile6.h5
+ tfile7.h5
+ tfilespace.h5
+ th5o_file
+ th5s1.h5
+ tselect.h5
+ tsohm.h5
+ tsohm_dst.h5
+ tsohm_src.h5
+)
# Remove any output file left over from previous test run
add_test (NAME H5TEST-clear-testhdf5-objects
COMMAND ${CMAKE_COMMAND}
- -E remove
- coord.h5
- dtypes10.h5
- sys_file1
- tattr.h5
- tfile1.h5
- tfile2.h5
- tfile3.h5
- tfile4.h5
- tfile5.h5
- tfile6.h5
- tfile7.h5
- tfilespace.h5
- th5o_file
- th5s1.h5
- tselect.h5
- tsohm.h5
- tsohm_dst.h5
- tsohm_src.h5
+ -E remove ${testhdf5_CLEANFILES}
WORKING_DIRECTORY
${HDF5_TEST_BINARY_DIR}/H5TEST
)
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
- )
- if (BUILD_SHARED_LIBS)
- add_test (NAME H5TEST-shared-clear-testhdf5-objects
- COMMAND ${CMAKE_COMMAND}
- -E remove
- coord.h5
- dtypes10.h5
- sys_file1
- tattr.h5
- tfile1.h5
- tfile2.h5
- tfile3.h5
- tfile4.h5
- tfile5.h5
- tfile6.h5
- tfile7.h5
- tfilespace.h5
- th5o_file
- th5s1.h5
- tselect.h5
- tsohm.h5
- tsohm_dst.h5
- tsohm_src.h5
- WORKING_DIRECTORY
- ${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"
- )
- set_tests_properties (H5TEST-shared-testhdf5 PROPERTIES
- FIXTURES_REQUIRED shared_clear_testhdf5
- ENVIRONMENT "srcdir=${HDF5_TEST_BINARY_DIR}/H5TEST-shared"
- WORKING_DIRECTORY ${HDF5_TEST_BINARY_DIR}/H5TEST-shared
- )
- endif ()
-endif ()
+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
+)
##############################################################################
##############################################################################
@@ -549,36 +464,39 @@ set (H5TEST_SEPARATE_TESTS
testhdf5
cache
cache_image
+ external_env
flush1
flush2
+ vds_env
)
-foreach (test ${H5_TESTS})
- if (NOT ${test} IN_LIST H5TEST_SEPARATE_TESTS)
+foreach (h5_test ${H5_TESTS})
+ if (NOT h5_test IN_LIST H5TEST_SEPARATE_TESTS)
if (HDF5_ENABLE_USING_MEMCHECKER)
- add_test (NAME H5TEST-${test} COMMAND $<TARGET_FILE:${test}>)
- set_tests_properties (H5TEST-${test} PROPERTIES
+ add_test (NAME H5TEST-${h5_test} COMMAND $<TARGET_FILE:${h5_test}>)
+ set_tests_properties (H5TEST-${h5_test} PROPERTIES
FIXTURES_REQUIRED clear_objects
ENVIRONMENT "srcdir=${HDF5_TEST_BINARY_DIR}/H5TEST"
WORKING_DIRECTORY ${HDF5_TEST_BINARY_DIR}/H5TEST
)
else ()
- if ("${test}" STREQUAL "big" AND CYGWIN)
- add_test (NAME H5TEST-${test}
+ if ("${h5_test}" STREQUAL "big" AND CYGWIN)
+ add_test (NAME H5TEST-${h5_test}
COMMAND ${CMAKE_COMMAND} -E echo "SKIP ${test}"
)
else ()
- add_test (NAME H5TEST-${test} COMMAND "${CMAKE_COMMAND}"
- -D "TEST_PROGRAM=$<TARGET_FILE:${test}>"
+ add_test (NAME H5TEST-${h5_test} COMMAND "${CMAKE_COMMAND}"
+ -D "TEST_PROGRAM=$<TARGET_FILE:${h5_test}>"
-D "TEST_ARGS:STRING="
-D "TEST_EXPECT=0"
-D "TEST_SKIP_COMPARE=TRUE"
- -D "TEST_OUTPUT=${test}.txt"
+ -D "TEST_OUTPUT=${h5_test}.txt"
+ -D "TEST_LIBRARY_DIRECTORY=${CMAKE_TEST_OUTPUT_DIRECTORY}"
#-D "TEST_REFERENCE=${test}.out"
-D "TEST_FOLDER=${HDF5_TEST_BINARY_DIR}/H5TEST"
-P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake"
)
endif ()
- set_tests_properties (H5TEST-${test} PROPERTIES
+ set_tests_properties (H5TEST-${h5_test} PROPERTIES
FIXTURES_REQUIRED clear_objects
ENVIRONMENT "srcdir=${HDF5_TEST_BINARY_DIR}/H5TEST"
WORKING_DIRECTORY ${HDF5_TEST_BINARY_DIR}/H5TEST
@@ -592,49 +510,6 @@ 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
- add_test (NAME H5TEST-shared-clear-objects
- COMMAND ${CMAKE_COMMAND}
- -E remove
- ${test_CLEANFILES}
- WORKING_DIRECTORY
- ${HDF5_TEST_BINARY_DIR}/H5TEST-shared
- )
- set_tests_properties (H5TEST-shared-clear-objects PROPERTIES FIXTURES_SETUP shared_clear_objects)
-
- foreach (test ${H5_TESTS})
- if (NOT ${test} IN_LIST H5TEST_SEPARATE_TESTS)
- if ("${test}" STREQUAL "big" AND CYGWIN)
- add_test (NAME H5TEST-shared-${test}
- COMMAND ${CMAKE_COMMAND} -E echo "SKIP ${test}-shared"
- )
- else ()
- add_test (NAME H5TEST-shared-${test} COMMAND "${CMAKE_COMMAND}"
- -D "TEST_PROGRAM=$<TARGET_FILE:${test}-shared>"
- -D "TEST_ARGS:STRING="
- -D "TEST_EXPECT=0"
- -D "TEST_SKIP_COMPARE=TRUE"
- -D "TEST_OUTPUT=${test}.txt"
- #-D "TEST_REFERENCE=${test}.out"
- -D "TEST_FOLDER=${HDF5_TEST_BINARY_DIR}/H5TEST-shared"
- -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake"
- )
- endif ()
- set_tests_properties (H5TEST-shared-${test} PROPERTIES
- FIXTURES_REQUIRED shared_clear_objects
- ENVIRONMENT "srcdir=${HDF5_TEST_BINARY_DIR}/H5TEST-shared"
- WORKING_DIRECTORY ${HDF5_TEST_BINARY_DIR}/H5TEST-shared
- )
- endif ()
- endforeach ()
-
- 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
if (NOT CYGWIN)
add_test (NAME H5TEST-clear-cache-objects
@@ -667,56 +542,101 @@ if (NOT CYGWIN)
set_tests_properties (H5TEST-cache PROPERTIES TIMEOUT ${CTEST_VERY_LONG_TIMEOUT})
endif ()
-#-- Adding test for cache_image
+if (TEST_CACHE_IMAGE)
+ #-- Adding test for cache_image
+ add_test (
+ NAME H5TEST-clear-cache_image-objects
+ COMMAND ${CMAKE_COMMAND}
+ -E remove
+ cache_image_test.h5
+ WORKING_DIRECTORY
+ ${HDF5_TEST_BINARY_DIR}/H5TEST
+ )
+ set_tests_properties (H5TEST-clear-cache_image-objects PROPERTIES FIXTURES_SETUP cache_image_clear_objects)
+ add_test (NAME H5TEST-cache_image COMMAND $<TARGET_FILE:cache_image>)
+ set_tests_properties (H5TEST-cache_image PROPERTIES
+ FIXTURES_REQUIRED cache_image_clear_objects
+ ENVIRONMENT "srcdir=${HDF5_TEST_BINARY_DIR}/H5TEST;HDF5TestExpress=${HDF_TEST_EXPRESS}"
+ WORKING_DIRECTORY ${HDF5_TEST_BINARY_DIR}/H5TEST
+ )
+endif ()
+
+#-- Adding test for external_env
add_test (
- NAME H5TEST-clear-cache_image-objects
+ NAME H5TEST-clear-external_env-objects
COMMAND ${CMAKE_COMMAND}
-E remove
- cache_image_test.h5
+ extern_1r.raw
+ extern_2r.raw
+ extern_3r.raw
+ extern_4r.raw
+ extern_1w.raw
+ extern_2w.raw
+ extern_3w.raw
+ extern_4w.raw
+ external_env.txt
+ external_env.out
WORKING_DIRECTORY
${HDF5_TEST_BINARY_DIR}/H5TEST
)
-set_tests_properties (H5TEST-clear-cache_image-objects PROPERTIES FIXTURES_SETUP cache_image_clear_objects)
-add_test (NAME H5TEST-cache_image COMMAND $<TARGET_FILE:cache_image>)
-set_tests_properties (H5TEST-cache_image PROPERTIES
- FIXTURES_REQUIRED cache_image_clear_objects
+set_tests_properties (H5TEST-clear-external_env-objects PROPERTIES FIXTURES_SETUP external_env_clear_objects)
+if (HDF5_ENABLE_USING_MEMCHECKER)
+ add_test (NAME H5TEST-external_env COMMAND $<TARGET_FILE:external_env>)
+else ()
+ add_test (NAME H5TEST-external_env COMMAND "${CMAKE_COMMAND}"
+ -D "TEST_PROGRAM=$<TARGET_FILE:external_env>"
+ -D "TEST_ARGS:STRING="
+ -D "TEST_ENV_VAR:STRING=HDF5_EXTFILE_PREFIX"
+ -D "TEST_ENV_VALUE:STRING=\${ORIGIN}"
+ -D "TEST_EXPECT=0"
+ -D "TEST_SKIP_COMPARE=TRUE"
+ -D "TEST_OUTPUT=external_env.txt"
+ #-D "TEST_REFERENCE=external_env.out"
+ -D "TEST_FOLDER=${PROJECT_BINARY_DIR}/H5TEST"
+ -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake"
+ )
+endif ()
+set_tests_properties (H5TEST-external_env PROPERTIES
+ FIXTURES_REQUIRED external_env_clear_objects
ENVIRONMENT "srcdir=${HDF5_TEST_BINARY_DIR}/H5TEST;HDF5TestExpress=${HDF_TEST_EXPRESS}"
WORKING_DIRECTORY ${HDF5_TEST_BINARY_DIR}/H5TEST
)
-if (BUILD_SHARED_LIBS)
- #-- Adding test for cache
- if (NOT CYGWIN AND NOT WIN32)
- add_test (NAME H5TEST-shared-clear-cache-objects
- COMMAND ${CMAKE_COMMAND}
- -E remove
- cache_test.h5
- WORKING_DIRECTORY
- ${HDF5_TEST_BINARY_DIR}/H5TEST-shared
- )
- set_tests_properties (H5TEST-clear-objects PROPERTIES FIXTURES_SETUP shared_cache_clear_objects)
- if (HDF5_ENABLE_USING_MEMCHECKER)
- add_test (NAME H5TEST-shared-cache COMMAND $<TARGET_FILE:cache-shared>)
- else ()
- add_test (NAME H5TEST-shared-cache COMMAND "${CMAKE_COMMAND}"
- -D "TEST_PROGRAM=$<TARGET_FILE:cache-shared>"
- -D "TEST_ARGS:STRING="
- -D "TEST_EXPECT=0"
- -D "TEST_SKIP_COMPARE=TRUE"
- -D "TEST_OUTPUT=cache-shared.txt"
- #-D "TEST_REFERENCE=cache-shared.out"
- -D "TEST_FOLDER=${HDF5_TEST_BINARY_DIR}/H5TEST-shared"
- -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake"
- )
- endif ()
- set_tests_properties (H5TEST-shared-cache PROPERTIES
- FIXTURES_REQUIRED shared_cache_clear_objects
- 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 ${CTEST_VERY_LONG_TIMEOUT})
- endif ()
+#-- Adding test for vds_env
+add_test (
+ NAME H5TEST-clear-vds_env-objects
+ COMMAND ${CMAKE_COMMAND}
+ -E remove
+ vds_virt_0.h5
+ vds_virt_3.h5
+ vds_src_2.h5
+ vds_env.txt
+ vds_env.out
+ WORKING_DIRECTORY
+ ${HDF5_TEST_BINARY_DIR}/H5TEST
+)
+set_tests_properties (H5TEST-clear-vds_env-objects PROPERTIES FIXTURES_SETUP vds_env_clear_objects)
+if (HDF5_ENABLE_USING_MEMCHECKER)
+ add_test (NAME H5TEST-vds_env COMMAND $<TARGET_FILE:vds_env>)
+else ()
+ add_test (NAME H5TEST-vds_env COMMAND "${CMAKE_COMMAND}"
+ -D "TEST_PROGRAM=$<TARGET_FILE:vds_env>"
+ -D "TEST_ARGS:STRING="
+ -D "TEST_ENV_VAR:STRING=HDF5_VDS_PREFIX"
+ -D "TEST_ENV_VALUE:STRING=\${ORIGIN}/tmp"
+ -D "TEST_EXPECT=0"
+ -D "TEST_SKIP_COMPARE=TRUE"
+ -D "TEST_OUTPUT=vds_env.txt"
+ #-D "TEST_REFERENCE=vds_env.out"
+ -D "TEST_FOLDER=${PROJECT_BINARY_DIR}/H5TEST"
+ -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake"
+ )
endif ()
+set_tests_properties (H5TEST-vds_env PROPERTIES
+ FIXTURES_REQUIRED vds_env_clear_objects
+ ENVIRONMENT "srcdir=${HDF5_TEST_BINARY_DIR}/H5TEST;HDF5TestExpress=${HDF_TEST_EXPRESS}"
+ WORKING_DIRECTORY ${HDF5_TEST_BINARY_DIR}/H5TEST
+)
#-- Adding test for flush1/2
add_test (NAME H5TEST-clear-flush-objects
@@ -783,7 +703,6 @@ set_tests_properties (H5TEST-tcheck_version-release PROPERTIES
WILL_FAIL "true"
)
-
##############################################################################
##############################################################################
### A D D I T I O N A L T E S T S ###
@@ -927,130 +846,38 @@ add_test (NAME H5TEST-clear-links_env-objects
${HDF5_TEST_BINARY_DIR}/H5TEST
)
set_tests_properties (H5TEST-clear-links_env-objects PROPERTIES FIXTURES_SETUP links_env_clear_objects)
-add_test (NAME H5TEST-links_env COMMAND "${CMAKE_COMMAND}"
- -D "TEST_PROGRAM=$<TARGET_FILE:links_env>"
- -D "TEST_ARGS:STRING="
- -D "TEST_ENV_VAR:STRING=HDF5_EXT_PREFIX"
- -D "TEST_ENV_VALUE:STRING=.:tmp"
- -D "TEST_EXPECT=0"
- -D "TEST_OUTPUT=links_env.txt"
- -D "TEST_REFERENCE=links_env.out"
- -D "TEST_FOLDER=${PROJECT_BINARY_DIR}/H5TEST"
- -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake"
-)
-set_tests_properties (H5TEST-links_env PROPERTIES
- FIXTURES_REQUIRED links_env_clear_objects
- ENVIRONMENT "srcdir=${HDF5_TEST_BINARY_DIR}/H5TEST"
- WORKING_DIRECTORY ${HDF5_TEST_BINARY_DIR}/H5TEST
-)
-
-#-- Adding test for libinfo
-add_test (NAME H5TEST-testlibinfo
- COMMAND ${CMAKE_COMMAND} -D "TEST_PROGRAM=$<TARGET_FILE:${HDF5_LIB_TARGET}>" -P "${GREP_RUNNER}"
- WORKING_DIRECTORY
- ${HDF5_TEST_BINARY_DIR}/H5TEST
-)
-
-if (BUILD_SHARED_LIBS)
- #-- Adding test for err_compat
- if (HDF5_ENABLE_DEPRECATED_SYMBOLS)
- add_test (NAME H5TEST-shared-clear-err_compat-objects
- COMMAND ${CMAKE_COMMAND}
- -E remove
- err_compat.txt
- err_compat.txt.err
- WORKING_DIRECTORY
- ${HDF5_TEST_BINARY_DIR}/H5TEST-shared
- )
- set_tests_properties (H5TEST-shared-clear-err_compat-objects PROPERTIES FIXTURES_SETUP shared_err_compat_clear_objects)
- add_test (NAME H5TEST-shared-err_compat COMMAND "${CMAKE_COMMAND}"
- -D "TEST_PROGRAM=$<TARGET_FILE:err_compat-shared>"
- -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"
- -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake"
- )
- set_tests_properties (H5TEST-shared-err_compat PROPERTIES
- FIXTURES_REQUIRED shared_err_compat_clear_objects
- ENVIRONMENT "srcdir=${HDF5_TEST_BINARY_DIR}/H5TEST-shared"
- WORKING_DIRECTORY ${HDF5_TEST_BINARY_DIR}/H5TEST-shared
- )
- endif ()
-
- #-- Adding test for error_test
- add_test (NAME H5TEST-shared-clear-error_test-objects
- COMMAND ${CMAKE_COMMAND}
- -E remove
- error_test.txt
- error_test.txt.err
- WORKING_DIRECTORY
- ${HDF5_TEST_BINARY_DIR}/H5TEST-shared
- )
- set_tests_properties (H5TEST-shared-clear-error_test-objects PROPERTIES FIXTURES_SETUP shared_error_test_clear_objects)
- if (HDF5_USE_16_API_DEFAULT)
- add_test (
- NAME H5TEST-shared-error_test
- COMMAND ${CMAKE_COMMAND} -E echo "SKIP $<TARGET_FILE:error_test-shared>"
- )
- set_property(TEST H5TEST-shared-error_test PROPERTY DISABLED)
- else ()
- add_test (NAME H5TEST-shared-error_test COMMAND "${CMAKE_COMMAND}"
- -D "TEST_PROGRAM=$<TARGET_FILE:error_test-shared>"
- -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"
- -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake"
- )
- set_tests_properties (H5TEST-shared-error_test PROPERTIES
- FIXTURES_REQUIRED shared_error_test_clear_objects
- ENVIRONMENT "srcdir=${HDF5_TEST_BINARY_DIR}/H5TEST-shared;HDF5_PLUGIN_PRELOAD=::"
- WORKING_DIRECTORY ${HDF5_TEST_BINARY_DIR}/H5TEST-shared
- )
- endif ()
-
- #-- Adding test for links_env
- add_test (NAME H5TEST-shared-clear-links_env-objects
- COMMAND ${CMAKE_COMMAND}
- -E remove
- links_env.txt
- links_env.txt.err
- extlinks_env0.h5
- extlinks_env1.h5
- tmp/extlinks_env1.h5
- WORKING_DIRECTORY
- ${HDF5_TEST_BINARY_DIR}/H5TEST-shared
- )
- set_tests_properties (H5TEST-shared-clear-links_env-objects PROPERTIES FIXTURES_SETUP shared_links_env_clear_objects)
- add_test (NAME H5TEST-shared-links_env COMMAND "${CMAKE_COMMAND}"
- -D "TEST_PROGRAM=$<TARGET_FILE:links_env-shared>"
+if (HDF5_ENABLE_USING_MEMCHECKER)
+ add_test (NAME H5TEST-links_env COMMAND $<TARGET_FILE:links_env>)
+else ()
+ add_test (NAME H5TEST-links_env COMMAND "${CMAKE_COMMAND}"
+ -D "TEST_PROGRAM=$<TARGET_FILE:links_env>"
-D "TEST_ARGS:STRING="
- -D "TEST_ENV_VAR:STRING=HDF5_EXT_PREFIX"
- -D "TEST_ENV_VALUE:STRING=.:tmp"
+ #-D "TEST_ENV_VAR:STRING=HDF5_EXT_PREFIX"
+ #-D "TEST_ENV_VALUE:STRING=.:tmp"
-D "TEST_EXPECT=0"
-D "TEST_OUTPUT=links_env.txt"
-D "TEST_REFERENCE=links_env.out"
- -D "TEST_FOLDER=${PROJECT_BINARY_DIR}/H5TEST-shared"
+ -D "TEST_FOLDER=${PROJECT_BINARY_DIR}/H5TEST"
-P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake"
)
- set_tests_properties (H5TEST-shared-links_env PROPERTIES
- FIXTURES_REQUIRED shared_links_env_clear_objects
- ENVIRONMENT "srcdir=${HDF5_TEST_BINARY_DIR}/H5TEST-shared"
- WORKING_DIRECTORY ${HDF5_TEST_BINARY_DIR}/H5TEST-shared
- )
+endif ()
+set_tests_properties (H5TEST-links_env PROPERTIES
+ FIXTURES_REQUIRED links_env_clear_objects
+ ENVIRONMENT "srcdir=${HDF5_TEST_BINARY_DIR}/H5TEST;HDF5_EXT_PREFIX=.:tmp"
+ WORKING_DIRECTORY ${HDF5_TEST_BINARY_DIR}/H5TEST
+)
+if (NOT BUILD_SHARED_LIBS)
#-- Adding test for libinfo
- add_test (NAME H5TEST-shared-testlibinfo
+ add_test (NAME H5TEST-testlibinfo
+ COMMAND ${CMAKE_COMMAND} -D "TEST_PROGRAM=$<TARGET_FILE:${HDF5_LIB_TARGET}>" -P "${GREP_RUNNER}"
+ WORKING_DIRECTORY ${HDF5_TEST_BINARY_DIR}/H5TEST
+ )
+else ()
+ #-- Adding test for libinfo
+ add_test (NAME H5TEST-testlibinfo
COMMAND ${CMAKE_COMMAND} -D "TEST_PROGRAM=$<TARGET_FILE:${HDF5_LIBSH_TARGET}>" -P "${GREP_RUNNER}"
- WORKING_DIRECTORY
- ${HDF5_TEST_BINARY_DIR}/H5TEST-shared
+ WORKING_DIRECTORY ${HDF5_TEST_BINARY_DIR}/H5TEST
)
endif ()
@@ -1100,9 +927,6 @@ if (ENABLE_EXTENDED_TESTS)
#-- Adding test for flushrefresh
file (MAKE_DIRECTORY "${PROJECT_BINARY_DIR}/H5TEST/flushrefresh_test")
- if (BUILD_SHARED_LIBS)
- file (MAKE_DIRECTORY "${PROJECT_BINARY_DIR}/H5TEST-shared/flushrefresh_test")
- endif ()
find_package (Perl)
if (PERL_FOUND)
add_test (NAME H5TEST-clear-testflushrefresh-objects
@@ -1133,10 +957,10 @@ if (ENABLE_EXTENDED_TESTS)
ENVIRONMENT "srcdir=${HDF5_TEST_BINARY_DIR}/H5TEST/flushrefresh_test"
WORKING_DIRECTORY ${HDF5_TEST_BINARY_DIR}/H5TEST/flushrefresh_test
)
- else ()
- message (STATUS "Cannot execute TEST flushrefresh - perl not found")
endif ()
-endif()
+else ()
+ message (STATUS "Cannot execute TEST flushrefresh - perl not found")
+endif ()
##############################################################################
##############################################################################
@@ -1154,8 +978,27 @@ endif ()
##############################################################################
##############################################################################
-if (HDF5_TEST_VOL)
- include (CMakeVOLTests.cmake)
+##############################################################################
+### V O L P L U G I N T E S T S
+##############################################################################
+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-vol_plugin COMMAND $<TARGET_FILE:vol_plugin>)
+ set_tests_properties (H5PLUGIN-vol_plugin PROPERTIES
+ ENVIRONMENT "HDF5_PLUGIN_PATH=${CMAKE_BINARY_DIR}/null_vol_plugin_dir;srcdir=${HDF5_TEST_BINARY_DIR}"
+ WORKING_DIRECTORY ${HDF5_TEST_BINARY_DIR}
+ )
+endif ()
+
+if (HDF5_TEST_PASSTHROUGH_VOL)
+ include (CMakePassthroughVOLTests.cmake)
endif ()
##############################################################################
@@ -1164,10 +1007,10 @@ endif ()
##############################################################################
##############################################################################
-if (HDF5_BUILD_GENERATORS)
+if (HDF5_BUILD_GENERATORS AND NOT ONLY_SHARED_LIBS)
macro (ADD_H5_GENERATOR genfile)
add_executable (${genfile} ${HDF5_TEST_SOURCE_DIR}/${genfile}.c)
- target_include_directories(${genfile} PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>")
+ target_include_directories (${genfile} PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>")
TARGET_C_PROPERTIES (${genfile} STATIC)
target_link_libraries (${genfile} PRIVATE ${HDF5_TEST_LIB_TARGET} ${HDF5_LIB_TARGET})
set_target_properties (${genfile} PROPERTIES FOLDER generator/test)
@@ -1198,8 +1041,8 @@ if (HDF5_BUILD_GENERATORS)
gen_plist
)
- foreach (gen ${H5_GENERATORS})
- ADD_H5_GENERATOR (${gen})
+ foreach (h5_gen ${H5_GENERATORS})
+ ADD_H5_GENERATOR (${h5_gen})
endforeach ()
endif ()
diff --git a/test/CMakeVFDTests.cmake b/test/CMakeVFDTests.cmake
index 9f03c40..0ddce92 100644
--- a/test/CMakeVFDTests.cmake
+++ b/test/CMakeVFDTests.cmake
@@ -34,37 +34,23 @@ foreach (vfdtest ${VFD_LIST})
file (MAKE_DIRECTORY "${PROJECT_BINARY_DIR}/${vfdtest}")
file (MAKE_DIRECTORY "${PROJECT_BINARY_DIR}/${vfdtest}/testfiles")
file (MAKE_DIRECTORY "${PROJECT_BINARY_DIR}/${vfdtest}/testfiles/plist_files")
- if (BUILD_SHARED_LIBS)
- file (MAKE_DIRECTORY "${PROJECT_BINARY_DIR}/${vfdtest}-shared")
- file (MAKE_DIRECTORY "${PROJECT_BINARY_DIR}/${vfdtest}-shared/testfiles")
- file (MAKE_DIRECTORY "${PROJECT_BINARY_DIR}/${vfdtest}-shared/testfiles/plist_files")
- endif ()
endforeach ()
foreach (vfdtest ${VFD_LIST})
foreach (h5_tfile ${HDF5_TEST_FILES})
HDFTEST_COPY_FILE("${HDF5_TOOLS_DIR}/testfiles/${h5_tfile}" "${PROJECT_BINARY_DIR}/${vfdtest}/${h5_tfile}" "HDF5_VFDTEST_LIB_files")
- if (BUILD_SHARED_LIBS)
- HDFTEST_COPY_FILE("${HDF5_TOOLS_DIR}/testfiles/${h5_tfile}" "${PROJECT_BINARY_DIR}/${vfdtest}-shared/${h5_tfile}" "HDF5_VFDTEST_LIBSH_files")
- endif ()
endforeach ()
endforeach ()
foreach (vfdtest ${VFD_LIST})
foreach (ref_file ${HDF5_REFERENCE_FILES})
HDFTEST_COPY_FILE("${HDF5_TEST_SOURCE_DIR}/testfiles/${ref_file}" "${PROJECT_BINARY_DIR}/${vfdtest}/${ref_file}" "HDF5_VFDTEST_LIB_files")
- if (BUILD_SHARED_LIBS)
- HDFTEST_COPY_FILE("${HDF5_TEST_SOURCE_DIR}/testfiles/${ref_file}" "${PROJECT_BINARY_DIR}/${vfdtest}-shared/${ref_file}" "HDF5_VFDTEST_LIBSH_files")
- endif ()
endforeach ()
endforeach ()
foreach (vfdtest ${VFD_LIST})
foreach (h5_file ${HDF5_REFERENCE_TEST_FILES})
HDFTEST_COPY_FILE("${HDF5_TEST_SOURCE_DIR}/${h5_file}" "${HDF5_TEST_BINARY_DIR}/${vfdtest}/${h5_file}" "HDF5_VFDTEST_LIB_files")
- if (BUILD_SHARED_LIBS)
- HDFTEST_COPY_FILE("${HDF5_TEST_SOURCE_DIR}/${h5_file}" "${HDF5_TEST_BINARY_DIR}/${vfdtest}-shared/${h5_file}" "HDF5_VFDTEST_LIBSH_files")
- endif ()
endforeach ()
endforeach ()
@@ -72,17 +58,10 @@ foreach (vfdtest ${VFD_LIST})
foreach (plistfile ${HDF5_REFERENCE_PLIST_FILES})
HDFTEST_COPY_FILE("${HDF5_TEST_SOURCE_DIR}/testfiles/plist_files/${plistfile}" "${PROJECT_BINARY_DIR}/${vfdtest}/testfiles/plist_files/${plistfile}" "HDF5_VFDTEST_LIB_files")
HDFTEST_COPY_FILE("${HDF5_TEST_SOURCE_DIR}/testfiles/plist_files/def_${plistfile}" "${PROJECT_BINARY_DIR}/${vfdtest}/testfiles/plist_files/def_${plistfile}" "HDF5_VFDTEST_LIB_files")
- if (BUILD_SHARED_LIBS)
- HDFTEST_COPY_FILE("${HDF5_TEST_SOURCE_DIR}/testfiles/plist_files/${plistfile}" "${PROJECT_BINARY_DIR}/${vfdtest}-shared/testfiles/plist_files/${plistfile}" "HDF5_VFDTEST_LIBSH_files")
- HDFTEST_COPY_FILE("${HDF5_TEST_SOURCE_DIR}/testfiles/plist_files/def_${plistfile}" "${PROJECT_BINARY_DIR}/${vfdtest}-shared/testfiles/plist_files/def_${plistfile}" "HDF5_VFDTEST_LIBSH_files")
- endif ()
endforeach ()
endforeach ()
add_custom_target(HDF5_VFDTEST_LIB_files ALL COMMENT "Copying files needed by HDF5_VFDTEST_LIB tests" DEPENDS ${HDF5_VFDTEST_LIB_files_list})
-if (BUILD_SHARED_LIBS)
- add_custom_target(HDF5_VFDTEST_LIBSH_files ALL COMMENT "Copying files needed by HDF5_VFDTEST_LIBSH tests" DEPENDS ${HDF5_VFDTEST_LIBSH_files_list})
-endif ()
##############################################################################
##############################################################################
@@ -92,6 +71,7 @@ endif ()
set (H5_VFD_SKIP_TESTS
cache
+ cache_image
accum
fheap
big
@@ -101,6 +81,8 @@ endif ()
tcheck_version
testmeta
links_env
+ external_env
+ vds_env
)
if (NOT CYGWIN)
list (REMOVE_ITEM H5_VFD_SKIP_TESTS big cache)
@@ -110,153 +92,116 @@ endif ()
macro (CHECK_VFD_TEST vfdtest vfdname resultcode)
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")
+ 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}-${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_FOLDER=${PROJECT_BINARY_DIR}/${vfdname}-shared"
- -P "${HDF_RESOURCES_DIR}/vfdTest.cmake"
- )
- set_tests_properties (VFD-${vfdname}-${vfdtest}-shared PROPERTIES
- ENVIRONMENT "srcdir=${HDF5_TEST_BINARY_DIR}/${vfdname}-shared"
- WORKING_DIRECTORY ${HDF5_TEST_BINARY_DIR}/${vfdname}-shared
- )
- endif ()
else ()
add_test (NAME VFD-${vfdname}-${vfdtest}
COMMAND ${CMAKE_COMMAND} -E echo "SKIP VFD-${vfdname}-${vfdtest}"
)
- if (BUILD_SHARED_LIBS)
- add_test (NAME VFD-${vfdname}-${test}-shared
- COMMAND ${CMAKE_COMMAND} -E echo "SKIP VFD-${vfdname}-${vfdtest}-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}"
WORKING_DIRECTORY ${HDF5_TEST_BINARY_DIR}/${vfdname}
)
- if (BUILD_SHARED_LIBS)
- 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_FOLDER=${PROJECT_BINARY_DIR}/${vfdname}-shared"
- -P "${HDF_RESOURCES_DIR}/vfdTest.cmake"
- )
- set_tests_properties (VFD-${vfdname}-${vfdtest}-shared PROPERTIES
- 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
- 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_FOLDER=${PROJECT_BINARY_DIR}/${vfdname}-shared"
- -P "${HDF_RESOURCES_DIR}/vfdTest.cmake"
- )
- set_tests_properties (VFD-${vfdname}-${vfdtest}-shared PROPERTIES
- ENVIRONMENT "srcdir=${HDF5_TEST_BINARY_DIR}/${vfdname}-shared;HDF5TestExpress=${HDF_TEST_EXPRESS}"
- WORKING_DIRECTORY ${HDF5_TEST_BINARY_DIR}/${vfdname}-shared
- )
- endif ()
endif ()
endmacro ()
macro (DO_VFD_TEST vfdtest vfdname resultcode)
- 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_FOLDER=${PROJECT_BINARY_DIR}/${vfdname}"
- -P "${HDF_RESOURCES_DIR}/vfdTest.cmake"
- )
- set_tests_properties (VFD-${vfdname}-${vfdtest} PROPERTIES
- 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
- 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_FOLDER=${PROJECT_BINARY_DIR}/${vfdname}-shared"
- -P "${HDF_RESOURCES_DIR}/vfdTest.cmake"
- )
- set_tests_properties (VFD-${vfdname}-${vfdtest}-shared PROPERTIES
- ENVIRONMENT "srcdir=${HDF5_TEST_BINARY_DIR}/${vfdname}-shared"
- WORKING_DIRECTORY ${HDF5_TEST_BINARY_DIR}/${vfdname}-shared
- )
- endif ()
+ 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}.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}
+ )
endmacro ()
macro (ADD_VFD_TEST vfdname resultcode)
- foreach (test ${H5_TESTS})
- if (NOT ${test} IN_LIST H5_VFD_SKIP_TESTS)
+ foreach (h5_test ${H5_TESTS})
+ if (NOT h5_test IN_LIST H5_VFD_SKIP_TESTS)
if (WIN32)
- CHECK_VFD_TEST (${test} ${vfdname} ${resultcode})
+ CHECK_VFD_TEST (${h5_test} ${vfdname} ${resultcode})
else ()
- DO_VFD_TEST (${test} ${vfdname} ${resultcode})
+ DO_VFD_TEST (${h5_test} ${vfdname} ${resultcode})
endif ()
endif ()
endforeach ()
@@ -267,52 +212,34 @@ endif ()
if (NOT CYGWIN)
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 ${CTEST_VERY_LONG_TIMEOUT})
- if (NOT CYGWIN AND NOT WIN32)
- 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
+ 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
- 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_FOLDER=${PROJECT_BINARY_DIR}/${vfdname}-shared"
- -P "${HDF_RESOURCES_DIR}/vfdTest.cmake"
- )
- set_tests_properties (VFD-${vfdname}-fheap-shared PROPERTIES
- 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
- )
- endif ()
endif ()
endmacro ()
# Run test with different Virtual File Driver
- foreach (vfd ${VFD_LIST})
- ADD_VFD_TEST (${vfd} 0)
+ foreach (h5_vfd ${VFD_LIST})
+ ADD_VFD_TEST (${h5_vfd} 0)
endforeach ()
diff --git a/test/Makefile.am b/test/Makefile.am
index 88dc542..1b82aa4 100644
--- a/test/Makefile.am
+++ b/test/Makefile.am
@@ -26,21 +26,23 @@ AM_CPPFLAGS+=-I$(top_srcdir)/src -I$(top_builddir)/src
# testlibinfo.sh:
# testcheck_version.sh: tcheck_version
# testlinks_env.sh: links_env
+# testexternal_env.sh: external_env
# testflushrefresh.sh: flushrefresh
+# testvds_env.sh: vds_env
# testswmr.sh: swmr*
# testvdsswmr.sh: vds_swmr*
# 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 \
- testswmr.sh testvdsswmr.sh testflushrefresh.sh test_usecases.sh testabort_fail.sh
+TEST_SCRIPT = testerror.sh testlibinfo.sh testcheck_version.sh testlinks_env.sh testexternal_env.sh \
+ testswmr.sh testvds_env.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) \
+ external_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) \
swmr_sparse_reader$(EXEEXT) swmr_sparse_writer$(EXEEXT) swmr_start_write$(EXEEXT) \
- vds_swmr_gen$(EXEEXT) vds_swmr_reader$(EXEEXT) vds_swmr_writer$(EXEEXT)
+ vds_env$(EXEEXT) vds_swmr_gen$(EXEEXT) vds_swmr_reader$(EXEEXT) vds_swmr_writer$(EXEEXT)
if HAVE_SHARED_CONDITIONAL
TEST_SCRIPT += test_filter_plugin.sh test_vol_plugin.sh
SCRIPT_DEPEND += filter_plugin$(EXEEXT) vol_plugin$(EXEEXT)
@@ -69,21 +71,23 @@ 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
+# external_env is used by testexternal_env.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.
# vds_swmr_* files are used by testvdsswmr.sh
+# vds_env is used by testvds_env.sh
# 'make check' doesn't run them directly, so they are not included in TEST_PROG.
# Also build testmeta, which is used for timings test. It builds quickly,
# 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 \
+ testmeta accum_swmr_reader atomic_writer atomic_reader external_env \
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
+ swmr_check_compat_vfd vds_env vds_swmr_gen vds_swmr_reader vds_swmr_writer
if HAVE_SHARED_CONDITIONAL
check_PROGRAMS+= filter_plugin vol_plugin
endif
@@ -131,7 +135,7 @@ else
noinst_LTLIBRARIES=libh5test.la
endif
-libh5test_la_SOURCES=h5test.c testframe.c cache_common.c swmr_common.c
+libh5test_la_SOURCES=h5test.c testframe.c cache_common.c swmr_common.c external_common.c
# Use libhd5test.la to compile all of the tests
LDADD=libh5test.la $(LIBHDF5)
@@ -223,7 +227,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 testabort_fail.sh \
+ testexternal_env.sh testswmr.sh testvds_env.sh testvdsswmr.sh test_usecases.sh testflushrefresh.sh testabort_fail.sh \
test_vol_plugin.sh
include $(top_srcdir)/config/conclude.am
diff --git a/test/accum.c b/test/accum.c
index 7af353c..da90995 100644
--- a/test/accum.c
+++ b/test/accum.c
@@ -100,7 +100,7 @@ main(void)
/* Test Setup */
- puts("Testing the metadata accumulator");
+ HDputs("Testing the metadata accumulator");
/* File access property list */
h5_reset();
@@ -152,7 +152,7 @@ main(void)
if(nerrors)
goto error;
- puts("All metadata accumulator tests passed.");
+ HDputs("All metadata accumulator tests passed.");
h5_cleanup(FILENAME, fapl);
return 0;
@@ -160,7 +160,7 @@ main(void)
error:
if(api_ctx_pushed) H5CX_pop();
- puts("*** TESTS FAILED ***");
+ HDputs("*** TESTS FAILED ***");
return 1;
} /* end main() */
diff --git a/test/app_ref.c b/test/app_ref.c
index 3ef3fef..a4853fa 100644
--- a/test/app_ref.c
+++ b/test/app_ref.c
@@ -83,8 +83,8 @@ Abrt_Handler (int H5_ATTR_UNUSED sig)
int i, n;
for (i=0; i<T_NUMCLASSES; i++) {
- fprintf(stderr, "%s ID reference count: %n", IDNAME[i], &n);
- fprintf(stderr, "%*d\n", (n < ERR_WIDTH) ? (ERR_WIDTH - n) : 0, rc[i]);
+ HDfprintf(stderr, "%s ID reference count: %n", IDNAME[i], &n);
+ HDfprintf(stderr, "%*d\n", (n < ERR_WIDTH) ? (ERR_WIDTH - n) : 0, rc[i]);
}
}
@@ -195,7 +195,7 @@ main (void)
error:
- puts("***** APPLICATION REFERENCE COUNT TESTS FAILED *****");
+ HDputs("***** APPLICATION REFERENCE COUNT TESTS FAILED *****");
return 1;
}
diff --git a/test/big.c b/test/big.c
index fe52aef..b3105eb 100644
--- a/test/big.c
+++ b/test/big.c
@@ -524,7 +524,7 @@ reader(char *filename, hid_t fapl)
}
if(zero) {
H5_FAILED();
- printf(" %d zero%s\n", zero, 1 == zero ? "" : "s");
+ HDprintf(" %d zero%s\n", zero, 1 == zero ? "" : "s");
} else if(wrong) {
SKIPPED();
HDputs(" Possible overlap with another region.");
@@ -765,7 +765,7 @@ main (int ac, char **av)
family_size_def = (hsize_t)HDstrtoull(*av, NULL, 0);
}
else{
- printf("***Missing fsize value***\n");
+ HDprintf("***Missing fsize value***\n");
usage();
return 1;
}
diff --git a/test/bittests.c b/test/bittests.c
index ccd725c..e29c188 100644
--- a/test/bittests.c
+++ b/test/bittests.c
@@ -57,13 +57,13 @@ test_find (void)
n = H5T__bit_find(v1, (size_t)0, (size_t)0, H5T_BIT_LSB, TRUE);
if(-1 != n) {
H5_FAILED();
- puts (" Zero length test failed (lsb)!");
+ HDputs (" Zero length test failed (lsb)!");
goto failed;
}
n = H5T__bit_find(v1, (size_t)0, (size_t)0, H5T_BIT_MSB, TRUE);
if(-1 != n) {
H5_FAILED();
- puts (" Zero length test failed (msb)!");
+ HDputs (" Zero length test failed (msb)!");
goto failed;
}
@@ -73,13 +73,13 @@ test_find (void)
n = H5T__bit_find(v1, (size_t)0, 8 * sizeof(v1), H5T_BIT_LSB, TRUE);
if(-1 != n) {
H5_FAILED();
- puts (" Zero buffer test failed (lsb)!");
+ HDputs (" Zero buffer test failed (lsb)!");
goto failed;
}
n = H5T__bit_find(v1, (size_t)0, 8 * sizeof(v1), H5T_BIT_MSB, TRUE);
if(-1 != n) {
H5_FAILED();
- puts (" Zero buffer test failed (msb)!");
+ HDputs (" Zero buffer test failed (msb)!");
goto failed;
}
@@ -90,13 +90,13 @@ test_find (void)
n = H5T__bit_find(v1, (size_t)0, 8 * sizeof(v1), H5T_BIT_LSB, TRUE);
if((ssize_t)i != n) {
H5_FAILED();
- printf (" Test for set bit %d failed (lsb)!\n", i);
+ HDprintf (" Test for set bit %d failed (lsb)!\n", i);
goto failed;
}
n = H5T__bit_find(v1, (size_t)0, 8 * sizeof(v1), H5T_BIT_MSB, TRUE);
if((ssize_t)i != n) {
H5_FAILED();
- printf (" Test for set bit %d failed (msb)!\n", i);
+ HDprintf (" Test for set bit %d failed (msb)!\n", i);
goto failed;
}
}
@@ -106,13 +106,13 @@ test_find (void)
n = H5T__bit_find(v1, (size_t)0, 8 * sizeof(v1), H5T_BIT_LSB, FALSE);
if(-1 != n) {
H5_FAILED();
- puts (" One buffer test failed (lsb)!");
+ HDputs (" One buffer test failed (lsb)!");
goto failed;
}
n = H5T__bit_find(v1, (size_t)0, 8 * sizeof(v1), H5T_BIT_MSB, FALSE);
if(-1 != n) {
H5_FAILED();
- puts (" One buffer test failed (msb)!");
+ HDputs (" One buffer test failed (msb)!");
goto failed;
}
@@ -123,13 +123,13 @@ test_find (void)
n = H5T__bit_find (v1, (size_t)0, 8*sizeof(v1), H5T_BIT_LSB, FALSE);
if ((ssize_t)i!=n) {
H5_FAILED();
- printf (" Test for clear bit %d failed (lsb)!\n", i);
+ HDprintf (" Test for clear bit %d failed (lsb)!\n", i);
goto failed;
}
n = H5T__bit_find (v1, (size_t)0, 8*sizeof(v1), H5T_BIT_MSB, FALSE);
if ((ssize_t)i!=n) {
H5_FAILED();
- printf (" Test for clear bit %d failed (lsb)!\n", i);
+ HDprintf (" Test for clear bit %d failed (lsb)!\n", i);
goto failed;
}
}
@@ -139,9 +139,9 @@ test_find (void)
return 0;
failed:
- printf (" v = 0x");
- for (i=0; i<(int)sizeof(v1); i++) printf ("%02x", v1[i]);
- printf ("\n");
+ HDprintf (" v = 0x");
+ for (i=0; i<(int)sizeof(v1); i++) HDprintf ("%02x", v1[i]);
+ HDprintf ("\n");
return -1;
}
@@ -185,12 +185,12 @@ test_copy (void)
for (j=0; j<(int)sizeof(v2); j++) if (v2[j]) break;
if (size>0 && j>=(int)sizeof(v2)) {
H5_FAILED();
- puts (" Unabled to find copied region in destination");
+ HDputs (" Unabled to find copied region in destination");
goto failed;
}
if (0==size && j<(int)sizeof(v2)) {
H5_FAILED();
- puts (" Found copied bits when we shouldn't have");
+ HDputs (" Found copied bits when we shouldn't have");
goto failed;
}
@@ -199,25 +199,25 @@ test_copy (void)
n = H5T__bit_find (v2, (size_t)0, 8*sizeof(v2), H5T_BIT_LSB, 1);
if (size>0 && n!=(ssize_t)d_offset) {
H5_FAILED();
- printf (" Unable to find first copied bit in destination "
+ HDprintf (" Unable to find first copied bit in destination "
"(n=%d)\n", (int)n);
goto failed;
}
if (0==size && n>=0) {
H5_FAILED();
- puts (" Found copied bits and shouldn't have!");
+ HDputs (" Found copied bits and shouldn't have!");
goto failed;
}
n = H5T__bit_find (v2, d_offset, 8*sizeof(v2)-d_offset, H5T_BIT_LSB, 0);
if (d_offset+size<8*sizeof(v2) && n!=(ssize_t)size) {
H5_FAILED();
- printf (" Unable to find last copied bit in destination "
+ HDprintf (" Unable to find last copied bit in destination "
"(n=%d)\n", (int)n);
goto failed;
}
if (d_offset+size==8*sizeof(v2) && n>=0) {
H5_FAILED();
- puts (" High-order zeros are present and shouldn't be!");
+ HDputs (" High-order zeros are present and shouldn't be!");
goto failed;
}
@@ -228,25 +228,25 @@ test_copy (void)
n = H5T__bit_find (v2, (size_t)0, 8*sizeof(v2), H5T_BIT_MSB, 1);
if (size>0 && (size_t)(n+1)!=d_offset+size) {
H5_FAILED();
- printf (" Unable to find last copied bit in destination "
+ HDprintf (" Unable to find last copied bit in destination "
"(reverse, n=%d)\n", (int)n);
goto failed;
}
if (0==size && n>=0) {
H5_FAILED();
- puts (" Found copied bits but shouldn't have (reverse)!");
+ HDputs (" Found copied bits but shouldn't have (reverse)!");
goto failed;
}
n = H5T__bit_find (v2, (size_t)0, d_offset+size, H5T_BIT_MSB, 0);
if (d_offset>0 && n+1!=(ssize_t)d_offset) {
H5_FAILED();
- printf (" Unable to find beginning of copied data "
+ HDprintf (" Unable to find beginning of copied data "
"(reverse, n=%d)\n", (int)n);
goto failed;
}
if (0==d_offset && n>=0) {
H5_FAILED();
- puts (" Found leading original data but shouldn't have!");
+ HDputs (" Found leading original data but shouldn't have!");
goto failed;
}
@@ -256,14 +256,14 @@ test_copy (void)
return 0;
failed:
- printf (" i=%d, s_offset=%lu, d_offset=%lu, size=%lu\n",
+ HDprintf (" i=%d, s_offset=%lu, d_offset=%lu, size=%lu\n",
i, (unsigned long)s_offset, (unsigned long)d_offset,
(unsigned long)size);
- printf (" s = 0x");
- for (j=sizeof(v1)-1; j>=0; --j) printf ("%02x", v1[j]);
- printf ("\n d = 0x");
- for (j=sizeof(v2)-1; j>=0; --j) printf ("%02x", v2[j]);
- printf ("\n");
+ HDprintf (" s = 0x");
+ for (j=sizeof(v1)-1; j>=0; --j) HDprintf ("%02x", v1[j]);
+ HDprintf ("\n d = 0x");
+ for (j=sizeof(v2)-1; j>=0; --j) HDprintf ("%02x", v2[j]);
+ HDprintf ("\n");
return -1;
}
@@ -311,7 +311,7 @@ test_shift (void)
n = H5T__bit_find (vector, (size_t)0, 8*sizeof(vector), H5T_BIT_LSB, 1);
if(n != (ssize_t)offset + shift_dist) {
H5_FAILED();
- printf (" Unable to find first bit in destination "
+ HDprintf (" Unable to find first bit in destination "
"(n=%d)\n", (int)n);
goto failed;
}
@@ -323,7 +323,7 @@ test_shift (void)
n = H5T__bit_find (vector, (size_t)0, 8*sizeof(vector), H5T_BIT_MSB, 1);
if (n!=(ssize_t)(offset+size-1)) {
H5_FAILED();
- printf (" Unable to find last bit in destination "
+ HDprintf (" Unable to find last bit in destination "
"(reverse, n=%d)\n", (int)n);
goto failed;
}
@@ -338,7 +338,7 @@ test_shift (void)
n = H5T__bit_find (vector, (size_t)0, 8*sizeof(vector), H5T_BIT_LSB, 1);
if ((size_t)n!=offset) {
H5_FAILED();
- printf (" Unable to find first bit in destination "
+ HDprintf (" Unable to find first bit in destination "
"(n=%d)\n", (int)n);
goto failed;
}
@@ -350,7 +350,7 @@ test_shift (void)
n = H5T__bit_find (vector, (size_t)0, 8*sizeof(vector), H5T_BIT_MSB, 1);
if(n != (ssize_t)(offset + size) - shift_dist - 1) {
H5_FAILED();
- printf (" Unable to find last bit in destination "
+ HDprintf (" Unable to find last bit in destination "
"(reverse, n=%d)\n", (int)n);
goto failed;
}
@@ -373,7 +373,7 @@ test_shift (void)
n = H5T__bit_find (vector, (size_t)0, 8*sizeof(vector), H5T_BIT_LSB, 1);
if (n >= 0) {
H5_FAILED();
- printf (" Unable to verify all bits are zero in destination(LSB) "
+ HDprintf (" Unable to verify all bits are zero in destination(LSB) "
"(n=%d)\n", (int)n);
goto failed;
}
@@ -382,7 +382,7 @@ test_shift (void)
n = H5T__bit_find (vector, (size_t)0, 8*sizeof(vector), H5T_BIT_MSB, 1);
if (n >= 0) {
H5_FAILED();
- printf (" Unable to verify all bits are zero in destination(MSB) "
+ HDprintf (" Unable to verify all bits are zero in destination(MSB) "
"(n=%d)\n", (int)n);
goto failed;
}
@@ -392,11 +392,11 @@ test_shift (void)
return 0;
failed:
- printf (" i=%d, offset=%lu, size=%lu, shift_dist=%lu\n",
+ HDprintf (" i=%d, offset=%lu, size=%lu, shift_dist=%lu\n",
i, (unsigned long)offset, (unsigned long)size,
(unsigned long)shift_dist);
- for (j=sizeof(vector)-1; j>=0; --j) printf ("%02x", vector[j]);
- printf ("\n");
+ for (j=sizeof(vector)-1; j>=0; --j) HDprintf ("%02x", vector[j]);
+ HDprintf ("\n");
return -1;
}
@@ -446,13 +446,13 @@ test_increment (void)
n = H5T__bit_find (vector, (size_t)0, 8*sizeof(vector), H5T_BIT_LSB, 1);
if (size!=1 && (size_t)n!=offset+size-1) {
H5_FAILED();
- printf (" Unable to find first bit in destination "
+ HDprintf (" Unable to find first bit in destination "
"(n=%d)\n", (int)n);
goto failed;
}
if(size==1 && n>=0) {
H5_FAILED();
- printf (" Unable to verify all-zero bit in destination "
+ HDprintf (" Unable to verify all-zero bit in destination "
"(n=%d)\n", (int)n);
goto failed;
}
@@ -464,13 +464,13 @@ test_increment (void)
n = H5T__bit_find (vector, (size_t)0, 8*sizeof(vector), H5T_BIT_MSB, 1);
if (size!=1 && n!=(ssize_t)(offset+size-1)) {
H5_FAILED();
- printf (" Unable to find last bit in destination "
+ HDprintf (" Unable to find last bit in destination "
"(reverse, n=%d)\n", (int)n);
goto failed;
}
if(size==1 && n>=0) {
H5_FAILED();
- printf (" Unable to verify all-zero bit in destination "
+ HDprintf (" Unable to verify all-zero bit in destination "
"(reverse, n=%d)\n", (int)n);
goto failed;
}
@@ -480,10 +480,10 @@ test_increment (void)
return 0;
failed:
- printf (" i=%d, offset=%lu, size=%lu\n",
+ HDprintf (" i=%d, offset=%lu, size=%lu\n",
i, (unsigned long)offset, (unsigned long)size);
- for (j=sizeof(vector)-1; j>=0; --j) printf ("%02x", vector[j]);
- printf ("\n");
+ for (j=sizeof(vector)-1; j>=0; --j) HDprintf ("%02x", vector[j]);
+ HDprintf ("\n");
return -1;
}
@@ -530,7 +530,7 @@ test_decrement (void)
n = H5T__bit_find (vector, (size_t)0, 8*sizeof(vector), H5T_BIT_LSB, 1);
if ((size_t)n!=offset) {
H5_FAILED();
- printf (" Unable to find first bit in destination "
+ HDprintf (" Unable to find first bit in destination "
"(n=%d)\n", (int)n);
goto failed;
}
@@ -542,7 +542,7 @@ test_decrement (void)
n = H5T__bit_find (vector, (size_t)0, 8*sizeof(vector), H5T_BIT_MSB, 1);
if (n!=(ssize_t)(offset+size-1)) {
H5_FAILED();
- printf (" Unable to find last bit in destination "
+ HDprintf (" Unable to find last bit in destination "
"(reverse, n=%d)\n", (int)n);
goto failed;
}
@@ -552,10 +552,10 @@ test_decrement (void)
return 0;
failed:
- printf (" i=%d, offset=%lu, size=%lu\n",
+ HDprintf (" i=%d, offset=%lu, size=%lu\n",
i, (unsigned long)offset, (unsigned long)size);
- for (j=sizeof(vector)-1; j>=0; --j) printf ("%02x", vector[j]);
- printf ("\n");
+ for (j=sizeof(vector)-1; j>=0; --j) HDprintf ("%02x", vector[j]);
+ HDprintf ("\n");
return -1;
}
@@ -602,7 +602,7 @@ test_negate (void)
n = H5T__bit_find (vector, (size_t)0, 8*sizeof(vector), H5T_BIT_LSB, 1);
if ((size_t)n!=offset) {
H5_FAILED();
- printf (" Unable to find first bit in destination "
+ HDprintf (" Unable to find first bit in destination "
"(n=%d)\n", (int)n);
goto failed;
}
@@ -614,7 +614,7 @@ test_negate (void)
n = H5T__bit_find (vector, (size_t)0, 8*sizeof(vector), H5T_BIT_MSB, 1);
if (n!=(ssize_t)(offset+size-1)) {
H5_FAILED();
- printf (" Unable to find last bit in destination "
+ HDprintf (" Unable to find last bit in destination "
"(reverse, n=%d)\n", (int)n);
goto failed;
}
@@ -630,7 +630,7 @@ test_negate (void)
n = H5T__bit_find (vector, (size_t)0, 8*sizeof(vector), H5T_BIT_LSB, 1);
if (n>=0) {
H5_FAILED();
- printf (" Unable to verify all-zero bits in destination "
+ HDprintf (" Unable to verify all-zero bits in destination "
"(n=%d)\n", (int)n);
goto failed;
}
@@ -642,7 +642,7 @@ test_negate (void)
n = H5T__bit_find (vector, (size_t)0, 8*sizeof(vector), H5T_BIT_MSB, 1);
if (n>=0) {
H5_FAILED();
- printf (" Unable to verify all-zero bits in destination "
+ HDprintf (" Unable to verify all-zero bits in destination "
"(reverse, n=%d)\n", (int)n);
goto failed;
}
@@ -652,10 +652,10 @@ test_negate (void)
return 0;
failed:
- printf (" i=%d, offset=%lu, size=%lu\n",
+ HDprintf (" i=%d, offset=%lu, size=%lu\n",
i, (unsigned long)offset, (unsigned long)size);
- for (j=sizeof(vector)-1; j>=0; --j) printf ("%02x", vector[j]);
- printf ("\n");
+ for (j=sizeof(vector)-1; j>=0; --j) HDprintf ("%02x", vector[j]);
+ HDprintf ("\n");
return -1;
}
@@ -697,12 +697,12 @@ test_set (void)
for (j=0; j<(int)sizeof(v2); j++) if (v2[j]) break;
if (size>0 && j>=(int)sizeof(v2)) {
H5_FAILED();
- puts (" Unabled to find set region in buffer");
+ HDputs (" Unabled to find set region in buffer");
goto failed;
}
if (0==size && j<(int)sizeof(v2)) {
H5_FAILED();
- puts (" Found set bits when we shouldn't have");
+ HDputs (" Found set bits when we shouldn't have");
goto failed;
}
@@ -711,25 +711,25 @@ test_set (void)
n = H5T__bit_find (v2, (size_t)0, 8*sizeof(v2), H5T_BIT_LSB, 1);
if (size>0 && n!=(ssize_t)d_offset) {
H5_FAILED();
- printf (" Unable to find first set bit in destination "
+ HDprintf (" Unable to find first set bit in destination "
"(n=%d)\n", (int)n);
goto failed;
}
if (0==size && n>=0) {
H5_FAILED();
- puts (" Found set bits and shouldn't have!");
+ HDputs (" Found set bits and shouldn't have!");
goto failed;
}
n = H5T__bit_find (v2, d_offset, 8*sizeof(v2)-d_offset, H5T_BIT_LSB, 0);
if (d_offset+size<8*sizeof(v2) && n!=(ssize_t)size) {
H5_FAILED();
- printf (" Unable to find last set bit in destination "
+ HDprintf (" Unable to find last set bit in destination "
"(n=%d)\n", (int)n);
goto failed;
}
if (d_offset+size==8*sizeof(v2) && n>=0) {
H5_FAILED();
- puts (" High-order zeros are present and shouldn't be!");
+ HDputs (" High-order zeros are present and shouldn't be!");
goto failed;
}
@@ -740,25 +740,25 @@ test_set (void)
n = H5T__bit_find (v2, (size_t)0, 8*sizeof(v2), H5T_BIT_MSB, 1);
if (size>0 && (size_t)(n+1)!=d_offset+size) {
H5_FAILED();
- printf (" Unable to find last set bit in destination "
+ HDprintf (" Unable to find last set bit in destination "
"(reverse, n=%d)\n", (int)n);
goto failed;
}
if (0==size && n>=0) {
H5_FAILED();
- puts (" Found set bits but shouldn't have (reverse)!");
+ HDputs (" Found set bits but shouldn't have (reverse)!");
goto failed;
}
n = H5T__bit_find (v2, (size_t)0, d_offset+size, H5T_BIT_MSB, 0);
if (d_offset>0 && n+1!=(ssize_t)d_offset) {
H5_FAILED();
- printf (" Unable to find beginning of set bit region "
+ HDprintf (" Unable to find beginning of set bit region "
"(reverse, n=%d)\n", (int)n);
goto failed;
}
if (0==d_offset && n>=0) {
H5_FAILED();
- puts (" Found leading zeros but shouldn't have!");
+ HDputs (" Found leading zeros but shouldn't have!");
goto failed;
}
@@ -768,11 +768,11 @@ test_set (void)
return 0;
failed:
- printf (" i=%d, d_offset=%lu, size=%lu\n",
+ HDprintf (" i=%d, d_offset=%lu, size=%lu\n",
i, (unsigned long)d_offset, (unsigned long)size);
- printf (" d = 0x");
- for (j=sizeof(v2)-1; j>=0; --j) printf ("%02x", v2[j]);
- printf ("\n");
+ HDprintf (" d = 0x");
+ for (j=sizeof(v2)-1; j>=0; --j) HDprintf ("%02x", v2[j]);
+ HDprintf ("\n");
return -1;
}
@@ -814,12 +814,12 @@ test_clear (void)
for (j=0; j<(int)sizeof(v2); j++) if (0xff!=v2[j]) break;
if (size>0 && j>=(int)sizeof(v2)) {
H5_FAILED();
- puts (" Unabled to find cleared region in buffer");
+ HDputs (" Unabled to find cleared region in buffer");
goto failed;
}
if (0==size && j<(int)sizeof(v2)) {
H5_FAILED();
- puts (" Found cleared bits when we shouldn't have");
+ HDputs (" Found cleared bits when we shouldn't have");
goto failed;
}
@@ -828,25 +828,25 @@ test_clear (void)
n = H5T__bit_find (v2, (size_t)0, 8*sizeof(v2), H5T_BIT_LSB, 0);
if (size>0 && n!=(ssize_t)d_offset) {
H5_FAILED();
- printf (" Unable to find first cleared bit in destination "
+ HDprintf (" Unable to find first cleared bit in destination "
"(n=%d)\n", (int)n);
goto failed;
}
if (0==size && n>=0) {
H5_FAILED();
- puts (" Found cleared bits and shouldn't have!");
+ HDputs (" Found cleared bits and shouldn't have!");
goto failed;
}
n = H5T__bit_find (v2, d_offset, 8*sizeof(v2)-d_offset, H5T_BIT_LSB, 1);
if (d_offset+size<8*sizeof(v2) && n!=(ssize_t)size) {
H5_FAILED();
- printf (" Unable to find last cleared bit in destination "
+ HDprintf (" Unable to find last cleared bit in destination "
"(n=%d)\n", (int)n);
goto failed;
}
if (d_offset+size==8*sizeof(v2) && n>=0) {
H5_FAILED();
- puts (" High-order ones are present and shouldn't be!");
+ HDputs (" High-order ones are present and shouldn't be!");
goto failed;
}
@@ -857,25 +857,25 @@ test_clear (void)
n = H5T__bit_find (v2, (size_t)0, 8*sizeof(v2), H5T_BIT_MSB, 0);
if (size>0 && (size_t)(n+1)!=d_offset+size) {
H5_FAILED();
- printf (" Unable to find last cleared bit in destination "
+ HDprintf (" Unable to find last cleared bit in destination "
"(reverse, n=%d)\n", (int)n);
goto failed;
}
if (0==size && n>=0) {
H5_FAILED();
- puts (" Found cleared bits but shouldn't have (reverse)!");
+ HDputs (" Found cleared bits but shouldn't have (reverse)!");
goto failed;
}
n = H5T__bit_find (v2, (size_t)0, d_offset+size, H5T_BIT_MSB, 1);
if (d_offset>0 && n+1!=(ssize_t)d_offset) {
H5_FAILED();
- printf (" Unable to find beginning of cleared bit region "
+ HDprintf (" Unable to find beginning of cleared bit region "
"(reverse, n=%d)\n", (int)n);
goto failed;
}
if (0==d_offset && n>=0) {
H5_FAILED();
- puts (" Found leading ones but shouldn't have!");
+ HDputs (" Found leading ones but shouldn't have!");
goto failed;
}
@@ -885,11 +885,11 @@ test_clear (void)
return 0;
failed:
- printf (" i=%d, d_offset=%lu, size=%lu\n",
+ HDprintf (" i=%d, d_offset=%lu, size=%lu\n",
i, (unsigned long)d_offset, (unsigned long)size);
- printf (" d = 0x");
- for (j=sizeof(v2)-1; j>=0; --j) printf ("%02x", v2[j]);
- printf ("\n");
+ HDprintf (" d = 0x");
+ for (j=sizeof(v2)-1; j>=0; --j) HDprintf ("%02x", v2[j]);
+ HDprintf ("\n");
return -1;
}
@@ -928,11 +928,11 @@ main(void)
nerrors += test_negate() < 0 ? 1 : 0;
if(nerrors) {
- printf("***** %u FAILURE%s! *****\n",
+ HDprintf("***** %u FAILURE%s! *****\n",
nerrors, 1 == nerrors ? "" : "S");
exit(EXIT_FAILURE);
}
- printf("All bit tests passed.\n");
+ HDprintf("All bit tests passed.\n");
H5close();
diff --git a/test/cache_logging.c b/test/cache_logging.c
index 6fd48d8..c43609b 100644
--- a/test/cache_logging.c
+++ b/test/cache_logging.c
@@ -43,7 +43,7 @@ test_logging_api(void)
hid_t fid = -1;
hid_t gid = -1;
hbool_t is_currently_logging;
- char group_name[8];
+ char group_name[12];
char filename[1024];
int i;
@@ -111,8 +111,8 @@ test_logging_api(void)
/* Perform some manipulations */
for(i = 0; i < N_GROUPS; i++) {
- HDmemset(group_name, 0, 8);
- HDsnprintf(group_name, 8, "%d", i);
+ HDmemset(group_name, 0, sizeof(group_name));
+ HDsnprintf(group_name, sizeof(group_name), "%d", i);
if((gid = H5Gcreate2(fid, group_name, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
TEST_ERROR;
if(H5Gclose(gid) < 0)
diff --git a/test/cache_tagging.c b/test/cache_tagging.c
index b91f013..734c760 100644
--- a/test/cache_tagging.c
+++ b/test/cache_tagging.c
@@ -448,7 +448,7 @@ check_file_creation_tags(hid_t fcpl_id, int type)
TESTING("tag application during file creation");
/* Create Fapl */
- if ( (fapl = h5_fileaccess_flags(H5_FILEACCESS_VOL | H5_FILEACCESS_LIBVER)) < 0 ) TEST_ERROR;
+ if ( (fapl = h5_fileaccess_flags(H5_FILEACCESS_LIBVER)) < 0 ) TEST_ERROR;
/* Create a test file with provided fcpl_t */
if ( (fid = H5Fcreate(FILENAME, H5F_ACC_TRUNC, fcpl_id, fapl)) < 0 ) TEST_ERROR;
@@ -539,7 +539,7 @@ check_file_open_tags(hid_t fcpl, int type)
/* ===== */
/* Create Fapl */
- if ( (fapl = h5_fileaccess_flags(H5_FILEACCESS_VOL | H5_FILEACCESS_LIBVER)) < 0 ) TEST_ERROR;
+ if ( (fapl = h5_fileaccess_flags(H5_FILEACCESS_LIBVER)) < 0 ) TEST_ERROR;
/* Create a test file with provided fcpl_t */
if ( (fid = H5Fcreate(FILENAME, H5F_ACC_TRUNC, fcpl, fapl)) < 0 ) TEST_ERROR;
@@ -652,7 +652,7 @@ check_group_creation_tags(void)
/* ===== */
/* Create Fapl */
- if ( (fapl = h5_fileaccess_flags(H5_FILEACCESS_VOL | H5_FILEACCESS_LIBVER)) < 0 ) TEST_ERROR;
+ if ( (fapl = h5_fileaccess_flags(H5_FILEACCESS_LIBVER)) < 0 ) TEST_ERROR;
/* Create a test file with provided fcpl_t */
if ( (fid = H5Fcreate(FILENAME, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0 ) TEST_ERROR;
@@ -741,7 +741,7 @@ check_multi_group_creation_tags(void)
hid_t fid = -1; /* File Identifier */
hid_t gid = -1; /* Group Identifier */
int verbose = FALSE; /* verbose file outout */
- char gname[10]; /* group name buffer */
+ char gname[16]; /* group name buffer */
int i = 0; /* iterator */
hid_t fapl = -1; /* File access prop list */
haddr_t g_tag = 0; /* Group tag value */
@@ -751,7 +751,7 @@ check_multi_group_creation_tags(void)
TESTING("tag application during multiple group creation");
/* Create Fapl */
- if ( (fapl = h5_fileaccess_flags(H5_FILEACCESS_VOL | H5_FILEACCESS_LIBVER)) < 0 ) TEST_ERROR;
+ if ( (fapl = h5_fileaccess_flags(H5_FILEACCESS_LIBVER)) < 0 ) TEST_ERROR;
/* Set latest version of library */
if ( H5Pset_libver_bounds(fapl, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST) < 0 ) TEST_ERROR;
@@ -881,7 +881,7 @@ check_link_iteration_tags(void)
TESTING("tag application during iteration over links in a group");
/* Create Fapl */
- if ( (fapl = h5_fileaccess_flags(H5_FILEACCESS_VOL | H5_FILEACCESS_LIBVER)) < 0 ) TEST_ERROR;
+ if ( (fapl = h5_fileaccess_flags(H5_FILEACCESS_LIBVER)) < 0 ) TEST_ERROR;
/* =========== */
/* Create File */
@@ -1000,7 +1000,7 @@ check_dense_attribute_tags(void)
TESTING("tag application during dense attribute manipulation");
/* Create Fapl */
- if ( (fapl = h5_fileaccess_flags(H5_FILEACCESS_VOL | H5_FILEACCESS_LIBVER)) < 0 ) TEST_ERROR;
+ if ( (fapl = h5_fileaccess_flags(H5_FILEACCESS_LIBVER)) < 0 ) TEST_ERROR;
if ( H5Pset_libver_bounds(fapl, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST) < 0 ) TEST_ERROR;
/* Create Dcpl */
@@ -1184,7 +1184,7 @@ check_group_open_tags(void)
/* ===== */
/* Create Fapl */
- if ( (fapl = h5_fileaccess_flags(H5_FILEACCESS_VOL | H5_FILEACCESS_LIBVER)) < 0 ) TEST_ERROR;
+ if ( (fapl = h5_fileaccess_flags(H5_FILEACCESS_LIBVER)) < 0 ) TEST_ERROR;
/* Create a test file with provided fcpl_t */
if ( (fid = H5Fcreate(FILENAME, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0 ) TEST_ERROR;
@@ -1295,7 +1295,7 @@ check_attribute_creation_tags(hid_t fcpl, int type)
/* ===== */
/* Create Fapl */
- if ( (fapl = h5_fileaccess_flags(H5_FILEACCESS_VOL | H5_FILEACCESS_LIBVER)) < 0 ) TEST_ERROR;
+ if ( (fapl = h5_fileaccess_flags(H5_FILEACCESS_LIBVER)) < 0 ) TEST_ERROR;
/* Create a test file with provided fcpl_t */
if ( (fid = H5Fcreate(FILENAME, H5F_ACC_TRUNC, fcpl, fapl)) < 0 ) TEST_ERROR;
@@ -1429,7 +1429,7 @@ check_attribute_open_tags(hid_t fcpl, int type)
/* ===== */
/* Create Fapl */
- if ( (fapl = h5_fileaccess_flags(H5_FILEACCESS_VOL | H5_FILEACCESS_LIBVER)) < 0 ) TEST_ERROR;
+ if ( (fapl = h5_fileaccess_flags(H5_FILEACCESS_LIBVER)) < 0 ) TEST_ERROR;
/* Create a test file with provided fcpl_t */
if ( (fid = H5Fcreate(FILENAME, H5F_ACC_TRUNC, fcpl, fapl)) < 0 ) TEST_ERROR;
@@ -1576,7 +1576,7 @@ check_attribute_rename_tags(hid_t fcpl, int type)
if ( (NULL == (data = (int *)HDcalloc(DIMS * DIMS, sizeof(int)))) ) TEST_ERROR;
/* Create Fapl */
- if ( (fapl = h5_fileaccess_flags(H5_FILEACCESS_VOL | H5_FILEACCESS_LIBVER)) < 0 ) TEST_ERROR;
+ if ( (fapl = h5_fileaccess_flags(H5_FILEACCESS_LIBVER)) < 0 ) TEST_ERROR;
/* Create a test file with provided fcpl_t */
if ( (fid = H5Fcreate(FILENAME, H5F_ACC_TRUNC, fcpl, fapl)) < 0 ) TEST_ERROR;
@@ -1761,7 +1761,7 @@ check_attribute_delete_tags(hid_t fcpl, int type)
if ( (NULL == (data = (int *)HDcalloc(DIMS * DIMS, sizeof(int)))) ) TEST_ERROR;
/* Create Fapl */
- if ( (fapl = h5_fileaccess_flags(H5_FILEACCESS_VOL | H5_FILEACCESS_LIBVER)) < 0 ) TEST_ERROR;
+ if ( (fapl = h5_fileaccess_flags(H5_FILEACCESS_LIBVER)) < 0 ) TEST_ERROR;
/* Create a test file with provided fcpl_t */
if ( (fid = H5Fcreate(FILENAME, H5F_ACC_TRUNC, fcpl, fapl)) < 0 ) TEST_ERROR;
@@ -1917,7 +1917,7 @@ check_dataset_creation_tags(hid_t fcpl, int type)
/* ===== */
/* Create Fapl */
- if ( (fapl = h5_fileaccess_flags(H5_FILEACCESS_VOL | H5_FILEACCESS_LIBVER)) < 0 ) TEST_ERROR;
+ if ( (fapl = h5_fileaccess_flags(H5_FILEACCESS_LIBVER)) < 0 ) TEST_ERROR;
if ( (fid = H5Fcreate(FILENAME, H5F_ACC_TRUNC, fcpl, fapl)) < 0 ) TEST_ERROR;
@@ -2051,7 +2051,7 @@ check_dataset_creation_earlyalloc_tags(hid_t fcpl, int type)
/* ===== */
/* Create Fapl */
- if ( (fapl = h5_fileaccess_flags(H5_FILEACCESS_VOL | H5_FILEACCESS_LIBVER)) < 0 ) TEST_ERROR;
+ if ( (fapl = h5_fileaccess_flags(H5_FILEACCESS_LIBVER)) < 0 ) TEST_ERROR;
if ( (fid = H5Fcreate(FILENAME, H5F_ACC_TRUNC, fcpl, fapl)) < 0 ) TEST_ERROR;
@@ -2187,7 +2187,7 @@ check_dataset_open_tags(void)
/* ========= */
/* Create Fapl */
- if ( (fapl = h5_fileaccess_flags(H5_FILEACCESS_VOL | H5_FILEACCESS_LIBVER)) < 0 ) TEST_ERROR;
+ if ( (fapl = h5_fileaccess_flags(H5_FILEACCESS_LIBVER)) < 0 ) TEST_ERROR;
/* Create file */
if ( (fid = H5Fcreate(FILENAME, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0 ) TEST_ERROR;
@@ -2318,7 +2318,7 @@ check_dataset_write_tags(void)
if ( (NULL == (data = (int *)HDcalloc(DIMS * DIMS, sizeof(int)))) ) TEST_ERROR;
/* Create Fapl */
- if ( (fapl = h5_fileaccess_flags(H5_FILEACCESS_VOL | H5_FILEACCESS_LIBVER)) < 0 ) TEST_ERROR;
+ if ( (fapl = h5_fileaccess_flags(H5_FILEACCESS_LIBVER)) < 0 ) TEST_ERROR;
/* Create file */
if ( (fid = H5Fcreate(FILENAME, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0 ) TEST_ERROR;
@@ -2457,7 +2457,7 @@ check_attribute_write_tags(hid_t fcpl, int type)
if ( (NULL == (data = (int *)HDcalloc(DIMS * DIMS, sizeof(int)))) ) TEST_ERROR;
/* Create Fapl */
- if ( (fapl = h5_fileaccess_flags(H5_FILEACCESS_VOL | H5_FILEACCESS_LIBVER)) < 0 ) TEST_ERROR;
+ if ( (fapl = h5_fileaccess_flags(H5_FILEACCESS_LIBVER)) < 0 ) TEST_ERROR;
/* Create a test file with provided fcpl_t */
if ( (fid = H5Fcreate(FILENAME, H5F_ACC_TRUNC, fcpl, fapl)) < 0 ) TEST_ERROR;
@@ -2613,7 +2613,7 @@ check_dataset_read_tags(void)
if ( (NULL == (data = (int *)HDcalloc(DIMS * DIMS, sizeof(int)))) ) TEST_ERROR;
/* Create Fapl */
- if ( (fapl = h5_fileaccess_flags(H5_FILEACCESS_VOL | H5_FILEACCESS_LIBVER)) < 0 ) TEST_ERROR;
+ if ( (fapl = h5_fileaccess_flags(H5_FILEACCESS_LIBVER)) < 0 ) TEST_ERROR;
/* Create file */
if ( (fid = H5Fcreate(FILENAME, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0 ) TEST_ERROR;
@@ -2751,7 +2751,7 @@ check_dataset_size_retrieval(void)
if ( (NULL == (data = (int *)HDcalloc(DIMS * DIMS, sizeof(int)))) ) TEST_ERROR;
/* Create Fapl */
- if ( (fapl = h5_fileaccess_flags(H5_FILEACCESS_VOL | H5_FILEACCESS_LIBVER)) < 0 ) TEST_ERROR;
+ if ( (fapl = h5_fileaccess_flags(H5_FILEACCESS_LIBVER)) < 0 ) TEST_ERROR;
/* Create file */
if ( (fid = H5Fcreate(FILENAME, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0 ) TEST_ERROR;
@@ -2890,7 +2890,7 @@ check_dataset_extend_tags(void)
if ( (NULL == (data = (int *)HDcalloc(DIMS * DIMS, sizeof(int)))) ) TEST_ERROR;
/* Create Fapl */
- if ( (fapl = h5_fileaccess_flags(H5_FILEACCESS_VOL | H5_FILEACCESS_LIBVER)) < 0 ) TEST_ERROR;
+ if ( (fapl = h5_fileaccess_flags(H5_FILEACCESS_LIBVER)) < 0 ) TEST_ERROR;
/* Create file */
if ( (fid = H5Fcreate(FILENAME, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0 ) TEST_ERROR;
@@ -3017,7 +3017,7 @@ check_object_info_tags(void)
/* ===== */
/* Create Fapl */
- if ( (fapl = h5_fileaccess_flags(H5_FILEACCESS_VOL | H5_FILEACCESS_LIBVER)) < 0 ) TEST_ERROR;
+ if ( (fapl = h5_fileaccess_flags(H5_FILEACCESS_LIBVER)) < 0 ) TEST_ERROR;
/* Create a test file */
if ( (fid = H5Fcreate(FILENAME, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0 ) TEST_ERROR;
@@ -3126,7 +3126,7 @@ check_object_copy_tags(void)
/* ===== */
/* Create Fapl */
- if ( (fapl = h5_fileaccess_flags(H5_FILEACCESS_VOL | H5_FILEACCESS_LIBVER)) < 0 ) TEST_ERROR;
+ if ( (fapl = h5_fileaccess_flags(H5_FILEACCESS_LIBVER)) < 0 ) TEST_ERROR;
/* Create a test file */
if ( (fid = H5Fcreate(FILENAME, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0 ) TEST_ERROR;
@@ -3257,7 +3257,7 @@ check_link_removal_tags(hid_t fcpl, int type)
if ( (NULL == (data = (int *)HDcalloc(DIMS * DIMS, sizeof(int)))) ) TEST_ERROR;
/* Create Fapl */
- if ( (fapl = h5_fileaccess_flags(H5_FILEACCESS_VOL | H5_FILEACCESS_LIBVER)) < 0 ) TEST_ERROR;
+ if ( (fapl = h5_fileaccess_flags(H5_FILEACCESS_LIBVER)) < 0 ) TEST_ERROR;
/* Create file */
if ( (fid = H5Fcreate(FILENAME, H5F_ACC_TRUNC, fcpl, fapl)) < 0 ) TEST_ERROR;
@@ -3416,7 +3416,7 @@ check_link_getname_tags(void)
if ( (NULL == (data = (int *)HDcalloc(DIMS * DIMS, sizeof(int)))) ) TEST_ERROR;
/* Create Fapl */
- if ( (fapl = h5_fileaccess_flags(H5_FILEACCESS_VOL | H5_FILEACCESS_LIBVER)) < 0 ) TEST_ERROR;
+ if ( (fapl = h5_fileaccess_flags(H5_FILEACCESS_LIBVER)) < 0 ) TEST_ERROR;
/* Create file */
if ( (fid = H5Fcreate(FILENAME, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0 ) TEST_ERROR;
@@ -3553,7 +3553,7 @@ check_external_link_creation_tags(void)
/* ===== */
/* Create Fapl */
- if ( (fapl = h5_fileaccess_flags(H5_FILEACCESS_VOL | H5_FILEACCESS_LIBVER)) < 0 ) TEST_ERROR;
+ if ( (fapl = h5_fileaccess_flags(H5_FILEACCESS_LIBVER)) < 0 ) TEST_ERROR;
/* Create a test file */
if ( (fid = H5Fcreate(FILENAME, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0 ) TEST_ERROR;
@@ -3660,7 +3660,7 @@ check_external_link_open_tags(void)
/* ===== */
/* Create Fapl */
- if ( (fapl = h5_fileaccess_flags(H5_FILEACCESS_VOL | H5_FILEACCESS_LIBVER)) < 0 ) TEST_ERROR;
+ if ( (fapl = h5_fileaccess_flags(H5_FILEACCESS_LIBVER)) < 0 ) TEST_ERROR;
/* Create a test file */
if ( (fid = H5Fcreate(FILENAME, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0 ) TEST_ERROR;
@@ -3787,7 +3787,7 @@ check_invalid_tag_application(void)
#if H5C_DO_TAGGING_SANITY_CHECKS
/* Create Fapl */
- if ( (fapl = h5_fileaccess_flags(H5_FILEACCESS_VOL | H5_FILEACCESS_LIBVER)) < 0 ) TEST_ERROR;
+ if ( (fapl = h5_fileaccess_flags(H5_FILEACCESS_LIBVER)) < 0 ) TEST_ERROR;
/* Create a test file */
if ( (fid = H5Fcreate(FILENAME, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0 ) TEST_ERROR;
diff --git a/test/cmpd_dset.c b/test/cmpd_dset.c
index a8baeac..1944ce1 100644
--- a/test/cmpd_dset.c
+++ b/test/cmpd_dset.c
@@ -1808,7 +1808,7 @@ test_pack_ooo(void)
unsigned free_order[PACK_NMEMBS]; /* Index of remaining free slots in order */
unsigned num_free; /* Number of free slots in order */
unsigned sub_cmpd_order; /* Order to insert the inner compound */
- char name[6]; /* Member name */
+ char name[16]; /* Member name */
unsigned extra_space; /* Whether to add extra space to the end of
* the compound */
unsigned i, j; /* Indices */
diff --git a/test/direct_chunk.c b/test/direct_chunk.c
index 2edfe64..9ea814c 100644
--- a/test/direct_chunk.c
+++ b/test/direct_chunk.c
@@ -58,6 +58,14 @@
#define OVERWRITE_CHUNK_NY 2
#define OVERWRITE_VALUE 42
+/* Test configurations */
+#define CONFIG_LATEST 0x01
+#define CONFIG_REOPEN_FILE 0x02
+#define CONFIG_REOPEN_DSET 0x04
+#define CONFIG_DIRECT_WRITE 0x08
+#define CONFIG_DIRECT_READ 0x10
+#define CONFIG_END 0x20
+
/* Defines used in test_single_chunk_latest() */
#define FILE "single_latest.h5"
#define DATASET "dataset"
@@ -1973,7 +1981,7 @@ error:
} /* test_read_unallocated_chunk() */
/*-------------------------------------------------------------------------
- * Function: test_single_chunk_latest
+ * Function: test_single_chunk
*
* Purpose: This is to verify the fix for jira issue HDFFV-10425.
* The problem was due to a bug in the internal ilbrary routine
@@ -1989,27 +1997,31 @@ error:
* index for the dataset.
* Verify that the data read is the same as the written data.
*
+ * Since expanded to test multiple combinations of cases
+ * involving a single chunk
+ *
* Return: Success: 0
* Failure: 1
*
*-------------------------------------------------------------------------
*/
static int
-test_single_chunk_latest(void)
+test_single_chunk(unsigned config)
{
- hid_t fid; /* File ID */
- hid_t fapl; /* File access property list ID */
- hid_t sid; /* Dataspace ID */
- hid_t did; /* Dataset ID */
- hid_t dcpl; /* Dataset creation property list */
+ hid_t fid = H5I_INVALID_HID; /* File ID */
+ hid_t fapl = H5I_INVALID_HID; /* File access property list ID */
+ hid_t sid = H5I_INVALID_HID; /* Dataspace ID */
+ hid_t did = H5I_INVALID_HID; /* Dataset ID */
+ hid_t dcpl = H5I_INVALID_HID; /* Dataset creation property list */
hsize_t dims[2] = {DIM0, DIM1}; /* Dimension sizes */
hsize_t chunk[2] = {CHUNK0, CHUNK1}; /* Chunk dimension sizes */
hsize_t offset[2] = {0,0}; /* Offset for writing */
+ uint32_t filters; /* Filter mask out */
int wdata[DIM0][DIM1]; /* Write buffer */
int rdata[DIM0][DIM1]; /* Read buffer */
int i, j; /* Local index variable */
- TESTING("H5Dwrite_chunk with single chunk and latest format");
+ TESTING("Single chunk I/O");
/* Initialize data */
for (i=0; i<DIM0; i++) {
@@ -2020,8 +2032,9 @@ test_single_chunk_latest(void)
/* Create a new file with the latest format */
if((fapl = H5Pcreate(H5P_FILE_ACCESS)) < 0)
goto error;
- if(H5Pset_libver_bounds(fapl, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST) < 0)
- goto error;
+ if(config & CONFIG_LATEST)
+ if(H5Pset_libver_bounds(fapl, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST) < 0)
+ goto error;
if((fid = H5Fcreate(FILE, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
goto error;
@@ -2039,37 +2052,57 @@ test_single_chunk_latest(void)
if((did = H5Dcreate2(fid, DATASET, H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0)
goto error;
- /* Write the data directly to the dataset */
- if(H5Dwrite_chunk(did, H5P_DEFAULT, 0, offset, CHUNK0*CHUNK1*4, (void *)wdata) < 0)
- goto error;
+ if(config & CONFIG_DIRECT_WRITE) {
+ /* Write the data directly to the dataset */
+ if(H5Dwrite_chunk(did, H5P_DEFAULT, 0, offset, CHUNK0*CHUNK1*4, (void *)wdata) < 0)
+ goto error;
+ } /* end if */
+ else
+ /* Write the data to the dataset */
+ if(H5Dwrite(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, (void *)wdata) < 0)
+ goto error;
/*
* Close and release resources.
*/
if(H5Pclose(dcpl) < 0)
goto error;
- if(H5Dclose(did) < 0)
- goto error;
+ if(config & CONFIG_REOPEN_DSET)
+ if(H5Dclose(did) < 0)
+ goto error;
if(H5Sclose(sid) < 0)
goto error;
if(H5Pclose(fapl) < 0)
goto error;
- if(H5Fclose(fid) < 0)
- goto error;
+ if(config & CONFIG_REOPEN_FILE)
+ if(H5Fclose(fid) < 0)
+ goto error;
/* Open the file and dataset with default properties */
- if((fid = H5Fopen(FILE, H5F_ACC_RDONLY, H5P_DEFAULT)) < 0)
- goto error;
- if((did = H5Dopen2(fid, DATASET, H5P_DEFAULT)) < 0)
- goto error;
+ if(config & CONFIG_REOPEN_FILE)
+ if((fid = H5Fopen(FILE, H5F_ACC_RDONLY, H5P_DEFAULT)) < 0)
+ goto error;
+ if(config & CONFIG_REOPEN_DSET)
+ if((did = H5Dopen2(fid, DATASET, H5P_DEFAULT)) < 0)
+ goto error;
/* Retrieve dataset creation property list */
if((dcpl = H5Dget_create_plist(did)) < 0)
goto error;
- /* Read the data */
- if(H5Dread(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, rdata) < 0)
- goto error;
+ if(config & CONFIG_DIRECT_READ) {
+ /* Read the data directly */
+ if(H5Dread_chunk(did, H5P_DEFAULT, offset, &filters, rdata) < 0)
+ goto error;
+
+ /* Verify returned filter mask */
+ if(filters != 0)
+ goto error;
+ } /* end if */
+ else
+ /* Read the data */
+ if(H5Dread(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, rdata) < 0)
+ goto error;
/* Verify that the data read was correct. */
for (i = 0; i < DIM0; i++) {
@@ -2122,6 +2155,7 @@ error:
int main( void )
{
hid_t file_id;
+ unsigned config;
int nerrors=0;
/*
@@ -2149,7 +2183,53 @@ int main( void )
nerrors += test_read_unfiltered_dset(file_id);
nerrors += test_read_unallocated_chunk(file_id);
- nerrors += test_single_chunk_latest();
+ /* Loop over test configurations */
+ for(config = 0; config < CONFIG_END; config++) {
+ hbool_t need_comma = FALSE;
+
+ /* Check for invalid combinations */
+ if((config & CONFIG_REOPEN_FILE) && !(config & CONFIG_REOPEN_DSET))
+ continue;
+
+ /* Print configuration */
+ printf("Configuration: ");
+ if(config == 0)
+ printf("<empty>");
+ if(config & CONFIG_LATEST) {
+ if(need_comma)
+ printf(", ");
+ printf("latest format");
+ need_comma = TRUE;
+ } /* end if */
+ if(config & CONFIG_REOPEN_FILE) {
+ if(need_comma)
+ printf(", ");
+ printf("reopen file");
+ need_comma = TRUE;
+ } /* end if */
+ else if(config & CONFIG_REOPEN_DSET) {
+ if(need_comma)
+ printf(", ");
+ printf("reopen dataset");
+ need_comma = TRUE;
+ } /* end if */
+ if(config & CONFIG_DIRECT_WRITE) {
+ if(need_comma)
+ printf(", ");
+ printf("direct write");
+ need_comma = TRUE;
+ } /* end if */
+ if(config & CONFIG_DIRECT_READ) {
+ if(need_comma)
+ printf(", ");
+ printf("direct read");
+ need_comma = TRUE;
+ } /* end if */
+ printf(":\n");
+ fflush(stdout);
+
+ nerrors += test_single_chunk(config);
+ } /* end for */
if(H5Fclose(file_id) < 0)
goto error;
@@ -2165,3 +2245,4 @@ error:
HDputs("*** TESTS FAILED ***");
return EXIT_FAILURE;
}
+
diff --git a/test/dsets.c b/test/dsets.c
index 5de9cfa..603f785 100644
--- a/test/dsets.c
+++ b/test/dsets.c
@@ -835,8 +835,8 @@ test_compact_io(hid_t fapl)
skipping invalid combinations.
- Create a file, create and write a compact dataset, and verify its data
- Verify the dataset's layout and fill message versions */
- for(low = H5F_LIBVER_EARLIEST; low < H5F_LIBVER_NBOUNDS; low++) {
- for(high = H5F_LIBVER_EARLIEST; high < H5F_LIBVER_NBOUNDS; high++) {
+ for(low = H5F_LIBVER_EARLIEST; low < H5F_LIBVER_NBOUNDS; H5_INC_ENUM(H5F_libver_t, low)) {
+ for(high = H5F_LIBVER_EARLIEST; high < H5F_LIBVER_NBOUNDS; H5_INC_ENUM(H5F_libver_t, high)) {
/* Set version bounds */
H5E_BEGIN_TRY {
@@ -1233,14 +1233,19 @@ test_conv_buffer(hid_t fid)
CmpField *cf = NULL;
CmpFieldR *cfrR = NULL;
- hid_t dataset = -1; /* dataset ID */
- hid_t space = -1; /* data space ID */
- hid_t ctype1, ctype2; /* data type ID */
- hid_t arr_type1, arr_type2, arr_type3, arr_type4, arr_type5;
+ hid_t dataset = H5I_INVALID_HID; /* dataset ID */
+ hid_t space = H5I_INVALID_HID; /* data space ID */
+ hid_t ctype1 = H5I_INVALID_HID,
+ ctype2 = H5I_INVALID_HID; /* data type ID */
+ hid_t arr_type1 = H5I_INVALID_HID,
+ arr_type2 = H5I_INVALID_HID,
+ arr_type3 = H5I_INVALID_HID,
+ arr_type4 = H5I_INVALID_HID,
+ arr_type5 = H5I_INVALID_HID;
hsize_t dimsa[3];
hsize_t dimsb[1];
hsize_t dimsc[1];
- hid_t xfer_list;
+ hid_t xfer_list = H5I_INVALID_HID;
size_t size;
TESTING("data type conversion buffer size");
@@ -10331,8 +10336,8 @@ test_zero_dim_dset(hid_t fapl)
/* Loop through all the combinations of low/high library format bounds,
skipping invalid combination, and verify support for reading a 1D
chunked dataset with dimension size = 0 */
- for(low = H5F_LIBVER_EARLIEST; low < H5F_LIBVER_NBOUNDS; low++) {
- for(high = H5F_LIBVER_EARLIEST; high < H5F_LIBVER_NBOUNDS; high++) {
+ for(low = H5F_LIBVER_EARLIEST; low < H5F_LIBVER_NBOUNDS; H5_INC_ENUM(H5F_libver_t, low)) {
+ for(high = H5F_LIBVER_EARLIEST; high < H5F_LIBVER_NBOUNDS; H5_INC_ENUM(H5F_libver_t, high)) {
/* Set version bounds before opening the file */
H5E_BEGIN_TRY {
@@ -12920,7 +12925,6 @@ test_versionbounds(void)
hid_t vspace = -1; /* Virtual dset dataspaces */
hid_t srcdset = -1; /* Source datset */
hid_t vdset = -1; /* Virtual dataset */
- hid_t null_dspace = -1; /* Data space of H5S_NULL */
hsize_t dims[1] = {3}; /* Data space current size */
char srcfilename[FILENAME_BUF_SIZE];
char vfilename1[FILENAME_BUF_SIZE];
@@ -12961,8 +12965,8 @@ test_versionbounds(void)
/* Create a source file and a dataset in it. Create a virtual file and
virtual dataset. Creation of virtual dataset should only succeed in
H5F_LIBVER_V110 */
- for(low = H5F_LIBVER_EARLIEST; low < H5F_LIBVER_NBOUNDS; low++) {
- for(high = H5F_LIBVER_EARLIEST; high < H5F_LIBVER_NBOUNDS; high++) {
+ for(low = H5F_LIBVER_EARLIEST; low < H5F_LIBVER_NBOUNDS; H5_INC_ENUM(H5F_libver_t, low)) {
+ for(high = H5F_LIBVER_EARLIEST; high < H5F_LIBVER_NBOUNDS; H5_INC_ENUM(H5F_libver_t, high)) {
/* Set version bounds, skip for invalid low/high combination */
H5E_BEGIN_TRY {
@@ -12990,7 +12994,7 @@ test_versionbounds(void)
if (vdset > 0) /* dataset created successfully */
{
/* Virtual dataset is only available starting in V110 */
- VERIFY(high, H5F_LIBVER_V110, "virtual dataset");
+ VERIFY(high >= H5F_LIBVER_V110, TRUE, "virtual dataset");
if(H5Dclose(vdset) < 0) TEST_ERROR
vdset = -1;
diff --git a/test/dtypes.c b/test/dtypes.c
index 7e5a992..2056245 100644
--- a/test/dtypes.c
+++ b/test/dtypes.c
@@ -6837,8 +6837,8 @@ test_delete_obj_named(hid_t fapl)
/* Loop through all valid the combinations of low/high library format bounds,
to test delete objects that use named datatypes through different file IDs */
- for(low = H5F_LIBVER_EARLIEST; low < H5F_LIBVER_NBOUNDS; low++) {
- for(high = H5F_LIBVER_EARLIEST; high < H5F_LIBVER_NBOUNDS; high++) {
+ for(low = H5F_LIBVER_EARLIEST; low < H5F_LIBVER_NBOUNDS; H5_INC_ENUM(H5F_libver_t, low)) {
+ for(high = H5F_LIBVER_EARLIEST; high < H5F_LIBVER_NBOUNDS; H5_INC_ENUM(H5F_libver_t, high)) {
/* Skip invalid low/high combination */
if ((high == H5F_LIBVER_EARLIEST) || (low > high))
@@ -6938,8 +6938,8 @@ test_delete_obj_named_fileid(hid_t fapl)
h5_fixname(FILENAME[9], fapl2, filename2, sizeof filename2);
/* Loop through all the combinations of low/high library format bounds */
- for(low = H5F_LIBVER_EARLIEST; low < H5F_LIBVER_NBOUNDS; low++) {
- for(high = H5F_LIBVER_EARLIEST; high < H5F_LIBVER_NBOUNDS; high++) {
+ for(low = H5F_LIBVER_EARLIEST; low < H5F_LIBVER_NBOUNDS; H5_INC_ENUM(H5F_libver_t, low)) {
+ for(high = H5F_LIBVER_EARLIEST; high < H5F_LIBVER_NBOUNDS; H5_INC_ENUM(H5F_libver_t, high)) {
/* Skip invalid low/high combination */
if ((high == H5F_LIBVER_EARLIEST) || (low > high))
@@ -7627,7 +7627,10 @@ test_versionbounds(void)
H5F_t *filep = NULL; /* Pointer to internal structure of a file */
H5T_t *dtypep = NULL; /* Pointer to internal structure of a datatype */
hsize_t arr_dim[] = {ARRAY_LEN}; /* Length of the array */
+ int i, j; /* Indices for iterating over versions */
H5F_libver_t low, high; /* File format bounds */
+ H5F_libver_t versions[] = {H5F_LIBVER_EARLIEST, H5F_LIBVER_V18, H5F_LIBVER_V110};
+ int versions_count = 3; /* Number of version bounds in the array */
unsigned highest_version; /* Highest version in nested datatypes */
color_t enum_val; /* Enum type index */
herr_t ret = 0; /* Generic return value */
@@ -7691,19 +7694,19 @@ test_versionbounds(void)
ret = H5Tenum_insert(enum_type, "RED", &enum_val);
if (ret < 0) TEST_ERROR
- enum_val++;
+ enum_val = E1_GREEN;
ret = H5Tenum_insert(enum_type, "GREEN", &enum_val);
if (ret < 0) TEST_ERROR
- enum_val++;
+ enum_val = E1_BLUE;
ret = H5Tenum_insert(enum_type, "BLUE", &enum_val);
if (ret < 0) TEST_ERROR
- enum_val++;
+ enum_val = E1_ORANGE;
ret = H5Tenum_insert(enum_type, "ORANGE", &enum_val);
if (ret < 0) TEST_ERROR
- enum_val++;
+ enum_val = E1_YELLOW;
ret = H5Tenum_insert(enum_type, "YELLOW", &enum_val);
if (ret < 0) TEST_ERROR
@@ -7727,8 +7730,9 @@ test_versionbounds(void)
skipping invalid combinations */
/* Create the file, create and write to a dataset with compound datatype */
/* Verify the dataset's datatype and its members */
- for(low = H5F_LIBVER_EARLIEST; low < H5F_LIBVER_NBOUNDS; low++) {
- for(high = H5F_LIBVER_EARLIEST; high < H5F_LIBVER_NBOUNDS; high++) {
+ for(i = 0, low = versions[i]; i < versions_count; i++) {
+
+ for(j = 0, high = versions[j]; j < versions_count; j++) {
/* Set version bounds */
H5E_BEGIN_TRY {
diff --git a/test/enc_dec_plist.c b/test/enc_dec_plist.c
index 33d23dc..2c8f691 100644
--- a/test/enc_dec_plist.c
+++ b/test/enc_dec_plist.c
@@ -15,75 +15,139 @@
* Serial tests for encoding/decoding plists
*/
-#include "h5test.h"
+#include "testhdf5.h"
#include "H5ACprivate.h"
#include "H5Pprivate.h"
+#define SRC_FNAME "source_file.h5"
+#define SRC_DSET "src_dset"
+
static int
-test_encode_decode(hid_t orig_pl)
+test_encode_decode(hid_t orig_pl, H5F_libver_t low, H5F_libver_t high, hbool_t support_virtual)
{
- hid_t pl = (-1); /* Decoded property list */
+ hid_t pl = (-1); /* Decoded property list */
+ hid_t fapl = -1; /* File access property list */
void *temp_buf = NULL; /* Pointer to encoding buffer */
size_t temp_size = 0; /* Size of encoding buffer */
+ herr_t ret; /* Return value */
- /* first call to encode returns only the size of the buffer needed */
- if(H5Pencode(orig_pl, NULL, &temp_size) < 0)
- STACK_ERROR
+ /* Create file access property list */
+ if((fapl = H5Pcreate(H5P_FILE_ACCESS)) < 0)
+ TEST_ERROR
- if(NULL == (temp_buf = (void *)HDmalloc(temp_size)))
+ /* Set library version bounds */
+ if(H5Pset_libver_bounds(fapl, low, high) < 0)
TEST_ERROR
- if(H5Pencode(orig_pl, temp_buf, &temp_size) < 0)
- STACK_ERROR
+ H5E_BEGIN_TRY {
+ ret = H5Pencode2(orig_pl, NULL, &temp_size, fapl);
+ } H5E_END_TRY;
+
+ if(support_virtual && high < H5F_LIBVER_V110)
+ VERIFY(ret, FAIL, "H5Pencode2");
+ else {
+
+ VERIFY(ret, SUCCEED, "H5Pencode2");
+
+ /* Allocate the buffer for encoding */
+ if(NULL == (temp_buf = (void *)HDmalloc(temp_size)))
+ TEST_ERROR
+
+ /* Encode the property list to the buffer */
+ if(H5Pencode2(orig_pl, temp_buf, &temp_size, fapl) < 0)
+ TEST_ERROR
+
+ /* Decode the buffer */
+ if((pl = H5Pdecode(temp_buf)) < 0)
+ STACK_ERROR
+
+ /* Check if the original and the decoded property lists are equal */
+ if(!H5Pequal(orig_pl, pl))
+ PUTS_ERROR("encoding-decoding cycle failed\n")
+
+ /* Close the decoded property list */
+ if((H5Pclose(pl)) < 0)
+ TEST_ERROR
+
+ /* Free the buffer */
+ if(temp_buf)
+ HDfree(temp_buf);
+
+#ifndef H5_NO_DEPRECATED_SYMBOLS
+ /* Test H5Pencode1() */
+
+ /* first call to encode returns only the size of the buffer needed */
+ if(H5Pencode1(orig_pl, NULL, &temp_size) < 0)
+ STACK_ERROR
+
+ if(NULL == (temp_buf = (void *)HDmalloc(temp_size)))
+ TEST_ERROR
+
+ if(H5Pencode1(orig_pl, temp_buf, &temp_size) < 0)
+ STACK_ERROR
- if((pl = H5Pdecode(temp_buf)) < 0)
- STACK_ERROR
+ if((pl = H5Pdecode(temp_buf)) < 0)
+ STACK_ERROR
- if(!H5Pequal(orig_pl, pl))
- PUTS_ERROR("encoding-decoding cycle failed\n")
+ if(!H5Pequal(orig_pl, pl))
+ PUTS_ERROR("encoding-decoding cycle failed\n")
- if((H5Pclose(pl)) < 0)
- STACK_ERROR
+ if((H5Pclose(pl)) < 0)
+ STACK_ERROR
- HDfree(temp_buf);
+ if(temp_buf)
+ HDfree(temp_buf);
+#endif /* H5_NO_DEPRECATED_SYMBOLS */
+
+ }
+
+ if((H5Pclose(fapl)) < 0)
+ TEST_ERROR
/* Success */
return(0);
error:
- if(pl > 0)
- H5Pclose(pl);
if(temp_buf)
HDfree(temp_buf);
+ H5E_BEGIN_TRY {
+ H5Pclose(pl);
+ H5Pclose(fapl);
+ } H5E_END_TRY;
+
return(-1);
} /* end test_encode_decode() */
int
main(void)
{
- hid_t dcpl; /* dataset create prop. list */
- hid_t dapl; /* dataset access prop. list */
- hid_t dxpl; /* dataset xfer prop. list */
- hid_t gcpl; /* group create prop. list */
- hid_t ocpypl; /* object copy prop. list */
- hid_t ocpl; /* object create prop. list */
- hid_t lcpl; /* link create prop. list */
- hid_t lapl; /* link access prop. list */
- hid_t fapl; /* file access prop. list */
- hid_t fcpl; /* file create prop. list */
- hid_t strcpl; /* string create prop. list */
- hid_t acpl; /* attribute create prop. list */
-
+ hid_t dcpl; /* dataset create prop. list */
+ hid_t dapl; /* dataset access prop. list */
+ hid_t dxpl; /* dataset xfer prop. list */
+ hid_t gcpl; /* group create prop. list */
+ hid_t ocpypl; /* object copy prop. list */
+ hid_t ocpl; /* object create prop. list */
+ hid_t lcpl; /* link create prop. list */
+ hid_t lapl; /* link access prop. list */
+ hid_t fapl; /* file access prop. list */
+ hid_t fcpl; /* file create prop. list */
+ hid_t strcpl; /* string create prop. list */
+ hid_t acpl; /* attribute create prop. list */
+ hid_t srcspace = -1; /* Source dataspaces */
+ hid_t vspace = -1; /* Virtual dset dataspaces */
+ hsize_t dims[1] = {3}; /* Data space current size */
hsize_t chunk_size[2] = {16384, 4}; /* chunk size */
- double fill = 2.7f; /* Fill value */
- hsize_t max_size[1]; /* data space maximum size */
+ double fill = 2.7f; /* Fill value */
+ hsize_t max_size[1]; /* data space maximum size */
size_t nslots = 521 * 2;
size_t nbytes = 1048576 * 10;
double w0 = 0.5f;
unsigned max_compact;
unsigned min_dense;
const char* c_to_f = "x+32";
+ H5F_libver_t low, high; /* Low and high bounds */
+
H5AC_cache_config_t my_cache_config = {
H5AC__CURR_CACHE_CONFIG_VERSION,
TRUE,
@@ -115,467 +179,511 @@ main(void)
0.2f,
(256 * 2048),
H5AC__DEFAULT_METADATA_WRITE_STRATEGY};
+
H5AC_cache_image_config_t my_cache_image_config = {
- H5AC__CURR_CACHE_IMAGE_CONFIG_VERSION,
- TRUE,
+ H5AC__CURR_CACHE_IMAGE_CONFIG_VERSION,
+ TRUE,
FALSE,
- -1};
-
- if(VERBOSE_MED)
- printf("Encode/Decode DCPLs\n");
+ -1 };
+
+ /* Loop through all the combinations of low/high version bounds */
+ for(low = H5F_LIBVER_EARLIEST; low < H5F_LIBVER_NBOUNDS; low++) {
+ for(high = H5F_LIBVER_EARLIEST; high < H5F_LIBVER_NBOUNDS; high++) {
+ char msg[80]; /* Message for file version bounds */
+ char* low_string; /* The low bound string */
+ char* high_string; /* The high bound string */
+
+ /* Invalid combinations, just continue */
+ if(high == H5F_LIBVER_EARLIEST || high < low)
+ continue;
+
+ /* Display testing info */
+ low_string = h5_get_version_string(low);
+ high_string = h5_get_version_string(high);
+ HDsprintf(msg, "Testing ENCODE/DECODE with file version bounds: (%s, %s):", low_string, high_string);
+ HDputs(msg);
+
+
+ if(VERBOSE_MED)
+ printf("Encode/Decode DCPLs\n");
+
+ /******* ENCODE/DECODE DCPLS *****/
+ TESTING("Default DCPL Encoding/Decoding");
+ if((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0)
+ FAIL_STACK_ERROR
+
+ /* Test encoding & decoding default property list */
+ if(test_encode_decode(dcpl, low, high, FALSE) < 0)
+ FAIL_PUTS_ERROR("Default DCPL encoding/decoding failed\n")
+
+ PASSED();
+
+ TESTING("DCPL Encoding/Decoding");
+
+ if((H5Pset_chunk(dcpl, 2, chunk_size)) < 0)
+ FAIL_STACK_ERROR
+
+ if((H5Pset_alloc_time(dcpl, H5D_ALLOC_TIME_LATE)) < 0)
+ FAIL_STACK_ERROR
+
+ 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)
+ FAIL_STACK_ERROR
+ if((H5Pset_external(dcpl, "ext2.data", (off_t)0,
+ (hsize_t)(max_size[0] * sizeof(int)/4))) < 0)
+ FAIL_STACK_ERROR
+ if((H5Pset_external(dcpl, "ext3.data", (off_t)0,
+ (hsize_t)(max_size[0] * sizeof(int)/4))) < 0)
+ FAIL_STACK_ERROR
+ if((H5Pset_external(dcpl, "ext4.data", (off_t)0,
+ (hsize_t)(max_size[0] * sizeof(int)/4))) < 0)
+ FAIL_STACK_ERROR
+
+ /* Test encoding & decoding property list */
+ if(test_encode_decode(dcpl, low, high, FALSE) < 0)
+ FAIL_PUTS_ERROR("DCPL encoding/decoding failed\n")
+
+ /* release resource */
+ if((H5Pclose(dcpl)) < 0)
+ FAIL_STACK_ERROR
+
+ PASSED();
+
+ /******* ENCODE/DECODE DCPLS *****/
+ TESTING("DCPL Encoding/Decoding for virtual layout");
+ if((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0)
+ FAIL_STACK_ERROR
+
+ /* Set virtual layout */
+ if(H5Pset_layout(dcpl, H5D_VIRTUAL) < 0)
+ TEST_ERROR
+
+ /* Create source dataspace */
+ if((srcspace = H5Screate_simple(1, dims, NULL)) < 0)
+ TEST_ERROR
+
+ /* Create virtual dataspace */
+ if((vspace = H5Screate_simple(1, dims, NULL)) < 0)
+ TEST_ERROR
+
+ /* Add virtual layout mapping */
+ if(H5Pset_virtual(dcpl, vspace, SRC_FNAME, SRC_DSET, srcspace) < 0)
+ TEST_ERROR
+
+ if(test_encode_decode(dcpl, low, high, TRUE) < 0)
+ FAIL_PUTS_ERROR("DCPL encoding/decoding failed\n")
+
+ /* release resource */
+ if((H5Pclose(dcpl)) < 0)
+ FAIL_STACK_ERROR
+
+ /******* ENCODE/DECODE DAPLS *****/
+ TESTING("Default DAPL Encoding/Decoding");
+ if((dapl = H5Pcreate(H5P_DATASET_ACCESS)) < 0)
+ FAIL_STACK_ERROR
+
+ /* Test encoding & decoding default property list */
+ if(test_encode_decode(dapl, low, high, FALSE) < 0)
+ FAIL_PUTS_ERROR("Default DAPL encoding/decoding failed\n")
+
+ PASSED();
+
+ TESTING("DAPL Encoding/Decoding");
+
+ if((H5Pset_chunk_cache(dapl, nslots, nbytes, w0)) < 0)
+ FAIL_STACK_ERROR
+
+ /* Test encoding & decoding property list */
+ if(test_encode_decode(dapl, low, high, FALSE) < 0)
+ FAIL_PUTS_ERROR("DAPL encoding/decoding failed\n")
+
+ /* release resource */
+ if((H5Pclose(dapl)) < 0)
+ FAIL_STACK_ERROR
- /******* ENCODE/DECODE DCPLS *****/
- TESTING("Default DCPL Encoding/Decoding");
- if((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0)
- FAIL_STACK_ERROR
+ PASSED();
- /* Test encoding & decoding default property list */
- if(test_encode_decode(dcpl) < 0)
- FAIL_PUTS_ERROR("Default DCPL encoding/decoding failed\n")
+ /******* ENCODE/DECODE OCPLS *****/
+ TESTING("Default OCPL Encoding/Decoding");
+ if((ocpl = H5Pcreate(H5P_OBJECT_CREATE)) < 0)
+ FAIL_STACK_ERROR
+
+ /* Test encoding & decoding default property list */
+ if(test_encode_decode(ocpl, low, high, FALSE) < 0)
+ FAIL_PUTS_ERROR("Default OCPL encoding/decoding failed\n")
- PASSED();
+ PASSED();
- TESTING("DCPL Encoding/Decoding");
+ TESTING("OCPL Encoding/Decoding");
- if((H5Pset_chunk(dcpl, 2, chunk_size)) < 0)
- FAIL_STACK_ERROR
+ if((H5Pset_attr_creation_order(ocpl, (H5P_CRT_ORDER_TRACKED | H5P_CRT_ORDER_INDEXED))) < 0)
+ FAIL_STACK_ERROR
- if((H5Pset_alloc_time(dcpl, H5D_ALLOC_TIME_LATE)) < 0)
- FAIL_STACK_ERROR
+ if((H5Pset_attr_phase_change (ocpl, 110, 105)) < 0)
+ FAIL_STACK_ERROR
- if((H5Pset_fill_value(dcpl, H5T_NATIVE_DOUBLE, &fill)) < 0)
- FAIL_STACK_ERROR
+ if((H5Pset_filter (ocpl, H5Z_FILTER_FLETCHER32, 0, (size_t)0, NULL)) < 0)
+ FAIL_STACK_ERROR
- if((H5Pset_dset_no_attrs_hint(dcpl, FALSE)) < 0)
- FAIL_STACK_ERROR
+ /* Test encoding & decoding property list */
+ if(test_encode_decode(ocpl, low, high, FALSE) < 0)
+ FAIL_PUTS_ERROR("OCPL encoding/decoding failed\n")
- max_size[0] = 100;
- if((H5Pset_external(dcpl, "ext1.data", (off_t)0,
- (hsize_t)(max_size[0] * sizeof(int)/4))) < 0)
- FAIL_STACK_ERROR
- if((H5Pset_external(dcpl, "ext2.data", (off_t)0,
- (hsize_t)(max_size[0] * sizeof(int)/4))) < 0)
- FAIL_STACK_ERROR
- if((H5Pset_external(dcpl, "ext3.data", (off_t)0,
- (hsize_t)(max_size[0] * sizeof(int)/4))) < 0)
- FAIL_STACK_ERROR
- if((H5Pset_external(dcpl, "ext4.data", (off_t)0,
- (hsize_t)(max_size[0] * sizeof(int)/4))) < 0)
- FAIL_STACK_ERROR
+ /* release resource */
+ if((H5Pclose(ocpl)) < 0)
+ FAIL_STACK_ERROR
- /* Test encoding & decoding property list */
- if(test_encode_decode(dcpl) < 0)
- FAIL_PUTS_ERROR("DCPL encoding/decoding failed\n")
-
- /* release resource */
- if((H5Pclose(dcpl)) < 0)
- FAIL_STACK_ERROR
+ PASSED();
- PASSED();
+ /******* ENCODE/DECODE DXPLS *****/
+ TESTING("Default DXPL Encoding/Decoding");
+ if((dxpl = H5Pcreate(H5P_DATASET_XFER)) < 0)
+ FAIL_STACK_ERROR
+ /* Test encoding & decoding default property list */
+ if(test_encode_decode(dxpl, low, high, FALSE) < 0)
+ FAIL_PUTS_ERROR("Default DXPL encoding/decoding failed\n")
- /******* ENCODE/DECODE DAPLS *****/
- TESTING("Default DAPL Encoding/Decoding");
- if((dapl = H5Pcreate(H5P_DATASET_ACCESS)) < 0)
- FAIL_STACK_ERROR
+ PASSED();
- /* Test encoding & decoding default property list */
- if(test_encode_decode(dapl) < 0)
- FAIL_PUTS_ERROR("Default DAPL encoding/decoding failed\n")
+ TESTING("DXPL Encoding/Decoding");
- PASSED();
+ if((H5Pset_btree_ratios(dxpl, 0.2f, 0.6f, 0.2f)) < 0)
+ FAIL_STACK_ERROR
+ if((H5Pset_hyper_vector_size(dxpl, 5)) < 0)
+ FAIL_STACK_ERROR
- TESTING("DAPL Encoding/Decoding");
+#ifdef H5_HAVE_PARALLEL
+ if((H5Pset_dxpl_mpio(dxpl, H5FD_MPIO_COLLECTIVE)) < 0)
+ FAIL_STACK_ERROR
+ if((H5Pset_dxpl_mpio_collective_opt(dxpl, H5FD_MPIO_INDIVIDUAL_IO)) < 0)
+ FAIL_STACK_ERROR
+ if((H5Pset_dxpl_mpio_chunk_opt(dxpl, H5FD_MPIO_CHUNK_MULTI_IO)) < 0)
+ FAIL_STACK_ERROR
+ if((H5Pset_dxpl_mpio_chunk_opt_ratio(dxpl, 30)) < 0)
+ FAIL_STACK_ERROR
+ if((H5Pset_dxpl_mpio_chunk_opt_num(dxpl, 40)) < 0)
+ FAIL_STACK_ERROR
+#endif/* H5_HAVE_PARALLEL */
+ if((H5Pset_edc_check(dxpl, H5Z_DISABLE_EDC)) < 0)
+ FAIL_STACK_ERROR
+ if((H5Pset_data_transform(dxpl, c_to_f)) < 0)
+ FAIL_STACK_ERROR
- if((H5Pset_chunk_cache(dapl, nslots, nbytes, w0)) < 0)
- FAIL_STACK_ERROR
+ /* Test encoding & decoding property list */
+ if(test_encode_decode(dxpl, low, high, FALSE) < 0)
+ FAIL_PUTS_ERROR("DXPL encoding/decoding failed\n")
- /* Test encoding & decoding property list */
- if(test_encode_decode(dapl) < 0)
- FAIL_PUTS_ERROR("DAPL encoding/decoding failed\n")
-
- /* release resource */
- if((H5Pclose(dapl)) < 0)
- FAIL_STACK_ERROR
+ /* release resource */
+ if((H5Pclose(dxpl)) < 0)
+ FAIL_STACK_ERROR
- PASSED();
+ PASSED();
+ /******* ENCODE/DECODE GCPLS *****/
+ TESTING("Default GCPL Encoding/Decoding");
+ if((gcpl = H5Pcreate(H5P_GROUP_CREATE)) < 0)
+ FAIL_STACK_ERROR
+
+ /* Test encoding & decoding default property list */
+ if(test_encode_decode(gcpl, low, high, FALSE) < 0)
+ FAIL_PUTS_ERROR("Default GCPL encoding/decoding failed\n")
- /******* ENCODE/DECODE OCPLS *****/
- TESTING("Default OCPL Encoding/Decoding");
- if((ocpl = H5Pcreate(H5P_OBJECT_CREATE)) < 0)
- FAIL_STACK_ERROR
+ PASSED();
- /* Test encoding & decoding default property list */
- if(test_encode_decode(ocpl) < 0)
- FAIL_PUTS_ERROR("Default OCPL encoding/decoding failed\n")
+ TESTING("GCPL Encoding/Decoding");
- PASSED();
+ if((H5Pset_local_heap_size_hint(gcpl, 256)) < 0)
+ FAIL_STACK_ERROR
- TESTING("OCPL Encoding/Decoding");
+ if((H5Pset_link_phase_change(gcpl, 2, 2)) < 0)
+ FAIL_STACK_ERROR
- if((H5Pset_attr_creation_order(ocpl, (H5P_CRT_ORDER_TRACKED | H5P_CRT_ORDER_INDEXED))) < 0)
- FAIL_STACK_ERROR
+ /* Query the group creation properties */
+ if((H5Pget_link_phase_change(gcpl, &max_compact, &min_dense)) < 0)
+ FAIL_STACK_ERROR
- if((H5Pset_attr_phase_change (ocpl, 110, 105)) < 0)
- FAIL_STACK_ERROR
+ if((H5Pset_est_link_info(gcpl, 3, 9)) < 0)
+ FAIL_STACK_ERROR
- if((H5Pset_filter (ocpl, H5Z_FILTER_FLETCHER32, 0, (size_t)0, NULL)) < 0)
- FAIL_STACK_ERROR
+ if((H5Pset_link_creation_order(gcpl, (H5P_CRT_ORDER_TRACKED | H5P_CRT_ORDER_INDEXED))) < 0)
+ FAIL_STACK_ERROR
- /* Test encoding & decoding property list */
- if(test_encode_decode(ocpl) < 0)
- FAIL_PUTS_ERROR("OCPL encoding/decoding failed\n")
+ /* Test encoding & decoding property list */
+ if(test_encode_decode(gcpl, low, high, FALSE) < 0)
+ FAIL_PUTS_ERROR("GCPL encoding/decoding failed\n")
- /* release resource */
- if((H5Pclose(ocpl)) < 0)
- FAIL_STACK_ERROR
+ /* release resource */
+ if((H5Pclose(gcpl)) < 0)
+ FAIL_STACK_ERROR
- PASSED();
+ PASSED();
+ /******* ENCODE/DECODE LCPLS *****/
+ TESTING("Default LCPL Encoding/Decoding");
+ if((lcpl = H5Pcreate(H5P_LINK_CREATE)) < 0)
+ FAIL_STACK_ERROR
- /******* ENCODE/DECODE DXPLS *****/
- TESTING("Default DXPL Encoding/Decoding");
- if((dxpl = H5Pcreate(H5P_DATASET_XFER)) < 0)
- FAIL_STACK_ERROR
+ /* Test encoding & decoding default property list */
+ if(test_encode_decode(lcpl, low, high, FALSE) < 0)
+ FAIL_PUTS_ERROR("Default LCPL encoding/decoding failed\n")
- /* Test encoding & decoding default property list */
- if(test_encode_decode(dxpl) < 0)
- FAIL_PUTS_ERROR("Default DXPL encoding/decoding failed\n")
+ PASSED();
- PASSED();
+ TESTING("LCPL Encoding/Decoding");
- TESTING("DXPL Encoding/Decoding");
+ if((H5Pset_create_intermediate_group(lcpl, TRUE)) < 0)
+ FAIL_STACK_ERROR
- if((H5Pset_btree_ratios(dxpl, 0.2f, 0.6f, 0.2f)) < 0)
- FAIL_STACK_ERROR
- if((H5Pset_hyper_vector_size(dxpl, 5)) < 0)
- FAIL_STACK_ERROR
-#ifdef H5_HAVE_PARALLEL
- if((H5Pset_dxpl_mpio(dxpl, H5FD_MPIO_COLLECTIVE)) < 0)
- FAIL_STACK_ERROR
- if((H5Pset_dxpl_mpio_collective_opt(dxpl, H5FD_MPIO_INDIVIDUAL_IO)) < 0)
- FAIL_STACK_ERROR
- if((H5Pset_dxpl_mpio_chunk_opt(dxpl, H5FD_MPIO_CHUNK_MULTI_IO)) < 0)
- FAIL_STACK_ERROR
- if((H5Pset_dxpl_mpio_chunk_opt_ratio(dxpl, 30)) < 0)
- FAIL_STACK_ERROR
- if((H5Pset_dxpl_mpio_chunk_opt_num(dxpl, 40)) < 0)
- FAIL_STACK_ERROR
-#endif/* H5_HAVE_PARALLEL */
- if((H5Pset_edc_check(dxpl, H5Z_DISABLE_EDC)) < 0)
- FAIL_STACK_ERROR
- if((H5Pset_data_transform(dxpl, c_to_f)) < 0)
- FAIL_STACK_ERROR
-
- /* Test encoding & decoding property list */
- if(test_encode_decode(dxpl) < 0)
- FAIL_PUTS_ERROR("DXPL encoding/decoding failed\n")
+ /* Test encoding & decoding property list */
+ if(test_encode_decode(lcpl, low, high, FALSE) < 0)
+ FAIL_PUTS_ERROR("LCPL encoding/decoding failed\n")
- /* release resource */
- if((H5Pclose(dxpl)) < 0)
- FAIL_STACK_ERROR
-
- PASSED();
+ /* release resource */
+ if((H5Pclose(lcpl)) < 0)
+ FAIL_STACK_ERROR
+ PASSED();
- /******* ENCODE/DECODE GCPLS *****/
- TESTING("Default GCPL Encoding/Decoding");
- if((gcpl = H5Pcreate(H5P_GROUP_CREATE)) < 0)
- FAIL_STACK_ERROR
- /* Test encoding & decoding default property list */
- if(test_encode_decode(gcpl) < 0)
- FAIL_PUTS_ERROR("Default GCPL encoding/decoding failed\n")
+ /******* ENCODE/DECODE LAPLS *****/
+ TESTING("Default LAPL Encoding/Decoding");
+ if((lapl = H5Pcreate(H5P_LINK_ACCESS)) < 0)
+ FAIL_STACK_ERROR
- PASSED();
+ /* Test encoding & decoding default property list */
+ if(test_encode_decode(lapl, low, high, FALSE) < 0)
+ FAIL_PUTS_ERROR("Default LAPL encoding/decoding failed\n")
- TESTING("GCPL Encoding/Decoding");
-
- if((H5Pset_local_heap_size_hint(gcpl, 256)) < 0)
- FAIL_STACK_ERROR
-
- if((H5Pset_link_phase_change(gcpl, 2, 2)) < 0)
- FAIL_STACK_ERROR
-
- /* Query the group creation properties */
- if((H5Pget_link_phase_change(gcpl, &max_compact, &min_dense)) < 0)
- FAIL_STACK_ERROR
-
- if((H5Pset_est_link_info(gcpl, 3, 9)) < 0)
- FAIL_STACK_ERROR
-
- if((H5Pset_link_creation_order(gcpl, (H5P_CRT_ORDER_TRACKED | H5P_CRT_ORDER_INDEXED))) < 0)
- FAIL_STACK_ERROR
-
- /* Test encoding & decoding property list */
- if(test_encode_decode(gcpl) < 0)
- FAIL_PUTS_ERROR("GCPL encoding/decoding failed\n")
-
- /* release resource */
- if((H5Pclose(gcpl)) < 0)
- FAIL_STACK_ERROR
+ PASSED();
- PASSED();
+ TESTING("LAPL Encoding/Decoding");
+ if((H5Pset_nlinks(lapl, (size_t)134)) < 0)
+ FAIL_STACK_ERROR
- /******* ENCODE/DECODE LCPLS *****/
- TESTING("Default LCPL Encoding/Decoding");
- if((lcpl = H5Pcreate(H5P_LINK_CREATE)) < 0)
- FAIL_STACK_ERROR
+ if((H5Pset_elink_acc_flags(lapl, H5F_ACC_RDONLY)) < 0)
+ FAIL_STACK_ERROR
- /* Test encoding & decoding default property list */
- if(test_encode_decode(lcpl) < 0)
- FAIL_PUTS_ERROR("Default LCPL encoding/decoding failed\n")
+ if((H5Pset_elink_prefix(lapl, "/tmpasodiasod")) < 0)
+ FAIL_STACK_ERROR
- PASSED();
+ /* Create FAPL for the elink FAPL */
+ if((fapl = H5Pcreate(H5P_FILE_ACCESS)) < 0)
+ FAIL_STACK_ERROR
+ if((H5Pset_alignment(fapl, 2, 1024)) < 0)
+ FAIL_STACK_ERROR
- TESTING("LCPL Encoding/Decoding");
+ if((H5Pset_elink_fapl(lapl, fapl)) < 0)
+ FAIL_STACK_ERROR
- if((H5Pset_create_intermediate_group(lcpl, TRUE)) < 0)
- FAIL_STACK_ERROR
+ /* Close the elink's FAPL */
+ if((H5Pclose(fapl)) < 0)
+ FAIL_STACK_ERROR
- /* Test encoding & decoding property list */
- if(test_encode_decode(lcpl) < 0)
- FAIL_PUTS_ERROR("LCPL encoding/decoding failed\n")
+ /* Test encoding & decoding property list */
+ if(test_encode_decode(lapl, low, high, FALSE) < 0)
+ FAIL_PUTS_ERROR("LAPL encoding/decoding failed\n")
- /* release resource */
- if((H5Pclose(lcpl)) < 0)
- FAIL_STACK_ERROR
+ /* release resource */
+ if((H5Pclose(lapl)) < 0)
+ FAIL_STACK_ERROR
- PASSED();
+ PASSED();
- /******* ENCODE/DECODE LAPLS *****/
- TESTING("Default LAPL Encoding/Decoding");
- if((lapl = H5Pcreate(H5P_LINK_ACCESS)) < 0)
- FAIL_STACK_ERROR
+ /******* ENCODE/DECODE OCPYPLS *****/
+ TESTING("Default OCPYPL Encoding/Decoding");
+ if((ocpypl = H5Pcreate(H5P_OBJECT_COPY)) < 0)
+ FAIL_STACK_ERROR
- /* Test encoding & decoding default property list */
- if(test_encode_decode(lapl) < 0)
- FAIL_PUTS_ERROR("Default LAPL encoding/decoding failed\n")
+ /* Test encoding & decoding default property list */
+ if(test_encode_decode(ocpypl, low, high, FALSE) < 0)
+ FAIL_PUTS_ERROR("Default OCPYPL encoding/decoding failed\n")
- PASSED();
+ PASSED();
- TESTING("LAPL Encoding/Decoding");
+ TESTING("OCPYPL Encoding/Decoding");
- if((H5Pset_nlinks(lapl, (size_t)134)) < 0)
- FAIL_STACK_ERROR
+ if((H5Pset_copy_object(ocpypl, H5O_COPY_EXPAND_EXT_LINK_FLAG)) < 0)
+ FAIL_STACK_ERROR
- if((H5Pset_elink_acc_flags(lapl, H5F_ACC_RDONLY)) < 0)
- FAIL_STACK_ERROR
+ if((H5Padd_merge_committed_dtype_path(ocpypl, "foo")) < 0)
+ FAIL_STACK_ERROR
+ if((H5Padd_merge_committed_dtype_path(ocpypl, "bar")) < 0)
+ FAIL_STACK_ERROR
- if((H5Pset_elink_prefix(lapl, "/tmpasodiasod")) < 0)
- FAIL_STACK_ERROR
-
- /* Create FAPL for the elink FAPL */
- if((fapl = H5Pcreate(H5P_FILE_ACCESS)) < 0)
- FAIL_STACK_ERROR
- if((H5Pset_alignment(fapl, 2, 1024)) < 0)
- FAIL_STACK_ERROR
-
- if((H5Pset_elink_fapl(lapl, fapl)) < 0)
- FAIL_STACK_ERROR
-
- /* Close the elink's FAPL */
- if((H5Pclose(fapl)) < 0)
- FAIL_STACK_ERROR
-
- /* Test encoding & decoding property list */
- if(test_encode_decode(lapl) < 0)
- FAIL_PUTS_ERROR("LAPL encoding/decoding failed\n")
+ /* Test encoding & decoding property list */
+ if(test_encode_decode(ocpypl, low, high, FALSE) < 0)
+ FAIL_PUTS_ERROR("OCPYPL encoding/decoding failed\n")
- /* release resource */
- if((H5Pclose(lapl)) < 0)
- FAIL_STACK_ERROR
-
- PASSED();
+ /* release resource */
+ if((H5Pclose(ocpypl)) < 0)
+ FAIL_STACK_ERROR
+ PASSED();
- /******* ENCODE/DECODE OCPYPLS *****/
- TESTING("Default OCPYPL Encoding/Decoding");
- if((ocpypl = H5Pcreate(H5P_OBJECT_COPY)) < 0)
- FAIL_STACK_ERROR
+ /******* ENCODE/DECODE FAPLS *****/
+ TESTING("Default FAPL Encoding/Decoding");
+ if((fapl = H5Pcreate(H5P_FILE_ACCESS)) < 0)
+ FAIL_STACK_ERROR
- /* Test encoding & decoding default property list */
- if(test_encode_decode(ocpypl) < 0)
- FAIL_PUTS_ERROR("Default OCPYPL encoding/decoding failed\n")
+ /* Test encoding & decoding default property list */
+ if(test_encode_decode(fapl, low, high, FALSE) < 0)
+ FAIL_PUTS_ERROR("Default FAPL encoding/decoding failed\n")
- PASSED();
+ PASSED();
- TESTING("OCPYPL Encoding/Decoding");
+ TESTING("FAPL Encoding/Decoding");
- if((H5Pset_copy_object(ocpypl, H5O_COPY_EXPAND_EXT_LINK_FLAG)) < 0)
- FAIL_STACK_ERROR
+ if((H5Pset_family_offset(fapl, 1024)) < 0)
+ FAIL_STACK_ERROR
+ if((H5Pset_meta_block_size(fapl, 2098452)) < 0)
+ FAIL_STACK_ERROR
+ if((H5Pset_sieve_buf_size(fapl, 1048576)) < 0)
+ FAIL_STACK_ERROR
+ if((H5Pset_alignment(fapl, 2, 1024)) < 0)
+ FAIL_STACK_ERROR
+ if((H5Pset_cache(fapl, 1024, 128, 10485760, 0.3f)) < 0)
+ FAIL_STACK_ERROR
+ if((H5Pset_elink_file_cache_size(fapl, 10485760)) < 0)
+ FAIL_STACK_ERROR
+ if((H5Pset_gc_references(fapl, 1)) < 0)
+ FAIL_STACK_ERROR
+ if((H5Pset_small_data_block_size(fapl, 2048)) < 0)
+ FAIL_STACK_ERROR
+ if((H5Pset_libver_bounds(fapl, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST)) < 0)
+ FAIL_STACK_ERROR
+ if((H5Pset_fclose_degree(fapl, H5F_CLOSE_WEAK)) < 0)
+ FAIL_STACK_ERROR
+ if((H5Pset_multi_type(fapl, H5FD_MEM_GHEAP)) < 0)
+ FAIL_STACK_ERROR
+ if((H5Pset_mdc_config(fapl, &my_cache_config)) < 0)
+ FAIL_STACK_ERROR
+ if((H5Pset_mdc_image_config(fapl, &my_cache_image_config)) < 0)
+ FAIL_STACK_ERROR
- if((H5Padd_merge_committed_dtype_path(ocpypl, "foo")) < 0)
- FAIL_STACK_ERROR
- if((H5Padd_merge_committed_dtype_path(ocpypl, "bar")) < 0)
- FAIL_STACK_ERROR
+ /* Test encoding & decoding property list */
+ if(test_encode_decode(fapl, low, high, FALSE) < 0)
+ FAIL_PUTS_ERROR("FAPL encoding/decoding failed\n")
- /* Test encoding & decoding property list */
- if(test_encode_decode(ocpypl) < 0)
- FAIL_PUTS_ERROR("OCPYPL encoding/decoding failed\n")
-
- /* release resource */
- if((H5Pclose(ocpypl)) < 0)
- FAIL_STACK_ERROR
-
- PASSED();
-
-
- /******* ENCODE/DECODE FAPLS *****/
- TESTING("Default FAPL Encoding/Decoding");
- if((fapl = H5Pcreate(H5P_FILE_ACCESS)) < 0)
- FAIL_STACK_ERROR
-
- /* Test encoding & decoding default property list */
- if(test_encode_decode(fapl) < 0)
- FAIL_PUTS_ERROR("Default FAPL encoding/decoding failed\n")
-
- PASSED();
-
- TESTING("FAPL Encoding/Decoding");
-
- if((H5Pset_family_offset(fapl, 1024)) < 0)
- FAIL_STACK_ERROR
- if((H5Pset_meta_block_size(fapl, 2098452)) < 0)
- FAIL_STACK_ERROR
- if((H5Pset_sieve_buf_size(fapl, 1048576)) < 0)
- FAIL_STACK_ERROR
- if((H5Pset_alignment(fapl, 2, 1024)) < 0)
- FAIL_STACK_ERROR
- if((H5Pset_cache(fapl, 1024, 128, 10485760, 0.3f)) < 0)
- FAIL_STACK_ERROR
- if((H5Pset_elink_file_cache_size(fapl, 10485760)) < 0)
- FAIL_STACK_ERROR
- if((H5Pset_gc_references(fapl, 1)) < 0)
- FAIL_STACK_ERROR
- if((H5Pset_small_data_block_size(fapl, 2048)) < 0)
- FAIL_STACK_ERROR
- if((H5Pset_libver_bounds(fapl, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST)) < 0)
- FAIL_STACK_ERROR
- if((H5Pset_fclose_degree(fapl, H5F_CLOSE_WEAK)) < 0)
- FAIL_STACK_ERROR
- if((H5Pset_multi_type(fapl, H5FD_MEM_GHEAP)) < 0)
- FAIL_STACK_ERROR
- if((H5Pset_mdc_config(fapl, &my_cache_config)) < 0)
- FAIL_STACK_ERROR
- if((H5Pset_mdc_image_config(fapl, &my_cache_image_config)) < 0)
- FAIL_STACK_ERROR
-
- /* Test encoding & decoding property list */
- if(test_encode_decode(fapl) < 0)
- FAIL_PUTS_ERROR("FAPL encoding/decoding failed\n")
-
- /* release resource */
- if((H5Pclose(fapl)) < 0)
- FAIL_STACK_ERROR
+ /* release resource */
+ if((H5Pclose(fapl)) < 0)
+ FAIL_STACK_ERROR
- PASSED();
+ PASSED();
- /******* ENCODE/DECODE FCPLS *****/
- TESTING("Default FCPL Encoding/Decoding");
+ /******* ENCODE/DECODE FCPLS *****/
+ TESTING("Default FCPL Encoding/Decoding");
- if((fcpl = H5Pcreate(H5P_FILE_CREATE)) < 0)
- FAIL_STACK_ERROR
+ if((fcpl = H5Pcreate(H5P_FILE_CREATE)) < 0)
+ FAIL_STACK_ERROR
- /* Test encoding & decoding default property list */
- if(test_encode_decode(fcpl) < 0)
- FAIL_PUTS_ERROR("Default FCPL encoding/decoding failed\n")
+ /* Test encoding & decoding default property list */
+ if(test_encode_decode(fcpl, low, high, FALSE) < 0)
+ FAIL_PUTS_ERROR("Default FCPL encoding/decoding failed\n")
- PASSED();
+ PASSED();
- TESTING("FCPL Encoding/Decoding");
+ TESTING("FCPL Encoding/Decoding");
- if((H5Pset_userblock(fcpl, 1024) < 0))
- FAIL_STACK_ERROR
+ if((H5Pset_userblock(fcpl, 1024) < 0))
+ FAIL_STACK_ERROR
- if((H5Pset_istore_k(fcpl, 3) < 0))
- FAIL_STACK_ERROR
+ if((H5Pset_istore_k(fcpl, 3) < 0))
+ FAIL_STACK_ERROR
- if((H5Pset_sym_k(fcpl, 4, 5) < 0))
- FAIL_STACK_ERROR
+ if((H5Pset_sym_k(fcpl, 4, 5) < 0))
+ FAIL_STACK_ERROR
- if((H5Pset_shared_mesg_nindexes(fcpl, 8) < 0))
- FAIL_STACK_ERROR
+ if((H5Pset_shared_mesg_nindexes(fcpl, 8) < 0))
+ FAIL_STACK_ERROR
- if((H5Pset_shared_mesg_index(fcpl, 1, H5O_SHMESG_SDSPACE_FLAG, 32) < 0))
- FAIL_STACK_ERROR
+ if((H5Pset_shared_mesg_index(fcpl, 1, H5O_SHMESG_SDSPACE_FLAG, 32) < 0))
+ FAIL_STACK_ERROR
- if((H5Pset_shared_mesg_phase_change(fcpl, 60, 20) < 0))
- FAIL_STACK_ERROR
+ if((H5Pset_shared_mesg_phase_change(fcpl, 60, 20) < 0))
+ FAIL_STACK_ERROR
- if((H5Pset_sizes(fcpl, 8, 4) < 0))
- FAIL_STACK_ERROR
+ if((H5Pset_sizes(fcpl, 8, 4) < 0))
+ FAIL_STACK_ERROR
- /* Test encoding & decoding property list */
- if(test_encode_decode(fcpl) < 0)
- FAIL_PUTS_ERROR("FCPL encoding/decoding failed\n")
+ /* Test encoding & decoding property list */
+ if(test_encode_decode(fcpl, low, high, FALSE) < 0)
+ FAIL_PUTS_ERROR("FCPL encoding/decoding failed\n")
- /* release resource */
- if((H5Pclose(fcpl)) < 0)
- FAIL_STACK_ERROR
+ /* release resource */
+ if((H5Pclose(fcpl)) < 0)
+ FAIL_STACK_ERROR
- PASSED();
+ PASSED();
- /******* ENCODE/DECODE STRCPLS *****/
- TESTING("Default STRCPL Encoding/Decoding");
+ /******* ENCODE/DECODE STRCPLS *****/
+ TESTING("Default STRCPL Encoding/Decoding");
- if((strcpl = H5Pcreate(H5P_STRING_CREATE)) < 0)
- FAIL_STACK_ERROR
+ if((strcpl = H5Pcreate(H5P_STRING_CREATE)) < 0)
+ FAIL_STACK_ERROR
- /* Test encoding & decoding default property list */
- if(test_encode_decode(strcpl) < 0)
- FAIL_PUTS_ERROR("Default STRCPL encoding/decoding failed\n")
+ /* Test encoding & decoding default property list */
+ if(test_encode_decode(strcpl, low, high, FALSE) < 0)
+ FAIL_PUTS_ERROR("Default STRCPL encoding/decoding failed\n")
- PASSED();
+ PASSED();
- TESTING("STRCPL Encoding/Decoding");
+ TESTING("STRCPL Encoding/Decoding");
- if((H5Pset_char_encoding(strcpl, H5T_CSET_UTF8) < 0))
- FAIL_STACK_ERROR
+ if((H5Pset_char_encoding(strcpl, H5T_CSET_UTF8) < 0))
+ FAIL_STACK_ERROR
- /* Test encoding & decoding property list */
- if(test_encode_decode(strcpl) < 0)
- FAIL_PUTS_ERROR("STRCPL encoding/decoding failed\n")
+ /* Test encoding & decoding property list */
+ if(test_encode_decode(strcpl, low, high, FALSE) < 0)
+ FAIL_PUTS_ERROR("STRCPL encoding/decoding failed\n")
- /* release resource */
- if((H5Pclose(strcpl)) < 0)
- FAIL_STACK_ERROR
+ /* release resource */
+ if((H5Pclose(strcpl)) < 0)
+ FAIL_STACK_ERROR
- PASSED();
+ PASSED();
- /******* ENCODE/DECODE ACPLS *****/
- TESTING("Default ACPL Encoding/Decoding");
+ /******* ENCODE/DECODE ACPLS *****/
+ TESTING("Default ACPL Encoding/Decoding");
- if((acpl = H5Pcreate(H5P_ATTRIBUTE_CREATE)) < 0)
- FAIL_STACK_ERROR
+ if((acpl = H5Pcreate(H5P_ATTRIBUTE_CREATE)) < 0)
+ FAIL_STACK_ERROR
- /* Test encoding & decoding default property list */
- if(test_encode_decode(acpl) < 0)
- FAIL_PUTS_ERROR("Default ACPL encoding/decoding failed\n")
+ /* Test encoding & decoding default property list */
+ if(test_encode_decode(acpl, low, high, FALSE) < 0)
+ FAIL_PUTS_ERROR("Default ACPL encoding/decoding failed\n")
- PASSED();
+ PASSED();
- TESTING("ACPL Encoding/Decoding");
+ TESTING("ACPL Encoding/Decoding");
- if((H5Pset_char_encoding(acpl, H5T_CSET_UTF8) < 0))
- FAIL_STACK_ERROR
+ if((H5Pset_char_encoding(acpl, H5T_CSET_UTF8) < 0))
+ FAIL_STACK_ERROR
- /* Test encoding & decoding property list */
- if(test_encode_decode(acpl) < 0)
- FAIL_PUTS_ERROR("ACPL encoding/decoding failed\n")
+ /* Test encoding & decoding property list */
+ if(test_encode_decode(acpl, low, high, FALSE) < 0)
+ FAIL_PUTS_ERROR("ACPL encoding/decoding failed\n")
- /* release resource */
- if((H5Pclose(acpl)) < 0)
- FAIL_STACK_ERROR
+ /* release resource */
+ if((H5Pclose(acpl)) < 0)
+ FAIL_STACK_ERROR
- PASSED();
+ PASSED();
+ } /* end high */
+ } /* end low */
return 0;
diff --git a/test/evict_on_close.c b/test/evict_on_close.c
index 9918829..b7d30a9 100644
--- a/test/evict_on_close.c
+++ b/test/evict_on_close.c
@@ -73,7 +73,7 @@ const char *FILENAMES[] = {
#define SUBGROUP_NAME_SIZE 16
/* Prototypes */
-static hbool_t verify_tag_not_in_cache(H5F_t *f, haddr_t tag);
+static hbool_t verify_tag_not_in_cache(const H5F_t *f, haddr_t tag);
static herr_t check_evict_on_close_api(void);
static hid_t generate_eoc_test_file(hid_t fapl_id);
static herr_t check_dset_scheme(hid_t fid, const char *dset_name);
@@ -90,8 +90,8 @@ static herr_t check_group_layout(hid_t fid, const char *group_name);
*
*-------------------------------------------------------------------------
*/
-static hbool_t
-verify_tag_not_in_cache(H5F_t *f, haddr_t tag)
+static H5_ATTR_PURE hbool_t
+verify_tag_not_in_cache(const H5F_t *f, haddr_t tag)
{
H5C_t *cache_ptr = NULL; /* cache pointer */
int i = 0; /* iterator */
diff --git a/test/external.c b/test/external.c
index 20a9ed8..6aa9d1b 100644
--- a/test/external.c
+++ b/test/external.c
@@ -17,25 +17,7 @@
*
* Purpose: Tests datasets stored in external raw files.
*/
-#include "h5test.h"
-
-const char *FILENAME[] = {
- "extern_1",
- "extern_2",
- "extern_3",
- "extern_4",
- "extern_dir/file_1",
- "extern_5",
- NULL
-};
-
-/* A similar collection of files is used for the tests that
- * perform file I/O.
- */
-#define N_EXT_FILES 4
-#define PART_SIZE 25
-#define TOTAL_SIZE 100
-#define GARBAGE_PER_FILE 10
+#include "external_common.h"
/*-------------------------------------------------------------------------
@@ -99,106 +81,6 @@ out:
/*-------------------------------------------------------------------------
- * Function: reset_raw_data_files
- *
- * Purpose: Resets the data in the raw data files for tests that
- * perform dataset I/O on a set of files.
- *
- * Return: SUCCEED/FAIL
- *
- * Programmer: Dana Robinson
- * February 2016
- *
- *-------------------------------------------------------------------------
- */
-static herr_t
-reset_raw_data_files(void)
-{
- int fd = 0; /* external file descriptor */
- size_t i, j; /* iterators */
- hssize_t n; /* bytes of I/O */
- char filename[1024]; /* file name */
- int data[PART_SIZE]; /* raw data buffer */
- uint8_t *garbage = NULL; /* buffer of garbage data */
- size_t garbage_count; /* size of garbage buffer */
- size_t garbage_bytes; /* # of garbage bytes written to file */
-
- /* Set up garbage buffer */
- garbage_count = N_EXT_FILES * GARBAGE_PER_FILE;
- if(NULL == (garbage = (uint8_t *)HDcalloc(garbage_count, sizeof(uint8_t))))
- goto error;
- for(i = 0; i < garbage_count; i++)
- garbage[i] = 0xFF;
-
- /* The *r files are pre-filled with data and are used to
- * verify that read operations work correctly.
- */
- for(i = 0; i < N_EXT_FILES; i++) {
-
- /* Open file */
- HDsprintf(filename, "extern_%lur.raw", (unsigned long)i + 1);
- if((fd = HDopen(filename, O_RDWR|O_CREAT|O_TRUNC, H5_POSIX_CREATE_MODE_RW)) < 0)
- goto error;
-
- /* Write garbage data to the file. This allows us to test the
- * the ability to set an offset in the raw data file.
- */
- garbage_bytes = i * 10;
- n = HDwrite(fd, garbage, garbage_bytes);
- if(n < 0 || (size_t)n != garbage_bytes)
- goto error;
-
- /* Fill array with data */
- for(j = 0; j < PART_SIZE; j++) {
- data[j] = (int)(i * 25 + j);
- } /* end for */
-
- /* Write raw data to the file. */
- n = HDwrite(fd, data, sizeof(data));
- if(n != sizeof(data))
- goto error;
-
- /* Close this file */
- HDclose(fd);
-
- } /* end for */
-
- /* The *w files are only pre-filled with the garbage data and are
- * used to verify that write operations work correctly. The individual
- * tests fill in the actual data.
- */
- for(i = 0; i < N_EXT_FILES; i++) {
-
- /* Open file */
- HDsprintf(filename, "extern_%luw.raw", (unsigned long)i + 1);
- if((fd = HDopen(filename, O_RDWR|O_CREAT|O_TRUNC, H5_POSIX_CREATE_MODE_RW)) < 0)
- goto error;
-
- /* Write garbage data to the file. This allows us to test the
- * the ability to set an offset in the raw data file.
- */
- garbage_bytes = i * 10;
- n = HDwrite(fd, garbage, garbage_bytes);
- if(n < 0 || (size_t)n != garbage_bytes)
- goto error;
-
- /* Close this file */
- HDclose(fd);
-
- } /* end for */
- HDfree(garbage);
- return SUCCEED;
-
-error:
- if(fd)
- HDclose(fd);
- if(garbage)
- HDfree(garbage);
- return FAIL;
-} /* end reset_raw_data_files() */
-
-
-/*-------------------------------------------------------------------------
* Function: test_non_extendible
*
* Purpose: Tests a non-extendible dataset with a single external file.
@@ -753,14 +635,14 @@ test_read_file_set(hid_t fapl)
TEST_ERROR
/* Reset the raw data files */
- if(reset_raw_data_files() < 0)
+ if(reset_raw_data_files(0) < 0)
TEST_ERROR
/* Create the file and an initial group. This causes messages about
* debugging to be emitted before we start playing games with what the
* output looks like.
*/
- h5_fixname(FILENAME[1], fapl, filename, sizeof(filename));
+ h5_fixname(EXT_FNAME[1], fapl, filename, sizeof(filename));
if((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
FAIL_STACK_ERROR
if((grp = H5Gcreate2(file, "emit-diagnostics", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
@@ -871,7 +753,7 @@ test_write_file_set(hid_t fapl)
TEST_ERROR
/* Create another file */
- h5_fixname(FILENAME[2], fapl, filename, sizeof(filename));
+ h5_fixname(EXT_FNAME[2], fapl, filename, sizeof(filename));
if((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
FAIL_STACK_ERROR
@@ -893,7 +775,7 @@ test_write_file_set(hid_t fapl)
} /* end for */
/* Reset the raw data files */
- if(reset_raw_data_files() < 0)
+ if(reset_raw_data_files(0) < 0)
TEST_ERROR
/* Create the dataset */
@@ -989,12 +871,12 @@ test_path_absolute(hid_t fapl)
TESTING("absolute filenames for external file");
- h5_fixname(FILENAME[3], fapl, filename, sizeof(filename));
+ h5_fixname(EXT_FNAME[3], fapl, filename, sizeof(filename));
if((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
FAIL_STACK_ERROR
/* Reset the raw data files */
- if(reset_raw_data_files() < 0)
+ if(reset_raw_data_files(0) < 0)
TEST_ERROR
/* Create the dcpl */
@@ -1085,12 +967,12 @@ test_path_relative(hid_t fapl)
if (HDmkdir("extern_dir", (mode_t)0755) < 0 && errno != EEXIST)
TEST_ERROR;
- h5_fixname(FILENAME[4], fapl, filename, sizeof(filename));
+ h5_fixname(EXT_FNAME[4], fapl, filename, sizeof(filename));
if((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
FAIL_STACK_ERROR;
/* Reset the raw data files */
- if(reset_raw_data_files() < 0)
+ if(reset_raw_data_files(0) < 0)
TEST_ERROR
/* Create the dataset */
@@ -1180,12 +1062,12 @@ test_path_relative_cwd(hid_t fapl)
if(HDmkdir("extern_dir", (mode_t)0755) < 0 && errno != EEXIST)
TEST_ERROR;
- h5_fixname(FILENAME[4], fapl, filename, sizeof(filename));
+ h5_fixname(EXT_FNAME[4], fapl, filename, sizeof(filename));
if((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
FAIL_STACK_ERROR;
/* Reset the raw data files */
- if(reset_raw_data_files() < 0)
+ if(reset_raw_data_files(0) < 0)
TEST_ERROR
/* Create the dataset */
@@ -1297,116 +1179,6 @@ error:
/*-------------------------------------------------------------------------
- * Function: test_path_env
- *
- * Purpose: Test whether the value of HDF5_EXTFILE_PREFIX will overwrite
- * the efile_prefix dataset access property.
- * This will create an HDF5 file in a subdirectory which will
- * refer to ../extern_*a.raw
- * The files are then accessed by setting the HDF5_EXTFILE_PREFIX
- * environment variable to "${ORIGIN}".
- * The efile_prefix dataset access property is set to "someprefix",
- * which will cause an error if the value is not overwritten by
- * the environment variable.
- *
- * Return: Success: 0
- * Failure: 1
- *
- * Programmer: Steffen Kiess
- * March 10, 2015
- *
- *-------------------------------------------------------------------------
- */
-static int
-test_path_env(hid_t fapl)
-{
- hid_t file = -1; /* file to write to */
- hid_t dcpl = -1; /* dataset creation properties */
- hid_t space = -1; /* data space */
- hid_t dapl = -1; /* dataset access property list */
- hid_t dset = -1; /* dataset */
- size_t i; /* miscellaneous counters */
- char cwdpath[1024]; /* working directory */
- char filename[1024]; /* file name */
- int part[PART_SIZE]; /* raw data buffer (partial) */
- int whole[TOTAL_SIZE]; /* raw data buffer (total) */
- hsize_t cur_size; /* current data space size */
- char buffer[1024]; /* buffer to read efile_prefix */
-
- TESTING("prefix in HDF5_EXTFILE_PREFIX");
-
- if(HDsetenv("HDF5_EXTFILE_PREFIX", "${ORIGIN}", 1))
- TEST_ERROR
-
- if(HDmkdir("extern_dir", (mode_t)0755) < 0 && errno != EEXIST)
- TEST_ERROR;
-
- h5_fixname(FILENAME[4], fapl, filename, sizeof(filename));
- if((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
- FAIL_STACK_ERROR
-
- /* Reset the raw data files */
- if(reset_raw_data_files() < 0)
- TEST_ERROR
-
- /* Create the dataset */
- if((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0)
- FAIL_STACK_ERROR
- if(NULL == HDgetcwd(cwdpath, sizeof(cwdpath)))
- TEST_ERROR
- for(i = 0; i < N_EXT_FILES; i++) {
- HDsnprintf(filename, sizeof(filename), "..%sextern_%dr.raw", H5_DIR_SEPS, (int) i + 1);
- if(H5Pset_external(dcpl, filename, (off_t)(i * GARBAGE_PER_FILE), (hsize_t)sizeof(part)) < 0)
- FAIL_STACK_ERROR
- } /* end for */
-
- cur_size = TOTAL_SIZE;
- if((space = H5Screate_simple(1, &cur_size, NULL)) < 0)
- FAIL_STACK_ERROR
- if((dapl = H5Pcreate(H5P_DATASET_ACCESS)) < 0)
- FAIL_STACK_ERROR
-
- /* Set prefix to a nonexistent directory, will be overwritten by environment variable */
- if(H5Pset_efile_prefix(dapl, "someprefix") < 0)
- FAIL_STACK_ERROR
- if(H5Pget_efile_prefix(dapl, buffer, sizeof(buffer)) < 0)
- FAIL_STACK_ERROR
- if(HDstrcmp(buffer, "someprefix") != 0)
- FAIL_PUTS_ERROR("efile prefix not set correctly");
-
- /* Create dataset */
- if((dset = H5Dcreate2(file, "dset1", H5T_NATIVE_INT, space, H5P_DEFAULT, dcpl, dapl)) < 0)
- FAIL_STACK_ERROR
-
- /* Read the entire dataset and compare with the original */
- HDmemset(whole, 0, sizeof(whole));
- if(H5Dread(dset, H5T_NATIVE_INT, space, space, H5P_DEFAULT, whole) < 0)
- FAIL_STACK_ERROR
- for(i = 0; i < TOTAL_SIZE; i++)
- if(whole[i] != (signed)i)
- FAIL_PUTS_ERROR("Incorrect value(s) read.");
-
- if(H5Dclose(dset) < 0) FAIL_STACK_ERROR
- if(H5Pclose(dapl) < 0) FAIL_STACK_ERROR
- if(H5Pclose(dcpl) < 0) FAIL_STACK_ERROR
- if(H5Sclose(space) < 0) FAIL_STACK_ERROR
- if(H5Fclose(file) < 0) FAIL_STACK_ERROR
- PASSED();
- return 0;
-
-error:
- H5E_BEGIN_TRY {
- H5Pclose(dapl);
- H5Dclose(dset);
- H5Pclose(dcpl);
- H5Sclose(space);
- H5Fclose(file);
- } H5E_END_TRY;
- return 1;
-} /* end test_path_env() */
-
-
-/*-------------------------------------------------------------------------
* Function: test_h5d_get_access_plist
*
* Purpose: Ensure that H5Dget_access_plist returns correct values.
@@ -1437,11 +1209,11 @@ test_h5d_get_access_plist(hid_t fapl_id)
TEST_ERROR
/* Reset the raw data files */
- if(reset_raw_data_files() < 0)
+ if(reset_raw_data_files(0) < 0)
TEST_ERROR
/* Create the file */
- h5_fixname(FILENAME[5], fapl_id, filename, sizeof(filename));
+ h5_fixname(EXT_FNAME[5], fapl_id, filename, sizeof(filename));
if((fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl_id)) < 0)
FAIL_STACK_ERROR
@@ -1532,7 +1304,7 @@ main(void)
/* Get a fapl for the old (default) file format */
fapl_id_old = h5_fileaccess();
- h5_fixname(FILENAME[0], fapl_id_old, filename, sizeof(filename));
+ h5_fixname(EXT_FNAME[0], fapl_id_old, filename, sizeof(filename));
/* Copy and set up a fapl for the latest file format */
if((fapl_id_new = H5Pcopy(fapl_id_old)) < 0)
@@ -1585,10 +1357,9 @@ main(void)
nerrors += test_path_absolute(current_fapl_id);
nerrors += test_path_relative(current_fapl_id);
nerrors += test_path_relative_cwd(current_fapl_id);
- nerrors += test_path_env(current_fapl_id);
/* Verify symbol table messages are cached */
- nerrors += (h5_verify_cached_stabs(FILENAME, current_fapl_id) < 0 ? 1 : 0);
+ nerrors += (h5_verify_cached_stabs(EXT_FNAME, current_fapl_id) < 0 ? 1 : 0);
/* Close the common file */
if(H5Fclose(fid) < 0) FAIL_STACK_ERROR
@@ -1603,7 +1374,7 @@ main(void)
HDputs("All external storage tests passed.");
/* Clean up files used by file set tests */
- if(h5_cleanup(FILENAME, fapl_id_old)) {
+ if(h5_cleanup(EXT_FNAME, fapl_id_old)) {
HDremove("extern_1r.raw");
HDremove("extern_2r.raw");
HDremove("extern_3r.raw");
@@ -1630,4 +1401,3 @@ error:
printf("%d TEST%s FAILED.\n", nerrors, 1 == nerrors ? "" : "s");
return EXIT_FAILURE;
} /* end main() */
-
diff --git a/test/external_common.c b/test/external_common.c
new file mode 100644
index 0000000..c3aa455
--- /dev/null
+++ b/test/external_common.c
@@ -0,0 +1,127 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * 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. *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+/*
+ * Programmer: Raymond Lu <songyulu@hdfgroup.org>
+ * April, 2019
+ *
+ * Purpose: Private function for external.c and external_env.c
+ */
+
+#include "external_common.h"
+
+
+/*-------------------------------------------------------------------------
+ * Function: reset_raw_data_files
+ *
+ * Purpose: Resets the data in the raw data files for tests that
+ * perform dataset I/O on a set of files.
+ *
+ * Return: SUCCEED/FAIL
+ *
+ * Programmer: Dana Robinson
+ * February 2016
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+reset_raw_data_files(int is_env)
+{
+ int fd = 0; /* external file descriptor */
+ size_t i, j; /* iterators */
+ hssize_t n; /* bytes of I/O */
+ char filename[1024]; /* file name */
+ int data[PART_SIZE]; /* raw data buffer */
+ uint8_t *garbage = NULL; /* buffer of garbage data */
+ size_t garbage_count; /* size of garbage buffer */
+ size_t garbage_bytes; /* # of garbage bytes written to file */
+
+ /* Set up garbage buffer */
+ garbage_count = N_EXT_FILES * GARBAGE_PER_FILE;
+ if(NULL == (garbage = (uint8_t *)HDcalloc(garbage_count, sizeof(uint8_t))))
+ goto error;
+ for(i = 0; i < garbage_count; i++)
+ garbage[i] = 0xFF;
+
+ /* The *r files are pre-filled with data and are used to
+ * verify that read operations work correctly.
+ */
+ for(i = 0; i < N_EXT_FILES; i++) {
+
+ /* Open file */
+ if(is_env)
+ HDsprintf(filename, "extern_env_%lur.raw", (unsigned long)i + 1);
+ else
+ HDsprintf(filename, "extern_%lur.raw", (unsigned long)i + 1);
+ if((fd = HDopen(filename, O_RDWR|O_CREAT|O_TRUNC, H5_POSIX_CREATE_MODE_RW)) < 0)
+ goto error;
+
+ /* Write garbage data to the file. This allows us to test the
+ * the ability to set an offset in the raw data file.
+ */
+ garbage_bytes = i * 10;
+ n = HDwrite(fd, garbage, garbage_bytes);
+ if(n < 0 || (size_t)n != garbage_bytes)
+ goto error;
+
+ /* Fill array with data */
+ for(j = 0; j < PART_SIZE; j++) {
+ data[j] = (int)(i * 25 + j);
+ } /* end for */
+
+ /* Write raw data to the file. */
+ n = HDwrite(fd, data, sizeof(data));
+ if(n != sizeof(data))
+ goto error;
+
+ /* Close this file */
+ HDclose(fd);
+
+ } /* end for */
+
+ /* The *w files are only pre-filled with the garbage data and are
+ * used to verify that write operations work correctly. The individual
+ * tests fill in the actual data.
+ */
+ for(i = 0; i < N_EXT_FILES; i++) {
+
+ /* Open file */
+ if(is_env)
+ HDsprintf(filename, "extern_env_%luw.raw", (unsigned long)i + 1);
+ else
+ HDsprintf(filename, "extern_%luw.raw", (unsigned long)i + 1);
+ if((fd = HDopen(filename, O_RDWR|O_CREAT|O_TRUNC, H5_POSIX_CREATE_MODE_RW)) < 0)
+ goto error;
+
+ /* Write garbage data to the file. This allows us to test the
+ * the ability to set an offset in the raw data file.
+ */
+ garbage_bytes = i * 10;
+ n = HDwrite(fd, garbage, garbage_bytes);
+ if(n < 0 || (size_t)n != garbage_bytes)
+ goto error;
+
+ /* Close this file */
+ HDclose(fd);
+
+ } /* end for */
+ HDfree(garbage);
+ return SUCCEED;
+
+error:
+ if(fd)
+ HDclose(fd);
+ if(garbage)
+ HDfree(garbage);
+ return FAIL;
+}
diff --git a/test/external_common.h b/test/external_common.h
new file mode 100644
index 0000000..1e4fe7a
--- /dev/null
+++ b/test/external_common.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. *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+/*
+ * Programmer: Raymond Lu <songyulu@hdfgroup.org>
+ * April, 2019
+ *
+ * Purpose: Private function for external.c and external_env.c
+ */
+#ifndef _EXTERNAL_COMMON_H
+#define _EXTERNAL_COMMON_H
+
+/* Include test header files */
+#include "h5test.h"
+
+static const char *EXT_FNAME[] = {
+ "extern_1",
+ "extern_2",
+ "extern_3",
+ "extern_4",
+ "extern_dir/file_1",
+ "extern_5",
+ NULL
+};
+
+/* A similar collection of files is used for the tests that
+ * perform file I/O.
+ */
+#define N_EXT_FILES 4
+#define PART_SIZE 25
+#define TOTAL_SIZE 100
+#define GARBAGE_PER_FILE 10
+
+H5TEST_DLL herr_t reset_raw_data_files(int);
+#endif /* _EXTERNAL_COMMON_H */
diff --git a/test/external_env.c b/test/external_env.c
new file mode 100644
index 0000000..1bf0cf0
--- /dev/null
+++ b/test/external_env.c
@@ -0,0 +1,218 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * 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: Tests datasets stored in external raw files.
+ */
+#include "external_common.h"
+
+static const char *EXT_ENV_FNAME[] = {
+ "extern_env_dir/env_file_1",
+ NULL
+};
+
+
+/*-------------------------------------------------------------------------
+ * Function: test_path_env
+ *
+ * Purpose: Test whether the value of HDF5_EXTFILE_PREFIX will overwrite
+ * the efile_prefix dataset access property.
+ * This will create an HDF5 file in a subdirectory which will
+ * refer to ../extern_*a.raw
+ * The files are then accessed by setting the HDF5_EXTFILE_PREFIX
+ * environment variable to "${ORIGIN}".
+ * The efile_prefix dataset access property is set to "someprefix",
+ * which will cause an error if the value is not overwritten by
+ * the environment variable.
+ *
+ * Return: Success: 0
+ * Failure: 1
+ *
+ * Programmer: Steffen Kiess
+ * March 10, 2015
+ *
+ *-------------------------------------------------------------------------
+ */
+static int
+test_path_env(hid_t fapl)
+{
+ hid_t file = -1; /* file to write to */
+ hid_t dcpl = -1; /* dataset creation properties */
+ hid_t space = -1; /* data space */
+ hid_t dapl = -1; /* dataset access property list */
+ hid_t dset = -1; /* dataset */
+ size_t i; /* miscellaneous counters */
+ char cwdpath[1024]; /* working directory */
+ char filename[1024]; /* file name */
+ int part[PART_SIZE]; /* raw data buffer (partial) */
+ int whole[TOTAL_SIZE]; /* raw data buffer (total) */
+ hsize_t cur_size; /* current data space size */
+ char buffer[1024]; /* buffer to read efile_prefix */
+
+ TESTING("prefix in HDF5_EXTFILE_PREFIX");
+
+ if(HDmkdir("extern_env_dir", (mode_t)0755) < 0 && errno != EEXIST)
+ TEST_ERROR;
+
+ h5_fixname(EXT_ENV_FNAME[0], fapl, filename, sizeof(filename));
+ if((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
+ FAIL_STACK_ERROR
+
+ /* Reset the raw data files */
+ if(reset_raw_data_files(1) < 0)
+ TEST_ERROR
+
+ /* Create the dataset */
+ if((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0)
+ FAIL_STACK_ERROR
+ if(NULL == HDgetcwd(cwdpath, sizeof(cwdpath)))
+ TEST_ERROR
+ for(i = 0; i < N_EXT_FILES; i++) {
+ HDsnprintf(filename, sizeof(filename), "..%sextern_env_%dr.raw", H5_DIR_SEPS, (int) i + 1);
+ if(H5Pset_external(dcpl, filename, (off_t)(i * GARBAGE_PER_FILE), (hsize_t)sizeof(part)) < 0)
+ FAIL_STACK_ERROR
+ } /* end for */
+
+ cur_size = TOTAL_SIZE;
+ if((space = H5Screate_simple(1, &cur_size, NULL)) < 0)
+ FAIL_STACK_ERROR
+ if((dapl = H5Pcreate(H5P_DATASET_ACCESS)) < 0)
+ FAIL_STACK_ERROR
+
+ /* Set prefix to a nonexistent directory, will be overwritten by environment variable */
+ if(H5Pset_efile_prefix(dapl, "someprefix") < 0)
+ FAIL_STACK_ERROR
+ if(H5Pget_efile_prefix(dapl, buffer, sizeof(buffer)) < 0)
+ FAIL_STACK_ERROR
+ if(HDstrcmp(buffer, "someprefix") != 0)
+ FAIL_PUTS_ERROR("efile prefix not set correctly");
+
+ /* Create dataset */
+ if((dset = H5Dcreate2(file, "dset1", H5T_NATIVE_INT, space, H5P_DEFAULT, dcpl, dapl)) < 0)
+ FAIL_STACK_ERROR
+
+ /* Read the entire dataset and compare with the original */
+ HDmemset(whole, 0, sizeof(whole));
+ if(H5Dread(dset, H5T_NATIVE_INT, space, space, H5P_DEFAULT, whole) < 0)
+ FAIL_STACK_ERROR
+ for(i = 0; i < TOTAL_SIZE; i++)
+ if(whole[i] != (signed)i)
+ FAIL_PUTS_ERROR("Incorrect value(s) read.");
+
+ if(H5Dclose(dset) < 0) FAIL_STACK_ERROR
+ if(H5Pclose(dapl) < 0) FAIL_STACK_ERROR
+ if(H5Pclose(dcpl) < 0) FAIL_STACK_ERROR
+ if(H5Sclose(space) < 0) FAIL_STACK_ERROR
+ if(H5Fclose(file) < 0) FAIL_STACK_ERROR
+
+ PASSED();
+ return 0;
+
+error:
+ H5E_BEGIN_TRY {
+ H5Pclose(dapl);
+ H5Dclose(dset);
+ H5Pclose(dcpl);
+ H5Sclose(space);
+ H5Fclose(file);
+ } H5E_END_TRY;
+ return 1;
+} /* end test_path_env() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: main
+ *
+ * Purpose: Runs external dataset tests.
+ *
+ * Return: EXIT_SUCCESS/EXIT_FAILURE
+ *
+ * Programmer: Robb Matzke
+ * Tuesday, March 3, 1998
+ *
+ *-------------------------------------------------------------------------
+ */
+int
+main(void)
+{
+ hid_t fapl_id_old = -1; /* file access properties (old format) */
+ hid_t fapl_id_new = -1; /* file access properties (new format) */
+ hid_t fid = -1; /* file for test_1* functions */
+ hid_t gid = -1; /* group to emit diagnostics */
+ unsigned latest_format; /* default or latest file format */
+ int nerrors = 0; /* number of errors */
+
+ h5_reset();
+
+ /* Get a fapl for the old (default) file format */
+ fapl_id_old = h5_fileaccess();
+
+ /* Copy and set up a fapl for the latest file format */
+ if((fapl_id_new = H5Pcopy(fapl_id_old)) < 0)
+ FAIL_STACK_ERROR
+ if(H5Pset_libver_bounds(fapl_id_new, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST) < 0)
+ FAIL_STACK_ERROR
+
+ /* Test with old & new format groups */
+ for(latest_format = FALSE; latest_format <= TRUE; latest_format++) {
+ hid_t current_fapl_id = -1;
+
+ /* Set the fapl for different file formats */
+ if(latest_format) {
+ HDputs("\nTesting with the latest file format:");
+ current_fapl_id = fapl_id_new;
+ } /* end if */
+ else {
+ HDputs("Testing with the default file format:");
+ current_fapl_id = fapl_id_old;
+ } /* end else */
+
+ nerrors += test_path_env(current_fapl_id);
+ } /* end for */
+
+ if(nerrors > 0) goto error;
+
+ /* Close the new ff fapl. h5_cleanup will take care of the old ff fapl */
+ if(H5Pclose(fapl_id_new) < 0) FAIL_STACK_ERROR
+
+ HDputs("All external storage tests passed.");
+
+ /* Clean up files used by file set tests */
+ if(h5_cleanup(EXT_FNAME, fapl_id_old)) {
+ HDremove("extern_env_1r.raw");
+ HDremove("extern_env_2r.raw");
+ HDremove("extern_env_3r.raw");
+ HDremove("extern_env_4r.raw");
+
+ HDremove("extern_env_1w.raw");
+ HDremove("extern_env_2w.raw");
+ HDremove("extern_env_3w.raw");
+ HDremove("extern_env_4w.raw");
+
+ HDrmdir("extern_env_dir");
+ } /* end if */
+
+ return EXIT_SUCCESS;
+
+error:
+ H5E_BEGIN_TRY {
+ H5Fclose(fid);
+ H5Pclose(fapl_id_old);
+ H5Pclose(fapl_id_new);
+ H5Gclose(gid);
+ } H5E_END_TRY;
+ nerrors = MAX(1, nerrors);
+ printf("%d TEST%s FAILED.\n", nerrors, 1 == nerrors ? "" : "s");
+ return EXIT_FAILURE;
+} /* end main() */
+
diff --git a/test/fheap.c b/test/fheap.c
index c7f6ff0..846f03e 100644
--- a/test/fheap.c
+++ b/test/fheap.c
@@ -7599,7 +7599,7 @@ test_man_incr_insert_remove(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_
unsigned char heap_id[100][MAX_HEAP_ID_LEN]; /* Heap ID for object inserted */
struct a_type_t1 {
char a[10];
- char b[29];
+ char b[40];
} obj1, obj2; /* Objects to insert/remove */
size_t id_len; /* Size of fractal heap IDs */
fheap_heap_state_t state; /* State of fractal heap */
@@ -7640,14 +7640,14 @@ test_man_incr_insert_remove(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_
*/
TESTING("incremental object insertion and removal")
+ HDmemset(&obj1, 0, sizeof(obj1));
+ HDmemset(&obj2, 0, sizeof(obj2));
for(i = 0; i < 100; i++) {
- HDsprintf(obj1.b, "%s%d", "ABCDEFGHIJKLMNOPQRSTUVWXYZ", i);
-
for(j = 0; j < i; j++) {
- HDsprintf(obj2.b, "%s%d", "ABCDEFGHIJKLMNOPQRSTUVWXYZ", j);
-
if(H5HF_remove(fh, heap_id[j]) < 0)
FAIL_STACK_ERROR
+
+ HDsprintf(obj2.b, "%s%2d", "ABCDEFGHIJKLMNOPQRSTUVWXYZ", j);
if(H5HF_insert(fh, (sizeof(obj2)), &obj2, heap_id[j]) < 0)
FAIL_STACK_ERROR
} /* end for */
@@ -7658,6 +7658,7 @@ test_man_incr_insert_remove(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_
/* Insert object */
HDmemset(heap_id[i], 0, id_len);
+ HDsprintf(obj1.b, "%s%2d", "ABCDEFGHIJKLMNOPQRSTUVWXYZ", i);
if(H5HF_insert(fh, (sizeof(obj1)), &obj1, heap_id[i]) < 0)
FAIL_STACK_ERROR
} /* end for */
diff --git a/test/file_image.c b/test/file_image.c
index 0dba236..86dd13e 100644
--- a/test/file_image.c
+++ b/test/file_image.c
@@ -580,7 +580,7 @@ test_core(void)
file = H5Fopen(copied_filename, H5F_ACC_RDONLY, fapl);
VERIFY(file >= 0, "H5Fopen failed");
VERIFY((udata->used_callbacks == MALLOC) ||
- (udata->used_callbacks == MALLOC | UDATA_COPY | UDATA_FREE), "opening a core file used the wrong callbacks");
+ (udata->used_callbacks == (MALLOC | UDATA_COPY | UDATA_FREE)), "opening a core file used the wrong callbacks");
VERIFY(udata->malloc_src == H5FD_FILE_IMAGE_OP_FILE_OPEN, "Malloc callback came from wrong sourc in core open");
/* Close file */
diff --git a/test/fill18.h5 b/test/fill18.h5
new file mode 100644
index 0000000..c092f59
--- /dev/null
+++ b/test/fill18.h5
Binary files differ
diff --git a/test/flush1.c b/test/flush1.c
index fefa8d0..ac5f9ef 100644
--- a/test/flush1.c
+++ b/test/flush1.c
@@ -73,7 +73,7 @@ create_file(const char *filename, hid_t fapl_id, hbool_t swmr)
hid_t fid = -1; /* file ID */
hid_t top_gid = -1; /* containing group ID */
hid_t gid = -1; /* subgroup ID */
- char group_name[16]; /* group name */
+ char group_name[32]; /* group name */
unsigned flags; /* file open flags */
int i; /* iterator */
diff --git a/test/flush2.c b/test/flush2.c
index 6e8aee7..8ebfb75 100644
--- a/test/flush2.c
+++ b/test/flush2.c
@@ -135,7 +135,7 @@ file_ok(const char *filename, hid_t fapl_id, hbool_t check_second_dset)
hid_t fid = -1; /* file ID */
hid_t top_gid = -1; /* containing group ID */
hid_t gid = -1; /* subgroup ID */
- char group_name[16]; /* group name */
+ char group_name[32]; /* group name */
int i; /* iterator */
/* open file */
diff --git a/test/flushrefreshTest.cmake b/test/flushrefreshTest.cmake
index f66ee64..73210ef 100644
--- a/test/flushrefreshTest.cmake
+++ b/test/flushrefreshTest.cmake
@@ -18,7 +18,7 @@ if (NOT TEST_PROGRAM)
message (FATAL_ERROR "Require TEST_PROGRAM to be defined")
endif ()
if (NOT TEST_FOLDER)
- message ( FATAL_ERROR "Require TEST_FOLDER to be defined")
+ message (FATAL_ERROR "Require TEST_FOLDER to be defined")
endif ()
if (NOT TEST_OUTPUT)
message (FATAL_ERROR "Require TEST_OUTPUT to be defined")
@@ -53,7 +53,7 @@ if (TEST_ENV_VAR)
#message (STATUS "ENV:${TEST_ENV_VAR}=$ENV{${TEST_ENV_VAR}}")
endif ()
-message(STATUS "Background: ${PERL_EXECUTABLE} ${PERL_SCRIPT} ${TEST_PROGRAM}")
+message (STATUS "Background: ${PERL_EXECUTABLE} ${PERL_SCRIPT} ${TEST_PROGRAM}")
execute_process (
COMMAND ${PERL_EXECUTABLE} ${PERL_SCRIPT} ${TEST_PROGRAM}
RESULT_VARIABLE SCRIPT_RESULT
@@ -61,34 +61,34 @@ execute_process (
OUTPUT_VARIABLE SCRIPT_OUTPUT
WORKING_DIRECTORY ${TEST_FOLDER}
)
-message(STATUS "Background: ${SCRIPT_OUTPUT}")
-if (NOT "${SCRIPT_RESULT}" STREQUAL "0")
+message (STATUS "Background: ${SCRIPT_OUTPUT}")
+if (SCRIPT_RESULT)
message (FATAL_ERROR "Failed: The background script failed ${SCRIPT_RESULT}: ${SCRIPT_ERR}")
endif ()
-set(verification_done "0")
-while(verification_done LESS "1")
- message(STATUS "checking first stage:${TEST_FOLDER}/${TEST_ARGS1}")
- if(EXISTS ${TEST_FOLDER}/${TEST_ERR})
+set (verification_done "0")
+while (verification_done LESS "1")
+ message (STATUS "checking first stage:${TEST_FOLDER}/${TEST_ARGS1}")
+ if (EXISTS ${TEST_FOLDER}/${TEST_ERR})
# Error exit script
- set(verification_done "3")
- elseif(EXISTS ${TEST_FOLDER}/${TEST_ARGS1})
+ set (verification_done "3")
+ elseif (EXISTS ${TEST_FOLDER}/${TEST_ARGS1})
file (STRINGS ${TEST_FOLDER}/${TEST_ARGS1} v1)
list (LENGTH v1 len_v1)
- message(STATUS "v1:${v1} len_v1:${len_v1}")
- if (NOT "${len_v1}" STREQUAL "0")
+ message (STATUS "v1:${v1} len_v1:${len_v1}")
+ if (len_v1)
list (GET v1 0 param1)
list (GET v1 -1 param2)
endif ()
- file(REMOVE ${TEST_FOLDER}/${TEST_ARGS1})
- message(STATUS "PARAM1:${param1} PARAM2:${param2}")
+ file (REMOVE ${TEST_FOLDER}/${TEST_ARGS1})
+ message (STATUS "PARAM1:${param1} PARAM2:${param2}")
- if(${param1} MATCHES "VERIFICATION_DONE")
- set(verification_done "1")
- file(WRITE ${TEST_FOLDER}/${TEST_ARGS2} "all flush verification complete")
- message(STATUS "write: ${TEST_FOLDER}/${TEST_ARGS2}")
- else()
- message(STATUS "execute: ${TEST_PROGRAM} ${param1} ${param2}")
+ if (param1 MATCHES "VERIFICATION_DONE")
+ set (verification_done "1")
+ file (WRITE ${TEST_FOLDER}/${TEST_ARGS2} "all flush verification complete")
+ message (STATUS "write: ${TEST_FOLDER}/${TEST_ARGS2}")
+ else ()
+ message (STATUS "execute: ${TEST_PROGRAM} ${param1} ${param2}")
execute_process (
COMMAND ${TEST_PROGRAM} ${param1} ${param2}
RESULT_VARIABLE TEST_RESULT
@@ -98,40 +98,40 @@ while(verification_done LESS "1")
ERROR_VARIABLE TEST_ERROR
WORKING_DIRECTORY ${TEST_FOLDER}
)
- message(STATUS "flush verification: ${TEST_OUT}")
- if (NOT "${TEST_RESULT}" STREQUAL "0")
+ message (STATUS "flush verification: ${TEST_OUT}")
+ if (TEST_RESULT)
message (FATAL_ERROR "Failed: The flush verification failed ${TEST_RESULT}: ${TEST_ERROR}")
endif ()
- file(WRITE ${TEST_FOLDER}/${TEST_ARGS2} "verification flush process done")
- endif()
- else()
- message(STATUS "waiting: ${TEST_FOLDER}/${TEST_ARGS1}")
+ file (WRITE ${TEST_FOLDER}/${TEST_ARGS2} "verification flush process done")
+ endif ()
+ else ()
+ message (STATUS "waiting: ${TEST_FOLDER}/${TEST_ARGS1}")
#execute_process (COMMAND ${CMAKE_COMMAND} -E sleep 2)
- endif()
-endwhile()
+ endif ()
+endwhile ()
-while(verification_done LESS "2")
- message(STATUS "checking second stage:${TEST_FOLDER}/${TEST_ARGS1}")
- if(EXISTS ${TEST_FOLDER}/${TEST_ERR})
+while (verification_done LESS "2")
+ message (STATUS "checking second stage:${TEST_FOLDER}/${TEST_ARGS1}")
+ if (EXISTS ${TEST_FOLDER}/${TEST_ERR})
# Error exit script
- set(verification_done "3")
- elseif(EXISTS ${TEST_FOLDER}/${TEST_ARGS1})
+ set (verification_done "3")
+ elseif (EXISTS ${TEST_FOLDER}/${TEST_ARGS1})
file (STRINGS ${TEST_FOLDER}/${TEST_ARGS1} v1)
list (LENGTH v1 len_v1)
- message(STATUS "v1:${v1} len_v1:${len_v1}")
- if (NOT "${len_v1}" STREQUAL "0")
+ message (STATUS "v1:${v1} len_v1:${len_v1}")
+ if (len_v1)
list (GET v1 0 param1)
list (GET v1 -1 param2)
endif ()
- file(REMOVE ${TEST_FOLDER}/${TEST_ARGS1})
- message(STATUS "PARAM1:${param1} PARAM2:${param2}")
+ file (REMOVE ${TEST_FOLDER}/${TEST_ARGS1})
+ message (STATUS "PARAM1:${param1} PARAM2:${param2}")
- if(${param1} MATCHES "VERIFICATION_DONE")
- set(verification_done "2")
- file(WRITE ${TEST_FOLDER}/${TEST_ARGS2} "all refresh verification complete")
- message(STATUS "write: ${TEST_FOLDER}/${TEST_ARGS2}")
- else()
- message(STATUS "execute: ${TEST_PROGRAM} ${param1}")
+ if (param1 MATCHES "VERIFICATION_DONE")
+ set (verification_done "2")
+ file (WRITE ${TEST_FOLDER}/${TEST_ARGS2} "all refresh verification complete")
+ message (STATUS "write: ${TEST_FOLDER}/${TEST_ARGS2}")
+ else ()
+ message (STATUS "execute: ${TEST_PROGRAM} ${param1}")
execute_process (
COMMAND ${TEST_PROGRAM} ${param1}
RESULT_VARIABLE TEST_RESULT
@@ -141,22 +141,22 @@ while(verification_done LESS "2")
ERROR_VARIABLE TEST_ERROR
WORKING_DIRECTORY ${TEST_FOLDER}
)
- message(STATUS "refresh verification: ${TEST_OUT}")
- if (NOT "${TEST_RESULT}" STREQUAL "0")
+ message (STATUS "refresh verification: ${TEST_OUT}")
+ if (TEST_RESULT)
message (FATAL_ERROR "Failed: The refresh verification failed ${TEST_RESULT}: ${TEST_ERROR}")
endif ()
- file(WRITE ${TEST_FOLDER}/${TEST_ARGS2} "refresh verifiction process done")
- endif()
- else()
- message(STATUS "waiting: ${TEST_FOLDER}/${TEST_ARGS1}")
+ file (WRITE ${TEST_FOLDER}/${TEST_ARGS2} "refresh verifiction process done")
+ endif ()
+ else ()
+ message (STATUS "waiting: ${TEST_FOLDER}/${TEST_ARGS1}")
#execute_process (COMMAND ${CMAKE_COMMAND} -E sleep 2)
- endif()
-endwhile()
+ endif ()
+endwhile ()
message (STATUS "COMMAND Result: ${TEST_RESULT}")
# 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)
@@ -169,4 +169,4 @@ endif ()
message (STATUS "COMMAND Error: ${TEST_ERROR}")
# everything went fine...
-message ("Passed")
+message (STATUS "Passed")
diff --git a/test/gen_plist.c b/test/gen_plist.c
index 68da6cc..8f38b1a 100644
--- a/test/gen_plist.c
+++ b/test/gen_plist.c
@@ -466,13 +466,13 @@ encode_plist(hid_t plist_id, int little_endian, int word_length, const char *fil
HDassert(ret > 0);
/* first call to encode returns only the size of the buffer needed */
- if((ret = H5Pencode(plist_id, NULL, &temp_size)) < 0)
+ if((ret = H5Pencode2(plist_id, NULL, &temp_size, H5P_DEFAULT)) < 0)
HDassert(ret > 0);
temp_buf = (void *)HDmalloc(temp_size);
HDassert(temp_buf);
- if((ret = H5Pencode(plist_id, temp_buf, &temp_size)) < 0)
+ if((ret = H5Pencode2(plist_id, temp_buf, &temp_size, H5P_DEFAULT)) < 0)
HDassert(ret > 0);
fd = HDopen(filename, O_RDWR | O_CREAT | O_TRUNC, H5_POSIX_CREATE_MODE_RW);
diff --git a/test/h5test.c b/test/h5test.c
index dfa6a31..59ccfe4 100644
--- a/test/h5test.c
+++ b/test/h5test.c
@@ -44,12 +44,6 @@
* is interpreted according to the driver. See
* h5_get_vfd_fapl() for details.
*
- * HDF5_VOL_CONNECTOR: This string describes what VOL connector to
- * use for HDF5 file access. The first word in the
- * value is the name of the connector and subsequent data
- * is interpreted according to the connector. See
- * h5_get_vol_fapl() for details.
- *
* HDF5_LIBVER_BOUNDS: This string describes what library version bounds to
* use for HDF5 file access. See h5_get_libver_fapl() for details.
*
@@ -106,12 +100,23 @@ static const char *multi_letters = "msbrglo";
/* The # of seconds to wait for the message file--used by h5_wait_message() */
#define MESSAGE_TIMEOUT 300 /* Timeout in seconds */
+/* The strings that correspond to library version bounds H5F_libver_t in H5Fpublic.h */
+/* This is used by h5_get_version_string() */
+const char *LIBVER_NAMES[] = {
+ "earliest", /* H5F_LIBVER_EARLIEST = 0 */
+ "v18", /* H5F_LIBVER_V18 = 1 */
+ "v110", /* H5F_LIBVER_V110 = 2 */
+ "latest", /* H5F_LIBVER_V112 = 3 */
+ NULL
+};
+
+
/* Previous error reporting function */
static H5E_auto2_t err_func = NULL;
static herr_t h5_errors(hid_t estack, void *client_data);
-static char * h5_fixname_real(const char *base_name, hid_t fapl, const char *suffix,
- char *fullname, size_t size, hbool_t nest_printf);
+static char *h5_fixname_real(const char *base_name, hid_t fapl, const char *_suffix,
+ char *fullname, size_t size, hbool_t nest_printf, hbool_t subst_for_superblock);
/*-------------------------------------------------------------------------
@@ -466,7 +471,33 @@ h5_test_init(void)
char *
h5_fixname(const char *base_name, hid_t fapl, char *fullname, size_t size)
{
- return (h5_fixname_real(base_name, fapl, ".h5", fullname, size, FALSE));
+ return (h5_fixname_real(base_name, fapl, ".h5", fullname, size, FALSE, FALSE));
+}
+
+
+/*-------------------------------------------------------------------------
+ * Function: h5_fixname_superblock
+ *
+ * Purpose: Like h5_fixname() but returns the name of the file you'd
+ * open to find the superblock. Useful for when you have to
+ * open a file with open(2) but the h5_fixname() string
+ * contains stuff like format strings.
+ *
+ * Return: Success: The FULLNAME pointer.
+ *
+ * Failure: NULL if BASENAME or FULLNAME is the null
+ * pointer or if FULLNAME isn't large enough for
+ * the result.
+ *
+ * Programmer: Dana Robinson
+ * Spring 2019
+ *
+ *-------------------------------------------------------------------------
+ */
+char *
+h5_fixname_superblock(const char *base_name, hid_t fapl_id, char *fullname, size_t size)
+{
+ return (h5_fixname_real(base_name, fapl_id, ".h5", fullname, size, FALSE, TRUE));
}
@@ -486,7 +517,7 @@ h5_fixname(const char *base_name, hid_t fapl, char *fullname, size_t size)
char *
h5_fixname_no_suffix(const char *base_name, hid_t fapl, char *fullname, size_t size)
{
- return (h5_fixname_real(base_name, fapl, NULL, fullname, size, FALSE));
+ return (h5_fixname_real(base_name, fapl, NULL, fullname, size, FALSE, FALSE));
}
@@ -512,7 +543,7 @@ h5_fixname_no_suffix(const char *base_name, hid_t fapl, char *fullname, size_t s
char *
h5_fixname_printf(const char *base_name, hid_t fapl, char *fullname, size_t size)
{
- return (h5_fixname_real(base_name, fapl, ".h5", fullname, size, TRUE));
+ return (h5_fixname_real(base_name, fapl, ".h5", fullname, size, TRUE, FALSE));
}
@@ -540,9 +571,10 @@ h5_fixname_printf(const char *base_name, hid_t fapl, char *fullname, size_t size
*/
static char *
h5_fixname_real(const char *base_name, hid_t fapl, const char *_suffix,
- char *fullname, size_t size, hbool_t nest_printf)
+ char *fullname, size_t size, hbool_t nest_printf, hbool_t subst_for_superblock)
{
const char *prefix = NULL;
+ const char *env = NULL; /* HDF5_DRIVER environment variable */
char *ptr, last = '\0';
const char *suffix = _suffix;
size_t i, j;
@@ -560,17 +592,46 @@ h5_fixname_real(const char *base_name, hid_t fapl, const char *_suffix,
return NULL;
if(suffix) {
- if(H5FD_FAMILY == driver)
- suffix = nest_printf ? "%%05d.h5" : "%05d.h5";
- else if (H5FD_MULTI == driver)
- suffix = NULL;
+ if(H5FD_FAMILY == driver) {
+ if(subst_for_superblock)
+ suffix = "00000.h5";
+ else
+ suffix = nest_printf ? "%%05d.h5" : "%05d.h5";
+ }
+ else if (H5FD_MULTI == driver) {
+
+ /* Get the environment variable, if it exists, in case
+ * we are using the split driver since both of those
+ * use the multi VFD under the hood.
+ */
+ env = HDgetenv("HDF5_DRIVER");
+#ifdef HDF5_DRIVER
+ /* Use the environment variable, then the compile-time constant */
+ if(!env)
+ env = HDF5_DRIVER;
+#endif
+ if(env && !HDstrcmp(env, "split")) {
+ /* split VFD */
+ if(subst_for_superblock)
+ suffix = "-m.h5";
+ else
+ suffix = NULL;
+ }
+ else {
+ /* multi VFD */
+ if(subst_for_superblock)
+ suffix = "-s.h5";
+ else
+ suffix = NULL;
+ }
+ }
}
}
/* Must first check fapl is not H5P_DEFAULT (-1) because H5FD_XXX
* could be of value -1 if it is not defined.
*/
- isppdriver = H5P_DEFAULT != fapl && (H5FD_MPIO==driver);
+ isppdriver = H5P_DEFAULT != fapl && (H5FD_MPIO == driver);
/* Check HDF5_NOCLEANUP environment setting.
* (The #ifdef is needed to prevent compile failure in case MPI is not
@@ -785,10 +846,6 @@ h5_fileaccess(void)
if(h5_get_vfd_fapl(fapl_id) < 0)
goto error;
- /* Next, try to set up a VOL connector */
- if(h5_get_vol_fapl(fapl_id) < 0)
- goto error;
-
/* Finally, check for libver bounds */
if(h5_get_libver_fapl(fapl_id) < 0)
goto error;
@@ -829,10 +886,6 @@ h5_fileaccess_flags(unsigned flags)
if((flags & H5_FILEACCESS_VFD) && h5_get_vfd_fapl(fapl_id) < 0)
goto error;
- /* Next, try to set up a VOL connector */
- if((flags & H5_FILEACCESS_VOL) && h5_get_vol_fapl(fapl_id) < 0)
- goto error;
-
/* Finally, check for libver bounds */
if((flags & H5_FILEACCESS_LIBVER) && h5_get_libver_fapl(fapl_id) < 0)
goto error;
@@ -1046,110 +1099,6 @@ error:
/*-------------------------------------------------------------------------
- * Function: h5_get_vol_fapl
- *
- * Purpose: Returns a file access property list which is the default
- * fapl but with a VOL connector set according to the constant
- * or environment variable HDF5_VOL_CONNECTOR.
- *
- * Return: Success: 0
- * Failure: -1
- *
- * Programmer: Jordan Henderson
- * November 2018
- *
- *-------------------------------------------------------------------------
- */
-herr_t
-h5_get_vol_fapl(hid_t fapl)
-{
- const char *env = NULL;
- const char *tok = NULL;
- char *lasts = NULL; /* Context pointer for strtok_r() call */
- htri_t connector_is_registered;
- char buf[1024]; /* Buffer for tokenizing HDF5_VOL_CONNECTOR */
- void *vol_info = NULL; /* VOL connector info */
- hid_t connector_id = -1;
-
- /* Get the environment variable, if it exists */
- env = HDgetenv("HDF5_VOL_CONNECTOR");
-#ifdef HDF5_VOL_CONNECTOR
- /* Use the environment variable, then the compile-time constant */
- if(!env)
- env = HDF5_VOL_CONNECTOR;
-#endif
-
- /* If the environment variable was not set, just return. */
- if(!env || !*env)
- goto done;
-
- /* Get the first 'word' of the environment variable.
- * If it's nothing (environment variable was whitespace) just return.
- */
- HDstrncpy(buf, env, sizeof(buf));
- buf[sizeof(buf) - 1] = '\0';
- if(NULL == (tok = HDstrtok_r(buf, " \t\n\r", &lasts)))
- goto done;
-
- /* First, check to see if the connector is already registered */
- if((connector_is_registered = H5VLis_connector_registered(tok)) < 0)
- goto done;
- else if(connector_is_registered) {
- /* Retrieve the ID of the already-registered VOL connector */
- if((connector_id = H5VLget_connector_id(tok)) < 0)
- goto error;
- } /* end else-if */
- else {
- /* Check for VOL connectors that ship with the library */
- if(!HDstrcmp(tok, "native")) {
- connector_id = H5VL_NATIVE;
- if(H5Iinc_ref(connector_id) < 0)
- goto error;
- } else if(!HDstrcmp(tok, "pass_through")) {
- connector_id = H5VL_PASSTHRU;
- if(H5Iinc_ref(connector_id) < 0)
- goto error;
- } else {
- /* Register the VOL connector */
- /* (NOTE: No provisions for vipl_id currently) */
- if((connector_id = H5VLregister_connector_by_name(tok, H5P_DEFAULT)) < 0)
- goto error;
- } /* end else */
- } /* end else */
-
- /* Was there any connector info specified in the environment variable? */
- if(NULL != (tok = HDstrtok_r(NULL, " \t\n\r", &lasts)))
- if(H5VLconnector_str_to_info(tok, connector_id, &vol_info) < 0)
- goto error;
-
- /* Set the VOL connector in the FAPL */
- if(H5Pset_vol(fapl, connector_id, vol_info) < 0)
- goto error;
-
- /* Release VOL connector info, if there was any */
- if(vol_info)
- if(H5VLfree_connector_info(connector_id, vol_info) < 0)
- goto error;
-
- /* Close the connector ID */
- if(connector_id >= 0)
- if(H5VLunregister_connector(connector_id) < 0)
- goto error;
-
-done:
- return 0;
-
-error:
- if(vol_info)
- H5VLfree_connector_info(connector_id, vol_info);
- if(connector_id >= 0)
- H5VLunregister_connector(connector_id);
-
- return -1;
-} /* end h5_get_vol_fapl() */
-
-
-/*-------------------------------------------------------------------------
* Function: h5_no_hwconv
*
* Purpose: Turn off hardware data type conversions.
@@ -1270,7 +1219,7 @@ h5_set_info_object(void)
int ret_value=0;
/* handle any MPI INFO hints via $HDF5_MPI_INFO */
- if ((envp = getenv("HDF5_MPI_INFO")) != NULL){
+ if ((envp = HDgetenv("HDF5_MPI_INFO")) != NULL){
char *next, *valp;
valp = envp = next = HDstrdup(envp);
@@ -1332,7 +1281,7 @@ h5_set_info_object(void)
/* actually set the darned thing */
if (MPI_SUCCESS != MPI_Info_set(h5_io_info_g, namep, valp)) {
- printf("MPI_Info_set failed\n");
+ HDprintf("MPI_Info_set failed\n");
ret_value = -1;
}
}
@@ -1508,9 +1457,9 @@ print_func(const char *format, ...)
va_list arglist;
int ret_value;
- va_start(arglist, format);
+ HDva_start(arglist, format);
ret_value = vprintf(format, arglist);
- va_end(arglist);
+ HDva_end(arglist);
return ret_value;
}
@@ -1595,7 +1544,7 @@ getenv_all(MPI_Comm comm, int root, const char* name)
int len;
static char* env = NULL;
- assert(name);
+ HDassert(name);
MPI_Initialized(&mpi_initialized);
MPI_Finalized(&mpi_finalized);
@@ -1603,7 +1552,7 @@ getenv_all(MPI_Comm comm, int root, const char* name)
if(mpi_initialized && !mpi_finalized) {
MPI_Comm_rank(comm, &mpi_rank);
MPI_Comm_size(comm, &mpi_size);
- assert(root < mpi_size);
+ HDassert(root < mpi_size);
/* The root task does the getenv call
* and sends the result to the other tasks */
@@ -2058,3 +2007,17 @@ error:
return NULL;
} /* h5_get_dummy_vol_class */
+/*-------------------------------------------------------------------------
+ * Function: h5_get_version_string
+ *
+ * Purpose: Get the string that corresponds to the libvery version bound.
+ *
+ * Return: The string
+ *
+ *-------------------------------------------------------------------------
+ */
+char *
+h5_get_version_string(H5F_libver_t libver)
+{
+ return(LIBVER_NAMES[libver]);
+} /* end of h5_get_version_string */
diff --git a/test/h5test.h b/test/h5test.h
index 66a7863..448813e 100644
--- a/test/h5test.h
+++ b/test/h5test.h
@@ -123,8 +123,7 @@ H5TEST_DLLVAR MPI_Info h5_io_info_g; /* MPI INFO object for IO */
/* Flags for h5_fileaccess_flags() */
#define H5_FILEACCESS_VFD 0x01
-#define H5_FILEACCESS_VOL 0x02
-#define H5_FILEACCESS_LIBVER 0x04
+#define H5_FILEACCESS_LIBVER 0x02
#ifdef __cplusplus
extern "C" {
@@ -134,6 +133,7 @@ extern "C" {
H5TEST_DLL void h5_clean_files(const char *base_name[], hid_t fapl);
H5TEST_DLL int h5_cleanup(const char *base_name[], hid_t fapl);
H5TEST_DLL char *h5_fixname(const char *base_name, hid_t fapl, char *fullname, size_t size);
+H5TEST_DLL char *h5_fixname_superblock(const char *base_name, hid_t fapl, char *fullname, size_t size);
H5TEST_DLL char *h5_fixname_no_suffix(const char *base_name, hid_t fapl, char *fullname, size_t size);
H5TEST_DLL char *h5_fixname_printf(const char *base_name, hid_t fapl, char *fullname, size_t size);
H5TEST_DLL hid_t h5_fileaccess(void);
@@ -149,10 +149,10 @@ H5TEST_DLL int h5_make_local_copy(const char *origfilename, const char *local_co
H5TEST_DLL herr_t h5_verify_cached_stabs(const char *base_name[], hid_t fapl);
H5TEST_DLL H5FD_class_t *h5_get_dummy_vfd_class(void);
H5TEST_DLL H5VL_class_t *h5_get_dummy_vol_class(void);
+H5TEST_DLL char *h5_get_version_string(H5F_libver_t libver);
/* Functions that will replace components of a FAPL */
H5TEST_DLL herr_t h5_get_vfd_fapl(hid_t fapl_id);
-H5TEST_DLL herr_t h5_get_vol_fapl(hid_t fapl_id);
H5TEST_DLL herr_t h5_get_libver_fapl(hid_t fapl_id);
/* h5_clean_files() replacements */
diff --git a/test/hyperslab.c b/test/hyperslab.c
index feb96bd..d8c00c9 100644
--- a/test/hyperslab.c
+++ b/test/hyperslab.c
@@ -819,12 +819,8 @@ test_transpose(size_t nx, size_t ny)
dst_stride[1] = (hsize_t)(nx * sizeof(*src));
/* Copy and transpose */
- if(nx == ny)
- H5VM_stride_copy(2, (hsize_t)sizeof(*src), size, dst_stride, dst,
- src_stride, src);
- else
- H5VM_stride_copy(2, (hsize_t)sizeof(*src), size, dst_stride, dst,
- src_stride, src);
+ H5VM_stride_copy(2, (hsize_t)sizeof(*src), size, dst_stride, dst,
+ src_stride, src);
/* Check */
for(i = 0; i < nx; i++) {
diff --git a/test/links.c b/test/links.c
index 520f784..3166954 100644
--- a/test/links.c
+++ b/test/links.c
@@ -7759,6 +7759,7 @@ done:
case H5I_ERROR_CLASS:
case H5I_ERROR_MSG:
case H5I_ERROR_STACK:
+ case H5I_SPACE_SEL_ITER:
case H5I_NTYPES:
default:
return -1;
@@ -7847,6 +7848,7 @@ done:
case H5I_ERROR_CLASS:
case H5I_ERROR_MSG:
case H5I_ERROR_STACK:
+ case H5I_SPACE_SEL_ITER:
case H5I_NTYPES:
default:
return -1;
diff --git a/test/mount.c b/test/mount.c
index c6230ee..b7d2858 100644
--- a/test/mount.c
+++ b/test/mount.c
@@ -192,7 +192,7 @@ test_illegal(hid_t fapl)
} H5E_END_TRY;
if(status >= 0) {
H5_FAILED();
- puts(" Mounting a file on itself should have failed.");
+ HDputs(" Mounting a file on itself should have failed.");
TEST_ERROR
} /* end if */
@@ -208,7 +208,7 @@ test_illegal(hid_t fapl)
} H5E_END_TRY;
if(status >= 0) {
H5_FAILED();
- puts(" Mounting two files at one mount point should have failed.");
+ HDputs(" Mounting two files at one mount point should have failed.");
TEST_ERROR
} /* end if */
if(H5Funmount(mnt, ".") < 0) FAIL_STACK_ERROR
@@ -227,7 +227,7 @@ test_illegal(hid_t fapl)
} H5E_END_TRY;
if(status >= 0) {
H5_FAILED();
- puts(" Mounting same file opened twice at one mount point should have failed.");
+ HDputs(" Mounting same file opened twice at one mount point should have failed.");
TEST_ERROR
} /* end if */
if(H5Funmount(mnt, ".") < 0) FAIL_STACK_ERROR
@@ -240,7 +240,7 @@ test_illegal(hid_t fapl)
} H5E_END_TRY;
if(status >= 0) {
H5_FAILED();
- puts(" Creating a cycle with mount points should have failed.");
+ HDputs(" Creating a cycle with mount points should have failed.");
TEST_ERROR
} /* end if */
if(H5Funmount(file1, "/mnt1") < 0) FAIL_STACK_ERROR
@@ -423,7 +423,7 @@ test_hide(hid_t fapl)
} H5E_END_TRY;
if(grp >= 0) {
H5_FAILED();
- puts(" Name is still accessible under mount point.");
+ HDputs(" Name is still accessible under mount point.");
TEST_ERROR
} /* end if */
@@ -434,7 +434,7 @@ test_hide(hid_t fapl)
if(H5Oget_info_by_name2(file1, "/file1", &oi2, H5O_INFO_BASIC, H5P_DEFAULT) < 0) FAIL_STACK_ERROR
if(oi1.fileno != oi2.fileno || H5F_addr_ne(oi1.addr, oi2.addr)) {
H5_FAILED();
- puts(" Hard link failed for hidden object.");
+ HDputs(" Hard link failed for hidden object.");
TEST_ERROR
} /* end if */
@@ -503,7 +503,7 @@ test_assoc(hid_t fapl)
if(oi1.fileno != oi2.fileno || H5F_addr_ne(oi1.addr, oi2.addr)) {
H5_FAILED();
- puts(" Association failed.");
+ HDputs(" Association failed.");
TEST_ERROR
} /* end if */
@@ -628,7 +628,7 @@ test_move(hid_t fapl)
} H5E_END_TRY;
if(status >= 0) {
H5_FAILED();
- puts(" Moving an object across files should't have been possible");
+ HDputs(" Moving an object across files should't have been possible");
TEST_ERROR
} /* end if */
@@ -834,7 +834,7 @@ test_unlink(hid_t fapl)
} H5E_END_TRY;
if(status >= 0) {
H5_FAILED();
- puts(" Incorrect traversal from mount point!");
+ HDputs(" Incorrect traversal from mount point!");
TEST_ERROR
} /* end if */
@@ -851,7 +851,7 @@ test_unlink(hid_t fapl)
} H5E_END_TRY;
if(status >= 0) {
H5_FAILED();
- puts(" Traversal through mount point should not have worked!");
+ HDputs(" Traversal through mount point should not have worked!");
TEST_ERROR
} /* end if */
H5E_BEGIN_TRY {
@@ -859,7 +859,7 @@ test_unlink(hid_t fapl)
} H5E_END_TRY;
if(status >= 0) {
H5_FAILED();
- puts(" Traversal through mount point should not have worked!");
+ HDputs(" Traversal through mount point should not have worked!");
TEST_ERROR
} /* end if */
@@ -873,7 +873,7 @@ test_unlink(hid_t fapl)
} H5E_END_TRY;
if(status >= 0) {
H5_FAILED();
- printf(" %d: Unmount by name should not have been allowed!\n",__LINE__);
+ HDprintf(" %d: Unmount by name should not have been allowed!\n",__LINE__);
TEST_ERROR
} /* end if */
H5E_BEGIN_TRY {
@@ -881,7 +881,7 @@ test_unlink(hid_t fapl)
} H5E_END_TRY;
if(status >= 0) {
H5_FAILED();
- printf(" %d: Unmount by name should not have been allowed!\n",__LINE__);
+ HDprintf(" %d: Unmount by name should not have been allowed!\n",__LINE__);
TEST_ERROR
} /* end if */
if(H5Funmount(mnt, ".") < 0) FAIL_STACK_ERROR
@@ -1005,7 +1005,7 @@ test_interlink(hid_t fapl)
} H5E_END_TRY;
if(status >= 0) {
H5_FAILED();
- puts(" Interfile hard link should not have been allowed!");
+ HDputs(" Interfile hard link should not have been allowed!");
TEST_ERROR
} /* end if */
@@ -1015,7 +1015,7 @@ test_interlink(hid_t fapl)
} H5E_END_TRY;
if(status >= 0) {
H5_FAILED();
- puts(" Interfile renaming should not have been allowed!");
+ HDputs(" Interfile renaming should not have been allowed!");
TEST_ERROR
} /* end if */
@@ -1033,7 +1033,7 @@ test_interlink(hid_t fapl)
} H5E_END_TRY;
if(dset >= 0) {
H5_FAILED();
- puts(" Dataset and shared type must be in the same file!");
+ HDputs(" Dataset and shared type must be in the same file!");
TEST_ERROR
} /* end if */
@@ -1172,7 +1172,7 @@ test_close(hid_t fapl)
if(H5Fclose(file1) < 0) FAIL_STACK_ERROR
if(H5Oget_info_by_name2(file2, "/mnt1", &oinfo, H5O_INFO_BASIC, H5P_DEFAULT) < 0) {
H5_FAILED();
- puts(" File1 contents are not accessible!");
+ HDputs(" File1 contents are not accessible!");
TEST_ERROR
} /* end if */
if(H5Fclose(file2) < 0) FAIL_STACK_ERROR
@@ -4379,13 +4379,13 @@ main(void)
if (nerrors) goto error;
- puts("All mount tests passed.");
+ HDputs("All mount tests passed.");
h5_cleanup(FILENAME, fapl);
return 0;
error:
- puts("***** MOUNT ERRORS *****");
+ HDputs("***** MOUNT ERRORS *****");
return 1;
}
diff --git a/test/null_vol_connector.c b/test/null_vol_connector.c
index b62b370..5ed8545 100644
--- a/test/null_vol_connector.c
+++ b/test/null_vol_connector.c
@@ -15,8 +15,15 @@
* (registration, etc.).
*/
+
+/* Public HDF5 header */
+#include "hdf5.h"
+
+/* For HDF5 plugin functionality */
#include "H5PLextern.h"
+
+/* This connector's header */
#include "null_vol_connector.h"
/* The VOL class struct */
@@ -27,16 +34,21 @@ static const H5VL_class_t null_vol_g = {
0, /* capability flags */
NULL, /* initialize */
NULL, /* terminate */
- (size_t)0, /* info size */
- NULL, /* info copy */
- NULL, /* info compare */
- NULL, /* info free */
- NULL, /* info to str */
- NULL, /* str to info */
- NULL, /* get_object */
- NULL, /* get_wrap_ctx */
- NULL, /* wrap_object */
- NULL, /* free_wrap_ctx */
+ { /* info_cls */
+ (size_t)0, /* size */
+ NULL, /* copy */
+ NULL, /* compare */
+ NULL, /* free */
+ NULL, /* to_str */
+ NULL, /* from_str */
+ },
+ { /* wrap_cls */
+ NULL, /* get_object */
+ NULL, /* get_wrap_ctx */
+ NULL, /* wrap_object */
+ NULL, /* unwrap_object */
+ NULL, /* free_wrap_ctx */
+ },
{ /* attribute_cls */
NULL, /* create */
NULL, /* open */
diff --git a/test/objcopy.c b/test/objcopy.c
index eb4927f..e646c87 100644
--- a/test/objcopy.c
+++ b/test/objcopy.c
@@ -1167,7 +1167,7 @@ compare_data(hid_t parent1, hid_t parent2, hid_t pid, hid_t tid, size_t nelmts,
if((obj2_sid = H5Rget_region(parent2, H5R_DATASET_REGION, ref_buf2)) < 0) TEST_ERROR
/* Check if dataspaces are the same shape */
- if(H5S_select_shape_same_test(obj1_sid, obj2_sid) < 0) TEST_ERROR
+ if(H5S__select_shape_same_test(obj1_sid, obj2_sid) < 0) TEST_ERROR
/* Close dataspaces */
if(H5Sclose(obj1_sid) < 0) TEST_ERROR
@@ -2136,9 +2136,7 @@ test_copy_dataset_versionbounds(hid_t fcpl_src, hid_t fapl_src)
char src_fname[NAME_BUF_SIZE]; /* Name of source file */
char dst_fname[NAME_BUF_SIZE]; /* Name of destination file */
H5F_libver_t low, high; /* File format bounds */
- H5F_libver_t low_src, high_src; /* Source file format bounds */
- unsigned srcdset_fillversion; /* Fill version of source dataset */
- hbool_t valid_high = FALSE; /* TRUE if high bound is valid */
+ unsigned srcdset_layoutversion; /* Layout version of source dataset */
int i, j; /* Local index variables */
H5D_t *dsetp = NULL; /* Pointer to internal dset structure */
herr_t ret; /* Generic return value */
@@ -2181,7 +2179,8 @@ test_copy_dataset_versionbounds(hid_t fcpl_src, hid_t fapl_src)
/* Get the internal dset ptr to get the fill version for verifying later */
if ((dsetp = (H5D_t *)H5VL_object(did_src)) == NULL) TEST_ERROR
- srcdset_fillversion = dsetp->shared->dcpl_cache.fill.version;
+
+ srcdset_layoutversion = dsetp->shared->layout.version;
/* Close dataspace */
if(H5Sclose(sid) < 0) TEST_ERROR
@@ -2199,8 +2198,8 @@ test_copy_dataset_versionbounds(hid_t fcpl_src, hid_t fapl_src)
/* Loop through all the combinations of low/high library format bounds,
skipping invalid combinations. Create a destination file and copy the
source dataset to it, then verify */
- for(low = H5F_LIBVER_EARLIEST; low < H5F_LIBVER_NBOUNDS; low++) {
- for(high = H5F_LIBVER_EARLIEST; high < H5F_LIBVER_NBOUNDS; high++) {
+ for(low = H5F_LIBVER_EARLIEST; low < H5F_LIBVER_NBOUNDS; H5_INC_ENUM(H5F_libver_t, low)) {
+ for(high = H5F_LIBVER_EARLIEST; high < H5F_LIBVER_NBOUNDS; H5_INC_ENUM(H5F_libver_t, high)) {
/* Set version bounds */
H5E_BEGIN_TRY {
@@ -2226,9 +2225,9 @@ test_copy_dataset_versionbounds(hid_t fcpl_src, hid_t fapl_src)
/* If copy failed, check if the failure is expected */
if (ret < 0)
{
- /* Failure is valid if fill version of source dataset is
+ /* Failure is valid if layout version of source dataset is
greater than destination */
- if (srcdset_fillversion <= H5O_fill_ver_bounds[high])
+ if (srcdset_layoutversion <= H5O_layout_ver_bounds[high])
TEST_ERROR
/* Close the DST file before continue */
@@ -5872,12 +5871,14 @@ compare_attribute_compound_vlstr(hid_t loc, hid_t loc2)
{
hid_t aid = -1, aid2 = -1; /* Attribute IDs */
hid_t tid = -1, tid2 = -1; /* Datatype IDs */
+ hid_t sid = -1, sid2 = -1; /* Dataspace IDs */
+ hid_t dxpl_id = -1;
typedef struct { /* Compound structure for the attribute */
int i;
char *v;
} s1;
s1 rbuf; /* Buffer for data read */
- s1 rbuf2; /* Buffer for data read */
+ s1 rbuf2; /* Buffer for data read */
/* Open the attributes attached to the objects */
if((aid = H5Aopen_by_idx(loc, ".", H5_INDEX_CRT_ORDER, H5_ITER_INC, (hsize_t)0, H5P_DEFAULT, H5P_DEFAULT)) < 0)
@@ -5891,6 +5892,12 @@ compare_attribute_compound_vlstr(hid_t loc, hid_t loc2)
if((tid2 = H5Aget_type(aid2)) < 0)
FAIL_STACK_ERROR
+ /* Get the attributes' dataspaces */
+ if((sid = H5Aget_space(aid)) < 0)
+ FAIL_STACK_ERROR
+ if((sid2 = H5Aget_space(aid2)) < 0)
+ FAIL_STACK_ERROR
+
/* Read the attributes */
if(H5Aread(aid, tid, &rbuf) < 0)
FAIL_STACK_ERROR
@@ -5905,6 +5912,19 @@ compare_attribute_compound_vlstr(hid_t loc, hid_t loc2)
if(HDmemcmp(rbuf.v, rbuf2.v, HDstrlen(rbuf.v)))
FAIL_STACK_ERROR
+ /* Reclaim vlen buffer */
+ if((dxpl_id = H5Pcreate(H5P_DATASET_XFER)) < 0) TEST_ERROR
+ if(H5Pset_vlen_mem_manager(dxpl_id, NULL, NULL, NULL, NULL) < 0) TEST_ERROR
+ if(H5Dvlen_reclaim(tid, sid, dxpl_id, &rbuf) < 0) TEST_ERROR
+ if(H5Dvlen_reclaim(tid, sid, dxpl_id, &rbuf2) < 0) TEST_ERROR
+ if(H5Pclose(dxpl_id) < 0) TEST_ERROR
+
+ /* Close the dataspaces */
+ if(H5Sclose(sid) < 0)
+ FAIL_STACK_ERROR
+ if(H5Sclose(sid2) < 0)
+ FAIL_STACK_ERROR
+
/* Close the attributes */
if(H5Aclose(aid) < 0)
FAIL_STACK_ERROR
@@ -5916,8 +5936,13 @@ error:
H5E_BEGIN_TRY {
H5Aclose(aid);
H5Aclose(aid2);
+ H5Dvlen_reclaim(tid, sid, H5P_DEFAULT, &rbuf);
+ H5Dvlen_reclaim(tid, sid, H5P_DEFAULT, &rbuf2);
+ H5Sclose(sid);
+ H5Sclose(sid2);
H5Tclose(tid);
H5Tclose(tid2);
+ H5Pclose(dxpl_id);
} H5E_END_TRY;
return FALSE;
@@ -7871,7 +7896,7 @@ test_copy_old_layout(hid_t fcpl_dst, hid_t fapl, hbool_t test_open)
addr_reset();
/* Setup */
- if((src_fapl = h5_fileaccess_flags(H5_FILEACCESS_VOL | H5_FILEACCESS_LIBVER)) < 0) TEST_ERROR
+ if((src_fapl = h5_fileaccess_flags(H5_FILEACCESS_LIBVER)) < 0) TEST_ERROR
/* open source file (read-only) */
if((fid_src = H5Fopen(src_filename, H5F_ACC_RDONLY, src_fapl)) < 0) TEST_ERROR
diff --git a/test/ohdr.c b/test/ohdr.c
index 85554a5..d15e43b 100644
--- a/test/ohdr.c
+++ b/test/ohdr.c
@@ -751,27 +751,6 @@ error:
} /* test_unknown() */
/*
- * 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.
*/
@@ -830,216 +809,181 @@ oh_compare(hid_t did1, hid_t did2)
* Conduct additions side-by-side with a standard datataset and one with
* minimized dataset object headers.
*/
+#define ATTR_NAME_MAX 16
+#define ATTR_SHORT "first"
+#define ATTR_LONG "second"
+#define N_ATTRS 64
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
- */
+ hsize_t dims[1] = {0}; /* dataspace extent */
+ char filename[512] = "";
+ char attr_name[ATTR_NAME_MAX] = "";
+ 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 aid = H5I_INVALID_HID;
+ char *in_buf = NULL;
+ char *out_buf = NULL;
+ size_t buf_size = 0;
+ int out_val = 0;
+ int in_val = 0;
+ int i;
+
+ TESTING("adding attributes to datasets created with H5Pset_dset_no_attrs_hint()")
+
+ /* Create the test file */
+ if(NULL == h5_fixname(FILENAME[1], fapl_id, filename, sizeof(filename)))
+ TEST_ERROR;
+ if((fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl_id)) == H5I_INVALID_HID)
+ TEST_ERROR;
- count = count_attributes(dset_id);
- if(count != 0) TEST_ERROR
- count = count_attributes(mindset_id);
- if(count != 0) TEST_ERROR
+ /* Set the 'no attrs' hint on the dcpl */
+ if((dcpl_id = H5Pcreate(H5P_DATASET_CREATE)) == H5I_INVALID_HID)
+ TEST_ERROR;
+ if(H5Pset_dset_no_attrs_hint(dcpl_id, TRUE) < 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
+ /* The dataset doesn't need to contain data */
+ dims[0] = 0;
+ if((sid = H5Screate_simple(1, dims, NULL)) == H5I_INVALID_HID)
+ TEST_ERROR;
- ret = put_attribute(mindset_id, "PURPOSE", "DEMO", char_type_id, dspace_id, &attr_1a_id);
- if(ret < 0) TEST_ERROR
+ /* Create the dataset */
+ if((did = H5Dcreate2(fid, "H5Pset_dset_no_attrs_hint", H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl_id, H5P_DEFAULT)) == H5I_INVALID_HID)
+ TEST_ERROR;
- count = count_attributes(dset_id);
- if(count != 1) TEST_ERROR
- count = count_attributes(mindset_id);
- if(count != 1) TEST_ERROR
+ /* Close */
+ if(H5Pclose(dcpl_id) < 0)
+ TEST_ERROR;
+ if(H5Sclose(sid) < 0)
+ TEST_ERROR;
- ret = H5Aread(attr_1_id, char_type_id, buffer);
- if(ret < 0) TEST_ERROR
- if(HDstrcmp("DEMO", buffer)) TEST_ERROR
+ /**********************************************
+ * ADD A (STRING) ATTRIBUTE AND MANIPULATE IT *
+ **********************************************/
- ret = H5Aread(attr_1a_id, char_type_id, buffer);
- if(ret < 0) TEST_ERROR
- if(HDstrcmp("DEMO", buffer)) TEST_ERROR
+ buf_size = HDstrlen(ATTR_LONG) + 1;
+ if(NULL == (in_buf = (char *)HDcalloc(buf_size, sizeof(char))))
+ TEST_ERROR;
+ if(NULL == (out_buf = (char *)HDcalloc(buf_size, sizeof(char))))
+ TEST_ERROR;
- /* -----------------
- * modify one attribute
+ /* Create a string attribute on the dataset
+ *
+ * It has to be long enough to hold the longest string we're going to write
+ * to it.
*/
+ dims[0] = buf_size;
+ if((sid = H5Screate_simple(1, dims, NULL)) == H5I_INVALID_HID)
+ TEST_ERROR;
+ if((aid = H5Acreate2(did, "string_attr", H5T_NATIVE_CHAR, sid, H5P_DEFAULT, H5P_DEFAULT)) == H5I_INVALID_HID)
+ TEST_ERROR;
- ret = put_attribute(dset_id, "PURPOSE", "REWRITE", char_type_id, -1, &attr_1_id);
- if(ret < 0) TEST_ERROR
+ /* Write attribute data */
+ HDstrcpy(in_buf, ATTR_SHORT);
+ if(H5Awrite(aid, H5T_NATIVE_CHAR, in_buf) < 0)
+ TEST_ERROR;
- ret = put_attribute(mindset_id, "PURPOSE", "REWRITE", char_type_id, -1, &attr_1a_id);
- if(ret < 0) TEST_ERROR
+ /* Make sure the count is correct */
+ if(count_attributes(did) != 1)
+ TEST_ERROR;
- count = count_attributes(dset_id);
- if(count != 1) TEST_ERROR
- count = count_attributes(mindset_id);
- if(count != 1) TEST_ERROR
+ /* Read the data back and verify */
+ if(H5Aread(aid, H5T_NATIVE_CHAR, out_buf) < 0)
+ TEST_ERROR;
+ if(HDstrcmp(in_buf, out_buf))
+ TEST_ERROR;
- ret = H5Aread(attr_1_id, char_type_id, buffer);
- if(ret < 0) TEST_ERROR
- if(HDstrcmp("REWRITE", buffer)) TEST_ERROR
+ /* modify the string attribute */
+ HDmemset(in_buf, 0, buf_size);
+ HDstrcpy(in_buf, ATTR_LONG);
+ if(H5Awrite(aid, H5T_NATIVE_CHAR, in_buf) < 0)
+ TEST_ERROR;
- ret = H5Aread(attr_1a_id, char_type_id, buffer);
- if(ret < 0) TEST_ERROR
- if(HDstrcmp("REWRITE", buffer)) TEST_ERROR
+ if(count_attributes(did) != 1)
+ TEST_ERROR;
- /* -----------------
- * add second attribute
- */
+ /* Read the data back and verify */
+ if(H5Aread(aid, H5T_NATIVE_CHAR, out_buf) < 0)
+ TEST_ERROR;
+ if(HDstrcmp(in_buf, out_buf))
+ TEST_ERROR;
- 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
+ /* Close */
+ if(H5Sclose(sid) < 0)
+ TEST_ERROR;
+ if(H5Aclose(aid) < 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
+ /***************************************
+ * ADD A BUNCH OF (INTEGER) ATTRIBUTES *
+ ***************************************/
- count = count_attributes(dset_id);
- if(count != 2) TEST_ERROR
- count = count_attributes(mindset_id);
- if(count != 2) TEST_ERROR
+ if((sid = H5Screate(H5S_SCALAR)) == H5I_INVALID_HID)
+ TEST_ERROR;
- ret = H5Aread(attr_2_id, int_type_id, &a_out);
- if(ret < 0) TEST_ERROR
- if(a_out != 5) TEST_ERROR
+ /* Loop over a reasonable number of attributes */
+ for(i = 0; i < N_ATTRS; i++) {
- ret = H5Aread(attr_2a_id, int_type_id, &a_out);
- if(ret < 0) TEST_ERROR
- if(a_out != 3) TEST_ERROR
+ /* Set the attribute's name */
+ if(HDsnprintf(attr_name, ATTR_NAME_MAX, "int_attr_%d", i) < 0)
+ TEST_ERROR;
- /* -----------------
- * add third attribute
- */
+ /* Create an integer attribute on the dataset */
+ if((aid = H5Acreate2(did, attr_name, H5T_NATIVE_INT, sid, H5P_DEFAULT, H5P_DEFAULT)) == H5I_INVALID_HID)
+ TEST_ERROR;
- 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
+ /* Write attribute data */
+ in_val = i;
+ if(H5Awrite(aid, H5T_NATIVE_INT, &in_val) < 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
+ /* Make sure the count is correct (already has one attribute) */
+ if(count_attributes(did) != i + 2)
+ TEST_ERROR;
- count = count_attributes(dset_id);
- if(count != 3) TEST_ERROR
- count = count_attributes(mindset_id);
- if(count != 3) TEST_ERROR
+ /* Read the data back and verify */
+ if(H5Aread(aid, H5T_NATIVE_INT, &out_val) < 0)
+ TEST_ERROR;
+ if(in_val != out_val)
+ TEST_ERROR;
- ret = H5Aread(attr_3_id, int_type_id, &a_out);
- if(ret < 0) TEST_ERROR
- if(a_out != -86) TEST_ERROR
+ /* Close */
+ if(H5Aclose(aid) < 0)
+ TEST_ERROR;
+ }
- ret = H5Aread(attr_3a_id, int_type_id, &a_out);
- if(ret < 0) TEST_ERROR
- if(a_out != 2185) TEST_ERROR
+ /* Close */
+ if(H5Sclose(sid) < 0)
+ TEST_ERROR;
- /************
- * TEARDOWN *
- ************/
+ /* Close the remaining IDs */
+ if(H5Dclose(did) < 0)
+ TEST_ERROR;
+ if(H5Fclose(fid) < 0)
+ TEST_ERROR;
- 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
+ /* Free memory */
+ HDfree(in_buf);
+ HDfree(out_buf);
- PASSED()
+ 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);
+ (void)H5Sclose(sid);
+ (void)H5Dclose(did);
+ (void)H5Aclose(aid);
+ (void)H5Fclose(fid);
} H5E_END_TRY;
+
+ HDfree(in_buf);
+ HDfree(out_buf);
+
return FAIL;
} /* test_minimized_dset_ohdr_attribute_addition */
@@ -1085,19 +1029,24 @@ test_minimized_dset_ohdr_size_comparisons(hid_t fapl_id)
* file-minimized | F_x | F_Y | F_N
*/
- TESTING("minimized dset object headers size comparisons");
/*********
* SETUP *
*********/
+ /* Set filenames (not in a test, can't use TEST_ERROR) */
if(h5_fixname(FILENAME[1], fapl_id, filename_a, sizeof(filename_a)) == NULL)
- TEST_ERROR
-
+ return FAIL;
if(h5_fixname(FILENAME[2], fapl_id, filename_b, sizeof(filename_b)) == NULL)
- TEST_ERROR
+ return FAIL;
for (compact = 0; compact < 2; compact++) { /* 0 or 1 */
+
+ if(compact)
+ TESTING("minimized dset object headers size comparisons (compact)")
+ else
+ TESTING("minimized dset object headers size comparisons")
+
dcpl_default = H5Pcreate(H5P_DATASET_CREATE);
if(dcpl_default < 0) TEST_ERROR
@@ -1112,15 +1061,13 @@ test_minimized_dset_ohdr_size_comparisons(hid_t fapl_id)
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
@@ -1191,9 +1138,10 @@ test_minimized_dset_ohdr_size_comparisons(hid_t fapl_id)
if(H5Dclose(dset_F_N_id) < 0) TEST_ERROR
if(H5Dclose(dset_F_Y_id) < 0) TEST_ERROR
+ PASSED()
+
} /* compact and non-compact */
- PASSED()
return SUCCEED;
error :
@@ -1627,45 +1575,6 @@ error:
return FAIL;
} /* test_minimized_dset_ohdr_fillvalue_backwards_compatability */
-#define STR_EARLIEST "earliest"
-#define STR_V18 "v18"
-#define STR_LATEST "latest"
-static char *
-version_string(H5F_libver_t libver)
-{
- char *str = NULL;
-
- str = (char *) HDmalloc(20);
- if (str == NULL) {
- HDfprintf(stderr, "Allocation failed\n");
- HDexit(1);
- }
-
- switch(libver) {
- case H5F_LIBVER_EARLIEST:
- HDstrcpy(str, STR_EARLIEST);
- break;
-
- case H5F_LIBVER_V18:
- HDstrcpy(str, STR_V18);
- break;
-
- case H5F_LIBVER_V110:
- HDassert(H5F_LIBVER_LATEST == H5F_LIBVER_V110);
- HDstrcpy(str, STR_LATEST);
- break;
-
- case H5F_LIBVER_ERROR:
- case H5F_LIBVER_NBOUNDS:
- default:
- HDsprintf(str, "%ld", (long)libver);
- break;
- } /* end switch */
-
- /* Return the formed version bound string */
- return str;
-} /* end version_string() */
-
/*-------------------------------------------------------------------------
* Function: main
@@ -1693,7 +1602,6 @@ main(void)
H5O_loc_t oh_loc; /* Object header locations */
H5F_libver_t low, high; /* File format bounds */
time_t time_new, ro;
- char msg[80]; /* Message for file format version */
int i; /* Local index variable */
hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */
herr_t ret; /* Generic return value */
@@ -1716,10 +1624,11 @@ main(void)
api_ctx_pushed = TRUE;
/* Loop through all the combinations of low/high library format bounds */
- for(low = H5F_LIBVER_EARLIEST; low < H5F_LIBVER_NBOUNDS; low++) {
- for(high = H5F_LIBVER_EARLIEST; high < H5F_LIBVER_NBOUNDS; high++) {
- char *low_string = NULL;
- char *high_string = NULL;
+ for(low = H5F_LIBVER_EARLIEST; low < H5F_LIBVER_NBOUNDS; H5_INC_ENUM(H5F_libver_t, low)) {
+ for(high = H5F_LIBVER_EARLIEST; high < H5F_LIBVER_NBOUNDS; H5_INC_ENUM(H5F_libver_t, high)) {
+ char *low_string = NULL; /* Message for library version low bound */
+ char *high_string = NULL; /* Message for library version high bound */
+ char msg[80]; /* Message for file format version */
/* Set version bounds before opening the file */
H5E_BEGIN_TRY {
@@ -1730,13 +1639,11 @@ main(void)
continue;
/* Display info about testing */
- low_string = version_string(low);
- high_string = version_string(high);
+ low_string = h5_get_version_string(low);
+ high_string = h5_get_version_string(high);
sprintf(msg, "Using file format version: (%s, %s)", low_string,
high_string);
HDputs(msg);
- HDfree(high_string);
- HDfree(low_string);
/* test on object continuation block */
if(test_cont(filename, fapl) < 0)
diff --git a/test/page_buffer.c b/test/page_buffer.c
index b9b31f8..e11a6d6 100644
--- a/test/page_buffer.c
+++ b/test/page_buffer.c
@@ -98,7 +98,7 @@ create_file(char *filename, hid_t fcpl, hid_t fapl)
int i;
int num_elements;
int j;
- char dset_name[10];
+ char dset_name[32];
if((file_id = H5Fcreate(filename, H5F_ACC_TRUNC, fcpl, fapl)) < 0)
FAIL_STACK_ERROR;
@@ -235,7 +235,7 @@ open_file(char *filename, hid_t fapl, hsize_t page_size,
int i;
int j;
int num_elements;
- char dset_name[10];
+ char dset_name[32];
H5F_t *f = NULL;
if((file_id = H5Fopen(filename, H5F_ACC_RDONLY, fapl)) < 0)
diff --git a/test/set_extent.c b/test/set_extent.c
index 5d11819..f6b02cf 100644
--- a/test/set_extent.c
+++ b/test/set_extent.c
@@ -433,8 +433,8 @@ static int do_layouts( hid_t fapl )
TESTING("storage layout use - tested with all low/high library format bounds");
/* Loop through all the combinations of low/high library format bounds */
- for(low = H5F_LIBVER_EARLIEST; low < H5F_LIBVER_NBOUNDS; low++) {
- for(high = H5F_LIBVER_EARLIEST; high < H5F_LIBVER_NBOUNDS; high++) {
+ for(low = H5F_LIBVER_EARLIEST; low < H5F_LIBVER_NBOUNDS; H5_INC_ENUM(H5F_libver_t, low)) {
+ for(high = H5F_LIBVER_EARLIEST; high < H5F_LIBVER_NBOUNDS; H5_INC_ENUM(H5F_libver_t, high)) {
/* Copy plist to use locally to avoid modifying the original */
new_fapl = H5Pcopy(fapl);
diff --git a/test/tattr.c b/test/tattr.c
index 454ea71..c7a2c23 100644
--- a/test/tattr.c
+++ b/test/tattr.c
@@ -581,107 +581,118 @@ test_attr_flush(hid_t fapl)
static void
test_attr_plist(hid_t fapl)
{
- hid_t fid1; /* HDF5 File IDs */
- hid_t dataset; /* Dataset ID */
- hid_t sid1,sid2; /* Dataspace ID */
- hid_t attr; /* Attribute ID */
- hid_t plist; /* Property list ID */
- hsize_t dims1[] = {SPACE1_DIM1, SPACE1_DIM2, SPACE1_DIM3};
- hsize_t dims2[] = {ATTR1_DIM1};
- H5T_cset_t cset; /* Character set for attributes */
- herr_t ret; /* Generic return value */
+ hid_t fid = H5I_INVALID_HID; /* File ID */
+ hid_t did = H5I_INVALID_HID; /* Dataset ID */
+ hid_t dsid = H5I_INVALID_HID; /* Dataspace ID (for dataset) */
+ hid_t asid = H5I_INVALID_HID; /* Dataspace ID (for attribute) */
+ hid_t aid = H5I_INVALID_HID; /* Attribute ID */
+ hid_t acpl_id = H5I_INVALID_HID; /* Attribute creation property list ID */
+ hid_t aapl_id = H5I_INVALID_HID; /* Attribute access property list ID */
+ hsize_t dims1[] = {SPACE1_DIM1, SPACE1_DIM2, SPACE1_DIM3};
+ hsize_t dims2[] = {ATTR1_DIM1};
+ H5T_cset_t cset; /* Character set for attributes */
+ herr_t ret; /* Generic return value */
/* Output message about test being performed */
MESSAGE(5, ("Testing Attribute Property Lists\n"));
/* Create file */
- fid1 = H5Fcreate(FILENAME, H5F_ACC_TRUNC, H5P_DEFAULT, fapl);
- CHECK(fid1, FAIL, "H5Fcreate");
+ fid = H5Fcreate(FILENAME, H5F_ACC_TRUNC, H5P_DEFAULT, fapl);
+ CHECK(fid, H5I_INVALID_HID, "H5Fcreate");
/* Create dataspace for dataset */
- sid1 = H5Screate_simple(SPACE1_RANK, dims1, NULL);
- CHECK(sid1, FAIL, "H5Screate_simple");
+ dsid = H5Screate_simple(SPACE1_RANK, dims1, NULL);
+ CHECK(dsid, H5I_INVALID_HID, "H5Screate_simple");
/* Create a dataset */
- dataset = H5Dcreate2(fid1, DSET1_NAME, H5T_NATIVE_UCHAR, sid1, H5P_DEFAULT, dcpl_g, H5P_DEFAULT);
- CHECK(dataset, FAIL, "H5Dcreate2");
+ did = H5Dcreate2(fid, DSET1_NAME, H5T_NATIVE_UCHAR, dsid, H5P_DEFAULT, dcpl_g, H5P_DEFAULT);
+ CHECK(did, H5I_INVALID_HID, "H5Dcreate2");
/* Create dataspace for attribute */
- sid2 = H5Screate_simple(ATTR1_RANK, dims2, NULL);
- CHECK(sid2, FAIL, "H5Screate_simple");
+ asid = H5Screate_simple(ATTR1_RANK, dims2, NULL);
+ CHECK(asid, H5I_INVALID_HID, "H5Screate_simple");
+
+ /* Create default creation property list for attribute */
+ acpl_id = H5Pcreate(H5P_ATTRIBUTE_CREATE);
+ CHECK(acpl_id, H5I_INVALID_HID, "H5Pcreate");
- /* Create default property list for attribute */
- plist = H5Pcreate(H5P_ATTRIBUTE_CREATE);
- CHECK(plist, FAIL, "H5Pcreate");
+ /* Create default access property list for attribute
+ * This currently has no properties, but we need to test its creation
+ * and use.
+ */
+ aapl_id = H5Pcreate(H5P_ATTRIBUTE_ACCESS);
+ CHECK(aapl_id, H5I_INVALID_HID, "H5Pcreate");
/* Get the character encoding and ensure that it is the default (ASCII) */
- ret = H5Pget_char_encoding(plist, &cset);
+ ret = H5Pget_char_encoding(acpl_id, &cset);
CHECK(ret, FAIL, "H5Pget_char_encoding");
VERIFY(cset, H5T_CSET_ASCII, "H5Pget_char_encoding");
/* Create an attribute for the dataset using the property list */
- attr = H5Acreate2(dataset, ATTR1_NAME, H5T_NATIVE_INT, sid2, plist, H5P_DEFAULT);
- CHECK(attr, FAIL, "H5Acreate2");
+ aid = H5Acreate2(did, ATTR1_NAME, H5T_NATIVE_INT, asid, acpl_id, aapl_id);
+ CHECK(aid, H5I_INVALID_HID, "H5Acreate2");
- /* Close the property list, and get the attribute's property list */
- ret = H5Pclose(plist);
+ /* Close the property list, and get the attribute's creation property list */
+ ret = H5Pclose(acpl_id);
CHECK(ret, FAIL, "H5Pclose");
- plist = H5Aget_create_plist(attr);
- CHECK(plist, FAIL, "H5Aget_create_plist");
+ acpl_id = H5Aget_create_plist(aid);
+ CHECK(acpl_id, H5I_INVALID_HID, "H5Aget_create_plist");
/* Get the character encoding and ensure that it is the default (ASCII) */
- ret = H5Pget_char_encoding(plist, &cset);
+ ret = H5Pget_char_encoding(acpl_id, &cset);
CHECK(ret, FAIL, "H5Pget_char_encoding");
VERIFY(cset, H5T_CSET_ASCII, "H5Pget_char_encoding");
/* Close the property list and attribute */
- ret = H5Pclose(plist);
+ ret = H5Pclose(acpl_id);
CHECK(ret, FAIL, "H5Pclose");
- ret = H5Aclose(attr);
+ ret = H5Aclose(aid);
CHECK(ret, FAIL, "H5Aclose");
/* Create a new property list and modify it to use a different encoding */
- plist = H5Pcreate(H5P_ATTRIBUTE_CREATE);
- CHECK(plist, FAIL, "H5Pcreate");
- ret = H5Pset_char_encoding(plist, H5T_CSET_UTF8);
+ acpl_id = H5Pcreate(H5P_ATTRIBUTE_CREATE);
+ CHECK(acpl_id, H5I_INVALID_HID, "H5Pcreate");
+ ret = H5Pset_char_encoding(acpl_id, H5T_CSET_UTF8);
CHECK(ret, FAIL, "H5Pset_char_encoding");
/* Get the character encoding and ensure that it has been changed */
- ret = H5Pget_char_encoding(plist, &cset);
+ ret = H5Pget_char_encoding(acpl_id, &cset);
CHECK(ret, FAIL, "H5Pget_char_encoding");
VERIFY(cset, H5T_CSET_UTF8, "H5Pget_char_encoding");
/* Create an attribute for the dataset using the modified property list */
- attr = H5Acreate2(dataset, ATTR2_NAME, H5T_NATIVE_INT, sid2, plist, H5P_DEFAULT);
- CHECK(attr, FAIL, "H5Acreate2");
+ aid = H5Acreate2(did, ATTR2_NAME, H5T_NATIVE_INT, asid, acpl_id, aapl_id);
+ CHECK(aid, H5I_INVALID_HID, "H5Acreate2");
/* Close the property list and attribute */
- ret = H5Pclose(plist);
+ ret = H5Pclose(acpl_id);
CHECK(ret, FAIL, "H5Pclose");
- ret = H5Aclose(attr);
+ ret = H5Aclose(aid);
CHECK(ret, FAIL, "H5Aclose");
/* Re-open the second attribute and ensure that its character encoding is correct */
- attr = H5Aopen(dataset, ATTR2_NAME, H5P_DEFAULT);
- CHECK(attr, FAIL, "H5Aopen");
- plist = H5Aget_create_plist(attr);
- CHECK(plist, FAIL, "H5Aget_create_plist");
- ret = H5Pget_char_encoding(plist, &cset);
+ aid = H5Aopen(did, ATTR2_NAME, H5P_DEFAULT);
+ CHECK(aid, H5I_INVALID_HID, "H5Aopen");
+ acpl_id = H5Aget_create_plist(aid);
+ CHECK(acpl_id, H5I_INVALID_HID, "H5Aget_create_plist");
+ ret = H5Pget_char_encoding(acpl_id, &cset);
CHECK(ret, FAIL, "H5Pget_char_encoding");
VERIFY(cset, H5T_CSET_UTF8, "H5Pget_char_encoding");
/* Close everything */
- ret=H5Sclose(sid1);
+ ret = H5Sclose(dsid);
CHECK(ret, FAIL, "H5Sclose");
- ret=H5Sclose(sid2);
+ ret = H5Sclose(asid);
CHECK(ret, FAIL, "H5Sclose");
- ret = H5Pclose(plist);
+ ret = H5Pclose(aapl_id);
+ CHECK(ret, FAIL, "H5Pclose");
+ ret = H5Pclose(acpl_id);
CHECK(ret, FAIL, "H5Pclose");
- ret=H5Aclose(attr);
+ ret = H5Aclose(aid);
CHECK(ret, FAIL, "H5Aclose");
- ret=H5Dclose(dataset);
+ ret = H5Dclose(did);
CHECK(ret, FAIL, "H5Dclose");
- ret=H5Fclose(fid1);
+ ret = H5Fclose(fid);
CHECK(ret, FAIL, "H5Fclose");
} /* test_attr_plist() */
@@ -2626,6 +2637,7 @@ test_attr_dense_rename(hid_t fcpl, hid_t fapl)
H5O_info_t oinfo; /* Object info */
unsigned u; /* Local index variable */
int use_min_dset_oh = (dcpl_g != H5P_DEFAULT);
+ unsigned use_corder; /* Track creation order or not */
herr_t ret; /* Generic return value */
/* Output message about test being performed */
@@ -2641,7 +2653,7 @@ test_attr_dense_rename(hid_t fcpl, hid_t fapl)
CHECK(ret, FAIL, "H5Pset_file_space_strategy");
}
fid = H5Fcreate(FILENAME, H5F_ACC_TRUNC, fcpl, fapl);
- CHECK(fid, FAIL, "H5Fcreate");
+ CHECK(fid, H5I_INVALID_HID, "H5Fcreate");
if (use_min_dset_oh)
CHECK(H5Pclose(fcpl), FAIL, "H5Pclose");
@@ -2656,76 +2668,92 @@ test_attr_dense_rename(hid_t fcpl, hid_t fapl)
/* Re-open file */
fid = H5Fopen(FILENAME, H5F_ACC_RDWR, fapl);
- CHECK(fid, FAIL, "H5Fopen");
+ CHECK(fid, H5I_INVALID_HID, "H5Fopen");
/* Create dataspace for dataset */
sid = H5Screate(H5S_SCALAR);
- CHECK(sid, FAIL, "H5Screate");
+ CHECK(sid, H5I_INVALID_HID, "H5Screate");
/* need DCPL to query the group creation properties */
if (use_min_dset_oh) {
dcpl = H5Pcopy(dcpl_g);
- CHECK(dcpl, FAIL, "H5Pcopy");
+ CHECK(dcpl, H5I_INVALID_HID, "H5Pcopy");
} else {
dcpl = H5Pcreate(H5P_DATASET_CREATE);
- CHECK(dcpl, FAIL, "H5Pcreate");
+ CHECK(dcpl, H5I_INVALID_HID, "H5Pcreate");
}
- /* Create a dataset */
- dataset = H5Dcreate2(fid, DSET1_NAME, H5T_NATIVE_UCHAR, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT);
- CHECK(dataset, FAIL, "H5Dcreate2");
-
/* Retrieve limits for compact/dense attribute storage */
ret = H5Pget_attr_phase_change(dcpl, &max_compact, &min_dense);
CHECK(ret, FAIL, "H5Pget_attr_phase_change");
- /* Close property list */
- ret = H5Pclose(dcpl);
- CHECK(ret, FAIL, "H5Pclose");
+ /* Using creation order or not */
+ for(use_corder = FALSE; use_corder <= TRUE; use_corder++) {
- /* Check on dataset's attribute storage status */
- is_dense = H5O__is_attr_dense_test(dataset);
- VERIFY(is_dense, FALSE, "H5O__is_attr_dense_test");
+ if(use_corder) {
+ ret = H5Pset_attr_creation_order(dcpl, H5P_CRT_ORDER_TRACKED | H5P_CRT_ORDER_INDEXED);
+ CHECK(ret, FAIL, "H5Pset_attr_creation_order");
+ }
- /* Add attributes, until well into dense storage */
- for(u = 0; u < (max_compact * 2); u++) {
- /* Create attribute */
- sprintf(attrname, "attr %02u", u);
- attr = H5Acreate2(dataset, attrname, H5T_NATIVE_UINT, sid, H5P_DEFAULT, H5P_DEFAULT);
- CHECK(attr, FAIL, "H5Acreate2");
+ /* Create a dataset */
+ dataset = H5Dcreate2(fid, DSET1_NAME, H5T_NATIVE_UCHAR, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT);
+ CHECK(dataset, H5I_INVALID_HID, "H5Dcreate2");
- /* Write data into the attribute */
- ret = H5Awrite(attr, H5T_NATIVE_UINT, &u);
- CHECK(ret, FAIL, "H5Awrite");
+ /* Check on dataset's attribute storage status */
+ is_dense = H5O__is_attr_dense_test(dataset);
+ VERIFY(is_dense, FALSE, "H5O__is_attr_dense_test");
- /* Close attribute */
- ret = H5Aclose(attr);
- CHECK(ret, FAIL, "H5Aclose");
+ /* Add attributes, until well into dense storage */
+ for(u = 0; u < (max_compact * 2); u++) {
+ /* Create attribute */
+ sprintf(attrname, "attr %02u", u);
+ attr = H5Acreate2(dataset, attrname, H5T_NATIVE_UINT, sid, H5P_DEFAULT, H5P_DEFAULT);
+ CHECK(attr, H5I_INVALID_HID, "H5Acreate2");
- /* Rename attribute */
- sprintf(new_attrname, "new attr %02u", u);
+ /* Write data into the attribute */
+ ret = H5Awrite(attr, H5T_NATIVE_UINT, &u);
+ CHECK(ret, FAIL, "H5Awrite");
- /* Rename attribute */
- ret = H5Arename_by_name(fid, DSET1_NAME, attrname, new_attrname, H5P_DEFAULT);
- CHECK(ret, FAIL, "H5Arename_by_name");
+ /* Close attribute */
+ ret = H5Aclose(attr);
+ CHECK(ret, FAIL, "H5Aclose");
- /* Check # of attributes */
- ret = H5Oget_info2(dataset, &oinfo, H5O_INFO_NUM_ATTRS);
- CHECK(ret, FAIL, "H5Oget_info");
- VERIFY(oinfo.num_attrs, (u + 1), "H5Oget_info");
- } /* end for */
+ /* Rename attribute */
+ sprintf(new_attrname, "new attr %02u", u);
- /* Check on dataset's attribute storage status */
- is_dense = H5O__is_attr_dense_test(dataset);
- VERIFY(is_dense, TRUE, "H5O__is_attr_dense_test");
+ /* Rename attribute */
+ ret = H5Arename_by_name(fid, DSET1_NAME, attrname, new_attrname, H5P_DEFAULT);
+ CHECK(ret, FAIL, "H5Arename_by_name");
+
+ /* Check # of attributes */
+ ret = H5Oget_info2(dataset, &oinfo, H5O_INFO_NUM_ATTRS);
+ CHECK(ret, FAIL, "H5Oget_info");
+ VERIFY(oinfo.num_attrs, (u + 1), "H5Oget_info");
+ } /* end for */
+
+ /* Check on dataset's attribute storage status */
+ is_dense = H5O__is_attr_dense_test(dataset);
+ VERIFY(is_dense, TRUE, "H5O__is_attr_dense_test");
+
+ /* Close Dataset */
+ ret = H5Dclose(dataset);
+ CHECK(ret, FAIL, "H5Dclose");
+
+ if(!use_corder) {
+ /* Unlink dataset with attributes */
+ ret = H5Ldelete(fid, DSET1_NAME, H5P_DEFAULT);
+ CHECK(ret, FAIL, "H5Ldelete");
+ }
+
+ } /* end for use_corder */
/* Close dataspace */
ret = H5Sclose(sid);
CHECK(ret, FAIL, "H5Sclose");
- /* Close Dataset */
- ret = H5Dclose(dataset);
- CHECK(ret, FAIL, "H5Dclose");
+ /* Close property list */
+ ret = H5Pclose(dcpl);
+ CHECK(ret, FAIL, "H5Pclose");
/* Close file */
ret = H5Fclose(fid);
@@ -2734,11 +2762,11 @@ test_attr_dense_rename(hid_t fcpl, hid_t fapl)
/* Re-open file */
fid = H5Fopen(FILENAME, H5F_ACC_RDWR, fapl);
- CHECK(fid, FAIL, "H5Fopen");
+ CHECK(fid, H5I_INVALID_HID, "H5Fopen");
/* Open dataset */
dataset = H5Dopen2(fid, DSET1_NAME, H5P_DEFAULT);
- CHECK(dataset, FAIL, "H5Dopen2");
+ CHECK(dataset, H5I_INVALID_HID, "H5Dopen2");
/* Verify renamed attributes */
for(u = 0; u < (max_compact * 2); u++) {
@@ -2747,7 +2775,7 @@ test_attr_dense_rename(hid_t fcpl, hid_t fapl)
/* Open attribute */
sprintf(attrname, "new attr %02u", u);
attr = H5Aopen(dataset, attrname, H5P_DEFAULT);
- CHECK(attr, FAIL, "H5Aopen");
+ CHECK(attr, H5I_INVALID_HID, "H5Aopen");
/* Read data from the attribute */
ret = H5Aread(attr, H5T_NATIVE_UINT, &value);
@@ -10037,7 +10065,7 @@ test_attr_bug2(hid_t fcpl, hid_t fapl)
hid_t tid; /* Datatype ID */
hid_t gcpl; /* Group creation property list */
hsize_t dims[2] = {10, 100}; /* Attribute dimensions */
- char aname[4]; /* Attribute name */
+ char aname[16]; /* Attribute name */
unsigned i; /* index */
herr_t ret; /* Generic return status */
htri_t tri_ret; /* htri_t return status */
diff --git a/test/testerror.sh.in b/test/testerror.sh.in
index 734b051..ac2a109 100644
--- a/test/testerror.sh.in
+++ b/test/testerror.sh.in
@@ -22,7 +22,9 @@ CMP='cmp -s'
DIFF='diff -c'
# Skip plugin module to test missing filter
-ENVCMD="env HDF5_PLUGIN_PRELOAD=::"
+# Also reset the VOL connector to only use the native connector, because of the
+# error stack checking. QAK - 2019/03/09
+ENVCMD="env HDF5_PLUGIN_PRELOAD=:: HDF5_VOL_CONNECTOR=native"
nerrors=0
verbose=yes
diff --git a/test/testexternal_env.sh.in b/test/testexternal_env.sh.in
new file mode 100644
index 0000000..3cc140d
--- /dev/null
+++ b/test/testexternal_env.sh.in
@@ -0,0 +1,42 @@
+#! /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 for external file with environment variable: HDF5_EXTFILE_PREFIX
+
+srcdir=@srcdir@
+
+nerrors=0
+
+##############################################################################
+##############################################################################
+### T H E T E S T S ###
+##############################################################################
+##############################################################################
+
+# test for external file with HDF5_EXTFILE_PREFIX
+echo "Testing external file with HDF5_EXTFILE_PREFIX"
+TEST_NAME=external_env # The test name
+TEST_BIN=`pwd`/$TEST_NAME # The path of the test binary
+ENVCMD="env HDF5_EXTFILE_PREFIX=\${ORIGIN}" # The environment variable & value
+#
+# Run the test
+# echo "$ENVCMD $RUNSERIAL $TEST_BIN"
+$ENVCMD $RUNSERIAL $TEST_BIN
+exitcode=$?
+if [ $exitcode -eq 0 ]; then
+ echo "Test prefix for HDF5_EXTFILE_PREFIX PASSED"
+ else
+ nerrors="`expr $nerrors + 1`"
+ echo "***Error encountered for HDF5_EXTFILE_PREFIX test***"
+fi
+exit $nerrors
diff --git a/test/testframe.c b/test/testframe.c
index 335118c..97b2d1f 100644
--- a/test/testframe.c
+++ b/test/testframe.c
@@ -15,7 +15,7 @@
* Programmer: Quincey Koziol <koziol@ncsa.uiuc.edu>
* Tuesday, January 6, 2004
*
- * Purpose: Provides support functions for the testing framework.
+ * Purpose: Provides support functions for the testing framework.
*
*/
@@ -28,24 +28,25 @@
#define MAXTESTDESC 64
typedef struct TestStruct {
- int NumErrors;
- char Description[MAXTESTDESC];
- int SkipFlag;
- char Name[MAXTESTNAME];
- void (*Call)(void);
- void (*Cleanup)(void);
- const void *Parameters;
+ int NumErrors;
+ char Description[MAXTESTDESC];
+ int SkipFlag;
+ char Name[MAXTESTNAME];
+ void (*Call)(void);
+ void (*Cleanup)(void);
+ const void *Parameters;
} TestStruct;
/*
* Variables used by testing framework.
*/
+static int enable_error_stack = 0; /* enable error stack; disable=0 enable=1 */
static int num_errs = 0; /* Total number of errors during testing */
int TestVerbosity = VERBO_DEF; /* Default Verbosity is Low */
-static int Summary = 0; /* Show test summary. Default is no. */
-static int CleanUp = 1; /* Do cleanup or not. Default is yes. */
-static int TestExpress = -1; /* Do TestExpress or not. -1 means not set yet. */
+static int Summary = 0; /* Show test summary. Default is no. */
+static int CleanUp = 1; /* Do cleanup or not. Default is yes. */
+static int TestExpress = -1; /* Do TestExpress or not. -1 means not set yet. */
static TestStruct *Test = NULL; /* Array of tests */
static unsigned TestAlloc = 0; /* Size of the Test array */
static unsigned Index = 0;
@@ -54,7 +55,7 @@ static const char *TestProgName = NULL;
static void (*TestPrivateUsage)(void) = NULL;
static int (*TestPrivateParser)(int ac, char *av[]) = NULL;
-
+
/*
* Setup a test function and add it to the list of tests.
* It must have no parameters and returns void.
@@ -74,12 +75,12 @@ AddTest(const char *TheName, void (*TheCall) (void), void (*Cleanup) (void), con
/* Sanity checking */
if (HDstrlen(TheDescr) >= MAXTESTDESC) {
printf("Test description ('%s') too long, increase MAXTESTDESC(%d).\n",
- TheDescr, MAXTESTDESC);
+ TheDescr, MAXTESTDESC);
exit(EXIT_FAILURE);
} /* end if */
if (HDstrlen(TheName) >= MAXTESTNAME) {
printf("Test name too long, increase MAXTESTNAME(%d).\n",
- MAXTESTNAME);
+ MAXTESTNAME);
exit(EXIT_FAILURE);
} /* end if */
@@ -102,12 +103,12 @@ AddTest(const char *TheName, void (*TheCall) (void), void (*Cleanup) (void), con
/* Set up test function */
HDstrcpy(Test[Index].Description, TheDescr);
if(*TheName != '-') {
- HDstrcpy(Test[Index].Name, TheName);
- Test[Index].SkipFlag = 0;
+ HDstrcpy(Test[Index].Name, TheName);
+ Test[Index].SkipFlag = 0;
}
- else { /* skip test by default */
- HDstrcpy(Test[Index].Name, TheName+1);
- Test[Index].SkipFlag = 1;
+ else { /* skip test by default */
+ HDstrcpy(Test[Index].Name, TheName+1);
+ Test[Index].SkipFlag = 1;
}
Test[Index].Call = TheCall;
Test[Index].Cleanup = Cleanup;
@@ -118,7 +119,7 @@ AddTest(const char *TheName, void (*TheCall) (void), void (*Cleanup) (void), con
Index++;
}
-
+
/*
* Initialize testing framework
*
@@ -130,8 +131,8 @@ AddTest(const char *TheName, void (*TheCall) (void), void (*Cleanup) (void), con
* private options. Default to NULL which means none is provided.
*
* Modifications:
- * Albert Cheng 2004/08/17
- * Added the ProgName, private_usage and private_parser arguments.
+ * Albert Cheng 2004/08/17
+ * Added the ProgName, private_usage and private_parser arguments.
*/
void TestInit(const char *ProgName, void (*private_usage)(void), int (*private_parser)(int ac, char *av[]))
{
@@ -140,7 +141,8 @@ void TestInit(const char *ProgName, void (*private_usage)(void), int (*private_p
* half the functions this test calls are private, so automatic error
* reporting wouldn't do much good since it's triggered at the API layer.
*/
- H5Eset_auto2(H5E_DEFAULT, NULL, NULL);
+ if (enable_error_stack == 0)
+ H5Eset_auto2(H5E_DEFAULT, NULL, NULL);
/*
* Record the program name and private routines if provided.
@@ -152,50 +154,50 @@ void TestInit(const char *ProgName, void (*private_usage)(void), int (*private_p
TestPrivateParser = private_parser;
}
-
+
/*
* Print test usage.
- * First print the common test options, then the extra options if provided.
+ * First print the common test options, then the extra options if provided.
*
* Modification:
- * 2004/08/18 Albert Cheng. Add TestPrivateUsage feature.
+ * 2004/08/18 Albert Cheng. Add TestPrivateUsage feature.
*/
void TestUsage(void)
{
- unsigned i;
-
- print_func("Usage: %s [-v[erbose] (l[ow]|m[edium]|h[igh]|0-9)] %s\n",
- TestProgName, (TestPrivateUsage ? "<extra options>" : ""));
- print_func(" [-[e]x[clude] name]+ \n");
- print_func(" [-o[nly] name]+ \n");
- print_func(" [-b[egin] name] \n");
- print_func(" [-s[ummary]] \n");
- print_func(" [-c[leanoff]] \n");
- print_func(" [-h[elp]] \n");
- print_func("\n\n");
- print_func("verbose controls the amount of information displayed\n");
- print_func("exclude to exclude tests by name\n");
- print_func("only to name tests which should be run\n");
- print_func("begin start at the name of the test givin\n");
- print_func("summary prints a summary of test results at the end\n");
- print_func("cleanoff does not delete *.hdf files after execution of tests\n");
- print_func("help print out this information\n");
- if (TestPrivateUsage){
- print_func("\nExtra options\n");
- TestPrivateUsage();
- }
- print_func("\n\n");
- print_func("This program currently tests the following: \n\n");
- print_func("%16s %s\n", "Name", "Description");
- print_func("%16s %s\n", "----", "-----------");
-
- for (i = 0; i < Index; i++)
- print_func("%16s %s\n", Test[i].Name, Test[i].Description);
-
- print_func("\n\n");
+ unsigned i;
+
+ print_func("Usage: %s [-v[erbose] (l[ow]|m[edium]|h[igh]|0-9)] %s\n",
+ TestProgName, (TestPrivateUsage ? "<extra options>" : ""));
+ print_func(" [-[e]x[clude] name]+ \n");
+ print_func(" [-o[nly] name]+ \n");
+ print_func(" [-b[egin] name] \n");
+ print_func(" [-s[ummary]] \n");
+ print_func(" [-c[leanoff]] \n");
+ print_func(" [-h[elp]] \n");
+ print_func("\n\n");
+ print_func("verbose controls the amount of information displayed\n");
+ print_func("exclude to exclude tests by name\n");
+ print_func("only to name tests which should be run\n");
+ print_func("begin start at the name of the test givin\n");
+ print_func("summary prints a summary of test results at the end\n");
+ print_func("cleanoff does not delete *.hdf files after execution of tests\n");
+ print_func("help print out this information\n");
+ if (TestPrivateUsage){
+ print_func("\nExtra options\n");
+ TestPrivateUsage();
+ }
+ print_func("\n\n");
+ print_func("This program currently tests the following: \n\n");
+ print_func("%16s %s\n", "Name", "Description");
+ print_func("%16s %s\n", "----", "-----------");
+
+ for (i = 0; i < Index; i++)
+ print_func("%16s %s\n", Test[i].Name, Test[i].Description);
+
+ print_func("\n\n");
}
-
+
/*
* Print test info.
*/
@@ -209,7 +211,7 @@ void TestInfo(const char *ProgName)
print_func("Linked with hdf5 version %u.%u release %u\n", major, minor, release);
}
-
+
/*
* Parse command line information.
* argc, argv: the usual command line argument count and strings
@@ -218,7 +220,7 @@ void TestInfo(const char *ProgName)
* exit EXIT_FAILURE if error is encountered.
*
* Modification:
- * 2004/08/18 Albert Cheng. Add extra_parse feature.
+ * 2004/08/18 Albert Cheng. Add extra_parse feature.
*/
void TestParseCmdLine(int argc, char *argv[])
{
@@ -226,80 +228,82 @@ void TestParseCmdLine(int argc, char *argv[])
int ret_code;
while (argv++, --argc > 0){
- if ((HDstrcmp(*argv, "-verbose") == 0) ||
- (HDstrcmp(*argv, "-v") == 0)) {
- if (argc > 0){
- --argc; ++argv;
- ParseTestVerbosity(*argv);
- }else{
- TestUsage();
- exit(EXIT_FAILURE);
- }
- }
- else if (((HDstrcmp(*argv, "-exclude") == 0) ||
- (HDstrcmp(*argv, "-x") == 0))) {
- if (argc > 0){
- --argc; ++argv;
- SetTest(*argv, SKIPTEST);
- }else{
- TestUsage();
- exit(EXIT_FAILURE);
- }
- }
- else if (((HDstrcmp(*argv, "-begin") == 0) ||
- (HDstrcmp(*argv, "-b") == 0))) {
- if (argc > 0){
- --argc; ++argv;
- SetTest(*argv, BEGINTEST);
- }else{
- TestUsage();
- exit(EXIT_FAILURE);
- }
- }
- else if (((HDstrcmp(*argv, "-only") == 0) ||
- (HDstrcmp(*argv, "-o") == 0))) {
- if(argc > 0) {
- unsigned Loop;
-
- --argc; ++argv;
-
- /* Skip all tests, then activate only one. */
+ if ((HDstrcmp(*argv, "-verbose") == 0) ||
+ (HDstrcmp(*argv, "-v") == 0)) {
+ if (argc > 0){
+ --argc; ++argv;
+ ParseTestVerbosity(*argv);
+ }else{
+ TestUsage();
+ exit(EXIT_FAILURE);
+ }
+ }
+ else if (((HDstrcmp(*argv, "-exclude") == 0) ||
+ (HDstrcmp(*argv, "-x") == 0))) {
+ if (argc > 0){
+ --argc; ++argv;
+ SetTest(*argv, SKIPTEST);
+ }else{
+ TestUsage();
+ exit(EXIT_FAILURE);
+ }
+ }
+ else if (((HDstrcmp(*argv, "-begin") == 0) ||
+ (HDstrcmp(*argv, "-b") == 0))) {
+ if (argc > 0){
+ --argc; ++argv;
+ SetTest(*argv, BEGINTEST);
+ }else{
+ TestUsage();
+ exit(EXIT_FAILURE);
+ }
+ }
+ else if (((HDstrcmp(*argv, "-only") == 0) ||
+ (HDstrcmp(*argv, "-o") == 0))) {
+ if(argc > 0) {
+ unsigned Loop;
+
+ --argc; ++argv;
+
+ /* Skip all tests, then activate only one. */
if(!skipped_all) {
for(Loop = 0; Loop < Index; Loop++)
Test[Loop].SkipFlag = 1;
skipped_all = TRUE;
} /* end if */
- SetTest(*argv, ONLYTEST);
- } /* end if */
+ SetTest(*argv, ONLYTEST);
+ } /* end if */
else {
- TestUsage();
- exit(EXIT_FAILURE);
- }
- }
- else if ((HDstrcmp(*argv, "-summary") == 0) || (HDstrcmp(*argv, "-s") == 0))
- Summary = 1;
- else if ((HDstrcmp(*argv, "-help") == 0) || (HDstrcmp(*argv, "-h") == 0)) {
- TestUsage();
- exit(EXIT_SUCCESS);
+ TestUsage();
+ exit(EXIT_FAILURE);
}
- else if ((HDstrcmp(*argv, "-cleanoff") == 0) || (HDstrcmp(*argv, "-c") == 0))
- SetTestNoCleanup();
- else {
- /* non-standard option. Break out. */
- break;
- }
+ }
+ else if ((HDstrcmp(*argv, "-summary") == 0) || (HDstrcmp(*argv, "-s") == 0))
+ Summary = 1;
+ else if (HDstrcmp(*argv, "-enable-error-stack") == 0)
+ enable_error_stack = 1;
+ else if ((HDstrcmp(*argv, "-help") == 0) || (HDstrcmp(*argv, "-h") == 0)) {
+ TestUsage();
+ exit(EXIT_SUCCESS);
+ }
+ else if ((HDstrcmp(*argv, "-cleanoff") == 0) || (HDstrcmp(*argv, "-c") == 0))
+ SetTestNoCleanup();
+ else {
+ /* non-standard option. Break out. */
+ break;
+ }
}
/* Call extra parsing function if provided. */
if (NULL != TestPrivateParser){
- ret_code=TestPrivateParser(argc+1, argv-1);
- if (ret_code != 0)
- exit(EXIT_FAILURE);
+ ret_code=TestPrivateParser(argc+1, argv-1);
+ if (ret_code != 0)
+ exit(EXIT_FAILURE);
}
}
-
+
/*
* Perform Tests.
*/
@@ -314,10 +318,10 @@ void PerformTests(void)
MESSAGE(2, ("Testing -- %s (%s) \n", Test[Loop].Description, Test[Loop].Name));
MESSAGE(5, ("===============================================\n"));
Test[Loop].NumErrors = num_errs;
- Test_parameters = Test[Loop].Parameters;
- ALARM_ON;
+ Test_parameters = Test[Loop].Parameters;
+ ALARM_ON;
Test[Loop].Call();
- ALARM_OFF;
+ ALARM_OFF;
Test[Loop].NumErrors = num_errs - Test[Loop].NumErrors;
MESSAGE(5, ("===============================================\n"));
MESSAGE(5, ("There were %d errors detected.\n\n", (int)Test[Loop].NumErrors));
@@ -332,7 +336,7 @@ void PerformTests(void)
print_func("All tests were successful. \n\n");
}
-
+
/*
* Display test summary.
*/
@@ -354,7 +358,7 @@ void TestSummary(void)
print_func("\n\n");
}
-
+
/*
* Cleanup files from testing
*/
@@ -370,7 +374,7 @@ void TestCleanup(void)
Test[Loop].Cleanup();
}
-
+
/*
* Shutdown the test infrastructure
*/
@@ -380,7 +384,7 @@ void TestShutdown(void)
HDfree(Test);
}
-
+
/*
* Retrieve the verbosity level for the testing framework
*/
@@ -504,16 +508,16 @@ int SetTestNoCleanup(void)
void ParseTestVerbosity(char *argv)
{
if (*argv == 'l')
- SetTestVerbosity(VERBO_LO);
+ SetTestVerbosity(VERBO_LO);
else if (*argv == 'm')
- SetTestVerbosity(VERBO_MED);
+ SetTestVerbosity(VERBO_MED);
else if (*argv == 'h')
- SetTestVerbosity(VERBO_HI);
+ SetTestVerbosity(VERBO_HI);
else
- SetTestVerbosity(atoi(argv));
+ SetTestVerbosity(atoi(argv));
}
-
+
/*
* Retrieve the number of testing errors for the testing framework
*/
@@ -522,7 +526,7 @@ H5_ATTR_PURE int GetTestNumErrs(void)
return(num_errs);
}
-
+
/*
* Increment the number of testing errors
*/
@@ -531,7 +535,7 @@ void IncTestNumErrs(void)
num_errs++;
}
-
+
/*
* Retrieve the current Test Parameters pointer.
*/
@@ -540,7 +544,7 @@ H5_ATTR_PURE const void *GetTestParameters(void)
return(Test_parameters);
}
-
+
/*
* This routine is designed to provide equivalent functionality to 'printf'
* and also increment the error count for the testing framework.
@@ -563,7 +567,7 @@ TestErrPrintf(const char *format, ...)
return ret_value;
}
-
+
/*
* Set (control) which test will be tested.
* SKIPTEST: skip this test
@@ -576,41 +580,41 @@ void SetTest(const char *testname, int action)
unsigned Loop;
switch (action){
- case SKIPTEST:
- for (Loop = 0; Loop < Index; Loop++)
- if (HDstrcmp(testname, Test[Loop].Name) == 0){
- Test[Loop].SkipFlag = 1;
- break;
- }
- break;
- case BEGINTEST:
- for (Loop = 0; Loop < Index; Loop++) {
- if (HDstrcmp(testname, Test[Loop].Name) != 0)
- Test[Loop].SkipFlag = 1;
- else{
- /* Found it. Set it to run. Done. */
- Test[Loop].SkipFlag = 0;
- break;
- }
- }
- break;
- case ONLYTEST:
- for (Loop = 0; Loop < Index; Loop++) {
- if (HDstrcmp(testname, Test[Loop].Name) == 0) {
- /* Found it. Set it to run. Break to skip the rest. */
- Test[Loop].SkipFlag = 0;
- break;
- }
- }
- break;
- default:
- /* error */
- printf("*** ERROR: Unknown action (%d) for SetTest\n", action);
- break;
+ case SKIPTEST:
+ for (Loop = 0; Loop < Index; Loop++)
+ if (HDstrcmp(testname, Test[Loop].Name) == 0){
+ Test[Loop].SkipFlag = 1;
+ break;
+ }
+ break;
+ case BEGINTEST:
+ for (Loop = 0; Loop < Index; Loop++) {
+ if (HDstrcmp(testname, Test[Loop].Name) != 0)
+ Test[Loop].SkipFlag = 1;
+ else{
+ /* Found it. Set it to run. Done. */
+ Test[Loop].SkipFlag = 0;
+ break;
+ }
+ }
+ break;
+ case ONLYTEST:
+ for (Loop = 0; Loop < Index; Loop++) {
+ if (HDstrcmp(testname, Test[Loop].Name) == 0) {
+ /* Found it. Set it to run. Break to skip the rest. */
+ Test[Loop].SkipFlag = 0;
+ break;
+ }
+ }
+ break;
+ default:
+ /* error */
+ printf("*** ERROR: Unknown action (%d) for SetTest\n", action);
+ break;
}
}
-
+
/*
* Enable alarm on test execution, configurable by environment variable
*/
diff --git a/test/testvds_env.sh.in b/test/testvds_env.sh.in
new file mode 100644
index 0000000..894e52e
--- /dev/null
+++ b/test/testvds_env.sh.in
@@ -0,0 +1,44 @@
+#! /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 for external file with environment variable: HDF5_VDS_PREFIX
+
+srcdir=@srcdir@
+
+nerrors=0
+
+##############################################################################
+##############################################################################
+### T H E T E S T S ###
+##############################################################################
+##############################################################################
+
+# test for VDS with HDF5_VDS_PREFIX
+echo "Testing basic virtual dataset I/O via H5Pset_vds_prefix(): all selection with ENV prefix"
+TEST_NAME=vds_env # The test name
+TEST_BIN=`pwd`/$TEST_NAME # The path of the test binary
+ENVCMD="env HDF5_VDS_PREFIX=\${ORIGIN}/tmp" # Set the environment variable & value
+UNENVCMD="unset HDF5_VDS_PREFIX" # Unset the environment variable & value
+#
+# Run the test
+# echo "$ENVCMD $RUNSERIAL $TEST_BIN"
+$ENVCMD $RUNSERIAL $TEST_BIN
+exitcode=$?
+if [ $exitcode -eq 0 ]; then
+ echo "Test prefix for HDF5_VDS_PREFIX PASSED"
+ else
+ nerrors="`expr $nerrors + 1`"
+ echo "***Error encountered for HDF5_VDS_PREFIX test***"
+fi
+$UNENVCMD
+exit $nerrors
diff --git a/test/tfile.c b/test/tfile.c
index c5e913c..c15064a 100644
--- a/test/tfile.c
+++ b/test/tfile.c
@@ -169,6 +169,15 @@ const char *FILESPACE_NAME[] = {
NULL
};
+
+/* Declarations for test_libver_bounds_copy(): */
+/* SRC_FILE: source file created under 1.8 branch with latest format */
+/* DST_FILE: destination file for copying the dataset in SRC_FILE */
+/* DSET_DS1: the dataset created in SRC_FILE to be copied to DST_FILE */
+#define SRC_FILE "fill18.h5"
+#define DST_FILE "fill18_copy.h5"
+#define DSET_DS1 "DS1"
+
/* Local test function declarations for version bounds */
static void test_libver_bounds_low_high(void);
static void test_libver_bounds_super(hid_t fapl);
@@ -1437,6 +1446,7 @@ test_obj_count_and_id(hid_t fid1, hid_t fid2, hid_t did, hid_t gid1,
case H5I_ERROR_CLASS:
case H5I_ERROR_MSG:
case H5I_ERROR_STACK:
+ case H5I_SPACE_SEL_ITER:
case H5I_NTYPES:
default:
ERROR("H5Fget_obj_ids");
@@ -1594,54 +1604,72 @@ test_file_perm2(void)
** H5Fis_accessible() API call.
**
*****************************************************************/
+#define FILE_IS_ACCESSIBLE "tfile_is_accessible"
static void
test_file_is_accessible(const char *env_h5_drvr)
{
- hid_t fid; /* File opened with read-write permission */
- hid_t fcpl_id; /* File creation property list */
- hid_t fapl = -1; /* File access property list */
- int fd; /* POSIX file descriptor */
- char filename[FILENAME_LEN]; /* Filename to use */
- ssize_t nbytes; /* Number of bytes written */
- unsigned u; /* Local index variable */
- unsigned char buf[1024]; /* Buffer of data to write */
- htri_t status; /* Whether a file is an HDF5 file */
- hbool_t single_file_vfd; /* Whether VFD used is a single file */
- herr_t ret;
+ hid_t fid = H5I_INVALID_HID; /* File opened with read-write permission */
+ hid_t fcpl_id = H5I_INVALID_HID; /* File creation property list */
+ hid_t fapl_id = H5I_INVALID_HID; /* File access property list */
+ int fd; /* POSIX file descriptor */
+ char filename[FILENAME_LEN]; /* Filename to use */
+ char sb_filename[FILENAME_LEN]; /* Name of file w/ superblock */
+ ssize_t nbytes; /* Number of bytes written */
+ unsigned u; /* Local index variable */
+ unsigned char buf[1024]; /* Buffer of data to write */
+ htri_t is_hdf5; /* Whether a file is an HDF5 file */
+ int posix_ret; /* Return value from POSIX calls */
+ herr_t ret; /* Return value from HDF5 calls */
/* Output message about test being performed */
MESSAGE(5, ("Testing Detection of HDF5 Files\n"));
/* Get FAPL */
- fapl = h5_fileaccess();
- CHECK(fapl, FAIL, "H5Pcreate");
- h5_fixname(FILE1, fapl, filename, sizeof filename);
+ fapl_id = h5_fileaccess();
+ CHECK(fapl_id, H5I_INVALID_HID, "H5Pcreate");
+
+ /* Fix up filenames
+ * For VFDs that create multiple files, we also need the name
+ * of the file with the superblock. With single-file VFDs, this
+ * will be equal to the one from h5_fixname().
+ */
+ h5_fixname(FILE_IS_ACCESSIBLE, fapl_id, filename, sizeof(filename));
+ h5_fixname_superblock(FILE_IS_ACCESSIBLE, fapl_id, sb_filename, sizeof(filename));
+
+ /****************/
+ /* Normal usage */
+ /****************/
/* Create a file */
- fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl);
- CHECK(fid, FAIL, "H5Fcreate");
+ fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl_id);
+ CHECK(fid, H5I_INVALID_HID, "H5Fcreate");
/* Close file */
ret = H5Fclose(fid);
CHECK(ret, FAIL, "H5Fclose");
/* Verify that the file is an HDF5 file */
- status = H5Fis_accessible(filename, fapl);
- VERIFY(status, TRUE, "H5Fis_accessible");
+ is_hdf5 = H5Fis_accessible(filename, fapl_id);
+ VERIFY(is_hdf5, TRUE, "H5Fis_accessible");
+ /*******************************/
+ /* Non-default user block size */
+ /*******************************/
- /* This test is not currently working for the family VFD */
+ /* This test is not currently working for the family VFD.
+ * There are failures when creating files with userblocks.
+ */
if(0 != HDstrcmp(env_h5_drvr, "family")) {
/* Create a file creation property list with a non-default user block size */
fcpl_id = H5Pcreate(H5P_FILE_CREATE);
- CHECK(fcpl_id, FAIL, "H5Pcreate");
+ CHECK(fcpl_id, H5I_INVALID_HID, "H5Pcreate");
ret = H5Pset_userblock(fcpl_id, (hsize_t)2048);
CHECK(ret, FAIL, "H5Pset_userblock");
/* Create file with non-default user block */
- fid = H5Fcreate(filename, H5F_ACC_TRUNC, fcpl_id, fapl);
- CHECK(fid, FAIL, "H5Fcreate");
+ fid = H5Fcreate(filename, H5F_ACC_TRUNC, fcpl_id, fapl_id);
+ CHECK(fid, H5I_INVALID_HID, "H5Fcreate");
/* Release file-creation property list */
ret = H5Pclose(fcpl_id);
@@ -1652,37 +1680,56 @@ test_file_is_accessible(const char *env_h5_drvr)
CHECK(ret, FAIL, "H5Fclose");
/* Verify that the file is an HDF5 file */
- status = H5Fis_accessible(filename, fapl);
- VERIFY(status, TRUE, "H5Fis_accessible");
+ is_hdf5 = H5Fis_accessible(filename, fapl_id);
+ VERIFY(is_hdf5, TRUE, "H5Fis_accessible");
} /* end if */
+ /***********************/
+ /* EMPTY non-HDF5 file */
+ /***********************/
- /* This test only works for VFDs with a single file */
- single_file_vfd = (hbool_t)(HDstrcmp(env_h5_drvr, "split") && HDstrcmp(env_h5_drvr, "multi") && HDstrcmp(env_h5_drvr, "family"));
- if(single_file_vfd) {
- /* Create non-HDF5 file and check it */
- fd = HDopen(filename, O_RDWR|O_CREAT|O_TRUNC, H5_POSIX_CREATE_MODE_RW);
- CHECK(fd, FAIL, "HDopen");
+ /* Create non-HDF5 file and check it */
+ fd = HDopen(sb_filename, O_RDWR | O_CREAT | O_TRUNC, H5_POSIX_CREATE_MODE_RW);
+ CHECK(fd, (-1), "HDopen");
- /* Initialize information to write */
- for (u=0; u<1024; u++)
- buf[u]=(unsigned char)u;
+ /* Close the file */
+ posix_ret = HDclose(fd);
+ CHECK(posix_ret, (-1), "HDclose");
- /* Write some information */
- nbytes = HDwrite(fd, buf, (size_t)1024);
- VERIFY(nbytes, 1024, "HDwrite");
+ /* Verify that the file is NOT an HDF5 file */
+ is_hdf5 = H5Fis_accessible(filename, fapl_id);
+ VERIFY(is_hdf5, FALSE, "H5Fis_accessible (empty non-HDF5 file)");
- /* Close the file */
- ret = HDclose(fd);
- CHECK(ret, FAIL, "HDclose");
+ /***************************/
+ /* Non-empty non-HDF5 file */
+ /***************************/
- /* Verify that the file is not an HDF5 file */
- status = H5Fis_accessible(filename, fapl);
- VERIFY(status, FALSE, "H5Fis_accessible");
- } /* end if */
+ /* Create non-HDF5 file and check it */
+ fd = HDopen(sb_filename, O_RDWR | O_CREAT | O_TRUNC, H5_POSIX_CREATE_MODE_RW);
+ CHECK(fd, (-1), "HDopen");
+
+ /* Initialize information to write */
+ for (u = 0; u < 1024; u++)
+ buf[u]=(unsigned char)u;
+
+ /* Write some information */
+ nbytes = HDwrite(fd, buf, (size_t)1024);
+ VERIFY(nbytes, 1024, "HDwrite");
+
+ /* Close the file */
+ posix_ret = HDclose(fd);
+ CHECK(posix_ret, (-1), "HDclose");
+
+ /* Verify that the file is not an HDF5 file */
+ is_hdf5 = H5Fis_accessible(filename, fapl_id);
+ VERIFY(is_hdf5, FALSE, "H5Fis_accessible (non-HDF5 file)");
+
+
+ /* Clean up files */
+ h5_delete_test_file(filename, fapl_id);
/* Close property list */
- ret = H5Pclose(fapl);
+ ret = H5Pclose(fapl_id);
CHECK(ret, FAIL, "H5Pclose");
} /* end test_file_is_accessible() */
@@ -1697,70 +1744,97 @@ test_file_is_accessible(const char *env_h5_drvr)
*****************************************************************/
#ifndef H5_NO_DEPRECATED_SYMBOLS
static void
-test_file_ishdf5(void)
+test_file_ishdf5(const char *env_h5_drvr)
{
- hid_t file; /* File opened with read-write permission */
- hid_t fcpl; /* File creation property list */
- hid_t fapl = -1; /* File access property list */
- int fd; /* File Descriptor */
- char filename[FILENAME_LEN]; /* Filename to use */
- ssize_t nbytes; /* Number of bytes written */
- unsigned u; /* Local index variable */
- unsigned char buf[1024]; /* Buffer of data to write */
- htri_t status; /* Whether a file is an HDF5 file */
- herr_t ret;
+ hid_t fid = H5I_INVALID_HID; /* File opened with read-write permission */
+ hid_t fcpl_id = H5I_INVALID_HID; /* File creation property list */
+ hid_t fapl_id = H5I_INVALID_HID; /* File access property list */
+ int fd; /* POSIX file descriptor */
+ char filename[FILENAME_LEN]; /* Filename to use */
+ char sb_filename[FILENAME_LEN]; /* Name of file w/ superblock */
+ ssize_t nbytes; /* Number of bytes written */
+ unsigned u; /* Local index variable */
+ unsigned char buf[1024]; /* Buffer of data to write */
+ htri_t is_hdf5; /* Whether a file is an HDF5 file */
+ int posix_ret; /* Return value from POSIX calls */
+ herr_t ret; /* Return value from HDF5 calls */
/* Output message about test being performed */
MESSAGE(5, ("Testing Detection of HDF5 Files (using deprecated H5Fis_hdf5() call)\n"));
/* Get FAPL */
- fapl = h5_fileaccess();
- CHECK(fapl, FAIL, "H5Pcreate");
- h5_fixname(FILE1, fapl, filename, sizeof filename);
+ fapl_id = h5_fileaccess();
+ CHECK(fapl_id, H5I_INVALID_HID, "H5Pcreate");
+
+ /* Fix up filenames
+ * For VFDs that create multiple files, we also need the name
+ * of the file with the superblock. With single-file VFDs, this
+ * will be equal to the one from h5_fixname().
+ */
+ h5_fixname(FILE_IS_ACCESSIBLE, fapl_id, filename, sizeof(filename));
+ h5_fixname_superblock(FILE_IS_ACCESSIBLE, fapl_id, sb_filename, sizeof(filename));
+
+ /****************/
+ /* Normal usage */
+ /****************/
/* Create a file */
- file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl);
- CHECK(file, FAIL, "H5Fcreate");
+ fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl_id);
+ CHECK(fid, H5I_INVALID_HID, "H5Fcreate");
/* Close file */
- ret = H5Fclose(file);
+ ret = H5Fclose(fid);
CHECK(ret, FAIL, "H5Fclose");
/* Verify that the file is an HDF5 file */
- status = H5Fis_hdf5(filename);
- VERIFY(status, TRUE, "H5Fis_hdf5");
+ is_hdf5 = H5Fis_hdf5(sb_filename);
+ VERIFY(is_hdf5, TRUE, "H5Fis_hdf5");
+ /*******************************/
+ /* Non-default user block size */
+ /*******************************/
- /* Create a file creation property list with a non-default user block size */
- fcpl = H5Pcreate(H5P_FILE_CREATE);
- CHECK(fcpl, FAIL, "H5Pcreate");
+ /* This test is not currently working for the family VFD.
+ * There are failures when creating files with userblocks.
+ */
+ if(0 != HDstrcmp(env_h5_drvr, "family")) {
+ /* Create a file creation property list with a non-default user block size */
+ fcpl_id = H5Pcreate(H5P_FILE_CREATE);
+ CHECK(fcpl_id, H5I_INVALID_HID, "H5Pcreate");
- ret = H5Pset_userblock(fcpl, (hsize_t)2048);
- CHECK(ret, FAIL, "H5Pset_userblock");
+ ret = H5Pset_userblock(fcpl_id, (hsize_t)2048);
+ CHECK(ret, FAIL, "H5Pset_userblock");
- /* Create file with non-default user block */
- file = H5Fcreate(filename, H5F_ACC_TRUNC, fcpl, fapl);
- CHECK(file, FAIL, "H5Fcreate");
+ /* Create file with non-default user block */
+ fid = H5Fcreate(filename, H5F_ACC_TRUNC, fcpl_id, fapl_id);
+ CHECK(fid, H5I_INVALID_HID, "H5Fcreate");
- /* Release file-creation property list */
- ret = H5Pclose(fcpl);
- CHECK(ret, FAIL, "H5Pclose");
+ /* Release file creation property list */
+ ret = H5Pclose(fcpl_id);
+ CHECK(ret, FAIL, "H5Pclose");
- /* Close file */
- ret = H5Fclose(file);
- CHECK(ret, FAIL, "H5Fclose");
+ /* Close file */
+ ret = H5Fclose(fid);
+ CHECK(ret, FAIL, "H5Fclose");
- /* Verify that the file is an HDF5 file */
- status = H5Fis_hdf5(filename);
- VERIFY(status, TRUE, "H5Fis_hdf5");
+ /* Verify that the file is an HDF5 file */
+ is_hdf5 = H5Fis_hdf5(sb_filename);
+ VERIFY(is_hdf5, TRUE, "H5Fis_hdf5");
+ } /* end if */
+ /***************************/
+ /* Non-empty non-HDF5 file */
+ /***************************/
- /* Create non-HDF5 file and check it */
- fd = HDopen(filename, O_RDWR|O_CREAT|O_TRUNC, H5_POSIX_CREATE_MODE_RW);
- CHECK(fd, FAIL, "HDopen");
+ /* Create non-HDF5 file. Use the calculated superblock
+ * filename to avoid the format strings that will make
+ * open(2) sad.
+ */
+ fd = HDopen(sb_filename, O_RDWR | O_CREAT | O_TRUNC, H5_POSIX_CREATE_MODE_RW);
+ CHECK(fd, (-1), "HDopen");
/* Initialize information to write */
- for(u=0; u<1024; u++)
+ for(u = 0; u < 1024; u++)
buf[u]=(unsigned char)u;
/* Write some information */
@@ -1768,20 +1842,120 @@ test_file_ishdf5(void)
VERIFY(nbytes, 1024, "HDwrite");
/* Close the file */
- ret = HDclose(fd);
- CHECK(ret, FAIL, "HDclose");
+ posix_ret = HDclose(fd);
+ CHECK(posix_ret, (-1), "HDclose");
/* Verify that the file is not an HDF5 file */
- status = H5Fis_hdf5(filename);
- VERIFY(status, FALSE, "H5Fis_hdf5");
+ is_hdf5 = H5Fis_hdf5(sb_filename);
+ VERIFY(is_hdf5, FALSE, "H5Fis_hdf5");
+
+
+ /* Clean up files */
+ h5_delete_test_file(filename, fapl_id);
/* Close property list */
- ret = H5Pclose(fapl);
+ ret = H5Pclose(fapl_id);
CHECK(ret, FAIL, "H5Pclose");
} /* end test_file_ishdf5() */
#endif /* H5_NO_DEPRECATED_SYMBOLS */
+
+/****************************************************************
+**
+** test_file_delete(): tests H5Fdelete for all VFDs
+**
+*****************************************************************/
+#define FILE_DELETE "test_file_delete"
+#define FILE_DELETE_NOT_HDF5 "test_file_delete_not_hdf5"
+static void
+test_file_delete(hid_t fapl_id)
+{
+ hid_t fid = H5I_INVALID_HID; /* File to be deleted */
+ char filename[FILENAME_LEN]; /* Filename to use */
+ htri_t is_hdf5; /* Whether a file is an HDF5 file */
+ int fd; /* POSIX file descriptor */
+ int iret;
+ herr_t ret;
+
+ /* Output message about test being performed */
+ MESSAGE(5, ("Testing Deletion of HDF5 Files\n"));
+
+ /*************/
+ /* HDF5 FILE */
+ /*************/
+
+ /* This is just a placeholder until the native VOL connector supports
+ * H5Fdelete().
+ */
+
+ /* Get fapl-dependent filename */
+ h5_fixname(FILE_DELETE, fapl_id, filename, sizeof(filename));
+
+ /* Create a file */
+ fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl_id);
+ CHECK(fid, H5I_INVALID_HID, "H5Fcreate");
+
+ /* Close file */
+ ret = H5Fclose(fid);
+ VERIFY(ret, SUCCEED, "H5Fclose");
+
+ /* Verify that the file is an HDF5 file */
+ is_hdf5 = H5Fis_accessible(filename, fapl_id);
+ VERIFY(is_hdf5, TRUE, "H5Fis_accessible");
+
+ /* Attempt to delete the file - should fail */
+ H5E_BEGIN_TRY {
+ ret = H5Fdelete(filename, fapl_id);
+ } H5E_END_TRY;
+ VERIFY(ret, FAIL, "H5Fdelete");
+
+ /* Verify that the file still exists */
+ is_hdf5 = H5Fis_accessible(filename, fapl_id);
+ VERIFY(is_hdf5, TRUE, "H5Fis_accessible");
+
+ /* Actually delete the test file */
+ h5_delete_test_file(FILE_DELETE, fapl_id);
+
+ /*****************/
+ /* NON-HDF5 FILE */
+ /*****************/
+
+ /* Get fapl-dependent filename */
+ h5_fixname(FILE_DELETE_NOT_HDF5, fapl_id, filename, sizeof(filename));
+
+ /* Create a non-HDF5 file */
+ fd = HDopen(filename, O_RDWR | O_CREAT | O_TRUNC, H5_POSIX_CREATE_MODE_RW);
+ CHECK_I(fd, "HDopen");
+
+ /* Close the file */
+ ret = HDclose(fd);
+ VERIFY(ret, 0, "HDclose");
+
+ /* Verify that the file is not an HDF5 file */
+ /* Note that you can get a FAIL result when h5_fixname()
+ * perturbs the filename as a file with that exact name
+ * may not have been created since we created it with
+ * open(2) and not the library.
+ */
+ H5E_BEGIN_TRY {
+ is_hdf5 = H5Fis_accessible(filename, fapl_id);
+ } H5E_END_TRY;
+ CHECK(is_hdf5, TRUE, "H5Fis_accessible");
+
+ /* Try to delete it (should fail) */
+ H5E_BEGIN_TRY {
+ ret = H5Fdelete(filename, fapl_id);
+ } H5E_END_TRY;
+ VERIFY(ret, FAIL, "H5Fdelete");
+
+ /* Delete the file */
+ iret = HDremove(filename);
+ VERIFY(iret, 0, "HDremove");
+
+} /* end test_file_delete() */
+
+
/****************************************************************
**
** test_file_open_dot(): low-level file test routine.
@@ -1921,6 +2095,7 @@ test_file_open_overlap(void)
hid_t sid;
ssize_t nobjs; /* # of open objects */
unsigned intent;
+ unsigned long fileno1, fileno2; /* File number */
herr_t ret; /* Generic return value */
/* Output message about test being performed */
@@ -1939,6 +2114,19 @@ test_file_open_overlap(void)
CHECK(ret, FAIL, "H5Fget_intent");
VERIFY(intent, H5F_ACC_RDWR, "H5Fget_intent");
+ /* Check the file numbers */
+ fileno1 = 0;
+ ret = H5Fget_fileno(fid1, &fileno1);
+ CHECK(ret, FAIL, "H5Fget_fileno");
+ fileno2 = 0;
+ ret = H5Fget_fileno(fid2, &fileno2);
+ CHECK(ret, FAIL, "H5Fget_fileno");
+ VERIFY(fileno1, fileno2, "H5Fget_fileno");
+
+ /* Check that a file number pointer of NULL is ignored */
+ ret = H5Fget_fileno(fid1, NULL);
+ CHECK(ret, FAIL, "H5Fget_fileno");
+
/* Create a group in file */
gid = H5Gcreate2(fid1, GROUP1, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
CHECK(gid, FAIL, "H5Gcreate2");
@@ -2652,6 +2840,7 @@ test_userblock_file_size(void)
hid_t fcpl2_id;
hsize_t dims[2] = {3, 4};
hsize_t filesize1, filesize2, filesize;
+ unsigned long fileno1, fileno2; /* File number */
herr_t ret; /* Generic return value */
/* Output message about test being performed */
@@ -2669,6 +2858,15 @@ test_userblock_file_size(void)
file2_id = H5Fcreate(FILE2, H5F_ACC_TRUNC, fcpl2_id, H5P_DEFAULT);
CHECK(file2_id, FAIL, "H5Fcreate");
+ /* Check the file numbers */
+ fileno1 = 0;
+ ret = H5Fget_fileno(file1_id, &fileno1);
+ CHECK(ret, FAIL, "H5Fget_fileno");
+ fileno2 = 0;
+ ret = H5Fget_fileno(file2_id, &fileno2);
+ CHECK(ret, FAIL, "H5Fget_fileno");
+ CHECK(fileno1, fileno2, "H5Fget_fileno");
+
/* Create groups */
group1_id = H5Gcreate2(file1_id, GROUP1, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
CHECK(group1_id, FAIL, "H5Gcreate2");
@@ -5148,7 +5346,7 @@ test_libver_bounds_open(void)
/* Opening VERBFNAME in these combination should succeed.
For each low bound, verify that it is upgraded properly */
high = H5F_LIBVER_LATEST;
- for (low = H5F_LIBVER_EARLIEST; low < H5F_LIBVER_NBOUNDS; low++)
+ for (low = H5F_LIBVER_EARLIEST; low < H5F_LIBVER_NBOUNDS; H5_INC_ENUM(H5F_libver_t, low))
{
H5F_libver_t new_low = H5F_LIBVER_EARLIEST;
@@ -5167,7 +5365,7 @@ test_libver_bounds_open(void)
/* Get new low bound and verify that it has been upgraded properly */
ret = H5Pget_libver_bounds(new_fapl, &new_low, NULL);
CHECK(ret, FAIL, "H5Pget_libver_bounds");
- VERIFY(new_low, H5F_LIBVER_LATEST, "Low bound should be upgraded to H5F_LIBVER_LATEST");
+ VERIFY(new_low >= H5F_LIBVER_V110, TRUE, "Low bound should be upgraded to at least H5F_LIBVER_V110");
ret = H5Pclose(new_fapl);
CHECK(ret, FAIL, "H5Pclose");
@@ -5185,6 +5383,79 @@ test_libver_bounds_open(void)
} /* end test_libver_bounds_open() */
+/*-------------------------------------------------------------------------
+ * Function: test_libver_bounds_copy
+ *
+ * Purpose: Test to verify HDFFV-10800 is fixed:
+ * This test is copied from the user test program: copy10.c.
+ * (See attached programs in the jira issue.)
+ *
+ * The source file used in the test is generated by the user test
+ * program "fill18.c" with the 1.8 library. The file is created
+ * with the latest format and the dataset created in the file
+ * has version 3 fill value message (latest).
+ *
+ * The test creates the destination file with (v18, v18) version bounds.
+ * H5Ocopy() should succeed in copying the dataset in the source file
+ * to the destination file.
+ *
+ * Return: Success: 0
+ * Failure: number of errors
+ *
+ *-------------------------------------------------------------------------
+ */
+static void
+test_libver_bounds_copy(void)
+{
+ hid_t src_fid = -1; /* File ID */
+ hid_t dst_fid = -1; /* File ID */
+ hid_t fapl = -1; /* File access property list ID */
+ const char *src_fname; /* Source file name */
+ herr_t ret; /* Generic return value */
+
+ /* Output message about the test being performed */
+ MESSAGE(5, ("Testing H5Ocopy a dataset in a 1.8 library file to a 1.10 library file\n"));
+
+ /* Get the test file name */
+ src_fname = H5_get_srcdir_filename(SRC_FILE);
+
+ /* Open the source test file */
+ src_fid = H5Fopen(src_fname, H5F_ACC_RDONLY, H5P_DEFAULT);
+ CHECK(src_fid, FAIL, "H5Fopen");
+
+ /* Create file access property list */
+ fapl = H5Pcreate(H5P_FILE_ACCESS);
+ CHECK(fapl, FAIL, "H5Pcreate");
+
+ /* Set library version bounds to (v18, v18) */
+ ret = H5Pset_libver_bounds(fapl, H5F_LIBVER_V18, H5F_LIBVER_V18);
+ CHECK(ret, FAIL, "H5Pset_libver_bounds");
+
+ /* Create the destination file with the fapl */
+ dst_fid = H5Fcreate(DST_FILE, H5F_ACC_TRUNC, H5P_DEFAULT, fapl);
+ CHECK(dst_fid, FAIL, "H5Pcreate");
+
+ /* Close the fapl */
+ ret = H5Pclose(fapl);
+ CHECK(ret, FAIL, "H5Pclose");
+
+ /* Copy the dataset in the source file to the destination file */
+ ret = H5Ocopy(src_fid, DSET_DS1, dst_fid, DSET_DS1, H5P_DEFAULT, H5P_DEFAULT);
+ VERIFY(ret, SUCCEED, "H5Ocopy");
+
+ /* Close the source file */
+ ret = H5Fclose(src_fid);
+ CHECK(ret, FAIL, "H5Fclose");
+
+ /* Close the destination file */
+ ret = H5Fclose(dst_fid);
+ CHECK(ret, FAIL, "H5Fclose");
+
+ /* Remove the destination file */
+ HDremove(DST_FILE);
+
+} /* end test_libver_bounds_copy() */
+
/****************************************************************
**
** test_libver_bounds():
@@ -5203,6 +5474,7 @@ test_libver_bounds(void)
test_libver_bounds_real(H5F_LIBVER_EARLIEST, 1, H5F_LIBVER_LATEST, 2);
test_libver_bounds_real(H5F_LIBVER_LATEST, 2, H5F_LIBVER_EARLIEST, 2);
test_libver_bounds_open();
+ test_libver_bounds_copy();
} /* end test_libver_bounds() */
/**************************************************************************************
@@ -5241,8 +5513,8 @@ test_libver_bounds_low_high(void)
CHECK(fapl, FAIL, "H5Pcreate");
/* Loop through all the combinations of low/high version bounds */
- for(low = H5F_LIBVER_EARLIEST; low < H5F_LIBVER_NBOUNDS; low++)
- for(high = H5F_LIBVER_EARLIEST; high < H5F_LIBVER_NBOUNDS; high++) {
+ for(low = H5F_LIBVER_EARLIEST; low < H5F_LIBVER_NBOUNDS; H5_INC_ENUM(H5F_libver_t, low))
+ for(high = H5F_LIBVER_EARLIEST; high < H5F_LIBVER_NBOUNDS; H5_INC_ENUM(H5F_libver_t, high)) {
H5E_BEGIN_TRY {
/* Set the low/high version bounds */
@@ -5445,7 +5717,7 @@ test_libver_bounds_super_create(hid_t fapl, hid_t fcpl, htri_t is_swmr)
} H5E_END_TRY;
/* Get the internal file pointer if the create succeeds */
- if((ok = fid >= 0)) {
+ if(fid >= 0) {
f = (H5F_t *)H5VL_object(fid);
CHECK(f, NULL, "H5VL_object");
}
@@ -5456,34 +5728,35 @@ test_libver_bounds_super_create(hid_t fapl, hid_t fcpl, htri_t is_swmr)
if(is_swmr) { /* SWMR is enabled */
- if(high == H5F_LIBVER_LATEST) { /* Should succeed */
- VERIFY(ok, TRUE, "H5Fcreate");
+ if(high >= H5F_LIBVER_V110) { /* Should succeed */
+ VERIFY(fid >= 0, TRUE, "H5Fcreate");
VERIFY(HDF5_SUPERBLOCK_VERSION_3, f->shared->sblock->super_vers, "HDF5_superblock_ver_bounds");
- VERIFY(H5F_LIBVER_V110, f->shared->low_bound, "HDF5_superblock_ver_bounds");
+ VERIFY(f->shared->low_bound >= H5F_LIBVER_V110, TRUE, "HDF5_superblock_ver_bounds");
} else /* Should fail */
- VERIFY(ok, FALSE, "H5Fcreate");
+ VERIFY(fid >= 0, FALSE, "H5Fcreate");
}
else { /* Should succeed */
- VERIFY(ok, TRUE, "H5Fcreate");
+ VERIFY(fid >= 0, TRUE, "H5Fcreate");
VERIFY(low, f->shared->low_bound, "HDF5_superblock_ver_bounds");
switch(low) {
case H5F_LIBVER_EARLIEST:
- ok = (f->shared->sblock->super_vers == 0 ||
- f->shared->sblock->super_vers == 1 ||
- f->shared->sblock->super_vers == 2);
+ ok = (f->shared->sblock->super_vers == HDF5_SUPERBLOCK_VERSION_DEF ||
+ f->shared->sblock->super_vers == HDF5_SUPERBLOCK_VERSION_1 ||
+ f->shared->sblock->super_vers == HDF5_SUPERBLOCK_VERSION_2);
VERIFY(ok, TRUE, "HDF5_superblock_ver_bounds");
break;
case H5F_LIBVER_V18:
- ok = (f->shared->sblock->super_vers == 2);
+ ok = (f->shared->sblock->super_vers == HDF5_SUPERBLOCK_VERSION_2);
VERIFY(ok, TRUE, "HDF5_superblock_ver_bounds");
break;
case H5F_LIBVER_V110:
- ok = (f->shared->sblock->super_vers == 3);
+ case H5F_LIBVER_V112:
+ ok = (f->shared->sblock->super_vers == HDF5_SUPERBLOCK_VERSION_3);
VERIFY(ok, TRUE, "HDF5_superblock_ver_bounds");
break;
@@ -5495,7 +5768,7 @@ test_libver_bounds_super_create(hid_t fapl, hid_t fcpl, htri_t is_swmr)
} /* end switch */
}
- if(ok) { /* Close the file */
+ if(fid >= 0) { /* Close the file */
ret = H5Fclose(fid);
CHECK(ret, FAIL, "H5Fclose");
}
@@ -5587,7 +5860,6 @@ test_libver_bounds_super_open(hid_t fapl, hid_t fcpl, htri_t is_swmr)
hid_t new_fapl = -1; /* File access property list */
unsigned super_vers; /* Superblock version */
H5F_libver_t low, high; /* Low and high bounds */
- hbool_t ok; /* The result is ok or not */
herr_t ret; /* Return value */
/* Create the file with the input fcpl and fapl */
@@ -5610,8 +5882,8 @@ test_libver_bounds_super_open(hid_t fapl, hid_t fcpl, htri_t is_swmr)
CHECK(new_fapl, FAIL, "H5Pcreate");
/* Loop through all the combinations of low/high bounds in new_fapl */
- for(low = H5F_LIBVER_EARLIEST; low < H5F_LIBVER_NBOUNDS; low++) {
- for(high = H5F_LIBVER_EARLIEST; high < H5F_LIBVER_NBOUNDS; high++) {
+ for(low = H5F_LIBVER_EARLIEST; low < H5F_LIBVER_NBOUNDS; H5_INC_ENUM(H5F_libver_t, low)) {
+ for(high = H5F_LIBVER_EARLIEST; high < H5F_LIBVER_NBOUNDS; H5_INC_ENUM(H5F_libver_t, high)) {
H5E_BEGIN_TRY {
ret = H5Pset_libver_bounds(new_fapl, low, high);
} H5E_END_TRY;
@@ -5626,7 +5898,7 @@ test_libver_bounds_super_open(hid_t fapl, hid_t fcpl, htri_t is_swmr)
} H5E_END_TRY;
/* Get the internal file pointer if the open succeeds */
- if((ok = fid >= 0)) {
+ if(fid >= 0) {
f = (H5F_t *)H5VL_object(fid);
CHECK(f, NULL, "H5VL_object");
}
@@ -5634,26 +5906,24 @@ test_libver_bounds_super_open(hid_t fapl, hid_t fcpl, htri_t is_swmr)
/* Verify the file open succeeds or fails */
switch(super_vers) {
case 3:
- if(high == H5F_LIBVER_LATEST) {
+ if(high >= H5F_LIBVER_V110) {
/* Should succeed */
- VERIFY(ok, TRUE, "H5Fopen");
- VERIFY(H5F_LIBVER_V110, f->shared->low_bound, "HDF5_superblock_ver_bounds");
+ VERIFY(fid >= 0, TRUE, "H5Fopen");
+ VERIFY(f->shared->low_bound >= H5F_LIBVER_V110, TRUE, "HDF5_superblock_ver_bounds");
/* Close the file */
ret = H5Fclose(fid);
CHECK(ret, FAIL, "H5Fclose");
} else /* Should fail */
- VERIFY(ok, FALSE, "H5Fopen");
+ VERIFY(fid >= 0, FALSE, "H5Fopen");
break;
case 2:
if(is_swmr) /* Should fail */
- VERIFY(ok, FALSE, "H5Fopen");
+ VERIFY(fid >= 0, FALSE, "H5Fopen");
else { /* Should succeed */
- VERIFY(ok, TRUE, "H5Fopen");
-
- ok = f->shared->low_bound >= H5F_LIBVER_V18;
- VERIFY(ok, TRUE, "HDF5_superblock_ver_bounds");
+ VERIFY(fid >= 0, TRUE, "H5Fopen");
+ VERIFY(f->shared->low_bound >= H5F_LIBVER_V18, TRUE, "HDF5_superblock_ver_bounds");
/* Close the file */
ret = H5Fclose(fid);
@@ -5664,10 +5934,10 @@ test_libver_bounds_super_open(hid_t fapl, hid_t fcpl, htri_t is_swmr)
case 1:
case 0:
if(is_swmr) /* Should fail */
- VERIFY(ok, FALSE, "H5Fopen");
+ VERIFY(fid >= 0, FALSE, "H5Fopen");
else { /* Should succeed */
- VERIFY(ok, TRUE, "H5Fopen");
- VERIFY(low, f->shared->low_bound, "HDF5_superblock_ver_bounds");
+ VERIFY(fid >= 0, TRUE, "H5Fopen");
+ VERIFY(f->shared->low_bound, low, "HDF5_superblock_ver_bounds");
ret = H5Fclose(fid);
CHECK(ret, FAIL, "H5Fclose");
@@ -5782,8 +6052,8 @@ test_libver_bounds_obj(hid_t fapl)
/* Loop through all the combinations of low/high bounds in new_fapl */
/* Open the file with the fapl; create a group and verify the
object header version, then delete the group and close the file.*/
- for(low = H5F_LIBVER_EARLIEST; low < H5F_LIBVER_NBOUNDS; low++) {
- for(high = H5F_LIBVER_EARLIEST; high < H5F_LIBVER_NBOUNDS; high++) {
+ for(low = H5F_LIBVER_EARLIEST; low < H5F_LIBVER_NBOUNDS; H5_INC_ENUM(H5F_libver_t, low)) {
+ for(high = H5F_LIBVER_EARLIEST; high < H5F_LIBVER_NBOUNDS; H5_INC_ENUM(H5F_libver_t, high)) {
H5E_BEGIN_TRY {
ret = H5Pset_libver_bounds(new_fapl, low, high);
} H5E_END_TRY;
@@ -5993,8 +6263,8 @@ test_libver_bounds_dataset(hid_t fapl)
/* Loop through all the combinations of low/high bounds in new_fapl */
/* Open the file with the fapl and create the chunked dataset */
/* Verify the dataset's layout, fill value and filter pipleline message versions */
- for(low = H5F_LIBVER_EARLIEST; low < H5F_LIBVER_NBOUNDS; low++) {
- for(high = H5F_LIBVER_EARLIEST; high < H5F_LIBVER_NBOUNDS; high++) {
+ for(low = H5F_LIBVER_EARLIEST; low < H5F_LIBVER_NBOUNDS; H5_INC_ENUM(H5F_libver_t, low)) {
+ for(high = H5F_LIBVER_EARLIEST; high < H5F_LIBVER_NBOUNDS; H5_INC_ENUM(H5F_libver_t, high)) {
H5E_BEGIN_TRY {
ret = H5Pset_libver_bounds(new_fapl, low, high);
} H5E_END_TRY;
@@ -6206,8 +6476,8 @@ test_libver_bounds_dataspace(hid_t fapl)
/* Loop through all the combinations of low/high bounds in new_fapl */
/* Open the file and create the chunked/compact/contiguous datasets */
/* Verify the dataspace message version for the three datasets */
- for(low = H5F_LIBVER_EARLIEST; low < H5F_LIBVER_NBOUNDS; low++) {
- for(high = H5F_LIBVER_EARLIEST; high < H5F_LIBVER_NBOUNDS; high++) {
+ for(low = H5F_LIBVER_EARLIEST; low < H5F_LIBVER_NBOUNDS; H5_INC_ENUM(H5F_libver_t, low)) {
+ for(high = H5F_LIBVER_EARLIEST; high < H5F_LIBVER_NBOUNDS; H5_INC_ENUM(H5F_libver_t, high)) {
hid_t tmp_sid, tmp_sid_compact, tmp_sid_contig; /* Dataspace IDs */
H5S_t *tmp_space, *tmp_space_compact, *tmp_space_contig; /* Internal dataspace pointers */
@@ -6531,8 +6801,8 @@ test_libver_bounds_datatype_check(hid_t fapl, hid_t tid)
/* Open the file and create the chunked dataset with the input tid */
/* Verify the dataset's datatype message version */
/* Also verify the committed atatype message version */
- for(low = H5F_LIBVER_EARLIEST; low < H5F_LIBVER_NBOUNDS; low++) {
- for(high = H5F_LIBVER_EARLIEST; high < H5F_LIBVER_NBOUNDS; high++) {
+ for(low = H5F_LIBVER_EARLIEST; low < H5F_LIBVER_NBOUNDS; H5_INC_ENUM(H5F_libver_t, low)) {
+ for(high = H5F_LIBVER_EARLIEST; high < H5F_LIBVER_NBOUNDS; H5_INC_ENUM(H5F_libver_t, high)) {
H5E_BEGIN_TRY {
ret = H5Pset_libver_bounds(new_fapl, low, high);
} H5E_END_TRY;
@@ -6852,8 +7122,8 @@ test_libver_bounds_attributes(hid_t fapl)
/* Loop through all the combinations of low/high bounds */
/* Open the file and group and attach an attribute to the group */
/* Verify the attribute version */
- for(low = H5F_LIBVER_EARLIEST; low < H5F_LIBVER_NBOUNDS; low++) {
- for(high = H5F_LIBVER_EARLIEST; high < H5F_LIBVER_NBOUNDS; high++) {
+ for(low = H5F_LIBVER_EARLIEST; low < H5F_LIBVER_NBOUNDS; H5_INC_ENUM(H5F_libver_t, low)) {
+ for(high = H5F_LIBVER_EARLIEST; high < H5F_LIBVER_NBOUNDS; H5_INC_ENUM(H5F_libver_t, high)) {
H5E_BEGIN_TRY {
ret = H5Pset_libver_bounds(new_fapl, low, high);
} H5E_END_TRY;
@@ -7515,8 +7785,9 @@ test_deprec(void)
void
test_file(void)
{
- hbool_t single_file_vfd; /* Whether VFD used is a single file */
const char *env_h5_drvr; /* File Driver value from environment */
+ hid_t fapl_id = H5I_INVALID_HID; /* VFD-dependent fapl ID */
+ herr_t ret;
/* Output message about test being performed */
MESSAGE(5, ("Testing Low-Level File I/O\n"));
@@ -7525,7 +7796,10 @@ test_file(void)
env_h5_drvr = HDgetenv("HDF5_DRIVER");
if(env_h5_drvr == NULL)
env_h5_drvr = "nomatch";
- single_file_vfd = (hbool_t)(HDstrcmp(env_h5_drvr, "split") && HDstrcmp(env_h5_drvr, "multi") && HDstrcmp(env_h5_drvr, "family"));
+
+ /* Improved version of VFD-dependent checks */
+ fapl_id = h5_fileaccess();
+ CHECK(fapl_id, H5I_INVALID_HID, "h5_fileaccess");
test_file_create(); /* Test file creation(also creation templates)*/
test_file_open(); /* Test file opening */
@@ -7536,6 +7810,7 @@ test_file(void)
test_file_perm(); /* Test file access permissions */
test_file_perm2(); /* Test file access permission again */
test_file_is_accessible(env_h5_drvr); /* Test detecting HDF5 files correctly */
+ test_file_delete(fapl_id); /* Test H5Fdelete */
test_file_open_dot(); /* Test opening objects with "." for a name */
test_file_open_overlap(); /* Test opening files in an overlapping manner */
test_file_getname(); /* Test basic H5Fget_name() functionality */
@@ -7571,12 +7846,13 @@ test_file(void)
test_incr_filesize(); /* Test H5Fincrement_filesize() and H5Fget_eoa() */
test_min_dset_ohdr(); /* Test datset object header minimization */
#ifndef H5_NO_DEPRECATED_SYMBOLS
- if(single_file_vfd)
- test_file_ishdf5(); /* Test detecting HDF5 files correctly */
- else
- MESSAGE(5, ("Skipping testing detection of HDF5 Files (using deprecated H5Fis_hdf5() call for non-single file VFDs)\n"));
+ test_file_ishdf5(env_h5_drvr); /* Test detecting HDF5 files correctly */
test_deprec(); /* Test deprecated routines */
#endif /* H5_NO_DEPRECATED_SYMBOLS */
+
+ ret = H5Pclose(fapl_id);
+ CHECK(ret, FAIL, "H5Pclose");
+
} /* test_file() */
@@ -7605,5 +7881,6 @@ cleanup_file(void)
HDremove(FILE5);
HDremove(FILE6);
HDremove(FILE7);
+ HDremove(DST_FILE);
}
diff --git a/test/th5o.c b/test/th5o.c
index 63fee5f..0aa589f 100644
--- a/test/th5o.c
+++ b/test/th5o.c
@@ -806,8 +806,8 @@ test_h5o_link(void)
CHECK(fapl_id, FAIL, "H5Pcreate");
/* Loop through all the combinations of low/high library format bounds */
- for(low = H5F_LIBVER_EARLIEST; low < H5F_LIBVER_NBOUNDS; low++) {
- for(high = H5F_LIBVER_EARLIEST; high < H5F_LIBVER_NBOUNDS; high++) {
+ for(low = H5F_LIBVER_EARLIEST; low < H5F_LIBVER_NBOUNDS; H5_INC_ENUM(H5F_libver_t, low)) {
+ for(high = H5F_LIBVER_EARLIEST; high < H5F_LIBVER_NBOUNDS; H5_INC_ENUM(H5F_libver_t, high)) {
/* Set version bounds */
H5E_BEGIN_TRY {
diff --git a/test/th5s.c b/test/th5s.c
index 14f5de9..c5dfa97 100644
--- a/test/th5s.c
+++ b/test/th5s.c
@@ -30,6 +30,7 @@
* This file also needs to access the dataspace testing code.
*/
#define H5S_FRIEND /*suppress error about including H5Spkg */
+#define H5S_TESTING /*suppress warning about H5S testing funcs*/
#include "H5Spkg.h" /* Dataspaces */
/*
@@ -90,7 +91,21 @@ struct space4_struct {
unsigned u;
float f;
char c2;
- } space4_data={'v',987123,-3.14F,'g'}; /* Test data for 4th dataspace */
+} space4_data={'v',987123,-3.14F,'g'}; /* Test data for 4th dataspace */
+
+/*
+ * Testing configuration defines used by:
+ * test_h5s_encode_regular_hyper()
+ * test_h5s_encode_irregular_hyper()
+ * test_h5s_encode_points()
+ */
+#define CONFIG_8 1
+#define CONFIG_16 2
+#define CONFIG_32 3
+#define POWER8 256 /* 2^8 */
+#define POWER16 65536 /* 2^16 */
+#define POWER32 4294967296 /* 2^32 */
+
/****************************************************************
**
@@ -1163,27 +1178,30 @@ test_h5s_zero_dim(void)
**
** test_h5s_encode(): Test H5S (dataspace) encoding and decoding.
**
+** Note: See "RFC: H5Sencode/H5Sdecode Format Change".
+**
****************************************************************/
static void
-test_h5s_encode(void)
+test_h5s_encode(H5F_libver_t low, H5F_libver_t high)
{
- hid_t sid1, sid2, sid3; /* Dataspace ID */
- hid_t decoded_sid1, decoded_sid2, decoded_sid3;
- int rank; /* Logical rank of dataspace */
- hsize_t dims1[] = {SPACE1_DIM1, SPACE1_DIM2, SPACE1_DIM3};
- size_t sbuf_size=0, null_size=0, scalar_size=0;
- unsigned char *sbuf=NULL, *null_sbuf=NULL, *scalar_buf=NULL;
- hsize_t tdims[4]; /* Dimension array to test with */
- hssize_t n; /* Number of dataspace elements */
- hsize_t start[] = {0, 0, 0};
- hsize_t stride[] = {2, 5, 3};
- hsize_t count[] = {2, 2, 2};
- hsize_t block[] = {1, 3, 1};
- H5S_sel_type sel_type;
- H5S_class_t space_type;
- hssize_t nblocks;
- hid_t ret_id; /* Generic hid_t return value */
- herr_t ret; /* Generic return value */
+ hid_t sid1, sid2, sid3; /* Dataspace ID */
+ hid_t decoded_sid1, decoded_sid2, decoded_sid3;
+ int rank; /* Logical rank of dataspace */
+ hid_t fapl = -1; /* File access property list ID */
+ hsize_t dims1[] = {SPACE1_DIM1, SPACE1_DIM2, SPACE1_DIM3};
+ size_t sbuf_size=0, null_size=0, scalar_size=0;
+ unsigned char *sbuf=NULL, *null_sbuf=NULL, *scalar_buf=NULL;
+ hsize_t tdims[4]; /* Dimension array to test with */
+ hssize_t n; /* Number of dataspace elements */
+ hsize_t start[] = {0, 0, 0};
+ hsize_t stride[] = {2, 5, 3};
+ hsize_t count[] = {2, 2, 2};
+ hsize_t block[] = {1, 3, 1};
+ H5S_sel_type sel_type;
+ H5S_class_t space_type;
+ hssize_t nblocks;
+ hid_t ret_id; /* Generic hid_t return value */
+ herr_t ret; /* Generic return value */
/* Output message about test being performed */
MESSAGE(5, ("Testing Dataspace Encoding and Decoding\n"));
@@ -1192,26 +1210,40 @@ test_h5s_encode(void)
* Test encoding and decoding of simple dataspace and hyperslab selection.
*-------------------------------------------------------------------------
*/
+
+ /* Create the file access property list */
+ fapl = H5Pcreate(H5P_FILE_ACCESS);
+ CHECK(fapl, FAIL, "H5Pcreate");
+
+ /* Set low/high bounds in the fapl */
+ ret = H5Pset_libver_bounds(fapl, low, high);
+ CHECK(ret, FAIL, "H5Pset_libver_bounds");
+
+ /* Create the dataspace */
sid1 = H5Screate_simple(SPACE1_RANK, dims1, NULL);
CHECK(sid1, FAIL, "H5Screate_simple");
+ /* Set the hyperslab selection */
ret = H5Sselect_hyperslab(sid1, H5S_SELECT_SET, start, stride, count, block);
CHECK(ret, FAIL, "H5Sselect_hyperslab");
- /* Encode simple data space in a buffer */
- ret = H5Sencode(sid1, NULL, &sbuf_size);
- CHECK(ret, FAIL, "H5Sencode");
+ /* Encode simple data space in a buffer with the fapl setting */
+ ret = H5Sencode2(sid1, NULL, &sbuf_size, fapl);
+ CHECK(ret, FAIL, "H5Sencode2");
- if(sbuf_size>0)
+ if(sbuf_size>0) {
sbuf = (unsigned char*)HDcalloc((size_t)1, sbuf_size);
+ CHECK(sbuf, NULL, "HDcalloc");
+ }
/* Try decoding bogus buffer */
H5E_BEGIN_TRY {
- ret_id = H5Sdecode(sbuf);
+ ret_id = H5Sdecode(sbuf);
} H5E_END_TRY;
VERIFY(ret_id, FAIL, "H5Sdecode");
- ret = H5Sencode(sid1, sbuf, &sbuf_size);
+ /* Encode the simple data space in a buffer with the fapl setting */
+ ret = H5Sencode2(sid1, sbuf, &sbuf_size, fapl);
CHECK(ret, FAIL, "H5Sencode");
/* Decode from the dataspace buffer and return an object handle */
@@ -1224,22 +1256,26 @@ test_h5s_encode(void)
VERIFY(n, SPACE1_DIM1 * SPACE1_DIM2 * SPACE1_DIM3,
"H5Sget_simple_extent_npoints");
+ /* Retrieve and verify the dataspace rank */
rank = H5Sget_simple_extent_ndims(decoded_sid1);
CHECK(rank, FAIL, "H5Sget_simple_extent_ndims");
VERIFY(rank, SPACE1_RANK, "H5Sget_simple_extent_ndims");
+ /* Retrieve and verify the dataspace dimensions */
rank = H5Sget_simple_extent_dims(decoded_sid1, tdims, NULL);
CHECK(rank, FAIL, "H5Sget_simple_extent_dims");
VERIFY(HDmemcmp(tdims, dims1, SPACE1_RANK * sizeof(hsize_t)), 0,
"H5Sget_simple_extent_dims");
- /* Verify hyperslabe selection */
+ /* Verify the type of dataspace selection */
sel_type = H5Sget_select_type(decoded_sid1);
VERIFY(sel_type, H5S_SEL_HYPERSLABS, "H5Sget_select_type");
+ /* Verify the number of hyperslab blocks */
nblocks = H5Sget_select_hyper_nblocks(decoded_sid1);
VERIFY(nblocks, 2*2*2, "H5Sget_select_hyper_nblocks");
+ /* Close the dataspaces */
ret = H5Sclose(sid1);
CHECK(ret, FAIL, "H5Sclose");
@@ -1254,23 +1290,27 @@ test_h5s_encode(void)
CHECK(sid2, FAIL, "H5Screate");
/* Encode null data space in a buffer */
- ret = H5Sencode(sid2, NULL, &null_size);
+ ret = H5Sencode2(sid2, NULL, &null_size, fapl);
CHECK(ret, FAIL, "H5Sencode");
- if(null_size>0)
+ if(null_size>0) {
null_sbuf = (unsigned char*)HDcalloc((size_t)1, null_size);
+ CHECK(null_sbuf, NULL, "HDcalloc");
+ }
- ret = H5Sencode(sid2, null_sbuf, &null_size);
- CHECK(ret, FAIL, "H5Sencode");
+ /* Encode the null data space in the buffer */
+ ret = H5Sencode2(sid2, null_sbuf, &null_size, fapl);
+ CHECK(ret, FAIL, "H5Sencode2");
/* Decode from the dataspace buffer and return an object handle */
decoded_sid2=H5Sdecode(null_sbuf);
CHECK(decoded_sid2, FAIL, "H5Sdecode");
- /* Verify decoded dataspace */
+ /* Verify the decoded dataspace type */
space_type = H5Sget_simple_extent_type(decoded_sid2);
VERIFY(space_type, H5S_NULL, "H5Sget_simple_extent_type");
+ /* Close the dataspaces */
ret = H5Sclose(sid2);
CHECK(ret, FAIL, "H5Sclose");
@@ -1286,16 +1326,211 @@ test_h5s_encode(void)
CHECK(sid3, FAIL, "H5Screate_simple");
/* Encode scalar data space in a buffer */
- ret = H5Sencode(sid3, NULL, &scalar_size);
+ ret = H5Sencode2(sid3, NULL, &scalar_size, fapl);
CHECK(ret, FAIL, "H5Sencode");
- if(scalar_size>0)
+ if(scalar_size>0) {
scalar_buf = (unsigned char*)HDcalloc((size_t)1, scalar_size);
+ CHECK(scalar_buf, NULL, "HDcalloc");
+ }
+
+ /* Encode the scalar data space in the buffer */
+ ret = H5Sencode2(sid3, scalar_buf, &scalar_size, fapl);
+ CHECK(ret, FAIL, "H5Sencode2");
+
+ /* Decode from the dataspace buffer and return an object handle */
+ decoded_sid3=H5Sdecode(scalar_buf);
+ CHECK(decoded_sid3, FAIL, "H5Sdecode");
+
+ /* Verify extent type */
+ space_type = H5Sget_simple_extent_type(decoded_sid3);
+ VERIFY(space_type, H5S_SCALAR, "H5Sget_simple_extent_type");
+
+ /* Verify decoded dataspace */
+ n = H5Sget_simple_extent_npoints(decoded_sid3);
+ CHECK(n, FAIL, "H5Sget_simple_extent_npoints");
+ VERIFY(n, 1, "H5Sget_simple_extent_npoints");
+
+ /* Retrieve and verify the dataspace rank */
+ rank = H5Sget_simple_extent_ndims(decoded_sid3);
+ CHECK(rank, FAIL, "H5Sget_simple_extent_ndims");
+ VERIFY(rank, 0, "H5Sget_simple_extent_ndims");
+
+ /* Close the dataspaces */
+ ret = H5Sclose(sid3);
+ CHECK(ret, FAIL, "H5Sclose");
+
+ ret = H5Sclose(decoded_sid3);
+ CHECK(ret, FAIL, "H5Sclose");
+
+ /* Close the file access property list */
+ ret = H5Pclose(fapl);
+ CHECK(ret, FAIL, "H5Pclose");
+
+ /* Release resources */
+ if(sbuf)
+ HDfree(sbuf);
+ if(null_sbuf)
+ HDfree(null_sbuf);
+ if(scalar_buf)
+ HDfree(scalar_buf);
+} /* test_h5s_encode() */
+
+#ifndef H5_NO_DEPRECATED_SYMBOLS
+
+/****************************************************************
+**
+** test_h5s_encode(): Test H5S (dataspace) encoding and decoding.
+**
+****************************************************************/
+static void
+test_h5s_encode1(void)
+{
+ hid_t sid1, sid2, sid3; /* Dataspace ID */
+ hid_t decoded_sid1, decoded_sid2, decoded_sid3;
+ int rank; /* Logical rank of dataspace */
+ hsize_t dims1[] = {SPACE1_DIM1, SPACE1_DIM2, SPACE1_DIM3};
+ size_t sbuf_size=0, null_size=0, scalar_size=0;
+ unsigned char *sbuf=NULL, *null_sbuf=NULL, *scalar_buf=NULL;
+ hsize_t tdims[4]; /* Dimension array to test with */
+ hssize_t n; /* Number of dataspace elements */
+ hsize_t start[] = {0, 0, 0};
+ hsize_t stride[] = {2, 5, 3};
+ hsize_t count[] = {2, 2, 2};
+ hsize_t block[] = {1, 3, 1};
+ H5S_sel_type sel_type;
+ H5S_class_t space_type;
+ hssize_t nblocks;
+ hid_t ret_id; /* Generic hid_t return value */
+ herr_t ret; /* Generic return value */
+
+ /* Output message about test being performed */
+ MESSAGE(5, ("Testing Dataspace Encoding (H5Sencode1) and Decoding\n"));
+
+ /*-------------------------------------------------------------------------
+ * Test encoding and decoding of simple dataspace and hyperslab selection.
+ *-------------------------------------------------------------------------
+ */
+ /* Create the dataspace */
+ sid1 = H5Screate_simple(SPACE1_RANK, dims1, NULL);
+ CHECK(sid1, FAIL, "H5Screate_simple");
+
+ /* Set the hyperslab selection */
+ ret = H5Sselect_hyperslab(sid1, H5S_SELECT_SET, start, stride, count, block);
+ CHECK(ret, FAIL, "H5Sselect_hyperslab");
+
+ /* Encode simple data space in a buffer with the fapl setting */
+ ret = H5Sencode1(sid1, NULL, &sbuf_size);
+ CHECK(ret, FAIL, "H5Sencode2");
+
+ if(sbuf_size>0) {
+ sbuf = (unsigned char*)HDcalloc((size_t)1, sbuf_size);
+ CHECK(sbuf, NULL, "HDcalloc");
+ }
+
+ /* Try decoding bogus buffer */
+ H5E_BEGIN_TRY {
+ ret_id = H5Sdecode(sbuf);
+ } H5E_END_TRY;
+ VERIFY(ret_id, FAIL, "H5Sdecode");
- ret = H5Sencode(sid3, scalar_buf, &scalar_size);
+ /* Encode the simple data space in a buffer */
+ ret = H5Sencode1(sid1, sbuf, &sbuf_size);
CHECK(ret, FAIL, "H5Sencode");
/* Decode from the dataspace buffer and return an object handle */
+ decoded_sid1=H5Sdecode(sbuf);
+ CHECK(decoded_sid1, FAIL, "H5Sdecode");
+
+ /* Verify the decoded dataspace */
+ n = H5Sget_simple_extent_npoints(decoded_sid1);
+ CHECK(n, FAIL, "H5Sget_simple_extent_npoints");
+ VERIFY(n, SPACE1_DIM1 * SPACE1_DIM2 * SPACE1_DIM3,
+ "H5Sget_simple_extent_npoints");
+
+ /* Retrieve and verify the dataspace rank */
+ rank = H5Sget_simple_extent_ndims(decoded_sid1);
+ CHECK(rank, FAIL, "H5Sget_simple_extent_ndims");
+ VERIFY(rank, SPACE1_RANK, "H5Sget_simple_extent_ndims");
+
+ /* Retrieve and verify the dataspace dimensions */
+ rank = H5Sget_simple_extent_dims(decoded_sid1, tdims, NULL);
+ CHECK(rank, FAIL, "H5Sget_simple_extent_dims");
+ VERIFY(HDmemcmp(tdims, dims1, SPACE1_RANK * sizeof(hsize_t)), 0,
+ "H5Sget_simple_extent_dims");
+
+ /* Verify the type of dataspace selection */
+ sel_type = H5Sget_select_type(decoded_sid1);
+ VERIFY(sel_type, H5S_SEL_HYPERSLABS, "H5Sget_select_type");
+
+ /* Verify the number of hyperslab blocks */
+ nblocks = H5Sget_select_hyper_nblocks(decoded_sid1);
+ VERIFY(nblocks, 2*2*2, "H5Sget_select_hyper_nblocks");
+
+ /* Close the dataspaces */
+ ret = H5Sclose(sid1);
+ CHECK(ret, FAIL, "H5Sclose");
+
+ ret = H5Sclose(decoded_sid1);
+ CHECK(ret, FAIL, "H5Sclose");
+
+ /*-------------------------------------------------------------------------
+ * Test encoding and decoding of null dataspace.
+ *-------------------------------------------------------------------------
+ */
+ sid2 = H5Screate(H5S_NULL);
+ CHECK(sid2, FAIL, "H5Screate");
+
+ /* Encode null data space in a buffer */
+ ret = H5Sencode1(sid2, NULL, &null_size);
+ CHECK(ret, FAIL, "H5Sencode");
+
+ if(null_size>0) {
+ null_sbuf = (unsigned char*)HDcalloc((size_t)1, null_size);
+ CHECK(null_sbuf, NULL, "HDcalloc");
+ }
+
+ /* Encode the null data space in the buffer */
+ ret = H5Sencode1(sid2, null_sbuf, &null_size);
+ CHECK(ret, FAIL, "H5Sencode2");
+
+ /* Decode from the dataspace buffer and return an object handle */
+ decoded_sid2=H5Sdecode(null_sbuf);
+ CHECK(decoded_sid2, FAIL, "H5Sdecode");
+
+ /* Verify the decoded dataspace type */
+ space_type = H5Sget_simple_extent_type(decoded_sid2);
+ VERIFY(space_type, H5S_NULL, "H5Sget_simple_extent_type");
+
+ /* Close the dataspaces */
+ ret = H5Sclose(sid2);
+ CHECK(ret, FAIL, "H5Sclose");
+
+ ret = H5Sclose(decoded_sid2);
+ CHECK(ret, FAIL, "H5Sclose");
+
+ /*-------------------------------------------------------------------------
+ * Test encoding and decoding of scalar dataspace.
+ *-------------------------------------------------------------------------
+ */
+ /* Create scalar dataspace */
+ sid3 = H5Screate(H5S_SCALAR);
+ CHECK(sid3, FAIL, "H5Screate_simple");
+
+ /* Encode scalar data space in a buffer */
+ ret = H5Sencode1(sid3, NULL, &scalar_size);
+ CHECK(ret, FAIL, "H5Sencode");
+
+ if(scalar_size>0) {
+ scalar_buf = (unsigned char*)HDcalloc((size_t)1, scalar_size);
+ CHECK(scalar_buf, NULL, "HDcalloc");
+ }
+
+ /* Encode the scalar data space in the buffer */
+ ret = H5Sencode1(sid3, scalar_buf, &scalar_size);
+ CHECK(ret, FAIL, "H5Sencode2");
+
+ /* Decode from the dataspace buffer and return an object handle */
decoded_sid3=H5Sdecode(scalar_buf);
CHECK(decoded_sid3, FAIL, "H5Sdecode");
@@ -1308,20 +1543,628 @@ test_h5s_encode(void)
CHECK(n, FAIL, "H5Sget_simple_extent_npoints");
VERIFY(n, 1, "H5Sget_simple_extent_npoints");
+ /* Retrieve and verify the dataspace rank */
rank = H5Sget_simple_extent_ndims(decoded_sid3);
CHECK(rank, FAIL, "H5Sget_simple_extent_ndims");
VERIFY(rank, 0, "H5Sget_simple_extent_ndims");
+ /* Close the dataspaces */
ret = H5Sclose(sid3);
CHECK(ret, FAIL, "H5Sclose");
ret = H5Sclose(decoded_sid3);
CHECK(ret, FAIL, "H5Sclose");
- HDfree(sbuf);
- HDfree(null_sbuf);
- HDfree(scalar_buf);
-} /* test_h5s_encode() */
+ /* Release resources */
+ if(sbuf)
+ HDfree(sbuf);
+ if(null_sbuf)
+ HDfree(null_sbuf);
+ if(scalar_buf)
+ HDfree(scalar_buf);
+} /* test_h5s_encode1() */
+
+#endif /* H5_NO_DEPRECATED_SYMBOLS */
+
+
+/****************************************************************
+**
+** test_h5s_check_encoding():
+** This is the helper routine to verify that H5Sencode2()
+** works as specified in the RFC for the library format setting
+** in the file access property list.
+** See "RFC: H5Sencode/H5Sdeocde Format Change".
+**
+** This routine is used by:
+** test_h5s_encode_regular_hyper()
+** test_h5s_encode_irregular_hyper()
+** test_h5s_encode_points()
+**
+****************************************************************/
+static herr_t
+test_h5s_check_encoding(hid_t in_fapl, hid_t in_sid,
+ uint32_t expected_version, uint8_t expected_enc_size, hbool_t expected_to_fail)
+{
+ char *buf = NULL; /* Pointer to the encoded buffer */
+ size_t buf_size; /* Size of the encoded buffer */
+ hid_t d_sid = -1; /* The decoded dataspace ID */
+ htri_t check;
+ hsize_t in_low_bounds[1]; /* The low bounds for the selection for in_sid */
+ hsize_t in_high_bounds[1]; /* The high bounds for the selection for in_sid */
+ hsize_t d_low_bounds[1]; /* The low bounds for the selection for d_sid */
+ hsize_t d_high_bounds[1]; /* The high bounds for the selection for d_sid */
+ herr_t ret; /* Return value */
+
+ /* Get buffer size for encoding with the format setting in in_fapl */
+ H5E_BEGIN_TRY {
+ ret = H5Sencode2(in_sid, NULL, &buf_size, in_fapl);
+ } H5E_END_TRY
+
+ if(expected_to_fail) {
+ VERIFY(ret, FAIL, "H5Screate_simple");
+ } else {
+
+ CHECK(ret, FAIL, "H5Sencode2");
+
+ /* Allocate the buffer for encoding */
+ buf = (char *)HDmalloc(buf_size);
+ CHECK(buf, NULL, "H5Dmalloc");
+
+ /* Encode according to the setting in in_fapl */
+ ret = H5Sencode2(in_sid, buf, &buf_size, in_fapl);
+ CHECK(ret, FAIL, "H5Sencode2");
+
+ /* Decode the buffer */
+ d_sid = H5Sdecode(buf);
+ CHECK(d_sid, FAIL, "H5Sdecode");
+
+ /* Verify the number of selected points for in_sid and d_sid */
+ VERIFY(H5Sget_select_npoints(in_sid), H5Sget_select_npoints(d_sid), "Compare npoints");
+
+ /* Verify if the two dataspace selections (in_sid, d_sid) are the same shape */
+ check = H5S__select_shape_same_test(in_sid, d_sid);
+ VERIFY(check, TRUE, "H5S__select_shape_same_test");
+
+ /* Compare the starting/ending coordinates of the bounding box for in_sid and d_sid */
+ ret = H5Sget_select_bounds(in_sid, in_low_bounds, in_high_bounds);
+ CHECK(ret, FAIL, "H5Sget_select_bounds");
+ ret = H5Sget_select_bounds(d_sid, d_low_bounds, d_high_bounds);
+ CHECK(ret, FAIL, "H5Sget_select_bounds");
+ VERIFY(in_low_bounds[0], d_low_bounds[0], "Compare selection low bounds");
+ VERIFY(in_high_bounds[0], d_high_bounds[0], "Compare selection high bounds");
+
+ /*
+ * See "RFC: H5Sencode/H5Sdeocde Format Change" for the verification of:
+ * H5S_SEL_POINTS:
+ * --the expected version for point selection info
+ * --the expected encoded size (version 2 points selection info)
+ * H5S_SEL_HYPERSLABS:
+ * --the expected version for hyperslab selection info
+ * --the expected encoded size (version 3 hyperslab selection info)
+ */
+
+ if(H5Sget_select_type(in_sid) == H5S_SEL_POINTS) {
+
+ /* Verify the version */
+ VERIFY((uint32_t)buf[35], expected_version, "Version for point selection");
+
+ /* Verify the encoded size for version 2 */
+ if(expected_version == 2)
+ VERIFY((uint8_t)buf[39], expected_enc_size, "Encoded size of point selection info");
+ }
+
+ if(H5Sget_select_type(in_sid) == H5S_SEL_HYPERSLABS) {
+
+ /* Verify the version */
+ VERIFY((uint32_t)buf[35], expected_version, "Version for hyperslab selection info");
+
+ /* Verify the encoded size for version 3 */
+ if(expected_version == 3)
+ VERIFY((uint8_t)buf[40], expected_enc_size, "Encoded size of selection info");
+
+ } /* hyperslab selection */
+
+ ret = H5Sclose(d_sid);
+ CHECK(ret, FAIL, "H5Sclose");
+ if(buf)
+ HDfree(buf);
+
+ }
+
+ return(0);
+
+} /* test_h5s_check_encoding */
+
+/****************************************************************
+**
+** test_h5s_encode_regular_hyper():
+** This test verifies that H5Sencode2() works as specified in
+** the RFC for regular hyperslabs.
+** See "RFC: H5Sencode/H5Sdeocde Format Change".
+**
+****************************************************************/
+static void
+test_h5s_encode_regular_hyper(H5F_libver_t low, H5F_libver_t high)
+{
+ hid_t fapl = -1; /* File access property list ID */
+ hid_t sid = -1; /* Dataspace ID */
+ hsize_t numparticles = 8388608; /* Used to calculate dimension size */
+ unsigned num_dsets = 513; /* Used to calculate dimension size */
+ hsize_t total_particles = numparticles * num_dsets;
+ hsize_t vdsdims[1] = {total_particles}; /* Dimension size */
+ hsize_t start, stride, count, block; /* Selection info */
+ unsigned config; /* Testing configuration */
+ unsigned unlim; /* H5S_UNLIMITED setting or not */
+ herr_t ret; /* Generic return value */
+ uint32_t expected_version = 0; /* Expected version for selection info */
+ uint8_t expected_enc_size = 0; /* Expected encoded size for selection info */
+
+ /* Output message about test being performed */
+ MESSAGE(5, ("Testing Dataspace encoding of regular hyperslabs\n"));
+
+ /* Create the file access property list */
+ fapl = H5Pcreate(H5P_FILE_ACCESS);
+ CHECK(fapl, FAIL, "H5Pcreate");
+
+ /* Set the low/high bounds in the fapl */
+ ret = H5Pset_libver_bounds(fapl, low, high);
+ CHECK(ret, FAIL, "H5Pset_libver_bounds");
+
+ /* Create the dataspace */
+ sid = H5Screate_simple(1, vdsdims, NULL);
+ CHECK(sid, FAIL, "H5Screate_simple");
+
+ /* Testing with each configuration */
+ for(config = CONFIG_16; config <= CONFIG_32; config++) {
+ hbool_t expected_to_fail = FALSE;
+
+ /* Testing with unlimited or not */
+ for(unlim = 0; unlim <= 1; unlim++) {
+ start = 0;
+ count = unlim? H5S_UNLIMITED : 2;
+
+ if((high <= H5F_LIBVER_V18) &&
+ (unlim || config == CONFIG_32))
+ expected_to_fail = TRUE;
+
+ if(low >= H5F_LIBVER_V112)
+ expected_version = 3;
+ else if(config == CONFIG_16 && !unlim)
+ expected_version = 1;
+ else
+ expected_version = 2;
+
+ /* test 1 */
+ switch(config) {
+ case CONFIG_16:
+ stride = POWER16 - 1;
+ block = 4;
+ expected_enc_size = expected_version == 3 ? 2 : 4;
+ break;
+ case CONFIG_32:
+ stride = POWER32 - 1;
+ block = 4;
+ expected_enc_size = expected_version == 3 ? 4 : 8;
+
+ break;
+ default:
+ HDassert(0);
+ break;
+ } /* end switch */
+
+ /* Set the hyperslab selection */
+ ret = H5Sselect_hyperslab(sid, H5S_SELECT_SET, &start, &stride, &count, &block);
+ CHECK(ret, FAIL, "H5Sselect_hyperslab");
+
+ /* Verify the version and encoded size expected for this configuration */
+ ret = test_h5s_check_encoding(fapl, sid, expected_version, expected_enc_size, expected_to_fail);
+ CHECK(ret, FAIL, "test_h5s_check_encoding");
+
+ /* test 2 */
+ switch(config) {
+ case CONFIG_16:
+ stride = POWER16 - 1;
+ block = POWER16 - 2;
+ expected_enc_size = expected_version == 3 ? 2 : 4;
+ break;
+ case CONFIG_32:
+ stride = POWER32 - 1;
+ block = POWER32 - 2;
+ expected_enc_size = expected_version == 3 ? 4 : 8;
+ break;
+ default:
+ HDassert(0);
+ break;
+ } /* end switch */
+
+ /* Set the hyperslab selection */
+ ret = H5Sselect_hyperslab(sid, H5S_SELECT_SET, &start, &stride, &count, &block);
+ CHECK(ret, FAIL, "H5Sselect_hyperslab");
+
+ /* Verify the version and encoded size for this configuration */
+ ret = test_h5s_check_encoding(fapl, sid, expected_version, expected_enc_size, expected_to_fail);
+ CHECK(ret, FAIL, "test_h5s_check_encoding");
+
+ /* test 3 */
+ switch(config) {
+ case CONFIG_16:
+ stride = POWER16 - 1;
+ block = POWER16 - 1;
+ expected_enc_size = 4;
+ break;
+ case CONFIG_32:
+ stride = POWER32 - 1;
+ block = POWER32 - 1;
+ expected_enc_size = 8;
+ break;
+ default:
+ HDassert(0);
+ break;
+ }
+
+ /* Set the hyperslab selection */
+ ret = H5Sselect_hyperslab(sid, H5S_SELECT_SET, &start, &stride, &count, &block);
+ CHECK(ret, FAIL, "H5Sselect_hyperslab");
+
+ /* Verify the version and encoded size expected for this configuration */
+ ret = test_h5s_check_encoding(fapl, sid, expected_version, expected_enc_size, expected_to_fail);
+ CHECK(ret, FAIL, "test_h5s_check_encoding");
+
+ /* test 4 */
+ switch(config) {
+ case CONFIG_16:
+ stride = POWER16;
+ block = POWER16 - 2;
+ expected_enc_size = 4;
+ break;
+ case CONFIG_32:
+ stride = POWER32;
+ block = POWER32 - 2;
+ expected_enc_size = 8;
+ break;
+ default:
+ HDassert(0);
+ break;
+ } /* end switch */
+
+ /* Set the hyperslab selection */
+ ret = H5Sselect_hyperslab(sid, H5S_SELECT_SET, &start, &stride, &count, &block);
+ CHECK(ret, FAIL, "H5Sselect_hyperslab");
+
+ /* Verify the version and encoded size expected for this configuration */
+ ret = test_h5s_check_encoding(fapl, sid, expected_version, expected_enc_size, expected_to_fail);
+ CHECK(ret, FAIL, "test_h5s_check_encoding");
+
+ /* test 5 */
+ switch(config) {
+ case CONFIG_16:
+ stride = POWER16;
+ block = 1;
+ expected_enc_size = 4;
+ break;
+ case CONFIG_32:
+ stride = POWER32;
+ block = 1;
+ expected_enc_size = 8;
+ break;
+ default:
+ HDassert(0);
+ break;
+ }
+
+ /* Set the hyperslab selection */
+ ret = H5Sselect_hyperslab(sid, H5S_SELECT_SET, &start, &stride, &count, &block);
+ CHECK(ret, FAIL, "H5Sselect_hyperslab");
+
+ /* Verify the version and encoded size expected for this configuration */
+ ret = test_h5s_check_encoding(fapl, sid, expected_version, expected_enc_size, expected_to_fail);
+ CHECK(ret, FAIL, "test_h5s_check_encoding");
+
+ } /* for unlim */
+ } /* for config */
+
+ ret = H5Sclose(sid);
+ CHECK(ret, FAIL, "H5Sclose");
+
+ ret = H5Pclose(fapl);
+ CHECK(ret, FAIL, "H5Pclose");
+
+} /* test_h5s_encode_regular_hyper() */
+
+/****************************************************************
+**
+** test_h5s_encode_irregular_hyper():
+** This test verifies that H5Sencode2() works as specified in
+** the RFC for irregular hyperslabs.
+** See "RFC: H5Sencode/H5Sdeocde Format Change".
+**
+****************************************************************/
+static void
+test_h5s_encode_irregular_hyper(H5F_libver_t low, H5F_libver_t high)
+{
+ hid_t fapl = -1; /* File access property list ID */
+ hid_t sid; /* Dataspace ID */
+ hsize_t numparticles = 8388608; /* Used to calculate dimension size */
+ unsigned num_dsets = 513; /* Used to calculate dimension size */
+ hsize_t total_particles = numparticles * num_dsets;
+ hsize_t vdsdims[1] = {total_particles}; /* Dimension size */
+ hsize_t start, stride, count, block; /* Selection info */
+ htri_t is_regular; /* Is this a regular hyperslab */
+ unsigned config; /* Testing configuration */
+ herr_t ret; /* Generic return value */
+
+ /* Output message about test being performed */
+ MESSAGE(5, ("Testing Dataspace encoding of irregular hyperslabs\n"));
+
+ /* Create the file access property list */
+ fapl = H5Pcreate(H5P_FILE_ACCESS);
+ CHECK(fapl, FAIL, "H5Pcreate");
+
+ /* Set the low/high bounds in the fapl */
+ ret = H5Pset_libver_bounds(fapl, low, high);
+ CHECK(ret, FAIL, "H5Pset_libver_bounds");
+
+ /* Create the dataspace */
+ sid = H5Screate_simple(1, vdsdims, NULL);
+ CHECK(sid, FAIL, "H5Screate_simple");
+
+ /* Testing with each configuration */
+ for(config = CONFIG_8; config <= CONFIG_32; config++) {
+ hbool_t expected_to_fail = FALSE; /* Whether H5Sencode2 is expected to fail */
+ uint32_t expected_version = 0; /* Expected version for selection info */
+ uint8_t expected_enc_size = 0; /* Expected encoded size for selection info */
+
+ start = 0;
+ count = 2;
+ block = 4;
+
+ /* H5Sencode2 is expected to fail for library v110 and below
+ when the selection exceeds the 32 bits integer limit */
+ if(high <= H5F_LIBVER_V110 && config == CONFIG_32)
+ expected_to_fail = TRUE;
+
+ if(low >= H5F_LIBVER_V112 || config == CONFIG_32)
+ expected_version = 3;
+ else
+ expected_version = 1;
+
+ switch(config) {
+ case CONFIG_8:
+ stride = POWER8 - 2;
+ break;
+
+ case CONFIG_16:
+ stride = POWER16 - 2;
+ break;
+
+ case CONFIG_32:
+ stride = POWER32 - 2;
+ break;
+
+ default:
+ HDassert(0);
+ break;
+ }
+
+ /* Set the hyperslab selection */
+ ret = H5Sselect_hyperslab(sid, H5S_SELECT_SET, &start, &stride, &count, &block);
+ CHECK(ret, FAIL, "H5Sselect_hyperslab");
+
+ start = 8;
+ count = 5;
+ block = 2;
+
+ switch(config) {
+ case CONFIG_8:
+ stride = POWER8;
+ expected_enc_size = expected_version == 3 ? 2 : 4;
+ break;
+
+ case CONFIG_16:
+ stride = POWER16;
+ expected_enc_size = 4;
+ break;
+
+ case CONFIG_32:
+ stride = POWER32;
+ expected_enc_size = 8;
+ break;
+
+ default:
+ assert(0);
+ break;
+ }
+
+ /* Set the hyperslab selection */
+ ret = H5Sselect_hyperslab(sid, H5S_SELECT_OR, &start, &stride, &count, &block);
+ CHECK(ret, FAIL, "H5Sselect_hyperslab");
+
+ /* Should be irregular hyperslab */
+ is_regular = H5Sis_regular_hyperslab(sid);
+ VERIFY(is_regular, FALSE, "H5Sis_regular_hyperslab");
+
+ /* Verify the version and encoded size expected for the configuration */
+ ret = test_h5s_check_encoding(fapl, sid, expected_version, expected_enc_size, expected_to_fail);
+ CHECK(ret, FAIL, "test_h5s_check_encoding");
+
+ } /* for config */
+
+ ret = H5Sclose(sid);
+ CHECK(ret, FAIL, "H5Sclose");
+
+} /* test_h5s_encode_irregular_hyper() */
+
+/****************************************************************
+**
+** test_h5s_encode_points():
+** This test verifies that H5Sencode2() works as specified in
+** the RFC for point selection.
+** See "RFC: H5Sencode/H5Sdeocde Format Change".
+**
+****************************************************************/
+static void
+test_h5s_encode_points(H5F_libver_t low, H5F_libver_t high)
+{
+ hid_t fapl = -1; /* File access property list ID */
+ hid_t sid; /* Dataspace ID */
+ hsize_t numparticles = 8388608; /* Used to calculate dimenion size */
+ unsigned num_dsets = 513; /* used to calculate dimension size */
+ hsize_t total_particles = numparticles * num_dsets;
+ hsize_t vdsdims[1] = {total_particles}; /* Dimension size */
+ hsize_t coord[4]; /* The point coordinates */
+ herr_t ret; /* Generic return value */
+ hbool_t expected_to_fail = FALSE; /* Expected to fail or not */
+ uint32_t expected_version = 0; /* Expected version for selection info */
+ uint8_t expected_enc_size = 0; /* Expected encoded size of selection info */
+
+ /* Output message about test being performed */
+ MESSAGE(5, ("Testing Dataspace encoding of points selection\n"));
+
+ /* Create the file access property list */
+ fapl = H5Pcreate(H5P_FILE_ACCESS);
+ CHECK(fapl, FAIL, "H5Pcreate");
+
+ /* Set the low/high bounds in the fapl */
+ ret = H5Pset_libver_bounds(fapl, low, high);
+ CHECK(ret, FAIL, "H5Pset_libver_bounds");
+
+ /* Create the dataspace */
+ sid = H5Screate_simple(1, vdsdims, NULL);
+ CHECK(sid, FAIL, "H5Screate_simple");
+
+ /* test 1 */
+ coord[0] = 5;
+ coord[1] = 15;
+ coord[2] = POWER16;
+ coord[3] = 19;
+ ret = H5Sselect_elements(sid, H5S_SELECT_SET, (size_t)4, coord);
+ CHECK(ret, FAIL, "H5Sselect_elements");
+
+ expected_to_fail = FALSE;
+ expected_enc_size = 4;
+ expected_version = 1;
+
+ if(low >= H5F_LIBVER_V112)
+ expected_version = 2;
+
+ /* Verify the version and encoded size expected for the configuration */
+ ret = test_h5s_check_encoding(fapl, sid, expected_version, expected_enc_size, expected_to_fail);
+ CHECK(ret, FAIL, "test_h5s_check_encoding");
+
+ /* test 2 */
+ coord[0] = 5;
+ coord[1] = 15;
+ coord[2] = POWER32 - 1;
+ coord[3] = 19;
+ ret = H5Sselect_elements(sid, H5S_SELECT_SET, (size_t)4, coord);
+ CHECK(ret, FAIL, "H5Sselect_elements");
+
+ /* Expected result same as test 1 */
+ ret = test_h5s_check_encoding(fapl, sid, expected_version, expected_enc_size, expected_to_fail);
+ CHECK(ret, FAIL, "test_h5s_check_encoding");
+
+ /* test 3 */
+ if(high <= H5F_LIBVER_V110)
+ expected_to_fail = TRUE;
+
+ if(high >= H5F_LIBVER_V112) {
+ expected_version = 2;
+ expected_enc_size = 8;
+ }
+
+ coord[0] = 5;
+ coord[1] = 15;
+ coord[2] = POWER32 + 1;
+ coord[3] = 19;
+ ret = H5Sselect_elements(sid, H5S_SELECT_SET, (size_t)4, coord);
+ CHECK(ret, FAIL, "H5Sselect_elements");
+
+ /* Verify the version and encoded size expected for the configuration */
+ ret = test_h5s_check_encoding(fapl, sid, expected_version, expected_enc_size, expected_to_fail);
+ CHECK(ret, FAIL, "test_h5s_check_encoding");
+
+ /* Close the dataspace */
+ ret = H5Sclose(sid);
+ CHECK(ret, FAIL, "H5Sclose");
+
+} /* test_h5s_encode_points() */
+
+/****************************************************************
+**
+** test_h5s_encode_length():
+** Test to verify HDFFV-10271 is fixed.
+** Verify that version 2 hyperslab encoding length is correct.
+**
+** See "RFC: H5Sencode/H5Sdecode Format Change" for the
+** description of the encoding format.
+**
+****************************************************************/
+static void
+test_h5s_encode_length(void)
+{
+ hid_t sid; /* Dataspace ID */
+ hid_t decoded_sid; /* Dataspace ID from H5Sdecode2 */
+ size_t sbuf_size=0; /* Buffer size for H5Sencode2/1 */
+ unsigned char *sbuf=NULL; /* Buffer for H5Sencode2/1 */
+ hsize_t dims[1] = {500}; /* Dimension size */
+ hsize_t start, count, block, stride; /* Hyperslab selection specifications */
+ herr_t ret; /* Generic return value */
+
+ /* Output message about test being performed */
+ MESSAGE(5, ("Testing Version 2 Hyperslab Encoding Length is correct\n"));
+
+ /* Create dataspace */
+ sid = H5Screate_simple(1, dims, NULL);
+ CHECK(sid, FAIL, "H5Screate_simple");
+
+ /* Setting H5S_UNLIMITED in count will use version 2 for hyperslab encoding */
+ start = 0;
+ stride = 10;
+ block = 4;
+ count = H5S_UNLIMITED;
+
+ /* Set hyperslab selection */
+ ret = H5Sselect_hyperslab(sid, H5S_SELECT_SET, &start, &stride, &count, &block);
+ CHECK(ret, FAIL, "H5Sselect_hyperslab");
+
+ /* Encode simple data space in a buffer */
+ ret = H5Sencode2(sid, NULL, &sbuf_size, H5P_DEFAULT);
+ CHECK(ret, FAIL, "H5Sencode");
+
+ /* Allocate the buffer */
+ if(sbuf_size > 0) {
+ sbuf = (unsigned char*)HDcalloc((size_t)1, sbuf_size);
+ CHECK(sbuf, NULL, "H5Sencode2");
+ }
+
+ /* Encode the dataspace */
+ ret = H5Sencode2(sid, sbuf, &sbuf_size, H5P_DEFAULT);
+ CHECK(ret, FAIL, "H5Sencode");
+
+ /* Verify that length stored at this location in the buffer is correct */
+ VERIFY((uint32_t)sbuf[40], 36, "Length for encoding version 2");
+ VERIFY((uint32_t)sbuf[35], 2, "Hyperslab encoding version is 2");
+
+ /* Decode from the dataspace buffer and return an object handle */
+ decoded_sid = H5Sdecode(sbuf);
+ CHECK(decoded_sid, FAIL, "H5Sdecode");
+
+ /* Verify that the original and the decoded dataspace are equal */
+ VERIFY(H5Sget_select_npoints(sid), H5Sget_select_npoints(decoded_sid), "Compare npoints");
+
+ /* Close the decoded dataspace */
+ ret = H5Sclose(decoded_sid);
+ CHECK(ret, FAIL, "H5Sclose");
+
+ /* Free the buffer */
+ if(sbuf)
+ HDfree(sbuf);
+
+ /* Close the original dataspace */
+ ret = H5Sclose(sid);
+ CHECK(ret, FAIL, "H5Sclose");
+
+} /* test_h5s_encode_length() */
/****************************************************************
**
@@ -1331,14 +2174,14 @@ test_h5s_encode(void)
static void
test_h5s_scalar_write(void)
{
- hid_t fid1; /* HDF5 File IDs */
- hid_t dataset; /* Dataset ID */
- hid_t sid1; /* Dataspace ID */
- int rank; /* Logical rank of dataspace */
- hsize_t tdims[4]; /* Dimension array to test with */
- hssize_t n; /* Number of dataspace elements */
- H5S_class_t ext_type; /* Extent type */
- herr_t ret; /* Generic return value */
+ hid_t fid1; /* HDF5 File IDs */
+ hid_t dataset; /* Dataset ID */
+ hid_t sid1; /* Dataspace ID */
+ int rank; /* Logical rank of dataspace */
+ hsize_t tdims[4]; /* Dimension array to test with */
+ hssize_t n; /* Number of dataspace elements */
+ H5S_class_t ext_type; /* Extent type */
+ herr_t ret; /* Generic return value */
/* Output message about test being performed */
MESSAGE(5, ("Testing Scalar Dataspace Manipulation during Writing\n"));
@@ -1357,14 +2200,17 @@ test_h5s_scalar_write(void)
sid1 = H5Screate_simple(SPACE3_RANK, NULL, NULL);
CHECK(sid1, FAIL, "H5Screate_simple");
+ /* Retrieve the number of elements in the dataspace selection */
n = H5Sget_simple_extent_npoints(sid1);
CHECK(n, FAIL, "H5Sget_simple_extent_npoints");
VERIFY(n, 1, "H5Sget_simple_extent_npoints");
+ /* Get the dataspace rank */
rank = H5Sget_simple_extent_ndims(sid1);
CHECK(rank, FAIL, "H5Sget_simple_extent_ndims");
VERIFY(rank, SPACE3_RANK, "H5Sget_simple_extent_ndims");
+ /* Get the dataspace dimension sizes */
rank = H5Sget_simple_extent_dims(sid1, tdims, NULL);
VERIFY(rank, 0, "H5Sget_simple_extent_dims");
@@ -1376,6 +2222,7 @@ test_h5s_scalar_write(void)
dataset = H5Dcreate2(fid1, "Dataset1", H5T_NATIVE_UINT, sid1, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
CHECK(dataset, FAIL, "H5Dcreate2");
+ /* Write to the dataset */
ret = H5Dwrite(dataset, H5T_NATIVE_UINT, H5S_ALL, H5S_ALL, H5P_DEFAULT, &space3_data);
CHECK(ret, FAIL, "H5Dwrite");
@@ -1390,7 +2237,7 @@ test_h5s_scalar_write(void)
/* Close file */
ret = H5Fclose(fid1);
CHECK(ret, FAIL, "H5Fclose");
-} /* test_h5s_scalar_write() */
+} /* test_h5s_scalar_write() */
/****************************************************************
**
@@ -2509,15 +3356,38 @@ test_versionbounds(void)
void
test_h5s(void)
{
+ H5F_libver_t low, high; /* Low and high bounds */
+
/* Output message about test being performed */
MESSAGE(5, ("Testing Dataspaces\n"));
- test_h5s_basic(); /* Test basic H5S code */
- test_h5s_null(); /* Test Null dataspace H5S code */
+ test_h5s_basic(); /* Test basic H5S code */
+ test_h5s_null(); /* Test Null dataspace H5S code */
test_h5s_zero_dim(); /* Test dataspace with zero dimension size */
- test_h5s_encode(); /* Test encoding and decoding */
+
+ /* Loop through all the combinations of low/high version bounds */
+ for(low = H5F_LIBVER_EARLIEST; low < H5F_LIBVER_NBOUNDS; low++) {
+ for(high = H5F_LIBVER_EARLIEST; high < H5F_LIBVER_NBOUNDS; high++) {
+
+ /* Invalid combinations, just continue */
+ if(high == H5F_LIBVER_EARLIEST || high < low)
+ continue;
+
+ test_h5s_encode(low, high); /* Test encoding and decoding */
+ test_h5s_encode_regular_hyper(low, high); /* Test encoding regular hyperslabs */
+ test_h5s_encode_irregular_hyper(low, high); /* Test encoding irregular hyperslabs */
+ test_h5s_encode_points(low, high); /* Test encoding points */
+
+ } /* end high bound */
+ } /* end low bound */
+
+ test_h5s_encode_length(); /* Test version 2 hyperslab encoding length is correct */
+#ifndef H5_NO_DEPRECATED_SYMBOLS
+ test_h5s_encode1(); /* Test operations with old API routine (H5Sencode1) */
+#endif /* H5_NO_DEPRECATED_SYMBOLS */
+
test_h5s_scalar_write(); /* Test scalar H5S writing code */
- test_h5s_scalar_read(); /* Test scalar H5S reading code */
+ test_h5s_scalar_read(); /* Test scalar H5S reading code */
test_h5s_compound_scalar_write(); /* Test compound datatype scalar H5S writing code */
test_h5s_compound_scalar_read(); /* Test compound datatype scalar H5S reading code */
diff --git a/test/tid.c b/test/tid.c
index 8a27c3b..7f61c6a 100644
--- a/test/tid.c
+++ b/test/tid.c
@@ -251,7 +251,10 @@ static int id_predefined_test(void )
testObj = HDmalloc(sizeof(int));
- /* Try to perform illegal functions on various predefined types */
+ /*
+ * Attempt to perform public functions on various library types
+ */
+
H5E_BEGIN_TRY
testID = H5Iregister(H5I_FILE, testObj);
H5E_END_TRY
@@ -292,7 +295,26 @@ static int id_predefined_test(void )
if(testErr >= 0)
goto out;
- /* Create a datatype ID and try to perform illegal functions on it */
+ H5E_BEGIN_TRY
+ testErr = H5Itype_exists(H5I_GROUP);
+ H5E_END_TRY
+
+ VERIFY(testErr, -1, "H5Itype_exists");
+ if(testErr != -1)
+ goto out;
+
+ H5E_BEGIN_TRY
+ testErr = H5Itype_exists(H5I_ATTR);
+ H5E_END_TRY
+
+ VERIFY(testErr, -1, "H5Itype_exists");
+ if(testErr != -1)
+ goto out;
+
+ /*
+ * Create a datatype ID and try to perform illegal functions on it
+ */
+
typeID = H5Tcreate(H5T_OPAQUE, (size_t)42);
CHECK(typeID, H5I_INVALID_HID, "H5Tcreate");
if(typeID == H5I_INVALID_HID)
@@ -317,7 +339,7 @@ static int id_predefined_test(void )
H5Tclose(typeID);
/* testObj was never registered as an atom, so it will not be
- * automatically freed. */
+ * automatically freed. */
HDfree(testObj);
return 0;
diff --git a/test/titerate.c b/test/titerate.c
index 87ddfb8..54e9b5e 100644
--- a/test/titerate.c
+++ b/test/titerate.c
@@ -116,7 +116,7 @@ liter_cb(hid_t H5_ATTR_UNUSED group, const char *name, const H5L_info_t H5_ATTR_
return(count2 > 10 ? 1 : 0);
default:
- printf("invalid iteration command");
+ HDprintf("invalid iteration command");
return(-1);
} /* end switch */
} /* end liter_cb() */
@@ -163,7 +163,7 @@ test_iter_group(hid_t fapl, hbool_t new_format)
CHECK(filespace, FAIL, "H5Screate");
for(i=0; i< NDATASETS; i++) {
- sprintf(name,"Dataset %d",i);
+ HDsprintf(name,"Dataset %d",i);
dataset = H5Dcreate2(file, name, datatype, filespace, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
CHECK(dataset, FAIL, "H5Dcreate2");
@@ -737,7 +737,7 @@ static void test_grp_memb_funcs(hid_t fapl)
CHECK(filespace, FAIL, "H5Screate");
for(i = 0; i < NDATASETS; i++) {
- sprintf(name, "Dataset %d", i);
+ HDsprintf(name, "Dataset %d", i);
dataset = H5Dcreate2(file, name, datatype, filespace, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
CHECK(dataset, FAIL, "H5Dcreate2");
@@ -945,7 +945,7 @@ find_err_msg_cb(unsigned n, const H5E_error2_t *err_desc, void *_client_data)
searched_err_t *searched_err = (searched_err_t *)_client_data;
if (searched_err == NULL)
- return -1;
+ return H5_ITER_ERROR;
/* If the searched error message is found, stop the iteration */
if (err_desc->desc != NULL && strcmp(err_desc->desc, searched_err->message) == 0)
@@ -953,6 +953,7 @@ find_err_msg_cb(unsigned n, const H5E_error2_t *err_desc, void *_client_data)
searched_err->found = true;
status = H5_ITER_STOP;
}
+
return status;
} /* end find_err_msg_cb() */
@@ -988,6 +989,7 @@ static void test_corrupted_attnamelen(void)
/* 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);
+ VERIFY(err_status, FAIL, "H5Aiterate2");
/* Make sure the intended error was caught */
if(err_status == -1)
@@ -1077,6 +1079,6 @@ test_iterate(void)
void
cleanup_iterate(void)
{
- remove(DATAFILE);
+ HDremove(DATAFILE);
}
diff --git a/test/trefer.c b/test/trefer.c
index 4f76cb3..4bf9caf 100644
--- a/test/trefer.c
+++ b/test/trefer.c
@@ -490,43 +490,48 @@ test_reference_obj(void)
** test_reference_region(): Test basic H5R (reference) object reference code.
** Tests references to various kinds of objects
**
+** Note: The libver_low/libver_high parameters are added to create the file
+** with the low and high bounds setting in fapl.
+** Please see the RFC for "H5Sencode/H5Sdecode Format Change".
+**
****************************************************************/
static void
-test_reference_region(void)
+test_reference_region(H5F_libver_t libver_low, H5F_libver_t libver_high)
{
- hid_t fid1; /* HDF5 File IDs */
- hid_t dset1, /* Dataset ID */
- dset2; /* Dereferenced dataset ID */
- hid_t sid1, /* Dataspace ID #1 */
- sid2; /* Dataspace ID #2 */
- hid_t dapl_id; /* Dataset access property list */
- hsize_t dims1[] = {SPACE1_DIM1},
- dims2[] = {SPACE2_DIM1, SPACE2_DIM2};
- hsize_t start[SPACE2_RANK]; /* Starting location of hyperslab */
- hsize_t stride[SPACE2_RANK]; /* Stride of hyperslab */
- hsize_t count[SPACE2_RANK]; /* Element count of hyperslab */
- hsize_t block[SPACE2_RANK]; /* Block size of hyperslab */
- hsize_t coord1[POINT1_NPOINTS][SPACE2_RANK]; /* Coordinates for point selection */
- hsize_t * coords; /* Coordinate buffer */
- hsize_t low[SPACE2_RANK]; /* Selection bounds */
- hsize_t high[SPACE2_RANK]; /* Selection bounds */
- hdset_reg_ref_t *wbuf, /* buffer to write to disk */
- *rbuf; /* buffer read from disk */
+ hid_t fid1; /* HDF5 File IDs */
+ hid_t fapl = -1; /* File access property list */
+ hid_t dset1, /* Dataset ID */
+ dset2; /* Dereferenced dataset ID */
+ hid_t sid1, /* Dataspace ID #1 */
+ sid2; /* Dataspace ID #2 */
+ hid_t dapl_id; /* Dataset access property list */
+ hsize_t dims1[] = {SPACE1_DIM1},
+ dims2[] = {SPACE2_DIM1, SPACE2_DIM2};
+ hsize_t start[SPACE2_RANK]; /* Starting location of hyperslab */
+ hsize_t stride[SPACE2_RANK]; /* Stride of hyperslab */
+ hsize_t count[SPACE2_RANK]; /* Element count of hyperslab */
+ hsize_t block[SPACE2_RANK]; /* Block size of hyperslab */
+ hsize_t coord1[POINT1_NPOINTS][SPACE2_RANK]; /* Coordinates for point selection */
+ hsize_t *coords; /* Coordinate buffer */
+ hsize_t low[SPACE2_RANK]; /* Selection bounds */
+ hsize_t high[SPACE2_RANK]; /* Selection bounds */
+ hdset_reg_ref_t *wbuf, /* buffer to write to disk */
+ *rbuf; /* buffer read from disk */
hdset_reg_ref_t nvrbuf[3]={{0},{101},{255}}; /* buffer with non-valid refs */
- uint8_t *dwbuf, /* Buffer for writing numeric data to disk */
- *drbuf; /* Buffer for reading numeric data from disk */
- uint8_t *tu8; /* Temporary pointer to uint8 data */
- H5O_type_t obj_type; /* Type of object */
- int i, j; /* counting variables */
- hssize_t hssize_ret; /* hssize_t return value */
- htri_t tri_ret; /* htri_t return value */
- herr_t ret; /* Generic return value */
- haddr_t addr = HADDR_UNDEF; /* test for undefined reference */
- hid_t dset_NA; /* Dataset id for undefined reference */
- hid_t space_NA; /* Dataspace id for undefined reference */
- hsize_t dims_NA[1] = {1}; /* Dims array for undefined reference */
- hdset_reg_ref_t wdata_NA[1], /* Write buffer */
- rdata_NA[1]; /* Read buffer */
+ uint8_t *dwbuf, /* Buffer for writing numeric data to disk */
+ *drbuf; /* Buffer for reading numeric data from disk */
+ uint8_t *tu8; /* Temporary pointer to uint8 data */
+ H5O_type_t obj_type; /* Type of object */
+ int i, j; /* counting variables */
+ hssize_t hssize_ret; /* hssize_t return value */
+ htri_t tri_ret; /* htri_t return value */
+ herr_t ret; /* Generic return value */
+ haddr_t addr = HADDR_UNDEF; /* test for undefined reference */
+ hid_t dset_NA; /* Dataset id for undefined reference */
+ hid_t space_NA; /* Dataspace id for undefined reference */
+ hsize_t dims_NA[1] = {1}; /* Dims array for undefined reference */
+ hdset_reg_ref_t wdata_NA[1], /* Write buffer */
+ rdata_NA[1]; /* Read buffer */
/* Output message about test being performed */
MESSAGE(5, ("Testing Dataset Region Reference Functions\n"));
@@ -537,8 +542,16 @@ test_reference_region(void)
dwbuf = (uint8_t *)HDmalloc(sizeof(uint8_t) * SPACE2_DIM1 * SPACE2_DIM2);
drbuf = (uint8_t *)HDcalloc(sizeof(uint8_t), (size_t)(SPACE2_DIM1 * SPACE2_DIM2));
- /* Create file */
- fid1 = H5Fcreate(FILE2, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
+ /* Create file access property list */
+ fapl = H5Pcreate(H5P_FILE_ACCESS);
+ CHECK(fapl, FAIL, "H5Pcreate");
+
+ /* Set the low/high version bounds in fapl */
+ ret = H5Pset_libver_bounds(fapl, libver_low, libver_high);
+ CHECK(ret, FAIL, "H5Pset_libver_bounds");
+
+ /* Create file with the fapl */
+ fid1 = H5Fcreate(FILE2, H5F_ACC_TRUNC, H5P_DEFAULT, fapl);
CHECK(fid1, FAIL, "H5Fcreate");
/* Create dataspace for datasets */
@@ -625,8 +638,15 @@ test_reference_region(void)
VERIFY(hssize_ret, (hssize_t)H5S_UNLIMITED, "H5Sget_select_npoints");
/* Store third dataset region */
- ret = H5Rcreate(&wbuf[2], fid1, "/Dataset2", H5R_DATASET_REGION, sid2);
- CHECK(ret, FAIL, "H5Rcreate");
+ H5E_BEGIN_TRY {
+ ret = H5Rcreate(&wbuf[2], fid1, "/Dataset2", H5R_DATASET_REGION, sid2);
+ } H5E_END_TRY;
+
+ if(libver_high < H5F_LIBVER_V110)
+ VERIFY(ret, FAIL, "H5Rcreate");
+ else
+ CHECK(ret, FAIL, "H5Rcreate");
+
ret = H5Rget_obj_type2(dset1, H5R_DATASET_REGION, &wbuf[0], &obj_type);
CHECK(ret, FAIL, "H5Rget_obj_type2");
VERIFY(obj_type, H5O_TYPE_DATASET, "H5Rget_obj_type2");
@@ -677,7 +697,7 @@ test_reference_region(void)
CHECK(ret, FAIL, "H5Fclose");
/* Re-open the file */
- fid1 = H5Fopen(FILE2, H5F_ACC_RDWR, H5P_DEFAULT);
+ fid1 = H5Fopen(FILE2, H5F_ACC_RDWR, fapl);
CHECK(fid1, FAIL, "H5Fopen");
/*
@@ -822,30 +842,32 @@ test_reference_region(void)
ret = H5Sclose(sid2);
CHECK(ret, FAIL, "H5Sclose");
- /* Get the unlimited selection */
- sid2 = H5Rget_region(dset1, H5R_DATASET_REGION, &rbuf[2]);
- CHECK(sid2, FAIL, "H5Rget_region");
-
- /* Verify correct hyperslab selected */
- hssize_ret = H5Sget_select_npoints(sid2);
- VERIFY(hssize_ret, (hssize_t)H5S_UNLIMITED, "H5Sget_select_npoints");
- tri_ret = H5Sis_regular_hyperslab(sid2);
- CHECK(tri_ret, FAIL, "H5Sis_regular_hyperslab");
- VERIFY(tri_ret, TRUE, "H5Sis_regular_hyperslab Result");
- ret = H5Sget_regular_hyperslab(sid2, start, stride, count, block);
- CHECK(ret, FAIL, "H5Sget_regular_hyperslab");
- VERIFY(start[0], (hsize_t)1, "Hyperslab Coordinates");
- VERIFY(start[1], (hsize_t)8, "Hyperslab Coordinates");
- VERIFY(stride[0], (hsize_t)4, "Hyperslab Coordinates");
- VERIFY(stride[1], (hsize_t)1, "Hyperslab Coordinates");
- VERIFY(count[0], H5S_UNLIMITED, "Hyperslab Coordinates");
- VERIFY(count[1], (hsize_t)1, "Hyperslab Coordinates");
- VERIFY(block[0], (hsize_t)2, "Hyperslab Coordinates");
- VERIFY(block[1], (hsize_t)2, "Hyperslab Coordinates");
-
- /* Close region space */
- ret = H5Sclose(sid2);
- CHECK(ret, FAIL, "H5Sclose");
+ if(libver_high >= H5F_LIBVER_V110) {
+ /* Get the unlimited selection */
+ sid2 = H5Rget_region(dset1, H5R_DATASET_REGION, &rbuf[2]);
+ CHECK(sid2, FAIL, "H5Rget_region");
+
+ /* Verify correct hyperslab selected */
+ hssize_ret = H5Sget_select_npoints(sid2);
+ VERIFY(hssize_ret, (hssize_t)H5S_UNLIMITED, "H5Sget_select_npoints");
+ tri_ret = H5Sis_regular_hyperslab(sid2);
+ CHECK(tri_ret, FAIL, "H5Sis_regular_hyperslab");
+ VERIFY(tri_ret, TRUE, "H5Sis_regular_hyperslab Result");
+ ret = H5Sget_regular_hyperslab(sid2, start, stride, count, block);
+ CHECK(ret, FAIL, "H5Sget_regular_hyperslab");
+ VERIFY(start[0], (hsize_t)1, "Hyperslab Coordinates");
+ VERIFY(start[1], (hsize_t)8, "Hyperslab Coordinates");
+ VERIFY(stride[0], (hsize_t)4, "Hyperslab Coordinates");
+ VERIFY(stride[1], (hsize_t)1, "Hyperslab Coordinates");
+ VERIFY(count[0], H5S_UNLIMITED, "Hyperslab Coordinates");
+ VERIFY(count[1], (hsize_t)1, "Hyperslab Coordinates");
+ VERIFY(block[0], (hsize_t)2, "Hyperslab Coordinates");
+ VERIFY(block[1], (hsize_t)2, "Hyperslab Coordinates");
+
+ /* Close region space */
+ ret = H5Sclose(sid2);
+ CHECK(ret, FAIL, "H5Sclose");
+ }
/* Close first space */
ret = H5Sclose(sid1);
@@ -887,34 +909,39 @@ test_reference_region(void)
** test_reference_region_1D(): Test H5R (reference) object reference code.
** Tests 1-D references to various kinds of objects
**
+** Note: The libver_low/libver_high parameters are added to create the file
+** with the low and high bounds setting in fapl.
+** Please see the RFC for "H5Sencode/H5Sdecode Format Change".
+**
****************************************************************/
static void
-test_reference_region_1D(void)
+test_reference_region_1D(H5F_libver_t libver_low, H5F_libver_t libver_high)
{
- hid_t fid1; /* HDF5 File IDs */
- hid_t dset1, /* Dataset ID */
- dset3; /* Dereferenced dataset ID */
- hid_t sid1, /* Dataspace ID #1 */
- sid3; /* Dataspace ID #3 */
- hid_t dapl_id; /* Dataset access property list */
- hsize_t dims1[] = {SPACE1_DIM1},
- dims3[] = {SPACE3_DIM1};
- hsize_t start[SPACE3_RANK]; /* Starting location of hyperslab */
- hsize_t stride[SPACE3_RANK]; /* Stride of hyperslab */
- hsize_t count[SPACE3_RANK]; /* Element count of hyperslab */
- hsize_t block[SPACE3_RANK]; /* Block size of hyperslab */
- hsize_t coord1[POINT1_NPOINTS][SPACE3_RANK]; /* Coordinates for point selection */
- hsize_t * coords; /* Coordinate buffer */
- hsize_t low[SPACE3_RANK]; /* Selection bounds */
- hsize_t high[SPACE3_RANK]; /* Selection bounds */
- hdset_reg_ref_t *wbuf, /* buffer to write to disk */
- *rbuf; /* buffer read from disk */
- uint8_t *dwbuf, /* Buffer for writing numeric data to disk */
- *drbuf; /* Buffer for reading numeric data from disk */
- uint8_t *tu8; /* Temporary pointer to uint8 data */
- H5O_type_t obj_type; /* Object type */
- int i; /* counting variables */
- herr_t ret; /* Generic return value */
+ hid_t fid1; /* HDF5 File IDs */
+ hid_t fapl = -1; /* File access property list */
+ hid_t dset1, /* Dataset ID */
+ dset3; /* Dereferenced dataset ID */
+ hid_t sid1, /* Dataspace ID #1 */
+ sid3; /* Dataspace ID #3 */
+ hid_t dapl_id; /* Dataset access property list */
+ hsize_t dims1[] = {SPACE1_DIM1},
+ dims3[] = {SPACE3_DIM1};
+ hsize_t start[SPACE3_RANK]; /* Starting location of hyperslab */
+ hsize_t stride[SPACE3_RANK]; /* Stride of hyperslab */
+ hsize_t count[SPACE3_RANK]; /* Element count of hyperslab */
+ hsize_t block[SPACE3_RANK]; /* Block size of hyperslab */
+ hsize_t coord1[POINT1_NPOINTS][SPACE3_RANK]; /* Coordinates for point selection */
+ hsize_t *coords; /* Coordinate buffer */
+ hsize_t low[SPACE3_RANK]; /* Selection bounds */
+ hsize_t high[SPACE3_RANK]; /* Selection bounds */
+ hdset_reg_ref_t *wbuf, /* buffer to write to disk */
+ *rbuf; /* buffer read from disk */
+ uint8_t *dwbuf, /* Buffer for writing numeric data to disk */
+ *drbuf; /* Buffer for reading numeric data from disk */
+ uint8_t *tu8; /* Temporary pointer to uint8 data */
+ H5O_type_t obj_type; /* Object type */
+ int i; /* counting variables */
+ herr_t ret; /* Generic return value */
/* Output message about test being performed */
MESSAGE(5, ("Testing 1-D Dataset Region Reference Functions\n"));
@@ -925,8 +952,16 @@ test_reference_region_1D(void)
dwbuf = (uint8_t *)HDmalloc(sizeof(uint8_t) * SPACE3_DIM1);
drbuf = (uint8_t *)HDcalloc(sizeof(uint8_t), (size_t)SPACE3_DIM1);
- /* Create file */
- fid1 = H5Fcreate(FILE2, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
+ /* Create the file access property list */
+ fapl = H5Pcreate(H5P_FILE_ACCESS);
+ CHECK(fapl, FAIL, "H5Pcreate");
+
+ /* Set the low/high version bounds in fapl */
+ ret = H5Pset_libver_bounds(fapl, libver_low, libver_high);
+ CHECK(ret, FAIL, "H5Pset_libver_bounds");
+
+ /* Create file with the fapl */
+ fid1 = H5Fcreate(FILE2, H5F_ACC_TRUNC, H5P_DEFAULT, fapl);
CHECK(fid1, FAIL, "H5Fcreate");
/* Create dataspace for datasets */
@@ -1022,7 +1057,7 @@ test_reference_region_1D(void)
CHECK(ret, FAIL, "H5Fclose");
/* Re-open the file */
- fid1 = H5Fopen(FILE2, H5F_ACC_RDWR, H5P_DEFAULT);
+ fid1 = H5Fopen(FILE2, H5F_ACC_RDWR, fapl);
CHECK(fid1, FAIL, "H5Fopen");
/* Open the dataset */
@@ -1156,6 +1191,10 @@ test_reference_region_1D(void)
ret = H5Pclose(dapl_id);
CHECK(ret, FAIL, "H5Pclose");
+ /* Close file access property list */
+ ret = H5Pclose(fapl);
+ CHECK(ret, FAIL, "H5Pclose");
+
/* Close file */
ret = H5Fclose(fid1);
CHECK(ret, FAIL, "H5Fclose");
@@ -1733,13 +1772,28 @@ test_reference_compat(void)
void
test_reference(void)
{
+ H5F_libver_t low, high; /* Low and high bounds */
+
/* Output message about test being performed */
MESSAGE(5, ("Testing References\n"));
test_reference_params(); /* Test for correct parameter checking */
test_reference_obj(); /* Test basic H5R object reference code */
- test_reference_region(); /* Test basic H5R dataset region reference code */
- test_reference_region_1D(); /* Test H5R dataset region reference code for 1-D datasets */
+
+ /* Loop through all the combinations of low/high version bounds */
+ for(low = H5F_LIBVER_EARLIEST; low < H5F_LIBVER_NBOUNDS; low++) {
+ for(high = H5F_LIBVER_EARLIEST; high < H5F_LIBVER_NBOUNDS; high++) {
+
+ /* Invalid combinations, just continue */
+ if(high == H5F_LIBVER_EARLIEST || high < low)
+ continue;
+
+ test_reference_region(low, high); /* Test basic H5R dataset region reference code */
+ test_reference_region_1D(low, high); /* Test H5R dataset region reference code for 1-D datasets */
+
+ } /* end high bound */
+ } /* end low bound */
+
test_reference_obj_deleted(); /* Test H5R object reference code for deleted objects */
test_reference_group(); /* Test operations on dereferenced groups */
#ifndef H5_NO_DEPRECATED_SYMBOLS
diff --git a/test/tselect.c b/test/tselect.c
index bcc2a5b..ad435cb 100644
--- a/test/tselect.c
+++ b/test/tselect.c
@@ -157,6 +157,12 @@
#define SPACERE5_DIM3 12
#define SPACERE5_DIM4 8
+/* Information for Space update diminfo test */
+#define SPACEUD1_DIM0 20
+#define SPACEUD3_DIM0 9
+#define SPACEUD3_DIM1 12
+#define SPACEUD3_DIM2 13
+
/* #defines for shape same / different rank tests */
#define SS_DR_MAX_RANK 5
@@ -167,6 +173,9 @@
#define SPACE13_DIM3 50
#define SPACE13_NPOINTS 4
+/* Information for testing selection iterators */
+#define SEL_ITER_MAX_SEQ 256
+
/* Location comparison function */
static int compare_size_t(const void *s1, const void *s2);
@@ -1888,9 +1897,9 @@ test_select_hyper_contig_dr__run_test(int test_num, const uint16_t *cube_buf,
/* verify that H5S_select_shape_same() reports the two
* selections as having the same shape.
*/
- check = H5S_select_shape_same_test(small_cube_sid,
+ check = H5S__select_shape_same_test(small_cube_sid,
file_large_cube_sid);
- VERIFY(check, TRUE, "H5S_select_shape_same_test");
+ VERIFY(check, TRUE, "H5S__select_shape_same_test");
/* Read selection from disk */
ret = H5Dread(large_cube_dataset,
@@ -1965,9 +1974,9 @@ test_select_hyper_contig_dr__run_test(int test_num, const uint16_t *cube_buf,
/* verify that H5S_select_shape_same() reports the two
* selections as having the same shape.
*/
- check = H5S_select_shape_same_test(small_cube_sid,
+ check = H5S__select_shape_same_test(small_cube_sid,
mem_large_cube_sid);
- VERIFY(check, TRUE, "H5S_select_shape_same_test");
+ VERIFY(check, TRUE, "H5S__select_shape_same_test");
/* Read selection from disk */
@@ -2082,9 +2091,9 @@ test_select_hyper_contig_dr__run_test(int test_num, const uint16_t *cube_buf,
* memory slice through the cube selection and the
* on disk full small cube selections as having the same shape.
*/
- check = H5S_select_shape_same_test(small_cube_sid,
+ check = H5S__select_shape_same_test(small_cube_sid,
mem_large_cube_sid);
- VERIFY(check, TRUE, "H5S_select_shape_same_test");
+ VERIFY(check, TRUE, "H5S__select_shape_same_test");
/* write the slice from the in memory large cube to the on disk small cube */
@@ -2193,9 +2202,9 @@ test_select_hyper_contig_dr__run_test(int test_num, const uint16_t *cube_buf,
* on disk slice through the large cube selection
* as having the same shape.
*/
- check = H5S_select_shape_same_test(small_cube_sid,
+ check = H5S__select_shape_same_test(small_cube_sid,
file_large_cube_sid);
- VERIFY(check, TRUE, "H5S_select_shape_same_test");
+ VERIFY(check, TRUE, "H5S__select_shape_same_test");
/* write the cube from memory to the target slice of the disk cube */
@@ -2998,9 +3007,9 @@ test_select_hyper_checker_board_dr__run_test(int test_num, const uint16_t *cube_
/* verify that H5S_select_shape_same() reports the two
* selections as having the same shape.
*/
- check = H5S_select_shape_same_test(mem_small_cube_sid,
+ check = H5S__select_shape_same_test(mem_small_cube_sid,
file_large_cube_sid);
- VERIFY(check, TRUE, "H5S_select_shape_same_test");
+ VERIFY(check, TRUE, "H5S__select_shape_same_test");
/* zero the buffer that we will be using for reading */
HDmemset(small_cube_buf_1, 0, sizeof(*small_cube_buf_1) * small_cube_size);
@@ -3105,9 +3114,9 @@ test_select_hyper_checker_board_dr__run_test(int test_num, const uint16_t *cube_
/* verify that H5S_select_shape_same() reports the two
* selections as having the same shape.
*/
- check = H5S_select_shape_same_test(file_small_cube_sid,
+ check = H5S__select_shape_same_test(file_small_cube_sid,
mem_large_cube_sid);
- VERIFY(check, TRUE, "H5S_select_shape_same_test");
+ VERIFY(check, TRUE, "H5S__select_shape_same_test");
/* zero out the in memory large cube */
@@ -3258,9 +3267,9 @@ test_select_hyper_checker_board_dr__run_test(int test_num, const uint16_t *cube_
/* verify that H5S_select_shape_same() reports the two
* selections as having the same shape.
*/
- check = H5S_select_shape_same_test(file_small_cube_sid,
+ check = H5S__select_shape_same_test(file_small_cube_sid,
mem_large_cube_sid);
- VERIFY(check, TRUE, "H5S_select_shape_same_test");
+ VERIFY(check, TRUE, "H5S__select_shape_same_test");
/* write the slice from the in memory large cube to the
@@ -3390,9 +3399,9 @@ test_select_hyper_checker_board_dr__run_test(int test_num, const uint16_t *cube_
/* verify that H5S_select_shape_same() reports the two
* selections as having the same shape.
*/
- check = H5S_select_shape_same_test(file_large_cube_sid,
+ check = H5S__select_shape_same_test(file_large_cube_sid,
mem_small_cube_sid);
- VERIFY(check, TRUE, "H5S_select_shape_same_test");
+ VERIFY(check, TRUE, "H5S__select_shape_same_test");
/* write the checker board selection of the in memory
@@ -3525,13 +3534,13 @@ test_select_hyper_checker_board_dr__run_test(int test_num, const uint16_t *cube_
/****************************************************************
**
-** test_select_hyper_checker_board_dr(): Test H5S (dataspace)
-** selection code with checkerboard source and target having
+** test_select_hyper_checker_board_dr(): Test H5S (dataspace)
+** selection code with checkerboard source and target having
** different ranks but the same shape. We have already
-** tested H5S_shape_same in isolation, so now we try to do
+** tested H5S_shape_same in isolation, so now we try to do
** I/O.
**
-** This is just an initial smoke check, so we will work
+** This is just an initial smoke check, so we will work
** with a slice through a cube only.
**
****************************************************************/
@@ -4910,12 +4919,11 @@ test_select_hyper_union(void)
HDfree(rbuf);
} /* test_select_hyper_union() */
-#ifdef NEW_HYPERSLAB_API
/****************************************************************
**
** test_select_hyper_union_stagger(): Test basic H5S (dataspace) selection code.
** Tests unions of staggered hyperslabs. (Uses H5Scombine_hyperslab
-** and H5Sselect_select instead of H5Sselect_hyperslab)
+** and H5Smodify_select instead of H5Sselect_hyperslab)
**
****************************************************************/
static void
@@ -4932,11 +4940,11 @@ test_select_hyper_union_stagger(void)
hsize_t count[2]={3,1}; /* 1st Hyperslab size */
hsize_t count2[2]={3,1}; /* 2nd Hyperslab size */
hsize_t count3[2]={2,1}; /* 3rd Hyperslab size */
- hssize_t offset[2]={0,0}; /* 1st Hyperslab offset */
- hssize_t offset2[2]={2,1}; /* 2nd Hyperslab offset */
- hssize_t offset3[2]={4,2}; /* 3rd Hyperslab offset */
+ hsize_t start[2]={0,0}; /* 1st Hyperslab offset */
+ hsize_t start2[2]={2,1}; /* 2nd Hyperslab offset */
+ hsize_t start3[2]={4,2}; /* 3rd Hyperslab offset */
hsize_t count_out[2]={4,2}; /* Hyperslab size in memory */
- hssize_t offset_out[2]={0,3}; /* Hyperslab offset in memory */
+ hsize_t start_out[2]={0,3}; /* Hyperslab offset in memory */
int data[6][5]; /* Data to write */
int data_out[7][7]; /* Data read in */
int input_loc[8][2]={{0,0},
@@ -5007,27 +5015,27 @@ test_select_hyper_union_stagger(void)
CHECK(dataspace, FAIL, "H5Dget_space");
/* Select the hyperslabs */
- error = H5Sselect_hyperslab(dataspace, H5S_SELECT_SET, offset, stride, count, block);
+ error = H5Sselect_hyperslab(dataspace, H5S_SELECT_SET, start, stride, count, block);
CHECK(error, FAIL, "H5Sselect_hyperslab");
- tmp_space = H5Scombine_hyperslab(dataspace, H5S_SELECT_OR, offset2, stride, count2, block);
+ tmp_space = H5Scombine_hyperslab(dataspace, H5S_SELECT_OR, start2, stride, count2, block);
CHECK(tmp_space, FAIL, "H5Scombine_hyperslab");
/* Copy the file dataspace and select hyperslab */
tmp2_space = H5Scopy(dataspace);
CHECK(tmp2_space, FAIL, "H5Scopy");
- error=H5Sselect_hyperslab(tmp2_space,H5S_SELECT_SET,offset3,stride,count3,block);
+ error=H5Sselect_hyperslab(tmp2_space, H5S_SELECT_SET, start3, stride, count3, block);
CHECK(error, FAIL, "H5Sselect_hyperslab");
/* Combine the copied dataspace with the temporary dataspace */
- error=H5Sselect_select(tmp_space,H5S_SELECT_OR,tmp2_space);
- CHECK(error, FAIL, "H5Sselect_select");
+ error=H5Smodify_select(tmp_space,H5S_SELECT_OR,tmp2_space);
+ CHECK(error, FAIL, "H5Smodify_select");
/* Create Memory Dataspace */
memspace=H5Screate_simple(memrank,dimsm,NULL);
CHECK(memspace, FAIL, "H5Screate_simple");
/* Select hyperslab in memory */
- error=H5Sselect_hyperslab(memspace,H5S_SELECT_SET,offset_out,stride,count_out,block);
+ error=H5Sselect_hyperslab(memspace, H5S_SELECT_SET, start_out, stride, count_out, block);
CHECK(error, FAIL, "H5Sselect_hyperslab");
/* Read File Dataset */
@@ -5267,7 +5275,109 @@ test_select_hyper_union_3d(void)
HDfree(wbuf);
HDfree(rbuf);
} /* test_select_hyper_union_3d() */
-#endif /* NEW_HYPERSLAB_API */
+
+/****************************************************************
+**
+** test_select_hyper_valid_combination(): Tests invalid and valid
+** combinations of selections on dataspace for H5Scombine_select
+** and H5Smodify_select.
+**
+****************************************************************/
+static void
+test_select_hyper_valid_combination(void)
+{
+ hid_t single_pt_sid; /* Dataspace ID with single point selection */
+ hid_t single_hyper_sid; /* Dataspace ID with single block hyperslab selection */
+ hid_t regular_hyper_sid; /* Dataspace ID with regular hyperslab selection */
+ hid_t non_existent_sid = -1; /* A non-existent space id */
+ hid_t tmp_sid; /* Temporary dataspace ID */
+ hsize_t dims2D[] = {SPACE9_DIM1, SPACE9_DIM2};
+ hsize_t dims3D[] = {SPACE4_DIM1, SPACE4_DIM2, SPACE4_DIM3};
+
+ hsize_t coord1[1][SPACE2_RANK]; /* Coordinates for single point selection */
+ hsize_t start[SPACE4_RANK]; /* Hyperslab start */
+ hsize_t stride[SPACE4_RANK]; /* Hyperslab stride */
+ hsize_t count[SPACE4_RANK]; /* Hyperslab block count */
+ hsize_t block[SPACE4_RANK]; /* Hyperslab block size */
+ herr_t ret; /* Generic return value */
+
+ /* Output message about test being performed */
+ MESSAGE(6, ("Testing Selection Combination Validity\n"));
+ assert(SPACE9_DIM2>=POINT1_NPOINTS);
+
+ /* Create dataspace for single point selection */
+ single_pt_sid = H5Screate_simple(SPACE9_RANK, dims2D, NULL);
+ CHECK(single_pt_sid, FAIL, "H5Screate_simple");
+
+ /* Select sequence of ten points for multiple point selection */
+ coord1[0][0] = 2; coord1[0][1] = 2;
+ ret = H5Sselect_elements(single_pt_sid, H5S_SELECT_SET, (size_t)1, (const hsize_t *)coord1);
+ CHECK(ret, FAIL, "H5Sselect_elements");
+
+ /* Create dataspace for single hyperslab selection */
+ single_hyper_sid = H5Screate_simple(SPACE9_RANK, dims2D, NULL);
+ CHECK(single_hyper_sid, FAIL, "H5Screate_simple");
+
+ /* Select 10x10 hyperslab for single hyperslab selection */
+ start[0]=1; start[1]=1;
+ stride[0]=1; stride[1]=1;
+ count[0]=1; count[1]=1;
+ block[0]=(SPACE9_DIM1-2); block[1]=(SPACE9_DIM2-2);
+ ret = H5Sselect_hyperslab(single_hyper_sid,H5S_SELECT_SET,start,stride,count,block);
+ CHECK(ret, FAIL, "H5Sselect_hyperslab");
+
+ /* Create dataspace for regular hyperslab selection */
+ regular_hyper_sid = H5Screate_simple(SPACE4_RANK, dims3D, NULL);
+ CHECK(regular_hyper_sid, FAIL, "H5Screate_simple");
+
+ /* Select regular, strided hyperslab selection */
+ start[0]=2; start[1]=2; start[2]=2;
+ stride[0]=2; stride[1]=2; stride[2]=2;
+ count[0]=5; count[1]=2; count[2]=5;
+ block[0]=1; block[1]=1; block[2]=1;
+ ret = H5Sselect_hyperslab(regular_hyper_sid,H5S_SELECT_SET,start,stride,count,block);
+ CHECK(ret, FAIL, "H5Sselect_hyperslab");
+
+
+ /* Test all the selections created */
+
+ /* Test the invalid combinations between point and hyperslab */
+ tmp_sid = H5Scombine_select(single_pt_sid, H5S_SELECT_AND, single_hyper_sid);
+ VERIFY(tmp_sid, FAIL, "H5Scombine_select");
+
+ tmp_sid = H5Smodify_select(single_pt_sid, H5S_SELECT_AND, single_hyper_sid);
+ VERIFY(tmp_sid, FAIL, "H5Smodify_select");
+
+ /* Test the invalid combination between two hyperslab but of different dimension size */
+ tmp_sid = H5Scombine_select(single_hyper_sid, H5S_SELECT_AND, regular_hyper_sid);
+ VERIFY(tmp_sid, FAIL, "H5Scombine_select");
+
+ tmp_sid = H5Smodify_select(single_hyper_sid, H5S_SELECT_AND, regular_hyper_sid);
+ VERIFY(tmp_sid, FAIL, "H5Smodify_select");
+
+ /* Test invalid operation inputs to the two functions */
+ tmp_sid = H5Scombine_select(single_hyper_sid, H5S_SELECT_SET, single_hyper_sid);
+ VERIFY(tmp_sid, FAIL, "H5Scombine_select");
+
+ tmp_sid = H5Smodify_select(single_hyper_sid, H5S_SELECT_SET, single_hyper_sid);
+ VERIFY(tmp_sid, FAIL, "H5Smodify_select");
+
+ /* Test inputs in case of non-existent space ids */
+ tmp_sid = H5Scombine_select(single_hyper_sid, H5S_SELECT_AND, non_existent_sid);
+ VERIFY(tmp_sid, FAIL, "H5Scombine_select");
+
+ tmp_sid = H5Smodify_select(single_hyper_sid, H5S_SELECT_AND, non_existent_sid);
+ VERIFY(tmp_sid, FAIL, "H5Smodify_select");
+
+ /* Close dataspaces */
+ ret = H5Sclose(single_pt_sid);
+ CHECK(ret, FAIL, "H5Sclose");
+ ret = H5Sclose(single_hyper_sid);
+ CHECK(ret, FAIL, "H5Sclose");
+ ret = H5Sclose(regular_hyper_sid);
+ CHECK(ret, FAIL, "H5Sclose");
+} /* test_select_hyper_valid_combination() */
+
/****************************************************************
**
@@ -5902,6 +6012,10 @@ test_select_hyper_union_random_5d(hid_t read_plist)
/* Select hyperslab */
ret = H5Sselect_hyperslab(sid1, (i == 0 ? H5S_SELECT_SET : H5S_SELECT_OR), start, NULL, count, NULL);
CHECK(ret, FAIL, "H5Sselect_hyperslab");
+ if(ret < 0) {
+ TestErrPrintf("Random hyperslabs for seed %u failed!\n", seed);
+ break;
+ } /* end if */
} /* end for */
/* Get the number of elements selected */
@@ -5920,14 +6034,18 @@ test_select_hyper_union_random_5d(hid_t read_plist)
/* Read selection from disk */
ret=H5Dread(dataset,H5T_NATIVE_INT,sid2,sid1,read_plist,rbuf);
CHECK(ret, FAIL, "H5Dread");
+ if(ret < 0) {
+ TestErrPrintf("Random hyperslabs for seed %u failed!\n", seed);
+ break;
+ } /* end if */
/* Compare data read with data written out */
tbuf=rbuf;
ret = H5Diterate(wbuf,H5T_NATIVE_INT,sid1,test_select_hyper_iter2,&tbuf);
- if(ret<0) {
- TestErrPrintf("Random hyperslabs for seed %u failed!\n",seed);
+ if(ret < 0) {
+ TestErrPrintf("Random hyperslabs for seed %u failed!\n", seed);
break;
- }
+ } /* end if */
/* Set the read buffer back to all zeroes */
HDmemset(rbuf, 0, (size_t)SPACE6_DIM1);
@@ -6214,9 +6332,6 @@ test_select_point_chunk(void)
herr_t ret; /* Generic return value */
unsigned *data_out; /* output buffer */
-#ifdef LATER
- unsigned *tmpdata_out; /* output buffer */
-#endif /* LATER */
hsize_t start[SPACE7_RANK]; /* hyperslab offset */
hsize_t count[SPACE7_RANK]; /* size of the hyperslab */
@@ -6585,7 +6700,7 @@ test_select_combine(void)
hsize_t dims[SPACE7_RANK]={SPACE7_DIM1,SPACE7_DIM2}; /* Dimensions of dataspace */
H5S_sel_type sel_type; /* Selection type */
hssize_t nblocks; /* Number of hyperslab blocks */
- hsize_t blocks[128][2][SPACE7_RANK]; /* List of blocks */
+ hsize_t blocks[16][2][SPACE7_RANK]; /* List of blocks */
herr_t error;
/* Output message about test being performed */
@@ -8087,290 +8202,290 @@ test_shape_same(void)
/* Compare "all" selection to all the selections created */
/* Compare against itself */
- check=H5S_select_shape_same_test(all_sid,all_sid);
- VERIFY(check, TRUE, "H5S_select_shape_same_test");
+ check = H5S__select_shape_same_test(all_sid,all_sid);
+ VERIFY(check, TRUE, "H5S__select_shape_same_test");
/* Compare against copy of itself */
tmp_sid=H5Scopy(all_sid);
CHECK(tmp_sid, FAIL, "H5Scopy");
- check=H5S_select_shape_same_test(all_sid,tmp_sid);
- VERIFY(check, TRUE, "H5S_select_shape_same_test");
+ check = H5S__select_shape_same_test(all_sid,tmp_sid);
+ VERIFY(check, TRUE, "H5S__select_shape_same_test");
ret = H5Sclose(tmp_sid);
CHECK(ret, FAIL, "H5Sclose");
/* Compare against "none" selection */
- check=H5S_select_shape_same_test(all_sid,none_sid);
- VERIFY(check, FALSE, "H5S_select_shape_same_test");
+ check = H5S__select_shape_same_test(all_sid,none_sid);
+ VERIFY(check, FALSE, "H5S__select_shape_same_test");
/* Compare against single point selection */
- check=H5S_select_shape_same_test(all_sid,single_pt_sid);
- VERIFY(check, FALSE, "H5S_select_shape_same_test");
+ check = H5S__select_shape_same_test(all_sid,single_pt_sid);
+ VERIFY(check, FALSE, "H5S__select_shape_same_test");
/* Compare against multiple point selection */
- check=H5S_select_shape_same_test(all_sid,mult_pt_sid);
- VERIFY(check, FALSE, "H5S_select_shape_same_test");
+ check = H5S__select_shape_same_test(all_sid,mult_pt_sid);
+ VERIFY(check, FALSE, "H5S__select_shape_same_test");
/* Compare against "plain" single hyperslab selection */
- check=H5S_select_shape_same_test(all_sid,single_hyper_sid);
- VERIFY(check, FALSE, "H5S_select_shape_same_test");
+ check = H5S__select_shape_same_test(all_sid,single_hyper_sid);
+ VERIFY(check, FALSE, "H5S__select_shape_same_test");
/* Compare against "all" single hyperslab selection */
- check=H5S_select_shape_same_test(all_sid,single_hyper_all_sid);
- VERIFY(check, TRUE, "H5S_select_shape_same_test");
+ check = H5S__select_shape_same_test(all_sid,single_hyper_all_sid);
+ VERIFY(check, TRUE, "H5S__select_shape_same_test");
/* Compare against "single point" single hyperslab selection */
- check=H5S_select_shape_same_test(all_sid,single_hyper_pt_sid);
- VERIFY(check, FALSE, "H5S_select_shape_same_test");
+ check = H5S__select_shape_same_test(all_sid,single_hyper_pt_sid);
+ VERIFY(check, FALSE, "H5S__select_shape_same_test");
/* Compare against regular, strided hyperslab selection */
- check=H5S_select_shape_same_test(all_sid,regular_hyper_sid);
- VERIFY(check, FALSE, "H5S_select_shape_same_test");
+ check = H5S__select_shape_same_test(all_sid,regular_hyper_sid);
+ VERIFY(check, FALSE, "H5S__select_shape_same_test");
/* Compare against irregular hyperslab selection */
- check=H5S_select_shape_same_test(all_sid,irreg_hyper_sid);
- VERIFY(check, FALSE, "H5S_select_shape_same_test");
+ check = H5S__select_shape_same_test(all_sid,irreg_hyper_sid);
+ VERIFY(check, FALSE, "H5S__select_shape_same_test");
/* Compare against "no" hyperslab selection */
- check=H5S_select_shape_same_test(all_sid,none_hyper_sid);
- VERIFY(check, FALSE, "H5S_select_shape_same_test");
+ check = H5S__select_shape_same_test(all_sid,none_hyper_sid);
+ VERIFY(check, FALSE, "H5S__select_shape_same_test");
/* Compare against scalar "all" hyperslab selection */
- check = H5S_select_shape_same_test(all_sid, scalar_all_sid);
- VERIFY(check, FALSE, "H5S_select_shape_same_test");
+ check = H5S__select_shape_same_test(all_sid, scalar_all_sid);
+ VERIFY(check, FALSE, "H5S__select_shape_same_test");
/* Compare against scalar "none" hyperslab selection */
- check = H5S_select_shape_same_test(all_sid, scalar_none_sid);
- VERIFY(check, FALSE, "H5S_select_shape_same_test");
+ check = H5S__select_shape_same_test(all_sid, scalar_none_sid);
+ VERIFY(check, FALSE, "H5S__select_shape_same_test");
/* Compare "none" selection to all the selections created */
/* Compare against itself */
- check=H5S_select_shape_same_test(none_sid,none_sid);
- VERIFY(check, TRUE, "H5S_select_shape_same_test");
+ check = H5S__select_shape_same_test(none_sid,none_sid);
+ VERIFY(check, TRUE, "H5S__select_shape_same_test");
/* Compare against copy of itself */
tmp_sid=H5Scopy(none_sid);
CHECK(tmp_sid, FAIL, "H5Scopy");
- check=H5S_select_shape_same_test(none_sid,tmp_sid);
- VERIFY(check, TRUE, "H5S_select_shape_same_test");
+ check = H5S__select_shape_same_test(none_sid,tmp_sid);
+ VERIFY(check, TRUE, "H5S__select_shape_same_test");
ret = H5Sclose(tmp_sid);
CHECK(ret, FAIL, "H5Sclose");
/* Compare against "all" selection */
- check=H5S_select_shape_same_test(none_sid,all_sid);
- VERIFY(check, FALSE, "H5S_select_shape_same_test");
+ check = H5S__select_shape_same_test(none_sid,all_sid);
+ VERIFY(check, FALSE, "H5S__select_shape_same_test");
/* Compare against single point selection */
- check=H5S_select_shape_same_test(none_sid,single_pt_sid);
- VERIFY(check, FALSE, "H5S_select_shape_same_test");
+ check = H5S__select_shape_same_test(none_sid,single_pt_sid);
+ VERIFY(check, FALSE, "H5S__select_shape_same_test");
/* Compare against multiple point selection */
- check=H5S_select_shape_same_test(none_sid,mult_pt_sid);
- VERIFY(check, FALSE, "H5S_select_shape_same_test");
+ check = H5S__select_shape_same_test(none_sid,mult_pt_sid);
+ VERIFY(check, FALSE, "H5S__select_shape_same_test");
/* Compare against "plain" single hyperslab selection */
- check=H5S_select_shape_same_test(none_sid,single_hyper_sid);
- VERIFY(check, FALSE, "H5S_select_shape_same_test");
+ check = H5S__select_shape_same_test(none_sid,single_hyper_sid);
+ VERIFY(check, FALSE, "H5S__select_shape_same_test");
/* Compare against "all" single hyperslab selection */
- check=H5S_select_shape_same_test(none_sid,single_hyper_all_sid);
- VERIFY(check, FALSE, "H5S_select_shape_same_test");
+ check = H5S__select_shape_same_test(none_sid,single_hyper_all_sid);
+ VERIFY(check, FALSE, "H5S__select_shape_same_test");
/* Compare against "single point" single hyperslab selection */
- check=H5S_select_shape_same_test(none_sid,single_hyper_pt_sid);
- VERIFY(check, FALSE, "H5S_select_shape_same_test");
+ check = H5S__select_shape_same_test(none_sid,single_hyper_pt_sid);
+ VERIFY(check, FALSE, "H5S__select_shape_same_test");
/* Compare against regular, strided hyperslab selection */
- check=H5S_select_shape_same_test(none_sid,regular_hyper_sid);
- VERIFY(check, FALSE, "H5S_select_shape_same_test");
+ check = H5S__select_shape_same_test(none_sid,regular_hyper_sid);
+ VERIFY(check, FALSE, "H5S__select_shape_same_test");
/* Compare against irregular hyperslab selection */
- check=H5S_select_shape_same_test(none_sid,irreg_hyper_sid);
- VERIFY(check, FALSE, "H5S_select_shape_same_test");
+ check = H5S__select_shape_same_test(none_sid,irreg_hyper_sid);
+ VERIFY(check, FALSE, "H5S__select_shape_same_test");
/* Compare against "no" hyperslab selection */
- check=H5S_select_shape_same_test(none_sid,none_hyper_sid);
- VERIFY(check, TRUE, "H5S_select_shape_same_test");
+ check = H5S__select_shape_same_test(none_sid,none_hyper_sid);
+ VERIFY(check, TRUE, "H5S__select_shape_same_test");
/* Compare against scalar "all" hyperslab selection */
- check = H5S_select_shape_same_test(none_sid, scalar_all_sid);
- VERIFY(check, FALSE, "H5S_select_shape_same_test");
+ check = H5S__select_shape_same_test(none_sid, scalar_all_sid);
+ VERIFY(check, FALSE, "H5S__select_shape_same_test");
/* Compare against scalar "none" hyperslab selection */
- check = H5S_select_shape_same_test(none_sid, scalar_none_sid);
- VERIFY(check, TRUE, "H5S_select_shape_same_test");
+ check = H5S__select_shape_same_test(none_sid, scalar_none_sid);
+ VERIFY(check, TRUE, "H5S__select_shape_same_test");
/* Compare single point selection to all the selections created */
/* Compare against itself */
- check=H5S_select_shape_same_test(single_pt_sid,single_pt_sid);
- VERIFY(check, TRUE, "H5S_select_shape_same_test");
+ check = H5S__select_shape_same_test(single_pt_sid,single_pt_sid);
+ VERIFY(check, TRUE, "H5S__select_shape_same_test");
/* Compare against copy of itself */
tmp_sid=H5Scopy(single_pt_sid);
CHECK(tmp_sid, FAIL, "H5Scopy");
- check=H5S_select_shape_same_test(single_pt_sid,tmp_sid);
- VERIFY(check, TRUE, "H5S_select_shape_same_test");
+ check = H5S__select_shape_same_test(single_pt_sid,tmp_sid);
+ VERIFY(check, TRUE, "H5S__select_shape_same_test");
ret = H5Sclose(tmp_sid);
CHECK(ret, FAIL, "H5Sclose");
/* Compare against "all" selection */
- check=H5S_select_shape_same_test(single_pt_sid,all_sid);
- VERIFY(check, FALSE, "H5S_select_shape_same_test");
+ check = H5S__select_shape_same_test(single_pt_sid,all_sid);
+ VERIFY(check, FALSE, "H5S__select_shape_same_test");
/* Compare against "none" selection */
- check=H5S_select_shape_same_test(single_pt_sid,none_sid);
- VERIFY(check, FALSE, "H5S_select_shape_same_test");
+ check = H5S__select_shape_same_test(single_pt_sid,none_sid);
+ VERIFY(check, FALSE, "H5S__select_shape_same_test");
/* Compare against multiple point selection */
- check=H5S_select_shape_same_test(single_pt_sid,mult_pt_sid);
- VERIFY(check, FALSE, "H5S_select_shape_same_test");
+ check = H5S__select_shape_same_test(single_pt_sid,mult_pt_sid);
+ VERIFY(check, FALSE, "H5S__select_shape_same_test");
/* Compare against "plain" single hyperslab selection */
- check=H5S_select_shape_same_test(single_pt_sid,single_hyper_sid);
- VERIFY(check, FALSE, "H5S_select_shape_same_test");
+ check = H5S__select_shape_same_test(single_pt_sid,single_hyper_sid);
+ VERIFY(check, FALSE, "H5S__select_shape_same_test");
/* Compare against "all" single hyperslab selection */
- check=H5S_select_shape_same_test(single_pt_sid,single_hyper_all_sid);
- VERIFY(check, FALSE, "H5S_select_shape_same_test");
+ check = H5S__select_shape_same_test(single_pt_sid,single_hyper_all_sid);
+ VERIFY(check, FALSE, "H5S__select_shape_same_test");
/* Compare against "single point" single hyperslab selection */
- check=H5S_select_shape_same_test(single_pt_sid,single_hyper_pt_sid);
- VERIFY(check, TRUE, "H5S_select_shape_same_test");
+ check = H5S__select_shape_same_test(single_pt_sid,single_hyper_pt_sid);
+ VERIFY(check, TRUE, "H5S__select_shape_same_test");
/* Compare against regular, strided hyperslab selection */
- check=H5S_select_shape_same_test(single_pt_sid,regular_hyper_sid);
- VERIFY(check, FALSE, "H5S_select_shape_same_test");
+ check = H5S__select_shape_same_test(single_pt_sid,regular_hyper_sid);
+ VERIFY(check, FALSE, "H5S__select_shape_same_test");
/* Compare against irregular hyperslab selection */
- check=H5S_select_shape_same_test(single_pt_sid,irreg_hyper_sid);
- VERIFY(check, FALSE, "H5S_select_shape_same_test");
+ check = H5S__select_shape_same_test(single_pt_sid,irreg_hyper_sid);
+ VERIFY(check, FALSE, "H5S__select_shape_same_test");
/* Compare against "no" hyperslab selection */
- check=H5S_select_shape_same_test(single_pt_sid,none_hyper_sid);
- VERIFY(check, FALSE, "H5S_select_shape_same_test");
+ check = H5S__select_shape_same_test(single_pt_sid,none_hyper_sid);
+ VERIFY(check, FALSE, "H5S__select_shape_same_test");
/* Compare against scalar "all" hyperslab selection */
- check = H5S_select_shape_same_test(single_pt_sid, scalar_all_sid);
- VERIFY(check, TRUE, "H5S_select_shape_same_test");
+ check = H5S__select_shape_same_test(single_pt_sid, scalar_all_sid);
+ VERIFY(check, TRUE, "H5S__select_shape_same_test");
/* Compare against scalar "none" hyperslab selection */
- check = H5S_select_shape_same_test(single_pt_sid, scalar_none_sid);
- VERIFY(check, FALSE, "H5S_select_shape_same_test");
+ check = H5S__select_shape_same_test(single_pt_sid, scalar_none_sid);
+ VERIFY(check, FALSE, "H5S__select_shape_same_test");
/* Compare multiple point selection to all the selections created */
/* Compare against itself */
- check=H5S_select_shape_same_test(mult_pt_sid,mult_pt_sid);
- VERIFY(check, TRUE, "H5S_select_shape_same_test");
+ check = H5S__select_shape_same_test(mult_pt_sid,mult_pt_sid);
+ VERIFY(check, TRUE, "H5S__select_shape_same_test");
/* Compare against copy of itself */
tmp_sid=H5Scopy(mult_pt_sid);
CHECK(tmp_sid, FAIL, "H5Scopy");
- check=H5S_select_shape_same_test(mult_pt_sid,tmp_sid);
- VERIFY(check, TRUE, "H5S_select_shape_same_test");
+ check = H5S__select_shape_same_test(mult_pt_sid,tmp_sid);
+ VERIFY(check, TRUE, "H5S__select_shape_same_test");
ret = H5Sclose(tmp_sid);
CHECK(ret, FAIL, "H5Sclose");
/* Compare against "all" selection */
- check=H5S_select_shape_same_test(mult_pt_sid,all_sid);
- VERIFY(check, FALSE, "H5S_select_shape_same_test");
+ check = H5S__select_shape_same_test(mult_pt_sid,all_sid);
+ VERIFY(check, FALSE, "H5S__select_shape_same_test");
/* Compare against "none" selection */
- check=H5S_select_shape_same_test(mult_pt_sid,none_sid);
- VERIFY(check, FALSE, "H5S_select_shape_same_test");
+ check = H5S__select_shape_same_test(mult_pt_sid,none_sid);
+ VERIFY(check, FALSE, "H5S__select_shape_same_test");
/* Compare against single point selection */
- check=H5S_select_shape_same_test(mult_pt_sid,single_pt_sid);
- VERIFY(check, FALSE, "H5S_select_shape_same_test");
+ check = H5S__select_shape_same_test(mult_pt_sid,single_pt_sid);
+ VERIFY(check, FALSE, "H5S__select_shape_same_test");
/* Compare against "plain" single hyperslab selection */
- check=H5S_select_shape_same_test(mult_pt_sid,single_hyper_sid);
- VERIFY(check, FALSE, "H5S_select_shape_same_test");
+ check = H5S__select_shape_same_test(mult_pt_sid,single_hyper_sid);
+ VERIFY(check, FALSE, "H5S__select_shape_same_test");
/* Compare against "all" single hyperslab selection */
- check=H5S_select_shape_same_test(mult_pt_sid,single_hyper_all_sid);
- VERIFY(check, FALSE, "H5S_select_shape_same_test");
+ check = H5S__select_shape_same_test(mult_pt_sid,single_hyper_all_sid);
+ VERIFY(check, FALSE, "H5S__select_shape_same_test");
/* Compare against "single point" single hyperslab selection */
- check=H5S_select_shape_same_test(mult_pt_sid,single_hyper_pt_sid);
- VERIFY(check, FALSE, "H5S_select_shape_same_test");
+ check = H5S__select_shape_same_test(mult_pt_sid,single_hyper_pt_sid);
+ VERIFY(check, FALSE, "H5S__select_shape_same_test");
/* Compare against regular, strided hyperslab selection */
- check=H5S_select_shape_same_test(mult_pt_sid,regular_hyper_sid);
- VERIFY(check, FALSE, "H5S_select_shape_same_test");
+ check = H5S__select_shape_same_test(mult_pt_sid,regular_hyper_sid);
+ VERIFY(check, FALSE, "H5S__select_shape_same_test");
/* Compare against irregular hyperslab selection */
- check=H5S_select_shape_same_test(mult_pt_sid,irreg_hyper_sid);
- VERIFY(check, FALSE, "H5S_select_shape_same_test");
+ check = H5S__select_shape_same_test(mult_pt_sid,irreg_hyper_sid);
+ VERIFY(check, FALSE, "H5S__select_shape_same_test");
/* Compare against "no" hyperslab selection */
- check=H5S_select_shape_same_test(mult_pt_sid,none_hyper_sid);
- VERIFY(check, FALSE, "H5S_select_shape_same_test");
+ check = H5S__select_shape_same_test(mult_pt_sid,none_hyper_sid);
+ VERIFY(check, FALSE, "H5S__select_shape_same_test");
/* Compare against scalar "all" hyperslab selection */
- check = H5S_select_shape_same_test(mult_pt_sid, scalar_all_sid);
- VERIFY(check, FALSE, "H5S_select_shape_same_test");
+ check = H5S__select_shape_same_test(mult_pt_sid, scalar_all_sid);
+ VERIFY(check, FALSE, "H5S__select_shape_same_test");
/* Compare against scalar "none" hyperslab selection */
- check = H5S_select_shape_same_test(mult_pt_sid, scalar_none_sid);
- VERIFY(check, FALSE, "H5S_select_shape_same_test");
+ check = H5S__select_shape_same_test(mult_pt_sid, scalar_none_sid);
+ VERIFY(check, FALSE, "H5S__select_shape_same_test");
/* Compare single "normal" hyperslab selection to all the selections created */
/* Compare against itself */
- check=H5S_select_shape_same_test(single_hyper_sid,single_hyper_sid);
- VERIFY(check, TRUE, "H5S_select_shape_same_test");
+ check = H5S__select_shape_same_test(single_hyper_sid,single_hyper_sid);
+ VERIFY(check, TRUE, "H5S__select_shape_same_test");
/* Compare against copy of itself */
tmp_sid=H5Scopy(single_hyper_sid);
CHECK(tmp_sid, FAIL, "H5Scopy");
- check=H5S_select_shape_same_test(single_hyper_sid,tmp_sid);
- VERIFY(check, TRUE, "H5S_select_shape_same_test");
+ check = H5S__select_shape_same_test(single_hyper_sid,tmp_sid);
+ VERIFY(check, TRUE, "H5S__select_shape_same_test");
ret = H5Sclose(tmp_sid);
CHECK(ret, FAIL, "H5Sclose");
/* Compare against "all" selection */
- check=H5S_select_shape_same_test(single_hyper_sid,all_sid);
- VERIFY(check, FALSE, "H5S_select_shape_same_test");
+ check = H5S__select_shape_same_test(single_hyper_sid,all_sid);
+ VERIFY(check, FALSE, "H5S__select_shape_same_test");
/* Compare against "none" selection */
- check=H5S_select_shape_same_test(single_hyper_sid,none_sid);
- VERIFY(check, FALSE, "H5S_select_shape_same_test");
+ check = H5S__select_shape_same_test(single_hyper_sid,none_sid);
+ VERIFY(check, FALSE, "H5S__select_shape_same_test");
/* Compare against single point selection */
- check=H5S_select_shape_same_test(single_hyper_sid,single_pt_sid);
- VERIFY(check, FALSE, "H5S_select_shape_same_test");
+ check = H5S__select_shape_same_test(single_hyper_sid,single_pt_sid);
+ VERIFY(check, FALSE, "H5S__select_shape_same_test");
/* Compare against multiple point selection */
- check=H5S_select_shape_same_test(single_hyper_sid,mult_pt_sid);
- VERIFY(check, FALSE, "H5S_select_shape_same_test");
+ check = H5S__select_shape_same_test(single_hyper_sid,mult_pt_sid);
+ VERIFY(check, FALSE, "H5S__select_shape_same_test");
/* Compare against "all" single hyperslab selection */
- check=H5S_select_shape_same_test(single_hyper_sid,single_hyper_all_sid);
- VERIFY(check, FALSE, "H5S_select_shape_same_test");
+ check = H5S__select_shape_same_test(single_hyper_sid,single_hyper_all_sid);
+ VERIFY(check, FALSE, "H5S__select_shape_same_test");
/* Compare against "single point" single hyperslab selection */
- check=H5S_select_shape_same_test(single_hyper_sid,single_hyper_pt_sid);
- VERIFY(check, FALSE, "H5S_select_shape_same_test");
+ check = H5S__select_shape_same_test(single_hyper_sid,single_hyper_pt_sid);
+ VERIFY(check, FALSE, "H5S__select_shape_same_test");
/* Compare against regular, strided hyperslab selection */
- check=H5S_select_shape_same_test(single_hyper_sid,regular_hyper_sid);
- VERIFY(check, FALSE, "H5S_select_shape_same_test");
+ check = H5S__select_shape_same_test(single_hyper_sid,regular_hyper_sid);
+ VERIFY(check, FALSE, "H5S__select_shape_same_test");
/* Compare against irregular hyperslab selection */
- check=H5S_select_shape_same_test(single_hyper_sid,irreg_hyper_sid);
- VERIFY(check, FALSE, "H5S_select_shape_same_test");
+ check = H5S__select_shape_same_test(single_hyper_sid,irreg_hyper_sid);
+ VERIFY(check, FALSE, "H5S__select_shape_same_test");
/* Compare against "no" hyperslab selection */
- check=H5S_select_shape_same_test(single_hyper_sid,none_hyper_sid);
- VERIFY(check, FALSE, "H5S_select_shape_same_test");
+ check = H5S__select_shape_same_test(single_hyper_sid,none_hyper_sid);
+ VERIFY(check, FALSE, "H5S__select_shape_same_test");
#ifdef NOT_YET
/* In theory, these two selections are the same shape, but the
@@ -8394,8 +8509,8 @@ test_shape_same(void)
} /* end for */
/* Compare against hyperslab selection */
- check=H5S_select_shape_same_test(single_hyper_sid,tmp_sid);
- VERIFY(check, TRUE, "H5S_select_shape_same_test");
+ check = H5S__select_shape_same_test(single_hyper_sid,tmp_sid);
+ VERIFY(check, TRUE, "H5S__select_shape_same_test");
ret = H5Sclose(tmp_sid);
CHECK(ret, FAIL, "H5Sclose");
@@ -8421,70 +8536,70 @@ test_shape_same(void)
} /* end for */
/* Compare against hyperslab selection */
- check=H5S_select_shape_same_test(single_hyper_sid,tmp_sid);
- VERIFY(check, TRUE, "H5S_select_shape_same_test");
+ check = H5S__select_shape_same_test(single_hyper_sid,tmp_sid);
+ VERIFY(check, TRUE, "H5S__select_shape_same_test");
ret = H5Sclose(tmp_sid);
CHECK(ret, FAIL, "H5Sclose");
/* Compare against scalar "all" hyperslab selection */
- check = H5S_select_shape_same_test(single_hyper_sid, scalar_all_sid);
- VERIFY(check, FALSE, "H5S_select_shape_same_test");
+ check = H5S__select_shape_same_test(single_hyper_sid, scalar_all_sid);
+ VERIFY(check, FALSE, "H5S__select_shape_same_test");
/* Compare against scalar "none" hyperslab selection */
- check = H5S_select_shape_same_test(single_hyper_sid, scalar_none_sid);
- VERIFY(check, FALSE, "H5S_select_shape_same_test");
+ check = H5S__select_shape_same_test(single_hyper_sid, scalar_none_sid);
+ VERIFY(check, FALSE, "H5S__select_shape_same_test");
/* Compare single "all" hyperslab selection to all the selections created */
/* Compare against itself */
- check=H5S_select_shape_same_test(single_hyper_all_sid,single_hyper_all_sid);
- VERIFY(check, TRUE, "H5S_select_shape_same_test");
+ check = H5S__select_shape_same_test(single_hyper_all_sid,single_hyper_all_sid);
+ VERIFY(check, TRUE, "H5S__select_shape_same_test");
/* Compare against copy of itself */
tmp_sid=H5Scopy(single_hyper_all_sid);
CHECK(tmp_sid, FAIL, "H5Scopy");
- check=H5S_select_shape_same_test(single_hyper_all_sid,tmp_sid);
- VERIFY(check, TRUE, "H5S_select_shape_same_test");
+ check = H5S__select_shape_same_test(single_hyper_all_sid,tmp_sid);
+ VERIFY(check, TRUE, "H5S__select_shape_same_test");
ret = H5Sclose(tmp_sid);
CHECK(ret, FAIL, "H5Sclose");
/* Compare against "all" selection */
- check=H5S_select_shape_same_test(single_hyper_all_sid,all_sid);
- VERIFY(check, TRUE, "H5S_select_shape_same_test");
+ check = H5S__select_shape_same_test(single_hyper_all_sid,all_sid);
+ VERIFY(check, TRUE, "H5S__select_shape_same_test");
/* Compare against "none" selection */
- check=H5S_select_shape_same_test(single_hyper_all_sid,none_sid);
- VERIFY(check, FALSE, "H5S_select_shape_same_test");
+ check = H5S__select_shape_same_test(single_hyper_all_sid,none_sid);
+ VERIFY(check, FALSE, "H5S__select_shape_same_test");
/* Compare against single point selection */
- check=H5S_select_shape_same_test(single_hyper_all_sid,single_pt_sid);
- VERIFY(check, FALSE, "H5S_select_shape_same_test");
+ check = H5S__select_shape_same_test(single_hyper_all_sid,single_pt_sid);
+ VERIFY(check, FALSE, "H5S__select_shape_same_test");
/* Compare against multiple point selection */
- check=H5S_select_shape_same_test(single_hyper_all_sid,mult_pt_sid);
- VERIFY(check, FALSE, "H5S_select_shape_same_test");
+ check = H5S__select_shape_same_test(single_hyper_all_sid,mult_pt_sid);
+ VERIFY(check, FALSE, "H5S__select_shape_same_test");
/* Compare against "plain" single hyperslab selection */
- check=H5S_select_shape_same_test(single_hyper_all_sid,single_hyper_sid);
- VERIFY(check, FALSE, "H5S_select_shape_same_test");
+ check = H5S__select_shape_same_test(single_hyper_all_sid,single_hyper_sid);
+ VERIFY(check, FALSE, "H5S__select_shape_same_test");
/* Compare against "single point" single hyperslab selection */
- check=H5S_select_shape_same_test(single_hyper_all_sid,single_hyper_pt_sid);
- VERIFY(check, FALSE, "H5S_select_shape_same_test");
+ check = H5S__select_shape_same_test(single_hyper_all_sid,single_hyper_pt_sid);
+ VERIFY(check, FALSE, "H5S__select_shape_same_test");
/* Compare against regular, strided hyperslab selection */
- check=H5S_select_shape_same_test(single_hyper_all_sid,regular_hyper_sid);
- VERIFY(check, FALSE, "H5S_select_shape_same_test");
+ check = H5S__select_shape_same_test(single_hyper_all_sid,regular_hyper_sid);
+ VERIFY(check, FALSE, "H5S__select_shape_same_test");
/* Compare against irregular hyperslab selection */
- check=H5S_select_shape_same_test(single_hyper_all_sid,irreg_hyper_sid);
- VERIFY(check, FALSE, "H5S_select_shape_same_test");
+ check = H5S__select_shape_same_test(single_hyper_all_sid,irreg_hyper_sid);
+ VERIFY(check, FALSE, "H5S__select_shape_same_test");
/* Compare against "no" hyperslab selection */
- check=H5S_select_shape_same_test(single_hyper_all_sid,none_hyper_sid);
- VERIFY(check, FALSE, "H5S_select_shape_same_test");
+ check = H5S__select_shape_same_test(single_hyper_all_sid,none_hyper_sid);
+ VERIFY(check, FALSE, "H5S__select_shape_same_test");
#ifdef NOT_YET
/* In theory, these two selections are the same shape, but the
@@ -8508,8 +8623,8 @@ test_shape_same(void)
} /* end for */
/* Compare against hyperslab selection */
- check=H5S_select_shape_same_test(single_hyper_all_sid,tmp_sid);
- VERIFY(check, TRUE, "H5S_select_shape_same_test");
+ check = H5S__select_shape_same_test(single_hyper_all_sid,tmp_sid);
+ VERIFY(check, TRUE, "H5S__select_shape_same_test");
ret = H5Sclose(tmp_sid);
CHECK(ret, FAIL, "H5Sclose");
@@ -8535,129 +8650,129 @@ test_shape_same(void)
} /* end for */
/* Compare against hyperslab selection */
- check=H5S_select_shape_same_test(single_hyper_all_sid,tmp_sid);
- VERIFY(check, TRUE, "H5S_select_shape_same_test");
+ check = H5S__select_shape_same_test(single_hyper_all_sid,tmp_sid);
+ VERIFY(check, TRUE, "H5S__select_shape_same_test");
ret = H5Sclose(tmp_sid);
CHECK(ret, FAIL, "H5Sclose");
/* Compare against scalar "all" hyperslab selection */
- check = H5S_select_shape_same_test(single_hyper_all_sid, scalar_all_sid);
- VERIFY(check, FALSE, "H5S_select_shape_same_test");
+ check = H5S__select_shape_same_test(single_hyper_all_sid, scalar_all_sid);
+ VERIFY(check, FALSE, "H5S__select_shape_same_test");
/* Compare against scalar "none" hyperslab selection */
- check = H5S_select_shape_same_test(single_hyper_all_sid, scalar_none_sid);
- VERIFY(check, FALSE, "H5S_select_shape_same_test");
+ check = H5S__select_shape_same_test(single_hyper_all_sid, scalar_none_sid);
+ VERIFY(check, FALSE, "H5S__select_shape_same_test");
/* Compare single "point" hyperslab selection to all the selections created */
/* Compare against itself */
- check=H5S_select_shape_same_test(single_hyper_pt_sid,single_hyper_pt_sid);
- VERIFY(check, TRUE, "H5S_select_shape_same_test");
+ check = H5S__select_shape_same_test(single_hyper_pt_sid,single_hyper_pt_sid);
+ VERIFY(check, TRUE, "H5S__select_shape_same_test");
/* Compare against copy of itself */
tmp_sid=H5Scopy(single_hyper_pt_sid);
CHECK(tmp_sid, FAIL, "H5Scopy");
- check=H5S_select_shape_same_test(single_hyper_pt_sid,tmp_sid);
- VERIFY(check, TRUE, "H5S_select_shape_same_test");
+ check = H5S__select_shape_same_test(single_hyper_pt_sid,tmp_sid);
+ VERIFY(check, TRUE, "H5S__select_shape_same_test");
ret = H5Sclose(tmp_sid);
CHECK(ret, FAIL, "H5Sclose");
/* Compare against "all" selection */
- check=H5S_select_shape_same_test(single_hyper_pt_sid,all_sid);
- VERIFY(check, FALSE, "H5S_select_shape_same_test");
+ check = H5S__select_shape_same_test(single_hyper_pt_sid,all_sid);
+ VERIFY(check, FALSE, "H5S__select_shape_same_test");
/* Compare against "none" selection */
- check=H5S_select_shape_same_test(single_hyper_pt_sid,none_sid);
- VERIFY(check, FALSE, "H5S_select_shape_same_test");
+ check = H5S__select_shape_same_test(single_hyper_pt_sid,none_sid);
+ VERIFY(check, FALSE, "H5S__select_shape_same_test");
/* Compare against single point selection */
- check=H5S_select_shape_same_test(single_hyper_pt_sid,single_pt_sid);
- VERIFY(check, TRUE, "H5S_select_shape_same_test");
+ check = H5S__select_shape_same_test(single_hyper_pt_sid,single_pt_sid);
+ VERIFY(check, TRUE, "H5S__select_shape_same_test");
/* Compare against multiple point selection */
- check=H5S_select_shape_same_test(single_hyper_pt_sid,mult_pt_sid);
- VERIFY(check, FALSE, "H5S_select_shape_same_test");
+ check = H5S__select_shape_same_test(single_hyper_pt_sid,mult_pt_sid);
+ VERIFY(check, FALSE, "H5S__select_shape_same_test");
/* Compare against "plain" single hyperslab selection */
- check=H5S_select_shape_same_test(single_hyper_pt_sid,single_hyper_sid);
- VERIFY(check, FALSE, "H5S_select_shape_same_test");
+ check = H5S__select_shape_same_test(single_hyper_pt_sid,single_hyper_sid);
+ VERIFY(check, FALSE, "H5S__select_shape_same_test");
/* Compare against "all" single hyperslab selection */
- check=H5S_select_shape_same_test(single_hyper_pt_sid,single_hyper_all_sid);
- VERIFY(check, FALSE, "H5S_select_shape_same_test");
+ check = H5S__select_shape_same_test(single_hyper_pt_sid,single_hyper_all_sid);
+ VERIFY(check, FALSE, "H5S__select_shape_same_test");
/* Compare against regular, strided hyperslab selection */
- check=H5S_select_shape_same_test(single_hyper_pt_sid,regular_hyper_sid);
- VERIFY(check, FALSE, "H5S_select_shape_same_test");
+ check = H5S__select_shape_same_test(single_hyper_pt_sid,regular_hyper_sid);
+ VERIFY(check, FALSE, "H5S__select_shape_same_test");
/* Compare against irregular hyperslab selection */
- check=H5S_select_shape_same_test(single_hyper_pt_sid,irreg_hyper_sid);
- VERIFY(check, FALSE, "H5S_select_shape_same_test");
+ check = H5S__select_shape_same_test(single_hyper_pt_sid,irreg_hyper_sid);
+ VERIFY(check, FALSE, "H5S__select_shape_same_test");
/* Compare against "no" hyperslab selection */
- check=H5S_select_shape_same_test(single_hyper_pt_sid,none_hyper_sid);
- VERIFY(check, FALSE, "H5S_select_shape_same_test");
+ check = H5S__select_shape_same_test(single_hyper_pt_sid,none_hyper_sid);
+ VERIFY(check, FALSE, "H5S__select_shape_same_test");
/* Compare against scalar "all" hyperslab selection */
- check = H5S_select_shape_same_test(single_hyper_pt_sid, scalar_all_sid);
- VERIFY(check, TRUE, "H5S_select_shape_same_test");
+ check = H5S__select_shape_same_test(single_hyper_pt_sid, scalar_all_sid);
+ VERIFY(check, TRUE, "H5S__select_shape_same_test");
/* Compare against scalar "none" hyperslab selection */
- check = H5S_select_shape_same_test(single_hyper_pt_sid, scalar_none_sid);
- VERIFY(check, FALSE, "H5S_select_shape_same_test");
+ check = H5S__select_shape_same_test(single_hyper_pt_sid, scalar_none_sid);
+ VERIFY(check, FALSE, "H5S__select_shape_same_test");
/* Compare regular, strided hyperslab selection to all the selections created */
/* Compare against itself */
- check=H5S_select_shape_same_test(regular_hyper_sid,regular_hyper_sid);
- VERIFY(check, TRUE, "H5S_select_shape_same_test");
+ check = H5S__select_shape_same_test(regular_hyper_sid,regular_hyper_sid);
+ VERIFY(check, TRUE, "H5S__select_shape_same_test");
/* Compare against copy of itself */
tmp_sid=H5Scopy(regular_hyper_sid);
CHECK(tmp_sid, FAIL, "H5Scopy");
- check=H5S_select_shape_same_test(regular_hyper_sid,tmp_sid);
- VERIFY(check, TRUE, "H5S_select_shape_same_test");
+ check = H5S__select_shape_same_test(regular_hyper_sid,tmp_sid);
+ VERIFY(check, TRUE, "H5S__select_shape_same_test");
ret = H5Sclose(tmp_sid);
CHECK(ret, FAIL, "H5Sclose");
/* Compare against "all" selection */
- check=H5S_select_shape_same_test(regular_hyper_sid,all_sid);
- VERIFY(check, FALSE, "H5S_select_shape_same_test");
+ check = H5S__select_shape_same_test(regular_hyper_sid,all_sid);
+ VERIFY(check, FALSE, "H5S__select_shape_same_test");
/* Compare against "none" selection */
- check=H5S_select_shape_same_test(regular_hyper_sid,none_sid);
- VERIFY(check, FALSE, "H5S_select_shape_same_test");
+ check = H5S__select_shape_same_test(regular_hyper_sid,none_sid);
+ VERIFY(check, FALSE, "H5S__select_shape_same_test");
/* Compare against single point selection */
- check=H5S_select_shape_same_test(regular_hyper_sid,single_pt_sid);
- VERIFY(check, FALSE, "H5S_select_shape_same_test");
+ check = H5S__select_shape_same_test(regular_hyper_sid,single_pt_sid);
+ VERIFY(check, FALSE, "H5S__select_shape_same_test");
/* Compare against multiple point selection */
- check=H5S_select_shape_same_test(regular_hyper_sid,mult_pt_sid);
- VERIFY(check, FALSE, "H5S_select_shape_same_test");
+ check = H5S__select_shape_same_test(regular_hyper_sid,mult_pt_sid);
+ VERIFY(check, FALSE, "H5S__select_shape_same_test");
/* Compare against "plain" single hyperslab selection */
- check=H5S_select_shape_same_test(regular_hyper_sid,single_hyper_sid);
- VERIFY(check, FALSE, "H5S_select_shape_same_test");
+ check = H5S__select_shape_same_test(regular_hyper_sid,single_hyper_sid);
+ VERIFY(check, FALSE, "H5S__select_shape_same_test");
/* Compare against "all" single hyperslab selection */
- check=H5S_select_shape_same_test(regular_hyper_sid,single_hyper_all_sid);
- VERIFY(check, FALSE, "H5S_select_shape_same_test");
+ check = H5S__select_shape_same_test(regular_hyper_sid,single_hyper_all_sid);
+ VERIFY(check, FALSE, "H5S__select_shape_same_test");
/* Compare against "single point" single hyperslab selection */
- check=H5S_select_shape_same_test(regular_hyper_sid,single_hyper_pt_sid);
- VERIFY(check, FALSE, "H5S_select_shape_same_test");
+ check = H5S__select_shape_same_test(regular_hyper_sid,single_hyper_pt_sid);
+ VERIFY(check, FALSE, "H5S__select_shape_same_test");
/* Compare against irregular hyperslab selection */
- check=H5S_select_shape_same_test(regular_hyper_sid,irreg_hyper_sid);
- VERIFY(check, FALSE, "H5S_select_shape_same_test");
+ check = H5S__select_shape_same_test(regular_hyper_sid,irreg_hyper_sid);
+ VERIFY(check, FALSE, "H5S__select_shape_same_test");
/* Compare against "no" hyperslab selection */
- check=H5S_select_shape_same_test(regular_hyper_sid,none_hyper_sid);
- VERIFY(check, FALSE, "H5S_select_shape_same_test");
+ check = H5S__select_shape_same_test(regular_hyper_sid,none_hyper_sid);
+ VERIFY(check, FALSE, "H5S__select_shape_same_test");
/* Construct point selection which matches regular, strided hyperslab selection */
/* Create dataspace for point selection */
@@ -8674,8 +8789,8 @@ test_shape_same(void)
} /* end for */
/* Compare against hyperslab selection */
- check=H5S_select_shape_same_test(regular_hyper_sid,tmp_sid);
- VERIFY(check, TRUE, "H5S_select_shape_same_test");
+ check = H5S__select_shape_same_test(regular_hyper_sid,tmp_sid);
+ VERIFY(check, TRUE, "H5S__select_shape_same_test");
ret = H5Sclose(tmp_sid);
CHECK(ret, FAIL, "H5Sclose");
@@ -8700,8 +8815,8 @@ test_shape_same(void)
} /* end for */
/* Compare against hyperslab selection */
- check=H5S_select_shape_same_test(regular_hyper_sid,tmp_sid);
- VERIFY(check, TRUE, "H5S_select_shape_same_test");
+ check = H5S__select_shape_same_test(regular_hyper_sid,tmp_sid);
+ VERIFY(check, TRUE, "H5S__select_shape_same_test");
ret = H5Sclose(tmp_sid);
CHECK(ret, FAIL, "H5Sclose");
@@ -8720,70 +8835,70 @@ test_shape_same(void)
CHECK(ret, FAIL, "H5Sselect_hyperslab");
/* Compare against hyperslab selection */
- check=H5S_select_shape_same_test(regular_hyper_sid,tmp_sid);
- VERIFY(check, TRUE, "H5S_select_shape_same_test");
+ check = H5S__select_shape_same_test(regular_hyper_sid,tmp_sid);
+ VERIFY(check, TRUE, "H5S__select_shape_same_test");
ret = H5Sclose(tmp_sid);
CHECK(ret, FAIL, "H5Sclose");
/* Compare against scalar "all" hyperslab selection */
- check = H5S_select_shape_same_test(regular_hyper_sid, scalar_all_sid);
- VERIFY(check, FALSE, "H5S_select_shape_same_test");
+ check = H5S__select_shape_same_test(regular_hyper_sid, scalar_all_sid);
+ VERIFY(check, FALSE, "H5S__select_shape_same_test");
/* Compare against scalar "none" hyperslab selection */
- check = H5S_select_shape_same_test(regular_hyper_sid, scalar_none_sid);
- VERIFY(check, FALSE, "H5S_select_shape_same_test");
+ check = H5S__select_shape_same_test(regular_hyper_sid, scalar_none_sid);
+ VERIFY(check, FALSE, "H5S__select_shape_same_test");
/* Compare irregular hyperslab selection to all the selections created */
/* Compare against itself */
- check=H5S_select_shape_same_test(irreg_hyper_sid,irreg_hyper_sid);
- VERIFY(check, TRUE, "H5S_select_shape_same_test");
+ check = H5S__select_shape_same_test(irreg_hyper_sid,irreg_hyper_sid);
+ VERIFY(check, TRUE, "H5S__select_shape_same_test");
/* Compare against copy of itself */
tmp_sid=H5Scopy(irreg_hyper_sid);
CHECK(tmp_sid, FAIL, "H5Scopy");
- check=H5S_select_shape_same_test(irreg_hyper_sid,tmp_sid);
- VERIFY(check, TRUE, "H5S_select_shape_same_test");
+ check = H5S__select_shape_same_test(irreg_hyper_sid,tmp_sid);
+ VERIFY(check, TRUE, "H5S__select_shape_same_test");
ret = H5Sclose(tmp_sid);
CHECK(ret, FAIL, "H5Sclose");
/* Compare against "all" selection */
- check=H5S_select_shape_same_test(irreg_hyper_sid,all_sid);
- VERIFY(check, FALSE, "H5S_select_shape_same_test");
+ check = H5S__select_shape_same_test(irreg_hyper_sid,all_sid);
+ VERIFY(check, FALSE, "H5S__select_shape_same_test");
/* Compare against "none" selection */
- check=H5S_select_shape_same_test(irreg_hyper_sid,none_sid);
- VERIFY(check, FALSE, "H5S_select_shape_same_test");
+ check = H5S__select_shape_same_test(irreg_hyper_sid,none_sid);
+ VERIFY(check, FALSE, "H5S__select_shape_same_test");
/* Compare against single point selection */
- check=H5S_select_shape_same_test(irreg_hyper_sid,single_pt_sid);
- VERIFY(check, FALSE, "H5S_select_shape_same_test");
+ check = H5S__select_shape_same_test(irreg_hyper_sid,single_pt_sid);
+ VERIFY(check, FALSE, "H5S__select_shape_same_test");
/* Compare against multiple point selection */
- check=H5S_select_shape_same_test(irreg_hyper_sid,mult_pt_sid);
- VERIFY(check, FALSE, "H5S_select_shape_same_test");
+ check = H5S__select_shape_same_test(irreg_hyper_sid,mult_pt_sid);
+ VERIFY(check, FALSE, "H5S__select_shape_same_test");
/* Compare against "plain" single hyperslab selection */
- check=H5S_select_shape_same_test(irreg_hyper_sid,single_hyper_sid);
- VERIFY(check, FALSE, "H5S_select_shape_same_test");
+ check = H5S__select_shape_same_test(irreg_hyper_sid,single_hyper_sid);
+ VERIFY(check, FALSE, "H5S__select_shape_same_test");
/* Compare against "all" single hyperslab selection */
- check=H5S_select_shape_same_test(irreg_hyper_sid,single_hyper_all_sid);
- VERIFY(check, FALSE, "H5S_select_shape_same_test");
+ check = H5S__select_shape_same_test(irreg_hyper_sid,single_hyper_all_sid);
+ VERIFY(check, FALSE, "H5S__select_shape_same_test");
/* Compare against "single point" single hyperslab selection */
- check=H5S_select_shape_same_test(irreg_hyper_sid,single_hyper_pt_sid);
- VERIFY(check, FALSE, "H5S_select_shape_same_test");
+ check = H5S__select_shape_same_test(irreg_hyper_sid,single_hyper_pt_sid);
+ VERIFY(check, FALSE, "H5S__select_shape_same_test");
/* Compare against regular, strided hyperslab selection */
- check=H5S_select_shape_same_test(irreg_hyper_sid,regular_hyper_sid);
- VERIFY(check, FALSE, "H5S_select_shape_same_test");
+ check = H5S__select_shape_same_test(irreg_hyper_sid,regular_hyper_sid);
+ VERIFY(check, FALSE, "H5S__select_shape_same_test");
/* Compare against "no" hyperslab selection */
- check=H5S_select_shape_same_test(irreg_hyper_sid,none_hyper_sid);
- VERIFY(check, FALSE, "H5S_select_shape_same_test");
+ check = H5S__select_shape_same_test(irreg_hyper_sid,none_hyper_sid);
+ VERIFY(check, FALSE, "H5S__select_shape_same_test");
/* Construct hyperslab selection which matches irregular hyperslab selection */
/* Create dataspace for hyperslab selection */
@@ -8808,141 +8923,141 @@ test_shape_same(void)
} /* end for */
/* Compare against hyperslab selection */
- check=H5S_select_shape_same_test(irreg_hyper_sid,tmp_sid);
- VERIFY(check, TRUE, "H5S_select_shape_same_test");
+ check = H5S__select_shape_same_test(irreg_hyper_sid,tmp_sid);
+ VERIFY(check, TRUE, "H5S__select_shape_same_test");
ret = H5Sclose(tmp_sid);
CHECK(ret, FAIL, "H5Sclose");
/* Compare against scalar "all" hyperslab selection */
- check = H5S_select_shape_same_test(irreg_hyper_sid, scalar_all_sid);
- VERIFY(check, FALSE, "H5S_select_shape_same_test");
+ check = H5S__select_shape_same_test(irreg_hyper_sid, scalar_all_sid);
+ VERIFY(check, FALSE, "H5S__select_shape_same_test");
/* Compare against scalar "none" hyperslab selection */
- check = H5S_select_shape_same_test(irreg_hyper_sid, scalar_none_sid);
- VERIFY(check, FALSE, "H5S_select_shape_same_test");
+ check = H5S__select_shape_same_test(irreg_hyper_sid, scalar_none_sid);
+ VERIFY(check, FALSE, "H5S__select_shape_same_test");
/* Compare scalar "all" dataspace with all selections created */
/* Compare against itself */
- check = H5S_select_shape_same_test(scalar_all_sid, scalar_all_sid);
- VERIFY(check, TRUE, "H5S_select_shape_same_test");
+ check = H5S__select_shape_same_test(scalar_all_sid, scalar_all_sid);
+ VERIFY(check, TRUE, "H5S__select_shape_same_test");
/* Compare against copy of itself */
tmp_sid = H5Scopy(scalar_all_sid);
CHECK(tmp_sid, FAIL, "H5Scopy");
- check = H5S_select_shape_same_test(scalar_all_sid, tmp_sid);
- VERIFY(check, TRUE, "H5S_select_shape_same_test");
+ check = H5S__select_shape_same_test(scalar_all_sid, tmp_sid);
+ VERIFY(check, TRUE, "H5S__select_shape_same_test");
ret = H5Sclose(tmp_sid);
CHECK(ret, FAIL, "H5Sclose");
/* Compare against "all" selection */
- check = H5S_select_shape_same_test(scalar_all_sid, all_sid);
- VERIFY(check, FALSE, "H5S_select_shape_same_test");
+ check = H5S__select_shape_same_test(scalar_all_sid, all_sid);
+ VERIFY(check, FALSE, "H5S__select_shape_same_test");
/* Compare against "none" selection */
- check = H5S_select_shape_same_test(scalar_all_sid, none_sid);
- VERIFY(check, FALSE, "H5S_select_shape_same_test");
+ check = H5S__select_shape_same_test(scalar_all_sid, none_sid);
+ VERIFY(check, FALSE, "H5S__select_shape_same_test");
/* Compare against single point selection */
- check = H5S_select_shape_same_test(scalar_all_sid, single_pt_sid);
- VERIFY(check, TRUE, "H5S_select_shape_same_test");
+ check = H5S__select_shape_same_test(scalar_all_sid, single_pt_sid);
+ VERIFY(check, TRUE, "H5S__select_shape_same_test");
/* Compare against multiple point selection */
- check = H5S_select_shape_same_test(scalar_all_sid, mult_pt_sid);
- VERIFY(check, FALSE, "H5S_select_shape_same_test");
+ check = H5S__select_shape_same_test(scalar_all_sid, mult_pt_sid);
+ VERIFY(check, FALSE, "H5S__select_shape_same_test");
/* Compare against "plain" single hyperslab selection */
- check = H5S_select_shape_same_test(scalar_all_sid, single_hyper_sid);
- VERIFY(check, FALSE, "H5S_select_shape_same_test");
+ check = H5S__select_shape_same_test(scalar_all_sid, single_hyper_sid);
+ VERIFY(check, FALSE, "H5S__select_shape_same_test");
/* Compare against "all" single hyperslab selection */
- check = H5S_select_shape_same_test(scalar_all_sid, single_hyper_all_sid);
- VERIFY(check, FALSE, "H5S_select_shape_same_test");
+ check = H5S__select_shape_same_test(scalar_all_sid, single_hyper_all_sid);
+ VERIFY(check, FALSE, "H5S__select_shape_same_test");
/* Compare against "single point" single hyperslab selection */
- check = H5S_select_shape_same_test(scalar_all_sid, single_hyper_pt_sid);
- VERIFY(check, TRUE, "H5S_select_shape_same_test");
+ check = H5S__select_shape_same_test(scalar_all_sid, single_hyper_pt_sid);
+ VERIFY(check, TRUE, "H5S__select_shape_same_test");
/* Compare against regular, strided hyperslab selection */
- check = H5S_select_shape_same_test(scalar_all_sid, regular_hyper_sid);
- VERIFY(check, FALSE, "H5S_select_shape_same_test");
+ check = H5S__select_shape_same_test(scalar_all_sid, regular_hyper_sid);
+ VERIFY(check, FALSE, "H5S__select_shape_same_test");
/* Compare against irregular hyperslab selection */
- check = H5S_select_shape_same_test(scalar_all_sid, irreg_hyper_sid);
- VERIFY(check, FALSE, "H5S_select_shape_same_test");
+ check = H5S__select_shape_same_test(scalar_all_sid, irreg_hyper_sid);
+ VERIFY(check, FALSE, "H5S__select_shape_same_test");
/* Compare against "no" hyperslab selection */
- check = H5S_select_shape_same_test(scalar_all_sid, none_hyper_sid);
- VERIFY(check, FALSE, "H5S_select_shape_same_test");
+ check = H5S__select_shape_same_test(scalar_all_sid, none_hyper_sid);
+ VERIFY(check, FALSE, "H5S__select_shape_same_test");
/* Compare against scalar "none" hyperslab selection */
- check = H5S_select_shape_same_test(scalar_all_sid, scalar_none_sid);
- VERIFY(check, FALSE, "H5S_select_shape_same_test");
+ check = H5S__select_shape_same_test(scalar_all_sid, scalar_none_sid);
+ VERIFY(check, FALSE, "H5S__select_shape_same_test");
/* Compare scalar "none" dataspace with all selections created */
/* Compare against itself */
- check = H5S_select_shape_same_test(scalar_none_sid, scalar_none_sid);
- VERIFY(check, TRUE, "H5S_select_shape_same_test");
+ check = H5S__select_shape_same_test(scalar_none_sid, scalar_none_sid);
+ VERIFY(check, TRUE, "H5S__select_shape_same_test");
/* Compare against copy of itself */
tmp_sid = H5Scopy(scalar_none_sid);
CHECK(tmp_sid, FAIL, "H5Scopy");
- check = H5S_select_shape_same_test(scalar_none_sid, tmp_sid);
- VERIFY(check, TRUE, "H5S_select_shape_same_test");
+ check = H5S__select_shape_same_test(scalar_none_sid, tmp_sid);
+ VERIFY(check, TRUE, "H5S__select_shape_same_test");
ret = H5Sclose(tmp_sid);
CHECK(ret, FAIL, "H5Sclose");
/* Compare against "all" selection */
- check = H5S_select_shape_same_test(scalar_none_sid, all_sid);
- VERIFY(check, FALSE, "H5S_select_shape_same_test");
+ check = H5S__select_shape_same_test(scalar_none_sid, all_sid);
+ VERIFY(check, FALSE, "H5S__select_shape_same_test");
/* Compare against "none" selection */
- check = H5S_select_shape_same_test(scalar_none_sid, none_sid);
- VERIFY(check, TRUE, "H5S_select_shape_same_test");
+ check = H5S__select_shape_same_test(scalar_none_sid, none_sid);
+ VERIFY(check, TRUE, "H5S__select_shape_same_test");
/* Compare against single point selection */
- check = H5S_select_shape_same_test(scalar_none_sid, single_pt_sid);
- VERIFY(check, FALSE, "H5S_select_shape_same_test");
+ check = H5S__select_shape_same_test(scalar_none_sid, single_pt_sid);
+ VERIFY(check, FALSE, "H5S__select_shape_same_test");
/* Compare against multiple point selection */
- check = H5S_select_shape_same_test(scalar_none_sid, mult_pt_sid);
- VERIFY(check, FALSE, "H5S_select_shape_same_test");
+ check = H5S__select_shape_same_test(scalar_none_sid, mult_pt_sid);
+ VERIFY(check, FALSE, "H5S__select_shape_same_test");
/* Compare against "plain" single hyperslab selection */
- check = H5S_select_shape_same_test(scalar_none_sid, single_hyper_sid);
- VERIFY(check, FALSE, "H5S_select_shape_same_test");
+ check = H5S__select_shape_same_test(scalar_none_sid, single_hyper_sid);
+ VERIFY(check, FALSE, "H5S__select_shape_same_test");
/* Compare against "all" single hyperslab selection */
- check = H5S_select_shape_same_test(scalar_none_sid, single_hyper_all_sid);
- VERIFY(check, FALSE, "H5S_select_shape_same_test");
+ check = H5S__select_shape_same_test(scalar_none_sid, single_hyper_all_sid);
+ VERIFY(check, FALSE, "H5S__select_shape_same_test");
/* Compare against "single point" single hyperslab selection */
- check = H5S_select_shape_same_test(scalar_none_sid, single_hyper_pt_sid);
- VERIFY(check, FALSE, "H5S_select_shape_same_test");
+ check = H5S__select_shape_same_test(scalar_none_sid, single_hyper_pt_sid);
+ VERIFY(check, FALSE, "H5S__select_shape_same_test");
/* Compare against regular, strided hyperslab selection */
- check = H5S_select_shape_same_test(scalar_none_sid, regular_hyper_sid);
- VERIFY(check, FALSE, "H5S_select_shape_same_test");
+ check = H5S__select_shape_same_test(scalar_none_sid, regular_hyper_sid);
+ VERIFY(check, FALSE, "H5S__select_shape_same_test");
/* Compare against irregular hyperslab selection */
- check = H5S_select_shape_same_test(scalar_none_sid, irreg_hyper_sid);
- VERIFY(check, FALSE, "H5S_select_shape_same_test");
+ check = H5S__select_shape_same_test(scalar_none_sid, irreg_hyper_sid);
+ VERIFY(check, FALSE, "H5S__select_shape_same_test");
/* Compare against "no" hyperslab selection */
- check = H5S_select_shape_same_test(scalar_none_sid, none_hyper_sid);
- VERIFY(check, TRUE, "H5S_select_shape_same_test");
+ check = H5S__select_shape_same_test(scalar_none_sid, none_hyper_sid);
+ VERIFY(check, TRUE, "H5S__select_shape_same_test");
/* Compare against scalar "all" hyperslab selection */
- check = H5S_select_shape_same_test(scalar_none_sid, scalar_all_sid);
- VERIFY(check, FALSE, "H5S_select_shape_same_test");
+ check = H5S__select_shape_same_test(scalar_none_sid, scalar_all_sid);
+ VERIFY(check, FALSE, "H5S__select_shape_same_test");
/* Close dataspaces */
@@ -8974,27 +9089,27 @@ test_shape_same(void)
/****************************************************************
**
-** test_shape_same_dr__smoke_check_1():
+** test_shape_same_dr__smoke_check_1():
**
-** Create a square, 2 D data space (10 X 10), and select
+** Create a square, 2 D data space (10 X 10), and select
** all of it.
**
-** Similarly, create nine, 3 D data spaces (10 X 10 X 10),
-** and select (10 X 10 X 1) hyper slabs in each, three with
-** the slab parallel to the xy plane, three parallel to the
+** Similarly, create nine, 3 D data spaces (10 X 10 X 10),
+** and select (10 X 10 X 1) hyper slabs in each, three with
+** the slab parallel to the xy plane, three parallel to the
** xz plane, and three parallel to the yz plane.
**
-** Assuming that z is the fastest changing dimension,
-** H5S_select_shape_same() should return TRUE when comparing
-** the full 2 D space against any hyperslab parallel to the
-** yz plane in the 3 D space, and FALSE when comparing the
+** Assuming that z is the fastest changing dimension,
+** H5S_select_shape_same() should return TRUE when comparing
+** the full 2 D space against any hyperslab parallel to the
+** yz plane in the 3 D space, and FALSE when comparing the
** full 2 D space against the other two hyper slabs.
**
-** Also create two additional 3 D data spaces (10 X 10 X 10),
-** and select a (10 X 10 X 2) hyper slab parallel to the yz
-** axis in one of them, and two parallel (10 X 10 X 1) hyper
-** slabs parallel to the yz axis in the other.
-** H5S_select_shape_same() should return FALSE when comparing
+** Also create two additional 3 D data spaces (10 X 10 X 10),
+** and select a (10 X 10 X 2) hyper slab parallel to the yz
+** axis in one of them, and two parallel (10 X 10 X 1) hyper
+** slabs parallel to the yz axis in the other.
+** H5S_select_shape_same() should return FALSE when comparing
** each to the 2 D selection.
**
****************************************************************/
@@ -9183,42 +9298,42 @@ test_shape_same_dr__smoke_check_1(void)
/* setup is done -- run the tests: */
/* Compare against "xy" selection */
- check = H5S_select_shape_same_test(small_cube_xy_slice_0_sid, small_square_sid);
- VERIFY(check, FALSE, "H5S_select_shape_same_test");
+ check = H5S__select_shape_same_test(small_cube_xy_slice_0_sid, small_square_sid);
+ VERIFY(check, FALSE, "H5S__select_shape_same_test");
- check = H5S_select_shape_same_test(small_cube_xy_slice_1_sid, small_square_sid);
- VERIFY(check, FALSE, "H5S_select_shape_same_test");
+ check = H5S__select_shape_same_test(small_cube_xy_slice_1_sid, small_square_sid);
+ VERIFY(check, FALSE, "H5S__select_shape_same_test");
- check = H5S_select_shape_same_test(small_cube_xy_slice_2_sid, small_square_sid);
- VERIFY(check, FALSE, "H5S_select_shape_same_test");
+ check = H5S__select_shape_same_test(small_cube_xy_slice_2_sid, small_square_sid);
+ VERIFY(check, FALSE, "H5S__select_shape_same_test");
/* Compare against "xz" selection */
- check = H5S_select_shape_same_test(small_cube_xz_slice_0_sid, small_square_sid);
- VERIFY(check, FALSE, "H5S_select_shape_same_test");
+ check = H5S__select_shape_same_test(small_cube_xz_slice_0_sid, small_square_sid);
+ VERIFY(check, FALSE, "H5S__select_shape_same_test");
- check = H5S_select_shape_same_test(small_cube_xz_slice_1_sid, small_square_sid);
- VERIFY(check, FALSE, "H5S_select_shape_same_test");
+ check = H5S__select_shape_same_test(small_cube_xz_slice_1_sid, small_square_sid);
+ VERIFY(check, FALSE, "H5S__select_shape_same_test");
- check = H5S_select_shape_same_test(small_cube_xz_slice_2_sid, small_square_sid);
- VERIFY(check, FALSE, "H5S_select_shape_same_test");
+ check = H5S__select_shape_same_test(small_cube_xz_slice_2_sid, small_square_sid);
+ VERIFY(check, FALSE, "H5S__select_shape_same_test");
/* Compare against "yz" selection */
- check = H5S_select_shape_same_test(small_cube_yz_slice_0_sid, small_square_sid);
- VERIFY(check, TRUE, "H5S_select_shape_same_test");
+ check = H5S__select_shape_same_test(small_cube_yz_slice_0_sid, small_square_sid);
+ VERIFY(check, TRUE, "H5S__select_shape_same_test");
- check = H5S_select_shape_same_test(small_cube_yz_slice_1_sid, small_square_sid);
- VERIFY(check, TRUE, "H5S_select_shape_same_test");
+ check = H5S__select_shape_same_test(small_cube_yz_slice_1_sid, small_square_sid);
+ VERIFY(check, TRUE, "H5S__select_shape_same_test");
- check = H5S_select_shape_same_test(small_cube_yz_slice_2_sid, small_square_sid);
- VERIFY(check, TRUE, "H5S_select_shape_same_test");
+ check = H5S__select_shape_same_test(small_cube_yz_slice_2_sid, small_square_sid);
+ VERIFY(check, TRUE, "H5S__select_shape_same_test");
- check = H5S_select_shape_same_test(small_cube_yz_slice_3_sid, small_square_sid);
- VERIFY(check, FALSE, "H5S_select_shape_same_test");
+ check = H5S__select_shape_same_test(small_cube_yz_slice_3_sid, small_square_sid);
+ VERIFY(check, FALSE, "H5S__select_shape_same_test");
- check = H5S_select_shape_same_test(small_cube_yz_slice_4_sid, small_square_sid);
- VERIFY(check, FALSE, "H5S_select_shape_same_test");
+ check = H5S__select_shape_same_test(small_cube_yz_slice_4_sid, small_square_sid);
+ VERIFY(check, FALSE, "H5S__select_shape_same_test");
/* Close dataspaces */
@@ -9265,9 +9380,9 @@ test_shape_same_dr__smoke_check_1(void)
/****************************************************************
**
-** test_shape_same_dr__smoke_check_2():
+** test_shape_same_dr__smoke_check_2():
**
-** Create a square, 2 D data space (10 X 10), and select
+** Create a square, 2 D data space (10 X 10), and select
** a "checker board" hyper slab as follows:
**
** * * - - * * - - * *
@@ -9281,27 +9396,27 @@ test_shape_same_dr__smoke_check_1(void)
** * * - - * * - - * *
** * * - - * * - - * *
**
-** where asterisks indicate selected elements, and dashes
+** where asterisks indicate selected elements, and dashes
** indicate unselected elements.
**
-** Similarly, create nine, 3 D data spaces (10 X 10 X 10),
-** and select similar (10 X 10 X 1) checker board hyper
-** slabs in each, three with the slab parallel to the xy
-** plane, three parallel to the xz plane, and three parallel
+** Similarly, create nine, 3 D data spaces (10 X 10 X 10),
+** and select similar (10 X 10 X 1) checker board hyper
+** slabs in each, three with the slab parallel to the xy
+** plane, three parallel to the xz plane, and three parallel
** to the yz plane.
**
-** Assuming that z is the fastest changing dimension,
-** H5S_select_shape_same() should return TRUE when comparing
-** the 2 D space checker board selection against a checker
-** board hyperslab parallel to the yz plane in the 3 D
-** space, and FALSE when comparing the 2 D checkerboard
-** selection against two hyper slabs parallel to the xy
+** Assuming that z is the fastest changing dimension,
+** H5S_select_shape_same() should return TRUE when comparing
+** the 2 D space checker board selection against a checker
+** board hyperslab parallel to the yz plane in the 3 D
+** space, and FALSE when comparing the 2 D checkerboard
+** selection against two hyper slabs parallel to the xy
** or xz planes.
**
-** Also create an additional 3 D data spaces (10 X 10 X 10),
-** and select a checker board parallel with the yz axis,
-** save with some squares being on different planes.
-** H5S_select_shape_same() should return FALSE when
+** Also create an additional 3 D data spaces (10 X 10 X 10),
+** and select a checker board parallel with the yz axis,
+** save with some squares being on different planes.
+** H5S_select_shape_same() should return FALSE when
** comparing this selection to the 2 D selection.
**
****************************************************************/
@@ -9584,7 +9699,7 @@ test_shape_same_dr__smoke_check_2(void)
start[0] = 4;
/* This test gets the right answer, but it fails the shape same
- * test in an unexpected point. Bring this up with Quincey, as
+ * test in an unexpected point. Bring this up with Quincey, as
* the oddness looks like it is not related to my code.
* -- JRM
*/
@@ -9596,39 +9711,39 @@ test_shape_same_dr__smoke_check_2(void)
/* setup is done -- run the tests: */
/* Compare against "xy" selection */
- check = H5S_select_shape_same_test(small_cube_xy_slice_0_sid, small_square_sid);
- VERIFY(check, FALSE, "H5S_select_shape_same_test");
+ check = H5S__select_shape_same_test(small_cube_xy_slice_0_sid, small_square_sid);
+ VERIFY(check, FALSE, "H5S__select_shape_same_test");
- check = H5S_select_shape_same_test(small_cube_xy_slice_1_sid, small_square_sid);
- VERIFY(check, FALSE, "H5S_select_shape_same_test");
+ check = H5S__select_shape_same_test(small_cube_xy_slice_1_sid, small_square_sid);
+ VERIFY(check, FALSE, "H5S__select_shape_same_test");
- check = H5S_select_shape_same_test(small_cube_xy_slice_2_sid, small_square_sid);
- VERIFY(check, FALSE, "H5S_select_shape_same_test");
+ check = H5S__select_shape_same_test(small_cube_xy_slice_2_sid, small_square_sid);
+ VERIFY(check, FALSE, "H5S__select_shape_same_test");
/* Compare against "xz" selection */
- check = H5S_select_shape_same_test(small_cube_xz_slice_0_sid, small_square_sid);
- VERIFY(check, FALSE, "H5S_select_shape_same_test");
+ check = H5S__select_shape_same_test(small_cube_xz_slice_0_sid, small_square_sid);
+ VERIFY(check, FALSE, "H5S__select_shape_same_test");
- check = H5S_select_shape_same_test(small_cube_xz_slice_1_sid, small_square_sid);
- VERIFY(check, FALSE, "H5S_select_shape_same_test");
+ check = H5S__select_shape_same_test(small_cube_xz_slice_1_sid, small_square_sid);
+ VERIFY(check, FALSE, "H5S__select_shape_same_test");
- check = H5S_select_shape_same_test(small_cube_xz_slice_2_sid, small_square_sid);
- VERIFY(check, FALSE, "H5S_select_shape_same_test");
+ check = H5S__select_shape_same_test(small_cube_xz_slice_2_sid, small_square_sid);
+ VERIFY(check, FALSE, "H5S__select_shape_same_test");
/* Compare against "yz" selection */
- check = H5S_select_shape_same_test(small_cube_yz_slice_0_sid, small_square_sid);
- VERIFY(check, TRUE, "H5S_select_shape_same_test");
+ check = H5S__select_shape_same_test(small_cube_yz_slice_0_sid, small_square_sid);
+ VERIFY(check, TRUE, "H5S__select_shape_same_test");
- check = H5S_select_shape_same_test(small_cube_yz_slice_1_sid, small_square_sid);
- VERIFY(check, TRUE, "H5S_select_shape_same_test");
+ check = H5S__select_shape_same_test(small_cube_yz_slice_1_sid, small_square_sid);
+ VERIFY(check, TRUE, "H5S__select_shape_same_test");
- check = H5S_select_shape_same_test(small_cube_yz_slice_2_sid, small_square_sid);
- VERIFY(check, TRUE, "H5S_select_shape_same_test");
+ check = H5S__select_shape_same_test(small_cube_yz_slice_2_sid, small_square_sid);
+ VERIFY(check, TRUE, "H5S__select_shape_same_test");
- check = H5S_select_shape_same_test(small_cube_yz_slice_3_sid, small_square_sid);
- VERIFY(check, FALSE, "H5S_select_shape_same_test");
+ check = H5S__select_shape_same_test(small_cube_yz_slice_3_sid, small_square_sid);
+ VERIFY(check, FALSE, "H5S__select_shape_same_test");
/* Close dataspaces */
@@ -9673,9 +9788,9 @@ test_shape_same_dr__smoke_check_2(void)
/****************************************************************
**
-** test_shape_same_dr__smoke_check_3():
+** test_shape_same_dr__smoke_check_3():
**
-** Create a square, 2 D data space (10 X 10), and select an
+** Create a square, 2 D data space (10 X 10), and select an
** irregular hyper slab as follows:
**
** y
@@ -9691,22 +9806,22 @@ test_shape_same_dr__smoke_check_2(void)
** 0 - - - - - - - - - -
** 0 1 2 3 4 5 6 7 8 9 x
**
-** where asterisks indicate selected elements, and dashes
+** where asterisks indicate selected elements, and dashes
** indicate unselected elements.
**
-** Similarly, create nine, 3 D data spaces (10 X 10 X 10),
-** and select similar irregular hyper slabs in each, three
-** with the slab parallel to the xy plane, three parallel
-** to the xz plane, and three parallel to the yz plane.
-** Further, translate the irregular slab in 2/3rds of the
+** Similarly, create nine, 3 D data spaces (10 X 10 X 10),
+** and select similar irregular hyper slabs in each, three
+** with the slab parallel to the xy plane, three parallel
+** to the xz plane, and three parallel to the yz plane.
+** Further, translate the irregular slab in 2/3rds of the
** cases.
**
-** Assuming that z is the fastest changing dimension,
-** H5S_select_shape_same() should return TRUE when
-** comparing the 2 D irregular hyperslab selection
-** against the irregular hyperslab selections parallel
-** to the yz plane in the 3 D space, and FALSE when
-** comparing it against the irregular hyper slabs
+** Assuming that z is the fastest changing dimension,
+** H5S_select_shape_same() should return TRUE when
+** comparing the 2 D irregular hyperslab selection
+** against the irregular hyperslab selections parallel
+** to the yz plane in the 3 D space, and FALSE when
+** comparing it against the irregular hyper slabs
** selections parallel to the xy or xz planes.
**
****************************************************************/
@@ -10119,36 +10234,36 @@ test_shape_same_dr__smoke_check_3(void)
/* setup is done -- run the tests: */
/* Compare against "xy" selection */
- check = H5S_select_shape_same_test(small_cube_xy_slice_0_sid, small_square_sid);
- VERIFY(check, FALSE, "H5S_select_shape_same_test");
+ check = H5S__select_shape_same_test(small_cube_xy_slice_0_sid, small_square_sid);
+ VERIFY(check, FALSE, "H5S__select_shape_same_test");
- check = H5S_select_shape_same_test(small_cube_xy_slice_1_sid, small_square_sid);
- VERIFY(check, FALSE, "H5S_select_shape_same_test");
+ check = H5S__select_shape_same_test(small_cube_xy_slice_1_sid, small_square_sid);
+ VERIFY(check, FALSE, "H5S__select_shape_same_test");
- check = H5S_select_shape_same_test(small_cube_xy_slice_2_sid, small_square_sid);
- VERIFY(check, FALSE, "H5S_select_shape_same_test");
+ check = H5S__select_shape_same_test(small_cube_xy_slice_2_sid, small_square_sid);
+ VERIFY(check, FALSE, "H5S__select_shape_same_test");
/* Compare against "xz" selection */
- check = H5S_select_shape_same_test(small_cube_xz_slice_0_sid, small_square_sid);
- VERIFY(check, FALSE, "H5S_select_shape_same_test");
+ check = H5S__select_shape_same_test(small_cube_xz_slice_0_sid, small_square_sid);
+ VERIFY(check, FALSE, "H5S__select_shape_same_test");
- check = H5S_select_shape_same_test(small_cube_xz_slice_1_sid, small_square_sid);
- VERIFY(check, FALSE, "H5S_select_shape_same_test");
+ check = H5S__select_shape_same_test(small_cube_xz_slice_1_sid, small_square_sid);
+ VERIFY(check, FALSE, "H5S__select_shape_same_test");
- check = H5S_select_shape_same_test(small_cube_xz_slice_2_sid, small_square_sid);
- VERIFY(check, FALSE, "H5S_select_shape_same_test");
+ check = H5S__select_shape_same_test(small_cube_xz_slice_2_sid, small_square_sid);
+ VERIFY(check, FALSE, "H5S__select_shape_same_test");
/* Compare against "yz" selection */
- check = H5S_select_shape_same_test(small_cube_yz_slice_0_sid, small_square_sid);
- VERIFY(check, TRUE, "H5S_select_shape_same_test");
+ check = H5S__select_shape_same_test(small_cube_yz_slice_0_sid, small_square_sid);
+ VERIFY(check, TRUE, "H5S__select_shape_same_test");
- check = H5S_select_shape_same_test(small_cube_yz_slice_1_sid, small_square_sid);
- VERIFY(check, TRUE, "H5S_select_shape_same_test");
+ check = H5S__select_shape_same_test(small_cube_yz_slice_1_sid, small_square_sid);
+ VERIFY(check, TRUE, "H5S__select_shape_same_test");
- check = H5S_select_shape_same_test(small_cube_yz_slice_2_sid, small_square_sid);
- VERIFY(check, TRUE, "H5S_select_shape_same_test");
+ check = H5S__select_shape_same_test(small_cube_yz_slice_2_sid, small_square_sid);
+ VERIFY(check, TRUE, "H5S__select_shape_same_test");
/* Close dataspaces */
@@ -10190,9 +10305,9 @@ test_shape_same_dr__smoke_check_3(void)
/****************************************************************
**
-** test_shape_same_dr__smoke_check_4():
+** test_shape_same_dr__smoke_check_4():
**
-** Create a square, 2 D data space (10 X 10), and select
+** Create a square, 2 D data space (10 X 10), and select
** the entire space.
**
** Similarly, create 3 D and 4 D data spaces:
@@ -10213,7 +10328,7 @@ test_shape_same_dr__smoke_check_3(void)
** And select these entire spaces as well.
**
** Compare the 2 D space against all the other spaces
-** with H5S_select_shape_same(). The (1 X 10 X 10) &
+** with H5S_select_shape_same(). The (1 X 10 X 10) &
** (1 X 1 X 10 X 10) should return TRUE. All others
** should return FALSE.
**
@@ -10331,39 +10446,39 @@ test_shape_same_dr__smoke_check_4(void)
/* setup is done -- run the tests: */
- check = H5S_select_shape_same_test(three_d_space_0_sid, square_sid);
- VERIFY(check, TRUE, "H5S_select_shape_same_test");
+ check = H5S__select_shape_same_test(three_d_space_0_sid, square_sid);
+ VERIFY(check, TRUE, "H5S__select_shape_same_test");
- check = H5S_select_shape_same_test(three_d_space_1_sid, square_sid);
- VERIFY(check, FALSE, "H5S_select_shape_same_test");
+ check = H5S__select_shape_same_test(three_d_space_1_sid, square_sid);
+ VERIFY(check, FALSE, "H5S__select_shape_same_test");
- check = H5S_select_shape_same_test(three_d_space_2_sid, square_sid);
- VERIFY(check, FALSE, "H5S_select_shape_same_test");
+ check = H5S__select_shape_same_test(three_d_space_2_sid, square_sid);
+ VERIFY(check, FALSE, "H5S__select_shape_same_test");
- check = H5S_select_shape_same_test(three_d_space_3_sid, square_sid);
- VERIFY(check, FALSE, "H5S_select_shape_same_test");
+ check = H5S__select_shape_same_test(three_d_space_3_sid, square_sid);
+ VERIFY(check, FALSE, "H5S__select_shape_same_test");
- check = H5S_select_shape_same_test(four_d_space_0_sid, square_sid);
- VERIFY(check, TRUE, "H5S_select_shape_same_test");
+ check = H5S__select_shape_same_test(four_d_space_0_sid, square_sid);
+ VERIFY(check, TRUE, "H5S__select_shape_same_test");
- check = H5S_select_shape_same_test(four_d_space_1_sid, square_sid);
- VERIFY(check, FALSE, "H5S_select_shape_same_test");
+ check = H5S__select_shape_same_test(four_d_space_1_sid, square_sid);
+ VERIFY(check, FALSE, "H5S__select_shape_same_test");
- check = H5S_select_shape_same_test(four_d_space_2_sid, square_sid);
- VERIFY(check, FALSE, "H5S_select_shape_same_test");
+ check = H5S__select_shape_same_test(four_d_space_2_sid, square_sid);
+ VERIFY(check, FALSE, "H5S__select_shape_same_test");
- check = H5S_select_shape_same_test(four_d_space_3_sid, square_sid);
- VERIFY(check, FALSE, "H5S_select_shape_same_test");
+ check = H5S__select_shape_same_test(four_d_space_3_sid, square_sid);
+ VERIFY(check, FALSE, "H5S__select_shape_same_test");
- check = H5S_select_shape_same_test(four_d_space_4_sid, square_sid);
- VERIFY(check, FALSE, "H5S_select_shape_same_test");
+ check = H5S__select_shape_same_test(four_d_space_4_sid, square_sid);
+ VERIFY(check, FALSE, "H5S__select_shape_same_test");
- check = H5S_select_shape_same_test(four_d_space_5_sid, square_sid);
- VERIFY(check, FALSE, "H5S_select_shape_same_test");
+ check = H5S__select_shape_same_test(four_d_space_5_sid, square_sid);
+ VERIFY(check, FALSE, "H5S__select_shape_same_test");
- check = H5S_select_shape_same_test(four_d_space_6_sid, square_sid);
- VERIFY(check, FALSE, "H5S_select_shape_same_test");
+ check = H5S__select_shape_same_test(four_d_space_6_sid, square_sid);
+ VERIFY(check, FALSE, "H5S__select_shape_same_test");
/* Close dataspaces */
@@ -10410,12 +10525,12 @@ test_shape_same_dr__smoke_check_4(void)
/****************************************************************
**
** test_shape_same_dr__full_space_vs_slice(): Tests selection
-** of a full n-cube data space vs an n-dimensional slice of
-** of an m-cube (m > n) in a call to H5S_select_shape_same().
-** Note that this test does not require the n-cube and the
+** of a full n-cube data space vs an n-dimensional slice of
+** of an m-cube (m > n) in a call to H5S_select_shape_same().
+** Note that this test does not require the n-cube and the
** n-dimensional slice to have the same rank (although
-** H5S_select_shape_same() should always return FALSE if
-** they don't).
+** H5S_select_shape_same() should always return FALSE if
+** they don't).
**
** Per Quincey's suggestion, only test up to 5 dimensional
** spaces.
@@ -10431,7 +10546,7 @@ test_shape_same_dr__full_space_vs_slice(int test_num,
hbool_t expected_result)
{
char test_desc_0[128];
- char test_desc_1[128];
+ char test_desc_1[256];
int i;
hid_t n_cube_0_sid; /* the fully selected hyper cube */
hid_t n_cube_1_sid; /* the hyper cube in which a slice is selected */
@@ -10452,16 +10567,16 @@ test_shape_same_dr__full_space_vs_slice(int test_num,
HDassert( large_rank <= SS_DR_MAX_RANK );
HDassert( 0 <= offset );
HDassert( offset < large_rank );
- HDassert( edge_size > 0 );
- HDassert( edge_size <= 1000 );
+ HDassert( edge_size > 0 );
+ HDassert( edge_size <= 1000 );
- sprintf(test_desc_0,
- "\tn-cube slice through m-cube (n <= m) test %d.\n",
+ sprintf(test_desc_0,
+ "\tn-cube slice through m-cube (n <= m) test %d.\n",
test_num);
MESSAGE(7, (test_desc_0));
/* This statement must be updated if SS_DR_MAX_RANK is changed */
- sprintf(test_desc_1,
+ sprintf(test_desc_1,
"\t\tranks: %d/%d offset: %d dim_selected: %d/%d/%d/%d/%d.\n",
small_rank, large_rank, offset,
(int)dim_selected[0],
@@ -10526,7 +10641,7 @@ test_shape_same_dr__full_space_vs_slice(int test_num,
/* setup is done -- run the test: */
- check = H5S_select_shape_same_test(n_cube_0_sid, n_cube_1_sid);
+ check = H5S__select_shape_same_test(n_cube_0_sid, n_cube_1_sid);
VERIFY(check, expected_result, "test_shape_same_dr__full_space_vs_slice");
@@ -10542,27 +10657,27 @@ test_shape_same_dr__full_space_vs_slice(int test_num,
/****************************************************************
**
-** test_shape_same_dr__run_full_space_vs_slice_tests():
+** test_shape_same_dr__run_full_space_vs_slice_tests():
**
** Run the est_shape_same_dr__full_space_vs_slice() test
** over a variety of ranks and offsets.
**
-** At present, we test H5S_select_shape_same() with
+** At present, we test H5S_select_shape_same() with
** fully selected 1, 2, 3, and 4 cubes as one parameter, and
** 1, 2, 3, and 4 dimensional slices through a n-cube of rank
-** no more than 5 (and at least the rank of the slice).
-** We stop at rank 5, as Quincey suggested that it would be
+** no more than 5 (and at least the rank of the slice).
+** We stop at rank 5, as Quincey suggested that it would be
** sufficient.
**
-** All the n-cubes will have lengths of the same size, so
+** All the n-cubes will have lengths of the same size, so
** H5S_select_shape_same() should return true iff:
**
-** 1) the rank for the fully selected n cube equals the
+** 1) the rank for the fully selected n cube equals the
** number of dimensions selected in the slice through the
** m-cube (m >= n).
**
** 2) The dimensions selected in the slice through the m-cube
-** are the dimesnions with the most quickly changing
+** are the dimesnions with the most quickly changing
** indices.
**
****************************************************************/
@@ -10668,7 +10783,7 @@ test_shape_same_dr__run_full_space_vs_slice_tests(void)
dim_selected,
expected_result
);
-
+
z++;
} while((z < 2) && (large_rank >= 1));
@@ -10691,15 +10806,15 @@ test_shape_same_dr__run_full_space_vs_slice_tests(void)
/****************************************************************
**
-** test_shape_same_dr__checkerboard(): Tests selection of a
-** "checker board" subset of a full n-cube data space vs
+** test_shape_same_dr__checkerboard(): Tests selection of a
+** "checker board" subset of a full n-cube data space vs
** a "checker board" n-dimensional slice of an m-cube (m > n).
-** in a call to H5S_select_shape_same().
+** in a call to H5S_select_shape_same().
**
-** Note that this test does not require the n-cube and the
+** Note that this test does not require the n-cube and the
** n-dimensional slice to have the same rank (although
-** H5S_select_shape_same() should always return FALSE if
-** they don't).
+** H5S_select_shape_same() should always return FALSE if
+** they don't).
**
** Per Quincey's suggestion, only test up to 5 dimensional
** spaces.
@@ -10716,14 +10831,14 @@ test_shape_same_dr__checkerboard(int test_num,
hbool_t expected_result)
{
char test_desc_0[128];
- char test_desc_1[128];
+ char test_desc_1[256];
int i;
int dims_selected = 0;
- hid_t n_cube_0_sid; /* the checker board selected
- * hyper cube
+ hid_t n_cube_0_sid; /* the checker board selected
+ * hyper cube
*/
- hid_t n_cube_1_sid; /* the hyper cube in which a
- * checkerboard slice is selected
+ hid_t n_cube_1_sid; /* the hyper cube in which a
+ * checkerboard slice is selected
*/
hsize_t dims[SS_DR_MAX_RANK];
hsize_t base_start[2];
@@ -10745,8 +10860,8 @@ test_shape_same_dr__checkerboard(int test_num,
HDassert( small_rank <= large_rank );
HDassert( large_rank <= SS_DR_MAX_RANK );
HDassert( 0 < checker_size );
- HDassert( checker_size <= edge_size );
- HDassert( edge_size <= 1000 );
+ HDassert( checker_size <= edge_size );
+ HDassert( edge_size <= 1000 );
HDassert( 0 <= offset );
HDassert( offset < (int)edge_size );
@@ -10757,13 +10872,13 @@ test_shape_same_dr__checkerboard(int test_num,
HDassert( dims_selected >= 0 );
HDassert( dims_selected <= large_rank );
- sprintf(test_desc_0,
- "\tcheckerboard n-cube slice through m-cube (n <= m) test %d.\n",
+ sprintf(test_desc_0,
+ "\tcheckerboard n-cube slice through m-cube (n <= m) test %d.\n",
test_num);
MESSAGE(7, (test_desc_0));
/* This statement must be updated if SS_DR_MAX_RANK is changed */
- sprintf(test_desc_1,
+ sprintf(test_desc_1,
"\tranks: %d/%d edge/chkr size: %d/%d offset: %d dim_selected: %d/%d/%d/%d/%d:%d.\n",
small_rank, large_rank,
(int)edge_size, (int)checker_size,
@@ -10803,17 +10918,17 @@ test_shape_same_dr__checkerboard(int test_num,
* * * - - * * - - * *
* * * - - * * - - * *
*
- * In both cases, asterisks indicate selected elements,
+ * In both cases, asterisks indicate selected elements,
* and dashes indicate unselected elements.
*
* 3-D and 4-D ascii art is somewhat painful, so I'll
* leave those selections to your imagination. :-)
*
* Note, that since the edge_size and checker_size are
- * parameters that are passed in, the selection need
+ * parameters that are passed in, the selection need
* not look exactly like the selection shown above.
- * At present, the function allows checker sizes that
- * are not even divisors of the edge size -- thus
+ * At present, the function allows checker sizes that
+ * are not even divisors of the edge size -- thus
* something like the following is also possible:
*
* * * * - - - * * * -
@@ -10827,14 +10942,14 @@ test_shape_same_dr__checkerboard(int test_num,
* * * * - - - * * * -
* - - - * * * - - - *
*
- * As the above pattern can't be selected in one
+ * As the above pattern can't be selected in one
* call to H5Sselect_hyperslab(), and since the
* values in the start, stride, count, and block
- * arrays will be repeated over all entries in
+ * arrays will be repeated over all entries in
* the selected space case, and over all selected
* dimensions in the selected hyperslab case, we
- * compute these values first and store them in
- * in the base_start, base_stride, base_count,
+ * compute these values first and store them in
+ * in the base_start, base_stride, base_count,
* and base_block arrays.
*/
@@ -10844,9 +10959,9 @@ test_shape_same_dr__checkerboard(int test_num,
base_stride[0] = 2 * checker_size;
base_stride[1] = 2 * checker_size;
- /* Note that the following computation depends on the C99
- * requirement that integer division discard any fraction
- * (truncation towards zero) to function correctly. As we
+ /* Note that the following computation depends on the C99
+ * requirement that integer division discard any fraction
+ * (truncation towards zero) to function correctly. As we
* now require C99, this shouldn't be a problem, but noting
* it may save us some pain if we are ever obliged to support
* pre-C99 compilers again.
@@ -10863,7 +10978,7 @@ test_shape_same_dr__checkerboard(int test_num,
base_block[0] = checker_size;
base_block[1] = checker_size;
- /* now setup start, stride, count, and block arrays for
+ /* now setup start, stride, count, and block arrays for
* the first call to H5Sselect_hyperslab().
*/
for(i = 0; i < SS_DR_MAX_RANK; i++) {
@@ -10877,10 +10992,10 @@ test_shape_same_dr__checkerboard(int test_num,
start, stride, count, block);
CHECK(ret, FAIL, "H5Sselect_hyperslab");
- /* if small_rank == 1, or if edge_size == checker_size, we
+ /* if small_rank == 1, or if edge_size == checker_size, we
* are done, as either there is no added dimension in which
* to place offset selected "checkers".
- *
+ *
* Otherwise, set up start, stride, count and block, and
* make the additional selection.
*/
@@ -10900,7 +11015,7 @@ test_shape_same_dr__checkerboard(int test_num,
/* Wierdness alert:
*
- * Some how, it seems that selections can extend beyond the
+ * Some how, it seems that selections can extend beyond the
* boundaries of the target data space -- hence the following
* code to manually clip the selection back to the data space
* proper.
@@ -10923,8 +11038,8 @@ test_shape_same_dr__checkerboard(int test_num,
/* Now select the checkerboard selection in the (possibly larger) n-cube.
- *
- * Since we have already calculated the base start, stride, count,
+ *
+ * Since we have already calculated the base start, stride, count,
* and block, re-use the values in setting up start, stride, count,
* and block.
*/
@@ -10968,10 +11083,10 @@ test_shape_same_dr__checkerboard(int test_num,
start_ptr, stride_ptr, count_ptr, block_ptr);
CHECK(ret, FAIL, "H5Sselect_hyperslab");
- /* As before, if the number of dimensions selected is less than or
- * equal to 1, or if edge_size == checker_size, we are done, as
- * either there is no added dimension in which to place offset selected
- * "checkers", or the hyperslab is completely occupied by one
+ /* As before, if the number of dimensions selected is less than or
+ * equal to 1, or if edge_size == checker_size, we are done, as
+ * either there is no added dimension in which to place offset selected
+ * "checkers", or the hyperslab is completely occupied by one
* "checker".
*
* Otherwise, set up start, stride, count and block, and
@@ -11001,7 +11116,7 @@ test_shape_same_dr__checkerboard(int test_num,
/* Wierdness alert:
*
- * Again, it seems that selections can extend beyond the
+ * Again, it seems that selections can extend beyond the
* boundaries of the target data space -- hence the following
* code to manually clip the selection back to the data space
* proper.
@@ -11018,7 +11133,7 @@ test_shape_same_dr__checkerboard(int test_num,
CHECK(ret, FAIL, "H5Sselect_hyperslab");
/* setup is done -- run the test: */
- check = H5S_select_shape_same_test(n_cube_0_sid, n_cube_1_sid);
+ check = H5S__select_shape_same_test(n_cube_0_sid, n_cube_1_sid);
VERIFY(check, expected_result, "test_shape_same_dr__checkerboard");
@@ -11034,23 +11149,23 @@ test_shape_same_dr__checkerboard(int test_num,
/****************************************************************
**
-** test_shape_same_dr__run_checkerboard_tests():
+** test_shape_same_dr__run_checkerboard_tests():
**
-** In this set of tests, we test H5S_select_shape_same()
-** with a "checkerboard" selection of 1, 2, 3, and 4 cubes as
-** one parameter, and 1, 2, 3, and 4 dimensional checkerboard
-** slices through a n-cube of rank no more than 5 (and at
-** least the rank of the slice).
+** In this set of tests, we test H5S_select_shape_same()
+** with a "checkerboard" selection of 1, 2, 3, and 4 cubes as
+** one parameter, and 1, 2, 3, and 4 dimensional checkerboard
+** slices through a n-cube of rank no more than 5 (and at
+** least the rank of the slice).
**
-** All the n-cubes will have lengths of the same size, so
+** All the n-cubes will have lengths of the same size, so
** H5S_select_shape_same() should return true iff:
**
-** 1) the rank of the n cube equals the number of dimensions
-** selected in the checker board slice through the m-cube
+** 1) the rank of the n cube equals the number of dimensions
+** selected in the checker board slice through the m-cube
** (m >= n).
**
-** 2) The dimensions selected in the checkerboard slice
-** through the m-cube are the dimensions with the most
+** 2) The dimensions selected in the checkerboard slice
+** through the m-cube are the dimensions with the most
** quickly changing indices.
**
****************************************************************/
@@ -11101,7 +11216,7 @@ test_shape_same_dr__run_checkerboard_tests(void)
dim_selected[4] = FALSE;
else
dim_selected[4] = TRUE;
-
+
/* compute the expected result: */
i = 0;
@@ -11305,17 +11420,17 @@ test_shape_same_dr__run_checkerboard_tests(void)
/****************************************************************
**
-** test_shape_same_dr__irregular():
+** test_shape_same_dr__irregular():
**
-** Tests selection of an "irregular" subset of a full
+** Tests selection of an "irregular" subset of a full
** n-cube data space vs an identical "irregular" subset
** of an n-dimensional slice of an m-cube (m > n).
-** in a call to H5S_select_shape_same().
+** in a call to H5S_select_shape_same().
**
-** Note that this test does not require the n-cube and the
+** Note that this test does not require the n-cube and the
** n-dimensional slice to have the same rank (although
-** H5S_select_shape_same() should always return FALSE if
-** they don't).
+** H5S_select_shape_same() should always return FALSE if
+** they don't).
**
****************************************************************/
static void
@@ -11328,7 +11443,7 @@ test_shape_same_dr__irregular(int test_num,
hbool_t expected_result)
{
char test_desc_0[128];
- char test_desc_1[128];
+ char test_desc_1[256];
int edge_size = 10;
int i;
int j;
@@ -11337,7 +11452,7 @@ test_shape_same_dr__irregular(int test_num,
hid_t n_cube_0_sid; /* the hyper cube containing
* an irregular selection
*/
- hid_t n_cube_1_sid; /* the hyper cube in which a
+ hid_t n_cube_1_sid; /* the hyper cube in which a
* slice contains an irregular
* selection.
*/
@@ -11373,7 +11488,7 @@ test_shape_same_dr__irregular(int test_num,
hsize_t clip_block[SS_DR_MAX_RANK] = {10, 10, 10, 10, 10};
- hsize_t *(starts[SS_DR_MAX_RANK]) =
+ hsize_t *(starts[SS_DR_MAX_RANK]) =
{start_0, start_1, start_2, start_3, start_4};
hsize_t *(strides[SS_DR_MAX_RANK]) =
{stride_0, stride_1, stride_2, stride_3, stride_4};
@@ -11396,8 +11511,8 @@ test_shape_same_dr__irregular(int test_num,
HDassert( 0 < small_rank );
HDassert( small_rank <= large_rank );
HDassert( large_rank <= SS_DR_MAX_RANK );
- HDassert( 9 <= edge_size );
- HDassert( edge_size <= 1000 );
+ HDassert( 9 <= edge_size );
+ HDassert( edge_size <= 1000 );
HDassert( 0 <= slice_offset );
HDassert( slice_offset < edge_size );
HDassert( -2 <= pattern_offset );
@@ -11410,16 +11525,16 @@ test_shape_same_dr__irregular(int test_num,
HDassert( dims_selected >= 0 );
HDassert( dims_selected <= large_rank );
- sprintf(test_desc_0,
- "\tirregular sub set of n-cube slice through m-cube (n <= m) test %d.\n",
+ sprintf(test_desc_0,
+ "\tirregular sub set of n-cube slice through m-cube (n <= m) test %d.\n",
test_num);
MESSAGE(7, (test_desc_0));
/* This statement must be updated if SS_DR_MAX_RANK is changed */
- sprintf(test_desc_1,
+ sprintf(test_desc_1,
"\tranks: %d/%d edge: %d s/p offset: %d/%d dim_selected: %d/%d/%d/%d/%d:%d.\n",
small_rank, large_rank,
- edge_size,
+ edge_size,
slice_offset, pattern_offset,
(int)dim_selected[0],
(int)dim_selected[1],
@@ -11438,11 +11553,11 @@ test_shape_same_dr__irregular(int test_num,
CHECK(n_cube_0_sid, FAIL, "H5Screate_simple");
/* Select an "irregular" pattern in the small n-cube. This
- * pattern can be though of a set of four 3 x 2 x 2 X 2
- * four dimensional prisims, each parallel to one of the
- * axies and none of them intersecting with the other.
+ * pattern can be though of a set of four 3 x 2 x 2 X 2
+ * four dimensional prisims, each parallel to one of the
+ * axies and none of them intersecting with the other.
*
- * In the lesser dimensional cases, this 4D pattern is
+ * In the lesser dimensional cases, this 4D pattern is
* projected onto the lower dimensional space.
*
* In the 1-D case, the projection of the pattern looks
@@ -11467,12 +11582,12 @@ test_shape_same_dr__irregular(int test_num,
* 0 - - - - - - - - - -
* 0 1 2 3 4 5 6 7 8 9 x
*
- * In both cases, asterisks indicate selected elements,
+ * In both cases, asterisks indicate selected elements,
* and dashes indicate unselected elements.
*
* Note that is this case, since the edge size is fixed,
- * the pattern does not change. However, we do use the
- * displacement parameter to allow it to be moved around
+ * the pattern does not change. However, we do use the
+ * displacement parameter to allow it to be moved around
* within the n-cube or hyper slab.
*/
@@ -11487,7 +11602,7 @@ test_shape_same_dr__irregular(int test_num,
CHECK(ret, FAIL, "H5Sselect_hyperslab");
} /* end for */
- /* finally, clip the selection to ensure that it lies fully
+ /* finally, clip the selection to ensure that it lies fully
* within the n-cube.
*/
ret = H5Sselect_hyperslab(n_cube_0_sid, H5S_SELECT_AND,
@@ -11526,8 +11641,8 @@ test_shape_same_dr__irregular(int test_num,
/* Now select the irregular selection in the (possibly larger) n-cube.
- *
- * Basic idea is to project the pattern used in the smaller n-cube
+ *
+ * Basic idea is to project the pattern used in the smaller n-cube
* onto the dimensions selected in the larger n-cube, with the displacement
* specified.
*/
@@ -11564,7 +11679,7 @@ test_shape_same_dr__irregular(int test_num,
/* setup is done -- run the test: */
- check = H5S_select_shape_same_test(n_cube_0_sid, n_cube_1_sid);
+ check = H5S__select_shape_same_test(n_cube_0_sid, n_cube_1_sid);
VERIFY(check, expected_result, "test_shape_same_dr__checkerboard");
@@ -11580,25 +11695,25 @@ test_shape_same_dr__irregular(int test_num,
/****************************************************************
**
-** test_shape_same_dr__run_irregular_tests():
+** test_shape_same_dr__run_irregular_tests():
**
-** In this set of tests, we test H5S_select_shape_same()
-** with an "irregular" subselection of 1, 2, 3, and 4 cubes as
-** one parameter, and irregular subselections of 1, 2, 3,
-** and 4 dimensional slices through a n-cube of rank no more
-** than 5 (and at least the rank of the slice) as the other.
-** Note that the "irregular" selection may be offset between
+** In this set of tests, we test H5S_select_shape_same()
+** with an "irregular" subselection of 1, 2, 3, and 4 cubes as
+** one parameter, and irregular subselections of 1, 2, 3,
+** and 4 dimensional slices through a n-cube of rank no more
+** than 5 (and at least the rank of the slice) as the other.
+** Note that the "irregular" selection may be offset between
** the n-cube and the slice.
**
** All the irregular selections will be identical (modulo rank)
** so H5S_select_shape_same() should return true iff:
**
-** 1) the rank of the n cube equals the number of dimensions
-** selected in the irregular slice through the m-cube
+** 1) the rank of the n cube equals the number of dimensions
+** selected in the irregular slice through the m-cube
** (m >= n).
**
-** 2) The dimensions selected in the irregular slice
-** through the m-cube are the dimensions with the most
+** 2) The dimensions selected in the irregular slice
+** through the m-cube are the dimensions with the most
** quickly changing indices.
**
****************************************************************/
@@ -11649,7 +11764,7 @@ test_shape_same_dr__run_irregular_tests(void)
dim_selected[4] = FALSE;
else
dim_selected[4] = TRUE;
-
+
/* compute the expected result: */
i = 0;
@@ -11795,8 +11910,8 @@ test_shape_same_dr__run_irregular_tests(void)
/****************************************************************
**
-** test_shape_same_dr(): Tests selections on dataspace with
-** different ranks, to verify that "shape same" routine
+** test_shape_same_dr(): Tests selections on dataspace with
+** different ranks, to verify that "shape same" routine
** is now handling this case correctly.
**
****************************************************************/
@@ -11843,7 +11958,8 @@ test_space_rebuild(void)
hid_t sid_irreg1,sid_irreg2,sid_irreg3,sid_irreg4,sid_irreg5;
/* rebuild status state */
- htri_t rebuild_stat,rebuild_check;
+ H5S_diminfo_valid_t rebuild_stat1,rebuild_stat2;
+ htri_t rebuild_check;
herr_t ret;
/* dimensions of rank 1 to rank 5 */
@@ -11912,19 +12028,23 @@ test_space_rebuild(void)
ret = H5Sselect_hyperslab(sid_reg1,H5S_SELECT_OR,start1,stride1,count1,block1);
CHECK(ret, FAIL, "H5Sselect_hyperslab");
- rebuild_stat = FALSE;
- rebuild_stat = H5S_get_rebuild_status_test(sid_reg1);
- assert(rebuild_stat!=FAIL);
- /* In this case, rebuild_stat should be TRUE. */
- if(!rebuild_stat){
+ ret = H5S__get_rebuild_status_test(sid_reg1,&rebuild_stat1,&rebuild_stat2);
+ CHECK(ret, FAIL, "H5S__get_rebuild_status_test");
+ /* In this case, rebuild_stat1 and rebuild_stat2 should be
+ * H5S_DIMINFO_VALID_YES. */
+ if(rebuild_stat1 != H5S_DIMINFO_VALID_YES) {
ret = FAIL;
CHECK(ret,FAIL,"H5S_hyper_rebuild");
- }
- else {
+ } /* end if */
+ if(rebuild_stat2 != H5S_DIMINFO_VALID_YES) {
+ ret = FAIL;
+ CHECK(ret,FAIL,"H5S_hyper_rebuild");
+ } /* end if */
+ if(ret != FAIL) {
/* In this case, rebuild_check should be TRUE. */
- rebuild_check = H5S_select_shape_same_test(sid_reg1,sid_reg_ori1);
+ rebuild_check = H5S__select_shape_same_test(sid_reg1,sid_reg_ori1);
CHECK(rebuild_check,FALSE,"H5S_hyper_rebuild");
- }
+ } /* end if */
/* For irregular hyperslab */
sid_irreg1 = H5Screate_simple(SPACERE1_RANK,dims1,NULL);
@@ -11944,14 +12064,19 @@ test_space_rebuild(void)
ret = H5Sselect_hyperslab(sid_irreg1,H5S_SELECT_OR,start1,stride1,count1,block1);
CHECK(ret, FAIL, "H5Sselect_hyperslab");
- rebuild_stat = TRUE;
- rebuild_stat = H5S_get_rebuild_status_test(sid_irreg1);
- assert(rebuild_stat!=FAIL);
- /* In this case, rebuild_stat should be FALSE. */
- if(rebuild_stat){
+ ret = H5S__get_rebuild_status_test(sid_irreg1,&rebuild_stat1,&rebuild_stat2);
+ CHECK(ret, FAIL, "H5S__get_rebuild_status_test");
+ /* In this case, rebuild_stat1 should be H5S_DIMINFO_VALID_NO and
+ * rebuild_stat2 should be H5S_DIMINFO_VALID_IMPOSSIBLE. */
+ if(rebuild_stat1 != H5S_DIMINFO_VALID_NO) {
ret = FAIL;
CHECK(ret,FAIL,"H5S_hyper_rebuild");
- }/* No need to do shape comparision */
+ } /* end if */
+ if(rebuild_stat2 != H5S_DIMINFO_VALID_IMPOSSIBLE) {
+ ret = FAIL;
+ CHECK(ret,FAIL,"H5S_hyper_rebuild");
+ } /* end if */
+ /* No need to do shape comparision */
MESSAGE(7, ("Testing functionality to rebuild 2-D hyperslab selection\n"));
@@ -11991,19 +12116,23 @@ test_space_rebuild(void)
ret = H5Sselect_hyperslab(sid_reg2,H5S_SELECT_OR,start2,stride2,count2,block2);
CHECK(ret, FAIL, "H5Sselect_hyperslab");
- rebuild_stat = FALSE;
- rebuild_stat = H5S_get_rebuild_status_test(sid_reg2);
- assert(rebuild_stat!=FAIL);
- /* In this case, rebuild_stat should be TRUE. */
- if(!rebuild_stat){
+ ret = H5S__get_rebuild_status_test(sid_reg2,&rebuild_stat1,&rebuild_stat2);
+ CHECK(ret, FAIL, "H5S__get_rebuild_status_test");
+ /* In this case, rebuild_stat1 and rebuild_stat2 should be
+ * H5S_DIMINFO_VALID_YES. */
+ if(rebuild_stat1 != H5S_DIMINFO_VALID_YES) {
ret = FAIL;
CHECK(ret,FAIL,"H5S_hyper_rebuild");
- }
- else {
+ } /* end if */
+ if(rebuild_stat2 != H5S_DIMINFO_VALID_YES) {
+ ret = FAIL;
+ CHECK(ret,FAIL,"H5S_hyper_rebuild");
+ } /* end if */
+ if(ret != FAIL) {
/* In this case, rebuild_check should be TRUE. */
- rebuild_check = H5S_select_shape_same_test(sid_reg2,sid_reg_ori2);
+ rebuild_check = H5S__select_shape_same_test(sid_reg2,sid_reg_ori2);
CHECK(rebuild_check,FALSE,"H5S_hyper_rebuild");
- }
+ } /* end if */
/* 2-D irregular case */
sid_irreg2 = H5Screate_simple(SPACERE2_RANK,dims2,NULL);
@@ -12028,14 +12157,19 @@ test_space_rebuild(void)
ret = H5Sselect_hyperslab(sid_irreg2,H5S_SELECT_OR,start2,stride2,count2,block2);
CHECK(ret, FAIL, "H5Sselect_hyperslab");
- rebuild_stat = TRUE;
- rebuild_stat = H5S_get_rebuild_status_test(sid_irreg2);
- assert(rebuild_stat!=FAIL);
- /* In this case, rebuild_stat should be FALSE. */
- if(rebuild_stat){
+ ret = H5S__get_rebuild_status_test(sid_irreg2,&rebuild_stat1,&rebuild_stat2);
+ CHECK(ret, FAIL, "H5S__get_rebuild_status_test");
+ /* In this case, rebuild_stat1 should be H5S_DIMINFO_VALID_NO and
+ * rebuild_stat2 should be H5S_DIMINFO_VALID_IMPOSSIBLE. */
+ if(rebuild_stat1 != H5S_DIMINFO_VALID_NO) {
+ ret = FAIL;
+ CHECK(ret,FAIL,"H5S_hyper_rebuild");
+ } /* end if */
+ if(rebuild_stat2 != H5S_DIMINFO_VALID_IMPOSSIBLE) {
ret = FAIL;
CHECK(ret,FAIL,"H5S_hyper_rebuild");
- }/* No need to do shape comparision */
+ } /* end if */
+ /* No need to do shape comparision */
MESSAGE(7, ("Testing functionality to rebuild 3-D hyperslab selection\n"));
@@ -12080,20 +12214,23 @@ test_space_rebuild(void)
ret = H5Sselect_hyperslab(sid_reg3,H5S_SELECT_OR,start3,stride3,count3,block3);
CHECK(ret, FAIL, "H5Sselect_hyperslab");
- rebuild_stat = FALSE;
- rebuild_stat = H5S_get_rebuild_status_test(sid_reg3);
- assert(rebuild_stat!=FAIL);
-
- /* In this case, rebuild_stat should be TRUE. */
- if(!rebuild_stat){
+ ret = H5S__get_rebuild_status_test(sid_reg3,&rebuild_stat1,&rebuild_stat2);
+ CHECK(ret, FAIL, "H5S__get_rebuild_status_test");
+ /* In this case, rebuild_stat1 and rebuild_stat2 should be
+ * H5S_DIMINFO_VALID_YES. */
+ if(rebuild_stat1 != H5S_DIMINFO_VALID_YES) {
ret = FAIL;
CHECK(ret,FAIL,"H5S_hyper_rebuild");
- }
- else {
+ } /* end if */
+ if(rebuild_stat2 != H5S_DIMINFO_VALID_YES) {
+ ret = FAIL;
+ CHECK(ret,FAIL,"H5S_hyper_rebuild");
+ } /* end if */
+ if(ret != FAIL) {
/* In this case, rebuild_check should be TRUE. */
- rebuild_check = H5S_select_shape_same_test(sid_reg3,sid_reg_ori3);
+ rebuild_check = H5S__select_shape_same_test(sid_reg3,sid_reg_ori3);
CHECK(rebuild_check,FALSE,"H5S_hyper_rebuild");
- }
+ } /* end if */
sid_irreg3 = H5Screate_simple(SPACERE3_RANK,dims3,NULL);
@@ -12123,14 +12260,19 @@ test_space_rebuild(void)
ret = H5Sselect_hyperslab(sid_irreg3,H5S_SELECT_OR,start3,stride3,count3,block3);
CHECK(ret, FAIL, "H5Sselect_hyperslab");
- rebuild_stat = TRUE;
- rebuild_stat = H5S_get_rebuild_status_test(sid_irreg3);
- assert(rebuild_stat!=FAIL);
- /* In this case, rebuild_stat should be FALSE. */
- if(rebuild_stat){
+ ret = H5S__get_rebuild_status_test(sid_irreg3,&rebuild_stat1,&rebuild_stat2);
+ CHECK(ret, FAIL, "H5S__get_rebuild_status_test");
+ /* In this case, rebuild_stat1 should be H5S_DIMINFO_VALID_NO and
+ * rebuild_stat2 should be H5S_DIMINFO_VALID_IMPOSSIBLE. */
+ if(rebuild_stat1 != H5S_DIMINFO_VALID_NO) {
ret = FAIL;
CHECK(ret,FAIL,"H5S_hyper_rebuild");
- }/* No need to do shape comparision */
+ } /* end if */
+ if(rebuild_stat2 != H5S_DIMINFO_VALID_IMPOSSIBLE) {
+ ret = FAIL;
+ CHECK(ret,FAIL,"H5S_hyper_rebuild");
+ } /* end if */
+ /* No need to do shape comparision */
MESSAGE(7, ("Testing functionality to rebuild 4-D hyperslab selection\n"));
@@ -12183,19 +12325,23 @@ test_space_rebuild(void)
CHECK(ret, FAIL, "H5Sselect_hyperslab");
- rebuild_stat = FALSE;
- rebuild_stat = H5S_get_rebuild_status_test(sid_reg4);
- assert(rebuild_stat!=FAIL);
- /* In this case, rebuild_stat should be TRUE. */
- if(!rebuild_stat){
+ ret = H5S__get_rebuild_status_test(sid_reg4,&rebuild_stat1,&rebuild_stat2);
+ CHECK(ret, FAIL, "H5S__get_rebuild_status_test");
+ /* In this case, rebuild_stat1 and rebuild_stat2 should be
+ * H5S_DIMINFO_VALID_YES. */
+ if(rebuild_stat1 != H5S_DIMINFO_VALID_YES) {
ret = FAIL;
CHECK(ret,FAIL,"H5S_hyper_rebuild");
- }
- else {
+ } /* end if */
+ if(rebuild_stat2 != H5S_DIMINFO_VALID_YES) {
+ ret = FAIL;
+ CHECK(ret,FAIL,"H5S_hyper_rebuild");
+ } /* end if */
+ if(ret != FAIL) {
/* In this case, rebuild_check should be TRUE. */
- rebuild_check = H5S_select_shape_same_test(sid_reg4,sid_reg_ori4);
+ rebuild_check = H5S__select_shape_same_test(sid_reg4,sid_reg_ori4);
CHECK(rebuild_check,FALSE,"H5S_hyper_rebuild");
- }
+ } /* end if */
/* Testing irregular selection */
sid_irreg4 = H5Screate_simple(SPACERE4_RANK,dims4,NULL);
@@ -12236,14 +12382,19 @@ test_space_rebuild(void)
ret = H5Sselect_hyperslab(sid_irreg4,H5S_SELECT_OR,start4,stride4,count4,block4);
CHECK(ret, FAIL, "H5Sselect_hyperslab");
- rebuild_stat = TRUE;
- rebuild_stat = H5S_get_rebuild_status_test(sid_irreg4);
- assert(rebuild_stat!=FAIL);
- /* In this case, rebuild_stat should be FALSE. */
- if(rebuild_stat){
+ ret = H5S__get_rebuild_status_test(sid_irreg4,&rebuild_stat1,&rebuild_stat2);
+ CHECK(ret, FAIL, "H5S__get_rebuild_status_test");
+ /* In this case, rebuild_stat1 should be H5S_DIMINFO_VALID_NO and
+ * rebuild_stat2 should be H5S_DIMINFO_VALID_IMPOSSIBLE. */
+ if(rebuild_stat1 != H5S_DIMINFO_VALID_NO) {
ret = FAIL;
CHECK(ret,FAIL,"H5S_hyper_rebuild");
- }/* No need to do shape comparision */
+ } /* end if */
+ if(rebuild_stat2 != H5S_DIMINFO_VALID_IMPOSSIBLE) {
+ ret = FAIL;
+ CHECK(ret,FAIL,"H5S_hyper_rebuild");
+ } /* end if */
+ /* No need to do shape comparision */
MESSAGE(7, ("Testing functionality to rebuild 5-D hyperslab selection\n"));
@@ -12300,19 +12451,23 @@ test_space_rebuild(void)
CHECK(ret, FAIL, "H5Sselect_hyperslab");
- rebuild_stat = FALSE;
- rebuild_stat = H5S_get_rebuild_status_test(sid_reg5);
- assert(rebuild_stat!=FAIL);
- /* In this case, rebuild_stat should be TRUE. */
- if(!rebuild_stat){
+ ret = H5S__get_rebuild_status_test(sid_reg5,&rebuild_stat1,&rebuild_stat2);
+ CHECK(ret, FAIL, "H5S__get_rebuild_status_test");
+ /* In this case, rebuild_stat1 and rebuild_stat2 should be
+ * H5S_DIMINFO_VALID_YES. */
+ if(rebuild_stat1 != H5S_DIMINFO_VALID_YES) {
ret = FAIL;
CHECK(ret,FAIL,"H5S_hyper_rebuild");
- }
- else {
+ } /* end if */
+ if(rebuild_stat2 != H5S_DIMINFO_VALID_YES) {
+ ret = FAIL;
+ CHECK(ret,FAIL,"H5S_hyper_rebuild");
+ } /* end if */
+ if(ret != FAIL) {
/* In this case, rebuild_check should be TRUE. */
- rebuild_check = H5S_select_shape_same_test(sid_reg5,sid_reg_ori5);
+ rebuild_check = H5S__select_shape_same_test(sid_reg5,sid_reg_ori5);
CHECK(rebuild_check,FALSE,"H5S_hyper_rebuild");
- }
+ } /* end if */
sid_irreg5 = H5Screate_simple(SPACERE5_RANK,dims5,NULL);
@@ -12358,14 +12513,19 @@ test_space_rebuild(void)
ret = H5Sselect_hyperslab(sid_irreg5,H5S_SELECT_OR,start5,stride5,count5,block5);
CHECK(ret, FAIL, "H5Sselect_hyperslab");
- rebuild_stat = TRUE;
- rebuild_stat = H5S_get_rebuild_status_test(sid_irreg5);
- assert(rebuild_stat!=FAIL);
- /* In this case, rebuild_stat should be FALSE. */
- if(rebuild_stat){
+ ret = H5S__get_rebuild_status_test(sid_irreg5,&rebuild_stat1,&rebuild_stat2);
+ CHECK(ret, FAIL, "H5S__get_rebuild_status_test");
+ /* In this case, rebuild_stat1 should be H5S_DIMINFO_VALID_NO and
+ * rebuild_stat2 should be H5S_DIMINFO_VALID_IMPOSSIBLE. */
+ if(rebuild_stat1 != H5S_DIMINFO_VALID_NO) {
+ ret = FAIL;
+ CHECK(ret,FAIL,"H5S_hyper_rebuild");
+ } /* end if */
+ if(rebuild_stat2 != H5S_DIMINFO_VALID_IMPOSSIBLE) {
ret = FAIL;
CHECK(ret,FAIL,"H5S_hyper_rebuild");
- }/* No need to do shape comparision */
+ } /* end if */
+ /* No need to do shape comparision */
/* We use 5-D to test a special case with
rebuilding routine TRUE, FALSE and TRUE */
@@ -12399,13 +12559,20 @@ test_space_rebuild(void)
ret = H5Sselect_hyperslab(sid_spec,H5S_SELECT_SET,start5,stride5,count5,block5);
CHECK(ret, FAIL, "H5Sselect_hyperslab");
- rebuild_stat = FALSE;
- rebuild_stat = H5S_get_rebuild_status_test(sid_spec);
- /* In this case, rebuild_stat should be TRUE. */
- if(!rebuild_stat){
+
+ ret = H5S__get_rebuild_status_test(sid_spec,&rebuild_stat1,&rebuild_stat2);
+ CHECK(ret, FAIL, "H5S__get_rebuild_status_test");
+ /* In this case, rebuild_stat1 and rebuild_stat2 should both be
+ * H5S_DIMINFO_VALID_YES. */
+ if(rebuild_stat1 != H5S_DIMINFO_VALID_YES) {
+ ret = FAIL;
+ CHECK(ret,FAIL,"H5S_hyper_rebuild");
+ } /* end if */
+ if(rebuild_stat2 != H5S_DIMINFO_VALID_YES) {
ret = FAIL;
CHECK(ret,FAIL,"H5S_hyper_rebuild");
- }/* No need to do shape comparision */
+ } /* end if */
+ /* No need to do shape comparision */
/* Adding some selections to make it real irregular */
start5[3] = 1;
@@ -12421,14 +12588,19 @@ test_space_rebuild(void)
ret = H5Sselect_hyperslab(sid_spec,H5S_SELECT_OR,start5,stride5,count5,block5);
CHECK(ret, FAIL, "H5Sselect_hyperslab");
- rebuild_stat = TRUE;
- rebuild_stat = H5S_get_rebuild_status_test(sid_spec);
- assert(rebuild_stat!=FAIL);
- /* In this case, rebuild_stat should be FALSE. */
- if(rebuild_stat){
+ ret = H5S__get_rebuild_status_test(sid_spec,&rebuild_stat1,&rebuild_stat2);
+ CHECK(ret, FAIL, "H5S__get_rebuild_status_test");
+ /* In this case, rebuild_stat1 should be H5S_DIMINFO_VALID_NO and
+ * rebuild_stat2 should be H5S_DIMINFO_VALID_IMPOSSIBLE. */
+ if(rebuild_stat1 != H5S_DIMINFO_VALID_NO) {
ret = FAIL;
CHECK(ret,FAIL,"H5S_hyper_rebuild");
- }/* No need to do shape comparision */
+ } /* end if */
+ if(rebuild_stat2 != H5S_DIMINFO_VALID_IMPOSSIBLE) {
+ ret = FAIL;
+ CHECK(ret,FAIL,"H5S_hyper_rebuild");
+ } /* end if */
+ /* No need to do shape comparision */
/* Add more selections to make it regular again */
start5[3] = 5;
@@ -12444,14 +12616,19 @@ test_space_rebuild(void)
ret = H5Sselect_hyperslab(sid_spec,H5S_SELECT_OR,start5,stride5,count5,block5);
CHECK(ret, FAIL, "H5Sselect_hyperslab");
- rebuild_stat = FALSE;
- rebuild_stat = H5S_get_rebuild_status_test(sid_spec);
- assert(rebuild_stat!=FAIL);
- /* In this case, rebuild_stat should be FALSE. */
- if(!rebuild_stat){
+ ret = H5S__get_rebuild_status_test(sid_spec,&rebuild_stat1,&rebuild_stat2);
+ CHECK(ret, FAIL, "H5S__get_rebuild_status_test");
+ /* In this case, rebuild_stat1 should be H5S_DIMINFO_VALID_NO and
+ * rebuild_stat2 should be H5S_DIMINFO_VALID_YES. */
+ if(rebuild_stat1 != H5S_DIMINFO_VALID_NO) {
+ ret = FAIL;
+ CHECK(ret,FAIL,"H5S_hyper_rebuild");
+ } /* end if */
+ if(rebuild_stat2 != H5S_DIMINFO_VALID_YES) {
ret = FAIL;
CHECK(ret,FAIL,"H5S_hyper_rebuild");
- }/* No need to do shape comparision */
+ } /* end if */
+ /* No need to do shape comparision */
H5Sclose(sid_reg1);
CHECK(ret, FAIL, "H5Sclose");
@@ -12485,6 +12662,791 @@ test_space_rebuild(void)
/****************************************************************
**
+** test_space_update_diminfo(): Tests selection diminfo update
+** routine. We will test whether regular selections can be
+** quickly updated when the selection is modified.
+**
+**
+****************************************************************/
+static void
+test_space_update_diminfo(void)
+{
+ hid_t space_id; /* Dataspace id */
+ H5S_diminfo_valid_t diminfo_valid; /* Diminfo status */
+ H5S_diminfo_valid_t rebuild_status; /* Diminfo status after rebuid */
+ H5S_sel_type sel_type; /* Selection type */
+ herr_t ret; /* Return value */
+
+ /* dimensions of rank 1 to rank 5 */
+ hsize_t dims1[] ={SPACEUD1_DIM0};
+ hsize_t dims3[] ={SPACEUD3_DIM0, SPACEUD3_DIM1, SPACEUD3_DIM2};
+
+ /* The start of the hyperslab */
+ hsize_t start1[1], start3[3];
+
+ /* The stride of the hyperslab */
+ hsize_t stride1[1], stride3[3];
+
+ /* The number of blocks for the hyperslab */
+ hsize_t count1[1], count3[3];
+
+ /* The size of each block for the hyperslab */
+ hsize_t block1[1], block3[3];
+
+
+ /* Output message about test being performed */
+ MESSAGE(6, ("Testing functionality to update hyperslab dimension info\n"));
+
+
+ MESSAGE(7, ("Testing functionality to update 1-D hyperslab dimension info\n"));
+
+ /*
+ * Test adding regularly spaced distinct blocks
+ */
+
+ /* Create 1-D dataspace */
+ space_id = H5Screate_simple(1, dims1, NULL);
+
+ /* Create single block */
+ start1[0] = 3;
+ count1[0] = 1;
+ block1[0] = 2;
+ ret = H5Sselect_hyperslab(space_id, H5S_SELECT_SET, start1, NULL, count1, block1);
+ CHECK(ret, FAIL, "H5Sselect_hyperslab");
+
+ /* diminfo_valid should be YES */
+ ret = H5S__get_diminfo_status_test(space_id, &diminfo_valid);
+ CHECK(ret, FAIL, "H5S__get_diminfo_status_test");
+ if(diminfo_valid != H5S_DIMINFO_VALID_YES) {
+ ret = FAIL;
+ CHECK(ret, FAIL, "H5S_hyper_update_diminfo");
+ } /* end if */
+
+ /* Add block after first, with OR */
+ start1[0] = 6;
+ count1[0] = 1;
+ block1[0] = 2;
+ ret = H5Sselect_hyperslab(space_id, H5S_SELECT_OR, start1, NULL, count1, block1);
+ CHECK(ret, FAIL, "H5Sselect_hyperslab");
+
+ /* diminfo_valid should be YES */
+ ret = H5S__get_diminfo_status_test(space_id, &diminfo_valid);
+ CHECK(ret, FAIL, "H5S__get_diminfo_status_test");
+ if(diminfo_valid != H5S_DIMINFO_VALID_YES) {
+ ret = FAIL;
+ CHECK(ret, FAIL, "H5S_hyper_update_diminfo");
+ } /* end if */
+
+ /* Add block before first, this time with XOR */
+ start1[0] = 0;
+ count1[0] = 1;
+ block1[0] = 2;
+ ret = H5Sselect_hyperslab(space_id, H5S_SELECT_XOR, start1, NULL, count1, block1);
+ CHECK(ret, FAIL, "H5Sselect_hyperslab");
+
+ /* diminfo_valid should be YES */
+ ret = H5S__get_diminfo_status_test(space_id, &diminfo_valid);
+ CHECK(ret, FAIL, "H5S__get_diminfo_status_test");
+ if(diminfo_valid != H5S_DIMINFO_VALID_YES) {
+ ret = FAIL;
+ CHECK(ret, FAIL, "H5S_hyper_update_diminfo");
+ } /* end if */
+
+ /* Add two blocks after current block */
+ start1[0] = 9;
+ stride1[0] = 3;
+ count1[0] = 2;
+ block1[0] = 2;
+ ret = H5Sselect_hyperslab(space_id, H5S_SELECT_OR, start1, stride1, count1, block1);
+ CHECK(ret, FAIL, "H5Sselect_hyperslab");
+
+ /* diminfo_valid should be YES */
+ ret = H5S__get_diminfo_status_test(space_id, &diminfo_valid);
+ CHECK(ret, FAIL, "H5S__get_diminfo_status_test");
+ if(diminfo_valid != H5S_DIMINFO_VALID_YES) {
+ ret = FAIL;
+ CHECK(ret, FAIL, "H5S_hyper_update_diminfo");
+ } /* end if */
+
+ /* Add two blocks overlapping current block, with OR */
+ start1[0] = 9;
+ stride1[0] = 3;
+ count1[0] = 2;
+ block1[0] = 2;
+ ret = H5Sselect_hyperslab(space_id, H5S_SELECT_OR, start1, stride1, count1, block1);
+ CHECK(ret, FAIL, "H5Sselect_hyperslab");
+
+ /* diminfo_valid should be YES */
+ ret = H5S__get_diminfo_status_test(space_id, &diminfo_valid);
+ CHECK(ret, FAIL, "H5S__get_diminfo_status_test");
+ if(diminfo_valid != H5S_DIMINFO_VALID_YES) {
+ ret = FAIL;
+ CHECK(ret, FAIL, "H5S_hyper_update_diminfo");
+ } /* end if */
+
+ /* Add two blocks partially overlapping current block, with OR */
+ start1[0] = 12;
+ stride1[0] = 3;
+ count1[0] = 2;
+ block1[0] = 2;
+ ret = H5Sselect_hyperslab(space_id, H5S_SELECT_OR, start1, stride1, count1, block1);
+ CHECK(ret, FAIL, "H5Sselect_hyperslab");
+
+ /* diminfo_valid should be YES */
+ ret = H5S__get_diminfo_status_test(space_id, &diminfo_valid);
+ CHECK(ret, FAIL, "H5S__get_diminfo_status_test");
+ if(diminfo_valid != H5S_DIMINFO_VALID_YES) {
+ ret = FAIL;
+ CHECK(ret, FAIL, "H5S_hyper_update_diminfo");
+ } /* end if */
+
+ /* Add two blocks partially overlapping current block, with XOR */
+ start1[0] = 15;
+ stride1[0] = 3;
+ count1[0] = 2;
+ block1[0] = 2;
+ ret = H5Sselect_hyperslab(space_id, H5S_SELECT_XOR, start1, stride1, count1, block1);
+ CHECK(ret, FAIL, "H5Sselect_hyperslab");
+
+ /* diminfo_valid should be NO, after rebuild it should be IMPOSSIBLE */
+ ret = H5S__get_rebuild_status_test(space_id, &diminfo_valid,
+ &rebuild_status);
+ CHECK(ret, FAIL, "H5S__get_diminfo_status_test");
+ if(diminfo_valid != H5S_DIMINFO_VALID_NO) {
+ ret = FAIL;
+ CHECK(ret, FAIL, "H5S_hyper_update_diminfo");
+ } /* end if */
+ if(rebuild_status != H5S_DIMINFO_VALID_IMPOSSIBLE) {
+ ret = FAIL;
+ CHECK(ret, FAIL, "H5S_hyper_rebuild");
+ } /* end if */
+
+ /* Fill in missing block */
+ start1[0] = 15;
+ count1[0] = 1;
+ block1[0] = 2;
+ ret = H5Sselect_hyperslab(space_id, H5S_SELECT_XOR, start1, NULL, count1, block1);
+ CHECK(ret, FAIL, "H5Sselect_hyperslab");
+
+ /* diminfo_valid should be NO, after rebuild it should be YES */
+ ret = H5S__get_rebuild_status_test(space_id, &diminfo_valid,
+ &rebuild_status);
+ CHECK(ret, FAIL, "H5S__get_diminfo_status_test");
+ if(diminfo_valid != H5S_DIMINFO_VALID_NO) {
+ ret = FAIL;
+ CHECK(ret, FAIL, "H5S_hyper_update_diminfo");
+ } /* end if */
+ if(rebuild_status != H5S_DIMINFO_VALID_YES) {
+ ret = FAIL;
+ CHECK(ret, FAIL, "H5S_hyper_rebuild");
+ } /* end if */
+
+ /*
+ * Test adding contiguous blocks
+ */
+
+ /* Create single block */
+ start1[0] = 3;
+ count1[0] = 1;
+ block1[0] = 2;
+ ret = H5Sselect_hyperslab(space_id, H5S_SELECT_SET, start1, NULL, count1, block1);
+ CHECK(ret, FAIL, "H5Sselect_hyperslab");
+
+ /* diminfo_valid should be YES */
+ ret = H5S__get_diminfo_status_test(space_id, &diminfo_valid);
+ CHECK(ret, FAIL, "H5S__get_diminfo_status_test");
+ if(diminfo_valid != H5S_DIMINFO_VALID_YES) {
+ ret = FAIL;
+ CHECK(ret, FAIL, "H5S_hyper_update_diminfo");
+ } /* end if */
+
+ /* Add block immediately after first, with OR */
+ start1[0] = 5;
+ count1[0] = 1;
+ block1[0] = 2;
+ ret = H5Sselect_hyperslab(space_id, H5S_SELECT_OR, start1, NULL, count1, block1);
+ CHECK(ret, FAIL, "H5Sselect_hyperslab");
+
+ /* diminfo_valid should be YES */
+ ret = H5S__get_diminfo_status_test(space_id, &diminfo_valid);
+ CHECK(ret, FAIL, "H5S__get_diminfo_status_test");
+ if(diminfo_valid != H5S_DIMINFO_VALID_YES) {
+ ret = FAIL;
+ CHECK(ret, FAIL, "H5S_hyper_update_diminfo");
+ } /* end if */
+
+ /* Add block immediately before first, with XOR */
+ start1[0] = 1;
+ count1[0] = 1;
+ block1[0] = 2;
+ ret = H5Sselect_hyperslab(space_id, H5S_SELECT_OR, start1, NULL, count1, block1);
+ CHECK(ret, FAIL, "H5Sselect_hyperslab");
+
+ /* diminfo_valid should be YES */
+ ret = H5S__get_diminfo_status_test(space_id, &diminfo_valid);
+ CHECK(ret, FAIL, "H5S__get_diminfo_status_test");
+ if(diminfo_valid != H5S_DIMINFO_VALID_YES) {
+ ret = FAIL;
+ CHECK(ret, FAIL, "H5S_hyper_update_diminfo");
+ } /* end if */
+
+ /* Add differently size block immediately after current, with OR */
+ start1[0] = 7;
+ count1[0] = 1;
+ block1[0] = 7;
+ ret = H5Sselect_hyperslab(space_id, H5S_SELECT_OR, start1, NULL, count1, block1);
+ CHECK(ret, FAIL, "H5Sselect_hyperslab");
+
+ /* diminfo_valid should be YES */
+ ret = H5S__get_diminfo_status_test(space_id, &diminfo_valid);
+ CHECK(ret, FAIL, "H5S__get_diminfo_status_test");
+ if(diminfo_valid != H5S_DIMINFO_VALID_YES) {
+ ret = FAIL;
+ CHECK(ret, FAIL, "H5S_hyper_update_diminfo");
+ } /* end if */
+
+ /*
+ * Test adding overlapping blocks
+ */
+
+ /* Create single block */
+ start1[0] = 3;
+ count1[0] = 1;
+ block1[0] = 2;
+ ret = H5Sselect_hyperslab(space_id, H5S_SELECT_SET, start1, NULL, count1, block1);
+ CHECK(ret, FAIL, "H5Sselect_hyperslab");
+
+ /* diminfo_valid should be YES */
+ ret = H5S__get_diminfo_status_test(space_id, &diminfo_valid);
+ CHECK(ret, FAIL, "H5S__get_diminfo_status_test");
+ if(diminfo_valid != H5S_DIMINFO_VALID_YES) {
+ ret = FAIL;
+ CHECK(ret, FAIL, "H5S_hyper_update_diminfo");
+ } /* end if */
+
+ /* Add block completely overlapping first, with OR */
+ start1[0] = 3;
+ count1[0] = 1;
+ block1[0] = 2;
+ ret = H5Sselect_hyperslab(space_id, H5S_SELECT_OR, start1, NULL, count1, block1);
+ CHECK(ret, FAIL, "H5Sselect_hyperslab");
+
+ /* diminfo_valid should be YES */
+ ret = H5S__get_diminfo_status_test(space_id, &diminfo_valid);
+ CHECK(ret, FAIL, "H5S__get_diminfo_status_test");
+ if(diminfo_valid != H5S_DIMINFO_VALID_YES) {
+ ret = FAIL;
+ CHECK(ret, FAIL, "H5S_hyper_update_diminfo");
+ } /* end if */
+
+ /* Add block parially overlapping first, with OR */
+ start1[0] = 4;
+ count1[0] = 1;
+ block1[0] = 2;
+ ret = H5Sselect_hyperslab(space_id, H5S_SELECT_OR, start1, NULL, count1, block1);
+ CHECK(ret, FAIL, "H5Sselect_hyperslab");
+
+ /* diminfo_valid should be YES */
+ ret = H5S__get_diminfo_status_test(space_id, &diminfo_valid);
+ CHECK(ret, FAIL, "H5S__get_diminfo_status_test");
+ if(diminfo_valid != H5S_DIMINFO_VALID_YES) {
+ ret = FAIL;
+ CHECK(ret, FAIL, "H5S_hyper_update_diminfo");
+ } /* end if */
+
+ /* Add block completely enclosing current, with OR */
+ start1[0] = 2;
+ count1[0] = 1;
+ block1[0] = 5;
+ ret = H5Sselect_hyperslab(space_id, H5S_SELECT_OR, start1, NULL, count1, block1);
+ CHECK(ret, FAIL, "H5Sselect_hyperslab");
+
+ /* diminfo_valid should be YES */
+ ret = H5S__get_diminfo_status_test(space_id, &diminfo_valid);
+ CHECK(ret, FAIL, "H5S__get_diminfo_status_test");
+ if(diminfo_valid != H5S_DIMINFO_VALID_YES) {
+ ret = FAIL;
+ CHECK(ret, FAIL, "H5S_hyper_update_diminfo");
+ } /* end if */
+
+ /* Add block completely enclosed by current, with OR */
+ start1[0] = 3;
+ count1[0] = 1;
+ block1[0] = 2;
+ ret = H5Sselect_hyperslab(space_id, H5S_SELECT_OR, start1, NULL, count1, block1);
+ CHECK(ret, FAIL, "H5Sselect_hyperslab");
+
+ /* diminfo_valid should be YES */
+ ret = H5S__get_diminfo_status_test(space_id, &diminfo_valid);
+ CHECK(ret, FAIL, "H5S__get_diminfo_status_test");
+ if(diminfo_valid != H5S_DIMINFO_VALID_YES) {
+ ret = FAIL;
+ CHECK(ret, FAIL, "H5S_hyper_update_diminfo");
+ } /* end if */
+
+ /* Add equally sized block parially overlapping current, with XOR */
+ start1[0] = 3;
+ count1[0] = 1;
+ block1[0] = 5;
+ ret = H5Sselect_hyperslab(space_id, H5S_SELECT_XOR, start1, NULL, count1, block1);
+ CHECK(ret, FAIL, "H5Sselect_hyperslab");
+
+ /* diminfo_valid should be YES */
+ ret = H5S__get_diminfo_status_test(space_id, &diminfo_valid);
+ CHECK(ret, FAIL, "H5S__get_diminfo_status_test");
+ if(diminfo_valid != H5S_DIMINFO_VALID_YES) {
+ ret = FAIL;
+ CHECK(ret, FAIL, "H5S_hyper_update_diminfo");
+ } /* end if */
+
+ /* Fill in hole in block */
+ start1[0] = 3;
+ count1[0] = 1;
+ block1[0] = 4;
+ ret = H5Sselect_hyperslab(space_id, H5S_SELECT_OR, start1, NULL, count1, block1);
+ CHECK(ret, FAIL, "H5Sselect_hyperslab");
+
+ /* diminfo_valid should be NO, after rebuild it should be YES */
+ ret = H5S__get_rebuild_status_test(space_id, &diminfo_valid,
+ &rebuild_status);
+ CHECK(ret, FAIL, "H5S__get_diminfo_status_test");
+ if(diminfo_valid != H5S_DIMINFO_VALID_NO) {
+ ret = FAIL;
+ CHECK(ret, FAIL, "H5S_hyper_update_diminfo");
+ } /* end if */
+ if(rebuild_status != H5S_DIMINFO_VALID_YES) {
+ ret = FAIL;
+ CHECK(ret, FAIL, "H5S_hyper_rebuild");
+ } /* end if */
+
+ /* Add differently sized block parially overlapping current, with XOR */
+ start1[0] = 4;
+ count1[0] = 1;
+ block1[0] = 5;
+ ret = H5Sselect_hyperslab(space_id, H5S_SELECT_XOR, start1, NULL, count1, block1);
+ CHECK(ret, FAIL, "H5Sselect_hyperslab");
+
+ /* diminfo_valid should be NO */
+ ret = H5S__get_diminfo_status_test(space_id, &diminfo_valid);
+ CHECK(ret, FAIL, "H5S__get_diminfo_status_test");
+ if(diminfo_valid != H5S_DIMINFO_VALID_NO) {
+ ret = FAIL;
+ CHECK(ret, FAIL, "H5S_hyper_update_diminfo");
+ } /* end if */
+
+ /* Fill in hole in block */
+ start1[0] = 4;
+ count1[0] = 1;
+ block1[0] = 4;
+ ret = H5Sselect_hyperslab(space_id, H5S_SELECT_OR, start1, NULL, count1, block1);
+ CHECK(ret, FAIL, "H5Sselect_hyperslab");
+
+ /* diminfo_valid should be NO, after rebuild it should be YES */
+ ret = H5S__get_rebuild_status_test(space_id, &diminfo_valid,
+ &rebuild_status);
+ CHECK(ret, FAIL, "H5S__get_rebuild_status_test");
+ if(diminfo_valid != H5S_DIMINFO_VALID_NO) {
+ ret = FAIL;
+ CHECK(ret, FAIL, "H5S_hyper_update_diminfo");
+ } /* end if */
+ if(rebuild_status != H5S_DIMINFO_VALID_YES) {
+ ret = FAIL;
+ CHECK(ret, FAIL, "H5S_hyper_rebuild");
+ } /* end if */
+
+ /* Add block completely overlapping current, with XOR */
+ start1[0] = 2;
+ count1[0] = 1;
+ block1[0] = 7;
+ ret = H5Sselect_hyperslab(space_id, H5S_SELECT_XOR, start1, NULL, count1, block1);
+ CHECK(ret, FAIL, "H5Sselect_hyperslab");
+
+ sel_type = H5Sget_select_type(space_id);
+ VERIFY(sel_type, H5S_SEL_NONE, "H5Sget_select_type");
+
+ /*
+ * Test various conditions that break the fast algorithm
+ */
+
+ /* Create multiple blocks */
+ start1[0] = 3;
+ stride1[0] = 3;
+ count1[0] = 2;
+ block1[0] = 2;
+ ret = H5Sselect_hyperslab(space_id, H5S_SELECT_SET, start1, stride1, count1, block1);
+ CHECK(ret, FAIL, "H5Sselect_hyperslab");
+
+ /* diminfo_valid should be YES */
+ ret = H5S__get_diminfo_status_test(space_id, &diminfo_valid);
+ CHECK(ret, FAIL, "H5S__get_diminfo_status_test");
+ if(diminfo_valid != H5S_DIMINFO_VALID_YES) {
+ ret = FAIL;
+ CHECK(ret, FAIL, "H5S_hyper_update_diminfo");
+ } /* end if */
+
+ /* Create single block with start out of phase */
+ start1[0] = 8;
+ count1[0] = 1;
+ block1[0] = 2;
+ ret = H5Sselect_hyperslab(space_id, H5S_SELECT_OR, start1, NULL, count1, block1);
+ CHECK(ret, FAIL, "H5Sselect_hyperslab");
+
+ /* diminfo_valid should be NO */
+ ret = H5S__get_diminfo_status_test(space_id, &diminfo_valid);
+ CHECK(ret, FAIL, "H5S__get_diminfo_status_test");
+ if(diminfo_valid != H5S_DIMINFO_VALID_NO) {
+ ret = FAIL;
+ CHECK(ret, FAIL, "H5S_hyper_update_diminfo");
+ } /* end if */
+
+ /* Create multiple blocks */
+ start1[0] = 3;
+ stride1[0] = 3;
+ count1[0] = 2;
+ block1[0] = 2;
+ ret = H5Sselect_hyperslab(space_id, H5S_SELECT_SET, start1, stride1, count1, block1);
+ CHECK(ret, FAIL, "H5Sselect_hyperslab");
+
+ /* diminfo_valid should be YES */
+ ret = H5S__get_diminfo_status_test(space_id, &diminfo_valid);
+ CHECK(ret, FAIL, "H5S__get_diminfo_status_test");
+ if(diminfo_valid != H5S_DIMINFO_VALID_YES) {
+ ret = FAIL;
+ CHECK(ret, FAIL, "H5S_hyper_update_diminfo");
+ } /* end if */
+
+ /* Create multiple blocks with start out of phase */
+ start1[0] = 8;
+ stride1[0] = 3;
+ count1[0] = 2;
+ block1[0] = 2;
+ ret = H5Sselect_hyperslab(space_id, H5S_SELECT_OR, start1, stride1, count1, block1);
+ CHECK(ret, FAIL, "H5Sselect_hyperslab");
+
+ /* diminfo_valid should be NO */
+ ret = H5S__get_diminfo_status_test(space_id, &diminfo_valid);
+ CHECK(ret, FAIL, "H5S__get_diminfo_status_test");
+ if(diminfo_valid != H5S_DIMINFO_VALID_NO) {
+ ret = FAIL;
+ CHECK(ret, FAIL, "H5S_hyper_update_diminfo");
+ } /* end if */
+
+ /* Create multiple blocks */
+ start1[0] = 3;
+ stride1[0] = 3;
+ count1[0] = 2;
+ block1[0] = 2;
+ ret = H5Sselect_hyperslab(space_id, H5S_SELECT_SET, start1, stride1, count1, block1);
+ CHECK(ret, FAIL, "H5Sselect_hyperslab");
+
+ /* diminfo_valid should be YES */
+ ret = H5S__get_diminfo_status_test(space_id, &diminfo_valid);
+ CHECK(ret, FAIL, "H5S__get_diminfo_status_test");
+ if(diminfo_valid != H5S_DIMINFO_VALID_YES) {
+ ret = FAIL;
+ CHECK(ret, FAIL, "H5S_hyper_update_diminfo");
+ } /* end if */
+
+ /* Create multiple blocks with wrong stride */
+ start1[0] = 9;
+ stride1[0] = 4;
+ count1[0] = 2;
+ block1[0] = 2;
+ ret = H5Sselect_hyperslab(space_id, H5S_SELECT_OR, start1, stride1, count1, block1);
+ CHECK(ret, FAIL, "H5Sselect_hyperslab");
+
+ /* diminfo_valid should be NO */
+ ret = H5S__get_diminfo_status_test(space_id, &diminfo_valid);
+ CHECK(ret, FAIL, "H5S__get_diminfo_status_test");
+ if(diminfo_valid != H5S_DIMINFO_VALID_NO) {
+ ret = FAIL;
+ CHECK(ret, FAIL, "H5S_hyper_update_diminfo");
+ } /* end if */
+
+ /* Create single block */
+ start1[0] = 3;
+ count1[0] = 1;
+ block1[0] = 2;
+ ret = H5Sselect_hyperslab(space_id, H5S_SELECT_SET, start1, NULL, count1, block1);
+ CHECK(ret, FAIL, "H5Sselect_hyperslab");
+
+ /* diminfo_valid should be YES */
+ ret = H5S__get_diminfo_status_test(space_id, &diminfo_valid);
+ CHECK(ret, FAIL, "H5S__get_diminfo_status_test");
+ if(diminfo_valid != H5S_DIMINFO_VALID_YES) {
+ ret = FAIL;
+ CHECK(ret, FAIL, "H5S_hyper_update_diminfo");
+ } /* end if */
+
+ /* Create single block with wrong size */
+ start1[0] = 6;
+ count1[0] = 1;
+ block1[0] = 1;
+ ret = H5Sselect_hyperslab(space_id, H5S_SELECT_OR, start1, NULL, count1, block1);
+ CHECK(ret, FAIL, "H5Sselect_hyperslab");
+
+ /* diminfo_valid should be NO */
+ ret = H5S__get_diminfo_status_test(space_id, &diminfo_valid);
+ CHECK(ret, FAIL, "H5S__get_diminfo_status_test");
+ if(diminfo_valid != H5S_DIMINFO_VALID_NO) {
+ ret = FAIL;
+ CHECK(ret, FAIL, "H5S_hyper_update_diminfo");
+ } /* end if */
+
+ /* Create single block */
+ start1[0] = 3;
+ count1[0] = 1;
+ block1[0] = 2;
+ ret = H5Sselect_hyperslab(space_id, H5S_SELECT_SET, start1, NULL, count1, block1);
+ CHECK(ret, FAIL, "H5Sselect_hyperslab");
+
+ /* diminfo_valid should be YES */
+ ret = H5S__get_diminfo_status_test(space_id, &diminfo_valid);
+ CHECK(ret, FAIL, "H5S__get_diminfo_status_test");
+ if(diminfo_valid != H5S_DIMINFO_VALID_YES) {
+ ret = FAIL;
+ CHECK(ret, FAIL, "H5S_hyper_update_diminfo");
+ } /* end if */
+
+ /* Create multiple blocks with wrong size */
+ start1[0] = 6;
+ stride1[0] = 3;
+ count1[0] = 2;
+ block1[0] = 1;
+ ret = H5Sselect_hyperslab(space_id, H5S_SELECT_OR, start1, stride1, count1, block1);
+ CHECK(ret, FAIL, "H5Sselect_hyperslab");
+
+ /* diminfo_valid should be NO */
+ ret = H5S__get_diminfo_status_test(space_id, &diminfo_valid);
+ CHECK(ret, FAIL, "H5S__get_diminfo_status_test");
+ if(diminfo_valid != H5S_DIMINFO_VALID_NO) {
+ ret = FAIL;
+ CHECK(ret, FAIL, "H5S_hyper_update_diminfo");
+ } /* end if */
+
+ /* Create multiple blocks */
+ start1[0] = 3;
+ stride1[0] = 3;
+ count1[0] = 2;
+ block1[0] = 2;
+ ret = H5Sselect_hyperslab(space_id, H5S_SELECT_SET, start1, stride1, count1, block1);
+ CHECK(ret, FAIL, "H5Sselect_hyperslab");
+
+ /* diminfo_valid should be YES */
+ ret = H5S__get_diminfo_status_test(space_id, &diminfo_valid);
+ CHECK(ret, FAIL, "H5S__get_diminfo_status_test");
+ if(diminfo_valid != H5S_DIMINFO_VALID_YES) {
+ ret = FAIL;
+ CHECK(ret, FAIL, "H5S_hyper_update_diminfo");
+ } /* end if */
+
+ /* Create single block with wrong size */
+ start1[0] = 9;
+ count1[0] = 1;
+ block1[0] = 1;
+ ret = H5Sselect_hyperslab(space_id, H5S_SELECT_OR, start1, NULL, count1, block1);
+ CHECK(ret, FAIL, "H5Sselect_hyperslab");
+
+ /* diminfo_valid should be NO */
+ ret = H5S__get_diminfo_status_test(space_id, &diminfo_valid);
+ CHECK(ret, FAIL, "H5S__get_diminfo_status_test");
+ if(diminfo_valid != H5S_DIMINFO_VALID_NO) {
+ ret = FAIL;
+ CHECK(ret, FAIL, "H5S_hyper_update_diminfo");
+ } /* end if */
+
+ /* Create multiple blocks */
+ start1[0] = 3;
+ stride1[0] = 3;
+ count1[0] = 2;
+ block1[0] = 2;
+ ret = H5Sselect_hyperslab(space_id, H5S_SELECT_SET, start1, stride1, count1, block1);
+ CHECK(ret, FAIL, "H5Sselect_hyperslab");
+
+ /* diminfo_valid should be YES */
+ ret = H5S__get_diminfo_status_test(space_id, &diminfo_valid);
+ CHECK(ret, FAIL, "H5S__get_diminfo_status_test");
+ if(diminfo_valid != H5S_DIMINFO_VALID_YES) {
+ ret = FAIL;
+ CHECK(ret, FAIL, "H5S_hyper_update_diminfo");
+ } /* end if */
+
+ /* Create multiple blocks with wrong size */
+ start1[0] = 9;
+ stride1[0] = 3;
+ count1[0] = 2;
+ block1[0] = 1;
+ ret = H5Sselect_hyperslab(space_id, H5S_SELECT_OR, start1, stride1, count1, block1);
+ CHECK(ret, FAIL, "H5Sselect_hyperslab");
+
+ /* diminfo_valid should be NO */
+ ret = H5S__get_diminfo_status_test(space_id, &diminfo_valid);
+ CHECK(ret, FAIL, "H5S__get_diminfo_status_test");
+ if(diminfo_valid != H5S_DIMINFO_VALID_NO) {
+ ret = FAIL;
+ CHECK(ret, FAIL, "H5S_hyper_update_diminfo");
+ } /* end if */
+
+ ret = H5Sclose(space_id);
+ CHECK(ret, FAIL, "H5Sclose");
+
+
+ MESSAGE(7, ("Testing functionality to update 3-D hyperslab dimension info\n"));
+
+ /* Create 3-D dataspace */
+ space_id = H5Screate_simple(3, dims3, NULL);
+
+ /* Create multiple blocks */
+ start3[0] = 0;
+ start3[1] = 1;
+ start3[2] = 2;
+ stride3[0] = 2;
+ stride3[1] = 3;
+ stride3[2] = 4;
+ count3[0] = 4;
+ count3[1] = 3;
+ count3[2] = 2;
+ block3[0] = 1;
+ block3[1] = 2;
+ block3[2] = 3;
+ ret = H5Sselect_hyperslab(space_id, H5S_SELECT_SET, start3, stride3, count3, block3);
+ CHECK(ret, FAIL, "H5Sselect_hyperslab");
+
+ /* diminfo_valid should be YES */
+ ret = H5S__get_diminfo_status_test(space_id, &diminfo_valid);
+ CHECK(ret, FAIL, "H5S__get_diminfo_status_test");
+ if(diminfo_valid != H5S_DIMINFO_VALID_YES) {
+ ret = FAIL;
+ CHECK(ret, FAIL, "H5S_hyper_update_diminfo");
+ } /* end if */
+
+ /* Add blocks with same values in all dimensions */
+ ret = H5Sselect_hyperslab(space_id, H5S_SELECT_OR, start3, stride3, count3, block3);
+ CHECK(ret, FAIL, "H5Sselect_hyperslab");
+
+ /* diminfo_valid should be YES */
+ ret = H5S__get_diminfo_status_test(space_id, &diminfo_valid);
+ CHECK(ret, FAIL, "H5S__get_diminfo_status_test");
+ if(diminfo_valid != H5S_DIMINFO_VALID_YES) {
+ ret = FAIL;
+ CHECK(ret, FAIL, "H5S_hyper_update_diminfo");
+ } /* end if */
+
+ /* Add blocks with same values in two dimensions */
+ start3[0] = 8;
+ stride3[0] = 1;
+ count3[0] = 1;
+ block3[0] = 1;
+ ret = H5Sselect_hyperslab(space_id, H5S_SELECT_OR, start3, stride3, count3, block3);
+ CHECK(ret, FAIL, "H5Sselect_hyperslab");
+
+ /* diminfo_valid should be YES */
+ ret = H5S__get_diminfo_status_test(space_id, &diminfo_valid);
+ CHECK(ret, FAIL, "H5S__get_diminfo_status_test");
+ if(diminfo_valid != H5S_DIMINFO_VALID_YES) {
+ ret = FAIL;
+ CHECK(ret, FAIL, "H5S_hyper_update_diminfo");
+ } /* end if */
+
+ /* Create multiple blocks */
+ start3[0] = 0;
+ start3[1] = 1;
+ start3[2] = 2;
+ stride3[0] = 2;
+ stride3[1] = 3;
+ stride3[2] = 4;
+ count3[0] = 4;
+ count3[1] = 3;
+ count3[2] = 2;
+ block3[0] = 1;
+ block3[1] = 2;
+ block3[2] = 3;
+ ret = H5Sselect_hyperslab(space_id, H5S_SELECT_SET, start3, stride3, count3, block3);
+ CHECK(ret, FAIL, "H5Sselect_hyperslab");
+
+ /* diminfo_valid should be YES */
+ ret = H5S__get_diminfo_status_test(space_id, &diminfo_valid);
+ CHECK(ret, FAIL, "H5S__get_diminfo_status_test");
+ if(diminfo_valid != H5S_DIMINFO_VALID_YES) {
+ ret = FAIL;
+ CHECK(ret, FAIL, "H5S_hyper_update_diminfo");
+ } /* end if */
+
+ /* Add blocks with same values in one dimension */
+ start3[0] = 8;
+ start3[1] = 10;
+ stride3[0] = 1;
+ stride3[1] = 1;
+ count3[0] = 1;
+ count3[1] = 1;
+ block3[0] = 1;
+ block3[1] = 2;
+ ret = H5Sselect_hyperslab(space_id, H5S_SELECT_OR, start3, stride3, count3, block3);
+ CHECK(ret, FAIL, "H5Sselect_hyperslab");
+
+ /* diminfo_valid should be NO */
+ ret = H5S__get_diminfo_status_test(space_id, &diminfo_valid);
+ CHECK(ret, FAIL, "H5S__get_diminfo_status_test");
+ if(diminfo_valid != H5S_DIMINFO_VALID_NO) {
+ ret = FAIL;
+ CHECK(ret, FAIL, "H5S_hyper_update_diminfo");
+ } /* end if */
+
+ /* Create multiple blocks */
+ start3[0] = 0;
+ start3[1] = 1;
+ start3[2] = 2;
+ stride3[0] = 2;
+ stride3[1] = 3;
+ stride3[2] = 4;
+ count3[0] = 4;
+ count3[1] = 3;
+ count3[2] = 2;
+ block3[0] = 1;
+ block3[1] = 2;
+ block3[2] = 3;
+ ret = H5Sselect_hyperslab(space_id, H5S_SELECT_SET, start3, stride3, count3, block3);
+ CHECK(ret, FAIL, "H5Sselect_hyperslab");
+
+ /* diminfo_valid should be YES */
+ ret = H5S__get_diminfo_status_test(space_id, &diminfo_valid);
+ CHECK(ret, FAIL, "H5S__get_diminfo_status_test");
+ if(diminfo_valid != H5S_DIMINFO_VALID_YES) {
+ ret = FAIL;
+ CHECK(ret, FAIL, "H5S_hyper_update_diminfo");
+ } /* end if */
+
+ /* Add blocks with same values in no dimensions */
+ start3[0] = 8;
+ start3[1] = 10;
+ start3[2] = 10;
+ stride3[0] = 1;
+ stride3[1] = 1;
+ stride3[2] = 1;
+ count3[0] = 1;
+ count3[1] = 1;
+ count3[2] = 1;
+ block3[0] = 1;
+ block3[1] = 2;
+ block3[2] = 3;
+ ret = H5Sselect_hyperslab(space_id, H5S_SELECT_OR, start3, stride3, count3, block3);
+ CHECK(ret, FAIL, "H5Sselect_hyperslab");
+
+ /* diminfo_valid should be NO */
+ ret = H5S__get_diminfo_status_test(space_id, &diminfo_valid);
+ CHECK(ret, FAIL, "H5S__get_diminfo_status_test");
+ if(diminfo_valid != H5S_DIMINFO_VALID_NO) {
+ ret = FAIL;
+ CHECK(ret, FAIL, "H5S_hyper_update_diminfo");
+ } /* end if */
+
+ ret = H5Sclose(space_id);
+ CHECK(ret, FAIL, "H5Sclose");
+} /* end test_space_update_diminfo() */
+
+
+/****************************************************************
+**
** test_select_hyper_chunk_offset(): Tests selections on dataspace,
** verify that offsets for hyperslab selections are working in
** chunked datasets.
@@ -12861,9 +13823,9 @@ test_select_bounds(void)
/* Get bounds for 'none' selection */
H5E_BEGIN_TRY {
ret = H5Sget_select_bounds(sid, low_bounds, high_bounds);
- } H5E_END_TRY;
- VERIFY(ret, FAIL, "H5Sget_select_bo unds");
-
+ } H5E_END_TRY;
+ VERIFY(ret, FAIL, "H5Sget_select_bo unds");
+
/* Set point selection */
coord[0][0] = 3; coord[0][1] = 3;
coord[1][0] = 3; coord[1][1] = 96;
@@ -13040,14 +14002,14 @@ test_hyper_regular(void)
/* Query if 'all' selection is regular hyperslab (should fail) */
H5E_BEGIN_TRY {
is_regular = H5Sis_regular_hyperslab(sid);
- } H5E_END_TRY;
- VERIFY(is_regular, FAIL, "H5Sis_regular_hyperslab");
+ } H5E_END_TRY;
+ VERIFY(is_regular, FAIL, "H5Sis_regular_hyperslab");
/* Query regular hyperslab selection info (should fail) */
H5E_BEGIN_TRY {
ret = H5Sget_regular_hyperslab(sid, q_start, q_stride, q_count, q_block);
- } H5E_END_TRY;
- VERIFY(ret, FAIL, "H5Sget_regular_hyperslab");
+ } H5E_END_TRY;
+ VERIFY(ret, FAIL, "H5Sget_regular_hyperslab");
/* Set 'none' selection */
ret = H5Sselect_none(sid);
@@ -13056,14 +14018,14 @@ test_hyper_regular(void)
/* Query if 'none' selection is regular hyperslab (should fail) */
H5E_BEGIN_TRY {
is_regular = H5Sis_regular_hyperslab(sid);
- } H5E_END_TRY;
- VERIFY(is_regular, FAIL, "H5Sis_regular_hyperslab");
+ } H5E_END_TRY;
+ VERIFY(is_regular, FAIL, "H5Sis_regular_hyperslab");
/* Query regular hyperslab selection info (should fail) */
H5E_BEGIN_TRY {
ret = H5Sget_regular_hyperslab(sid, q_start, q_stride, q_count, q_block);
- } H5E_END_TRY;
- VERIFY(ret, FAIL, "H5Sget_regular_hyperslab");
+ } H5E_END_TRY;
+ VERIFY(ret, FAIL, "H5Sget_regular_hyperslab");
/* Set point selection */
coord[0][0] = 3; coord[0][1] = 3; coord[0][2] = 3;
@@ -13076,14 +14038,14 @@ test_hyper_regular(void)
/* Query if 'point' selection is regular hyperslab (should fail) */
H5E_BEGIN_TRY {
is_regular = H5Sis_regular_hyperslab(sid);
- } H5E_END_TRY;
- VERIFY(is_regular, FAIL, "H5Sis_regular_hyperslab");
+ } H5E_END_TRY;
+ VERIFY(is_regular, FAIL, "H5Sis_regular_hyperslab");
/* Query regular hyperslab selection info (should fail) */
H5E_BEGIN_TRY {
ret = H5Sget_regular_hyperslab(sid, q_start, q_stride, q_count, q_block);
- } H5E_END_TRY;
- VERIFY(ret, FAIL, "H5Sget_regular_hyperslab");
+ } H5E_END_TRY;
+ VERIFY(ret, FAIL, "H5Sget_regular_hyperslab");
/* Set "regular" hyperslab selection */
start[0] = 2; start[1] = 2; start[2] = 2;
@@ -13095,7 +14057,7 @@ test_hyper_regular(void)
/* Query if 'hyperslab' selection is regular hyperslab (should be TRUE) */
is_regular = H5Sis_regular_hyperslab(sid);
- VERIFY(is_regular, TRUE, "H5Sis_regular_hyperslab");
+ VERIFY(is_regular, TRUE, "H5Sis_regular_hyperslab");
/* Retrieve the hyperslab parameters */
ret = H5Sget_regular_hyperslab(sid, q_start, q_stride, q_count, q_block);
@@ -13121,13 +14083,13 @@ test_hyper_regular(void)
/* Query if 'hyperslab' selection is regular hyperslab (should be FALSE) */
is_regular = H5Sis_regular_hyperslab(sid);
- VERIFY(is_regular, FALSE, "H5Sis_regular_hyperslab");
+ VERIFY(is_regular, FALSE, "H5Sis_regular_hyperslab");
/* Query regular hyperslab selection info (should fail) */
H5E_BEGIN_TRY {
ret = H5Sget_regular_hyperslab(sid, q_start, q_stride, q_count, q_block);
- } H5E_END_TRY;
- VERIFY(ret, FAIL, "H5Sget_regular_hyperslab");
+ } H5E_END_TRY;
+ VERIFY(ret, FAIL, "H5Sget_regular_hyperslab");
/* 'XOR' in the point again, to remove it, which should make it regular again */
t_start[0] = 0; t_start[1] = 0; t_start[2] = 0;
@@ -13137,7 +14099,7 @@ test_hyper_regular(void)
/* Query if 'hyperslab' selection is regular hyperslab (should be TRUE) */
is_regular = H5Sis_regular_hyperslab(sid);
- VERIFY(is_regular, TRUE, "H5Sis_regular_hyperslab");
+ VERIFY(is_regular, TRUE, "H5Sis_regular_hyperslab");
/* Retrieve the hyperslab parameters */
ret = H5Sget_regular_hyperslab(sid, q_start, q_stride, q_count, q_block);
@@ -13595,6 +14557,642 @@ test_hyper_unlim(void)
/****************************************************************
**
+** test_internal_consistency(): Tests selections on dataspace, then
+** verify that internal states of data structures of selections are
+** consistent.
+**
+****************************************************************/
+static void
+test_internal_consistency(void)
+{
+ hid_t all_sid; /* Dataspace ID with "all" selection */
+ hid_t none_sid; /* Dataspace ID with "none" selection */
+ hid_t single_pt_sid; /* Dataspace ID with single point selection */
+ hid_t mult_pt_sid; /* Dataspace ID with multiple point selection */
+ hid_t single_hyper_sid; /* Dataspace ID with single block hyperslab selection */
+ hid_t single_hyper_all_sid; /* Dataspace ID with single block hyperslab
+ * selection that is the entire dataspace
+ */
+ hid_t single_hyper_pt_sid; /* Dataspace ID with single block hyperslab
+ * selection that is the same as the single
+ * point selection
+ */
+ hid_t regular_hyper_sid; /* Dataspace ID with regular hyperslab selection */
+ hid_t irreg_hyper_sid; /* Dataspace ID with irregular hyperslab selection */
+ hid_t none_hyper_sid; /* Dataspace ID with "no hyperslabs" selection */
+ hid_t scalar_all_sid; /* ID for scalar dataspace with "all" selection */
+ hid_t scalar_none_sid; /* ID for scalar dataspace with "none" selection */
+ hid_t tmp_sid; /* Temporary dataspace ID */
+ hsize_t dims[] = {SPACE9_DIM1, SPACE9_DIM2};
+ hsize_t coord1[1][SPACE2_RANK]; /* Coordinates for single point selection */
+ hsize_t coord2[SPACE9_DIM2][SPACE9_RANK]; /* Coordinates for multiple point selection */
+ hsize_t start[SPACE9_RANK]; /* Hyperslab start */
+ hsize_t stride[SPACE9_RANK]; /* Hyperslab stride */
+ hsize_t count[SPACE9_RANK]; /* Hyperslab block count */
+ hsize_t block[SPACE9_RANK]; /* Hyperslab block size */
+ htri_t check; /* Shape comparison return value */
+ herr_t ret; /* Generic return value */
+
+ /* Output message about test being performed */
+ MESSAGE(6, ("Testing Consistency of Internal States\n"));
+ assert(SPACE9_DIM2>=POINT1_NPOINTS);
+
+ /* Create dataspace for "all" selection */
+ all_sid = H5Screate_simple(SPACE9_RANK, dims, NULL);
+ CHECK(all_sid, FAIL, "H5Screate_simple");
+
+ /* Select entire extent for dataspace */
+ ret = H5Sselect_all(all_sid);
+ CHECK(ret, FAIL, "H5Sselect_all");
+
+ /* Create dataspace for "none" selection */
+ none_sid = H5Screate_simple(SPACE9_RANK, dims, NULL);
+ CHECK(none_sid, FAIL, "H5Screate_simple");
+
+ /* Un-Select entire extent for dataspace */
+ ret = H5Sselect_none(none_sid);
+ CHECK(ret, FAIL, "H5Sselect_none");
+
+ /* Create dataspace for single point selection */
+ single_pt_sid = H5Screate_simple(SPACE9_RANK, dims, NULL);
+ CHECK(single_pt_sid, FAIL, "H5Screate_simple");
+
+ /* Select sequence of ten points for multiple point selection */
+ coord1[0][0] = 2; coord1[0][1] = 2;
+ ret = H5Sselect_elements(single_pt_sid, H5S_SELECT_SET, (size_t)1, (const hsize_t *)coord1);
+ CHECK(ret, FAIL, "H5Sselect_elements");
+
+ /* Create dataspace for multiple point selection */
+ mult_pt_sid = H5Screate_simple(SPACE9_RANK, dims, NULL);
+ CHECK(mult_pt_sid, FAIL, "H5Screate_simple");
+
+ /* Select sequence of ten points for multiple point selection */
+ coord2[0][0]=2; coord2[0][1]=2;
+ coord2[1][0]=7; coord2[1][1]=2;
+ coord2[2][0]=1; coord2[2][1]=4;
+ coord2[3][0]=2; coord2[3][1]=6;
+ coord2[4][0]=0; coord2[4][1]=8;
+ coord2[5][0]=3; coord2[5][1]=2;
+ coord2[6][0]=4; coord2[6][1]=4;
+ coord2[7][0]=1; coord2[7][1]=0;
+ coord2[8][0]=5; coord2[8][1]=1;
+ coord2[9][0]=9; coord2[9][1]=3;
+ ret = H5Sselect_elements(mult_pt_sid, H5S_SELECT_SET, (size_t)POINT1_NPOINTS, (const hsize_t *)coord2);
+ CHECK(ret, FAIL, "H5Sselect_elements");
+
+ /* Create dataspace for single hyperslab selection */
+ single_hyper_sid = H5Screate_simple(SPACE9_RANK, dims, NULL);
+ CHECK(single_hyper_sid, FAIL, "H5Screate_simple");
+
+ /* Select 10x10 hyperslab for single hyperslab selection */
+ start[0]=1; start[1]=1;
+ stride[0]=1; stride[1]=1;
+ count[0]=1; count[1]=1;
+ block[0]=(SPACE9_DIM1-2); block[1]=(SPACE9_DIM2-2);
+ ret = H5Sselect_hyperslab(single_hyper_sid,H5S_SELECT_SET,start,stride,count,block);
+ CHECK(ret, FAIL, "H5Sselect_hyperslab");
+
+ /* Create dataspace for single hyperslab selection with entire extent selected */
+ single_hyper_all_sid = H5Screate_simple(SPACE9_RANK, dims, NULL);
+ CHECK(single_hyper_all_sid, FAIL, "H5Screate_simple");
+
+ /* Select entire extent for hyperslab selection */
+ start[0]=0; start[1]=0;
+ stride[0]=1; stride[1]=1;
+ count[0]=1; count[1]=1;
+ block[0]=SPACE9_DIM1; block[1]=SPACE9_DIM2;
+ ret = H5Sselect_hyperslab(single_hyper_all_sid,H5S_SELECT_SET,start,stride,count,block);
+ CHECK(ret, FAIL, "H5Sselect_hyperslab");
+
+ /* Create dataspace for single hyperslab selection with single point selected */
+ single_hyper_pt_sid = H5Screate_simple(SPACE9_RANK, dims, NULL);
+ CHECK(single_hyper_pt_sid, FAIL, "H5Screate_simple");
+
+ /* Select entire extent for hyperslab selection */
+ start[0]=2; start[1]=2;
+ stride[0]=1; stride[1]=1;
+ count[0]=1; count[1]=1;
+ block[0]=1; block[1]=1;
+ ret = H5Sselect_hyperslab(single_hyper_pt_sid,H5S_SELECT_SET,start,stride,count,block);
+ CHECK(ret, FAIL, "H5Sselect_hyperslab");
+
+ /* Create dataspace for regular hyperslab selection */
+ regular_hyper_sid = H5Screate_simple(SPACE9_RANK, dims, NULL);
+ CHECK(regular_hyper_sid, FAIL, "H5Screate_simple");
+
+ /* Select regular, strided hyperslab selection */
+ start[0]=2; start[1]=2;
+ stride[0]=2; stride[1]=2;
+ count[0]=5; count[1]=2;
+ block[0]=1; block[1]=1;
+ ret = H5Sselect_hyperslab(regular_hyper_sid,H5S_SELECT_SET,start,stride,count,block);
+ CHECK(ret, FAIL, "H5Sselect_hyperslab");
+
+ /* Create dataspace for irregular hyperslab selection */
+ irreg_hyper_sid = H5Screate_simple(SPACE9_RANK, dims, NULL);
+ CHECK(irreg_hyper_sid, FAIL, "H5Screate_simple");
+
+ /* Create irregular hyperslab selection by OR'ing two blocks together */
+ start[0]=2; start[1]=2;
+ stride[0]=1; stride[1]=1;
+ count[0]=1; count[1]=1;
+ block[0]=1; block[1]=1;
+ ret = H5Sselect_hyperslab(irreg_hyper_sid,H5S_SELECT_SET,start,stride,count,block);
+ CHECK(ret, FAIL, "H5Sselect_hyperslab");
+
+ start[0]=4; start[1]=4;
+ stride[0]=1; stride[1]=1;
+ count[0]=1; count[1]=1;
+ block[0]=3; block[1]=3;
+ ret = H5Sselect_hyperslab(irreg_hyper_sid,H5S_SELECT_OR,start,stride,count,block);
+ CHECK(ret, FAIL, "H5Sselect_hyperslab");
+
+ /* Create dataspace for "no" hyperslab selection */
+ none_hyper_sid = H5Screate_simple(SPACE9_RANK, dims, NULL);
+ CHECK(none_hyper_sid, FAIL, "H5Screate_simple");
+
+ /* Create "no" hyperslab selection by XOR'ing same blocks together */
+ start[0]=2; start[1]=2;
+ stride[0]=1; stride[1]=1;
+ count[0]=1; count[1]=1;
+ block[0]=1; block[1]=1;
+ ret = H5Sselect_hyperslab(none_hyper_sid,H5S_SELECT_SET,start,stride,count,block);
+ CHECK(ret, FAIL, "H5Sselect_hyperslab");
+
+ ret = H5Sselect_hyperslab(none_hyper_sid,H5S_SELECT_XOR,start,stride,count,block);
+ CHECK(ret, FAIL, "H5Sselect_hyperslab");
+
+ /* Create scalar dataspace for "all" selection */
+ scalar_all_sid = H5Screate(H5S_SCALAR);
+ CHECK(scalar_all_sid, FAIL, "H5Screate");
+
+ /* Create scalar dataspace for "none" selection */
+ scalar_none_sid = H5Screate(H5S_SCALAR);
+ CHECK(scalar_none_sid, FAIL, "H5Screate");
+
+ /* Un-Select entire extent for dataspace */
+ ret = H5Sselect_none(scalar_none_sid);
+ CHECK(ret, FAIL, "H5Sselect_none");
+
+ /* Test all the selections created */
+
+ /* Test the copy of itself */
+ tmp_sid=H5Scopy(all_sid);
+ CHECK(tmp_sid, FAIL, "H5Scopy");
+
+ check = H5S__internal_consistency_test(tmp_sid);
+ VERIFY(check, TRUE, "H5S__internal_consistency_test");
+
+ ret = H5Sclose(tmp_sid);
+ CHECK(ret, FAIL, "H5Sclose");
+
+ /* Test "none" selection */
+ check = H5S__internal_consistency_test(none_sid);
+ VERIFY(check, TRUE, "H5S__internal_consistency_test");
+
+ /* Test single point selection */
+ check = H5S__internal_consistency_test(single_pt_sid);
+ VERIFY(check, TRUE, "H5S__internal_consistency_test");
+
+ /* Test multiple point selection */
+ check = H5S__internal_consistency_test(mult_pt_sid);
+ VERIFY(check, TRUE, "H5S__internal_consistency_test");
+
+ /* Test "plain" single hyperslab selection */
+ check = H5S__internal_consistency_test(single_hyper_sid);
+ VERIFY(check, TRUE, "H5S__internal_consistency_test");
+
+ /* Test "all" single hyperslab selection */
+ check = H5S__internal_consistency_test(single_hyper_all_sid);
+ VERIFY(check, TRUE, "H5S__internal_consistency_test");
+
+ /* Test "single point" single hyperslab selection */
+ check = H5S__internal_consistency_test(single_hyper_pt_sid);
+ VERIFY(check, TRUE, "H5S__internal_consistency_test");
+
+ /* Test regular, strided hyperslab selection */
+ check = H5S__internal_consistency_test(regular_hyper_sid);
+ VERIFY(check, TRUE, "H5S__internal_consistency_test");
+
+ /* Test irregular hyperslab selection */
+ check = H5S__internal_consistency_test(irreg_hyper_sid);
+ VERIFY(check, TRUE, "H5S__internal_consistency_test");
+
+ /* Test "no" hyperslab selection */
+ check = H5S__internal_consistency_test(none_hyper_sid);
+ VERIFY(check, TRUE, "H5S__internal_consistency_test");
+
+ /* Test scalar "all" hyperslab selection */
+ check = H5S__internal_consistency_test(scalar_all_sid);
+ VERIFY(check, TRUE, "H5S__internal_consistency_test");
+
+ /* Test scalar "none" hyperslab selection */
+ check = H5S__internal_consistency_test(scalar_none_sid);
+ VERIFY(check, TRUE, "H5S__internal_consistency_test");
+
+ /* Close dataspaces */
+ ret = H5Sclose(all_sid);
+ CHECK(ret, FAIL, "H5Sclose");
+ ret = H5Sclose(none_sid);
+ CHECK(ret, FAIL, "H5Sclose");
+ ret = H5Sclose(single_pt_sid);
+ CHECK(ret, FAIL, "H5Sclose");
+ ret = H5Sclose(mult_pt_sid);
+ CHECK(ret, FAIL, "H5Sclose");
+ ret = H5Sclose(single_hyper_sid);
+ CHECK(ret, FAIL, "H5Sclose");
+ ret = H5Sclose(single_hyper_all_sid);
+ CHECK(ret, FAIL, "H5Sclose");
+ ret = H5Sclose(single_hyper_pt_sid);
+ CHECK(ret, FAIL, "H5Sclose");
+ ret = H5Sclose(regular_hyper_sid);
+ CHECK(ret, FAIL, "H5Sclose");
+ ret = H5Sclose(irreg_hyper_sid);
+ CHECK(ret, FAIL, "H5Sclose");
+ ret = H5Sclose(none_hyper_sid);
+ CHECK(ret, FAIL, "H5Sclose");
+ ret = H5Sclose(scalar_all_sid);
+ CHECK(ret, FAIL, "H5Sclose");
+ ret = H5Sclose(scalar_none_sid);
+ CHECK(ret, FAIL, "H5Sclose");
+} /* test_internal_consistency() */
+
+/****************************************************************
+**
+** test_irreg_io(): Tests unusual selections on datasets, to stress the
+** new hyperslab code.
+**
+****************************************************************/
+static void
+test_irreg_io(void)
+{
+ hid_t fid; /* File ID */
+ hid_t did; /* Dataset ID */
+ hid_t dcpl_id; /* Dataset creation property list ID */
+ hid_t sid; /* File dataspace ID */
+ hid_t mem_sid; /* Memory dataspace ID */
+ hsize_t dims[] = {6, 12}; /* Dataspace dimensions */
+ hsize_t chunk_dims[] = {2, 2}; /* Chunk dimensions */
+ hsize_t mem_dims[] = {32}; /* Memory dataspace dimensions */
+ hsize_t start[2]; /* Hyperslab start */
+ hsize_t stride[2]; /* Hyperslab stride */
+ hsize_t count[2]; /* Hyperslab block count */
+ hsize_t block[2]; /* Hyperslab block size */
+ unsigned char wbuf[72]; /* Write buffer */
+ unsigned char rbuf[32]; /* Read buffer */
+ unsigned u; /* Local index variable */
+ herr_t ret; /* Generic return value */
+
+ /* Output message about test being performed */
+ MESSAGE(6, ("Testing Irregular Hyperslab I/O\n"));
+
+ /* Create file */
+ fid = H5Fcreate(FILENAME, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
+ CHECK(fid, FAIL, "H5Fcreate");
+
+ /* Create dataspace for dataset */
+ sid = H5Screate_simple(2, dims, NULL);
+ CHECK(sid, FAIL, "H5Screate_simple");
+
+ /* Set chunk dimensions for dataset */
+ dcpl_id = H5Pcreate(H5P_DATASET_CREATE);
+ CHECK(dcpl_id, FAIL, "H5Pcreate");
+ ret = H5Pset_chunk(dcpl_id, 2, chunk_dims);
+ CHECK(ret, FAIL, "H5Pset_chunk");
+
+ /* Create a dataset */
+ did = H5Dcreate2(fid, SPACE1_NAME, H5T_NATIVE_UCHAR, sid, H5P_DEFAULT, dcpl_id, H5P_DEFAULT);
+ CHECK(did, FAIL, "H5Dcreate2");
+
+ /* Initialize the write buffer */
+ for(u = 0; u < 72; u++)
+ wbuf[u] = (unsigned char)u;
+
+ /* Write entire dataset to disk */
+ ret = H5Dwrite(did, H5T_NATIVE_UCHAR, H5S_ALL, H5S_ALL, H5P_DEFAULT, wbuf);
+ CHECK(ret, FAIL, "H5Dwrite");
+
+ /* Close the DCPL */
+ ret = H5Pclose(dcpl_id);
+ CHECK(ret, FAIL, "H5Pclose");
+
+ /* Create dataspace for memory selection */
+ mem_sid = H5Screate_simple(1, mem_dims, NULL);
+ CHECK(mem_sid, FAIL, "H5Screate_simple");
+
+ /* Select 'L'-shaped region within dataset */
+ start[0] = 0; start[1] = 10;
+ stride[0] = 1; stride[1] = 1;
+ count[0] = 4; count[1] = 2;
+ block[0] = 1; block[1] = 1;
+ ret = H5Sselect_hyperslab(sid, H5S_SELECT_SET, start, stride, count, block);
+ CHECK(ret, FAIL, "H5Sselect_hyperslab");
+
+ start[0] = 4; start[1] = 0;
+ stride[0] = 1; stride[1] = 1;
+ count[0] = 2; count[1] = 12;
+ block[0] = 1; block[1] = 1;
+ ret = H5Sselect_hyperslab(sid, H5S_SELECT_OR, start, stride, count, block);
+ CHECK(ret, FAIL, "H5Sselect_hyperslab");
+
+ /* Reset the buffer */
+ HDmemset(rbuf, 0, sizeof(rbuf));
+
+ /* Read selection from disk */
+ ret = H5Dread(did, H5T_NATIVE_UCHAR, mem_sid, sid, H5P_DEFAULT, rbuf);
+ CHECK(ret, FAIL, "H5Dread");
+
+
+ /* Close everything */
+ ret = H5Sclose(mem_sid);
+ CHECK(ret, FAIL, "H5Sclose");
+ ret = H5Sclose(sid);
+ CHECK(ret, FAIL, "H5Sclose");
+ ret = H5Dclose(did);
+ CHECK(ret, FAIL, "H5Dclose");
+ ret = H5Fclose(fid);
+ CHECK(ret, FAIL, "H5Fclose");
+} /* test_irreg_io() */
+
+/****************************************************************
+**
+** test_sel_iter(): Test selection iterator API routines.
+**
+****************************************************************/
+static void
+test_sel_iter(void)
+{
+ hid_t sid; /* Dataspace ID */
+ hid_t iter_id; /* Dataspace selection iterator ID */
+ hsize_t dims1[] = {6, 12}; /* 2-D Dataspace dimensions */
+ hsize_t dims2[] = {32}; /* 1-D dataspace dimensions */
+ hsize_t coord1[POINT1_NPOINTS][2]; /* Coordinates for point selection */
+ hsize_t start[2]; /* Hyperslab start */
+ hsize_t stride[2]; /* Hyperslab stride */
+ hsize_t count[2]; /* Hyperslab block count */
+ hsize_t block[2]; /* Hyperslab block size */
+ size_t nseq; /* # of sequences retrieved */
+ size_t nbytes; /* # of bytes retrieved */
+ hsize_t off[SEL_ITER_MAX_SEQ]; /* Offsets for retrieved sequences */
+ size_t len[SEL_ITER_MAX_SEQ]; /* Lengths for retrieved sequences */
+ H5S_sel_type sel_type; /* Selection type */
+ unsigned sel_share; /* Whether to share selection with dataspace */
+ unsigned sel_iter_flags; /* Flags for selection iterator creation */
+ herr_t ret; /* Generic return value */
+
+ /* Output message about test being performed */
+ MESSAGE(6, ("Testing Dataspace Selection Iterators\n"));
+
+ /* Create dataspace */
+ sid = H5Screate_simple(2, dims1, NULL);
+ CHECK(sid, FAIL, "H5Screate_simple");
+
+
+ /* Try creating selection iterator object with bad parameters */
+ H5E_BEGIN_TRY { /* Bad dataspace ID */
+ iter_id = H5Ssel_iter_create(H5I_INVALID_HID, (size_t)1, (unsigned)0);
+ } H5E_END_TRY;
+ VERIFY(iter_id, FAIL, "H5Ssel_iter_create");
+ H5E_BEGIN_TRY { /* Bad element size */
+ iter_id = H5Ssel_iter_create(sid, (size_t)0, (unsigned)0);
+ } H5E_END_TRY;
+ VERIFY(iter_id, FAIL, "H5Ssel_iter_create");
+ H5E_BEGIN_TRY { /* Bad flag(s) */
+ iter_id = H5Ssel_iter_create(sid, (size_t)1, (unsigned)0xffff);
+ } H5E_END_TRY;
+ VERIFY(iter_id, FAIL, "H5Ssel_iter_create");
+
+ /* Try closing selection iterator, with bad parameters */
+ H5E_BEGIN_TRY { /* Invalid ID */
+ ret = H5Ssel_iter_close(H5I_INVALID_HID);
+ } H5E_END_TRY;
+ VERIFY(ret, FAIL, "H5Ssel_iter_close");
+ H5E_BEGIN_TRY { /* Not a selection iterator ID */
+ ret = H5Ssel_iter_close(sid);
+ } H5E_END_TRY;
+ VERIFY(ret, FAIL, "H5Ssel_iter_close");
+
+
+ /* Try with no selection sharing, and with sharing */
+ for(sel_share = 0; sel_share < 2; sel_share++) {
+ /* Set selection iterator sharing flags */
+ if(sel_share)
+ sel_iter_flags = H5S_SEL_ITER_SHARE_WITH_DATASPACE;
+ else
+ sel_iter_flags = 0;
+
+ /* Create selection iterator object */
+ iter_id = H5Ssel_iter_create(sid, (size_t)1, (unsigned)sel_iter_flags);
+ CHECK(iter_id, FAIL, "H5Ssel_iter_create");
+
+ /* Close selection iterator */
+ ret = H5Ssel_iter_close(iter_id);
+ CHECK(ret, FAIL, "H5Ssel_iter_close");
+
+ /* Try closing selection iterator twice */
+ H5E_BEGIN_TRY { /* Invalid ID */
+ ret = H5Ssel_iter_close(iter_id);
+ } H5E_END_TRY;
+ VERIFY(ret, FAIL, "H5Ssel_iter_close");
+
+
+ /* Create selection iterator object */
+ iter_id = H5Ssel_iter_create(sid, (size_t)1, (unsigned)sel_iter_flags);
+ CHECK(iter_id, FAIL, "H5Ssel_iter_create");
+
+ /* Try retrieving sequences, with bad parameters */
+ H5E_BEGIN_TRY { /* Invalid ID */
+ ret = H5Ssel_iter_get_seq_list(H5I_INVALID_HID, (size_t)1, (size_t)1, &nseq, &nbytes, off, len);
+ } H5E_END_TRY;
+ VERIFY(ret, FAIL, "H5Ssel_iter_get_seq_list");
+ H5E_BEGIN_TRY { /* Invalid nseq pointer */
+ ret = H5Ssel_iter_get_seq_list(iter_id, (size_t)1, (size_t)1, NULL, &nbytes, off, len);
+ } H5E_END_TRY;
+ VERIFY(ret, FAIL, "H5Ssel_iter_get_seq_list");
+ H5E_BEGIN_TRY { /* Invalid nbytes pointer */
+ ret = H5Ssel_iter_get_seq_list(iter_id, (size_t)1, (size_t)1, &nseq, NULL, off, len);
+ } H5E_END_TRY;
+ VERIFY(ret, FAIL, "H5Ssel_iter_get_seq_list");
+ H5E_BEGIN_TRY { /* Invalid offset array */
+ ret = H5Ssel_iter_get_seq_list(iter_id, (size_t)1, (size_t)1, &nseq, &nbytes, NULL, len);
+ } H5E_END_TRY;
+ VERIFY(ret, FAIL, "H5Ssel_iter_get_seq_list");
+ H5E_BEGIN_TRY { /* Invalid length array */
+ ret = H5Ssel_iter_get_seq_list(iter_id, (size_t)1, (size_t)1, &nseq, &nbytes, off, NULL);
+ } H5E_END_TRY;
+ VERIFY(ret, FAIL, "H5Ssel_iter_get_seq_list");
+
+ /* Close selection iterator */
+ ret = H5Ssel_iter_close(iter_id);
+ CHECK(ret, FAIL, "H5Ssel_iter_close");
+
+
+ /* Test iterators on various basic selection types */
+ for(sel_type = H5S_SEL_NONE; sel_type <= H5S_SEL_ALL; sel_type = (H5S_sel_type)(sel_type + 1)) {
+ switch(sel_type) {
+ case H5S_SEL_NONE: /* "None" selection */
+ ret = H5Sselect_none(sid);
+ CHECK(ret, FAIL, "H5Sselect_none");
+ break;
+
+ case H5S_SEL_POINTS: /* Point selection */
+ /* Select sequence of ten points */
+ coord1[0][0] = 0; coord1[0][1] = 9;
+ coord1[1][0] = 1; coord1[1][1] = 2;
+ coord1[2][0] = 2; coord1[2][1] = 4;
+ coord1[3][0] = 0; coord1[3][1] = 6;
+ coord1[4][0] = 1; coord1[4][1] = 8;
+ coord1[5][0] = 2; coord1[5][1] = 10;
+ coord1[6][0] = 0; coord1[6][1] = 11;
+ coord1[7][0] = 1; coord1[7][1] = 4;
+ coord1[8][0] = 2; coord1[8][1] = 1;
+ coord1[9][0] = 0; coord1[9][1] = 3;
+ ret = H5Sselect_elements(sid, H5S_SELECT_SET, (size_t)POINT1_NPOINTS, (const hsize_t *)coord1);
+ CHECK(ret, FAIL, "H5Sselect_elements");
+ break;
+
+ case H5S_SEL_HYPERSLABS: /* Hyperslab selection */
+ /* Select regular hyperslab */
+ start[0] = 3; start[1] = 0;
+ stride[0] = 2; stride[1] = 2;
+ count[0] = 2; count[1] = 5;
+ block[0] = 1; block[1] = 1;
+ ret = H5Sselect_hyperslab(sid, H5S_SELECT_SET, start, stride, count, block);
+ CHECK(ret, FAIL, "H5Sselect_hyperslab");
+ break;
+
+ case H5S_SEL_ALL: /* "All" selection */
+ ret = H5Sselect_all(sid);
+ CHECK(ret, FAIL, "H5Sselect_all");
+ break;
+
+ case H5S_SEL_ERROR:
+ case H5S_SEL_N:
+ default:
+ HDassert(0 && "Can't occur");
+ break;
+ } /* end switch */
+
+ /* Create selection iterator object */
+ iter_id = H5Ssel_iter_create(sid, (size_t)1, (unsigned)sel_iter_flags);
+ CHECK(iter_id, FAIL, "H5Ssel_iter_create");
+
+ /* Try retrieving no sequences, with 0 for maxseq & maxbytes */
+ ret = H5Ssel_iter_get_seq_list(iter_id, (size_t)0, (size_t)1, &nseq, &nbytes, off, len);
+ CHECK(ret, FAIL, "H5Ssel_iter_get_seq_list");
+ VERIFY(nseq, 0, "H5Ssel_iter_get_seq_list");
+ VERIFY(nbytes, 0, "H5Ssel_iter_get_seq_list");
+ ret = H5Ssel_iter_get_seq_list(iter_id, (size_t)1, (size_t)0, &nseq, &nbytes, off, len);
+ CHECK(ret, FAIL, "H5Ssel_iter_get_seq_list");
+ VERIFY(nseq, 0, "H5Ssel_iter_get_seq_list");
+ VERIFY(nbytes, 0, "H5Ssel_iter_get_seq_list");
+
+ /* Try retrieving all sequences */
+ ret = H5Ssel_iter_get_seq_list(iter_id, (size_t)SEL_ITER_MAX_SEQ, (size_t)(1024 * 1024), &nseq, &nbytes, off, len);
+ CHECK(ret, FAIL, "H5Ssel_iter_get_seq_list");
+
+ /* Check results from retrieving sequence list */
+ switch(sel_type) {
+ case H5S_SEL_NONE: /* "None" selection */
+ VERIFY(nseq, 0, "H5Ssel_iter_get_seq_list");
+ VERIFY(nbytes, 0, "H5Ssel_iter_get_seq_list");
+ break;
+
+ case H5S_SEL_POINTS: /* Point selection */
+ VERIFY(nseq, 10, "H5Ssel_iter_get_seq_list");
+ VERIFY(nbytes, 10, "H5Ssel_iter_get_seq_list");
+ break;
+
+ case H5S_SEL_HYPERSLABS: /* Hyperslab selection */
+ VERIFY(nseq, 10, "H5Ssel_iter_get_seq_list");
+ VERIFY(nbytes, 10, "H5Ssel_iter_get_seq_list");
+ break;
+
+ case H5S_SEL_ALL: /* "All" selection */
+ VERIFY(nseq, 1, "H5Ssel_iter_get_seq_list");
+ VERIFY(nbytes, 72, "H5Ssel_iter_get_seq_list");
+ break;
+
+ case H5S_SEL_ERROR:
+ case H5S_SEL_N:
+ default:
+ HDassert(0 && "Can't occur");
+ break;
+ } /* end switch */
+
+ /* Close selection iterator */
+ ret = H5Ssel_iter_close(iter_id);
+ CHECK(ret, FAIL, "H5Ssel_iter_close");
+ } /* end for */
+
+ /* Point selection which will merge into smaller # of sequences */
+ coord1[0][0] = 0; coord1[0][1] = 9;
+ coord1[1][0] = 0; coord1[1][1] = 10;
+ coord1[2][0] = 0; coord1[2][1] = 11;
+ coord1[3][0] = 0; coord1[3][1] = 6;
+ coord1[4][0] = 1; coord1[4][1] = 8;
+ coord1[5][0] = 2; coord1[5][1] = 10;
+ coord1[6][0] = 0; coord1[6][1] = 11;
+ coord1[7][0] = 1; coord1[7][1] = 4;
+ coord1[8][0] = 1; coord1[8][1] = 5;
+ coord1[9][0] = 1; coord1[9][1] = 6;
+ ret = H5Sselect_elements(sid, H5S_SELECT_SET, (size_t)POINT1_NPOINTS, (const hsize_t *)coord1);
+ CHECK(ret, FAIL, "H5Sselect_elements");
+
+ /* Create selection iterator object */
+ iter_id = H5Ssel_iter_create(sid, (size_t)1, (unsigned)sel_iter_flags);
+ CHECK(iter_id, FAIL, "H5Ssel_iter_create");
+
+ /* Try retrieving all sequences */
+ ret = H5Ssel_iter_get_seq_list(iter_id, (size_t)SEL_ITER_MAX_SEQ, (size_t)(1024 * 1024), &nseq, &nbytes, off, len);
+ CHECK(ret, FAIL, "H5Ssel_iter_get_seq_list");
+ VERIFY(nseq, 6, "H5Ssel_iter_get_seq_list");
+ VERIFY(nbytes, 10, "H5Ssel_iter_get_seq_list");
+
+ /* Close selection iterator */
+ ret = H5Ssel_iter_close(iter_id);
+ CHECK(ret, FAIL, "H5Ssel_iter_close");
+
+
+ /* Select irregular hyperslab, which will merge into smaller # of sequences */
+ start[0] = 3; start[1] = 0;
+ stride[0] = 2; stride[1] = 2;
+ count[0] = 2; count[1] = 5;
+ block[0] = 1; block[1] = 1;
+ ret = H5Sselect_hyperslab(sid, H5S_SELECT_SET, start, stride, count, block);
+ CHECK(ret, FAIL, "H5Sselect_hyperslab");
+
+ start[0] = 3; start[1] = 3;
+ stride[0] = 2; stride[1] = 2;
+ count[0] = 2; count[1] = 5;
+ block[0] = 1; block[1] = 1;
+ ret = H5Sselect_hyperslab(sid, H5S_SELECT_OR, start, stride, count, block);
+ CHECK(ret, FAIL, "H5Sselect_hyperslab");
+
+ /* Create selection iterator object */
+ iter_id = H5Ssel_iter_create(sid, (size_t)1, (unsigned)sel_iter_flags);
+ CHECK(iter_id, FAIL, "H5Ssel_iter_create");
+
+ /* Try retrieving all sequences */
+ ret = H5Ssel_iter_get_seq_list(iter_id, (size_t)SEL_ITER_MAX_SEQ, (size_t)(1024 * 1024), &nseq, &nbytes, off, len);
+ CHECK(ret, FAIL, "H5Ssel_iter_get_seq_list");
+ VERIFY(nseq, 6, "H5Ssel_iter_get_seq_list");
+ VERIFY(nbytes, 20, "H5Ssel_iter_get_seq_list");
+
+ /* Close selection iterator */
+ ret = H5Ssel_iter_close(iter_id);
+ CHECK(ret, FAIL, "H5Ssel_iter_close");
+
+ } /* end for */
+
+ /* Close dataspace */
+ ret = H5Sclose(sid);
+ CHECK(ret, FAIL, "H5Sclose");
+} /* test_sel_iter() */
+
+
+/****************************************************************
+**
** test_select(): Main H5S selection testing routine.
**
****************************************************************/
@@ -13661,10 +15259,12 @@ test_select(void)
test_select_hyper_offset2();/* Test more selection offset code with hyperslabs */
test_select_point_offset(); /* Test selection offset code with elements */
test_select_hyper_union(); /* Test hyperslab union code */
-#ifdef NEW_HYPERSLAB_API
+
+ /* Fancy hyperslab API tests */
test_select_hyper_union_stagger(); /* Test hyperslab union code for staggered slabs */
test_select_hyper_union_3d(); /* Test hyperslab union code for 3-D dataset */
-#endif /* NEW_HYPERSLAB_API */
+ test_select_hyper_valid_combination(); /* Test different input combinations */
+
test_select_hyper_and_2d(); /* Test hyperslab intersection (AND) code for 2-D dataset */
test_select_hyper_xor_2d(); /* Test hyperslab XOR code for 2-D dataset */
test_select_hyper_notb_2d(); /* Test hyperslab NOTB code for 2-D dataset */
@@ -13740,6 +15340,8 @@ test_select(void)
/* Test "re-build" routine */
test_space_rebuild();
+ /* Test "update diminfo" routine */
+ test_space_update_diminfo();
/* Test point selections in chunked datasets */
test_select_point_chunk();
@@ -13760,6 +15362,14 @@ test_select(void)
/* Test unlimited hyperslab selections */
test_hyper_unlim();
+ /* Test the consistency of internal data structures of selection */
+ test_internal_consistency();
+
+ /* Test irregular selection I/O */
+ test_irreg_io();
+
+ /* Test selection iterators */
+ test_sel_iter();
} /* test_select() */
@@ -13780,6 +15390,6 @@ test_select(void)
void
cleanup_select(void)
{
- remove(FILENAME);
+ HDremove(FILENAME);
}
diff --git a/test/tsohm.c b/test/tsohm.c
index bd73d00..5c3707f 100644
--- a/test/tsohm.c
+++ b/test/tsohm.c
@@ -621,12 +621,12 @@ size1_helper(hid_t file, const char *filename, hid_t fapl_id, int test_file_clos
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"); \
+ HDprintf("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"); \
+ HDprintf("incorrect read data\n"); \
goto error; \
} \
} /* TSOHM_S1H_VERIFY_DATA() definition */
@@ -1383,7 +1383,7 @@ size2_verify_plist1(hid_t plist)
ret = H5Pget_fill_value(plist, dtype1_id, &fill1);
CHECK_I(ret, "H5Pget_fill_value");
- ret = memcmp(&fill1, &fill1_correct, sizeof(fill1_correct));
+ ret = HDmemcmp(&fill1, &fill1_correct, sizeof(fill1_correct));
VERIFY(ret, 0, "memcmp");
ret = H5Tclose(dtype1_id);
@@ -1482,15 +1482,15 @@ size2_verify_plist2(hid_t plist)
static void
size2_dump_struct(const char *name, size2_helper_struct *sizes)
{
- puts(name);
- printf(" empty size: %llu\n", (unsigned long long)sizes->empty_size);
- printf(" first dataset: %llu \tdelta: %llu\n", (unsigned long long)sizes->first_dset, (unsigned long long)(sizes->first_dset - sizes->empty_size));
- printf("second dataset: %llu \tdelta: %llu\n", (unsigned long long)sizes->second_dset, (unsigned long long)(sizes->second_dset - sizes->first_dset));
- printf(" dsets 1: %llu \tdelta: %llu\n", (unsigned long long)sizes->dsets1, (unsigned long long)(sizes->dsets1 - sizes->second_dset));
- printf(" dsets 2: %llu \tdelta: %llu\n", (unsigned long long)sizes->dsets2, (unsigned long long)(sizes->dsets2 - sizes->dsets1));
- 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));
+ HDputs(name);
+ HDprintf(" empty size: %llu\n", (unsigned long long)sizes->empty_size);
+ HDprintf(" first dataset: %llu \tdelta: %llu\n", (unsigned long long)sizes->first_dset, (unsigned long long)(sizes->first_dset - sizes->empty_size));
+ HDprintf("second dataset: %llu \tdelta: %llu\n", (unsigned long long)sizes->second_dset, (unsigned long long)(sizes->second_dset - sizes->first_dset));
+ HDprintf(" dsets 1: %llu \tdelta: %llu\n", (unsigned long long)sizes->dsets1, (unsigned long long)(sizes->dsets1 - sizes->second_dset));
+ HDprintf(" dsets 2: %llu \tdelta: %llu\n", (unsigned long long)sizes->dsets2, (unsigned long long)(sizes->dsets2 - sizes->dsets1));
+ HDprintf(" interleaved: %llu \tdelta: %llu\n", (unsigned long long)sizes->interleaved, (unsigned long long)(sizes->interleaved - sizes->dsets2));
+ HDprintf(" attributes: %llu \tdelta: %llu\n", (unsigned long long)sizes->attrs1, (unsigned long long)(sizes->attrs1 - sizes->interleaved));
+ HDprintf(" attributes 2: %llu \tdelta: %llu\n", (unsigned long long)sizes->attrs2, (unsigned long long)(sizes->attrs2 - sizes->attrs1));
} /* size2_dump_struct */
#endif /* NOT_NOW */
@@ -3862,8 +3862,8 @@ test_sohm(void)
void
cleanup_sohm(void)
{
- remove(FILENAME);
- remove(FILENAME_SRC);
- remove(FILENAME_DST);
+ HDremove(FILENAME);
+ HDremove(FILENAME_SRC);
+ HDremove(FILENAME_DST);
} /* cleanup_sohm */
diff --git a/test/ttime.c b/test/ttime.c
index 48c9ba8..5b3436d 100644
--- a/test/ttime.c
+++ b/test/ttime.c
@@ -178,13 +178,13 @@ test_time_io(void)
tid = H5Dget_type(dsid);
CHECK(tid, FAIL, "H5Dget_type");
if( H5Tget_class (tid) == H5T_TIME)
- fprintf(stderr,"datatype class is H5T_TIME\n");
+ HDfprintf(stderr,"datatype class is H5T_TIME\n");
status = H5Tclose (tid);
CHECK(status, FAIL, "H5Tclose");
status = H5Dread (dsid, H5T_UNIX_D32LE, H5S_ALL, H5S_ALL, H5P_DEFAULT, &timethen);
CHECK(status, FAIL, "H5Dread");
-fprintf(stderr,"time written was: %s\n", HDctime(&timethen));
+HDfprintf(stderr,"time written was: %s\n", HDctime(&timethen));
status = H5Dclose(dsid);
CHECK(status, FAIL, "H5Dclose");
@@ -231,6 +231,6 @@ test_time(void)
void
cleanup_time(void)
{
- remove(DATAFILE);
+ HDremove(DATAFILE);
}
diff --git a/test/ttsafe_error.c b/test/ttsafe_error.c
index 56d87ee..5e26888 100644
--- a/test/ttsafe_error.c
+++ b/test/ttsafe_error.c
@@ -63,6 +63,8 @@ static void *tts_error_thread(void *);
void
tts_error(void)
{
+ hid_t def_fapl = H5I_INVALID_HID;
+ hid_t vol_id = H5I_INVALID_HID;
hid_t dataset = H5I_INVALID_HID;
H5TS_thread_t threads[NUM_THREAD];
H5TS_attr_t attribute;
@@ -111,39 +113,52 @@ tts_error(void)
H5TS_attr_setscope(&attribute, H5TS_SCOPE_SYSTEM);
#endif /* H5_HAVE_SYSTEM_SCOPE_THREADS */
- /* Create a hdf5 file using H5F_ACC_TRUNC access, default file
- * creation plist and default file access plist
- */
- error_file_g = H5Fcreate(FILENAME, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
- CHECK(error_file_g, H5I_INVALID_HID, "H5Fcreate");
+ def_fapl = H5Pcreate(H5P_FILE_ACCESS);
+ CHECK(def_fapl, H5I_INVALID_HID, "H5Pcreate");
- for (i = 0; i < NUM_THREAD; i++)
- threads[i] = H5TS_create_thread(tts_error_thread, &attribute, NULL);
+ status = H5Pget_vol_id(def_fapl, &vol_id);
+ CHECK(status, FAIL, "H5Pget_vol_id");
- for (i = 0; i < NUM_THREAD; i++)
- H5TS_wait_for_thread(threads[i]);
+ if(vol_id == H5VL_NATIVE) {
+ /* Create a hdf5 file using H5F_ACC_TRUNC access, default file
+ * creation plist and default file access plist
+ */
+ error_file_g = H5Fcreate(FILENAME, H5F_ACC_TRUNC, H5P_DEFAULT, def_fapl);
+ CHECK(error_file_g, H5I_INVALID_HID, "H5Fcreate");
- if (error_flag_g) {
- TestErrPrintf("At least one thread reported a value that was different from the expected value\n");
- HDprintf("(Update this test if the error stack changed!)\n");
- }
+ for (i = 0; i < NUM_THREAD; i++)
+ threads[i] = H5TS_create_thread(tts_error_thread, &attribute, NULL);
+
+ for (i = 0; i < NUM_THREAD; i++)
+ H5TS_wait_for_thread(threads[i]);
+
+ if (error_flag_g) {
+ TestErrPrintf("At least one thread reported a value that was different from the expected value\n");
+ HDprintf("(Update this test if the error stack changed!)\n");
+ }
- if (error_count_g != NUM_THREAD - 1)
- TestErrPrintf("Error: %d threads failed instead of %d\n", error_count_g, NUM_THREAD-1);
+ if (error_count_g != NUM_THREAD - 1)
+ TestErrPrintf("Error: %d threads failed instead of %d\n", error_count_g, NUM_THREAD-1);
- dataset = H5Dopen2(error_file_g, DATASETNAME, H5P_DEFAULT);
- CHECK(dataset, H5I_INVALID_HID, "H5Dopen2");
+ dataset = H5Dopen2(error_file_g, DATASETNAME, H5P_DEFAULT);
+ CHECK(dataset, H5I_INVALID_HID, "H5Dopen2");
- status = H5Dread(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, &value);
- CHECK(status, FAIL, "H5Dread");
+ status = H5Dread(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, &value);
+ CHECK(status, FAIL, "H5Dread");
- if (value != WRITE_NUMBER)
- TestErrPrintf("Error: Successful thread wrote value %d instead of %d\n", value, WRITE_NUMBER);
+ if (value != WRITE_NUMBER)
+ TestErrPrintf("Error: Successful thread wrote value %d instead of %d\n", value, WRITE_NUMBER);
- status = H5Dclose(dataset);
- CHECK(status, FAIL, "H5Dclose");
- status = H5Fclose(error_file_g);
- CHECK(status, FAIL, "H5Fclose");
+ status = H5Dclose(dataset);
+ CHECK(status, FAIL, "H5Dclose");
+ status = H5Fclose(error_file_g);
+ CHECK(status, FAIL, "H5Fclose");
+ } /* end if */
+ else
+ HDprintf("Non-native VOL connector used, skipping test\n");
+
+ status = H5Idec_ref(vol_id);
+ CHECK(status, FAIL, "H5Idec_ref");
H5TS_attr_destroy(&attribute);
} /* end tts_error() */
diff --git a/test/tunicode.c b/test/tunicode.c
index 5a60036..255dc50 100644
--- a/test/tunicode.c
+++ b/test/tunicode.c
@@ -854,7 +854,7 @@ void test_unicode(void)
*/
void cleanup_unicode(void)
{
- remove(FILENAME);
+ HDremove(FILENAME);
}
diff --git a/test/tvlstr.c b/test/tvlstr.c
index da6195c..77589bb 100644
--- a/test/tvlstr.c
+++ b/test/tvlstr.c
@@ -183,7 +183,7 @@ test_vlstrings_basic(void)
/* Count the actual number of bytes used by the strings */
for(i=0,str_used=0; i<SPACE1_DIM1; i++)
- str_used+=HDstrlen(wdata[i])+1;
+ str_used += HDstrlen(wdata[i])+1;
/* Compare against the strings actually written */
VERIFY(size,(hsize_t)str_used,"H5Dvlen_get_buf_size");
@@ -198,7 +198,7 @@ test_vlstrings_basic(void)
/* Compare data read in */
for(i = 0; i < SPACE1_DIM1; i++) {
if(HDstrlen(wdata[i]) != HDstrlen(rdata[i])) {
- TestErrPrintf("VL data length don't match!, strlen(wdata[%d])=%d, strlen(rdata[%d])=%d\n",(int)i,(int)strlen(wdata[i]),(int)i,(int)strlen(rdata[i]));
+ TestErrPrintf("VL data length don't match!, strlen(wdata[%d])=%d, strlen(rdata[%d])=%d\n",(int)i,(int)strlen(wdata[i]),(int)i,(int)HDstrlen(rdata[i]));
continue;
} /* end if */
if(HDstrcmp(wdata[i], rdata[i]) != 0 ) {
@@ -300,7 +300,7 @@ test_vlstrings_special(void)
/* Compare data read in */
for(i = 0; i < SPACE1_DIM1; i++) {
if(HDstrlen(wdata[i]) != HDstrlen(rdata[i])) {
- TestErrPrintf("VL data length don't match!, strlen(wdata[%d])=%d, strlen(rdata[%d])=%d\n",(int)i,(int)strlen(wdata[i]),(int)i,(int)strlen(rdata[i]));
+ TestErrPrintf("VL data length don't match!, strlen(wdata[%d])=%d, strlen(rdata[%d])=%d\n",(int)i,(int)strlen(wdata[i]),(int)i,(int)HDstrlen(rdata[i]));
continue;
} /* end if */
if((wdata[i] == NULL && rdata[i] != NULL) || (rdata[i] == NULL && wdata[i] != NULL)) {
@@ -527,7 +527,7 @@ test_compact_vlstring(void)
/* Compare data read in */
for(i = 0; i < SPACE1_DIM1; i++) {
if(HDstrlen(wdata[i]) != HDstrlen(rdata[i])) {
- TestErrPrintf("VL data length don't match!, strlen(wdata[%d])=%d, strlen(rdata[%d])=%d\n",(int)i,(int)strlen(wdata[i]),(int)i,(int)strlen(rdata[i]));
+ TestErrPrintf("VL data length don't match!, strlen(wdata[%d])=%d, strlen(rdata[%d])=%d\n",(int)i,(int)strlen(wdata[i]),(int)i,(int)HDstrlen(rdata[i]));
continue;
} /* end if */
if(HDstrcmp(wdata[i], rdata[i]) != 0) {
@@ -802,33 +802,33 @@ static void test_vl_rewrite(void)
/* Create in file 1 */
for(i=0; i<REWRITE_NDATASETS; i++) {
- sprintf(name, "/set_%d", i);
+ HDsprintf(name, "/set_%d", i);
write_scalar_dset(file1, type, space, name, name);
}
/* Effectively copy data from file 1 to 2 */
for(i=0; i<REWRITE_NDATASETS; i++) {
- sprintf(name, "/set_%d", i);
+ HDsprintf(name, "/set_%d", i);
read_scalar_dset(file1, type, space, name, name);
write_scalar_dset(file2, type, space, name, name);
}
/* Read back from file 2 */
for(i = 0; i < REWRITE_NDATASETS; i++) {
- sprintf(name, "/set_%d", i);
+ HDsprintf(name, "/set_%d", i);
read_scalar_dset(file2, type, space, name, name);
} /* end for */
/* Remove from file 2. */
for(i = 0; i < REWRITE_NDATASETS; i++) {
- sprintf(name, "/set_%d", i);
+ HDsprintf(name, "/set_%d", i);
ret = H5Ldelete(file2, name, H5P_DEFAULT);
CHECK(ret, FAIL, "H5Ldelete");
} /* end for */
/* Effectively copy from file 1 to file 2 */
for(i = 0; i < REWRITE_NDATASETS; i++) {
- sprintf(name, "/set_%d", i);
+ HDsprintf(name, "/set_%d", i);
read_scalar_dset(file1, type, space, name, name);
write_scalar_dset(file2, type, space, name, name);
} /* end for */
diff --git a/test/vds.c b/test/vds.c
index 4f03bbd..af052a8 100644
--- a/test/vds.c
+++ b/test/vds.c
@@ -378,7 +378,7 @@ test_api_get_ex_dcpl(test_api_config_t config, hid_t fapl, hid_t dcpl,
TEST_ERROR
if(config == TEST_API_REOPEN_FILE) {
if(oinfo.meta_size.obj.heap_size != exp_meta_size) {
- printf("VDS metadata size: %llu Expected: %llu\n", (long long unsigned)oinfo.meta_size.obj.heap_size, (long long unsigned)exp_meta_size);
+ HDprintf("VDS metadata size: %llu Expected: %llu\n", (long long unsigned)oinfo.meta_size.obj.heap_size, (long long unsigned)exp_meta_size);
TEST_ERROR
}
}
@@ -420,11 +420,11 @@ test_api_get_ex_dcpl(test_api_config_t config, hid_t fapl, hid_t dcpl,
size_t plist_buf_size;
/* Encode property list to plist_buf */
- if(H5Pencode(dcpl, NULL, &plist_buf_size) < 0)
+ if(H5Pencode2(dcpl, NULL, &plist_buf_size, fapl) < 0)
TEST_ERROR
if(NULL == (plist_buf = HDmalloc(plist_buf_size)))
TEST_ERROR
- if(H5Pencode(dcpl, plist_buf, &plist_buf_size) < 0)
+ if(H5Pencode2(dcpl, plist_buf, &plist_buf_size, fapl) < 0)
TEST_ERROR
/* Decode serialized property list to *ex_dcpl */
@@ -469,7 +469,7 @@ error:
/* Main test function */
static int
-test_api(test_api_config_t config, hid_t fapl)
+test_api(test_api_config_t config, hid_t fapl, H5F_libver_t low)
{
char filename[FILENAME_BUF_SIZE];
hid_t dcpl = -1; /* Dataset creation property list */
@@ -618,7 +618,8 @@ test_api(test_api_config_t config, hid_t fapl)
TEST_ERROR
/* Get examination DCPL */
- if(test_api_get_ex_dcpl(config, fapl, dcpl, &ex_dcpl, vspace[0], filename, (hsize_t)213) < 0)
+ if(test_api_get_ex_dcpl(config, fapl, dcpl, &ex_dcpl, vspace[0], filename,
+ (low >= H5F_LIBVER_V112)?(hsize_t)99:(low >= H5F_LIBVER_V110?174:213)) < 0)
TEST_ERROR
/* Test H5Pget_virtual_count */
@@ -1025,7 +1026,8 @@ test_api(test_api_config_t config, hid_t fapl)
}
/* Get examination DCPL */
- if(test_api_get_ex_dcpl(config, fapl, dcpl, &ex_dcpl, vspace[0], filename, (hsize_t)697) < 0)
+ if(test_api_get_ex_dcpl(config, fapl, dcpl, &ex_dcpl, vspace[0], filename,
+ (low >= H5F_LIBVER_V112)?(hsize_t)607:(hsize_t)697) < 0)
TEST_ERROR
/* Test H5Pget_virtual_count */
@@ -1119,7 +1121,7 @@ error:
} /* end test_api() */
/*-------------------------------------------------------------------------
- * Function: vds_link_prefix
+ * Function: test_vds_prefix_first
*
* Purpose: Set up vds link prefix via H5Pset_virtual_prefix() to be "tmp"
* Should be able to access the target source files in tmp directory via the prefix set
@@ -1130,18 +1132,16 @@ error:
*-------------------------------------------------------------------------
*/
static int
-test_vds_prefix(unsigned config, hid_t fapl)
+test_vds_prefix_first(unsigned config, hid_t fapl)
{
char srcfilename[FILENAME_BUF_SIZE];
char srcfilename_map[FILENAME_BUF_SIZE];
char vfilename[FILENAME_BUF_SIZE];
- char vfilename2[FILENAME_BUF_SIZE];
char srcfilenamepct[FILENAME_BUF_SIZE];
char srcfilenamepct_map[FILENAME_BUF_SIZE];
const char *srcfilenamepct_map_orig = "vds%%%%_src";
hid_t srcfile[4] = {-1, -1, -1, -1}; /* Files with source dsets */
hid_t vfile = -1; /* File with virtual dset */
- hid_t vfile2 = -1; /* File with copied virtual dset */
hid_t dcpl = -1; /* Dataset creation property list */
hid_t dapl = -1; /* Dataset access property list */
hid_t srcspace[4] = {-1, -1, -1, -1}; /* Source dataspaces */
@@ -1156,10 +1156,9 @@ test_vds_prefix(unsigned config, hid_t fapl)
int i, j;
char buffer[1024]; /* buffer to read vds_prefix */
- TESTING("basic virtual dataset I/O via H5Pset_vds_prefix()")
+ TESTING("basic virtual dataset I/O via H5Pset_vds_prefix(): all selection")
h5_fixname(FILENAME[0], fapl, vfilename, sizeof vfilename);
- h5_fixname(FILENAME[7], fapl, vfilename2, sizeof vfilename2);
h5_fixname(FILENAME[8], fapl, srcfilename, sizeof srcfilename);
h5_fixname_printf(FILENAME[8], fapl, srcfilename_map, sizeof srcfilename_map);
h5_fixname(FILENAME[10], fapl, srcfilenamepct, sizeof srcfilenamepct);
@@ -1189,9 +1188,6 @@ test_vds_prefix(unsigned config, hid_t fapl)
if(HDstrcmp(buffer, TMPDIR) != 0)
FAIL_PUTS_ERROR("vds prefix not set correctly");
- /*
- * Test 1: All - all selection
- */
/* Create source dataspace */
if((srcspace[0] = H5Screate_simple(2, dims, NULL)) < 0)
TEST_ERROR
@@ -1344,187 +1340,6 @@ test_vds_prefix(unsigned config, hid_t fapl)
TEST_ERROR
dcpl = -1;
- /*
- * Test 2: All - all selection with ENV prefix
- */
- if(HDsetenv("HDF5_VDS_PREFIX", "${ORIGIN}/tmp", 1))
- TEST_ERROR
-
- /* Create DCPL */
- if((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0)
- TEST_ERROR
-
- /* Set fill value */
- if(H5Pset_fill_value(dcpl, H5T_NATIVE_INT, &fill) < 0)
- TEST_ERROR
-
- /* Set prefix to a nonexistent directory, will be overwritten by environment variable */
- if((dapl = H5Pcreate(H5P_DATASET_ACCESS)) < 0)
- TEST_ERROR
-
- if(H5Pset_virtual_prefix(dapl, "someprefix") < 0)
- TEST_ERROR
- if(H5Pget_virtual_prefix(dapl, buffer, sizeof(buffer)) < 0)
- TEST_ERROR
-
- if(HDstrcmp(buffer, "someprefix") != 0)
- FAIL_PUTS_ERROR("vds prefix not set correctly");
-
- /* Create source dataspace */
- if((srcspace[0] = H5Screate_simple(2, dims, NULL)) < 0)
- TEST_ERROR
-
- /* Create virtual dataspace */
- if((vspace[0] = H5Screate_simple(2, dims, NULL)) < 0)
- TEST_ERROR
-
- /* Select all (should not be necessary, but just to be sure) */
- if(H5Sselect_all(srcspace[0]) < 0)
- TEST_ERROR
- if(H5Sselect_all(vspace[0]) < 0)
- TEST_ERROR
-
- /* Add virtual layout mapping */
- if(H5Pset_virtual(dcpl, vspace[0], config & TEST_IO_DIFFERENT_FILE ? srcfilename_map : ".", "src_dset", srcspace[0]) < 0)
- TEST_ERROR
-
- /* Create virtual file */
- if((vfile = H5Fcreate(vfilename2, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
- TEST_ERROR
-
- /* Create source file if requested */
- if(config & TEST_IO_DIFFERENT_FILE) {
- HDgetcwd(buffer, 1024);
- HDchdir(TMPDIR);
- if((srcfile[0] = H5Fcreate(srcfilename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
- TEST_ERROR
- HDchdir(buffer);
- }
- else {
- srcfile[0] = vfile;
- if(H5Iinc_ref(srcfile[0]) < 0)
- TEST_ERROR
- }
-
- /* Create source dataset */
- if((srcdset[0] = H5Dcreate2(srcfile[0], "src_dset", H5T_NATIVE_INT, srcspace[0], H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
- TEST_ERROR
-
- /* Create virtual dataset */
- if((vdset = H5Dcreate2(vfile, "v_dset", H5T_NATIVE_INT, vspace[0], H5P_DEFAULT, dcpl, dapl)) < 0)
- TEST_ERROR
-
- /* Populate write buffer */
- for(i = 0; i < (int)(sizeof(buf) / sizeof(buf[0])); i++)
- for(j = 0; j < (int)(sizeof(buf[0]) / sizeof(buf[0][0])); j++)
- buf[i][j] = (i * (int)(sizeof(buf[0]) / sizeof(buf[0][0]))) + j;
-
- /* Write data directly to source dataset */
- if(H5Dwrite(srcdset[0], H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf[0]) < 0)
- TEST_ERROR
-
- /* Close srcdset and srcfile if config option specified */
- if(config & TEST_IO_CLOSE_SRC) {
- if(H5Dclose(srcdset[0]) < 0)
- TEST_ERROR
- srcdset[0] = -1;
-
- if(config & TEST_IO_DIFFERENT_FILE) {
- if(H5Fclose(srcfile[0]) < 0)
- TEST_ERROR
- srcfile[0] = -1;
- }
- }
-
- /* Reopen virtual dataset and file if config option specified */
- if(config & TEST_IO_REOPEN_VIRT) {
- if(H5Dclose(vdset) < 0)
- TEST_ERROR
- vdset = -1;
- if(H5Fclose(vfile) < 0)
- TEST_ERROR
- vfile = -1;
- if((vfile = H5Fopen(vfilename2, H5F_ACC_RDWR, fapl)) < 0)
- TEST_ERROR
- if((vdset = H5Dopen2(vfile, "v_dset", dapl)) < 0)
- TEST_ERROR
- }
-
- /* Read data through virtual dataset */
- HDmemset(rbuf[0], 0, sizeof(rbuf));
- if(H5Dread(vdset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, rbuf[0]) < 0)
- TEST_ERROR
-
- /* Verify read data */
- for(i = 0; i < (int)(sizeof(buf) / sizeof(buf[0])); i++) {
- for(j = 0; j < (int)(sizeof(buf[0]) / sizeof(buf[0][0])); j++)
- if(rbuf[i][j] != buf[i][j]) {
- TEST_ERROR
- }
- }
-
- /* Adjust write buffer */
- for(i = 0; i < (int)(sizeof(buf) / sizeof(buf[0])); i++)
- for(j = 0; j < (int)(sizeof(buf[0]) / sizeof(buf[0][0])); j++)
- buf[i][j] += (int)(sizeof(buf) / sizeof(buf[0][0]));
-
- /* Write data through virtual dataset */
- if(H5Dwrite(vdset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf[0]) < 0)
- TEST_ERROR
-
- /* Reopen srcdset and srcfile if config option specified */
- if(config & TEST_IO_CLOSE_SRC) {
- if(config & TEST_IO_DIFFERENT_FILE) {
- HDgetcwd(buffer, 1024);
- HDchdir(TMPDIR);
- if((srcfile[0] = H5Fopen(srcfilename, H5F_ACC_RDONLY, fapl)) < 0)
- TEST_ERROR
- HDchdir(buffer);
- }
- if((srcdset[0] = H5Dopen2(srcfile[0], "src_dset", H5P_DEFAULT)) < 0)
- TEST_ERROR
- }
-
- /* Read data directly from source dataset */
- HDmemset(rbuf[0], 0, sizeof(rbuf));
- if(H5Dread(srcdset[0], H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, rbuf[0]) < 0)
- TEST_ERROR
-
- /* Verify read data */
- for(i = 0; i < (int)(sizeof(buf) / sizeof(buf[0])); i++)
- for(j = 0; j < (int)(sizeof(buf[0]) / sizeof(buf[0][0])); j++)
- if(rbuf[i][j] != buf[i][j])
- TEST_ERROR
-
- /* Close */
- if(H5Dclose(vdset) < 0)
- TEST_ERROR
- vdset = -1;
- if(H5Dclose(srcdset[0]) < 0)
- TEST_ERROR
- srcdset[0] = -1;
- if(H5Fclose(srcfile[0]) < 0)
- TEST_ERROR
- srcfile[0] = -1;
- if(H5Fclose(vfile) < 0)
- TEST_ERROR
- vfile = -1;
- if(H5Sclose(srcspace[0]) < 0)
- TEST_ERROR
- srcspace[0] = -1;
- if(H5Sclose(vspace[0]) < 0)
- TEST_ERROR
- vspace[0] = -1;
- if(H5Pclose(dapl) < 0)
- TEST_ERROR
- dapl = -1;
- if(H5Pclose(dcpl) < 0)
- TEST_ERROR
- dcpl = -1;
-
- if(HDsetenv("HDF5_VDS_PREFIX", "", 1) < 0)
- TEST_ERROR
-
PASSED();
return 0;
@@ -1536,7 +1351,6 @@ test_vds_prefix(unsigned config, hid_t fapl)
for(i = 0; i < (int)(sizeof(srcfile) / sizeof(srcfile[0])); i++)
H5Fclose(srcfile[i]);
H5Fclose(vfile);
- H5Fclose(vfile2);
for(i = 0; i < (int)(sizeof(srcspace) / sizeof(srcspace[0])); i++)
H5Sclose(srcspace[i]);
for(i = 0; i < (int)(sizeof(vspace) / sizeof(vspace[0])); i++)
@@ -1550,7 +1364,7 @@ test_vds_prefix(unsigned config, hid_t fapl)
TEST_ERROR
return 1;
-} /* end vds_link_prefix() */
+} /* end test_vds_prefix */
/*-------------------------------------------------------------------------
@@ -1595,7 +1409,7 @@ test_basic_io(unsigned config, hid_t fapl)
int erbuf[10][26]; /* Expected read buffer */
int fill = -1; /* Fill value */
herr_t ret; /* Generic return value */
- int i, j;
+ int i, j, u, v;
TESTING("basic virtual dataset I/O")
@@ -3684,6 +3498,724 @@ test_basic_io(unsigned config, hid_t fapl)
memspace = -1;
+ /*
+ * Test 8: For code coverage: Horizontal block virtual mappings, and file
+ * selection, grid memory selection
+ */
+ /* Clear virtual layout in DCPL */
+ if(H5Pset_layout(dcpl, H5D_VIRTUAL) < 0)
+ TEST_ERROR
+
+ /* Create memory dataspace */
+ if((memspace = H5Screate_simple(2, dims, NULL)) < 0)
+ TEST_ERROR
+
+ /* Create virtual dataspaces */
+ dims[0] = 8;
+ dims[1] = 15;
+ if((vspace[0] = H5Screate_simple(2, dims, NULL)) < 0)
+ TEST_ERROR
+ if((vspace[1] = H5Screate_simple(2, dims, NULL)) < 0)
+ TEST_ERROR
+
+ /* Create source dataspace */
+ dims[0] = 4;
+ if((srcspace[0] = H5Screate_simple(2, dims, NULL)) < 0)
+ TEST_ERROR
+
+ /* Select all in source space (should not be necessary, but just to be sure)
+ */
+ if(H5Sselect_all(srcspace[0]) < 0)
+ TEST_ERROR
+
+ /* Select hyperslabs in virtual spaces */
+ start[0] = 0;
+ start[1] = 0;
+ if(H5Sselect_hyperslab(vspace[0], H5S_SELECT_SET, start, NULL, dims, NULL) < 0)
+ TEST_ERROR
+ start[0] = 4;
+ if(H5Sselect_hyperslab(vspace[1], H5S_SELECT_SET, start, NULL, dims, NULL) < 0)
+ TEST_ERROR
+
+ /* Add virtual layout mappings */
+ if(H5Pset_virtual(dcpl, vspace[0], config & TEST_IO_DIFFERENT_FILE ? srcfilename_map : ".", "src_dset1", srcspace[0]) < 0)
+ TEST_ERROR
+ if(H5Pset_virtual(dcpl, vspace[1], config & TEST_IO_DIFFERENT_FILE ? srcfilename_map : ".", "src_dset2", srcspace[0]) < 0)
+ TEST_ERROR
+
+ /* Reset dims */
+ dims[0] = 10;
+ dims[1] = 26;
+
+ /* Create virtual file */
+ if((vfile = H5Fcreate(vfilename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
+ TEST_ERROR
+
+ /* Create source file if requested */
+ if(config & TEST_IO_DIFFERENT_FILE) {
+ if((srcfile[0] = H5Fcreate(srcfilename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
+ TEST_ERROR
+ }
+ else {
+ srcfile[0] = vfile;
+ if(H5Iinc_ref(srcfile[0]) < 0)
+ TEST_ERROR
+ }
+
+ /* Create source datasets */
+ if((srcdset[0] = H5Dcreate2(srcfile[0], "src_dset1", H5T_NATIVE_INT, srcspace[0], H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ TEST_ERROR
+ if((srcdset[1] = H5Dcreate2(srcfile[0], "src_dset2", H5T_NATIVE_INT, srcspace[0], H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ TEST_ERROR
+
+ /* Create virtual dataset */
+ if((vdset = H5Dcreate2(vfile, "v_dset", H5T_NATIVE_INT, vspace[0], H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0)
+ TEST_ERROR
+
+ /* Reset erbuf */
+ HDmemset(erbuf[0], 0, sizeof(rbuf));
+
+ /* Populate write buffer */
+ for(i = 0; i < (int)(sizeof(buf) / sizeof(buf[0])); i++)
+ for(j = 0; j < (int)(sizeof(buf[0]) / sizeof(buf[0][0])); j++)
+ buf[i][j] = (i * (int)(sizeof(buf[0]) / sizeof(buf[0][0]))) + j;
+
+ /* Select hyperslab in memory */
+ start[0] = 0;
+ start[1] = 0;
+ count[0] = 4;
+ count[1] = 15;
+ if(H5Sselect_hyperslab(memspace, H5S_SELECT_SET, start, NULL, count, NULL) < 0)
+ TEST_ERROR
+
+ /* Write data directly to first source dataset */
+ if(H5Dwrite(srcdset[0], H5T_NATIVE_INT, memspace, H5S_ALL, H5P_DEFAULT, buf[0]) < 0)
+ TEST_ERROR
+
+ /* Update erbuf */
+ u = 0;
+ v = 0;
+ for(i = 2; i < 4; i++)
+ for(j = 0; j < 15; j++) {
+ erbuf[u][v] = buf[i][j];
+ v += 2;
+ if(v >= 24) {
+ u += 2;
+ v = 0;
+ }
+ }
+
+ /* Select hyperslab in memory */
+ start[0] = 4;
+ if(H5Sselect_hyperslab(memspace, H5S_SELECT_SET, start, NULL, count, NULL) < 0)
+ TEST_ERROR
+
+ /* Write data directly to second source dataset */
+ if(H5Dwrite(srcdset[1], H5T_NATIVE_INT, memspace, H5S_ALL, H5P_DEFAULT, buf[0]) < 0)
+ TEST_ERROR
+
+ /* Update erbuf */
+ for(i = 4; i < 6; i++)
+ for(j = 0; j < 15; j++) {
+ erbuf[u][v] = buf[i][j];
+ v += 2;
+ if(v >= 24) {
+ u += 2;
+ v = 0;
+ }
+ }
+
+ /* Close srcdsets and srcfile if config option specified */
+ if(config & TEST_IO_CLOSE_SRC) {
+ if(H5Dclose(srcdset[0]) < 0)
+ TEST_ERROR
+ srcdset[0] = -1;
+ if(H5Dclose(srcdset[1]) < 0)
+ TEST_ERROR
+ srcdset[1] = -1;
+ if(H5Fclose(srcfile[0]) < 0)
+ TEST_ERROR
+ srcfile[0] = -1;
+ }
+
+ /* Reopen virtual dataset and file if config option specified */
+ if(config & TEST_IO_REOPEN_VIRT) {
+ if(H5Dclose(vdset) < 0)
+ TEST_ERROR
+ vdset = -1;
+ if(H5Fclose(vfile) < 0)
+ TEST_ERROR
+ vfile = -1;
+ if((vfile = H5Fopen(vfilename, H5F_ACC_RDWR, fapl)) < 0)
+ TEST_ERROR
+ if((vdset = H5Dopen2(vfile, "v_dset", H5P_DEFAULT)) < 0)
+ TEST_ERROR
+ }
+
+ /* Select hyperslab in memory */
+ start[0] = 0;
+ start[1] = 0;
+ stride[0] = 2;
+ stride[1] = 2;
+ count[0] = 5;
+ count[1] = 12;
+ block[0] = 1;
+ block[1] = 1;
+ if(H5Sselect_hyperslab(memspace, H5S_SELECT_SET, start, stride, count, block) < 0)
+ TEST_ERROR
+
+ /* Select hyperslab in file */
+ start[0] = 2;
+ start[1] = 0;
+ count[0] = 4;
+ count[1] = 15;
+ if(H5Sselect_hyperslab(vspace[0], H5S_SELECT_SET, start, NULL, count, NULL) < 0)
+ TEST_ERROR
+
+ /* Read data through virtual dataset */
+ HDmemset(rbuf[0], 0, sizeof(rbuf));
+ if(H5Dread(vdset, H5T_NATIVE_INT, memspace, vspace[0], H5P_DEFAULT, rbuf[0]) < 0)
+ TEST_ERROR
+
+ /* Verify read data */
+ for(i = 0; i < (int)(sizeof(buf) / sizeof(buf[0])); i++)
+ for(j = 0; j < (int)(sizeof(buf[0]) / sizeof(buf[0][0])); j++)
+ if(rbuf[i][j] != erbuf[i][j])
+ TEST_ERROR
+
+ /* Close */
+ if(!(config & TEST_IO_CLOSE_SRC)) {
+ if(H5Dclose(srcdset[0]) < 0)
+ TEST_ERROR
+ srcdset[0] = -1;
+ if(H5Dclose(srcdset[1]) < 0)
+ TEST_ERROR
+ srcdset[1] = -1;
+ if(H5Fclose(srcfile[0]) < 0)
+ TEST_ERROR
+ srcfile[0] = -1;
+ }
+ if(H5Dclose(vdset) < 0)
+ TEST_ERROR
+ vdset = -1;
+ if(H5Fclose(vfile) < 0)
+ TEST_ERROR
+ vfile = -1;
+ if(H5Sclose(srcspace[0]) < 0)
+ TEST_ERROR
+ srcspace[0] = -1;
+ if(H5Sclose(vspace[0]) < 0)
+ TEST_ERROR
+ vspace[0] = -1;
+ if(H5Sclose(vspace[1]) < 0)
+ TEST_ERROR
+ vspace[1] = -1;
+ if(H5Sclose(memspace) < 0)
+ TEST_ERROR
+ memspace = -1;
+
+
+ /*
+ * Test 9: For code coverage: Horizontal block virtual mappings, and file
+ * selection, grid memory selection, 3 mappings, 3D memory space
+ */
+ /* Clear virtual layout in DCPL */
+ if(H5Pset_layout(dcpl, H5D_VIRTUAL) < 0)
+ TEST_ERROR
+
+ /* Create memory dataspace */
+ dims[1] = 13;
+ dims[2] = 2;
+ if((memspace = H5Screate_simple(3, dims, NULL)) < 0)
+ TEST_ERROR
+
+ /* Create virtual dataspaces */
+ dims[0] = 6;
+ dims[1] = 10;
+ if((vspace[0] = H5Screate_simple(2, dims, NULL)) < 0)
+ TEST_ERROR
+ if((vspace[1] = H5Screate_simple(2, dims, NULL)) < 0)
+ TEST_ERROR
+ if((vspace[2] = H5Screate_simple(2, dims, NULL)) < 0)
+ TEST_ERROR
+
+ /* Create source dataspace */
+ dims[0] = 2;
+ if((srcspace[0] = H5Screate_simple(2, dims, NULL)) < 0)
+ TEST_ERROR
+
+ /* Select all in source space (should not be necessary, but just to be sure)
+ */
+ if(H5Sselect_all(srcspace[0]) < 0)
+ TEST_ERROR
+
+ /* Select hyperslabs in virtual spaces */
+ start[0] = 0;
+ start[1] = 0;
+ if(H5Sselect_hyperslab(vspace[0], H5S_SELECT_SET, start, NULL, dims, NULL) < 0)
+ TEST_ERROR
+ start[0] = 2;
+ if(H5Sselect_hyperslab(vspace[1], H5S_SELECT_SET, start, NULL, dims, NULL) < 0)
+ TEST_ERROR
+ start[0] = 4;
+ if(H5Sselect_hyperslab(vspace[2], H5S_SELECT_SET, start, NULL, dims, NULL) < 0)
+ TEST_ERROR
+
+ /* Add virtual layout mappings */
+ if(H5Pset_virtual(dcpl, vspace[0], config & TEST_IO_DIFFERENT_FILE ? srcfilename_map : ".", "src_dset1", srcspace[0]) < 0)
+ TEST_ERROR
+ if(H5Pset_virtual(dcpl, vspace[1], config & TEST_IO_DIFFERENT_FILE ? srcfilename_map : ".", "src_dset2", srcspace[0]) < 0)
+ TEST_ERROR
+ if(H5Pset_virtual(dcpl, vspace[2], config & TEST_IO_DIFFERENT_FILE ? srcfilename_map : ".", "src_dset3", srcspace[0]) < 0)
+ TEST_ERROR
+
+ /* Reset dims */
+ dims[0] = 10;
+ dims[1] = 26;
+
+ /* Create virtual file */
+ if((vfile = H5Fcreate(vfilename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
+ TEST_ERROR
+
+ /* Create source file if requested */
+ if(config & TEST_IO_DIFFERENT_FILE) {
+ if((srcfile[0] = H5Fcreate(srcfilename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
+ TEST_ERROR
+ }
+ else {
+ srcfile[0] = vfile;
+ if(H5Iinc_ref(srcfile[0]) < 0)
+ TEST_ERROR
+ }
+
+ /* Create source datasets */
+ if((srcdset[0] = H5Dcreate2(srcfile[0], "src_dset1", H5T_NATIVE_INT, srcspace[0], H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ TEST_ERROR
+ if((srcdset[1] = H5Dcreate2(srcfile[0], "src_dset2", H5T_NATIVE_INT, srcspace[0], H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ TEST_ERROR
+ if((srcdset[2] = H5Dcreate2(srcfile[0], "src_dset3", H5T_NATIVE_INT, srcspace[0], H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ TEST_ERROR
+
+ /* Create virtual dataset */
+ if((vdset = H5Dcreate2(vfile, "v_dset", H5T_NATIVE_INT, vspace[0], H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0)
+ TEST_ERROR
+
+ /* Reset erbuf */
+ HDmemset(erbuf[0], 0, sizeof(rbuf));
+
+ /* Populate write buffer */
+ for(i = 0; i < (int)(sizeof(buf) / sizeof(buf[0])); i++)
+ for(j = 0; j < (int)(sizeof(buf[0]) / sizeof(buf[0][0])); j++)
+ buf[i][j] = (i * (int)(sizeof(buf[0]) / sizeof(buf[0][0]))) + j;
+
+ /* Select hyperslab in memory */
+ start[0] = 0;
+ start[1] = 0;
+ start[2] = 0;
+ count[0] = 2;
+ count[1] = 5;
+ count[2] = 2;
+ if(H5Sselect_hyperslab(memspace, H5S_SELECT_SET, start, NULL, count, NULL) < 0)
+ TEST_ERROR
+
+ /* Write data directly to first source dataset */
+ if(H5Dwrite(srcdset[0], H5T_NATIVE_INT, memspace, H5S_ALL, H5P_DEFAULT, buf[0]) < 0)
+ TEST_ERROR
+
+ /* Update erbuf */
+ u = 0;
+ v = 0;
+ for(i = 0; i < 2; i++)
+ for(j = 0; j < 10; j++) {
+ erbuf[u][v] = buf[i][j];
+ if(++v == 6)
+ v += 2;
+ else if(v == 14) {
+ u += 2;
+ v = 0;
+ }
+ }
+
+ /* Select hyperslab in memory */
+ start[0] = 2;
+ if(H5Sselect_hyperslab(memspace, H5S_SELECT_SET, start, NULL, count, NULL) < 0)
+ TEST_ERROR
+
+ /* Write data directly to second source dataset */
+ if(H5Dwrite(srcdset[1], H5T_NATIVE_INT, memspace, H5S_ALL, H5P_DEFAULT, buf[0]) < 0)
+ TEST_ERROR
+
+ /* Update erbuf */
+ for(i = 2; i < 4; i++)
+ for(j = 0; j < 10; j++) {
+ erbuf[u][v] = buf[i][j];
+ if(++v == 6)
+ v += 2;
+ else if(v == 14) {
+ u += 2;
+ v = 0;
+ }
+ }
+
+ /* Select hyperslab in memory */
+ start[0] = 4;
+ if(H5Sselect_hyperslab(memspace, H5S_SELECT_SET, start, NULL, count, NULL) < 0)
+ TEST_ERROR
+
+ /* Write data directly to third source dataset */
+ if(H5Dwrite(srcdset[2], H5T_NATIVE_INT, memspace, H5S_ALL, H5P_DEFAULT, buf[0]) < 0)
+ TEST_ERROR
+
+ /* Update erbuf */
+ for(i = 4; i < 6; i++)
+ for(j = 0; j < 10; j++) {
+ erbuf[u][v] = buf[i][j];
+ if(++v == 6)
+ v += 2;
+ else if(v == 14) {
+ u += 2;
+ v = 0;
+ }
+ }
+
+ /* Close srcdsets and srcfile if config option specified */
+ if(config & TEST_IO_CLOSE_SRC) {
+ if(H5Dclose(srcdset[0]) < 0)
+ TEST_ERROR
+ srcdset[0] = -1;
+ if(H5Dclose(srcdset[1]) < 0)
+ TEST_ERROR
+ srcdset[1] = -1;
+ if(H5Dclose(srcdset[2]) < 0)
+ TEST_ERROR
+ srcdset[2] = -1;
+ if(H5Fclose(srcfile[0]) < 0)
+ TEST_ERROR
+ srcfile[0] = -1;
+ }
+
+ /* Reopen virtual dataset and file if config option specified */
+ if(config & TEST_IO_REOPEN_VIRT) {
+ if(H5Dclose(vdset) < 0)
+ TEST_ERROR
+ vdset = -1;
+ if(H5Fclose(vfile) < 0)
+ TEST_ERROR
+ vfile = -1;
+ if((vfile = H5Fopen(vfilename, H5F_ACC_RDWR, fapl)) < 0)
+ TEST_ERROR
+ if((vdset = H5Dopen2(vfile, "v_dset", H5P_DEFAULT)) < 0)
+ TEST_ERROR
+ }
+
+ /* Select hyperslab in memory */
+ start[0] = 0;
+ start[1] = 0;
+ start[2] = 0;
+ stride[0] = 2;
+ stride[1] = 4;
+ stride[2] = 1;
+ count[0] = 5;
+ count[1] = 2;
+ count[2] = 1;
+ block[0] = 1;
+ block[1] = 3;
+ block[2] = 2;
+ if(H5Sselect_hyperslab(memspace, H5S_SELECT_SET, start, stride, count, block) < 0)
+ TEST_ERROR
+
+ /* Read data through virtual dataset */
+ HDmemset(rbuf[0], 0, sizeof(rbuf));
+ if(H5Dread(vdset, H5T_NATIVE_INT, memspace, H5S_ALL, H5P_DEFAULT, rbuf[0]) < 0)
+ TEST_ERROR
+
+ /* Verify read data */
+ for(i = 0; i < (int)(sizeof(buf) / sizeof(buf[0])); i++)
+ for(j = 0; j < (int)(sizeof(buf[0]) / sizeof(buf[0][0])); j++)
+ if(rbuf[i][j] != erbuf[i][j])
+ TEST_ERROR
+
+ /* Close */
+ if(!(config & TEST_IO_CLOSE_SRC)) {
+ if(H5Dclose(srcdset[0]) < 0)
+ TEST_ERROR
+ srcdset[0] = -1;
+ if(H5Dclose(srcdset[1]) < 0)
+ TEST_ERROR
+ srcdset[1] = -1;
+ if(H5Dclose(srcdset[2]) < 0)
+ TEST_ERROR
+ srcdset[2] = -1;
+ if(H5Fclose(srcfile[0]) < 0)
+ TEST_ERROR
+ srcfile[0] = -1;
+ }
+ if(H5Dclose(vdset) < 0)
+ TEST_ERROR
+ vdset = -1;
+ if(H5Fclose(vfile) < 0)
+ TEST_ERROR
+ vfile = -1;
+ if(H5Sclose(srcspace[0]) < 0)
+ TEST_ERROR
+ srcspace[0] = -1;
+ if(H5Sclose(vspace[0]) < 0)
+ TEST_ERROR
+ vspace[0] = -1;
+ if(H5Sclose(vspace[1]) < 0)
+ TEST_ERROR
+ vspace[1] = -1;
+ if(H5Sclose(vspace[2]) < 0)
+ TEST_ERROR
+ vspace[2] = -1;
+ if(H5Sclose(memspace) < 0)
+ TEST_ERROR
+ memspace = -1;
+
+
+ /*
+ * Test 10: For code coverage: Vertical stripe virtual mappings, vertical
+ * block file selection, block memory selection, 3D VDS
+ */
+ /* Clear virtual layout in DCPL */
+ if(H5Pset_layout(dcpl, H5D_VIRTUAL) < 0)
+ TEST_ERROR
+
+ /* Create memory dataspace */
+ if((memspace = H5Screate_simple(2, dims, NULL)) < 0)
+ TEST_ERROR
+
+ /* Create virtual dataspaces */
+ dims[0] = 10;
+ dims[1] = 9;
+ dims[2] = 6;
+ if((vspace[0] = H5Screate_simple(3, dims, NULL)) < 0)
+ TEST_ERROR
+ if((vspace[1] = H5Screate_simple(3, dims, NULL)) < 0)
+ TEST_ERROR
+
+ /* Create source dataspace */
+ dims[1] = 12;
+ if((srcspace[0] = H5Screate_simple(2, dims, NULL)) < 0)
+ TEST_ERROR
+
+ /* Select all in source space (should not be necessary, but just to be sure)
+ */
+ if(H5Sselect_all(srcspace[0]) < 0)
+ TEST_ERROR
+
+ /* Select hyperslabs in virtual spaces */
+ start[0] = 0;
+ start[1] = 0;
+ start[2] = 0;
+ count[0] = 1;
+ count[1] = 4;
+ count[2] = 3;
+ stride[0] = 1;
+ stride[1] = 2;
+ stride[2] = 2;
+ block[0] = 10;
+ block[1] = 1;
+ block[2] = 1;
+ if(H5Sselect_hyperslab(vspace[0], H5S_SELECT_SET, start, stride, count, block) < 0)
+ TEST_ERROR
+ start[2] = 1;
+ if(H5Sselect_hyperslab(vspace[1], H5S_SELECT_SET, start, stride, count, block) < 0)
+ TEST_ERROR
+
+ /* Add virtual layout mappings */
+ if(H5Pset_virtual(dcpl, vspace[0], config & TEST_IO_DIFFERENT_FILE ? srcfilename_map : ".", "src_dset1", srcspace[0]) < 0)
+ TEST_ERROR
+ if(H5Pset_virtual(dcpl, vspace[1], config & TEST_IO_DIFFERENT_FILE ? srcfilename_map : ".", "src_dset2", srcspace[0]) < 0)
+ TEST_ERROR
+
+ /* Reset dims */
+ dims[0] = 10;
+ dims[1] = 26;
+
+ /* Create virtual file */
+ if((vfile = H5Fcreate(vfilename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
+ TEST_ERROR
+
+ /* Create source file if requested */
+ if(config & TEST_IO_DIFFERENT_FILE) {
+ if((srcfile[0] = H5Fcreate(srcfilename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
+ TEST_ERROR
+ }
+ else {
+ srcfile[0] = vfile;
+ if(H5Iinc_ref(srcfile[0]) < 0)
+ TEST_ERROR
+ }
+
+ /* Create source datasets */
+ if((srcdset[0] = H5Dcreate2(srcfile[0], "src_dset1", H5T_NATIVE_INT, srcspace[0], H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ TEST_ERROR
+ if((srcdset[1] = H5Dcreate2(srcfile[0], "src_dset2", H5T_NATIVE_INT, srcspace[0], H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ TEST_ERROR
+
+ /* Create virtual dataset */
+ if((vdset = H5Dcreate2(vfile, "v_dset", H5T_NATIVE_INT, vspace[0], H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0)
+ TEST_ERROR
+
+ /* Initialize erbuf */
+ HDmemset(erbuf[0], 0, sizeof(rbuf));
+ for(i = 0; i < 10; i++)
+ for(j = 0; j < 24; j += 6) {
+ erbuf[i][j] = -1;
+ erbuf[i][j + 1] = -1;
+ }
+
+ /* Populate write buffer */
+ for(i = 0; i < (int)(sizeof(buf) / sizeof(buf[0])); i++)
+ for(j = 0; j < (int)(sizeof(buf[0]) / sizeof(buf[0][0])); j++)
+ buf[i][j] = (i * (int)(sizeof(buf[0]) / sizeof(buf[0][0]))) + j;
+
+ /* Select hyperslab in memory */
+ start[0] = 0;
+ start[1] = 0;
+ count[0] = 10;
+ count[1] = 12;
+ if(H5Sselect_hyperslab(memspace, H5S_SELECT_SET, start, NULL, count, NULL) < 0)
+ TEST_ERROR
+
+ /* Write data directly to first source dataset */
+ if(H5Dwrite(srcdset[0], H5T_NATIVE_INT, memspace, H5S_ALL, H5P_DEFAULT, buf[0]) < 0)
+ TEST_ERROR
+
+ /* Update erbuf */
+ u = 0;
+ v = 0;
+ for(i = 0; i < 10; i++)
+ for(j = 0; j < 8; j++) {
+ if(v == 0 || v == 12)
+ erbuf[u][v] = buf[i][j];
+ v += 2;
+ if(!(v % 6))
+ v += 6;
+ if(v >= 28) {
+ u++;
+ v = 0;
+ }
+ }
+
+ /* Select hyperslab in memory */
+ start[1] = 8;
+ if(H5Sselect_hyperslab(memspace, H5S_SELECT_SET, start, NULL, count, NULL) < 0)
+ TEST_ERROR
+
+ /* Write data directly to second source dataset */
+ if(H5Dwrite(srcdset[1], H5T_NATIVE_INT, memspace, H5S_ALL, H5P_DEFAULT, buf[0]) < 0)
+ TEST_ERROR
+
+ /* Update erbuf */
+ u = 0;
+ v = 1;
+ for(i = 0; i < 10; i++)
+ for(j = 8; j < 16; j++) {
+ if(v == 1 || v == 13)
+ erbuf[u][v] = buf[i][j];
+ v += 2;
+ if(!((v - 1) % 6))
+ v += 6;
+ if(v >= 28) {
+ u++;
+ v = 1;
+ }
+ }
+
+ /* Close srcdsets and srcfile if config option specified */
+ if(config & TEST_IO_CLOSE_SRC) {
+ if(H5Dclose(srcdset[0]) < 0)
+ TEST_ERROR
+ srcdset[0] = -1;
+ if(H5Dclose(srcdset[1]) < 0)
+ TEST_ERROR
+ srcdset[1] = -1;
+ if(H5Fclose(srcfile[0]) < 0)
+ TEST_ERROR
+ srcfile[0] = -1;
+ }
+
+ /* Reopen virtual dataset and file if config option specified */
+ if(config & TEST_IO_REOPEN_VIRT) {
+ if(H5Dclose(vdset) < 0)
+ TEST_ERROR
+ vdset = -1;
+ if(H5Fclose(vfile) < 0)
+ TEST_ERROR
+ vfile = -1;
+ if((vfile = H5Fopen(vfilename, H5F_ACC_RDWR, fapl)) < 0)
+ TEST_ERROR
+ if((vdset = H5Dopen2(vfile, "v_dset", H5P_DEFAULT)) < 0)
+ TEST_ERROR
+ }
+
+ /* Select hyperslab in memory */
+ start[0] = 0;
+ start[1] = 0;
+ stride[0] = 1;
+ stride[1] = 6;
+ count[0] = 1;
+ count[1] = 4;
+ block[0] = 10;
+ block[1] = 2;
+ if(H5Sselect_hyperslab(memspace, H5S_SELECT_SET, start, stride, count, block) < 0)
+ TEST_ERROR
+
+ /* Select hyperslab in file */
+ start[0] = 0;
+ start[1] = 0;
+ start[2] = 0;
+ count[0] = 10;
+ count[1] = 4;
+ count[2] = 2;
+ if(H5Sselect_hyperslab(vspace[0], H5S_SELECT_SET, start, NULL, count, NULL) < 0)
+ TEST_ERROR
+
+ /* Read data through virtual dataset */
+ HDmemset(rbuf[0], 0, sizeof(rbuf));
+ if(H5Dread(vdset, H5T_NATIVE_INT, memspace, vspace[0], H5P_DEFAULT, rbuf[0]) < 0)
+ TEST_ERROR
+
+ /* Verify read data */
+ for(i = 0; i < (int)(sizeof(buf) / sizeof(buf[0])); i++)
+ for(j = 0; j < (int)(sizeof(buf[0]) / sizeof(buf[0][0])); j++)
+ if(rbuf[i][j] != erbuf[i][j])
+ TEST_ERROR
+
+ /* Close */
+ if(!(config & TEST_IO_CLOSE_SRC)) {
+ if(H5Dclose(srcdset[0]) < 0)
+ TEST_ERROR
+ srcdset[0] = -1;
+ if(H5Dclose(srcdset[1]) < 0)
+ TEST_ERROR
+ srcdset[1] = -1;
+ if(H5Fclose(srcfile[0]) < 0)
+ TEST_ERROR
+ srcfile[0] = -1;
+ }
+ if(H5Dclose(vdset) < 0)
+ TEST_ERROR
+ vdset = -1;
+ if(H5Fclose(vfile) < 0)
+ TEST_ERROR
+ vfile = -1;
+ if(H5Sclose(srcspace[0]) < 0)
+ TEST_ERROR
+ srcspace[0] = -1;
+ if(H5Sclose(vspace[0]) < 0)
+ TEST_ERROR
+ vspace[0] = -1;
+ if(H5Sclose(vspace[1]) < 0)
+ TEST_ERROR
+ vspace[1] = -1;
+ if(H5Sclose(memspace) < 0)
+ TEST_ERROR
+ memspace = -1;
+
+
/* Close */
if(H5Pclose(dcpl) < 0)
TEST_ERROR
@@ -11598,6 +12130,11 @@ test_dapl_values(hid_t fapl_id)
*
* Purpose: Tests datasets with virtual layout
*
+ * Note:
+ * Tests are modified to test with the low/high bounds combination
+ * set in fapl.
+ * Please see RFC for "H5Sencode/H5Sdecode Format Change".
+ *
* Return: EXIT_SUCCESS/EXIT_FAILURE
*-------------------------------------------------------------------------
*/
@@ -11606,8 +12143,11 @@ main(void)
{
char filename[FILENAME_BUF_SIZE];
hid_t fapl;
+ hid_t my_fapl = -1; /* File access property list */
int test_api_config;
unsigned bit_config;
+ unsigned latest = FALSE; /* Using the latest library version bound */
+ H5F_libver_t low, high; /* Low and high bounds */
int nerrors = 0;
/* Testing setup */
@@ -11616,32 +12156,70 @@ main(void)
h5_fixname(FILENAME[0], fapl, filename, sizeof(filename));
- for(test_api_config = (int)TEST_API_BASIC; test_api_config < (int)TEST_API_NTESTS; test_api_config++)
- nerrors += test_api((test_api_config_t)test_api_config, fapl);
- for(bit_config = 0; bit_config < TEST_IO_NTESTS; bit_config++) {
- printf("Config: %s%s%s\n", bit_config & TEST_IO_CLOSE_SRC ? "closed source dataset, " : "", bit_config & TEST_IO_DIFFERENT_FILE ? "different source file" : "same source file", bit_config & TEST_IO_REOPEN_VIRT ? ", reopen virtual file" : "");
- nerrors += test_basic_io(bit_config, fapl);
- nerrors += test_vds_prefix(bit_config, fapl);
- nerrors += test_unlim(bit_config, fapl);
- nerrors += test_printf(bit_config, fapl);
- nerrors += test_all(bit_config, fapl);
- }
+ /* Set to use the latest file format */
+ if((my_fapl = H5Pcopy(fapl)) < 0) TEST_ERROR
+
+ /* Loop through all the combinations of low/high version bounds */
+ for(low = H5F_LIBVER_EARLIEST; low < H5F_LIBVER_NBOUNDS; low++) {
+ for(high = H5F_LIBVER_EARLIEST; high < H5F_LIBVER_NBOUNDS; high++) {
+ char msg[80]; /* Message for file version bounds */
+ char *low_string; /* The low bound string */
+ char *high_string; /* The high bound string */
+
+ /* Invalid combinations, just continue */
+ if(high == H5F_LIBVER_EARLIEST || high < low)
+ continue;
+
+ /* Test virtual dataset only for V110 and above */
+ if(high < H5F_LIBVER_V110)
+ continue;
+
+ /* Whether to use latest hyperslab/point selection version */
+ if(low >= H5F_LIBVER_V112)
+ latest = TRUE;
+
+ /* Set the low/high version bounds */
+ if(H5Pset_libver_bounds(my_fapl, low, high) < 0)
+ TEST_ERROR
+
+ /* Display testing info */
+ low_string = h5_get_version_string(low);
+ high_string = h5_get_version_string(high);
+ HDsprintf(msg, "Testing virtual dataset with file version bounds: (%s, %s):", low_string, high_string);
+ HDputs(msg);
+
+ for(test_api_config = (int)TEST_API_BASIC; test_api_config < (int)TEST_API_NTESTS; test_api_config++)
+ nerrors += test_api((test_api_config_t)test_api_config, my_fapl, low);
+ for(bit_config = 0; bit_config < TEST_IO_NTESTS; bit_config++) {
+ HDprintf("Config: %s%s%s\n", bit_config & TEST_IO_CLOSE_SRC ? "closed source dataset, " : "", bit_config & TEST_IO_DIFFERENT_FILE ? "different source file" : "same source file", bit_config & TEST_IO_REOPEN_VIRT ? ", reopen virtual file" : "");
+ nerrors += test_basic_io(bit_config, my_fapl);
+ nerrors += test_vds_prefix_first(bit_config, my_fapl);
+ nerrors += test_unlim(bit_config, my_fapl);
+ nerrors += test_printf(bit_config, my_fapl);
+ nerrors += test_all(bit_config, my_fapl);
+ }
- nerrors += test_dapl_values(fapl);
+ nerrors += test_dapl_values(my_fapl);
- /* Verify symbol table messages are cached */
- nerrors += (h5_verify_cached_stabs(FILENAME, fapl) < 0 ? 1 : 0);
+ /* Verify symbol table messages are cached */
+ nerrors += (h5_verify_cached_stabs(FILENAME, my_fapl) < 0 ? 1 : 0);
+
+ } /* end for high */
+ } /* end for low */
+
+ if(H5Pclose(my_fapl) < 0)
+ TEST_ERROR
if(nerrors)
goto error;
- printf("All virtual dataset tests passed.\n");
+ HDprintf("All virtual dataset tests passed.\n");
h5_cleanup(FILENAME, fapl);
return EXIT_SUCCESS;
error:
nerrors = MAX(1, nerrors);
- printf("***** %d VIRTUAL DATASET TEST%s FAILED! *****\n",
+ HDprintf("***** %d VIRTUAL DATASET TEST%s FAILED! *****\n",
nerrors, 1 == nerrors ? "" : "S");
return EXIT_FAILURE;
} /* end main() */
diff --git a/test/vds_env.c b/test/vds_env.c
new file mode 100644
index 0000000..abdd7b7
--- /dev/null
+++ b/test/vds_env.c
@@ -0,0 +1,364 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * 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. *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+/*
+ * Programmer: Neil Fortner <nfortne2@hdfgroup.org>
+ * Monday, February 16, 2015
+ *
+ * Purpose: Tests datasets with virtual layout.
+ */
+#include "h5test.h"
+
+const char *FILENAME[] = {
+ "vds_env_virt_0",
+ "vds_env_virt_3",
+ "vds_env_src_2",
+ "vds_env%%_src2",
+ NULL
+};
+
+/* I/O test config flags */
+#define TEST_IO_CLOSE_SRC 0x01u
+#define TEST_IO_DIFFERENT_FILE 0x02u
+#define TEST_IO_REOPEN_VIRT 0x04u
+#define TEST_IO_NTESTS 0x08u
+
+#define FILENAME_BUF_SIZE 1024
+
+#define TMPDIR "tmp/"
+
+/*-------------------------------------------------------------------------
+ * Function: test_vds_prefix_second
+ *
+ * Purpose: Set up vds link prefix via H5Pset_virtual_prefix() to be "tmp"
+ * Should be able to access the target source files in tmp directory via the prefix set
+ * by H5Pset_virtual_prefix()
+ *
+ * Return: Success: 0
+ * Failure: -1
+ *-------------------------------------------------------------------------
+ */
+static int
+test_vds_prefix_second(unsigned config, hid_t fapl)
+{
+ char srcfilename[FILENAME_BUF_SIZE];
+ char srcfilename_map[FILENAME_BUF_SIZE];
+ char vfilename[FILENAME_BUF_SIZE];
+ char vfilename2[FILENAME_BUF_SIZE];
+ char srcfilenamepct[FILENAME_BUF_SIZE];
+ char srcfilenamepct_map[FILENAME_BUF_SIZE];
+ const char *srcfilenamepct_map_orig = "vds%%%%_src";
+ hid_t srcfile[4] = {-1, -1, -1, -1}; /* Files with source dsets */
+ hid_t vfile = -1; /* File with virtual dset */
+ hid_t dcpl = -1; /* Dataset creation property list */
+ hid_t dapl = -1; /* Dataset access property list */
+ hid_t srcspace[4] = {-1, -1, -1, -1}; /* Source dataspaces */
+ hid_t vspace[4] = {-1, -1, -1, -1}; /* Virtual dset dataspaces */
+ hid_t memspace = -1; /* Memory dataspace */
+ hid_t srcdset[4] = {-1, -1, -1, -1}; /* Source datsets */
+ hid_t vdset = -1; /* Virtual dataset */
+ hsize_t dims[4] = {10, 26, 0, 0}; /* Data space current size */
+ int buf[10][26]; /* Write and expected read buffer */
+ int rbuf[10][26]; /* Read buffer */
+ int fill = -1; /* Fill value */
+ int i, j;
+ char buffer[1024]; /* buffer to read vds_prefix */
+
+ TESTING("basic virtual dataset I/O via H5Pset_vds_prefix(): all selection with ENV prefix")
+
+ h5_fixname(FILENAME[0], fapl, vfilename, sizeof vfilename);
+ h5_fixname(FILENAME[1], fapl, vfilename2, sizeof vfilename2);
+ h5_fixname(FILENAME[2], fapl, srcfilename, sizeof srcfilename);
+ h5_fixname_printf(FILENAME[2], fapl, srcfilename_map, sizeof srcfilename_map);
+ h5_fixname(FILENAME[3], fapl, srcfilenamepct, sizeof srcfilenamepct);
+ h5_fixname_printf(srcfilenamepct_map_orig, fapl, srcfilenamepct_map, sizeof srcfilenamepct_map);
+
+ /* create tmp directory and get current working directory path */
+ if (HDmkdir(TMPDIR, (mode_t)0755) < 0 && errno != EEXIST)
+ TEST_ERROR
+
+ /* Create DCPL */
+ if((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0)
+ TEST_ERROR
+
+ /* Set fill value */
+ if(H5Pset_fill_value(dcpl, H5T_NATIVE_INT, &fill) < 0)
+ TEST_ERROR
+
+ /* Set prefix to a nonexistent directory, will be overwritten by environment variable */
+ if((dapl = H5Pcreate(H5P_DATASET_ACCESS)) < 0)
+ TEST_ERROR
+
+ if(H5Pset_virtual_prefix(dapl, "someprefix") < 0)
+ TEST_ERROR
+ if(H5Pget_virtual_prefix(dapl, buffer, sizeof(buffer)) < 0)
+ TEST_ERROR
+
+ if(HDstrcmp(buffer, "someprefix") != 0)
+ FAIL_PUTS_ERROR("vds prefix not set correctly");
+
+ /* Create source dataspace */
+ if((srcspace[0] = H5Screate_simple(2, dims, NULL)) < 0)
+ TEST_ERROR
+
+ /* Create virtual dataspace */
+ if((vspace[0] = H5Screate_simple(2, dims, NULL)) < 0)
+ TEST_ERROR
+
+ /* Select all (should not be necessary, but just to be sure) */
+ if(H5Sselect_all(srcspace[0]) < 0)
+ TEST_ERROR
+ if(H5Sselect_all(vspace[0]) < 0)
+ TEST_ERROR
+
+ /* Add virtual layout mapping */
+ if(H5Pset_virtual(dcpl, vspace[0], config & TEST_IO_DIFFERENT_FILE ? srcfilename_map : ".", "src_dset", srcspace[0]) < 0)
+ TEST_ERROR
+
+ /* Create virtual file */
+ if((vfile = H5Fcreate(vfilename2, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
+ TEST_ERROR
+
+ /* Create source file if requested */
+ if(config & TEST_IO_DIFFERENT_FILE) {
+ HDgetcwd(buffer, 1024);
+ HDchdir(TMPDIR);
+ if((srcfile[0] = H5Fcreate(srcfilename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
+ TEST_ERROR
+ HDchdir(buffer);
+ }
+ else {
+ srcfile[0] = vfile;
+ if(H5Iinc_ref(srcfile[0]) < 0)
+ TEST_ERROR
+ }
+
+ /* Create source dataset */
+ if((srcdset[0] = H5Dcreate2(srcfile[0], "src_dset", H5T_NATIVE_INT, srcspace[0], H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ TEST_ERROR
+
+ /* Create virtual dataset */
+ if((vdset = H5Dcreate2(vfile, "v_dset", H5T_NATIVE_INT, vspace[0], H5P_DEFAULT, dcpl, dapl)) < 0)
+ TEST_ERROR
+
+ /* Populate write buffer */
+ for(i = 0; i < (int)(sizeof(buf) / sizeof(buf[0])); i++)
+ for(j = 0; j < (int)(sizeof(buf[0]) / sizeof(buf[0][0])); j++)
+ buf[i][j] = (i * (int)(sizeof(buf[0]) / sizeof(buf[0][0]))) + j;
+
+ /* Write data directly to source dataset */
+ if(H5Dwrite(srcdset[0], H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf[0]) < 0)
+ TEST_ERROR
+
+ /* Close srcdset and srcfile if config option specified */
+ if(config & TEST_IO_CLOSE_SRC) {
+ if(H5Dclose(srcdset[0]) < 0)
+ TEST_ERROR
+ srcdset[0] = -1;
+
+ if(config & TEST_IO_DIFFERENT_FILE) {
+ if(H5Fclose(srcfile[0]) < 0)
+ TEST_ERROR
+ srcfile[0] = -1;
+ }
+ }
+
+ /* Reopen virtual dataset and file if config option specified */
+ if(config & TEST_IO_REOPEN_VIRT) {
+ if(H5Dclose(vdset) < 0)
+ TEST_ERROR
+ vdset = -1;
+ if(H5Fclose(vfile) < 0)
+ TEST_ERROR
+ vfile = -1;
+ if((vfile = H5Fopen(vfilename2, H5F_ACC_RDWR, fapl)) < 0)
+ TEST_ERROR
+ if((vdset = H5Dopen2(vfile, "v_dset", dapl)) < 0)
+ TEST_ERROR
+ }
+
+ /* Read data through virtual dataset */
+ HDmemset(rbuf[0], 0, sizeof(rbuf));
+ if(H5Dread(vdset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, rbuf[0]) < 0)
+ TEST_ERROR
+
+ /* Verify read data */
+ for(i = 0; i < (int)(sizeof(buf) / sizeof(buf[0])); i++) {
+ for(j = 0; j < (int)(sizeof(buf[0]) / sizeof(buf[0][0])); j++)
+ if(rbuf[i][j] != buf[i][j]) {
+ TEST_ERROR
+ }
+ }
+
+ /* Adjust write buffer */
+ for(i = 0; i < (int)(sizeof(buf) / sizeof(buf[0])); i++)
+ for(j = 0; j < (int)(sizeof(buf[0]) / sizeof(buf[0][0])); j++)
+ buf[i][j] += (int)(sizeof(buf) / sizeof(buf[0][0]));
+
+ /* Write data through virtual dataset */
+ if(H5Dwrite(vdset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf[0]) < 0)
+ TEST_ERROR
+
+ /* Reopen srcdset and srcfile if config option specified */
+ if(config & TEST_IO_CLOSE_SRC) {
+ if(config & TEST_IO_DIFFERENT_FILE) {
+ HDgetcwd(buffer, 1024);
+ HDchdir(TMPDIR);
+ if((srcfile[0] = H5Fopen(srcfilename, H5F_ACC_RDONLY, fapl)) < 0)
+ TEST_ERROR
+ HDchdir(buffer);
+ }
+ if((srcdset[0] = H5Dopen2(srcfile[0], "src_dset", H5P_DEFAULT)) < 0)
+ TEST_ERROR
+ }
+
+ /* Read data directly from source dataset */
+ HDmemset(rbuf[0], 0, sizeof(rbuf));
+ if(H5Dread(srcdset[0], H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, rbuf[0]) < 0)
+ TEST_ERROR
+
+ /* Verify read data */
+ for(i = 0; i < (int)(sizeof(buf) / sizeof(buf[0])); i++)
+ for(j = 0; j < (int)(sizeof(buf[0]) / sizeof(buf[0][0])); j++)
+ if(rbuf[i][j] != buf[i][j])
+ TEST_ERROR
+
+ /* Close */
+ if(H5Dclose(vdset) < 0)
+ TEST_ERROR
+ vdset = -1;
+ if(H5Dclose(srcdset[0]) < 0)
+ TEST_ERROR
+ srcdset[0] = -1;
+ if(H5Fclose(srcfile[0]) < 0)
+ TEST_ERROR
+ srcfile[0] = -1;
+ if(H5Fclose(vfile) < 0)
+ TEST_ERROR
+ vfile = -1;
+ if(H5Sclose(srcspace[0]) < 0)
+ TEST_ERROR
+ srcspace[0] = -1;
+ if(H5Sclose(vspace[0]) < 0)
+ TEST_ERROR
+ vspace[0] = -1;
+ if(H5Pclose(dapl) < 0)
+ TEST_ERROR
+ dapl = -1;
+ if(H5Pclose(dcpl) < 0)
+ TEST_ERROR
+ dcpl = -1;
+
+ PASSED();
+ return 0;
+
+ error:
+ H5E_BEGIN_TRY {
+ for(i = 0; i < (int)(sizeof(srcdset) / sizeof(srcdset[0])); i++)
+ H5Dclose(srcdset[i]);
+ H5Dclose(vdset);
+ for(i = 0; i < (int)(sizeof(srcfile) / sizeof(srcfile[0])); i++)
+ H5Fclose(srcfile[i]);
+ H5Fclose(vfile);
+ for(i = 0; i < (int)(sizeof(srcspace) / sizeof(srcspace[0])); i++)
+ H5Sclose(srcspace[i]);
+ for(i = 0; i < (int)(sizeof(vspace) / sizeof(vspace[0])); i++)
+ H5Sclose(vspace[i]);
+ H5Sclose(memspace);
+ H5Pclose(dapl);
+ H5Pclose(dcpl);
+ } H5E_END_TRY;
+
+ return 1;
+} /* end test_vds_prefix2 */
+
+
+/*-------------------------------------------------------------------------
+ * Function: main
+ *
+ * Purpose: Tests datasets with virtual layout
+ *
+ * Return: EXIT_SUCCESS/EXIT_FAILURE
+ *-------------------------------------------------------------------------
+ */
+int
+main(void)
+{
+ hid_t fapl, my_fapl;
+ unsigned bit_config;
+ H5F_libver_t low, high; /* Low and high bounds */
+ unsigned latest = FALSE; /* Using the latest library version bound */
+ int nerrors = 0;
+
+ /* Testing setup */
+ h5_reset();
+ fapl = h5_fileaccess();
+
+ /* Set to use the latest file format */
+ if((my_fapl = H5Pcopy(fapl)) < 0) TEST_ERROR
+
+ /* Loop through all the combinations of low/high version bounds */
+ for(low = H5F_LIBVER_EARLIEST; low < H5F_LIBVER_NBOUNDS; H5_INC_ENUM(H5F_libver_t, low)) {
+ for(high = H5F_LIBVER_EARLIEST; high < H5F_LIBVER_NBOUNDS; H5_INC_ENUM(H5F_libver_t, high)) {
+ char msg[80]; /* Message for file version bounds */
+ char *low_string; /* The low bound string */
+ char *high_string; /* The high bound string */
+
+ /* Invalid combinations, just continue */
+ if(high == H5F_LIBVER_EARLIEST || high < low)
+ continue;
+
+ /* Test virtual dataset only for V110 and above */
+ if(high < H5F_LIBVER_V110)
+ continue;
+
+ /* Whether to use latest hyperslab/point selection version */
+ if(low >= H5F_LIBVER_V112)
+ latest = TRUE;
+
+ /* Set the low/high version bounds */
+ if(H5Pset_libver_bounds(my_fapl, low, high) < 0)
+ TEST_ERROR
+
+ /* Display testing info */
+ low_string = h5_get_version_string(low);
+ high_string = h5_get_version_string(high);
+ HDsprintf(msg, "Testing virtual dataset with file version bounds: (%s, %s):", low_string, high_string);
+ HDputs(msg);
+
+ for(bit_config = 0; bit_config < TEST_IO_NTESTS; bit_config++) {
+ HDprintf("Config: %s%s%s\n", bit_config & TEST_IO_CLOSE_SRC ? "closed source dataset, " : "", bit_config & TEST_IO_DIFFERENT_FILE ? "different source file" : "same source file", bit_config & TEST_IO_REOPEN_VIRT ? ", reopen virtual file" : "");
+ nerrors += test_vds_prefix_second(bit_config, fapl);
+ }
+
+ /* Verify symbol table messages are cached */
+ nerrors += (h5_verify_cached_stabs(FILENAME, my_fapl) < 0 ? 1 : 0);
+
+ } /* end for high */
+ } /* end for low */
+
+ if(H5Pclose(my_fapl) < 0)
+ TEST_ERROR
+
+ if(nerrors)
+ goto error;
+ HDprintf("All virtual dataset tests passed.\n");
+ h5_cleanup(FILENAME, fapl);
+
+ return EXIT_SUCCESS;
+
+error:
+ nerrors = MAX(1, nerrors);
+ HDprintf("***** %d VIRTUAL DATASET TEST%s FAILED! *****\n",
+ nerrors, 1 == nerrors ? "" : "S");
+ return EXIT_FAILURE;
+} /* end main() */
diff --git a/test/vfd.c b/test/vfd.c
index 19223ea..2305593 100644
--- a/test/vfd.c
+++ b/test/vfd.c
@@ -412,8 +412,8 @@ test_core(void)
for(j = 0; j < CORE_DSET_DIM2; j++)
if(*pr++ != *pw++) {
H5_FAILED();
- printf(" Read different values than written in data set.\n");
- printf(" At index %d,%d\n", i, j);
+ HDprintf(" Read different values than written in data set.\n");
+ HDprintf(" At index %d,%d\n", i, j);
TEST_ERROR;
} /* end if */
@@ -480,8 +480,8 @@ test_core(void)
for(j = 0; j < CORE_DSET_DIM2; j++)
if(*pw++ != *pr++) {
H5_FAILED();
- printf(" Read different values than written in data set.\n");
- printf(" At index %d,%d\n", i, j);
+ HDprintf(" Read different values than written in data set.\n");
+ HDprintf(" At index %d,%d\n", i, j);
TEST_ERROR;
} /* end if */
@@ -597,7 +597,7 @@ test_direct(void)
if(file<0) {
H5Pclose (fapl);
SKIPPED();
- printf(" Probably the file system doesn't support Direct I/O\n");
+ HDprintf(" Probably the file system doesn't support Direct I/O\n");
return 0;
}
@@ -674,8 +674,8 @@ test_direct(void)
for(j = 0; j < DSET1_DIM2; j++)
if(*p1++ != *p2++) {
H5_FAILED();
- printf(" Read different values than written in data set 1.\n");
- printf(" At index %d,%d\n", i, j);
+ HDprintf(" Read different values than written in data set 1.\n");
+ HDprintf(" At index %d,%d\n", i, j);
TEST_ERROR;
} /* end if */
@@ -706,8 +706,8 @@ test_direct(void)
for(i = 0; i < DSET2_DIM; i++)
if(wdata2[i] != rdata2[i]) {
H5_FAILED();
- printf(" Read different values than written in data set 2.\n");
- printf(" At index %d\n", i);
+ HDprintf(" Read different values than written in data set 2.\n");
+ HDprintf(" At index %d\n", i);
TEST_ERROR;
} /* end if */
@@ -1199,19 +1199,19 @@ test_multi(void)
memb_map[H5FD_MEM_BTREE] = H5FD_MEM_BTREE;
memb_map[H5FD_MEM_GHEAP] = H5FD_MEM_GHEAP;
- sprintf(sv[H5FD_MEM_SUPER], "%%s-%c.h5", 's');
+ HDsprintf(sv[H5FD_MEM_SUPER], "%%s-%c.h5", 's');
memb_name[H5FD_MEM_SUPER] = sv[H5FD_MEM_SUPER];
memb_addr[H5FD_MEM_SUPER] = 0;
- sprintf(sv[H5FD_MEM_BTREE], "%%s-%c.h5", 'b');
+ HDsprintf(sv[H5FD_MEM_BTREE], "%%s-%c.h5", 'b');
memb_name[H5FD_MEM_BTREE] = sv[H5FD_MEM_BTREE];
memb_addr[H5FD_MEM_BTREE] = HADDR_MAX/4;
- sprintf(sv[H5FD_MEM_DRAW], "%%s-%c.h5", 'r');
+ HDsprintf(sv[H5FD_MEM_DRAW], "%%s-%c.h5", 'r');
memb_name[H5FD_MEM_DRAW] = sv[H5FD_MEM_DRAW];
memb_addr[H5FD_MEM_DRAW] = HADDR_MAX/2;
- sprintf(sv[H5FD_MEM_GHEAP], "%%s-%c.h5", 'g');
+ HDsprintf(sv[H5FD_MEM_GHEAP], "%%s-%c.h5", 'g');
memb_name[H5FD_MEM_GHEAP] = sv[H5FD_MEM_GHEAP];
memb_addr[H5FD_MEM_GHEAP] = (HADDR_MAX/4)*3;
@@ -1431,12 +1431,12 @@ test_multi_compat(void)
memb_map[H5FD_MEM_DRAW] = H5FD_MEM_DRAW;
memb_fapl[H5FD_MEM_SUPER] = H5P_DEFAULT;
- sprintf(sv[H5FD_MEM_SUPER], "%%s-%c.h5", 's');
+ HDsprintf(sv[H5FD_MEM_SUPER], "%%s-%c.h5", 's');
memb_name[H5FD_MEM_SUPER] = sv[H5FD_MEM_SUPER];
memb_addr[H5FD_MEM_SUPER] = 0;
memb_fapl[H5FD_MEM_DRAW] = H5P_DEFAULT;
- sprintf(sv[H5FD_MEM_DRAW], "%%s-%c.h5", 'r');
+ HDsprintf(sv[H5FD_MEM_DRAW], "%%s-%c.h5", 'r');
memb_name[H5FD_MEM_DRAW] = sv[H5FD_MEM_DRAW];
memb_addr[H5FD_MEM_DRAW] = HADDR_MAX/2;
@@ -1446,17 +1446,19 @@ test_multi_compat(void)
h5_fixname(FILENAME[9], fapl, newname, sizeof newname);
/* Make copy for the data file in the build directory, to protect the
- * original file in the source directory */
- sprintf(filename_s, "%s-%c.h5", MULTI_COMPAT_BASENAME, 's');
- sprintf(newname_s, "%s-%c.h5", FILENAME[9], 's');
+ * original file in the source directory
+ */
+ HDsprintf(filename_s, "%s-%c.h5", MULTI_COMPAT_BASENAME, 's');
+ HDsprintf(newname_s, "%s-%c.h5", FILENAME[9], 's');
h5_make_local_copy(filename_s, newname_s);
- sprintf(filename_r, "%s-%c.h5", MULTI_COMPAT_BASENAME, 'r');
- sprintf(newname_r, "%s-%c.h5", FILENAME[9], 'r');
+ HDsprintf(filename_r, "%s-%c.h5", MULTI_COMPAT_BASENAME, 'r');
+ HDsprintf(newname_r, "%s-%c.h5", FILENAME[9], 'r');
h5_make_local_copy(filename_r, newname_r);
/* Reopen the file for read only. Verify 1.8 library can open file
- * created with 1.6 library. */
+ * created with 1.6 library.
+ */
if((file=H5Fopen(newname, H5F_ACC_RDONLY, fapl)) < 0)
TEST_ERROR;
diff --git a/test/vol.c b/test/vol.c
index c55874a..5ff0af0 100644
--- a/test/vol.c
+++ b/test/vol.c
@@ -11,7 +11,7 @@
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/*
- * Purpose: Tests the virtual object layer (H5VL)
+ * Purpose: Tests the virtual object layer (H5VL)
*
* This is a minimal test to ensure VOL usage (setting a VOL, etc.)
* works as expected. Actual VOL functionality is tested using
@@ -49,16 +49,21 @@ static const H5VL_class_t fake_vol_g = {
0, /* capability flags */
NULL, /* initialize */
NULL, /* terminate */
- (size_t)0, /* info size */
- NULL, /* info copy */
- NULL, /* info compare */
- NULL, /* info free */
- NULL, /* info to str */
- NULL, /* str to info */
- NULL, /* get_object */
- NULL, /* get_wrap_ctx */
- NULL, /* wrap_object */
- NULL, /* free_wrap_ctx */
+ { /* info_cls */
+ (size_t)0, /* size */
+ NULL, /* copy */
+ NULL, /* compare */
+ NULL, /* free */
+ NULL, /* to_str */
+ NULL, /* from_str */
+ },
+ { /* wrap_cls */
+ NULL, /* get_object */
+ NULL, /* get_wrap_ctx */
+ NULL, /* wrap_object */
+ NULL, /* unwrap_object */
+ NULL, /* free_wrap_ctx */
+ },
{ /* attribute_cls */
NULL, /* create */
NULL, /* open */
@@ -143,50 +148,83 @@ static const H5VL_class_t fake_vol_g = {
static herr_t
test_vol_registration(void)
{
- htri_t is_registered;
- hid_t vol_id = -1, vol_id2 = -1;
+ hid_t native_id = H5I_INVALID_HID;
+ hid_t lapl_id = H5I_INVALID_HID;
+ hid_t vipl_id = H5I_INVALID_HID;
+ herr_t ret = SUCCEED;
+ htri_t is_registered = FAIL;
+ hid_t vol_id = H5I_INVALID_HID;
+ hid_t vol_id2 = H5I_INVALID_HID;
TESTING("VOL registration");
/* The test/fake VOL connector should not be registered at the start of the test */
if ((is_registered = H5VLis_connector_registered(FAKE_VOL_NAME)) < 0)
- FAIL_STACK_ERROR;
+ TEST_ERROR;
if (is_registered > 0)
- FAIL_PUTS_ERROR("native VOL connector is inappropriately registered");
+ FAIL_PUTS_ERROR("VOL connector is inappropriately registered");
+
+ /* Test registering a connector with an incorrect property list (SHOULD FAIL) */
+ if ((lapl_id = H5Pcreate(H5P_LINK_ACCESS)) < 0)
+ TEST_ERROR;
+ H5E_BEGIN_TRY {
+ vol_id = H5VLregister_connector(&fake_vol_g, lapl_id);
+ } H5E_END_TRY;
+ if (H5I_INVALID_HID != vol_id)
+ FAIL_PUTS_ERROR("should not be able to register a connector with an incorrect property list");
+ if (H5Pclose(lapl_id) < 0)
+ TEST_ERROR;
- /* Load a VOL interface */
- if ((vol_id = H5VLregister_connector(&fake_vol_g, H5P_DEFAULT)) < 0)
- FAIL_STACK_ERROR;
+ /* Load a VOL interface
+ * The vipl_id does nothing without a VOL that needs it, but we do need to
+ * test creating a property list of that class and passing it along as a
+ * smoke check.
+ */
+ if ((vipl_id = H5Pcreate(H5P_VOL_INITIALIZE)) < 0)
+ TEST_ERROR;
+ if ((vol_id = H5VLregister_connector(&fake_vol_g, vipl_id)) < 0)
+ TEST_ERROR;
+ if (H5Pclose(vipl_id) < 0)
+ TEST_ERROR;
/* The test/fake VOL connector should be registered now */
if ((is_registered = H5VLis_connector_registered(FAKE_VOL_NAME)) < 0)
- FAIL_STACK_ERROR;
+ TEST_ERROR;
if (0 == is_registered)
- FAIL_PUTS_ERROR("native VOL connector is un-registered");
+ FAIL_PUTS_ERROR("VOL connector is un-registered");
/* Re-register a VOL connector */
if ((vol_id2 = H5VLregister_connector(&fake_vol_g, H5P_DEFAULT)) < 0)
- FAIL_STACK_ERROR;
+ TEST_ERROR;
/* The test/fake VOL connector should still be registered now */
if ((is_registered = H5VLis_connector_registered(FAKE_VOL_NAME)) < 0)
- FAIL_STACK_ERROR;
+ TEST_ERROR;
if (0 == is_registered)
- FAIL_PUTS_ERROR("native VOL connector is un-registered");
+ FAIL_PUTS_ERROR("VOL connector is un-registered");
/* Unregister the second test/fake VOL ID */
if (H5VLunregister_connector(vol_id2) < 0)
- FAIL_STACK_ERROR;
+ TEST_ERROR;
/* The test/fake VOL connector should still be registered now */
if ((is_registered = H5VLis_connector_registered(FAKE_VOL_NAME)) < 0)
- FAIL_STACK_ERROR;
+ TEST_ERROR;
if (0 == is_registered)
- FAIL_PUTS_ERROR("native VOL connector is un-registered");
+ FAIL_PUTS_ERROR("VOL connector is un-registered");
/* Unregister the original test/fake VOL ID */
if (H5VLunregister_connector(vol_id) < 0)
- FAIL_STACK_ERROR;
+ TEST_ERROR;
+
+ /* Try to unregister the native VOL connector (should fail) */
+ if (H5I_INVALID_HID == (native_id = H5VLget_connector_id(H5VL_NATIVE_NAME)))
+ TEST_ERROR;
+ H5E_BEGIN_TRY {
+ ret = H5VLunregister_connector(native_id);
+ } H5E_END_TRY;
+ if (FAIL != ret)
+ FAIL_PUTS_ERROR("should not be able to unregister the native VOL connector");
PASSED();
return SUCCEED;
@@ -194,6 +232,8 @@ test_vol_registration(void)
error:
H5E_BEGIN_TRY {
H5VLunregister_connector(vol_id);
+ H5Pclose(lapl_id);
+ H5Pclose(vipl_id);
} H5E_END_TRY;
return FAIL;
@@ -218,7 +258,7 @@ test_native_vol_init(void)
/* The native VOL connector should always be registered */
if ((is_registered = H5VLis_connector_registered(H5VL_NATIVE_NAME)) < 0)
- FAIL_STACK_ERROR;
+ TEST_ERROR;
if (0 == is_registered)
FAIL_PUTS_ERROR("native VOL connector is un-registered");
@@ -276,7 +316,7 @@ test_basic_file_operation(const char *env_h5_drvr)
if(H5Pset_fclose_degree(fapl_id, H5F_CLOSE_SEMI) < 0)
TEST_ERROR;
if(H5Pset_metadata_read_attempts(fapl_id, 9) < 0)
- FAIL_STACK_ERROR
+ TEST_ERROR
/* H5Fcreate */
if ((fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl_id)) < 0)
diff --git a/testpar/CMakeLists.txt b/testpar/CMakeLists.txt
index 797cb3f..95ff0de 100644
--- a/testpar/CMakeLists.txt
+++ b/testpar/CMakeLists.txt
@@ -22,24 +22,38 @@ set (testphdf5_SOURCES
#-- Adding test for testhdf5
add_executable (testphdf5 ${testphdf5_SOURCES})
-target_include_directories(testphdf5
+target_include_directories (testphdf5
PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>"
)
-TARGET_C_PROPERTIES (testphdf5 STATIC)
-target_link_libraries (testphdf5
- PRIVATE ${HDF5_TEST_LIB_TARGET} ${HDF5_LIB_TARGET} "$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_LIBRARIES}>"
-)
+if (NOT BUILD_SHARED_LIBS)
+ TARGET_C_PROPERTIES (testphdf5 STATIC)
+ target_link_libraries (testphdf5
+ PRIVATE ${HDF5_TEST_LIB_TARGET} ${HDF5_LIB_TARGET} "$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_LIBRARIES}>"
+ )
+else ()
+ TARGET_C_PROPERTIES (testphdf5 SHARED)
+ target_link_libraries (testphdf5
+ PRIVATE ${HDF5_TEST_LIBSH_TARGET} ${HDF5_LIBSH_TARGET} "$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_LIBRARIES}>"
+ )
+endif ()
set_target_properties (testphdf5 PROPERTIES FOLDER test/par)
MACRO (ADD_H5P_EXE file)
add_executable (${file} ${HDF5_TEST_PAR_SOURCE_DIR}/${file}.c)
- target_include_directories(${file}
+ target_include_directories (${file}
PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>"
)
- TARGET_C_PROPERTIES (${file} STATIC)
- target_link_libraries (${file}
- PRIVATE ${HDF5_TEST_LIB_TARGET} ${HDF5_LIB_TARGET} "$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_LIBRARIES}>"
- )
+ if (NOT BUILD_SHARED_LIBS)
+ TARGET_C_PROPERTIES (${file} STATIC)
+ target_link_libraries (${file}
+ PRIVATE ${HDF5_TEST_LIB_TARGET} ${HDF5_LIB_TARGET} "$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_LIBRARIES}>"
+ )
+ else ()
+ TARGET_C_PROPERTIES (${file} SHARED)
+ target_link_libraries (${file}
+ PRIVATE ${HDF5_TEST_LIBSH_TARGET} ${HDF5_LIBSH_TARGET} "$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_LIBRARIES}>"
+ )
+ endif ()
set_target_properties (${file} PROPERTIES FOLDER test/par)
ENDMACRO (ADD_H5P_EXE file)
@@ -47,7 +61,7 @@ set (H5P_TESTS
t_mpi
t_bigio
t_cache
- t_cache_image
+ #t_cache_image
t_pflush1
t_pflush2
t_pread
@@ -60,8 +74,8 @@ set (H5P_TESTS
t_filters_parallel
)
-foreach (testp ${H5P_TESTS})
- ADD_H5P_EXE(${testp})
+foreach (h5_testp ${H5P_TESTS})
+ ADD_H5P_EXE(${h5_testp})
endforeach ()
include (CMakeTests.cmake)
diff --git a/testpar/CMakeTests.cmake b/testpar/CMakeTests.cmake
index a0d7f59..0702d13 100644
--- a/testpar/CMakeTests.cmake
+++ b/testpar/CMakeTests.cmake
@@ -15,17 +15,111 @@
### 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_tests
+ cchunk1
+ cchunk2
+ cchunk3
+ cchunk4
+ ecdsetw
+ eidsetw2
+ selnone
+ cngrpw-ingrpr
+ cschunkw
+ ccchunkw
+ tldsc
+ actualio
+ MC_coll_MD_read
+)
+set (SKIP_testphdf5 "")
+foreach (skiptest ${SKIP_tests})
+ set (SKIP_testphdf5 "${SKIP_testphdf5};-x;${skiptest}")
+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 (last_test)
+ set_tests_properties (MPI_TEST_testphdf5 PROPERTIES DEPENDS ${last_test})
+endif ()
+set (last_test "MPI_TEST_testphdf5")
+
+#execute the skipped tests
+foreach (skiptest ${SKIP_tests})
+ add_test (NAME MPI_TEST_testphdf5_${skiptest} COMMAND ${MPIEXEC_EXECUTABLE} ${MPIEXEC_NUMPROC_FLAG} ${MPIEXEC_MAX_NUMPROCS} ${MPIEXEC_PREFLAGS} $<TARGET_FILE:testphdf5> ${MPIEXEC_POSTFLAGS} -o ${skiptest})
+ set_tests_properties (MPI_TEST_testphdf5_${skiptest} 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 (last_test)
+ set_tests_properties (MPI_TEST_testphdf5_${skiptest} PROPERTIES DEPENDS ${last_test})
+ endif ()
+ set (last_test "MPI_TEST_testphdf5_${skiptest}")
+endforeach ()
+
+#if (HDF5_OPENMPI_VERSION_SKIP)
+# list (REMOVE_ITEM H5P_TESTS t_shapesame)
+#endif ()
+
+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
+)
+
+# 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)
-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})
+foreach (h5_testp ${H5P_TESTS})
+ add_test (NAME MPI_TEST_${h5_testp} COMMAND ${MPIEXEC_EXECUTABLE} ${MPIEXEC_NUMPROC_FLAG} ${MPIEXEC_MAX_NUMPROCS} ${MPIEXEC_PREFLAGS} $<TARGET_FILE:${h5_testp}> ${MPIEXEC_POSTFLAGS})
+ set_tests_properties (MPI_TEST_${h5_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 (last_test)
+ set_tests_properties (MPI_TEST_${h5_testp} PROPERTIES DEPENDS ${last_test})
+ endif ()
+ set (last_test "MPI_TEST_${h5_testp}")
endforeach ()
# The t_pflush1 test is hard-coded to fail.
-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)
+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)
##############################################################################
##############################################################################
diff --git a/testpar/CMakeVFDTests.cmake b/testpar/CMakeVFDTests.cmake
index b6b065f..7333c6d 100644
--- a/testpar/CMakeVFDTests.cmake
+++ b/testpar/CMakeVFDTests.cmake
@@ -33,25 +33,41 @@
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})
+ foreach (h5_test ${H5P_VFD_TESTS})
+ add_test (
+ NAME MPI_TEST_VFD-${vfdname}-${h5_test}-clear-objects
+ COMMAND ${CMAKE_COMMAND}
+ -E remove
+ ${vfdname}/${vfdname}-${h5_test}.out
+ ${vfdname}/${vfdname}-${h5_test}.out.err
+ )
add_test (
- NAME TEST_PAR_VFD-${vfdname}-${test}
+ NAME MPI_TEST_VFD-${vfdname}-${h5_test}
COMMAND "${CMAKE_COMMAND}"
- -D "TEST_PROGRAM=$<TARGET_FILE:${test}>"
+ -D "TEST_PROGRAM=$<TARGET_FILE:${h5_test}>"
-D "TEST_ARGS:STRING="
-D "TEST_VFD:STRING=${vfdname}"
-D "TEST_EXPECT=${resultcode}"
- -D "TEST_OUTPUT=${test}"
- -D "TEST_FOLDER=${PROJECT_BINARY_DIR}"
+ -D "TEST_OUTPUT=${vfdname}-${h5_test}.out"
+ -D "TEST_FOLDER=${PROJECT_BINARY_DIR}/${vfdname}"
-P "${HDF_RESOURCES_DIR}/vfdTest.cmake"
)
+ set_tests_properties (MPI_TEST_VFD-${vfdname}-${h5_test} PROPERTIES
+ DEPENDS MPI_TEST_VFD-${vfdname}-${h5_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)
+ foreach (h5_vfd ${VFD_LIST})
+ ADD_VFD_TEST (${h5_vfd} 0)
endforeach ()
diff --git a/testpar/Makefile.am b/testpar/Makefile.am
index 27c4241..da2fd36 100644
--- a/testpar/Makefile.am
+++ b/testpar/Makefile.am
@@ -42,6 +42,11 @@ testphdf5_SOURCES=testphdf5.c t_dset.c t_file.c t_file_image.c t_mdset.c \
# The tests all depend on the hdf5 library and the test library
LDADD = $(LIBH5TEST) $(LIBHDF5)
+# Test with just the native connector, with a single pass-through connector
+# and with a doubly-stacked pass-through.
+VOL_LIST = native "pass_through under_vol=0;under_info={}" \
+ "pass_through under_vol=505;under_info={under_vol=0;under_info={}}"
+
# Temporary files
# MPItest.h5 is from t_mpi
# Para*.h5 are from testphdf
diff --git a/testpar/t_cache.c b/testpar/t_cache.c
index 7488728..50e6d50 100644
--- a/testpar/t_cache.c
+++ b/testpar/t_cache.c
@@ -24,6 +24,7 @@
#include "H5ACpkg.h"
#include "H5Cpkg.h"
+#include "H5CXprivate.h"
#include "H5Fpkg.h"
#include "H5Iprivate.h"
#include "H5MFprivate.h"
@@ -7225,7 +7226,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);
}
}
@@ -7241,7 +7242,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);
}
}
@@ -7250,7 +7251,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;
@@ -7271,7 +7272,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;
@@ -7291,7 +7292,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 ) {
@@ -7301,7 +7302,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;
@@ -7322,13 +7323,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_filters_parallel.c b/testpar/t_filters_parallel.c
index 1f26e0d..76f9276 100644
--- a/testpar/t_filters_parallel.c
+++ b/testpar/t_filters_parallel.c
@@ -3683,6 +3683,8 @@ test_read_filtered_dataset_point_selection(void)
if (read_buf) HDfree(read_buf);
if (correct_buf) HDfree(correct_buf);
+ HDfree(coords);
+
VRFY((H5Dclose(dset_id) >= 0), "Dataset close succeeded");
VRFY((H5Sclose(filespace) >= 0), "File dataspace close succeeded");
VRFY((H5Sclose(memspace) >= 0), "Memory dataspace close succeeded");
@@ -5791,6 +5793,9 @@ test_write_parallel_read_serial(void)
VRFY((H5Dclose(dset_id) >= 0), "Dataset close succeeded");
VRFY((H5Fclose(file_id) >= 0), "File close succeeded");
+
+ HDfree(correct_buf);
+ HDfree(read_buf);
}
return;
@@ -5808,7 +5813,7 @@ test_write_parallel_read_serial(void)
static void
test_shrinking_growing_chunks(void)
{
- float *data = NULL;
+ double *data = NULL;
hsize_t dataset_dims[SHRINKING_GROWING_CHUNKS_DATASET_DIMS];
hsize_t chunk_dims[SHRINKING_GROWING_CHUNKS_DATASET_DIMS];
hsize_t sel_dims[SHRINKING_GROWING_CHUNKS_DATASET_DIMS];
@@ -5903,9 +5908,9 @@ test_shrinking_growing_chunks(void)
VRFY((H5Pset_dxpl_mpio(plist_id, H5FD_MPIO_COLLECTIVE) >= 0),
"Set DXPL MPIO succeeded");
- data_size = sel_dims[0] * sel_dims[1] * sizeof(*data);
+ data_size = sel_dims[0] * sel_dims[1] * sizeof(double);
- data = (float *) HDcalloc(1, data_size);
+ data = (double *) HDcalloc(1, data_size);
VRFY((NULL != data), "HDcalloc succeeded");
for (i = 0; i < SHRINKING_GROWING_CHUNKS_NLOOPS; i++) {
diff --git a/testpar/t_mdset.c b/testpar/t_mdset.c
index 16eb13c..7f75d20 100644
--- a/testpar/t_mdset.c
+++ b/testpar/t_mdset.c
@@ -838,6 +838,13 @@ void dataset_fillvalue(void)
HDfree(wdata);
}
+/* combined cngrpw and ingrpr tests because ingrpr reads file created by cngrpw. */
+void collective_group_write_independent_group_read(void)
+{
+ collective_group_write();
+ independent_group_read();
+}
+
/* Write multiple groups with a chunked dataset in each group collectively.
* These groups and datasets are for testing independent read later.
*
diff --git a/testpar/t_prop.c b/testpar/t_prop.c
index d5efa94..2eb3914 100644
--- a/testpar/t_prop.c
+++ b/testpar/t_prop.c
@@ -33,12 +33,12 @@ test_encode_decode(hid_t orig_pl, int mpi_rank, int recv_proc)
int send_size = 0;
/* first call to encode returns only the size of the buffer needed */
- ret = H5Pencode(orig_pl, NULL, &buf_size);
+ ret = H5Pencode2(orig_pl, NULL, &buf_size, H5P_DEFAULT);
VRFY((ret >= 0), "H5Pencode succeeded");
sbuf = (uint8_t *)HDmalloc(buf_size);
- ret = H5Pencode(orig_pl, sbuf, &buf_size);
+ ret = H5Pencode2(orig_pl, sbuf, &buf_size, H5P_DEFAULT);
VRFY((ret >= 0), "H5Pencode succeeded");
/* this is a temp fix to send this size_t */
diff --git a/testpar/t_pvds.c b/testpar/t_pvds.c
index a55f8f9..56463ff 100644
--- a/testpar/t_pvds.c
+++ b/testpar/t_pvds.c
@@ -524,11 +524,11 @@ test_api_get_ex_dcpl(test_api_config_t config, hid_t fapl, hid_t dcpl,
size_t plist_buf_size;
/* Encode property list to plist_buf */
- if(H5Pencode(dcpl, NULL, &plist_buf_size) < 0)
+ if(H5Pencode2(dcpl, NULL, &plist_buf_size, H5P_DEFAULT) < 0)
TEST_ERROR
if(NULL == (plist_buf = HDmalloc(plist_buf_size)))
TEST_ERROR
- if(H5Pencode(dcpl, plist_buf, &plist_buf_size) < 0)
+ if(H5Pencode2(dcpl, plist_buf, &plist_buf_size, H5P_DEFAULT) < 0)
TEST_ERROR
/* Decode serialized property list to *ex_dcpl */
diff --git a/testpar/t_shapesame.c b/testpar/t_shapesame.c
index eddbada..f5282bd 100644
--- a/testpar/t_shapesame.c
+++ b/testpar/t_shapesame.c
@@ -948,9 +948,9 @@ contig_hs_dr_pio_test__d2m_l2s(struct hs_dr_pio_test_vars_t * tv_ptr)
/* verify that H5S_select_shape_same() reports the two
* selections as having the same shape.
*/
- check = H5S_select_shape_same_test(tv_ptr->small_ds_slice_sid,
+ check = H5S__select_shape_same_test(tv_ptr->small_ds_slice_sid,
tv_ptr->file_large_ds_sid_0);
- VRFY((check == TRUE), "H5S_select_shape_same_test passed");
+ VRFY((check == TRUE), "H5S__select_shape_same_test passed");
/* Read selection from disk */
@@ -1216,9 +1216,9 @@ contig_hs_dr_pio_test__d2m_s2l(struct hs_dr_pio_test_vars_t * tv_ptr)
/* verify that H5S_select_shape_same() reports the two
* selections as having the same shape.
*/
- check = H5S_select_shape_same_test(tv_ptr->file_small_ds_sid_0,
+ check = H5S__select_shape_same_test(tv_ptr->file_small_ds_sid_0,
tv_ptr->mem_large_ds_sid);
- VRFY((check == TRUE), "H5S_select_shape_same_test passed");
+ VRFY((check == TRUE), "H5S__select_shape_same_test passed");
/* Read selection from disk */
@@ -1531,9 +1531,9 @@ contig_hs_dr_pio_test__m2d_l2s(struct hs_dr_pio_test_vars_t * tv_ptr)
* memory slice through the cube selection and the
* on disk full square selections as having the same shape.
*/
- check = H5S_select_shape_same_test(tv_ptr->file_small_ds_sid_0,
+ check = H5S__select_shape_same_test(tv_ptr->file_small_ds_sid_0,
tv_ptr->mem_large_ds_sid);
- VRFY((check == TRUE), "H5S_select_shape_same_test passed.");
+ VRFY((check == TRUE), "H5S__select_shape_same_test passed.");
/* write the slice from the in memory large data set to the
@@ -1864,9 +1864,9 @@ contig_hs_dr_pio_test__m2d_s2l(struct hs_dr_pio_test_vars_t * tv_ptr)
* on disk slice through the large data set selection
* as having the same shape.
*/
- check = H5S_select_shape_same_test(tv_ptr->mem_small_ds_sid,
+ check = H5S__select_shape_same_test(tv_ptr->mem_small_ds_sid,
tv_ptr->file_large_ds_sid_0);
- VRFY((check == TRUE), "H5S_select_shape_same_test passed");
+ VRFY((check == TRUE), "H5S__select_shape_same_test passed");
/* write the small data set slice from memory to the
@@ -3149,9 +3149,9 @@ ckrbrd_hs_dr_pio_test__d2m_l2s(struct hs_dr_pio_test_vars_t * tv_ptr)
/* verify that H5S_select_shape_same() reports the two
* selections as having the same shape.
*/
- check = H5S_select_shape_same_test(tv_ptr->small_ds_slice_sid,
+ check = H5S__select_shape_same_test(tv_ptr->small_ds_slice_sid,
tv_ptr->file_large_ds_sid_0);
- VRFY((check == TRUE), "H5S_select_shape_same_test passed");
+ VRFY((check == TRUE), "H5S__select_shape_same_test passed");
/* Read selection from disk */
@@ -3415,9 +3415,9 @@ ckrbrd_hs_dr_pio_test__d2m_s2l(struct hs_dr_pio_test_vars_t * tv_ptr)
/* verify that H5S_select_shape_same() reports the two
* selections as having the same shape.
*/
- check = H5S_select_shape_same_test(tv_ptr->file_small_ds_sid_0,
+ check = H5S__select_shape_same_test(tv_ptr->file_small_ds_sid_0,
tv_ptr->mem_large_ds_sid);
- VRFY((check == TRUE), "H5S_select_shape_same_test passed");
+ VRFY((check == TRUE), "H5S__select_shape_same_test passed");
/* Read selection from disk */
@@ -3800,9 +3800,9 @@ ckrbrd_hs_dr_pio_test__m2d_l2s(struct hs_dr_pio_test_vars_t * tv_ptr)
* large dataset and the checkerboard selection of the process
* slice of the small data set as having the same shape.
*/
- check = H5S_select_shape_same_test(tv_ptr->file_small_ds_sid_1,
+ check = H5S__select_shape_same_test(tv_ptr->file_small_ds_sid_1,
tv_ptr->mem_large_ds_sid);
- VRFY((check == TRUE), "H5S_select_shape_same_test passed.");
+ VRFY((check == TRUE), "H5S__select_shape_same_test passed.");
/* write the checker board selection of the slice from the in
@@ -4155,9 +4155,9 @@ ckrbrd_hs_dr_pio_test__m2d_s2l(struct hs_dr_pio_test_vars_t * tv_ptr)
* on disk slice through the large data set selection
* as having the same shape.
*/
- check = H5S_select_shape_same_test(tv_ptr->mem_small_ds_sid,
+ check = H5S__select_shape_same_test(tv_ptr->mem_small_ds_sid,
tv_ptr->file_large_ds_sid_1);
- VRFY((check == TRUE), "H5S_select_shape_same_test passed");
+ VRFY((check == TRUE), "H5S__select_shape_same_test passed");
/* write the small data set slice from memory to the
diff --git a/testpar/t_span_tree.c b/testpar/t_span_tree.c
index 02d2cca..cc79af2 100644
--- a/testpar/t_span_tree.c
+++ b/testpar/t_span_tree.c
@@ -2334,9 +2334,9 @@ lower_dim_size_comp_test__run_test(const int chunk_edge_size,
/* verify that H5S_select_shape_same() reports the two
* selections as having the same shape.
*/
- check = H5S_select_shape_same_test(mem_large_ds_sid,
+ check = H5S__select_shape_same_test(mem_large_ds_sid,
file_small_ds_sid);
- VRFY((check == TRUE), "H5S_select_shape_same_test passed (1)");
+ VRFY((check == TRUE), "H5S__select_shape_same_test passed (1)");
ret = H5Dread(small_dataset,
@@ -2455,9 +2455,9 @@ lower_dim_size_comp_test__run_test(const int chunk_edge_size,
/* verify that H5S_select_shape_same() reports the two
* selections as having the same shape.
*/
- check = H5S_select_shape_same_test(mem_small_ds_sid,
+ check = H5S__select_shape_same_test(mem_small_ds_sid,
file_large_ds_sid);
- VRFY((check == TRUE), "H5S_select_shape_same_test passed (2)");
+ VRFY((check == TRUE), "H5S__select_shape_same_test passed (2)");
ret = H5Dread(large_dataset,
@@ -2622,31 +2622,27 @@ void
lower_dim_size_comp_test(void)
{
/* const char *fcnName = "lower_dim_size_comp_test()"; */
- int chunk_edge_size = 0;
- int use_collective_io = 1;
- hid_t dset_type = H5T_NATIVE_UINT;
+ int chunk_edge_size = 0;
+ int use_collective_io;
+
#if 0
HDsleep(60);
#endif
- HDcompile_assert(sizeof(uint32_t) == sizeof(unsigned));
- for ( use_collective_io = (hbool_t)0;
- (int)use_collective_io <= 1;
- (hbool_t)(use_collective_io++) ) {
+ HDcompile_assert(sizeof(uint32_t) == sizeof(unsigned));
+ for(use_collective_io = 0; use_collective_io <= 1; use_collective_io++) {
chunk_edge_size = 0;
lower_dim_size_comp_test__run_test(chunk_edge_size,
(hbool_t)use_collective_io,
- dset_type);
-
+ H5T_NATIVE_UINT);
chunk_edge_size = 5;
lower_dim_size_comp_test__run_test(chunk_edge_size,
(hbool_t)use_collective_io,
- dset_type);
- }
+ H5T_NATIVE_UINT);
+ } /* end for */
return;
-
} /* lower_dim_size_comp_test() */
diff --git a/testpar/testphdf5.c b/testpar/testphdf5.c
index 69b66ae..e1ccbed 100644
--- a/testpar/testphdf5.c
+++ b/testpar/testphdf5.c
@@ -26,15 +26,15 @@ int dim0;
int dim1;
int chunkdim0;
int chunkdim1;
-int nerrors = 0; /* errors count */
-int ndatasets = 300; /* number of datasets to create*/
+int nerrors = 0; /* errors count */
+int ndatasets = 300; /* number of datasets to create*/
int ngroups = 512; /* number of groups to create in root
* group. */
-int facc_type = FACC_MPIO; /*Test file access type */
+int facc_type = FACC_MPIO; /*Test file access type */
int dxfer_coll_type = DXFER_COLLECTIVE_IO;
-H5E_auto2_t old_func; /* previous error handler */
-void *old_client_data; /* previous error handler arg.*/
+H5E_auto2_t old_func; /* previous error handler */
+void *old_client_data; /* previous error handler arg.*/
/* other option flags */
@@ -46,10 +46,10 @@ void *old_client_data; /* previous error handler arg.*/
#define NFILENAME 2
#define PARATESTFILE filenames[0]
const char *FILENAME[NFILENAME]={
- "ParaTest",
- NULL};
-char filenames[NFILENAME][PATH_MAX];
-hid_t fapl; /* file access property list */
+ "ParaTest",
+ NULL};
+char filenames[NFILENAME][PATH_MAX];
+hid_t fapl; /* file access property list */
#ifdef USE_PAUSE
/* pause the process for a moment to allow debugger to attach if desired. */
@@ -62,7 +62,7 @@ void pause_proc(void)
{
int pid;
- h5_stat_t statbuf;
+ h5_stat_t statbuf;
char greenlight[] = "go";
int maxloop = 10;
int loops = 0;
@@ -80,14 +80,14 @@ void pause_proc(void)
if (MAINPROCESS)
while ((HDstat(greenlight, &statbuf) == -1) && loops < maxloop){
- if (!loops++){
- printf("Proc %d (%*s, %d): to debug, attach %d\n",
- mpi_rank, mpi_namelen, mpi_name, pid, pid);
- }
- printf("waiting(%ds) for file %s ...\n", time_int, greenlight);
- fflush(stdout);
+ if (!loops++){
+ printf("Proc %d (%*s, %d): to debug, attach %d\n",
+ mpi_rank, mpi_namelen, mpi_name, pid, pid);
+ }
+ printf("waiting(%ds) for file %s ...\n", time_int, greenlight);
+ fflush(stdout);
HDsleep(time_int);
- }
+ }
MPI_Barrier(MPI_COMM_WORLD);
}
@@ -99,7 +99,7 @@ int MPI_Init(int *argc, char ***argv)
pause_proc();
return (ret_code);
}
-#endif /* USE_PAUSE */
+#endif /* USE_PAUSE */
/*
@@ -109,15 +109,15 @@ static void
usage(void)
{
printf(" [-r] [-w] [-m<n_datasets>] [-n<n_groups>] "
- "[-o] [-f <prefix>] [-d <dim0> <dim1>]\n");
+ "[-o] [-f <prefix>] [-d <dim0> <dim1>]\n");
printf("\t-m<n_datasets>"
- "\tset number of datasets for the multiple dataset test\n");
+ "\tset number of datasets for the multiple dataset test\n");
printf("\t-n<n_groups>"
"\tset number of groups for the multiple group test\n");
printf("\t-f <prefix>\tfilename prefix\n");
printf("\t-2\t\tuse Split-file together with MPIO\n");
printf("\t-d <factor0> <factor1>\tdataset dimensions factors. Defaults (%d,%d)\n",
- ROW_FACTOR, COL_FACTOR);
+ ROW_FACTOR, COL_FACTOR);
printf("\t-c <dim0> <dim1>\tdataset chunk dimensions. Defaults (dim0/10,dim1/10)\n");
printf("\n");
}
@@ -129,7 +129,7 @@ usage(void)
static int
parse_options(int argc, char **argv)
{
- int mpi_size, mpi_rank; /* mpi variables */
+ int mpi_size, mpi_rank; /* mpi variables */
MPI_Comm_size(MPI_COMM_WORLD, &mpi_size);
MPI_Comm_rank(MPI_COMM_WORLD, &mpi_rank);
@@ -140,107 +140,107 @@ parse_options(int argc, char **argv)
chunkdim1 = (dim1+9)/10;
while (--argc){
- if (**(++argv) != '-'){
- break;
- }else{
- switch(*(*argv+1)){
- case 'm': ndatasets = atoi((*argv+1)+1);
- if (ndatasets < 0){
- nerrors++;
- return(1);
- }
- break;
- case 'n': ngroups = atoi((*argv+1)+1);
- if (ngroups < 0){
+ if (**(++argv) != '-'){
+ break;
+ }else{
+ switch(*(*argv+1)){
+ case 'm': ndatasets = atoi((*argv+1)+1);
+ if (ndatasets < 0){
+ nerrors++;
+ return(1);
+ }
+ break;
+ case 'n': ngroups = atoi((*argv+1)+1);
+ if (ngroups < 0){
nerrors++;
return(1);
- }
+ }
break;
- case 'f': if (--argc < 1) {
- nerrors++;
- return(1);
- }
- if (**(++argv) == '-') {
- nerrors++;
- return(1);
- }
- paraprefix = *argv;
- break;
- case 'i': /* Collective MPI-IO access with independent IO */
- dxfer_coll_type = DXFER_INDEPENDENT_IO;
- break;
- case '2': /* Use the split-file driver with MPIO access */
- /* Can use $HDF5_METAPREFIX to define the */
- /* meta-file-prefix. */
- facc_type = FACC_MPIO | FACC_SPLIT;
- break;
- case 'd': /* dimensizes */
- if (--argc < 2){
- nerrors++;
- return(1);
- }
- dim0 = atoi(*(++argv))*mpi_size;
- argc--;
- dim1 = atoi(*(++argv))*mpi_size;
- /* set default chunkdim sizes too */
- chunkdim0 = (dim0+9)/10;
- chunkdim1 = (dim1+9)/10;
- break;
- case 'c': /* chunk dimensions */
- if (--argc < 2){
- nerrors++;
- return(1);
- }
- chunkdim0 = atoi(*(++argv));
- argc--;
- chunkdim1 = atoi(*(++argv));
- break;
- case 'h': /* print help message--return with nerrors set */
- return(1);
- default: printf("Illegal option(%s)\n", *argv);
- nerrors++;
- return(1);
- }
- }
+ case 'f': if (--argc < 1) {
+ nerrors++;
+ return(1);
+ }
+ if (**(++argv) == '-') {
+ nerrors++;
+ return(1);
+ }
+ paraprefix = *argv;
+ break;
+ case 'i': /* Collective MPI-IO access with independent IO */
+ dxfer_coll_type = DXFER_INDEPENDENT_IO;
+ break;
+ case '2': /* Use the split-file driver with MPIO access */
+ /* Can use $HDF5_METAPREFIX to define the */
+ /* meta-file-prefix. */
+ facc_type = FACC_MPIO | FACC_SPLIT;
+ break;
+ case 'd': /* dimensizes */
+ if (--argc < 2){
+ nerrors++;
+ return(1);
+ }
+ dim0 = atoi(*(++argv))*mpi_size;
+ argc--;
+ dim1 = atoi(*(++argv))*mpi_size;
+ /* set default chunkdim sizes too */
+ chunkdim0 = (dim0+9)/10;
+ chunkdim1 = (dim1+9)/10;
+ break;
+ case 'c': /* chunk dimensions */
+ if (--argc < 2){
+ nerrors++;
+ return(1);
+ }
+ chunkdim0 = atoi(*(++argv));
+ argc--;
+ chunkdim1 = atoi(*(++argv));
+ break;
+ case 'h': /* print help message--return with nerrors set */
+ return(1);
+ default: printf("Illegal option(%s)\n", *argv);
+ nerrors++;
+ return(1);
+ }
+ }
} /*while*/
/* check validity of dimension and chunk sizes */
if (dim0 <= 0 || dim1 <= 0){
- printf("Illegal dim sizes (%d, %d)\n", dim0, dim1);
- nerrors++;
- return(1);
+ printf("Illegal dim sizes (%d, %d)\n", dim0, dim1);
+ nerrors++;
+ return(1);
}
if (chunkdim0 <= 0 || chunkdim1 <= 0){
- printf("Illegal chunkdim sizes (%d, %d)\n", chunkdim0, chunkdim1);
- nerrors++;
- return(1);
+ printf("Illegal chunkdim sizes (%d, %d)\n", chunkdim0, chunkdim1);
+ nerrors++;
+ return(1);
}
/* Make sure datasets can be divided into equal portions by the processes */
if ((dim0 % mpi_size) || (dim1 % mpi_size)){
- if (MAINPROCESS)
- printf("dim0(%d) and dim1(%d) must be multiples of processes(%d)\n",
- dim0, dim1, mpi_size);
- nerrors++;
- return(1);
+ if (MAINPROCESS)
+ printf("dim0(%d) and dim1(%d) must be multiples of processes(%d)\n",
+ dim0, dim1, mpi_size);
+ nerrors++;
+ return(1);
}
/* compose the test filenames */
{
- int i, n;
-
- n = sizeof(FILENAME)/sizeof(FILENAME[0]) - 1; /* exclude the NULL */
-
- for (i=0; i < n; i++)
- if (h5_fixname(FILENAME[i],fapl,filenames[i],sizeof(filenames[i]))
- == NULL){
- printf("h5_fixname failed\n");
- nerrors++;
- return(1);
- }
- printf("Test filenames are:\n");
- for (i=0; i < n; i++)
- printf(" %s\n", filenames[i]);
+ int i, n;
+
+ n = sizeof(FILENAME)/sizeof(FILENAME[0]) - 1; /* exclude the NULL */
+
+ for (i=0; i < n; i++)
+ if (h5_fixname(FILENAME[i],fapl,filenames[i],sizeof(filenames[i]))
+ == NULL){
+ printf("h5_fixname failed\n");
+ nerrors++;
+ return(1);
+ }
+ printf("Test filenames are:\n");
+ for (i=0; i < n; i++)
+ printf(" %s\n", filenames[i]);
}
return(0);
@@ -255,7 +255,7 @@ create_faccess_plist(MPI_Comm comm, MPI_Info info, int l_facc_type)
{
hid_t ret_pl = -1;
herr_t ret; /* generic return value */
- int mpi_rank; /* mpi variables */
+ int mpi_rank; /* mpi variables */
/* need the rank for error checking macros */
MPI_Comm_rank(MPI_COMM_WORLD, &mpi_rank);
@@ -264,36 +264,36 @@ create_faccess_plist(MPI_Comm comm, MPI_Info info, int l_facc_type)
VRFY((ret_pl >= 0), "H5P_FILE_ACCESS");
if (l_facc_type == FACC_DEFAULT)
- return (ret_pl);
+ return (ret_pl);
if (l_facc_type == FACC_MPIO){
- /* set Parallel access with communicator */
- ret = H5Pset_fapl_mpio(ret_pl, comm, info);
- VRFY((ret >= 0), "");
+ /* set Parallel access with communicator */
+ ret = H5Pset_fapl_mpio(ret_pl, comm, info);
+ VRFY((ret >= 0), "");
ret = H5Pset_all_coll_metadata_ops(ret_pl, TRUE);
- VRFY((ret >= 0), "");
+ VRFY((ret >= 0), "");
ret = H5Pset_coll_metadata_write(ret_pl, TRUE);
- VRFY((ret >= 0), "");
- return(ret_pl);
+ VRFY((ret >= 0), "");
+ return(ret_pl);
}
if (l_facc_type == (FACC_MPIO | FACC_SPLIT)){
- hid_t mpio_pl;
-
- mpio_pl = H5Pcreate (H5P_FILE_ACCESS);
- VRFY((mpio_pl >= 0), "");
- /* set Parallel access with communicator */
- ret = H5Pset_fapl_mpio(mpio_pl, comm, info);
- VRFY((ret >= 0), "");
-
- /* setup file access template */
- ret_pl = H5Pcreate (H5P_FILE_ACCESS);
- VRFY((ret_pl >= 0), "");
- /* set Parallel access with communicator */
- ret = H5Pset_fapl_split(ret_pl, ".meta", mpio_pl, ".raw", mpio_pl);
- VRFY((ret >= 0), "H5Pset_fapl_split succeeded");
- H5Pclose(mpio_pl);
- return(ret_pl);
+ hid_t mpio_pl;
+
+ mpio_pl = H5Pcreate (H5P_FILE_ACCESS);
+ VRFY((mpio_pl >= 0), "");
+ /* set Parallel access with communicator */
+ ret = H5Pset_fapl_mpio(mpio_pl, comm, info);
+ VRFY((ret >= 0), "");
+
+ /* setup file access template */
+ ret_pl = H5Pcreate (H5P_FILE_ACCESS);
+ VRFY((ret_pl >= 0), "");
+ /* set Parallel access with communicator */
+ ret = H5Pset_fapl_split(ret_pl, ".meta", mpio_pl, ".raw", mpio_pl);
+ VRFY((ret >= 0), "H5Pset_fapl_split succeeded");
+ H5Pclose(mpio_pl);
+ return(ret_pl);
}
/* unknown file access types */
@@ -303,7 +303,7 @@ create_faccess_plist(MPI_Comm comm, MPI_Info info, int l_facc_type)
int main(int argc, char **argv)
{
- int mpi_size, mpi_rank; /* mpi variables */
+ int mpi_size, mpi_rank; /* mpi variables */
H5Ptest_param_t ndsets_params, ngroups_params;
H5Ptest_param_t collngroups_params;
H5Ptest_param_t io_mode_confusion_params;
@@ -323,9 +323,9 @@ int main(int argc, char **argv)
dim1 = COL_FACTOR*mpi_size;
if (MAINPROCESS){
- printf("===================================\n");
- printf("PHDF5 TESTS START\n");
- printf("===================================\n");
+ printf("===================================\n");
+ printf("PHDF5 TESTS START\n");
+ printf("===================================\n");
}
/* Attempt to turn off atexit post processing so that in case errors
@@ -334,7 +334,7 @@ int main(int argc, char **argv)
* calls. By then, MPI calls may not work.
*/
if (H5dont_atexit() < 0){
- printf("Failed to turn off atexit processing. Continue.\n");
+ printf("Failed to turn off atexit processing. Continue.\n");
};
H5open();
h5_show_hostname();
@@ -344,10 +344,10 @@ int main(int argc, char **argv)
/* Tests are generally arranged from least to most complexity... */
AddTest("mpiodup", test_fapl_mpio_dup, NULL,
- "fapl_mpio duplicate", NULL);
+ "fapl_mpio duplicate", NULL);
AddTest("split", test_split_comm_access, NULL,
- "dataset using split communicators", PARATESTFILE);
+ "dataset using split communicators", PARATESTFILE);
#ifdef PB_OUT /* temporary: disable page buffering when parallel */
AddTest("page_buffer", test_page_buffer_access, NULL,
@@ -355,64 +355,64 @@ int main(int argc, char **argv)
#endif
AddTest("props", test_file_properties, NULL,
- "Coll Metadata file property settings", PARATESTFILE);
+ "Coll Metadata file property settings", PARATESTFILE);
AddTest("idsetw", dataset_writeInd, NULL,
- "dataset independent write", PARATESTFILE);
+ "dataset independent write", PARATESTFILE);
AddTest("idsetr", dataset_readInd, NULL,
- "dataset independent read", PARATESTFILE);
+ "dataset independent read", PARATESTFILE);
AddTest("cdsetw", dataset_writeAll, NULL,
- "dataset collective write", PARATESTFILE);
+ "dataset collective write", PARATESTFILE);
AddTest("cdsetr", dataset_readAll, NULL,
- "dataset collective read", PARATESTFILE);
+ "dataset collective read", PARATESTFILE);
AddTest("eidsetw", extend_writeInd, NULL,
- "extendible dataset independent write", PARATESTFILE);
+ "extendible dataset independent write", PARATESTFILE);
AddTest("eidsetr", extend_readInd, NULL,
- "extendible dataset independent read", PARATESTFILE);
+ "extendible dataset independent read", PARATESTFILE);
AddTest("ecdsetw", extend_writeAll, NULL,
- "extendible dataset collective write", PARATESTFILE);
+ "extendible dataset collective write", PARATESTFILE);
AddTest("ecdsetr", extend_readAll, NULL,
- "extendible dataset collective read", PARATESTFILE);
+ "extendible dataset collective read", PARATESTFILE);
AddTest("eidsetw2", extend_writeInd2, NULL,
- "extendible dataset independent write #2", PARATESTFILE);
+ "extendible dataset independent write #2", PARATESTFILE);
AddTest("selnone", none_selection_chunk, NULL,
"chunked dataset with none-selection", PARATESTFILE);
AddTest("calloc", test_chunk_alloc, NULL,
"parallel extend Chunked allocation on serial file", PARATESTFILE);
AddTest("fltread", test_filter_read, NULL,
- "parallel read of dataset written serially with filters", PARATESTFILE);
+ "parallel read of dataset written serially with filters", PARATESTFILE);
#ifdef H5_HAVE_FILTER_DEFLATE
AddTest("cmpdsetr", compress_readAll, NULL,
- "compressed dataset collective read", PARATESTFILE);
+ "compressed dataset collective read", PARATESTFILE);
#endif /* H5_HAVE_FILTER_DEFLATE */
AddTest("zerodsetr", zero_dim_dset, NULL,
- "zero dim dset", PARATESTFILE);
+ "zero dim dset", PARATESTFILE);
ndsets_params.name = PARATESTFILE;
ndsets_params.count = ndatasets;
AddTest("ndsetw", multiple_dset_write, NULL,
- "multiple datasets write", &ndsets_params);
+ "multiple datasets write", &ndsets_params);
ngroups_params.name = PARATESTFILE;
ngroups_params.count = ngroups;
AddTest("ngrpw", multiple_group_write, NULL,
- "multiple groups write", &ngroups_params);
+ "multiple groups write", &ngroups_params);
AddTest("ngrpr", multiple_group_read, NULL,
- "multiple groups read", &ngroups_params);
+ "multiple groups read", &ngroups_params);
AddTest("compact", compact_dataset, NULL,
- "compact dataset test", PARATESTFILE);
+ "compact dataset test", PARATESTFILE);
collngroups_params.name = PARATESTFILE;
collngroups_params.count = ngroups;
- AddTest("cngrpw", collective_group_write, NULL,
- "collective group and dataset write", &collngroups_params);
- AddTest("ingrpr", independent_group_read, NULL,
- "independent group and dataset read", &collngroups_params);
+ /* combined cngrpw and ingrpr tests because ingrpr reads file created by cngrpw. */
+ AddTest("cngrpw-ingrpr", collective_group_write_independent_group_read, NULL,
+ "collective grp/dset write - independent grp/dset read",
+ &collngroups_params);
#ifndef H5_HAVE_WIN32_API
AddTest("bigdset", big_dataset, NULL,
"big dataset test", PARATESTFILE);
@@ -420,71 +420,71 @@ int main(int argc, char **argv)
printf("big dataset test will be skipped on Windows (JIRA HDDFV-8064)\n");
#endif
AddTest("fill", dataset_fillvalue, NULL,
- "dataset fill value", PARATESTFILE);
+ "dataset fill value", PARATESTFILE);
AddTest("cchunk1",
- coll_chunk1,NULL, "simple collective chunk io",PARATESTFILE);
+ coll_chunk1,NULL, "simple collective chunk io",PARATESTFILE);
AddTest("cchunk2",
- coll_chunk2,NULL, "noncontiguous collective chunk io",PARATESTFILE);
+ coll_chunk2,NULL, "noncontiguous collective chunk io",PARATESTFILE);
AddTest("cchunk3",
- coll_chunk3,NULL, "multi-chunk collective chunk io",PARATESTFILE);
+ coll_chunk3,NULL, "multi-chunk collective chunk io",PARATESTFILE);
AddTest("cchunk4",
coll_chunk4,NULL, "collective chunk io with partial non-selection ",PARATESTFILE);
if((mpi_size < 3)&& MAINPROCESS ) {
- printf("Collective chunk IO optimization APIs ");
- printf("needs at least 3 processes to participate\n");
- printf("Collective chunk IO API tests will be skipped \n");
+ printf("Collective chunk IO optimization APIs ");
+ printf("needs at least 3 processes to participate\n");
+ printf("Collective chunk IO API tests will be skipped \n");
}
AddTest((mpi_size <3)? "-cchunk5":"cchunk5" ,
coll_chunk5,NULL,
- "linked chunk collective IO without optimization",PARATESTFILE);
+ "linked chunk collective IO without optimization",PARATESTFILE);
AddTest((mpi_size < 3)? "-cchunk6" : "cchunk6",
- coll_chunk6,NULL,
- "multi-chunk collective IO with direct request",PARATESTFILE);
+ coll_chunk6,NULL,
+ "multi-chunk collective IO with direct request",PARATESTFILE);
AddTest((mpi_size < 3)? "-cchunk7" : "cchunk7",
- coll_chunk7,NULL,
- "linked chunk collective IO with optimization",PARATESTFILE);
+ coll_chunk7,NULL,
+ "linked chunk collective IO with optimization",PARATESTFILE);
AddTest((mpi_size < 3)? "-cchunk8" : "cchunk8",
- coll_chunk8,NULL,
- "linked chunk collective IO transferring to multi-chunk",PARATESTFILE);
+ coll_chunk8,NULL,
+ "linked chunk collective IO transferring to multi-chunk",PARATESTFILE);
AddTest((mpi_size < 3)? "-cchunk9" : "cchunk9",
- coll_chunk9,NULL,
- "multiple chunk collective IO with optimization",PARATESTFILE);
+ coll_chunk9,NULL,
+ "multiple chunk collective IO with optimization",PARATESTFILE);
AddTest((mpi_size < 3)? "-cchunk10" : "cchunk10",
- coll_chunk10,NULL,
- "multiple chunk collective IO transferring to independent IO",PARATESTFILE);
+ coll_chunk10,NULL,
+ "multiple chunk collective IO transferring to independent IO",PARATESTFILE);
/* irregular collective IO tests*/
AddTest("ccontw",
- coll_irregular_cont_write,NULL,
- "collective irregular contiguous write",PARATESTFILE);
+ coll_irregular_cont_write,NULL,
+ "collective irregular contiguous write",PARATESTFILE);
AddTest("ccontr",
- coll_irregular_cont_read,NULL,
- "collective irregular contiguous read",PARATESTFILE);
+ coll_irregular_cont_read,NULL,
+ "collective irregular contiguous read",PARATESTFILE);
AddTest("cschunkw",
- coll_irregular_simple_chunk_write,NULL,
- "collective irregular simple chunk write",PARATESTFILE);
+ coll_irregular_simple_chunk_write,NULL,
+ "collective irregular simple chunk write",PARATESTFILE);
AddTest("cschunkr",
- coll_irregular_simple_chunk_read,NULL,
- "collective irregular simple chunk read",PARATESTFILE);
+ coll_irregular_simple_chunk_read,NULL,
+ "collective irregular simple chunk read",PARATESTFILE);
AddTest("ccchunkw",
- coll_irregular_complex_chunk_write,NULL,
- "collective irregular complex chunk write",PARATESTFILE);
+ coll_irregular_complex_chunk_write,NULL,
+ "collective irregular complex chunk write",PARATESTFILE);
AddTest("ccchunkr",
- coll_irregular_complex_chunk_read,NULL,
- "collective irregular complex chunk read",PARATESTFILE);
+ coll_irregular_complex_chunk_read,NULL,
+ "collective irregular complex chunk read",PARATESTFILE);
AddTest("null", null_dataset, NULL,
- "null dataset test", PARATESTFILE);
+ "null dataset test", PARATESTFILE);
io_mode_confusion_params.name = PARATESTFILE;
io_mode_confusion_params.count = 0; /* value not used */
AddTest("I/Omodeconf", io_mode_confusion, NULL,
- "I/O mode confusion test -- hangs quickly on failure",
+ "I/O mode confusion test -- hangs quickly on failure",
&io_mode_confusion_params);
if((mpi_size < 3) && MAINPROCESS) {
@@ -506,12 +506,12 @@ int main(int argc, char **argv)
AddTest("tldsc",
lower_dim_size_comp_test, NULL,
- "test lower dim size comp in span tree to mpi derived type",
+ "test lower dim size comp in span tree to mpi derived type",
PARATESTFILE);
AddTest("lccio",
link_chunk_collective_io_test, NULL,
- "test mpi derived type management",
+ "test mpi derived type management",
PARATESTFILE);
AddTest("actualio", actual_io_mode_tests, NULL,
@@ -523,7 +523,7 @@ int main(int argc, char **argv)
PARATESTFILE);
AddTest("edpl", test_plist_ed, NULL,
- "encode/decode Property Lists", NULL);
+ "encode/decode Property Lists", NULL);
if((mpi_size < 2) && MAINPROCESS) {
printf("File Image Ops daisy chain test needs at least 2 processes.\n");
@@ -533,11 +533,11 @@ int main(int argc, char **argv)
"file image ops daisy chain", NULL);
if((mpi_size < 2)&& MAINPROCESS ) {
- printf("Atomicity tests need at least 2 processes to participate\n");
- printf("8 is more recommended.. Atomicity tests will be skipped \n");
+ printf("Atomicity tests need at least 2 processes to participate\n");
+ printf("8 is more recommended.. Atomicity tests will be skipped \n");
}
else if (facc_type != FACC_MPIO && MAINPROCESS) {
- printf("Atomicity tests will not work with a non MPIO VFD\n");
+ printf("Atomicity tests will not work with a non MPIO VFD\n");
}
else if(mpi_size >= 2 && facc_type == FACC_MPIO){
AddTest("atomicity", dataset_atomicity, NULL,
@@ -545,11 +545,14 @@ int main(int argc, char **argv)
}
AddTest("denseattr", test_dense_attr, NULL,
- "Store Dense Attributes", PARATESTFILE);
+ "Store Dense Attributes", PARATESTFILE);
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]);
@@ -562,9 +565,9 @@ int main(int argc, char **argv)
TestParseCmdLine(argc, argv);
if (dxfer_coll_type == DXFER_INDEPENDENT_IO && MAINPROCESS){
- printf("===================================\n"
- " Using Independent I/O with file set view to replace collective I/O \n"
- "===================================\n");
+ printf("===================================\n"
+ " Using Independent I/O with file set view to replace collective I/O \n"
+ "===================================\n");
}
@@ -589,16 +592,16 @@ int main(int argc, char **argv)
{
int temp;
MPI_Allreduce(&nerrors, &temp, 1, MPI_INT, MPI_MAX, MPI_COMM_WORLD);
- nerrors=temp;
+ nerrors=temp;
}
- if (MAINPROCESS){ /* only process 0 reports */
- printf("===================================\n");
- if (nerrors)
- printf("***PHDF5 tests detected %d errors***\n", nerrors);
- else
- printf("PHDF5 tests finished with no errors\n");
- printf("===================================\n");
+ if (MAINPROCESS){ /* only process 0 reports */
+ printf("===================================\n");
+ if (nerrors)
+ printf("***PHDF5 tests detected %d errors***\n", nerrors);
+ else
+ printf("PHDF5 tests finished with no errors\n");
+ printf("===================================\n");
}
/* close HDF5 library */
diff --git a/testpar/testphdf5.h b/testpar/testphdf5.h
index 176574e..9fece12 100644
--- a/testpar/testphdf5.h
+++ b/testpar/testphdf5.h
@@ -240,6 +240,7 @@ void test_file_properties(void);
void multiple_dset_write(void);
void multiple_group_write(void);
void multiple_group_read(void);
+void collective_group_write_independent_group_read(void);
void collective_group_write(void);
void independent_group_read(void);
void test_fapl_mpio_dup(void);
@@ -295,6 +296,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.am b/tools/Makefile.am
index b0c33ed..5877cef 100644
--- a/tools/Makefile.am
+++ b/tools/Makefile.am
@@ -19,9 +19,20 @@
include $(top_srcdir)/config/commence.am
+if BUILD_TESTS_CONDITIONAL
+ TESTSERIAL_DIR =test
+else
+ TESTSERIAL_DIR=
+endif
+
CONFIG=ordered
# All subdirectories
-SUBDIRS=lib src test
+SUBDIRS=lib src $(TESTSERIAL_DIR)
+
+# Test with just the native connector, with a single pass-through connector
+# and with a doubly-stacked pass-through.
+VOL_LIST = native "pass_through under_vol=0;under_info={}" \
+ "pass_through under_vol=505;under_info={under_vol=0;under_info={}}"
include $(top_srcdir)/config/conclude.am
diff --git a/tools/lib/CMakeLists.txt b/tools/lib/CMakeLists.txt
index 1596ea7..e9dfcaa 100644
--- a/tools/lib/CMakeLists.txt
+++ b/tools/lib/CMakeLists.txt
@@ -32,25 +32,27 @@ set (H5_TOOLS_LIB_HDRS
${HDF5_TOOLS_LIB_SOURCE_DIR}/h5diff.h
)
-add_library (${HDF5_TOOLS_LIB_TARGET} STATIC ${H5_TOOLS_LIB_SOURCES} ${H5_TOOLS_LIB_HDRS})
-target_include_directories(${HDF5_TOOLS_LIB_TARGET}
- PRIVATE "${HDF5_TOOLS_LIB_SOURCE_DIR};${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>"
- INTERFACE "$<INSTALL_INTERFACE:$<INSTALL_PREFIX>/include>"
-)
-#target_compile_definitions(${HDF5_TOOLS_LIB_TARGET} PRIVATE H5DIFF_DEBUG>)
-TARGET_C_PROPERTIES (${HDF5_TOOLS_LIB_TARGET} STATIC)
-target_link_libraries (${HDF5_TOOLS_LIB_TARGET}
- PUBLIC ${HDF5_LIB_TARGET}
- PRIVATE "$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_LIBRARIES}>"
-)
-set_global_variable (HDF5_LIBRARIES_TO_EXPORT "${HDF5_LIBRARIES_TO_EXPORT};${HDF5_TOOLS_LIB_TARGET}")
-H5_SET_LIB_OPTIONS (${HDF5_TOOLS_LIB_TARGET} ${HDF5_TOOLS_LIB_NAME} STATIC 0)
-set_target_properties (${HDF5_TOOLS_LIB_TARGET} PROPERTIES FOLDER libraries/tools)
-set (install_targets ${HDF5_TOOLS_LIB_TARGET})
+if (NOT ONLY_SHARED_LIBS)
+ add_library (${HDF5_TOOLS_LIB_TARGET} STATIC ${H5_TOOLS_LIB_SOURCES} ${H5_TOOLS_LIB_HDRS})
+ target_include_directories (${HDF5_TOOLS_LIB_TARGET}
+ PRIVATE "${HDF5_TOOLS_LIB_SOURCE_DIR};${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>"
+ INTERFACE "$<INSTALL_INTERFACE:$<INSTALL_PREFIX>/include>"
+ )
+ #target_compile_definitions(${HDF5_TOOLS_LIB_TARGET} PRIVATE H5DIFF_DEBUG>)
+ TARGET_C_PROPERTIES (${HDF5_TOOLS_LIB_TARGET} STATIC)
+ target_link_libraries (${HDF5_TOOLS_LIB_TARGET}
+ PUBLIC ${HDF5_LIB_TARGET}
+ PRIVATE "$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_LIBRARIES}>"
+ )
+ set_global_variable (HDF5_LIBRARIES_TO_EXPORT "${HDF5_LIBRARIES_TO_EXPORT};${HDF5_TOOLS_LIB_TARGET}")
+ H5_SET_LIB_OPTIONS (${HDF5_TOOLS_LIB_TARGET} ${HDF5_TOOLS_LIB_NAME} STATIC 0)
+ set_target_properties (${HDF5_TOOLS_LIB_TARGET} PROPERTIES FOLDER libraries/tools)
+ set (install_targets ${HDF5_TOOLS_LIB_TARGET})
+endif ()
if (BUILD_SHARED_LIBS)
add_library (${HDF5_TOOLS_LIBSH_TARGET} SHARED ${H5_TOOLS_LIB_SOURCES} ${H5_TOOLS_LIB_HDRS})
- target_include_directories(${HDF5_TOOLS_LIBSH_TARGET}
+ target_include_directories (${HDF5_TOOLS_LIBSH_TARGET}
PRIVATE "${HDF5_TOOLS_LIB_SOURCE_DIR};${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>"
INTERFACE "$<INSTALL_INTERFACE:$<INSTALL_PREFIX>/include>"
)
@@ -82,7 +84,9 @@ if (HDF5_EXPORTED_TARGETS)
if (BUILD_SHARED_LIBS)
INSTALL_TARGET_PDB (${HDF5_TOOLS_LIBSH_TARGET} ${HDF5_INSTALL_BIN_DIR} toolslibraries)
endif ()
- INSTALL_TARGET_PDB (${HDF5_TOOLS_LIB_TARGET} ${HDF5_INSTALL_BIN_DIR} toolslibraries)
+ if (NOT ONLY_SHARED_LIBS)
+ INSTALL_TARGET_PDB (${HDF5_TOOLS_LIB_TARGET} ${HDF5_INSTALL_BIN_DIR} toolslibraries)
+ endif ()
install (
TARGETS
diff --git a/tools/lib/h5diff.c b/tools/lib/h5diff.c
index 594bf51..3ee5393 100644
--- a/tools/lib/h5diff.c
+++ b/tools/lib/h5diff.c
@@ -1344,7 +1344,6 @@ diff_match(hid_t file1_id, const char *grp1, trav_info_t *info1,
}
#endif /* H5_HAVE_PARALLEL */
-out:
opts->err_stat = opts->err_stat | ret_value;
/* free table */
diff --git a/tools/lib/h5diff_array.c b/tools/lib/h5diff_array.c
index 9d5f062..0169131 100644
--- a/tools/lib/h5diff_array.c
+++ b/tools/lib/h5diff_array.c
@@ -783,12 +783,11 @@ static hsize_t diff_datum(
}
/* check object type */
- if (ret_value >= 0)
- if (obj1_type != obj2_type) {
- parallel_print("Different object types referenced: <%s> and <%s>", obj1, obj2);
- opts->not_cmp = 1;
- HGOTO_DONE (opts->err_stat);
- }
+ if (obj1_type != obj2_type) {
+ parallel_print("Different object types referenced: <%s> and <%s>", obj1, obj2);
+ opts->not_cmp = 1;
+ HGOTO_DONE (opts->err_stat);
+ }
if ((obj1_id = H5Rdereference2(container1_id, H5P_DEFAULT, H5R_OBJECT, _mem1)) < 0) {
opts->err_stat = 1;
diff --git a/tools/src/h5copy/CMakeLists.txt b/tools/src/h5copy/CMakeLists.txt
index 10b3f3d..85233ef 100644
--- a/tools/src/h5copy/CMakeLists.txt
+++ b/tools/src/h5copy/CMakeLists.txt
@@ -4,18 +4,20 @@ project (HDF5_TOOLS_SRC_H5COPY C)
# --------------------------------------------------------------------
# Add the h5copy and test executables
# --------------------------------------------------------------------
-add_executable (h5copy ${HDF5_TOOLS_SRC_H5COPY_SOURCE_DIR}/h5copy.c)
-target_include_directories(h5copy PRIVATE "${HDF5_TOOLS_DIR}/lib;${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>")
-TARGET_C_PROPERTIES (h5copy STATIC)
-target_link_libraries (h5copy PRIVATE ${HDF5_TOOLS_LIB_TARGET} ${HDF5_LIB_TARGET})
-set_target_properties (h5copy PROPERTIES FOLDER tools)
-set_global_variable (HDF5_UTILS_TO_EXPORT "${HDF5_UTILS_TO_EXPORT};h5copy")
+if (NOT ONLY_SHARED_LIBS)
+ add_executable (h5copy ${HDF5_TOOLS_SRC_H5COPY_SOURCE_DIR}/h5copy.c)
+ target_include_directories (h5copy PRIVATE "${HDF5_TOOLS_DIR}/lib;${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>")
+ TARGET_C_PROPERTIES (h5copy STATIC)
+ target_link_libraries (h5copy PRIVATE ${HDF5_TOOLS_LIB_TARGET} ${HDF5_LIB_TARGET})
+ set_target_properties (h5copy PROPERTIES FOLDER tools)
+ set_global_variable (HDF5_UTILS_TO_EXPORT "${HDF5_UTILS_TO_EXPORT};h5copy")
-set (H5_DEP_EXECUTABLES h5copy)
+ set (H5_DEP_EXECUTABLES h5copy)
+endif ()
if (BUILD_SHARED_LIBS)
add_executable (h5copy-shared ${HDF5_TOOLS_SRC_H5COPY_SOURCE_DIR}/h5copy.c)
- target_include_directories(h5copy-shared PRIVATE "${HDF5_TOOLS_DIR}/lib;${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>")
+ target_include_directories (h5copy-shared PRIVATE "${HDF5_TOOLS_DIR}/lib;${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>")
TARGET_C_PROPERTIES (h5copy-shared SHARED)
target_link_libraries (h5copy-shared PRIVATE ${HDF5_TOOLS_LIBSH_TARGET} ${HDF5_LIBSH_TARGET})
set_target_properties (h5copy-shared PROPERTIES FOLDER tools)
diff --git a/tools/src/h5diff/CMakeLists.txt b/tools/src/h5diff/CMakeLists.txt
index 671e6b6..96ed6ad 100644
--- a/tools/src/h5diff/CMakeLists.txt
+++ b/tools/src/h5diff/CMakeLists.txt
@@ -4,24 +4,25 @@ project (HDF5_TOOLS_SRC_H5DIFF C)
# --------------------------------------------------------------------
# Add the h5diff executables
# --------------------------------------------------------------------
-add_executable (h5diff
- ${HDF5_TOOLS_SRC_H5DIFF_SOURCE_DIR}/h5diff_common.c
- ${HDF5_TOOLS_SRC_H5DIFF_SOURCE_DIR}/h5diff_main.c
-)
-target_include_directories(h5diff PRIVATE "${HDF5_TOOLS_DIR}/lib;${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>")
-TARGET_C_PROPERTIES (h5diff STATIC)
-target_link_libraries (h5diff PRIVATE ${HDF5_TOOLS_LIB_TARGET} ${HDF5_LIB_TARGET})
-set_target_properties (h5diff PROPERTIES FOLDER tools)
-set_global_variable (HDF5_UTILS_TO_EXPORT "${HDF5_UTILS_TO_EXPORT};h5diff")
-
-set (H5_DEP_EXECUTABLES h5diff)
+if (NOT ONLY_SHARED_LIBS)
+ add_executable (h5diff
+ ${HDF5_TOOLS_SRC_H5DIFF_SOURCE_DIR}/h5diff_common.c
+ ${HDF5_TOOLS_SRC_H5DIFF_SOURCE_DIR}/h5diff_main.c
+ )
+ target_include_directories (h5diff PRIVATE "${HDF5_TOOLS_DIR}/lib;${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>")
+ TARGET_C_PROPERTIES (h5diff STATIC)
+ target_link_libraries (h5diff PRIVATE ${HDF5_TOOLS_LIB_TARGET} ${HDF5_LIB_TARGET})
+ set_target_properties (h5diff PROPERTIES FOLDER tools)
+ set_global_variable (HDF5_UTILS_TO_EXPORT "${HDF5_UTILS_TO_EXPORT};h5diff")
+ set (H5_DEP_EXECUTABLES h5diff)
+endif ()
if (BUILD_SHARED_LIBS)
add_executable (h5diff-shared
${HDF5_TOOLS_SRC_H5DIFF_SOURCE_DIR}/h5diff_common.c
${HDF5_TOOLS_SRC_H5DIFF_SOURCE_DIR}/h5diff_main.c
)
- target_include_directories(h5diff-shared PRIVATE "${HDF5_TOOLS_DIR}/lib;${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>")
+ target_include_directories (h5diff-shared PRIVATE "${HDF5_TOOLS_DIR}/lib;${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>")
TARGET_C_PROPERTIES (h5diff-shared SHARED)
target_link_libraries (h5diff-shared PRIVATE ${HDF5_TOOLS_LIBSH_TARGET} ${HDF5_LIBSH_TARGET})
set_target_properties (h5diff-shared PROPERTIES FOLDER tools)
@@ -31,15 +32,30 @@ if (BUILD_SHARED_LIBS)
endif ()
if (H5_HAVE_PARALLEL)
- add_executable (ph5diff
- ${HDF5_TOOLS_SRC_H5DIFF_SOURCE_DIR}/h5diff_common.c
- ${HDF5_TOOLS_SRC_H5DIFF_SOURCE_DIR}/ph5diff_main.c
- )
- target_include_directories(ph5diff PRIVATE "${HDF5_TOOLS_DIR}/lib;${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>")
- TARGET_C_PROPERTIES (ph5diff STATIC)
- target_link_libraries (ph5diff PRIVATE ${HDF5_TOOLS_LIB_TARGET} ${HDF5_LIB_TARGET} "$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_LIBRARIES}>")
- set_target_properties (ph5diff PROPERTIES FOLDER tools)
- set_global_variable (HDF5_UTILS_TO_EXPORT "${HDF5_UTILS_TO_EXPORT};ph5diff")
+ if (NOT ONLY_SHARED_LIBS)
+ add_executable (ph5diff
+ ${HDF5_TOOLS_SRC_H5DIFF_SOURCE_DIR}/h5diff_common.c
+ ${HDF5_TOOLS_SRC_H5DIFF_SOURCE_DIR}/ph5diff_main.c
+ )
+ target_include_directories (ph5diff PRIVATE "${HDF5_TOOLS_DIR}/lib;${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>")
+ TARGET_C_PROPERTIES (ph5diff STATIC)
+ target_link_libraries (ph5diff PRIVATE ${HDF5_TOOLS_LIB_TARGET} ${HDF5_LIB_TARGET} "$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_LIBRARIES}>")
+ set_target_properties (ph5diff PROPERTIES FOLDER tools)
+ set_global_variable (HDF5_UTILS_TO_EXPORT "${HDF5_UTILS_TO_EXPORT};ph5diff")
+ set (H5_DEP_EXECUTABLES ${H5_DEP_EXECUTABLES} ph5diff)
+ endif ()
+ if (BUILD_SHARED_LIBS)
+ add_executable (ph5diff-shared
+ ${HDF5_TOOLS_SRC_H5DIFF_SOURCE_DIR}/h5diff_common.c
+ ${HDF5_TOOLS_SRC_H5DIFF_SOURCE_DIR}/ph5diff_main.c
+ )
+ target_include_directories (ph5diff-shared PRIVATE "${HDF5_TOOLS_DIR}/lib;${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>")
+ TARGET_C_PROPERTIES (ph5diff-shared SHARED)
+ target_link_libraries (ph5diff-shared PRIVATE ${HDF5_TOOLS_LIBSH_TARGET} ${HDF5_LIBSH_TARGET} "$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_LIBRARIES}>")
+ set_target_properties (ph5diff-shared PROPERTIES FOLDER tools)
+ set_global_variable (HDF5_UTILS_TO_EXPORT "${HDF5_UTILS_TO_EXPORT};ph5diff-shared")
+ set (H5_DEP_EXECUTABLES ${H5_DEP_EXECUTABLES} ph5diff-shared)
+ endif ()
endif ()
##############################################################################
@@ -63,16 +79,4 @@ if (HDF5_EXPORTED_TARGETS)
${HDF5_EXPORTED_TARGETS}
RUNTIME DESTINATION ${HDF5_INSTALL_BIN_DIR} COMPONENT toolsapplications
)
-
- if (H5_HAVE_PARALLEL)
- #INSTALL_PROGRAM_PDB (ph5diff ${HDF5_INSTALL_BIN_DIR} toolsapplications)
-
- install (
- TARGETS
- ph5diff
- EXPORT
- ${HDF5_EXPORTED_TARGETS}
- RUNTIME DESTINATION ${HDF5_INSTALL_BIN_DIR} COMPONENT toolsapplications
- )
- endif ()
endif ()
diff --git a/tools/src/h5dump/CMakeLists.txt b/tools/src/h5dump/CMakeLists.txt
index 25166c7..383b04e 100644
--- a/tools/src/h5dump/CMakeLists.txt
+++ b/tools/src/h5dump/CMakeLists.txt
@@ -4,18 +4,20 @@ project (HDF5_TOOLS_SRC_H5DUMP C)
# --------------------------------------------------------------------
# Add the h5dump executables
# --------------------------------------------------------------------
-add_executable (h5dump
- ${HDF5_TOOLS_SRC_H5DUMP_SOURCE_DIR}/h5dump.c
- ${HDF5_TOOLS_SRC_H5DUMP_SOURCE_DIR}/h5dump_ddl.c
- ${HDF5_TOOLS_SRC_H5DUMP_SOURCE_DIR}/h5dump_xml.c
-)
-target_include_directories(h5dump PRIVATE "${HDF5_TOOLS_DIR}/lib;${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>")
-TARGET_C_PROPERTIES (h5dump STATIC)
-target_link_libraries (h5dump PRIVATE ${HDF5_TOOLS_LIB_TARGET} ${HDF5_LIB_TARGET})
-set_target_properties (h5dump PROPERTIES FOLDER tools)
-set_global_variable (HDF5_UTILS_TO_EXPORT "${HDF5_UTILS_TO_EXPORT};h5dump")
+if (NOT ONLY_SHARED_LIBS)
+ add_executable (h5dump
+ ${HDF5_TOOLS_SRC_H5DUMP_SOURCE_DIR}/h5dump.c
+ ${HDF5_TOOLS_SRC_H5DUMP_SOURCE_DIR}/h5dump_ddl.c
+ ${HDF5_TOOLS_SRC_H5DUMP_SOURCE_DIR}/h5dump_xml.c
+ )
+ target_include_directories (h5dump PRIVATE "${HDF5_TOOLS_DIR}/lib;${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>")
+ TARGET_C_PROPERTIES (h5dump STATIC)
+ target_link_libraries (h5dump PRIVATE ${HDF5_TOOLS_LIB_TARGET} ${HDF5_LIB_TARGET})
+ set_target_properties (h5dump PROPERTIES FOLDER tools)
+ set_global_variable (HDF5_UTILS_TO_EXPORT "${HDF5_UTILS_TO_EXPORT};h5dump")
-set (H5_DEP_EXECUTABLES h5dump)
+ set (H5_DEP_EXECUTABLES h5dump)
+endif ()
if (BUILD_SHARED_LIBS)
add_executable (h5dump-shared
@@ -23,7 +25,7 @@ if (BUILD_SHARED_LIBS)
${HDF5_TOOLS_SRC_H5DUMP_SOURCE_DIR}/h5dump_ddl.c
${HDF5_TOOLS_SRC_H5DUMP_SOURCE_DIR}/h5dump_xml.c
)
- target_include_directories(h5dump-shared PRIVATE "${HDF5_TOOLS_DIR}/lib;${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>")
+ target_include_directories (h5dump-shared PRIVATE "${HDF5_TOOLS_DIR}/lib;${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>")
TARGET_C_PROPERTIES (h5dump-shared SHARED)
target_link_libraries (h5dump-shared PRIVATE ${HDF5_TOOLS_LIBSH_TARGET} ${HDF5_LIBSH_TARGET})
set_target_properties (h5dump-shared PROPERTIES FOLDER tools)
diff --git a/tools/src/h5format_convert/CMakeLists.txt b/tools/src/h5format_convert/CMakeLists.txt
index 79a1316..540be8c 100644
--- a/tools/src/h5format_convert/CMakeLists.txt
+++ b/tools/src/h5format_convert/CMakeLists.txt
@@ -4,14 +4,26 @@ project (HDF5_TOOLS_SRC_H5FC C)
# --------------------------------------------------------------------
# Add the h5format_convert executables
# --------------------------------------------------------------------
-add_executable (h5format_convert ${HDF5_TOOLS_SRC_H5FC_SOURCE_DIR}/h5format_convert.c)
-target_include_directories(h5format_convert PRIVATE "${HDF5_TOOLS_DIR}/lib;${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>")
-TARGET_C_PROPERTIES (h5format_convert STATIC)
-target_link_libraries (h5format_convert PRIVATE ${HDF5_TOOLS_LIB_TARGET} ${HDF5_LIB_TARGET})
-set_target_properties (h5format_convert PROPERTIES FOLDER tools)
-set_global_variable (HDF5_UTILS_TO_EXPORT "${HDF5_UTILS_TO_EXPORT};h5format_convert")
+if (NOT ONLY_SHARED_LIBS)
+ add_executable (h5format_convert ${HDF5_TOOLS_SRC_H5FC_SOURCE_DIR}/h5format_convert.c)
+ target_include_directories (h5format_convert PRIVATE "${HDF5_TOOLS_DIR}/lib;${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>")
+ TARGET_C_PROPERTIES (h5format_convert STATIC)
+ target_link_libraries (h5format_convert PRIVATE ${HDF5_TOOLS_LIB_TARGET} ${HDF5_LIB_TARGET})
+ set_target_properties (h5format_convert PROPERTIES FOLDER tools)
+ set_global_variable (HDF5_UTILS_TO_EXPORT "${HDF5_UTILS_TO_EXPORT};h5format_convert")
-set (H5_DEP_EXECUTABLES h5format_convert)
+ set (H5_DEP_EXECUTABLES h5format_convert)
+endif ()
+if (BUILD_SHARED_LIBS)
+ add_executable (h5format_convert-shared ${HDF5_TOOLS_SRC_H5FC_SOURCE_DIR}/h5format_convert.c)
+ target_include_directories (h5format_convert-shared PRIVATE "${HDF5_TOOLS_DIR}/lib;${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>")
+ TARGET_C_PROPERTIES (h5format_convert-shared SHARED)
+ target_link_libraries (h5format_convert-shared PRIVATE ${HDF5_TOOLS_LIBSH_TARGET} ${HDF5_LIBSH_TARGET})
+ set_target_properties (h5format_convert-shared PROPERTIES FOLDER tools)
+ set_global_variable (HDF5_UTILS_TO_EXPORT "${HDF5_UTILS_TO_EXPORT};h5format_convert-shared")
+
+ set (H5_DEP_EXECUTABLES ${H5_DEP_EXECUTABLES} h5format_convert-shared)
+endif ()
##############################################################################
##############################################################################
diff --git a/tools/src/h5import/CMakeLists.txt b/tools/src/h5import/CMakeLists.txt
index 7b38420..dd7921d 100644
--- a/tools/src/h5import/CMakeLists.txt
+++ b/tools/src/h5import/CMakeLists.txt
@@ -4,15 +4,29 @@ project (HDF5_TOOLS_SRC_H5IMPORT C)
# --------------------------------------------------------------------
# Add the h5import executables
# --------------------------------------------------------------------
-add_executable (h5import ${HDF5_TOOLS_SRC_H5IMPORT_SOURCE_DIR}/h5import.c)
-target_include_directories(h5import PRIVATE "${HDF5_TOOLS_DIR}/lib;${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>")
-TARGET_C_PROPERTIES (h5import STATIC)
-target_link_libraries (h5import PRIVATE ${HDF5_TOOLS_LIB_TARGET} ${HDF5_LIB_TARGET})
-#set_target_properties (h5import PROPERTIES COMPILE_DEFINITIONS H5DEBUGIMPORT)
-set_target_properties (h5import PROPERTIES FOLDER tools)
-set_global_variable (HDF5_UTILS_TO_EXPORT "${HDF5_UTILS_TO_EXPORT};h5import")
+if (NOT ONLY_SHARED_LIBS)
+ add_executable (h5import ${HDF5_TOOLS_SRC_H5IMPORT_SOURCE_DIR}/h5import.c)
+ target_include_directories (h5import PRIVATE "${HDF5_TOOLS_DIR}/lib;${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>")
+ TARGET_C_PROPERTIES (h5import STATIC)
+ target_link_libraries (h5import PRIVATE ${HDF5_TOOLS_LIB_TARGET} ${HDF5_LIB_TARGET})
+ #set_target_properties (h5import PROPERTIES COMPILE_DEFINITIONS H5DEBUGIMPORT)
+ set_target_properties (h5import PROPERTIES FOLDER tools)
+ set_global_variable (HDF5_UTILS_TO_EXPORT "${HDF5_UTILS_TO_EXPORT};h5import")
-set (H5_DEP_EXECUTABLES h5import)
+ set (H5_DEP_EXECUTABLES h5import)
+endif ()
+
+if (BUILD_SHARED_LIBS)
+ add_executable (h5import-shared ${HDF5_TOOLS_SRC_H5IMPORT_SOURCE_DIR}/h5import.c)
+ target_include_directories (h5import-shared PRIVATE "${HDF5_TOOLS_DIR}/lib;${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>")
+ TARGET_C_PROPERTIES (h5import-shared SHARED)
+ target_link_libraries (h5import-shared PRIVATE ${HDF5_TOOLS_LIBSH_TARGET} ${HDF5_LIBSH_TARGET})
+ #set_target_properties (h5import-shared PROPERTIES COMPILE_DEFINITIONS H5DEBUGIMPORT)
+ set_target_properties (h5import-shared PROPERTIES FOLDER tools)
+ set_global_variable (HDF5_UTILS_TO_EXPORT "${HDF5_UTILS_TO_EXPORT};h5import-shared")
+
+ set (H5_DEP_EXECUTABLES ${H5_DEP_EXECUTABLES} h5import-shared)
+endif ()
##############################################################################
##############################################################################
diff --git a/tools/src/h5jam/CMakeLists.txt b/tools/src/h5jam/CMakeLists.txt
index c455b2f..f430417 100644
--- a/tools/src/h5jam/CMakeLists.txt
+++ b/tools/src/h5jam/CMakeLists.txt
@@ -4,24 +4,47 @@ project (HDF5_TOOLS_SRC_H5JAM C)
# --------------------------------------------------------------------
# Add the h5jam executables
# --------------------------------------------------------------------
-add_executable (h5jam ${HDF5_TOOLS_SRC_H5JAM_SOURCE_DIR}/h5jam.c)
-target_include_directories(h5jam PRIVATE "${HDF5_TOOLS_DIR}/lib;${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>")
-TARGET_C_PROPERTIES (h5jam STATIC)
-target_link_libraries (h5jam PRIVATE ${HDF5_TOOLS_LIB_TARGET} ${HDF5_LIB_TARGET})
-set_target_properties (h5jam PROPERTIES FOLDER tools)
-set_global_variable (HDF5_UTILS_TO_EXPORT "${HDF5_UTILS_TO_EXPORT};h5jam")
-
-add_executable (h5unjam ${HDF5_TOOLS_SRC_H5JAM_SOURCE_DIR}/h5unjam.c)
-target_include_directories(h5unjam PRIVATE "${HDF5_TOOLS_DIR}/lib;${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>")
-TARGET_C_PROPERTIES (h5unjam STATIC)
-target_link_libraries (h5unjam PRIVATE ${HDF5_TOOLS_LIB_TARGET} ${HDF5_LIB_TARGET})
-set_target_properties (h5unjam PROPERTIES FOLDER tools)
-set_global_variable (HDF5_UTILS_TO_EXPORT "${HDF5_UTILS_TO_EXPORT};h5unjam")
-
-set (H5_DEP_EXECUTABLES
- h5jam
- h5unjam
-)
+if (NOT ONLY_SHARED_LIBS)
+ add_executable (h5jam ${HDF5_TOOLS_SRC_H5JAM_SOURCE_DIR}/h5jam.c)
+ target_include_directories (h5jam PRIVATE "${HDF5_TOOLS_DIR}/lib;${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>")
+ TARGET_C_PROPERTIES (h5jam STATIC)
+ target_link_libraries (h5jam PRIVATE ${HDF5_TOOLS_LIB_TARGET} ${HDF5_LIB_TARGET})
+ set_target_properties (h5jam PROPERTIES FOLDER tools)
+ set_global_variable (HDF5_UTILS_TO_EXPORT "${HDF5_UTILS_TO_EXPORT};h5jam")
+
+ add_executable (h5unjam ${HDF5_TOOLS_SRC_H5JAM_SOURCE_DIR}/h5unjam.c)
+ target_include_directories (h5unjam PRIVATE "${HDF5_TOOLS_DIR}/lib;${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>")
+ TARGET_C_PROPERTIES (h5unjam STATIC)
+ target_link_libraries (h5unjam PRIVATE ${HDF5_TOOLS_LIB_TARGET} ${HDF5_LIB_TARGET})
+ set_target_properties (h5unjam PROPERTIES FOLDER tools)
+ set_global_variable (HDF5_UTILS_TO_EXPORT "${HDF5_UTILS_TO_EXPORT};h5unjam")
+
+ set (H5_DEP_EXECUTABLES
+ h5jam
+ h5unjam
+ )
+endif ()
+
+if (BUILD_SHARED_LIBS)
+ add_executable (h5jam-shared ${HDF5_TOOLS_SRC_H5JAM_SOURCE_DIR}/h5jam.c)
+ target_include_directories (h5jam-shared PRIVATE "${HDF5_TOOLS_DIR}/lib;${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>")
+ TARGET_C_PROPERTIES (h5jam-shared SHARED)
+ target_link_libraries (h5jam-shared PRIVATE ${HDF5_TOOLS_LIBSH_TARGET} ${HDF5_LIBSH_TARGET})
+ set_target_properties (h5jam-shared PROPERTIES FOLDER tools)
+ set_global_variable (HDF5_UTILS_TO_EXPORT "${HDF5_UTILS_TO_EXPORT};h5jam-shared")
+
+ add_executable (h5unjam-shared ${HDF5_TOOLS_SRC_H5JAM_SOURCE_DIR}/h5unjam.c)
+ target_include_directories (h5unjam-shared PRIVATE "${HDF5_TOOLS_DIR}/lib;${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>")
+ TARGET_C_PROPERTIES (h5unjam-shared SHARED)
+ target_link_libraries (h5unjam-shared PRIVATE ${HDF5_TOOLS_LIBSH_TARGET} ${HDF5_LIBSH_TARGET})
+ set_target_properties (h5unjam-shared PROPERTIES FOLDER tools)
+ set_global_variable (HDF5_UTILS_TO_EXPORT "${HDF5_UTILS_TO_EXPORT};h5unjam-shared")
+
+ set (H5_DEP_EXECUTABLES ${H5_DEP_EXECUTABLES}
+ h5jam-shared
+ h5unjam-shared
+ )
+endif ()
##############################################################################
##############################################################################
diff --git a/tools/src/h5ls/CMakeLists.txt b/tools/src/h5ls/CMakeLists.txt
index 5b31b84..f2470fb 100644
--- a/tools/src/h5ls/CMakeLists.txt
+++ b/tools/src/h5ls/CMakeLists.txt
@@ -4,18 +4,20 @@ project (HDF5_TOOLS_SRC_H5LS C)
#-----------------------------------------------------------------------------
# Add the h5ls executable
#-----------------------------------------------------------------------------
-add_executable (h5ls ${HDF5_TOOLS_SRC_H5LS_SOURCE_DIR}/h5ls.c)
-target_include_directories(h5ls PRIVATE "${HDF5_TOOLS_DIR}/lib;${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>")
-TARGET_C_PROPERTIES (h5ls STATIC)
-target_link_libraries (h5ls PRIVATE ${HDF5_TOOLS_LIB_TARGET} ${HDF5_LIB_TARGET})
-set_target_properties (h5ls PROPERTIES FOLDER tools)
-set_global_variable (HDF5_UTILS_TO_EXPORT "${HDF5_UTILS_TO_EXPORT};h5ls")
+if (NOT ONLY_SHARED_LIBS)
+ add_executable (h5ls ${HDF5_TOOLS_SRC_H5LS_SOURCE_DIR}/h5ls.c)
+ target_include_directories (h5ls PRIVATE "${HDF5_TOOLS_DIR}/lib;${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>")
+ TARGET_C_PROPERTIES (h5ls STATIC)
+ target_link_libraries (h5ls PRIVATE ${HDF5_TOOLS_LIB_TARGET} ${HDF5_LIB_TARGET})
+ set_target_properties (h5ls PROPERTIES FOLDER tools)
+ set_global_variable (HDF5_UTILS_TO_EXPORT "${HDF5_UTILS_TO_EXPORT};h5ls")
-set (H5_DEP_EXECUTABLES h5ls)
+ set (H5_DEP_EXECUTABLES h5ls)
+endif ()
if (BUILD_SHARED_LIBS)
add_executable (h5ls-shared ${HDF5_TOOLS_SRC_H5LS_SOURCE_DIR}/h5ls.c)
- target_include_directories(h5ls-shared PRIVATE "${HDF5_TOOLS_DIR}/lib;${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>")
+ target_include_directories (h5ls-shared PRIVATE "${HDF5_TOOLS_DIR}/lib;${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>")
TARGET_C_PROPERTIES (h5ls-shared SHARED)
target_link_libraries (h5ls-shared PRIVATE ${HDF5_TOOLS_LIBSH_TARGET} ${HDF5_LIBSH_TARGET})
set_target_properties (h5ls-shared PROPERTIES FOLDER tools)
diff --git a/tools/src/h5repack/CMakeLists.txt b/tools/src/h5repack/CMakeLists.txt
index c0cd558..4a1430e 100644
--- a/tools/src/h5repack/CMakeLists.txt
+++ b/tools/src/h5repack/CMakeLists.txt
@@ -14,18 +14,20 @@ set (REPACK_COMMON_SOURCES
${HDF5_TOOLS_SRC_H5REPACK_SOURCE_DIR}/h5repack.c
)
-add_executable (h5repack ${REPACK_COMMON_SOURCES} ${HDF5_TOOLS_SRC_H5REPACK_SOURCE_DIR}/h5repack_main.c)
-target_include_directories(h5repack PRIVATE "${HDF5_TOOLS_DIR}/lib;${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>")
-TARGET_C_PROPERTIES (h5repack STATIC)
-target_link_libraries (h5repack PRIVATE ${HDF5_TOOLS_LIB_TARGET} ${HDF5_LIB_TARGET})
-set_target_properties (h5repack PROPERTIES FOLDER tools)
-set_global_variable (HDF5_UTILS_TO_EXPORT "${HDF5_UTILS_TO_EXPORT};h5repack")
-
-set (H5_DEP_EXECUTABLES h5repack)
+if (NOT ONLY_SHARED_LIBS)
+ add_executable (h5repack ${REPACK_COMMON_SOURCES} ${HDF5_TOOLS_SRC_H5REPACK_SOURCE_DIR}/h5repack_main.c)
+ target_include_directories (h5repack PRIVATE "${HDF5_TOOLS_DIR}/lib;${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>")
+ TARGET_C_PROPERTIES (h5repack STATIC)
+ target_link_libraries (h5repack PRIVATE ${HDF5_TOOLS_LIB_TARGET} ${HDF5_LIB_TARGET})
+ set_target_properties (h5repack PROPERTIES FOLDER tools)
+ set_global_variable (HDF5_UTILS_TO_EXPORT "${HDF5_UTILS_TO_EXPORT};h5repack")
+
+ set (H5_DEP_EXECUTABLES h5repack)
+endif ()
if (BUILD_SHARED_LIBS)
add_executable (h5repack-shared ${REPACK_COMMON_SOURCES} ${HDF5_TOOLS_SRC_H5REPACK_SOURCE_DIR}/h5repack_main.c)
- target_include_directories(h5repack-shared PRIVATE "${HDF5_TOOLS_DIR}/lib;${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>")
+ target_include_directories (h5repack-shared PRIVATE "${HDF5_TOOLS_DIR}/lib;${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>")
TARGET_C_PROPERTIES (h5repack-shared SHARED)
target_link_libraries (h5repack-shared PRIVATE ${HDF5_TOOLS_LIBSH_TARGET} ${HDF5_LIBSH_TARGET})
set_target_properties (h5repack-shared PROPERTIES FOLDER tools)
diff --git a/tools/src/h5repack/Makefile.am b/tools/src/h5repack/Makefile.am
index c71e65b..925b8a7 100644
--- a/tools/src/h5repack/Makefile.am
+++ b/tools/src/h5repack/Makefile.am
@@ -28,7 +28,7 @@ libh5repack_la_SOURCES=h5repack.c h5repack_copy.c h5repack_filters.c \
h5repack_opttable.c h5repack_parse.c h5repack_refs.c \
h5repack_verify.c
libh5repack_la_LDFLAGS = $(AM_LDFLAGS)
-libh5repack_la_LIBADD=$(LIBH5TOOLS) $(LIBH5TEST) $(LIBHDF5)
+libh5repack_la_LIBADD=$(LIBH5TOOLS) $(LIBHDF5)
# Our main target, h5repack tool
diff --git a/tools/src/h5repack/h5repack.c b/tools/src/h5repack/h5repack.c
index a63e56f..e96dea5 100644
--- a/tools/src/h5repack/h5repack.c
+++ b/tools/src/h5repack/h5repack.c
@@ -713,7 +713,7 @@ static int check_objects(const char* fname, pack_opt_t *options) {
hid_t did = -1;
hid_t sid = -1;
unsigned int i;
- unsigned int uf;
+ int ifil;
trav_table_t *travt = NULL;
/* nothing to do */
@@ -747,7 +747,7 @@ static int check_objects(const char* fname, pack_opt_t *options) {
*/
if (options->verbose)
- printf("Opening file. Searching %d objects to modify ...\n", travt->nobjs);
+ printf("Opening file. Searching %zu objects to modify ...\n", travt->nobjs);
for (i = 0; i < options->op_tbl->nelems; i++) {
char* name = options->op_tbl->objs[i].path;
@@ -761,17 +761,17 @@ static int check_objects(const char* fname, pack_opt_t *options) {
if (options->verbose)
printf("...Found\n");
- for (uf = 0; uf < options->op_tbl->objs[i].nfilters; uf++) {
- if (options->op_tbl->objs[i].filter[uf].filtn < 0)
+ for (ifil = 0; ifil < options->op_tbl->objs[i].nfilters; ifil++) {
+ if (options->op_tbl->objs[i].filter[ifil].filtn < 0)
HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "invalid filter");
/* check for extra filter conditions */
- switch (options->op_tbl->objs[i].filter[uf].filtn) {
+ switch (options->op_tbl->objs[i].filter[ifil].filtn) {
/* chunk size must be smaller than pixels per block */
case H5Z_FILTER_SZIP:
{
int j;
hsize_t csize = 1;
- unsigned ppb = options->op_tbl->objs[i].filter[uf].cd_values[0];
+ unsigned ppb = options->op_tbl->objs[i].filter[ifil].cd_values[0];
hsize_t dims[H5S_MAX_RANK];
int rank;
@@ -807,7 +807,7 @@ static int check_objects(const char* fname, pack_opt_t *options) {
default:
break;
}
- } /* for uf */
+ } /* for ifil */
} /* for i */
done:
diff --git a/tools/src/h5repack/h5repack_copy.c b/tools/src/h5repack/h5repack_copy.c
index 0567269..8122d6d 100644
--- a/tools/src/h5repack/h5repack_copy.c
+++ b/tools/src/h5repack/h5repack_copy.c
@@ -33,20 +33,6 @@
/* size of buffer/# of bytes to xfer at a time when copying userblock */
#define USERBLOCK_XFER_SIZE 512
-/* check H5Dread()/H5Dwrite() error, e.g. memory allocation error inside the library. */
-#define CHECK_H5DRW_ERROR(_fun, _fail, _did, _mtid, _msid, _fsid, _pid, _buf) { \
- H5E_BEGIN_TRY { \
- if(_fun(_did, _mtid, _msid, _fsid, _pid, _buf) < 0) { \
- hid_t _err_num = 0; \
- char _msg[80]; \
- H5Ewalk2(H5E_DEFAULT, H5E_WALK_DOWNWARD, walk_error_callback, &_err_num); \
- H5Eget_msg(_err_num, NULL, _msg, (size_t)80); \
- error_msg("%s %s -- %s\n", #_fun, "failed", _msg); \
- HGOTO_DONE(_fail) \
- } \
- } H5E_END_TRY; \
-}
-
/*-------------------------------------------------------------------------
* local functions
*-------------------------------------------------------------------------
@@ -61,15 +47,7 @@ static int copy_user_block(const char *infile, const char *outfile,
#if defined (H5REPACK_DEBUG_USER_BLOCK)
static void print_user_block(const char *filename, hid_t fid);
#endif
-static herr_t walk_error_callback(unsigned n, const H5E_error2_t *err_desc, void *udata);
-/* get the major number from the error stack. */
-static herr_t walk_error_callback(H5_ATTR_UNUSED unsigned n, const H5E_error2_t *err_desc, void *udata) {
- if (err_desc)
- *((hid_t *) udata) = err_desc->maj_num;
-
- return 0;
-}
/*-------------------------------------------------------------------------
* Function: copy_objects
@@ -634,7 +612,7 @@ int do_copy_objects(hid_t fidin, hid_t fidout, trav_table_t *travt,
unsigned crt_order_flags; /* group creation order flag */
unsigned i;
unsigned u;
- unsigned uf;
+ int ifil;
int is_ref = 0;
htri_t is_named;
hbool_t limit_maxdims;
@@ -740,8 +718,8 @@ int do_copy_objects(hid_t fidin, hid_t fidout, trav_table_t *travt,
if (options->op_tbl->objs) {
for (u = 0; u < options->op_tbl->nelems; u++) {
if (HDstrcmp(travt->objs[i].name, options->op_tbl->objs[u].path) == 0)
- for (uf = 0; uf < options->op_tbl->objs[uf].nfilters; uf++) {
- if (options->op_tbl->objs[u].filter[uf].filtn > 0)
+ for (ifil = 0; ifil < options->op_tbl->objs[ifil].nfilters; ifil++) {
+ if (options->op_tbl->objs[u].filter[ifil].filtn > 0)
req_filter = 1;
}
}
@@ -1350,7 +1328,7 @@ print_dataset_info(hid_t dcpl_id, char *objname, double ratio, int pr)
if (!pr)
printf(FORMAT_OBJ, "dset", objname);
else {
- char str[255], temp[28];
+ char str[512], temp[512];
HDstrcpy(str, "dset ");
HDstrcat(str, strfilter);
diff --git a/tools/src/h5repack/h5repack_filters.c b/tools/src/h5repack/h5repack_filters.c
index 3d9472a..7e32def 100644
--- a/tools/src/h5repack/h5repack_filters.c
+++ b/tools/src/h5repack/h5repack_filters.c
@@ -42,7 +42,8 @@ static int aux_copy_obj(hid_t dcpl_id, /* dataset creation property list */
H5D_layout_t layout;
int rank; /* rank of dataset */
hsize_t chsize[64]; /* chunk size in elements */
- unsigned int i;
+ int i;
+ unsigned u;
/* get information about input filters */
if ((nfilters = H5Pget_nfilters(dcpl_id)) < 0)
@@ -65,8 +66,8 @@ static int aux_copy_obj(hid_t dcpl_id, /* dataset creation property list */
if ((rank = H5Pget_chunk(dcpl_id, NELMTS(chsize), chsize/*out*/)) < 0)
HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pget_chunk failed");
objout->chunk.rank = rank;
- for (i = 0; i < rank; i++)
- objout->chunk.chunk_lengths[i] = chsize[i];
+ for (u = 0; u < (unsigned)rank; u++)
+ objout->chunk.chunk_lengths[u] = chsize[u];
}
done:
@@ -85,8 +86,7 @@ static int aux_find_obj(const char* name, /* object name from traverse list */
pack_info_t *obj /*OUT*/) /* info about object to filter */
{
char *pdest = NULL;
- char *pname = NULL;
- int result;
+ const char *pname = NULL;
unsigned int i;
for (i = 0; i < options->op_tbl->nelems; i++) {
diff --git a/tools/src/h5stat/CMakeLists.txt b/tools/src/h5stat/CMakeLists.txt
index 56c172c..55c675f 100644
--- a/tools/src/h5stat/CMakeLists.txt
+++ b/tools/src/h5stat/CMakeLists.txt
@@ -4,18 +4,20 @@ project (HDF5_TOOLS_SRC_H5STAT C)
# --------------------------------------------------------------------
# Add the h5stat executables
# --------------------------------------------------------------------
-add_executable (h5stat ${HDF5_TOOLS_SRC_H5STAT_SOURCE_DIR}/h5stat.c)
-target_include_directories(h5stat PRIVATE "${HDF5_TOOLS_DIR}/lib;${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>")
-TARGET_C_PROPERTIES (h5stat STATIC)
-target_link_libraries (h5stat PRIVATE ${HDF5_TOOLS_LIB_TARGET} ${HDF5_LIB_TARGET})
-set_target_properties (h5stat PROPERTIES FOLDER tools)
-set_global_variable (HDF5_UTILS_TO_EXPORT "${HDF5_UTILS_TO_EXPORT};h5stat")
+if (NOT ONLY_SHARED_LIBS)
+ add_executable (h5stat ${HDF5_TOOLS_SRC_H5STAT_SOURCE_DIR}/h5stat.c)
+ target_include_directories (h5stat PRIVATE "${HDF5_TOOLS_DIR}/lib;${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>")
+ TARGET_C_PROPERTIES (h5stat STATIC)
+ target_link_libraries (h5stat PRIVATE ${HDF5_TOOLS_LIB_TARGET} ${HDF5_LIB_TARGET})
+ set_target_properties (h5stat PROPERTIES FOLDER tools)
+ set_global_variable (HDF5_UTILS_TO_EXPORT "${HDF5_UTILS_TO_EXPORT};h5stat")
-set (H5_DEP_EXECUTABLES h5stat)
+ set (H5_DEP_EXECUTABLES h5stat)
+endif ()
if (BUILD_SHARED_LIBS)
add_executable (h5stat-shared ${HDF5_TOOLS_SRC_H5STAT_SOURCE_DIR}/h5stat.c)
- target_include_directories(h5stat-shared PRIVATE "${HDF5_TOOLS_DIR}/lib;${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>")
+ target_include_directories (h5stat-shared PRIVATE "${HDF5_TOOLS_DIR}/lib;${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>")
TARGET_C_PROPERTIES (h5stat-shared SHARED)
target_link_libraries (h5stat-shared PRIVATE ${HDF5_TOOLS_LIBSH_TARGET} ${HDF5_LIBSH_TARGET})
set_target_properties (h5stat-shared PROPERTIES FOLDER tools)
diff --git a/tools/src/h5stat/h5stat.c b/tools/src/h5stat/h5stat.c
index 8109b93..450f731 100644
--- a/tools/src/h5stat/h5stat.c
+++ b/tools/src/h5stat/h5stat.c
@@ -509,8 +509,7 @@ dataset_stats(iter_t *iter, const char *name, const H5O_info_t *oi)
HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "attribute_stats() failed");
/* Get storage info */
- if((storage = H5Dget_storage_size(did)) < 0)
- HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Dget_storage_size() failed");
+ storage = H5Dget_storage_size(did);
/* Gather layout statistics */
if((dcpl = H5Dget_create_plist(did)) < 0)
diff --git a/tools/src/misc/CMakeLists.txt b/tools/src/misc/CMakeLists.txt
index 937799f..7c3d7f0 100644
--- a/tools/src/misc/CMakeLists.txt
+++ b/tools/src/misc/CMakeLists.txt
@@ -5,40 +5,78 @@ project (HDF5_TOOLS_SRC_MISC C)
# Add the misc executables
# --------------------------------------------------------------------
#-- Misc Executables
-add_executable (h5debug ${HDF5_TOOLS_SRC_MISC_SOURCE_DIR}/h5debug.c)
-target_include_directories(h5debug PRIVATE "${HDF5_TOOLS_DIR}/lib;${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>")
-TARGET_C_PROPERTIES (h5debug STATIC)
-target_link_libraries (h5debug PRIVATE ${HDF5_LIB_TARGET} ${HDF5_TOOLS_LIB_TARGET})
-set_target_properties (h5debug PROPERTIES FOLDER tools)
-set_global_variable (HDF5_UTILS_TO_EXPORT "${HDF5_UTILS_TO_EXPORT};h5debug")
+if (NOT ONLY_SHARED_LIBS)
+ add_executable (h5debug ${HDF5_TOOLS_SRC_MISC_SOURCE_DIR}/h5debug.c)
+ target_include_directories (h5debug PRIVATE "${HDF5_TOOLS_DIR}/lib;${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>")
+ TARGET_C_PROPERTIES (h5debug STATIC)
+ target_link_libraries (h5debug PRIVATE ${HDF5_TOOLS_LIB_TARGET} ${HDF5_LIB_TARGET})
+ set_target_properties (h5debug PROPERTIES FOLDER tools)
+ set_global_variable (HDF5_UTILS_TO_EXPORT "${HDF5_UTILS_TO_EXPORT};h5debug")
-add_executable (h5repart ${HDF5_TOOLS_SRC_MISC_SOURCE_DIR}/h5repart.c)
-target_include_directories(h5repart PRIVATE "${HDF5_TOOLS_DIR}/lib;${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>")
-TARGET_C_PROPERTIES (h5repart STATIC)
-target_link_libraries (h5repart PRIVATE ${HDF5_LIB_TARGET} ${HDF5_TOOLS_LIB_TARGET})
-set_target_properties (h5repart PROPERTIES FOLDER tools)
-set_global_variable (HDF5_UTILS_TO_EXPORT "${HDF5_UTILS_TO_EXPORT};h5repart")
+ add_executable (h5repart ${HDF5_TOOLS_SRC_MISC_SOURCE_DIR}/h5repart.c)
+ target_include_directories (h5repart PRIVATE "${HDF5_TOOLS_DIR}/lib;${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>")
+ TARGET_C_PROPERTIES (h5repart STATIC)
+ target_link_libraries (h5repart PRIVATE ${HDF5_TOOLS_LIB_TARGET} ${HDF5_LIB_TARGET})
+ set_target_properties (h5repart PROPERTIES FOLDER tools)
+ set_global_variable (HDF5_UTILS_TO_EXPORT "${HDF5_UTILS_TO_EXPORT};h5repart")
-add_executable (h5mkgrp ${HDF5_TOOLS_SRC_MISC_SOURCE_DIR}/h5mkgrp.c)
-target_include_directories(h5mkgrp PRIVATE "${HDF5_TOOLS_DIR}/lib;${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>")
-TARGET_C_PROPERTIES (h5mkgrp STATIC)
-target_link_libraries (h5mkgrp PRIVATE ${HDF5_TOOLS_LIB_TARGET} ${HDF5_LIB_TARGET})
-set_target_properties (h5mkgrp PROPERTIES FOLDER tools)
-set_global_variable (HDF5_UTILS_TO_EXPORT "${HDF5_UTILS_TO_EXPORT};h5mkgrp")
+ add_executable (h5mkgrp ${HDF5_TOOLS_SRC_MISC_SOURCE_DIR}/h5mkgrp.c)
+ target_include_directories (h5mkgrp PRIVATE "${HDF5_TOOLS_DIR}/lib;${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>")
+ TARGET_C_PROPERTIES (h5mkgrp STATIC)
+ target_link_libraries (h5mkgrp PRIVATE ${HDF5_TOOLS_LIB_TARGET} ${HDF5_LIB_TARGET})
+ set_target_properties (h5mkgrp PROPERTIES FOLDER tools)
+ set_global_variable (HDF5_UTILS_TO_EXPORT "${HDF5_UTILS_TO_EXPORT};h5mkgrp")
-add_executable (h5clear ${HDF5_TOOLS_SRC_MISC_SOURCE_DIR}/h5clear.c)
-target_include_directories(h5clear PRIVATE "${HDF5_TOOLS_DIR}/lib;${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>")
-TARGET_C_PROPERTIES (h5clear STATIC)
-target_link_libraries (h5clear PRIVATE ${HDF5_TOOLS_LIB_TARGET} ${HDF5_LIB_TARGET})
-set_target_properties (h5clear PROPERTIES FOLDER tools)
-set_global_variable (HDF5_UTILS_TO_EXPORT "${HDF5_UTILS_TO_EXPORT};h5clear")
+ add_executable (h5clear ${HDF5_TOOLS_SRC_MISC_SOURCE_DIR}/h5clear.c)
+ target_include_directories (h5clear PRIVATE "${HDF5_TOOLS_DIR}/lib;${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>")
+ TARGET_C_PROPERTIES (h5clear STATIC)
+ target_link_libraries (h5clear PRIVATE ${HDF5_TOOLS_LIB_TARGET} ${HDF5_LIB_TARGET})
+ set_target_properties (h5clear PROPERTIES FOLDER tools)
+ set_global_variable (HDF5_UTILS_TO_EXPORT "${HDF5_UTILS_TO_EXPORT};h5clear")
-set (H5_DEP_EXECUTABLES
- h5debug
- h5repart
- h5mkgrp
- h5clear
-)
+ set (H5_DEP_EXECUTABLES
+ h5debug
+ h5repart
+ h5mkgrp
+ h5clear
+ )
+endif ()
+if (BUILD_SHARED_LIBS)
+ add_executable (h5debug-shared ${HDF5_TOOLS_SRC_MISC_SOURCE_DIR}/h5debug.c)
+ target_include_directories (h5debug-shared PRIVATE "${HDF5_TOOLS_DIR}/lib;${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>")
+ TARGET_C_PROPERTIES (h5debug-shared SHARED)
+ target_link_libraries (h5debug-shared PRIVATE ${HDF5_TOOLS_LIBSH_TARGET} ${HDF5_LIBSH_TARGET})
+ set_target_properties (h5debug-shared PROPERTIES FOLDER tools)
+ set_global_variable (HDF5_UTILS_TO_EXPORT "${HDF5_UTILS_TO_EXPORT};h5debug-shared")
+
+ add_executable (h5repart-shared ${HDF5_TOOLS_SRC_MISC_SOURCE_DIR}/h5repart.c)
+ target_include_directories (h5repart-shared PRIVATE "${HDF5_TOOLS_DIR}/lib;${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>")
+ TARGET_C_PROPERTIES (h5repart-shared SHARED)
+ target_link_libraries (h5repart-shared PRIVATE ${HDF5_TOOLS_LIBSH_TARGET} ${HDF5_LIBSH_TARGET})
+ set_target_properties (h5repart-shared PROPERTIES FOLDER tools)
+ set_global_variable (HDF5_UTILS_TO_EXPORT "${HDF5_UTILS_TO_EXPORT};h5repart-shared")
+
+ add_executable (h5mkgrp-shared ${HDF5_TOOLS_SRC_MISC_SOURCE_DIR}/h5mkgrp.c)
+ target_include_directories (h5mkgrp-shared PRIVATE "${HDF5_TOOLS_DIR}/lib;${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>")
+ TARGET_C_PROPERTIES (h5mkgrp-shared SHARED)
+ target_link_libraries (h5mkgrp-shared PRIVATE ${HDF5_TOOLS_LIBSH_TARGET} ${HDF5_LIBSH_TARGET})
+ set_target_properties (h5mkgrp-shared PROPERTIES FOLDER tools)
+ set_global_variable (HDF5_UTILS_TO_EXPORT "${HDF5_UTILS_TO_EXPORT};h5mkgrp-shared")
+
+ add_executable (h5clear-shared ${HDF5_TOOLS_SRC_MISC_SOURCE_DIR}/h5clear.c)
+ target_include_directories (h5clear-shared PRIVATE "${HDF5_TOOLS_DIR}/lib;${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>")
+ TARGET_C_PROPERTIES (h5clear-shared SHARED)
+ target_link_libraries (h5clear-shared PRIVATE ${HDF5_TOOLS_LIBSH_TARGET} ${HDF5_LIBSH_TARGET})
+ set_target_properties (h5clear-shared PROPERTIES FOLDER tools)
+ set_global_variable (HDF5_UTILS_TO_EXPORT "${HDF5_UTILS_TO_EXPORT};h5clear-shared")
+
+ set (H5_DEP_EXECUTABLES ${H5_DEP_EXECUTABLES}
+ h5debug-shared
+ h5repart-shared
+ h5mkgrp-shared
+ h5clear-shared
+ )
+endif ()
#-----------------------------------------------------------------------------
# Generate the h5cc file containing settings needed to compile programs
diff --git a/tools/src/misc/Makefile.am b/tools/src/misc/Makefile.am
index 64c5ee5..f1d2aaf 100644
--- a/tools/src/misc/Makefile.am
+++ b/tools/src/misc/Makefile.am
@@ -23,7 +23,6 @@ AM_CPPFLAGS+=-I$(top_srcdir)/src -I$(top_srcdir)/tools/lib
# These are our main targets, the tools
bin_PROGRAMS=h5debug h5repart h5mkgrp h5clear
-bin_SCRIPTS=h5redeploy
# Add h5debug, h5repart, and h5mkgrp specific linker flags here
h5debug_LDFLAGS = $(LT_STATIC_EXEC) $(AM_LDFLAGS)
@@ -31,30 +30,7 @@ h5repart_LDFLAGS = $(LT_STATIC_EXEC) $(AM_LDFLAGS)
h5mkgrp_LDFLAGS = $(LT_STATIC_EXEC) $(AM_LDFLAGS)
h5clear_LDFLAGS = $(LT_STATIC_EXEC) $(AM_LDFLAGS)
-# Tell automake to clean h5redeploy script
-CLEANFILES=h5redeploy
-
-# These were generated by configure. Remove them only when distclean.
-DISTCLEANFILES=h5cc
-
# All programs rely on hdf5 library and h5tools library
LDADD=$(LIBH5TOOLS) $(LIBHDF5)
-# h5cc needs custom install and uninstall rules, since it may be
-# named h5pcc if hdf5 is being built in parallel mode.
-if BUILD_PARALLEL_CONDITIONAL
- H5CC_NAME=h5pcc
-else
- H5CC_NAME=h5cc
-endif
-
-install-exec-local:
- @$(INSTALL) h5cc $(DESTDIR)$(bindir)/$(H5CC_NAME)
-uninstall-local:
- @$(RM) $(DESTDIR)$(bindir)/$(H5CC_NAME)
-
-# How to build h5redeploy script
-h5redeploy: h5redeploy.in
- @cp $(srcdir)/$@.in $@
-
include $(top_srcdir)/config/conclude.am
diff --git a/tools/test/h5copy/CMakeLists.txt b/tools/test/h5copy/CMakeLists.txt
index a71a12a..ecf371f 100644
--- a/tools/test/h5copy/CMakeLists.txt
+++ b/tools/test/h5copy/CMakeLists.txt
@@ -4,9 +4,9 @@ project (HDF5_TOOLS_TEST_H5COPY C)
# --------------------------------------------------------------------
# Add the h5copy test executables
# --------------------------------------------------------------------
-if (HDF5_BUILD_GENERATORS)
+if (HDF5_BUILD_GENERATORS AND NOT ONLY_SHARED_LIBS)
add_executable (h5copygentest ${HDF5_TOOLS_TEST_H5COPY_SOURCE_DIR}/h5copygentest.c)
- target_include_directories(h5copygentest PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>")
+ target_include_directories (h5copygentest PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>")
TARGET_C_PROPERTIES (h5copygentest STATIC)
target_link_libraries (h5copygentest PRIVATE ${HDF5_LIB_TARGET})
set_target_properties (h5copygentest PROPERTIES FOLDER generator/tools)
@@ -18,15 +18,15 @@ endif ()
# If plugin library tests can be tested
#-----------------------------------------------------------------------------
if (BUILD_SHARED_LIBS)
- set (HDF5_TOOL_PLUGIN_LIB_CORENAME "dynlibcopy")
- 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 (H5COPY_TOOL_PLUGIN_LIB_CORENAME "dynlibcopy")
+ set (H5COPY_TOOL_PLUGIN_LIB_NAME "${HDF5_EXTERNAL_LIB_PREFIX}${H5COPY_TOOL_PLUGIN_LIB_CORENAME}")
+ set (H5COPY_TOOL_PLUGIN_LIB_TARGET ${H5COPY_TOOL_PLUGIN_LIB_CORENAME})
- add_library (${HDF5_TOOL_PLUGIN_LIB_TARGET} SHARED dynlib_copy.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 (${H5COPY_TOOL_PLUGIN_LIB_TARGET} SHARED dynlib_copy.c)
+ target_include_directories (${H5COPY_TOOL_PLUGIN_LIB_TARGET} PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>")
+ TARGET_C_PROPERTIES (${H5COPY_TOOL_PLUGIN_LIB_TARGET} SHARED)
+ target_link_libraries (${H5COPY_TOOL_PLUGIN_LIB_TARGET} PRIVATE ${HDF5_TEST_LIBSH_TARGET})
+ H5_SET_LIB_OPTIONS (${H5COPY_TOOL_PLUGIN_LIB_TARGET} ${H5COPY_TOOL_PLUGIN_LIB_NAME} SHARED "LIB")
# make plugins dir
file (MAKE_DIRECTORY "${CMAKE_BINARY_DIR}/plugins")
@@ -34,12 +34,12 @@ if (BUILD_SHARED_LIBS)
# Copy plugin library to a plugins folder
#-----------------------------------------------------------------------------
add_custom_command (
- TARGET ${HDF5_TOOL_PLUGIN_LIB_TARGET}
+ TARGET ${H5COPY_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}>"
+ "$<TARGET_FILE:${H5COPY_TOOL_PLUGIN_LIB_TARGET}>"
+ "${CMAKE_BINARY_DIR}/plugins/$<TARGET_FILE_NAME:${H5COPY_TOOL_PLUGIN_LIB_TARGET}>"
)
endif ()
diff --git a/tools/test/h5copy/CMakeTests.cmake b/tools/test/h5copy/CMakeTests.cmake
index f31068b..df56f1a 100644
--- a/tools/test/h5copy/CMakeTests.cmake
+++ b/tools/test/h5copy/CMakeTests.cmake
@@ -45,6 +45,12 @@
endforeach ()
add_custom_target(h5copy_files ALL COMMENT "Copying files needed by h5copy tests" DEPENDS ${h5copy_files_list})
+ if (NOT BUILD_SHARED_LIBS)
+ set (tgt_ext "")
+ else ()
+ set (tgt_ext "-shared")
+ endif ()
+
##############################################################################
##############################################################################
### T H E T E S T S M A C R O S ###
@@ -52,7 +58,7 @@
##############################################################################
#
- # Perform h5copy according to passing parmeters
+ # Perform h5copy according to passing parameters
#
macro (ADD_H5_F_TEST testname resultcode infile fparam vparam sparam srcname dparam dstname)
if (NOT HDF5_ENABLE_USING_MEMCHECKER)
@@ -67,10 +73,10 @@
add_test (
NAME H5COPY_F-${testname}
- COMMAND $<TARGET_FILE:h5copy> -f ${fparam} -i ./testfiles/${infile} -o ./testfiles/${testname}.out.h5 ${vparam} ${sparam} ${srcname} ${dparam} ${dstname} ${ARGN}
+ COMMAND $<TARGET_FILE:h5copy${tgt_ext}> -f ${fparam} -i ./testfiles/${infile} -o ./testfiles/${testname}.out.h5 ${vparam} ${sparam} ${srcname} ${dparam} ${dstname} ${ARGN}
)
if (HDF5_ENABLE_USING_MEMCHECKER)
- if (NOT "${last_test}" STREQUAL "")
+ if (last_test)
set_tests_properties (H5COPY_F-${testname} PROPERTIES DEPENDS ${last_test})
endif ()
else ()
@@ -78,13 +84,13 @@
endif ()
# resultcode=2 will cause the test to skip the diff test
- if (NOT "${resultcode}" STREQUAL "2")
+ if (NOT ${resultcode} EQUAL 2)
add_test (
NAME H5COPY_F-${testname}-DIFF
- COMMAND $<TARGET_FILE:h5diff> -v ./testfiles/${infile} ./testfiles/${testname}.out.h5 ${srcname} ${dstname}
+ COMMAND $<TARGET_FILE:h5diff${tgt_ext}> -v ./testfiles/${infile} ./testfiles/${testname}.out.h5 ${srcname} ${dstname}
)
set_tests_properties (H5COPY_F-${testname}-DIFF PROPERTIES DEPENDS H5COPY_F-${testname})
- if ("${resultcode}" STREQUAL "1")
+ if (${resultcode} EQUAL 1)
set_tests_properties (H5COPY_F-${testname}-DIFF PROPERTIES WILL_FAIL "true")
endif ()
endif ()
@@ -103,10 +109,10 @@
add_test (
NAME H5COPY-${testname}
- COMMAND $<TARGET_FILE:h5copy> -i ./testfiles/${infile} -o ./testfiles/${testname}.out.h5 ${vparam} ${sparam} ${srcname} ${dparam} ${dstname} ${ARGN}
+ COMMAND $<TARGET_FILE:h5copy${tgt_ext}> -i ./testfiles/${infile} -o ./testfiles/${testname}.out.h5 ${vparam} ${sparam} ${srcname} ${dparam} ${dstname} ${ARGN}
)
if (HDF5_ENABLE_USING_MEMCHECKER)
- if (NOT "${last_test}" STREQUAL "")
+ if (last_test)
set_tests_properties (H5COPY-${testname} PROPERTIES DEPENDS ${last_test})
endif ()
else ()
@@ -114,13 +120,13 @@
endif ()
# resultcode=2 will cause the test to skip the diff test
- if (NOT "${resultcode}" STREQUAL "2")
+ if (NOT ${resultcode} EQUAL 2)
add_test (
NAME H5COPY-${testname}-DIFF
- COMMAND $<TARGET_FILE:h5diff> -v ./testfiles/${infile} ./testfiles/${testname}.out.h5 ${srcname} ${dstname}
+ COMMAND $<TARGET_FILE:h5diff${tgt_ext}> -v ./testfiles/${infile} ./testfiles/${testname}.out.h5 ${srcname} ${dstname}
)
set_tests_properties (H5COPY-${testname}-DIFF PROPERTIES DEPENDS H5COPY-${testname})
- if ("${resultcode}" STREQUAL "1")
+ if (${resultcode} EQUAL 1)
set_tests_properties (H5COPY-${testname}-DIFF PROPERTIES WILL_FAIL "true")
endif ()
endif ()
@@ -149,10 +155,10 @@
add_test (
NAME H5COPY-${testname}-prefill
- COMMAND $<TARGET_FILE:h5copy> -i ./testfiles/${infile} -o ./testfiles/${testname}.out.h5 -v -s ${psparam} -d ${pdparam}
+ COMMAND $<TARGET_FILE:h5copy${tgt_ext}> -i ./testfiles/${infile} -o ./testfiles/${testname}.out.h5 -v -s ${psparam} -d ${pdparam}
)
if (HDF5_ENABLE_USING_MEMCHECKER)
- if (NOT "${last_test}" STREQUAL "")
+ if (last_test)
set_tests_properties (H5COPY-${testname}-prefill PROPERTIES DEPENDS ${last_test})
endif ()
else ()
@@ -161,17 +167,17 @@
add_test (
NAME H5COPY-${testname}
- COMMAND $<TARGET_FILE:h5copy> -i ./testfiles/${infile} -o ./testfiles/${testname}.out.h5 ${vparam} ${sparam} ${srcname} ${dparam} ${dstname} ${ARGN}
+ COMMAND $<TARGET_FILE:h5copy${tgt_ext}> -i ./testfiles/${infile} -o ./testfiles/${testname}.out.h5 ${vparam} ${sparam} ${srcname} ${dparam} ${dstname} ${ARGN}
)
set_tests_properties (H5COPY-${testname} PROPERTIES DEPENDS H5COPY-${testname}-prefill)
# resultcode=2 will cause the test to skip the diff test
- if (NOT "${resultcode}" STREQUAL "2")
+ if (NOT ${resultcode} EQUAL 2)
add_test (
NAME H5COPY-${testname}-DIFF
- COMMAND $<TARGET_FILE:h5diff> -v ./testfiles/${infile} ./testfiles/${testname}.out.h5 ${srcname} ${dstname}
+ COMMAND $<TARGET_FILE:h5diff${tgt_ext}> -v ./testfiles/${infile} ./testfiles/${testname}.out.h5 ${srcname} ${dstname}
)
set_tests_properties (H5COPY-${testname}-DIFF PROPERTIES DEPENDS H5COPY-${testname})
- if ("${resultcode}" STREQUAL "1")
+ if (${resultcode} EQUAL 1)
set_tests_properties (H5COPY-${testname}-DIFF PROPERTIES WILL_FAIL "true")
endif ()
endif ()
@@ -190,10 +196,10 @@
add_test (
NAME H5COPY_SAME-${testname}-prefill
- COMMAND $<TARGET_FILE:h5copy> -i ./testfiles/${pfile} -o ./testfiles/${testname}.out.h5 -v -s ${psparam} -d ${pdparam}
+ COMMAND $<TARGET_FILE:h5copy${tgt_ext}> -i ./testfiles/${pfile} -o ./testfiles/${testname}.out.h5 -v -s ${psparam} -d ${pdparam}
)
if (HDF5_ENABLE_USING_MEMCHECKER)
- if (NOT "${last_test}" STREQUAL "")
+ if (last_test)
set_tests_properties (H5COPY_SAME-${testname}-prefill PROPERTIES DEPENDS ${last_test})
endif ()
else (HDF5_ENABLE_USING_MEMCHECKER)
@@ -202,17 +208,17 @@
add_test (
NAME H5COPY_SAME-${testname}
- COMMAND $<TARGET_FILE:h5copy> -i ./testfiles/${testname}.out.h5 -o ./testfiles/${testname}.out.h5 ${vparam} ${sparam} ${srcname} ${dparam} ${dstname} ${ARGN}
+ COMMAND $<TARGET_FILE:h5copy${tgt_ext}> -i ./testfiles/${testname}.out.h5 -o ./testfiles/${testname}.out.h5 ${vparam} ${sparam} ${srcname} ${dparam} ${dstname} ${ARGN}
)
set_tests_properties (H5COPY_SAME-${testname} PROPERTIES DEPENDS H5COPY_SAME-${testname}-prefill)
# resultcode=2 will cause the test to skip the diff test
- if (NOT "${resultcode}" STREQUAL "2")
+ if (NOT ${resultcode} EQUAL 2)
add_test (
NAME H5COPY_SAME-${testname}-DIFF
- COMMAND $<TARGET_FILE:h5diff> -v ./testfiles/${testname}.out.h5 ./testfiles/${testname}.out.h5 ${srcname} ${dstname}
+ COMMAND $<TARGET_FILE:h5diff${tgt_ext}> -v ./testfiles/${testname}.out.h5 ./testfiles/${testname}.out.h5 ${srcname} ${dstname}
)
set_tests_properties (H5COPY_SAME-${testname}-DIFF PROPERTIES DEPENDS H5COPY_SAME-${testname})
- if ("${resultcode}" STREQUAL "1")
+ if (${resultcode} EQUAL 1)
set_tests_properties (H5COPY_SAME-${testname}-DIFF PROPERTIES WILL_FAIL "true")
endif ()
endif ()
@@ -225,11 +231,11 @@
macro (ADD_H5_CMP_TEST testname resultcode infile vparam sparam srcname dparam dstname)
# If using memchecker add tests without using scripts
if (HDF5_ENABLE_USING_MEMCHECKER)
- add_test (NAME H5COPY-CMP-${testname} COMMAND $<TARGET_FILE:h5copy> -i ./testfiles/${infile} -o ./testfiles/${testname}.out.h5 ${vparam} ${sparam} ${srcname} ${dparam} ${dstname} ${ARGN})
- if ("${resultcode}" STREQUAL "1")
+ add_test (NAME H5COPY-CMP-${testname} COMMAND $<TARGET_FILE:h5copy${tgt_ext}> -i ./testfiles/${infile} -o ./testfiles/${testname}.out.h5 ${vparam} ${sparam} ${srcname} ${dparam} ${dstname} ${ARGN})
+ if (${resultcode} EQUAL 1)
set_tests_properties (H5COPY-CMP-${testname} PROPERTIES WILL_FAIL "true")
endif ()
- if (NOT "${last_test}" STREQUAL "")
+ if (last_test)
set_tests_properties (H5COPY-CMP-${testname} PROPERTIES DEPENDS ${last_test})
endif ()
else ()
@@ -245,7 +251,7 @@
add_test (
NAME H5COPY-CMP-${testname}
COMMAND "${CMAKE_COMMAND}"
- -D "TEST_PROGRAM=$<TARGET_FILE:h5copy>"
+ -D "TEST_PROGRAM=$<TARGET_FILE:h5copy${tgt_ext}>"
-D "TEST_ARGS=-i;./testfiles/${infile};-o;./testfiles/${testname}.out.h5;${vparam};${sparam};${srcname};${dparam};${dstname}"
-D "TEST_FOLDER=${PROJECT_BINARY_DIR}"
-D "TEST_OUTPUT=./testfiles/${testname}.out.out"
@@ -272,7 +278,7 @@
testfiles/${testname}.out.h5.out
testfiles/${testname}.out.h5.out.err
)
- if ("${resultcode}" STREQUAL "2")
+ if (${resultcode} EQUAL 2)
add_test (
NAME H5COPY_UD-${testname}
COMMAND "${CMAKE_COMMAND}"
@@ -285,6 +291,7 @@
-D "TEST_APPEND=EXIT CODE:"
-D "TEST_ENV_VAR=HDF5_PLUGIN_PATH"
-D "TEST_ENV_VALUE=${CMAKE_BINARY_DIR}"
+ -D "TEST_LIBRARY_DIRECTORY=${CMAKE_TEST_OUTPUT_DIRECTORY}"
-P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake"
)
else ()
@@ -300,6 +307,7 @@
-D "TEST_APPEND=EXIT CODE:"
-D "TEST_ENV_VAR=HDF5_PLUGIN_PATH"
-D "TEST_ENV_VALUE=${CMAKE_BINARY_DIR}/plugins"
+ -D "TEST_LIBRARY_DIRECTORY=${CMAKE_TEST_OUTPUT_DIRECTORY}"
-P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake"
)
endif ()
@@ -316,6 +324,7 @@
-D "TEST_APPEND=EXIT CODE:"
-D "TEST_ENV_VAR=HDF5_PLUGIN_PATH"
-D "TEST_ENV_VALUE=${CMAKE_BINARY_DIR}/plugins"
+ -D "TEST_LIBRARY_DIRECTORY=${CMAKE_TEST_OUTPUT_DIRECTORY}"
-P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake"
)
set_tests_properties (H5COPY_UD-${testname}-DIFF PROPERTIES DEPENDS H5COPY_UD-${testname})
@@ -335,7 +344,7 @@
testfiles/${testname}_ERR.out.h5.out
testfiles/${testname}_ERR.out.h5.out.err
)
- if ("${resultcode}" STREQUAL "2")
+ if (${resultcode} EQUAL 2)
add_test (
NAME H5COPY_UD_ERR-${testname}
COMMAND "${CMAKE_COMMAND}"
@@ -349,6 +358,7 @@
-D "TEST_APPEND=EXIT CODE:"
-D "TEST_ENV_VAR=HDF5_PLUGIN_PATH"
-D "TEST_ENV_VALUE=${CMAKE_BINARY_DIR}"
+ -D "TEST_LIBRARY_DIRECTORY=${CMAKE_TEST_OUTPUT_DIRECTORY}"
-P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake"
)
else ()
@@ -365,6 +375,7 @@
-D "TEST_APPEND=EXIT CODE:"
-D "TEST_ENV_VAR=HDF5_PLUGIN_PATH"
-D "TEST_ENV_VALUE=${CMAKE_BINARY_DIR}/plugins"
+ -D "TEST_LIBRARY_DIRECTORY=${CMAKE_TEST_OUTPUT_DIRECTORY}"
-P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake"
)
endif ()
@@ -381,6 +392,7 @@
-D "TEST_APPEND=EXIT CODE:"
-D "TEST_ENV_VAR=HDF5_PLUGIN_PATH"
-D "TEST_ENV_VALUE=${CMAKE_BINARY_DIR}/plugins"
+ -D "TEST_LIBRARY_DIRECTORY=${CMAKE_TEST_OUTPUT_DIRECTORY}"
-P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake"
)
set_tests_properties (H5COPY_UD_ERR-${testname}-DIFF PROPERTIES DEPENDS H5COPY_UD_ERR-${testname})
@@ -443,7 +455,7 @@
h5copy_misc1.out.out.err
)
set_tests_properties (H5COPY-clearall-objects PROPERTIES WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles")
- if (NOT "${last_test}" STREQUAL "")
+ if (last_test)
set_tests_properties (H5COPY-clearall-objects PROPERTIES DEPENDS ${last_test})
endif ()
set (last_test "H5COPY-clearall-objects")
diff --git a/tools/test/h5diff/CMakeLists.txt b/tools/test/h5diff/CMakeLists.txt
index c0aac36..0a874ec 100644
--- a/tools/test/h5diff/CMakeLists.txt
+++ b/tools/test/h5diff/CMakeLists.txt
@@ -4,9 +4,9 @@ project (HDF5_TOOLS_TEST_H5DIFF C)
# --------------------------------------------------------------------
# Add the h5diff and test executables
# --------------------------------------------------------------------
-if (HDF5_BUILD_GENERATORS)
+if (HDF5_BUILD_GENERATORS AND NOT ONLY_SHARED_LIBS)
add_executable (h5diffgentest ${HDF5_TOOLS_TEST_H5DIFF_SOURCE_DIR}/h5diffgentest.c)
- target_include_directories(h5diffgentest PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>")
+ target_include_directories (h5diffgentest PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>")
TARGET_C_PROPERTIES (h5diffgentest STATIC)
target_link_libraries (h5diffgentest PRIVATE ${HDF5_LIB_TARGET})
set_target_properties (h5diffgentest PROPERTIES FOLDER generator/tools)
@@ -18,15 +18,15 @@ endif ()
# If plugin library tests can be tested
#-----------------------------------------------------------------------------
if (BUILD_SHARED_LIBS)
- set (HDF5_TOOL_PLUGIN_LIB_CORENAME "dynlibdiff")
- 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 (H5DIFF_TOOL_PLUGIN_LIB_CORENAME "dynlibdiff")
+ set (H5DIFF_TOOL_PLUGIN_LIB_NAME "${HDF5_EXTERNAL_LIB_PREFIX}${H5DIFF_TOOL_PLUGIN_LIB_CORENAME}")
+ set (H5DIFF_TOOL_PLUGIN_LIB_TARGET ${H5DIFF_TOOL_PLUGIN_LIB_CORENAME})
- add_library (${HDF5_TOOL_PLUGIN_LIB_TARGET} SHARED dynlib_diff.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 (${H5DIFF_TOOL_PLUGIN_LIB_TARGET} SHARED dynlib_diff.c)
+ target_include_directories (${H5DIFF_TOOL_PLUGIN_LIB_TARGET} PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>")
+ TARGET_C_PROPERTIES (${H5DIFF_TOOL_PLUGIN_LIB_TARGET} SHARED)
+ target_link_libraries (${H5DIFF_TOOL_PLUGIN_LIB_TARGET} PRIVATE ${HDF5_TEST_LIBSH_TARGET})
+ H5_SET_LIB_OPTIONS (${H5DIFF_TOOL_PLUGIN_LIB_TARGET} ${H5DIFF_TOOL_PLUGIN_LIB_NAME} SHARED "LIB")
# make plugins dir
file (MAKE_DIRECTORY "${CMAKE_BINARY_DIR}/plugins")
@@ -34,12 +34,12 @@ if (BUILD_SHARED_LIBS)
# Copy plugin library to a plugins folder
#-----------------------------------------------------------------------------
add_custom_command (
- TARGET ${HDF5_TOOL_PLUGIN_LIB_TARGET}
+ TARGET ${H5DIFF_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}>"
+ "$<TARGET_FILE:${H5DIFF_TOOL_PLUGIN_LIB_TARGET}>"
+ "${CMAKE_BINARY_DIR}/plugins/$<TARGET_FILE_NAME:${H5DIFF_TOOL_PLUGIN_LIB_TARGET}>"
)
endif ()
diff --git a/tools/test/h5diff/CMakeTests.cmake b/tools/test/h5diff/CMakeTests.cmake
index 24646b0..604c8a5 100644
--- a/tools/test/h5diff/CMakeTests.cmake
+++ b/tools/test/h5diff/CMakeTests.cmake
@@ -343,6 +343,12 @@
endif ()
add_custom_target(h5diff_files ALL COMMENT "Copying files needed by h5diff tests" DEPENDS ${h5diff_files_list})
+ if (NOT BUILD_SHARED_LIBS)
+ set (tgt_ext "")
+ else ()
+ set (tgt_ext "-shared")
+ endif ()
+
##############################################################################
##############################################################################
### T H E T E S T S M A C R O S ###
@@ -352,12 +358,12 @@
macro (ADD_H5_TEST resultfile resultcode)
# If using memchecker add tests without using scripts
if (HDF5_ENABLE_USING_MEMCHECKER)
- add_test (NAME H5DIFF-${resultfile} COMMAND $<TARGET_FILE:h5diff> ${ARGN})
+ add_test (NAME H5DIFF-${resultfile} COMMAND $<TARGET_FILE:h5diff${tgt_ext}> ${ARGN})
set_tests_properties (H5DIFF-${resultfile} PROPERTIES WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles")
- if (NOT "${resultcode}" STREQUAL "0")
+ if (${resultcode})
set_tests_properties (H5DIFF-${resultfile} PROPERTIES WILL_FAIL "true")
endif ()
- if (NOT "${last_test}" STREQUAL "")
+ if (last_test)
set_tests_properties (H5DIFF-${resultfile} PROPERTIES DEPENDS ${last_test})
endif ()
else ()
@@ -369,13 +375,13 @@
testfiles/${resultfile}.out
testfiles/${resultfile}.out.err
)
- if (NOT "${last_test}" STREQUAL "")
+ if (last_test)
set_tests_properties (H5DIFF-${resultfile}-clear-objects PROPERTIES DEPENDS ${last_test})
endif ()
add_test (
NAME H5DIFF-${resultfile}
COMMAND "${CMAKE_COMMAND}"
- -D "TEST_PROGRAM=$<TARGET_FILE:h5diff>"
+ -D "TEST_PROGRAM=$<TARGET_FILE:h5diff${tgt_ext}>"
-D "TEST_ARGS:STRING=${ARGN}"
-D "TEST_FOLDER=${PROJECT_BINARY_DIR}/testfiles"
-D "TEST_OUTPUT=${resultfile}.out"
@@ -394,28 +400,28 @@
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")
- if (NOT "${resultcode}" STREQUAL "0")
- set_tests_properties (PH5DIFF-${resultfile} PROPERTIES WILL_FAIL "true")
+ 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 (${resultcode})
+ 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})
+ if (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})
+ if (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}"
@@ -429,7 +435,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 ()
@@ -444,7 +450,7 @@
testfiles/${resultfile}.out
testfiles/${resultfile}.out.err
)
- if ("${resultcode}" STREQUAL "2")
+ if (${resultcode} EQUAL 2)
add_test (
NAME H5DIFF_UD-${testname}
COMMAND "${CMAKE_COMMAND}"
@@ -457,6 +463,7 @@
-D "TEST_APPEND=EXIT CODE:"
-D "TEST_ENV_VAR=HDF5_PLUGIN_PATH"
-D "TEST_ENV_VALUE=${CMAKE_BINARY_DIR}"
+ -D "TEST_LIBRARY_DIRECTORY=${CMAKE_TEST_OUTPUT_DIRECTORY}"
-P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake"
)
else ()
@@ -472,6 +479,7 @@
-D "TEST_APPEND=EXIT CODE:"
-D "TEST_ENV_VAR=HDF5_PLUGIN_PATH"
-D "TEST_ENV_VALUE=${CMAKE_BINARY_DIR}/plugins"
+ -D "TEST_LIBRARY_DIRECTORY=${CMAKE_TEST_OUTPUT_DIRECTORY}"
-P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake"
)
endif ()
@@ -925,7 +933,7 @@
h5diff_vlstr.out.err
)
set_tests_properties (H5DIFF-clearall-objects PROPERTIES WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles")
- if (NOT "${last_test}" STREQUAL "")
+ if (last_test)
set_tests_properties (H5DIFF-clearall-objects PROPERTIES DEPENDS ${last_test})
endif ()
set (last_test "H5DIFF-clearall-objects")
diff --git a/tools/test/h5dump/CMakeLists.txt b/tools/test/h5dump/CMakeLists.txt
index 51938ae..1672774 100644
--- a/tools/test/h5dump/CMakeLists.txt
+++ b/tools/test/h5dump/CMakeLists.txt
@@ -5,15 +5,15 @@ project (HDF5_TOOLS_TEST_H5DUMP C)
# If plugin library tests can be tested
#-----------------------------------------------------------------------------
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})
+ set (H5DUMP_TOOL_PLUGIN_LIB_CORENAME "dynlibdump")
+ set (H5DUMP_TOOL_PLUGIN_LIB_NAME "${HDF5_EXTERNAL_LIB_PREFIX}${H5DUMP_TOOL_PLUGIN_LIB_CORENAME}")
+ set (H5DUMP_TOOL_PLUGIN_LIB_TARGET ${H5DUMP_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")
+ add_library (${H5DUMP_TOOL_PLUGIN_LIB_TARGET} SHARED dynlib_dump.c)
+ target_include_directories (${H5DUMP_TOOL_PLUGIN_LIB_TARGET} PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>")
+ TARGET_C_PROPERTIES (${H5DUMP_TOOL_PLUGIN_LIB_TARGET} SHARED)
+ target_link_libraries (${H5DUMP_TOOL_PLUGIN_LIB_TARGET} PRIVATE ${HDF5_TEST_LIBSH_TARGET})
+ H5_SET_LIB_OPTIONS (${H5DUMP_TOOL_PLUGIN_LIB_TARGET} ${H5DUMP_TOOL_PLUGIN_LIB_NAME} SHARED "LIB")
# make plugins dir
file (MAKE_DIRECTORY "${CMAKE_BINARY_DIR}/plugins")
@@ -21,23 +21,23 @@ if (BUILD_SHARED_LIBS)
# Copy plugin library to a plugins folder
#-----------------------------------------------------------------------------
add_custom_command (
- TARGET ${HDF5_TOOL_PLUGIN_LIB_TARGET}
+ TARGET ${H5DUMP_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}>"
+ "$<TARGET_FILE:${H5DUMP_TOOL_PLUGIN_LIB_TARGET}>"
+ "${CMAKE_BINARY_DIR}/plugins/$<TARGET_FILE_NAME:${H5DUMP_TOOL_PLUGIN_LIB_TARGET}>"
)
endif ()
# --------------------------------------------------------------------
# Add the h5dump test executable
# --------------------------------------------------------------------
-if (HDF5_BUILD_GENERATORS)
+if (HDF5_BUILD_GENERATORS AND NOT ONLY_SHARED_LIBS)
add_executable (h5dumpgentest ${HDF5_TOOLS_TEST_H5DUMP_SOURCE_DIR}/h5dumpgentest.c)
- target_include_directories(h5dumpgentest PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>")
+ target_include_directories (h5dumpgentest PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>")
TARGET_C_PROPERTIES (h5dumpgentest STATIC)
- target_link_libraries (h5dumpgentest PRIVATE ${HDF5_LIB_TARGET} ${HDF5_TOOLS_LIB_TARGET})
+ target_link_libraries (h5dumpgentest PRIVATE ${HDF5_TOOLS_LIB_TARGET} ${HDF5_LIB_TARGET})
set_target_properties (h5dumpgentest PROPERTIES FOLDER generator/tools)
#add_test (NAME h5dumpgentest COMMAND $<TARGET_FILE:h5dumpgentest>)
diff --git a/tools/test/h5dump/CMakeTests.cmake b/tools/test/h5dump/CMakeTests.cmake
index 382e664..070e98e 100644
--- a/tools/test/h5dump/CMakeTests.cmake
+++ b/tools/test/h5dump/CMakeTests.cmake
@@ -320,6 +320,7 @@
${HDF5_TOOLS_DIR}/testfiles/tvlenstr_array.h5
${HDF5_TOOLS_DIR}/testfiles/tvlstr.h5
${HDF5_TOOLS_DIR}/testfiles/tvms.h5
+ ${HDF5_TOOLS_DIR}/testfiles/t128bit_float.h5
${HDF5_TOOLS_DIR}/testfiles/zerodim.h5
)
set (HDF5_ERROR_REFERENCE_TEST_FILES
@@ -401,12 +402,18 @@
##############################################################################
##############################################################################
+ if (NOT BUILD_SHARED_LIBS)
+ set (tgt_ext "")
+ else ()
+ set (tgt_ext "-shared")
+ endif ()
+
macro (ADD_HELP_TEST testname resultcode)
# If using memchecker add tests without using scripts
if (HDF5_ENABLE_USING_MEMCHECKER)
- add_test (NAME H5DUMP-${testname} COMMAND $<TARGET_FILE:h5dump> ${ARGN})
+ add_test (NAME H5DUMP-${testname} COMMAND $<TARGET_FILE:h5dump${tgt_ext}> ${ARGN})
set_tests_properties (H5DUMP-${testname} PROPERTIES WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles/std")
- if (NOT "${last_test}" STREQUAL "")
+ if (last_test)
set_tests_properties (H5DUMP-${testname} PROPERTIES DEPENDS ${last_test})
endif ()
set (last_test "H5DUMP-${testname}")
@@ -419,13 +426,13 @@
testfiles/std/h5dump-${testname}.out
testfiles/std/h5dump-${testname}.out.err
)
- if (NOT "${last_test}" STREQUAL "")
+ if (last_test)
set_tests_properties (H5DUMP-${testname}-clear-objects PROPERTIES DEPENDS ${last_test})
endif ()
add_test (
NAME H5DUMP-${testname}
COMMAND "${CMAKE_COMMAND}"
- -D "TEST_PROGRAM=$<TARGET_FILE:h5dump>"
+ -D "TEST_PROGRAM=$<TARGET_FILE:h5dump${tgt_ext}>"
-D "TEST_ARGS:STRING=${ARGN}"
-D "TEST_FOLDER=${PROJECT_BINARY_DIR}/testfiles/std"
-D "TEST_OUTPUT=h5dump-${testname}.out"
@@ -454,12 +461,12 @@
macro (ADD_H5_TEST resultfile resultcode)
# If using memchecker add tests without using scripts
if (HDF5_ENABLE_USING_MEMCHECKER)
- add_test (NAME H5DUMP-${resultfile} COMMAND $<TARGET_FILE:h5dump> ${ARGN})
+ add_test (NAME H5DUMP-${resultfile} COMMAND $<TARGET_FILE:h5dump${tgt_ext}> ${ARGN})
set_tests_properties (H5DUMP-${resultfile} PROPERTIES WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles/std")
- if (NOT "${resultcode}" STREQUAL "0")
+ if (${resultcode})
set_tests_properties (H5DUMP-${resultfile} PROPERTIES WILL_FAIL "true")
endif ()
- if (NOT "${last_test}" STREQUAL "")
+ if (last_test)
set_tests_properties (H5DUMP-${resultfile} PROPERTIES DEPENDS ${last_test})
endif ()
else ()
@@ -475,7 +482,7 @@
add_test (
NAME H5DUMP-${resultfile}
COMMAND "${CMAKE_COMMAND}"
- -D "TEST_PROGRAM=$<TARGET_FILE:h5dump>"
+ -D "TEST_PROGRAM=$<TARGET_FILE:h5dump${tgt_ext}>"
-D "TEST_ARGS:STRING=${ARGN}"
-D "TEST_FOLDER=${PROJECT_BINARY_DIR}/testfiles/std"
-D "TEST_OUTPUT=${resultfile}.out"
@@ -490,12 +497,12 @@
macro (ADD_H5_TEST_N resultfile resultcode)
# If using memchecker add tests without using scripts
if (HDF5_ENABLE_USING_MEMCHECKER)
- add_test (NAME H5DUMP-N-${resultfile} COMMAND $<TARGET_FILE:h5dump> ${ARGN})
+ add_test (NAME H5DUMP-N-${resultfile} COMMAND $<TARGET_FILE:h5dump${tgt_ext}> ${ARGN})
set_tests_properties (H5DUMP-N-${resultfile} PROPERTIES WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles/std")
- if (NOT "${resultcode}" STREQUAL "0")
+ if (${resultcode})
set_tests_properties (H5DUMP-N-${resultfile} PROPERTIES WILL_FAIL "true")
endif ()
- if (NOT "${last_test}" STREQUAL "")
+ if (last_test)
set_tests_properties (H5DUMP-N-${resultfile} PROPERTIES DEPENDS ${last_test})
endif ()
else ()
@@ -511,7 +518,7 @@
add_test (
NAME H5DUMP-N-${resultfile}
COMMAND "${CMAKE_COMMAND}"
- -D "TEST_PROGRAM=$<TARGET_FILE:h5dump>"
+ -D "TEST_PROGRAM=$<TARGET_FILE:h5dump${tgt_ext}>"
-D "TEST_ARGS:STRING=${ARGN}"
-D "TEST_FOLDER=${PROJECT_BINARY_DIR}/testfiles/std"
-D "TEST_OUTPUT=${resultfile}-N.out"
@@ -526,12 +533,12 @@
macro (ADD_H5_TEST_EXPORT resultfile targetfile resultcode)
# If using memchecker add tests without using scripts
if (HDF5_ENABLE_USING_MEMCHECKER)
- add_test (NAME H5DUMP-${resultfile} COMMAND $<TARGET_FILE:h5dump> ${ARGN} ${resultfile}.txt ${targetfile})
+ add_test (NAME H5DUMP-${resultfile} COMMAND $<TARGET_FILE:h5dump${tgt_ext}> ${ARGN} ${resultfile}.txt ${targetfile})
set_tests_properties (H5DUMP-${resultfile} PROPERTIES WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles/std")
- if (NOT "${resultcode}" STREQUAL "0")
+ if (${resultcode})
set_tests_properties (H5DUMP-${resultfile} PROPERTIES WILL_FAIL "true")
endif ()
- if (NOT "${last_test}" STREQUAL "")
+ if (last_test)
set_tests_properties (H5DUMP-${resultfile} PROPERTIES DEPENDS ${last_test})
endif ()
else ()
@@ -547,7 +554,7 @@
add_test (
NAME H5DUMP-${resultfile}
COMMAND "${CMAKE_COMMAND}"
- -D "TEST_PROGRAM=$<TARGET_FILE:h5dump>"
+ -D "TEST_PROGRAM=$<TARGET_FILE:h5dump${tgt_ext}>"
-D "TEST_ARGS:STRING=${ARGN};${resultfile}.txt;${targetfile}"
-D "TEST_FOLDER=${PROJECT_BINARY_DIR}/testfiles/std"
-D "TEST_OUTPUT=${resultfile}.out"
@@ -569,12 +576,12 @@
macro (ADD_H5_TEST_EXPORT_DDL resultfile targetfile resultcode ddlfile)
# If using memchecker add tests without using scripts
if (HDF5_ENABLE_USING_MEMCHECKER)
- add_test (NAME H5DUMP-${resultfile} COMMAND $<TARGET_FILE:h5dump> --ddl=${ddlfile}.txt ${ARGN} ${resultfile}.txt ${targetfile})
+ add_test (NAME H5DUMP-${resultfile} COMMAND $<TARGET_FILE:h5dump${tgt_ext}> --ddl=${ddlfile}.txt ${ARGN} ${resultfile}.txt ${targetfile})
set_tests_properties (H5DUMP-${resultfile} PROPERTIES WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles/std")
- if (NOT "${resultcode}" STREQUAL "0")
+ if (${resultcode})
set_tests_properties (H5DUMP-${resultfile} PROPERTIES WILL_FAIL "true")
endif ()
- if (NOT "${last_test}" STREQUAL "")
+ if (last_test)
set_tests_properties (H5DUMP-${resultfile} PROPERTIES DEPENDS ${last_test})
endif ()
else ()
@@ -591,7 +598,7 @@
add_test (
NAME H5DUMP-${resultfile}
COMMAND "${CMAKE_COMMAND}"
- -D "TEST_PROGRAM=$<TARGET_FILE:h5dump>"
+ -D "TEST_PROGRAM=$<TARGET_FILE:h5dump${tgt_ext}>"
-D "TEST_ARGS:STRING=--ddl=${ddlfile}.txt;${ARGN};${resultfile}.txt;${targetfile}"
-D "TEST_FOLDER=${PROJECT_BINARY_DIR}/testfiles/std"
-D "TEST_OUTPUT=${resultfile}.out"
@@ -627,7 +634,7 @@
set_tests_properties (H5DUMP-output-${resultfile}-clear-objects PROPERTIES WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles/std")
add_test (
NAME H5DUMP-output-${resultfile}
- COMMAND $<TARGET_FILE:h5dump> ${ARGN} ${resultfile}.txt ${targetfile}
+ COMMAND $<TARGET_FILE:h5dump${tgt_ext}> ${ARGN} ${resultfile}.txt ${targetfile}
)
set_tests_properties (H5DUMP-output-${resultfile} PROPERTIES WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles/std")
set_tests_properties (H5DUMP-output-${resultfile} PROPERTIES DEPENDS H5DUMP-output-${resultfile}-clear-objects)
@@ -655,7 +662,7 @@
add_test (
NAME H5DUMP-${resultfile}
COMMAND "${CMAKE_COMMAND}"
- -D "TEST_PROGRAM=$<TARGET_FILE:h5dump>"
+ -D "TEST_PROGRAM=$<TARGET_FILE:h5dump${tgt_ext}>"
-D "TEST_ARGS:STRING=${ARGN}"
-D "TEST_FOLDER=${PROJECT_BINARY_DIR}/testfiles/std"
-D "TEST_OUTPUT=${resultfile}.out"
@@ -668,7 +675,33 @@
endif ()
endmacro ()
- macro (ADD_H5ERR_MASK_TEST resultfile resultcode)
+ macro (ADD_H5_GREP_TEST resultfile resultcode result_check)
+ if (NOT HDF5_ENABLE_USING_MEMCHECKER)
+ # Remove any output file left over from previous test run
+ add_test (
+ NAME H5DUMP-${resultfile}-clear-objects
+ COMMAND ${CMAKE_COMMAND}
+ -E remove
+ ${resultfile}.out
+ ${resultfile}.out.err
+ )
+ set_tests_properties (H5DUMP-${resultfile}-clear-objects PROPERTIES WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles/std")
+ add_test (
+ NAME H5DUMP-${resultfile}
+ COMMAND "${CMAKE_COMMAND}"
+ -D "TEST_PROGRAM=$<TARGET_FILE:h5dump${tgt_ext}>"
+ -D "TEST_ARGS:STRING=${ARGN}"
+ -D "TEST_FOLDER=${PROJECT_BINARY_DIR}/testfiles/std"
+ -D "TEST_OUTPUT=${resultfile}.out"
+ -D "TEST_EXPECT=${resultcode}"
+ -D "TEST_REFERENCE=${result_check}"
+ -P "${HDF_RESOURCES_EXT_DIR}/grepTest.cmake"
+ )
+ set_tests_properties (H5DUMP-${resultfile} PROPERTIES DEPENDS "H5DUMP-${resultfile}-clear-objects")
+ endif ()
+ endmacro ()
+
+ macro (ADD_H5ERR_MASK_TEST resultfile resultcode result_errcheck)
if (NOT HDF5_ENABLE_USING_MEMCHECKER)
# Remove any output file left over from previous test run
add_test (
@@ -682,21 +715,20 @@
add_test (
NAME H5DUMP-${resultfile}
COMMAND "${CMAKE_COMMAND}"
- -D "TEST_PROGRAM=$<TARGET_FILE:h5dump>"
+ -D "TEST_PROGRAM=$<TARGET_FILE:h5dump${tgt_ext}>"
-D "TEST_ARGS:STRING=${ARGN}"
-D "TEST_FOLDER=${PROJECT_BINARY_DIR}/testfiles/std"
-D "TEST_OUTPUT=${resultfile}.out"
-D "TEST_EXPECT=${resultcode}"
-D "TEST_REFERENCE=${resultfile}.ddl"
- -D "TEST_ERRREF=${resultfile}.err"
- -D "TEST_MASK_ERROR=true"
- -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake"
+ -D "TEST_ERRREF=${result_errcheck}"
+ -P "${HDF_RESOURCES_EXT_DIR}/grepTest.cmake"
)
- set_tests_properties (H5DUMP-${resultfile} PROPERTIES DEPENDS "H5DUMP-${resultfile}-clear-objects")
+ set_tests_properties (H5DUMP-${resultfile} PROPERTIES DEPENDS "H5DUMP-${resultfile}-clear-objects")
endif ()
endmacro ()
- macro (ADD_H5ERR_MASK_ENV_TEST resultfile resultcode envvar envval)
+ macro (ADD_H5ERR_MASK_ENV_TEST resultfile resultcode result_errcheck envvar envval)
if (NOT HDF5_ENABLE_USING_MEMCHECKER)
# Remove any output file left over from previous test run
add_test (
@@ -710,17 +742,16 @@
add_test (
NAME H5DUMP-${resultfile}
COMMAND "${CMAKE_COMMAND}"
- -D "TEST_PROGRAM=$<TARGET_FILE:h5dump>"
+ -D "TEST_PROGRAM=$<TARGET_FILE:h5dump${tgt_ext}>"
-D "TEST_ARGS:STRING=${ARGN}"
-D "TEST_FOLDER=${PROJECT_BINARY_DIR}/testfiles/std"
-D "TEST_OUTPUT=${resultfile}.out"
-D "TEST_EXPECT=${resultcode}"
-D "TEST_REFERENCE=${resultfile}.ddl"
- -D "TEST_ERRREF=${resultfile}.err"
- -D "TEST_MASK_ERROR=true"
+ -D "TEST_ERRREF=${result_errcheck}"
-D "TEST_ENV_VAR:STRING=${envvar}"
-D "TEST_ENV_VALUE:STRING=${envval}"
- -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake"
+ -P "${HDF_RESOURCES_EXT_DIR}/grepTest.cmake"
)
set_tests_properties (H5DUMP-${resultfile} PROPERTIES DEPENDS "H5DUMP-${resultfile}-clear-objects")
endif ()
@@ -741,7 +772,7 @@
add_test (
NAME H5DUMP-IMPORT-${resultfile}
COMMAND "${CMAKE_COMMAND}"
- -D "TEST_PROGRAM=$<TARGET_FILE:h5dump>"
+ -D "TEST_PROGRAM=$<TARGET_FILE:h5dump${tgt_ext}>"
-D "TEST_ARGS:STRING=${ARGN};-o;${resultfile}.bin;${testfile}"
-D "TEST_FOLDER=${PROJECT_BINARY_DIR}/testfiles/std"
-D "TEST_OUTPUT=${conffile}.out"
@@ -773,7 +804,7 @@
add_test (
NAME H5DUMP_UD-${testname}
COMMAND "${CMAKE_COMMAND}"
- -D "TEST_PROGRAM=$<TARGET_FILE:h5dump>"
+ -D "TEST_PROGRAM=$<TARGET_FILE:h5dump${tgt_ext}>"
-D "TEST_ARGS:STRING=${ARGN}"
-D "TEST_FOLDER=${PROJECT_BINARY_DIR}/testfiles/std"
-D "TEST_OUTPUT=${resultfile}.out"
@@ -781,6 +812,7 @@
-D "TEST_REFERENCE=${resultfile}.ddl"
-D "TEST_ENV_VAR=HDF5_PLUGIN_PATH"
-D "TEST_ENV_VALUE=${CMAKE_BINARY_DIR}/plugins"
+ -D "TEST_LIBRARY_DIRECTORY=${CMAKE_TEST_OUTPUT_DIRECTORY}"
-P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake"
)
set_tests_properties (H5DUMP_UD-${testname} PROPERTIES DEPENDS H5DUMP_UD-${testname}-clear-objects)
@@ -1149,7 +1181,7 @@
zerodim.out.err
)
set_tests_properties (H5DUMP-clearall-objects PROPERTIES WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles/std")
- if (NOT "${last_test}" STREQUAL "")
+ if (last_test)
set_tests_properties (H5DUMP-clearall-objects PROPERTIES DEPENDS ${last_test})
endif ()
set (last_test "H5DUMP-clearall-objects")
@@ -1199,12 +1231,12 @@
# test for displaying groups
ADD_H5_TEST (tgroup-1 0 --enable-error-stack tgroup.h5)
# test for displaying the selected groups
- ADD_H5ERR_MASK_TEST (tgroup-2 1 --enable-error-stack --group=/g2 --group / -g /y tgroup.h5)
+ ADD_H5ERR_MASK_TEST (tgroup-2 1 "h5dump error: unable to open group \"/y\"" --enable-error-stack --group=/g2 --group / -g /y tgroup.h5)
# test for displaying simple space datasets
ADD_H5_TEST (tdset-1 0 --enable-error-stack tdset.h5)
# test for displaying selected datasets
- ADD_H5ERR_MASK_TEST (tdset-2 1 --enable-error-stack -H -d dset1 -d /dset2 --dataset=dset3 tdset.h5)
+ ADD_H5ERR_MASK_TEST (tdset-2 1 "h5dump error: unable to get link info from \"dset3\"" --enable-error-stack -H -d dset1 -d /dset2 --dataset=dset3 tdset.h5)
# test for displaying attributes
ADD_H5_TEST (tattr-1 0 --enable-error-stack tattr.h5)
@@ -1212,7 +1244,7 @@
ADD_H5_TEST (tattr-2 0 --enable-error-stack -a /\\\\/attr1 --attribute /attr4 --attribute=/attr5 tattr.h5)
ADD_H5_TEST_N (tattr-2 0 --enable-error-stack -N /\\\\/attr1 --any_path /attr4 --any_path=/attr5 tattr.h5)
# test for header and error messages
- ADD_H5ERR_MASK_TEST (tattr-3 1 --enable-error-stack --header -a /attr2 --attribute=/attr tattr.h5)
+ ADD_H5ERR_MASK_TEST (tattr-3 1 "h5dump error: unable to open attribute \"attr\"" --enable-error-stack --header -a /attr2 --attribute=/attr tattr.h5)
# test for displaying at least 9 attributes on root from a be machine
ADD_H5_TEST (tattr-4_be 0 --enable-error-stack tattr4_be.h5)
# test for displaying attributes in shared datatype (also in group and dataset)
@@ -1226,7 +1258,7 @@
ADD_H5_TEST_N (tslink-2 0 --enable-error-stack -N slink2 tslink.h5)
ADD_H5_TEST (tudlink-2 0 --enable-error-stack -l udlink2 tudlink.h5)
# test for displaying dangling soft links
- ADD_H5ERR_MASK_TEST (tslink-D 0 --enable-error-stack -d /slink1 tslink.h5)
+ ADD_H5ERR_MASK_TEST (tslink-D 0 "component not found" --enable-error-stack -d /slink1 tslink.h5)
# tests for hard links
ADD_H5_TEST (thlink-1 0 --enable-error-stack thlink.h5)
@@ -1243,7 +1275,7 @@
ADD_H5_TEST (tcomp-2 0 --enable-error-stack -t /type1 --datatype /type2 --datatype=/group1/type3 tcompound.h5)
ADD_H5_TEST_N (tcomp-2 0 --enable-error-stack -N /type1 --any_path /type2 --any_path=/group1/type3 tcompound.h5)
# test for unamed type
- ADD_H5ERR_MASK_TEST (tcomp-3 0 "--enable-error-stack;-t;/#6632;-g;/group2;tcompound.h5")
+ ADD_H5ERR_MASK_TEST (tcomp-3 0 "object '#6632' doesn't exist" "--enable-error-stack;-t;/#6632;-g;/group2;tcompound.h5")
# test complicated compound datatype
ADD_H5_TEST (tcomp-4 0 --enable-error-stack tcompound_complex.h5)
ADD_H5_TEST (tcompound_complex2 0 --enable-error-stack tcompound_complex2.h5)
@@ -1259,7 +1291,7 @@
ADD_H5_TEST (tnestedcmpddt 0 --enable-error-stack tnestedcmpddt.h5)
# test for options
- ADD_H5ERR_MASK_TEST (tall-1 0 --enable-error-stack tall.h5)
+ ADD_H5ERR_MASK_TEST (tall-1 0 "unable to open external file, external link file name = 'somefile'" --enable-error-stack tall.h5)
ADD_H5_TEST (tall-2 0 --enable-error-stack --header -g /g1/g1.1 -a attr2 tall.h5)
ADD_H5_TEST (tall-3 0 --enable-error-stack -d /g2/dset2.1 -l /g1/g1.2/g1.2.1/slink tall.h5)
ADD_H5_TEST_N (tall-3 0 --enable-error-stack -N /g2/dset2.1 -N /g1/g1.2/g1.2.1/slink tall.h5)
@@ -1290,7 +1322,7 @@
# test for files with array data
ADD_H5_TEST (tarray1 0 --enable-error-stack tarray1.h5)
# # added for bug# 2092 - tarray1_big.h5
- ADD_H5ERR_MASK_TEST (tarray1_big 0 --enable-error-stack -R tarray1_big.h5)
+ ADD_H5ERR_MASK_TEST (tarray1_big 0 "Undefined reference pointer" --enable-error-stack -R tarray1_big.h5)
ADD_H5_TEST (tarray2 0 --enable-error-stack tarray2.h5)
ADD_H5_TEST (tarray3 0 --enable-error-stack tarray3.h5)
ADD_H5_TEST (tarray4 0 --enable-error-stack tarray4.h5)
@@ -1319,13 +1351,13 @@
ADD_H5_TEST (tlarge_objname 0 --enable-error-stack -w157 tlarge_objname.h5)
# test '-A' to suppress data but print attr's
- ADD_H5ERR_MASK_TEST (tall-2A 0 --enable-error-stack -A tall.h5)
+ ADD_H5ERR_MASK_TEST (tall-2A 0 "unable to open external file, external link file name = 'somefile'" --enable-error-stack -A tall.h5)
# test '-A' to suppress attr's but print data
- ADD_H5ERR_MASK_TEST (tall-2A0 0 --enable-error-stack -A 0 tall.h5)
+ ADD_H5ERR_MASK_TEST (tall-2A0 0 "unable to open external file, external link file name = 'somefile'" --enable-error-stack -A 0 tall.h5)
# test '-r' to print attributes in ASCII instead of decimal
- ADD_H5ERR_MASK_TEST (tall-2B 0 --enable-error-stack -A -r tall.h5)
+ ADD_H5ERR_MASK_TEST (tall-2B 0 "unable to open external file, external link file name = 'somefile'" --enable-error-stack -A -r tall.h5)
# test Subsetting
ADD_H5_TEST (tall-4s 0 --enable-error-stack --dataset=/g1/g1.1/dset1.1.1 --start=1,1 --stride=2,3 --count=3,2 --block=1,1 tall.h5)
@@ -1354,7 +1386,7 @@
ADD_H5_TEST (file_space 0 --enable-error-stack -B file_space.h5)
# test -p with a non existing dataset
- ADD_H5ERR_MASK_TEST (tperror 1 --enable-error-stack -p -d bogus tfcontents1.h5)
+ ADD_H5ERR_MASK_TEST (tperror 1 "h5dump error: unable to get link info from \"bogus\"" --enable-error-stack -p -d bogus tfcontents1.h5)
# test for file contents
ADD_H5_TEST (tcontents 0 --enable-error-stack -n tfcontents1.h5)
@@ -1501,9 +1533,9 @@
# test for dataset region references
ADD_H5_TEST (tdatareg 0 --enable-error-stack tdatareg.h5)
- ADD_H5ERR_MASK_TEST (tdataregR 0 --enable-error-stack -R tdatareg.h5)
+ ADD_H5ERR_MASK_TEST (tdataregR 0 "Undefined reference pointer" --enable-error-stack -R tdatareg.h5)
ADD_H5_TEST (tattrreg 0 --enable-error-stack tattrreg.h5)
- ADD_H5ERR_MASK_TEST (tattrregR 0 -R --enable-error-stack tattrreg.h5)
+ ADD_H5ERR_MASK_TEST (tattrregR 0 "Undefined reference pointer" -R --enable-error-stack tattrreg.h5)
ADD_H5_EXPORT_TEST (tbinregR tdatareg.h5 0 --enable-error-stack -d /Dataset1 -s 0 -R -y -o)
# tests for group creation order
@@ -1521,21 +1553,21 @@
ADD_H5_TEST (torderattr4 0 --enable-error-stack -H --sort_by=creation_order --sort_order=descending torderattr.h5)
# tests for link references and order
- ADD_H5ERR_MASK_TEST (torderlinks1 0 --enable-error-stack --sort_by=name --sort_order=ascending tfcontents1.h5)
- ADD_H5ERR_MASK_TEST (torderlinks2 0 --enable-error-stack --sort_by=name --sort_order=descending tfcontents1.h5)
+ ADD_H5ERR_MASK_TEST (torderlinks1 0 "unable to open external file, external link file name = 'fname'" --enable-error-stack --sort_by=name --sort_order=ascending tfcontents1.h5)
+ ADD_H5ERR_MASK_TEST (torderlinks2 0 "unable to open external file, external link file name = 'fname'" --enable-error-stack --sort_by=name --sort_order=descending tfcontents1.h5)
# tests for floating point user defined printf format
ADD_H5_TEST (tfpformat 0 --enable-error-stack -m %.7f tfpformat.h5)
# tests for traversal of external links
- ADD_H5ERR_MASK_TEST (textlinksrc 0 --enable-error-stack textlinksrc.h5)
- ADD_H5ERR_MASK_TEST (textlinkfar 0 --enable-error-stack textlinkfar.h5)
+ ADD_H5ERR_MASK_TEST (textlinksrc 0 "Too many soft links in path" --enable-error-stack textlinksrc.h5)
+ ADD_H5ERR_MASK_TEST (textlinkfar 0 "Too many soft links in path" --enable-error-stack textlinkfar.h5)
# test for dangling external links
- ADD_H5ERR_MASK_TEST (textlink 0 --enable-error-stack textlink.h5)
+ ADD_H5ERR_MASK_TEST (textlink 0 "unable to open external file, external link file name = 'anotherfile'" --enable-error-stack textlink.h5)
# test for error stack display (BZ2048)
- ADD_H5ERR_MASK_ENV_TEST (filter_fail 1 "HDF5_PLUGIN_PRELOAD" "::" --enable-error-stack filter_fail.h5)
+ ADD_H5ERR_MASK_ENV_TEST (filter_fail 1 "filter plugins disabled" "HDF5_PLUGIN_PRELOAD" "::" --enable-error-stack filter_fail.h5)
# test for -o -y for dataset with attributes
ADD_H5_TEST_EXPORT (tall-6 tall.h5 0 --enable-error-stack -d /g1/g1.1/dset1.1.1 -y -o)
@@ -1546,6 +1578,9 @@
# test to verify HDFFV-10333: error similar to H5O_attr_decode in the jira issue
ADD_H5_TEST (err_attr_dspace 1 err_attr_dspace.h5)
+ # test to verify HDFFV-9407: long double full precision
+ ADD_H5_GREP_TEST (t128bit_float 1 "1.123456789012345" -m %.35Lf t128bit_float.h5)
+
##############################################################################
### P L U G I N T E S T S
##############################################################################
diff --git a/tools/test/h5dump/CMakeTestsPBITS.cmake b/tools/test/h5dump/CMakeTestsPBITS.cmake
index 4f3ee9f..feb5c68 100644
--- a/tools/test/h5dump/CMakeTestsPBITS.cmake
+++ b/tools/test/h5dump/CMakeTestsPBITS.cmake
@@ -119,15 +119,21 @@
##############################################################################
##############################################################################
+ if (NOT BUILD_SHARED_LIBS)
+ set (tgt_ext "")
+ else ()
+ set (tgt_ext "-shared")
+ endif ()
+
macro (ADD_H5_PBITS_TEST resultfile resultcode)
# If using memchecker add tests without using scripts
if (HDF5_ENABLE_USING_MEMCHECKER)
- add_test (NAME H5DUMP-${resultfile} COMMAND $<TARGET_FILE:h5dump> ${ARGN})
+ add_test (NAME H5DUMP-${resultfile} COMMAND $<TARGET_FILE:h5dump${tgt_ext}> ${ARGN})
set_tests_properties (H5DUMP-${resultfile} PROPERTIES WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles/pbits")
- if (NOT ${resultcode} STREQUAL "0")
+ if (${resultcode})
set_tests_properties (H5DUMP-${resultfile} PROPERTIES WILL_FAIL "true")
endif ()
- if (NOT "${last_pbits_test}" STREQUAL "")
+ if (last_pbits_test)
set_tests_properties (H5DUMP-${resultfile} PROPERTIES DEPENDS ${last_pbits_test})
endif ()
else ()
@@ -143,7 +149,7 @@
add_test (
NAME H5DUMP-${resultfile}
COMMAND "${CMAKE_COMMAND}"
- -D "TEST_PROGRAM=$<TARGET_FILE:h5dump>"
+ -D "TEST_PROGRAM=$<TARGET_FILE:h5dump${tgt_ext}>"
-D "TEST_ARGS:STRING=${ARGN}"
-D "TEST_FOLDER=${PROJECT_BINARY_DIR}/testfiles/pbits"
-D "TEST_OUTPUT=${resultfile}.out"
@@ -275,7 +281,7 @@
tpbitsUnsignedLongLong16.out.err
)
set_tests_properties (H5DUMP_PACKED_BITS-clearall-objects PROPERTIES WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles/pbits")
- if (NOT "${last_pbits_test}" STREQUAL "")
+ if (last_pbits_test)
set_tests_properties (H5DUMP_PACKED_BITS-clearall-objects PROPERTIES DEPENDS ${last_pbits_test})
endif ()
set (last_pbits_test "H5DUMP_PACKED_BITS-clearall-objects")
diff --git a/tools/test/h5dump/CMakeTestsVDS.cmake b/tools/test/h5dump/CMakeTestsVDS.cmake
index 922e79e..c557ba4 100644
--- a/tools/test/h5dump/CMakeTestsVDS.cmake
+++ b/tools/test/h5dump/CMakeTestsVDS.cmake
@@ -115,15 +115,21 @@
##############################################################################
##############################################################################
+ if (NOT BUILD_SHARED_LIBS)
+ set (tgt_ext "")
+ else ()
+ set (tgt_ext "-shared")
+ endif ()
+
macro (ADD_H5_VDS_TEST resultfile resultcode)
# If using memchecker add tests without using scripts
if (HDF5_ENABLE_USING_MEMCHECKER)
- add_test (NAME H5DUMP-${resultfile} COMMAND $<TARGET_FILE:h5dump> ${ARGN})
+ add_test (NAME H5DUMP-${resultfile} COMMAND $<TARGET_FILE:h5dump${tgt_ext}> ${ARGN})
set_tests_properties (H5DUMP-${resultfile} PROPERTIES WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles/vds")
- if (NOT "${resultcode}" STREQUAL "0")
+ if (${resultcode})
set_tests_properties (H5DUMP-${resultfile} PROPERTIES WILL_FAIL "true")
endif ()
- if (NOT "${last_vds_test}" STREQUAL "")
+ if (last_vds_test)
set_tests_properties (H5DUMP-${resultfile} PROPERTIES DEPENDS ${last_VDS_test})
endif ()
else ()
@@ -139,7 +145,7 @@
add_test (
NAME H5DUMP-${resultfile}
COMMAND "${CMAKE_COMMAND}"
- -D "TEST_PROGRAM=$<TARGET_FILE:h5dump>"
+ -D "TEST_PROGRAM=$<TARGET_FILE:h5dump${tgt_ext}>"
-D "TEST_ARGS:STRING=${ARGN}"
-D "TEST_FOLDER=${PROJECT_BINARY_DIR}/testfiles/vds"
-D "TEST_OUTPUT=${resultfile}.out"
@@ -154,15 +160,15 @@
macro (ADD_H5_VDS_PREFIX_TEST resultfile resultcode)
# If using memchecker add tests without using scripts
if (HDF5_ENABLE_USING_MEMCHECKER)
- add_test (NAME H5DUMP_PREFIX-${resultfile} COMMAND $<TARGET_FILE:h5dump> ${ARGN})
+ add_test (NAME H5DUMP_PREFIX-${resultfile} COMMAND $<TARGET_FILE:h5dump${tgt_ext}> ${ARGN})
set_tests_properties (H5DUMP_PREFIX-${resultfile} PROPERTIES
ENVIRONMENT "HDF5_VDS_PREFIX=${PROJECT_BINARY_DIR}/testfiles/vds/"
WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles/vds/prefix"
)
- if (NOT "${resultcode}" STREQUAL "0")
+ if (${resultcode})
set_tests_properties (H5DUMP_PREFIX-${resultfile} PROPERTIES WILL_FAIL "true")
endif ()
- if (NOT "${last_vds_test}" STREQUAL "")
+ if (last_vds_test)
set_tests_properties (H5DUMP_PREFIX-${resultfile} PROPERTIES DEPENDS ${last_VDS_test})
endif ()
else ()
@@ -178,7 +184,7 @@
add_test (
NAME H5DUMP_PREFIX-${resultfile}
COMMAND "${CMAKE_COMMAND}"
- -D "TEST_PROGRAM=$<TARGET_FILE:h5dump>"
+ -D "TEST_PROGRAM=$<TARGET_FILE:h5dump${tgt_ext}>"
-D "TEST_ARGS:STRING=${ARGN}"
-D "TEST_FOLDER=${PROJECT_BINARY_DIR}/testfiles/vds/prefix"
-D "TEST_OUTPUT=${resultfile}.out"
@@ -195,12 +201,12 @@
macro (ADD_H5_VDS_LAYOUT resultfile resultcode)
# If using memchecker add tests without using scripts
if (HDF5_ENABLE_USING_MEMCHECKER)
- add_test (NAME H5DUMP-${resultfile} COMMAND $<TARGET_FILE:h5dump> -p ${ARGN})
+ add_test (NAME H5DUMP-${resultfile} COMMAND $<TARGET_FILE:h5dump${tgt_ext}> -p ${ARGN})
set_tests_properties (H5DUMP-${resultfile} PROPERTIES WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles/vds")
- if (NOT "${resultcode}" STREQUAL "0")
+ if (${resultcode})
set_tests_properties (H5DUMP-${resultfile} PROPERTIES WILL_FAIL "true")
endif ()
- if (NOT "${last_vds_test}" STREQUAL "")
+ if (last_vds_test)
set_tests_properties (H5DUMP-${resultfile} PROPERTIES DEPENDS ${last_VDS_test})
endif ()
else ()
@@ -216,7 +222,7 @@
add_test (
NAME H5DUMP-${resultfile}
COMMAND "${CMAKE_COMMAND}"
- -D "TEST_PROGRAM=$<TARGET_FILE:h5dump>"
+ -D "TEST_PROGRAM=$<TARGET_FILE:h5dump${tgt_ext}>"
-D "TEST_ARGS:STRING=-p;${ARGN}"
-D "TEST_FOLDER=${PROJECT_BINARY_DIR}/testfiles/vds"
-D "TEST_OUTPUT=${resultfile}.out"
@@ -276,7 +282,7 @@
vds_layout-maxmin.out.err
)
set_tests_properties (H5DUMP_VDS-clearall-objects PROPERTIES WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles/vds")
- if (NOT "${last_vds_test}" STREQUAL "")
+ if (last_vds_test)
set_tests_properties (H5DUMP_VDS-clearall-objects PROPERTIES DEPENDS ${last_vds_test})
endif ()
set (last_VDS_test "H5DUMP_VDS-clearall-objects")
diff --git a/tools/test/h5dump/CMakeTestsXML.cmake b/tools/test/h5dump/CMakeTestsXML.cmake
index de87d2f..a883b86 100644
--- a/tools/test/h5dump/CMakeTestsXML.cmake
+++ b/tools/test/h5dump/CMakeTestsXML.cmake
@@ -160,6 +160,12 @@
##############################################################################
##############################################################################
+ if (NOT BUILD_SHARED_LIBS)
+ set (tgt_ext "")
+ else ()
+ set (tgt_ext "-shared")
+ endif ()
+
macro (ADD_XML_SKIP_H5_TEST skipresultfile skipresultcode testtype)
if ("${testtype}" STREQUAL "SKIP")
if (NOT HDF5_ENABLE_USING_MEMCHECKER)
@@ -176,12 +182,12 @@
macro (ADD_XML_H5_TEST resultfile resultcode)
if (HDF5_ENABLE_USING_MEMCHECKER)
- add_test (NAME H5DUMP_XML-${resultfile} COMMAND $<TARGET_FILE:h5dump> --xml ${ARGN})
+ add_test (NAME H5DUMP_XML-${resultfile} COMMAND $<TARGET_FILE:h5dump${tgt_ext}> --xml ${ARGN})
set_tests_properties (H5DUMP_XML-${resultfile} PROPERTIES WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles/xml")
- if (NOT "${resultcode}" STREQUAL "0")
+ if (${resultcode})
set_tests_properties (H5DUMP_XML-${resultfile} PROPERTIES WILL_FAIL "true")
endif ()
- if (NOT "${last_xml_test}" STREQUAL "")
+ if (last_xml_test)
set_tests_properties (H5DUMP_XML-${resultfile} PROPERTIES DEPENDS ${last_xml_test})
endif ()
else ()
@@ -197,7 +203,7 @@
add_test (
NAME H5DUMP_XML-${resultfile}
COMMAND "${CMAKE_COMMAND}"
- -D "TEST_PROGRAM=$<TARGET_FILE:h5dump>"
+ -D "TEST_PROGRAM=$<TARGET_FILE:h5dump${tgt_ext}>"
-D "TEST_ARGS:STRING=--xml;${ARGN}"
-D "TEST_FOLDER=${PROJECT_BINARY_DIR}/testfiles/xml"
-D "TEST_OUTPUT=${resultfile}.out"
@@ -357,7 +363,7 @@
tvlstr.h5.out.err
)
set_tests_properties (H5DUMP-XML-clearall-objects PROPERTIES WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles/xml")
- if (NOT "${last_xml_test}" STREQUAL "")
+ if (last_xml_test)
set_tests_properties (H5DUMP-XML-clearall-objects PROPERTIES DEPENDS ${last_xml_test})
endif ()
set (last_test "H5DUMP-XML-clearall-objects")
diff --git a/tools/test/h5dump/h5dumpgentest.c b/tools/test/h5dump/h5dumpgentest.c
index 946ca04..3a414d1 100644
--- a/tools/test/h5dump/h5dumpgentest.c
+++ b/tools/test/h5dump/h5dumpgentest.c
@@ -1889,7 +1889,7 @@ static void gent_str2(void)
int i;
- char buf[LENSTR+10];
+ char buf[LENSTR+20];
char buf2[3*LENSTR2];
hsize_t sdim;
@@ -1941,7 +1941,7 @@ static void gent_str2(void)
for(i = 0; (hsize_t)i < sdim; i++) {
start[0] = (hsize_t)i;
- sprintf(buf, "This is row %1d of type H5T_STR_NULLTERM of", i);
+ sprintf(buf, "This is row %d of type H5T_STR_NULLTERM of", i);
H5Tset_size(memtype, HDstrlen(buf)+1);
H5Sselect_hyperslab(hyper_space, H5S_SELECT_SET, start, stride, count, block);
H5Dwrite(dataset, memtype, mem_space, hyper_space, H5P_DEFAULT, buf);
@@ -1954,7 +1954,7 @@ static void gent_str2(void)
for(i = 0; (hsize_t)i < sdim; i++) {
start[0] = (hsize_t)i;
- sprintf(buf, "This is row %1d of type H5T_STR_NULLTERM of string array", i);
+ sprintf(buf, "This is row %d of type H5T_STR_NULLTERM of string array", i);
H5Tset_size(memtype, HDstrlen(buf)+1);
H5Sselect_hyperslab(hyper_space, H5S_SELECT_SET, start, stride, count, block);
H5Dwrite(dataset, memtype, mem_space, hyper_space, H5P_DEFAULT, buf);
@@ -1974,7 +1974,7 @@ static void gent_str2(void)
for(i = 0;(hsize_t) i < sdim; i++) {
start[0] = (hsize_t)i;
- sprintf(buf, "This is row %1d of type H5T_STR_NULLPAD of", i);
+ sprintf(buf, "This is row %d of type H5T_STR_NULLPAD of", i);
H5Tset_size(memtype, HDstrlen(buf)+1);
H5Sselect_hyperslab(hyper_space, H5S_SELECT_SET, start, stride, count, block);
H5Dwrite(dataset, memtype, mem_space, hyper_space, H5P_DEFAULT, buf);
@@ -1988,7 +1988,7 @@ static void gent_str2(void)
for(i = 0; (hsize_t)i < sdim; i++) {
start[0] = (hsize_t)i;
- sprintf(buf, "This is row %1d of type H5T_STR_NULLPAD of string array", i);
+ sprintf(buf, "This is row %d of type H5T_STR_NULLPAD of string array", i);
H5Tset_size(memtype, HDstrlen(buf)+1);
H5Sselect_hyperslab(hyper_space, H5S_SELECT_SET, start, stride, count, block);
H5Dwrite(dataset, memtype, mem_space, hyper_space, H5P_DEFAULT, buf);
@@ -2007,7 +2007,7 @@ static void gent_str2(void)
for(i = 0; (hsize_t)i < sdim; i++) {
start[0] = (hsize_t)i;
- sprintf(buf, "This is row %1d of type H5T_STR_SPACEPAD of", i);
+ sprintf(buf, "This is row %d of type H5T_STR_SPACEPAD of", i);
H5Tset_size(memtype, HDstrlen(buf) + 1);
H5Sselect_hyperslab(hyper_space, H5S_SELECT_SET, start, stride, count, block);
H5Dwrite(dataset, memtype, mem_space, hyper_space, H5P_DEFAULT, buf);
@@ -2021,7 +2021,7 @@ static void gent_str2(void)
for(i = 0; (hsize_t)i < sdim; i++) {
start[0] = (hsize_t)i;
- sprintf(buf, "This is row %1d of type H5T_STR_SPACEPAD of string array", i);
+ sprintf(buf, "This is row %d of type H5T_STR_SPACEPAD of string array", i);
H5Tset_size(memtype, HDstrlen(buf) + 1);
H5Sselect_hyperslab(hyper_space, H5S_SELECT_SET, start, stride, count, block);
H5Dwrite(dataset, memtype, mem_space, hyper_space, H5P_DEFAULT, buf);
@@ -7532,16 +7532,6 @@ gent_nodata(void)
{
hid_t fid, dataset, space;
hsize_t dims[2];
- uint8_t dsetu8[F66_XDIM][F66_YDIM8], valu8bits;
- uint16_t dsetu16[F66_XDIM][F66_YDIM16], valu16bits;
- uint32_t dsetu32[F66_XDIM][F66_YDIM32], valu32bits;
- uint64_t dsetu64[F66_XDIM][F66_YDIM64], valu64bits;
- int8_t dset8[F66_XDIM][F66_YDIM8], val8bits;
- int16_t dset16[F66_XDIM][F66_YDIM16], val16bits;
- int32_t dset32[F66_XDIM][F66_YDIM32], val32bits;
- int64_t dset64[F66_XDIM][F66_YDIM64], val64bits;
- double dsetdbl[F66_XDIM][F66_YDIM8];
- unsigned int i, j;
fid = H5Fcreate(FILE87, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
diff --git a/tools/test/h5dump/testh5dump.sh.in b/tools/test/h5dump/testh5dump.sh.in
index af5d547..e5680cf 100644
--- a/tools/test/h5dump/testh5dump.sh.in
+++ b/tools/test/h5dump/testh5dump.sh.in
@@ -34,13 +34,16 @@ H5IMPORT_BIN=`pwd`/$H5IMPORT # The path of the h5import tool binary
RM='rm -rf'
CMP='cmp'
DIFF='diff -c'
+GREP='grep'
CP='cp'
DIRNAME='dirname'
LS='ls'
AWK='awk'
# Skip plugin module to test missing filter
-ENVCMD="env HDF5_PLUGIN_PRELOAD=::"
+# Also reset the VOL connector to only use the native connector, because of the
+# error stack checking. QAK - 2019/03/09
+ENVCMD="env HDF5_PLUGIN_PRELOAD=:: HDF5_VOL_CONNECTOR=native"
WORDS_BIGENDIAN="@WORDS_BIGENDIAN@"
@@ -81,6 +84,7 @@ $SRC_H5DUMP_TESTFILES/charsets.h5
$SRC_H5DUMP_TESTFILES/file_space.h5
$SRC_H5DUMP_TESTFILES/filter_fail.h5
$SRC_H5DUMP_TESTFILES/packedbits.h5
+$SRC_H5DUMP_TESTFILES/t128bit_float.h5
$SRC_H5DUMP_TESTFILES/taindices.h5
$SRC_H5DUMP_TESTFILES/tall.h5
$SRC_H5DUMP_TESTFILES/tarray1.h5
@@ -754,7 +758,7 @@ TOOLTEST4() {
TESTING $DUMPER $@
(
cd $TESTDIR
- $RUNSERIAL $DUMPER_BIN "$@"
+ $ENVCMD $RUNSERIAL $DUMPER_BIN "$@"
) >$actual 2>$actual_err
# save actual and actual_err in case they are needed later.
@@ -901,6 +905,36 @@ TOOLTEST_HELP() {
}
+# Call the h5dump tool and grep for a value
+#
+GREPTEST()
+{
+ expectdata=$1
+ actual=$TESTDIR/$2
+ actual_err="$TESTDIR/`basename $2 .ddl`.oerr"
+ shift
+ shift
+
+ # Run test.
+ TESTING $DUMPER -p $@
+ (
+ cd $TESTDIR
+ $ENVCMD $RUNSERIAL $DUMPER_BIN -p "$@"
+ ) >$actual 2>$actual_err
+ $GREP $expectdata $actual > /dev/null
+ if [ $? -eq 0 ]; then
+ echo " PASSED"
+ else
+ echo " FAILED"
+ nerrors="`expr $nerrors + 1`"
+ fi
+
+ # Clean up output file
+ if test -z "$HDF5_NOCLEANUP"; then
+ rm -f $actual $actual_err
+ fi
+}
+
# Print a "SKIP" message
SKIP() {
TESTING $DUMPER $@
@@ -1361,6 +1395,9 @@ TOOLTEST3 non_existing.ddl --enable-error-stack tgroup.h5 non_existing.h5
# test to verify HDFFV-10333: error similar to H5O_attr_decode in the jira issue
TOOLTEST err_attr_dspace.ddl err_attr_dspace.h5
+# test to verify HDFFV-9407: long double full precision
+GREPTEST "1.123456789012345" t128bit_float.ddl -m %.35Lf t128bit_float.h5
+
# Clean up temporary files/directories
CLEAN_TESTFILES_AND_TESTDIR
diff --git a/tools/test/h5format_convert/CMakeLists.txt b/tools/test/h5format_convert/CMakeLists.txt
index 170ba4c..019252f 100644
--- a/tools/test/h5format_convert/CMakeLists.txt
+++ b/tools/test/h5format_convert/CMakeLists.txt
@@ -5,16 +5,21 @@ project (HDF5_TOOLS_TEST_H5FC C)
# Add the h5format_convert test executables
# --------------------------------------------------------------------
add_executable (h5fc_chk_idx ${HDF5_TOOLS_TEST_H5FC_SOURCE_DIR}/h5fc_chk_idx.c)
-target_include_directories(h5fc_chk_idx PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>")
-TARGET_C_PROPERTIES (h5fc_chk_idx STATIC)
-target_link_libraries (h5fc_chk_idx PRIVATE ${HDF5_LIB_TARGET} ${HDF5_TOOLS_LIB_TARGET})
+target_include_directories (h5fc_chk_idx PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>")
+if (NOT ONLY_SHARED_LIBS)
+ TARGET_C_PROPERTIES (h5fc_chk_idx STATIC)
+ target_link_libraries (h5fc_chk_idx PRIVATE ${HDF5_TOOLS_LIB_TARGET} ${HDF5_LIB_TARGET})
+else ()
+ TARGET_C_PROPERTIES (h5fc_chk_idx SHARED)
+ target_link_libraries (h5fc_chk_idx PRIVATE ${HDF5_TOOLS_LIBSH_TARGET} ${HDF5_LIBSH_TARGET})
+endif ()
set_target_properties (h5fc_chk_idx PROPERTIES FOLDER tools)
-if (HDF5_BUILD_GENERATORS)
+if (HDF5_BUILD_GENERATORS AND NOT ONLY_SHARED_LIBS)
add_executable (h5fc_gentest ${HDF5_TOOLS_TEST_H5FC_SOURCE_DIR}/h5fc_gentest.c)
- target_include_directories(h5fc_gentest PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>")
+ target_include_directories (h5fc_gentest PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>")
TARGET_C_PROPERTIES (h5fc_gentest STATIC)
- target_link_libraries (h5fc_gentest PRIVATE ${HDF5_LIB_TARGET} ${HDF5_TOOLS_LIB_TARGET})
+ target_link_libraries (h5fc_gentest PRIVATE ${HDF5_TOOLS_LIB_TARGET} ${HDF5_LIB_TARGET})
set_target_properties (h5fc_gentest PROPERTIES FOLDER generator/tools)
#add_test (NAME h5fc_gentest COMMAND $<TARGET_FILE:h5fc_gentest>)
diff --git a/tools/test/h5format_convert/CMakeTests.cmake b/tools/test/h5format_convert/CMakeTests.cmake
index 5792d40..e1abc48 100644
--- a/tools/test/h5format_convert/CMakeTests.cmake
+++ b/tools/test/h5format_convert/CMakeTests.cmake
@@ -97,6 +97,12 @@
##############################################################################
##############################################################################
+ if (NOT BUILD_SHARED_LIBS)
+ set (tgt_ext "")
+ else ()
+ set (tgt_ext "-shared")
+ endif ()
+
macro (ADD_H5_OUTPUT testname resultfile resultcode testfile)
# If using memchecker add tests without using scripts
if (NOT HDF5_ENABLE_USING_MEMCHECKER)
@@ -108,10 +114,10 @@
./testfiles/${testname}.out
./testfiles/${testname}.out.err
)
- if (NOT "${last_test}" STREQUAL "")
+ if (last_test)
set_tests_properties (H5FC-${testname}-clear-objects PROPERTIES DEPENDS ${last_test})
endif ()
- if (NOT "${testfile}" STREQUAL "")
+ if (${testfile})
add_test (
NAME H5FC-${testname}-${testfile}-tmpfile
COMMAND ${CMAKE_COMMAND}
@@ -121,7 +127,7 @@
add_test (
NAME H5FC-${testname}-${testfile}
COMMAND "${CMAKE_COMMAND}"
- -D "TEST_PROGRAM=$<TARGET_FILE:h5format_convert>"
+ -D "TEST_PROGRAM=$<TARGET_FILE:h5format_convert${tgt_ext}>"
-D "TEST_ARGS=${ARGN};outtmp.h5"
-D "TEST_FOLDER=${PROJECT_BINARY_DIR}/testfiles"
-D "TEST_OUTPUT=${testname}.out"
@@ -136,7 +142,7 @@
add_test (
NAME H5FC-${testname}-NA
COMMAND "${CMAKE_COMMAND}"
- -D "TEST_PROGRAM=$<TARGET_FILE:h5format_convert>"
+ -D "TEST_PROGRAM=$<TARGET_FILE:h5format_convert${tgt_ext}>"
-D "TEST_ARGS=${ARGN}"
-D "TEST_FOLDER=${PROJECT_BINARY_DIR}/testfiles"
-D "TEST_OUTPUT=${testname}.out"
@@ -161,7 +167,7 @@
./testfiles/${testname}.out
./testfiles/${testname}.out.err
)
- if (NOT "${last_test}" STREQUAL "")
+ if (last_test)
set_tests_properties (H5FC-${testname}-clear-objects PROPERTIES DEPENDS ${last_test})
endif ()
add_test (
@@ -173,7 +179,7 @@
add_test (
NAME H5FC-${testname}-${testfile}
COMMAND "${CMAKE_COMMAND}"
- -D "TEST_PROGRAM=$<TARGET_FILE:h5format_convert>"
+ -D "TEST_PROGRAM=$<TARGET_FILE:h5format_convert${tgt_ext}>"
-D "TEST_ARGS=${ARGN};outtmp.h5"
-D "TEST_FOLDER=${PROJECT_BINARY_DIR}/testfiles"
-D "TEST_OUTPUT=${testname}.out"
@@ -186,7 +192,7 @@
endif ()
endmacro ()
- macro (ADD_H5_MASK_OUTPUT testname resultfile resultcode testfile)
+ macro (ADD_H5_MASK_OUTPUT testname resultfile resultcode result_errcheck testfile)
# If using memchecker add tests without using scripts
if (NOT HDF5_ENABLE_USING_MEMCHECKER)
add_test (
@@ -197,48 +203,29 @@
./testfiles/${testname}.out
./testfiles/${testname}.out.err
)
- if (NOT "${last_test}" STREQUAL "")
+ if (last_test)
set_tests_properties (H5FC-${testname}-clear-objects PROPERTIES DEPENDS ${last_test})
endif ()
- if (NOT "${testfile}" STREQUAL "")
- 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}"
- -D "TEST_ERRREF=${resultfile}.err"
- -D "TEST_MASK_ERROR=true"
- -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}")
- else ()
- add_test (
- NAME H5FC-${testname}-NA
- COMMAND "${CMAKE_COMMAND}"
- -D "TEST_PROGRAM=$<TARGET_FILE:h5format_convert>"
- -D "TEST_ARGS=${ARGN}"
- -D "TEST_FOLDER=${PROJECT_BINARY_DIR}/testfiles"
- -D "TEST_OUTPUT=${testname}.out"
- -D "TEST_EXPECT=${resultcode}"
- -D "TEST_REFERENCE=${resultfile}"
- -D "TEST_ERRREF=${resultfile}.err"
- -D "TEST_MASK_ERROR=true"
- -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake"
- )
- set_tests_properties (H5FC-${testname}-NA PROPERTIES DEPENDS "H5FC-${testname}-clear-objects")
- set (last_test "H5FC-${testname}-NA")
- 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${tgt_ext}>"
+ -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}"
+ -D "TEST_ERRREF=${result_errcheck}"
+ -P "${HDF_RESOURCES_EXT_DIR}/grepTest.cmake"
+ )
+ set_tests_properties (H5FC-${testname}-${testfile} PROPERTIES DEPENDS "H5FC-${testname}-${testfile}-tmpfile")
+ set (last_test "H5FC-${testname}-${testfile}")
endif ()
endmacro ()
@@ -253,7 +240,7 @@
./testfiles/${testname}.out
./testfiles/${testname}.out.err
)
- if (NOT "${last_test}" STREQUAL "")
+ if (last_test)
set_tests_properties (H5FC-${testname}-clear-objects PROPERTIES DEPENDS ${last_test})
endif ()
add_test (
@@ -265,7 +252,7 @@
add_test (
NAME H5FC-${testname}
COMMAND "${CMAKE_COMMAND}"
- -D "TEST_PROGRAM=$<TARGET_FILE:h5format_convert>"
+ -D "TEST_PROGRAM=$<TARGET_FILE:h5format_convert${tgt_ext}>"
-D "TEST_ARGS=${ARGN};./testfiles/tmp.h5"
-D "TEST_FOLDER=${PROJECT_BINARY_DIR}"
-D "TEST_OUTPUT=testfiles/${testname}.out"
@@ -300,7 +287,7 @@
./testfiles/${testname}.out
./testfiles/${testname}.out.err
)
- if (NOT "${last_test}" STREQUAL "")
+ if (last_test)
set_tests_properties (H5FC-${testname}-clear-objects PROPERTIES DEPENDS ${last_test})
endif ()
add_test (
@@ -312,7 +299,7 @@
add_test (
NAME H5FC-${testname}
COMMAND "${CMAKE_COMMAND}"
- -D "TEST_PROGRAM=$<TARGET_FILE:h5format_convert>"
+ -D "TEST_PROGRAM=$<TARGET_FILE:h5format_convert${tgt_ext}>"
-D "TEST_ARGS=-d;${ARGN};./testfiles/chktmp.h5"
-D "TEST_FOLDER=${PROJECT_BINARY_DIR}"
-D "TEST_OUTPUT=testfiles/${testname}.out"
@@ -343,7 +330,7 @@
./testfiles/${testname}_chk.out
./testfiles/${testname}_chk.out.err
)
- if (NOT "${last_test}" STREQUAL "")
+ if (last_test)
set_tests_properties (H5FC-${testname}-clear-objects PROPERTIES DEPENDS ${last_test})
endif ()
add_test (
@@ -355,7 +342,7 @@
add_test (
NAME H5FC-${testname}
COMMAND "${CMAKE_COMMAND}"
- -D "TEST_PROGRAM=$<TARGET_FILE:h5format_convert>"
+ -D "TEST_PROGRAM=$<TARGET_FILE:h5format_convert${tgt_ext}>"
-D "TEST_ARGS=${ARGN};./testfiles/dmptmp.h5"
-D "TEST_FOLDER=${PROJECT_BINARY_DIR}"
-D "TEST_OUTPUT=testfiles/${testname}.out"
@@ -367,7 +354,7 @@
add_test (
NAME H5FC_CHECK_DUMP-${testname}
COMMAND "${CMAKE_COMMAND}"
- -D "TEST_PROGRAM=$<TARGET_FILE:h5dump>"
+ -D "TEST_PROGRAM=$<TARGET_FILE:h5dump${tgt_ext}>"
-D "TEST_ARGS:STRING=-BH;./testfiles/dmptmp.h5"
-D "TEST_FOLDER=${PROJECT_BINARY_DIR}"
-D "TEST_OUTPUT=testfiles/${testname}_chk.out"
@@ -449,7 +436,7 @@
chktmp.h5
dmptmp.h5
)
- if (NOT "${last_test}" STREQUAL "")
+ if (last_test)
set_tests_properties (H5FC-clearall-objects PROPERTIES DEPENDS ${last_test})
endif ()
set (last_test "H5FC-clearall-objects")
@@ -493,7 +480,7 @@
#
#
# h5format_convert -v h5fc_err_level.h5 (error encountered in converting the dataset)
- ADD_H5_MASK_OUTPUT (h5fc_v_err h5fc_v_err.ddl 1 h5fc_err_level.h5 -v)
+ ADD_H5_MASK_OUTPUT (h5fc_v_err h5fc_v_err.ddl 1 "h5format_convert error: unable to downgrade dataset \"/DSET_ERR\"" h5fc_err_level.h5 -v)
#
#
#
diff --git a/tools/test/h5import/CMakeLists.txt b/tools/test/h5import/CMakeLists.txt
index 500be58..9364683 100644
--- a/tools/test/h5import/CMakeLists.txt
+++ b/tools/test/h5import/CMakeLists.txt
@@ -5,9 +5,14 @@ project (HDF5_TOOLS_TEST_H5IMPORT C)
# Add the h5import executables
# --------------------------------------------------------------------
add_executable (h5importtest ${HDF5_TOOLS_TEST_H5IMPORT_SOURCE_DIR}/h5importtest.c)
-target_include_directories(h5importtest PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>")
-TARGET_C_PROPERTIES (h5importtest STATIC)
-target_link_libraries (h5importtest PRIVATE ${HDF5_LIB_TARGET} ${HDF5_TOOLS_LIB_TARGET})
+target_include_directories (h5importtest PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>")
+if (NOT ONLY_SHARED_LIBS)
+ TARGET_C_PROPERTIES (h5importtest STATIC)
+ target_link_libraries (h5importtest PRIVATE ${HDF5_TOOLS_LIB_TARGET} ${HDF5_LIB_TARGET})
+else ()
+ TARGET_C_PROPERTIES (h5importtest SHARED)
+ target_link_libraries (h5importtest PRIVATE ${HDF5_TOOLS_LIBSH_TARGET} ${HDF5_LIBSH_TARGET})
+endif ()
set_target_properties (h5importtest PROPERTIES FOLDER tools)
include (CMakeTests.cmake)
diff --git a/tools/test/h5import/CMakeTests.cmake b/tools/test/h5import/CMakeTests.cmake
index 7d76fba..9d36276 100644
--- a/tools/test/h5import/CMakeTests.cmake
+++ b/tools/test/h5import/CMakeTests.cmake
@@ -95,11 +95,18 @@
### T H E T E S T S M A C R O S ###
##############################################################################
##############################################################################
+
+ if (NOT BUILD_SHARED_LIBS)
+ set (tgt_ext "")
+ else ()
+ set (tgt_ext "-shared")
+ endif ()
+
macro (ADD_H5_TEST testname importfile conffile testfile)
# If using memchecker skip macro based tests
if (HDF5_ENABLE_USING_MEMCHECKER)
- add_test (NAME H5IMPORT-${testname} COMMAND $<TARGET_FILE:h5import> ${importfile} -c ${conffile} -o ${testfile})
- if (NOT "${last_test}" STREQUAL "")
+ add_test (NAME H5IMPORT-${testname} COMMAND $<TARGET_FILE:h5import${tgt_ext}> ${importfile} -c ${conffile} -o ${testfile})
+ if (last_test)
set_tests_properties (H5IMPORT-${testname} PROPERTIES DEPENDS H5IMPORT-h5importtest)
endif ()
else ()
@@ -116,13 +123,13 @@
)
set_tests_properties (H5IMPORT-${testname}-clear-objects PROPERTIES DEPENDS H5IMPORT-h5importtest)
- add_test (NAME H5IMPORT-${testname} COMMAND $<TARGET_FILE:h5import> ${importfile} -c ${conffile} -o ${testfile})
+ add_test (NAME H5IMPORT-${testname} COMMAND $<TARGET_FILE:h5import${tgt_ext}> ${importfile} -c ${conffile} -o ${testfile})
set_tests_properties (H5IMPORT-${testname} PROPERTIES DEPENDS H5IMPORT-${testname}-clear-objects)
add_test (
NAME H5IMPORT-${testname}-H5DMP
COMMAND "${CMAKE_COMMAND}"
- -D "TEST_PROGRAM=$<TARGET_FILE:h5dump>"
+ -D "TEST_PROGRAM=$<TARGET_FILE:h5dump${tgt_ext}>"
-D "TEST_ARGS:STRING=${testfile}"
-D "TEST_FOLDER=${PROJECT_BINARY_DIR}"
-D "TEST_OUTPUT=${testfile}.new"
@@ -135,7 +142,7 @@
add_test (
NAME H5IMPORT-${testname}-H5DMP_CMP
COMMAND "${CMAKE_COMMAND}"
- -D "TEST_PROGRAM=$<TARGET_FILE:h5dump>"
+ -D "TEST_PROGRAM=$<TARGET_FILE:h5dump${tgt_ext}>"
-D "TEST_ARGS:STRING=testfiles/${testfile}"
-D "TEST_FOLDER=${PROJECT_BINARY_DIR}"
-D "TEST_OUTPUT=${testfile}.out"
@@ -170,7 +177,7 @@
add_test (
NAME H5IMPORT-DUMP-${testname}-H5DMP
COMMAND "${CMAKE_COMMAND}"
- -D "TEST_PROGRAM=$<TARGET_FILE:h5dump>"
+ -D "TEST_PROGRAM=$<TARGET_FILE:h5dump${tgt_ext}>"
-D "TEST_ARGS:STRING=-p;-d;${datasetname};-o;d${testfile}.bin;-b;NATIVE;testfiles/${testfile}"
-D "TEST_FOLDER=${PROJECT_BINARY_DIR}"
-D "TEST_OUTPUT=d${testfile}.dmp"
@@ -182,7 +189,7 @@
add_test (
NAME H5IMPORT-DUMP-${testname}-H5DMP
COMMAND "${CMAKE_COMMAND}"
- -D "TEST_PROGRAM=$<TARGET_FILE:h5dump>"
+ -D "TEST_PROGRAM=$<TARGET_FILE:h5dump${tgt_ext}>"
-D "TEST_ARGS:STRING=-p;-d;${datasetname};-o;d${testfile}.bin;-y;--width=1;testfiles/${testfile}"
-D "TEST_FOLDER=${PROJECT_BINARY_DIR}"
-D "TEST_OUTPUT=d${testfile}.dmp"
@@ -196,7 +203,7 @@
add_test (
NAME H5IMPORT-DUMP-${testname}
COMMAND "${CMAKE_COMMAND}"
- -D "TEST_PROGRAM=$<TARGET_FILE:h5import>"
+ -D "TEST_PROGRAM=$<TARGET_FILE:h5import${tgt_ext}>"
-D "TEST_ARGS:STRING=d${testfile}.bin;-c;d${testfile}.dmp;-o;d${testfile}"
-D "TEST_FOLDER=${PROJECT_BINARY_DIR}"
-D "TEST_OUTPUT=d${testfile}.imp"
@@ -209,7 +216,7 @@
add_test (
NAME H5IMPORT-DUMP-${testname}-H5DFF
COMMAND "${CMAKE_COMMAND}"
- -D "TEST_PROGRAM=$<TARGET_FILE:h5diff>"
+ -D "TEST_PROGRAM=$<TARGET_FILE:h5diff${tgt_ext}>"
-D "TEST_ARGS:STRING=-r;d${testfile};testfiles/${testfile};${datasetname};${datasetname}"
-D "TEST_FOLDER=${PROJECT_BINARY_DIR}"
-D "TEST_OUTPUT=d${testfile}.dff"
@@ -243,7 +250,7 @@
add_test (
NAME H5IMPORT_SUB-DUMP-${testname}-H5DMP
COMMAND "${CMAKE_COMMAND}"
- -D "TEST_PROGRAM=$<TARGET_FILE:h5dump>"
+ -D "TEST_PROGRAM=$<TARGET_FILE:h5dump${tgt_ext}>"
-D "TEST_ARGS:STRING=-p;-d;${datasetname};${ARGN};-o;${testname}.bin;-b;NATIVE;testfiles/${testfile}"
-D "TEST_FOLDER=${PROJECT_BINARY_DIR}"
-D "TEST_OUTPUT=${testname}.dmp"
@@ -256,7 +263,7 @@
add_test (
NAME H5IMPORT_SUB-DUMP-${testname}-H5IMP
COMMAND "${CMAKE_COMMAND}"
- -D "TEST_PROGRAM=$<TARGET_FILE:h5import>"
+ -D "TEST_PROGRAM=$<TARGET_FILE:h5import${tgt_ext}>"
-D "TEST_ARGS:STRING=${testname}.bin;-c;${testname}.dmp;-o;d-${testname}.h5"
-D "TEST_FOLDER=${PROJECT_BINARY_DIR}"
-D "TEST_OUTPUT=${testname}.imp"
@@ -268,7 +275,7 @@
add_test (
NAME H5IMPORT_SUB-DUMP-${testname}-CMP
COMMAND "${CMAKE_COMMAND}"
- -D "TEST_PROGRAM=$<TARGET_FILE:h5dump>"
+ -D "TEST_PROGRAM=$<TARGET_FILE:h5dump${tgt_ext}>"
-D "TEST_ARGS:STRING=-p;d-${testname}.h5"
-D "TEST_FOLDER=${PROJECT_BINARY_DIR}"
-D "TEST_OUTPUT=d-${testname}.dmp"
@@ -499,7 +506,7 @@
binuin32.bin
binuin32.conf
)
- if (NOT "${last_test}" STREQUAL "")
+ if (last_test)
set_tests_properties (H5IMPORT-h5importtest-clear-objects PROPERTIES DEPENDS ${last_test})
endif ()
set (last_test "H5IMPORT-clear-objects")
diff --git a/tools/test/h5jam/CMakeLists.txt b/tools/test/h5jam/CMakeLists.txt
index cc70adc..585a8a1 100644
--- a/tools/test/h5jam/CMakeLists.txt
+++ b/tools/test/h5jam/CMakeLists.txt
@@ -4,9 +4,9 @@ project (HDF5_TOOLS_TEST_H5JAM C)
# --------------------------------------------------------------------
# Add the h5jam test executables
# --------------------------------------------------------------------
-if (HDF5_BUILD_GENERATORS)
+if (HDF5_BUILD_GENERATORS AND NOT ONLY_SHARED_LIBS)
add_executable (h5jamgentest ${HDF5_TOOLS_TEST_H5JAM_SOURCE_DIR}/h5jamgentest.c)
- target_include_directories(h5jamgentest PRIVATE "${HDF5_TOOLS_DIR}/lib;${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>")
+ target_include_directories (h5jamgentest PRIVATE "${HDF5_TOOLS_DIR}/lib;${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>")
TARGET_C_PROPERTIES (h5jamgentest STATIC)
target_link_libraries (h5jamgentest PRIVATE ${HDF5_LIB_TARGET})
set_target_properties (h5jamgentest PROPERTIES FOLDER generator/tools)
@@ -15,15 +15,25 @@ if (HDF5_BUILD_GENERATORS)
endif ()
add_executable (getub ${HDF5_TOOLS_TEST_H5JAM_SOURCE_DIR}/getub.c)
-target_include_directories(getub PRIVATE "${HDF5_TOOLS_DIR}/lib;${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>")
-TARGET_C_PROPERTIES (getub STATIC)
-target_link_libraries (getub PRIVATE ${HDF5_TOOLS_LIB_TARGET} ${HDF5_LIB_TARGET})
+target_include_directories (getub PRIVATE "${HDF5_TOOLS_DIR}/lib;${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>")
+if (NOT ONLY_SHARED_LIBS)
+ TARGET_C_PROPERTIES (getub STATIC)
+ target_link_libraries (getub PRIVATE ${HDF5_TOOLS_LIB_TARGET} ${HDF5_LIB_TARGET})
+else ()
+ TARGET_C_PROPERTIES (getub SHARED)
+ target_link_libraries (getub PRIVATE ${HDF5_TOOLS_LIBSH_TARGET} ${HDF5_LIBSH_TARGET})
+endif ()
set_target_properties (getub PROPERTIES FOLDER tools)
add_executable (tellub ${HDF5_TOOLS_TEST_H5JAM_SOURCE_DIR}/tellub.c)
-target_include_directories(tellub PRIVATE "${HDF5_TOOLS_DIR}/lib;${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>")
-TARGET_C_PROPERTIES (tellub STATIC)
-target_link_libraries (tellub PRIVATE ${HDF5_TOOLS_LIB_TARGET} ${HDF5_LIB_TARGET})
+target_include_directories (tellub PRIVATE "${HDF5_TOOLS_DIR}/lib;${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>")
+if (NOT ONLY_SHARED_LIBS)
+ TARGET_C_PROPERTIES (tellub STATIC)
+ target_link_libraries (tellub PRIVATE ${HDF5_TOOLS_LIB_TARGET} ${HDF5_LIB_TARGET})
+else ()
+ TARGET_C_PROPERTIES (tellub SHARED)
+ target_link_libraries (tellub PRIVATE ${HDF5_TOOLS_LIBSH_TARGET} ${HDF5_LIBSH_TARGET})
+endif ()
set_target_properties (tellub PROPERTIES FOLDER tools)
include (CMakeTests.cmake)
diff --git a/tools/test/h5jam/CMakeTests.cmake b/tools/test/h5jam/CMakeTests.cmake
index 2d00b86..84af48b 100644
--- a/tools/test/h5jam/CMakeTests.cmake
+++ b/tools/test/h5jam/CMakeTests.cmake
@@ -47,6 +47,12 @@
##############################################################################
##############################################################################
+ if (NOT BUILD_SHARED_LIBS)
+ set (tgt_ext "")
+ else ()
+ set (tgt_ext "-shared")
+ endif ()
+
# ============================================================
# TEST_H5JAM_OUTPUT
# For the purpose to verify only output & exitcode from h5jam
@@ -54,8 +60,8 @@
macro (TEST_H5JAM_OUTPUT expectfile resultcode)
# If using memchecker add tests without using scripts
if (HDF5_ENABLE_USING_MEMCHECKER)
- add_test (NAME H5JAM-${expectfile} COMMAND $<TARGET_FILE:h5jam> ${ARGN})
- if (NOT "${resultcode}" STREQUAL "0")
+ add_test (NAME H5JAM-${expectfile} COMMAND $<TARGET_FILE:h5jam${tgt_ext}> ${ARGN})
+ if (${resultcode})
set_tests_properties (H5JAM-${expectfile} PROPERTIES WILL_FAIL "true")
endif ()
else ()
@@ -69,7 +75,7 @@
add_test (
NAME H5JAM-${expectfile}
COMMAND "${CMAKE_COMMAND}"
- -D "TEST_PROGRAM=$<TARGET_FILE:h5jam>"
+ -D "TEST_PROGRAM=$<TARGET_FILE:h5jam${tgt_ext}>"
-D "TEST_ARGS:STRING=${ARGN}"
-D "TEST_FOLDER=${PROJECT_BINARY_DIR}"
-D "TEST_OUTPUT=${expectfile}.out"
@@ -90,8 +96,8 @@
macro (TEST_H5UNJAM_OUTPUT expectfile resultcode)
# If using memchecker add tests without using scripts
if (HDF5_ENABLE_USING_MEMCHECKER)
- add_test (NAME H5JAM-UNJAM-${expectfile} COMMAND $<TARGET_FILE:h5unjam> ${ARGN})
- if (NOT "${resultcode}" STREQUAL "0")
+ add_test (NAME H5JAM-UNJAM-${expectfile} COMMAND $<TARGET_FILE:h5unjam${tgt_ext}> ${ARGN})
+ if (${resultcode})
set_tests_properties (H5JAM-UNJAM-${expectfile} PROPERTIES WILL_FAIL "true")
endif ()
else ()
@@ -105,7 +111,7 @@
add_test (
NAME H5JAM-UNJAM-${expectfile}
COMMAND "${CMAKE_COMMAND}"
- -D "TEST_PROGRAM=$<TARGET_FILE:h5unjam>"
+ -D "TEST_PROGRAM=$<TARGET_FILE:h5unjam${tgt_ext}>"
-D "TEST_ARGS=${ARGN}"
-D "TEST_FOLDER=${PROJECT_BINARY_DIR}"
-D "TEST_OUTPUT=${expectfile}.out"
@@ -133,7 +139,7 @@
add_test (
NAME H5JAM-${testname}-CHECKFILE-H5DMP
COMMAND "${CMAKE_COMMAND}"
- -D "TEST_PROGRAM=$<TARGET_FILE:h5dump>"
+ -D "TEST_PROGRAM=$<TARGET_FILE:h5dump${tgt_ext}>"
-D "TEST_ARGS:STRING=testfiles/${expected}"
-D "TEST_FOLDER=${PROJECT_BINARY_DIR}"
-D "TEST_OUTPUT=${actual}.new"
@@ -146,7 +152,7 @@
add_test (
NAME H5JAM-${testname}-CHECKFILE-H5DMP_CMP
COMMAND "${CMAKE_COMMAND}"
- -D "TEST_PROGRAM=$<TARGET_FILE:h5dump>"
+ -D "TEST_PROGRAM=$<TARGET_FILE:h5dump${tgt_ext}>"
-D "TEST_ARGS:STRING=${actual}"
-D "TEST_FOLDER=${PROJECT_BINARY_DIR}"
-D "TEST_OUTPUT=${actual}.out"
@@ -181,7 +187,7 @@
COMMAND ${CMAKE_COMMAND} -E remove ${ufile}
)
set_tests_properties (H5JAM-${testname}-UNJAM_D-clear-objects PROPERTIES DEPENDS H5JAM-${testname}-UNJAM-clear-objects)
- add_test (NAME H5JAM-${testname}-UNJAM COMMAND $<TARGET_FILE:h5unjam> -i ${infile} -u ${ufile} -o ${outfile})
+ add_test (NAME H5JAM-${testname}-UNJAM COMMAND $<TARGET_FILE:h5unjam${tgt_ext}> -i ${infile} -u ${ufile} -o ${outfile})
set_tests_properties (H5JAM-${testname}-UNJAM PROPERTIES DEPENDS H5JAM-${testname}-UNJAM_D-clear-objects)
set (compare_test ${ufile})
else ()
@@ -189,7 +195,7 @@
add_test (
NAME H5JAM-${testname}-UNJAM
COMMAND "${CMAKE_COMMAND}"
- -D "TEST_PROGRAM=$<TARGET_FILE:h5unjam>"
+ -D "TEST_PROGRAM=$<TARGET_FILE:h5unjam${tgt_ext}>"
-D "TEST_ARGS:STRING=-i;${infile};-o;${outfile}"
-D "TEST_FOLDER=${PROJECT_BINARY_DIR}"
-D "TEST_OUTPUT=${outfile}.ufile.txt"
@@ -200,12 +206,12 @@
set_tests_properties (H5JAM-${testname}-UNJAM PROPERTIES DEPENDS H5JAM-${testname}-UNJAM-clear-objects)
set (compare_test "${outfile}.ufile.txt")
else ()
- add_test (NAME H5JAM-${testname}-UNJAM COMMAND $<TARGET_FILE:h5unjam> -i ${infile} -o ${outfile})
+ add_test (NAME H5JAM-${testname}-UNJAM COMMAND $<TARGET_FILE:h5unjam${tgt_ext}> -i ${infile} -o ${outfile})
set_tests_properties (H5JAM-${testname}-UNJAM PROPERTIES DEPENDS H5JAM-${testname}-UNJAM-clear-objects)
set (compare_test "")
endif ()
endif ()
- if (NOT "${compare_test}" STREQUAL "")
+ if (${compare_test})
add_test (
NAME H5JAM-${testname}-UNJAM-CHECK_UB_1-clear-objects
COMMAND ${CMAKE_COMMAND}
@@ -244,7 +250,7 @@
-D "TEST_OFILE=NULL"
-P "${HDF_RESOURCES_DIR}/userblockTest.cmake"
)
- if (NOT "${compare_test}" STREQUAL "")
+ if (${compare_test})
set_tests_properties (H5JAM-${testname}-UNJAM-CHECK_NOUB PROPERTIES DEPENDS H5JAM-${testname}-UNJAM-CHECK_UB_1)
else ()
set_tests_properties (H5JAM-${testname}-UNJAM-CHECK_NOUB PROPERTIES DEPENDS H5JAM-${testname}-UNJAM)
@@ -261,7 +267,7 @@
COMMAND ${CMAKE_COMMAND} -E remove ${outfile} ${infile}.cpy.h5
)
endif ()
- add_test (NAME H5JAM-${testname} COMMAND $<TARGET_FILE:h5jam> -u testfiles/${jamfile} -i testfiles/${infile} -o ${outfile} ${ARGN})
+ add_test (NAME H5JAM-${testname} COMMAND $<TARGET_FILE:h5jam${tgt_ext}> -u testfiles/${jamfile} -i testfiles/${infile} -o ${outfile} ${ARGN})
if (NOT HDF5_ENABLE_USING_MEMCHECKER)
set_tests_properties (H5JAM-${testname} PROPERTIES DEPENDS H5JAM-${testname}-clear-objects)
set (compare_test ${outfile})
@@ -316,7 +322,7 @@
)
set_tests_properties (H5JAM-${testname}_NONE_COPY PROPERTIES DEPENDS H5JAM-${testname}_NONE-SETUP)
- add_test (NAME H5JAM-${testname}_NONE COMMAND $<TARGET_FILE:h5jam> -u testfiles/${jamfile} -i ${chkfile} ${ARGN})
+ add_test (NAME H5JAM-${testname}_NONE COMMAND $<TARGET_FILE:h5jam${tgt_ext}> -u testfiles/${jamfile} -i ${chkfile} ${ARGN})
set_tests_properties (H5JAM-${testname}_NONE PROPERTIES DEPENDS H5JAM-${testname}_NONE_COPY)
set (compare_test ${chkfile})
diff --git a/tools/test/h5ls/CMakeLists.txt b/tools/test/h5ls/CMakeLists.txt
index dc5804c..0da03c5 100644
--- a/tools/test/h5ls/CMakeLists.txt
+++ b/tools/test/h5ls/CMakeLists.txt
@@ -5,15 +5,15 @@ project (HDF5_TOOLS_TEST_H5LS C)
# If plugin library tests can be tested
#-----------------------------------------------------------------------------
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})
+ set (H5LS_TOOL_PLUGIN_LIB_CORENAME "dynlibls")
+ set (H5LS_TOOL_PLUGIN_LIB_NAME "${HDF5_EXTERNAL_LIB_PREFIX}${H5LS_TOOL_PLUGIN_LIB_CORENAME}")
+ set (H5LS_TOOL_PLUGIN_LIB_TARGET ${H5LS_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 (${H5LS_TOOL_PLUGIN_LIB_TARGET} SHARED dynlib_ls.c)
+ target_include_directories (${H5LS_TOOL_PLUGIN_LIB_TARGET} PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>")
+ TARGET_C_PROPERTIES (${H5LS_TOOL_PLUGIN_LIB_TARGET} SHARED)
+ target_link_libraries (${H5LS_TOOL_PLUGIN_LIB_TARGET} PRIVATE ${HDF5_TEST_LIBSH_TARGET})
+ H5_SET_LIB_OPTIONS (${H5LS_TOOL_PLUGIN_LIB_TARGET} ${H5LS_TOOL_PLUGIN_LIB_NAME} SHARED "LIB")
# make plugins dir
file (MAKE_DIRECTORY "${CMAKE_BINARY_DIR}/plugins")
@@ -21,12 +21,12 @@ if (BUILD_SHARED_LIBS)
# Copy plugin library to a plugins folder
#-----------------------------------------------------------------------------
add_custom_command (
- TARGET ${HDF5_TOOL_PLUGIN_LIB_TARGET}
+ TARGET ${H5LS_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}>"
+ "$<TARGET_FILE:${H5LS_TOOL_PLUGIN_LIB_TARGET}>"
+ "${CMAKE_BINARY_DIR}/plugins/$<TARGET_FILE_NAME:${H5LS_TOOL_PLUGIN_LIB_TARGET}>"
)
endif ()
diff --git a/tools/test/h5ls/CMakeTests.cmake b/tools/test/h5ls/CMakeTests.cmake
index 116d097..cd62297 100644
--- a/tools/test/h5ls/CMakeTests.cmake
+++ b/tools/test/h5ls/CMakeTests.cmake
@@ -134,15 +134,21 @@
##############################################################################
##############################################################################
+ if (NOT BUILD_SHARED_LIBS)
+ set (tgt_ext "")
+ else ()
+ set (tgt_ext "-shared")
+ endif ()
+
macro (ADD_H5_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})
+ add_test (NAME H5LS-${resultfile} COMMAND $<TARGET_FILE:h5ls${tgt_ext}> ${ARGN})
set_tests_properties (H5LS-${resultfile} PROPERTIES WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles")
- if ("${resultcode}" STREQUAL "1")
+ if (${resultcode} EQUAL 1)
set_tests_properties (H5LS-${resultfile} PROPERTIES WILL_FAIL "true")
endif ()
- if (NOT "${last_test}" STREQUAL "")
+ if (last_test)
set_tests_properties (H5LS-${resultfile} PROPERTIES DEPENDS ${last_test})
endif ()
else ()
@@ -157,7 +163,7 @@
add_test (
NAME H5LS-${resultfile}
COMMAND "${CMAKE_COMMAND}"
- -D "TEST_PROGRAM=$<TARGET_FILE:h5ls>"
+ -D "TEST_PROGRAM=$<TARGET_FILE:h5ls${tgt_ext}>"
-D "TEST_ARGS=${ARGN}"
-D "TEST_FOLDER=${PROJECT_BINARY_DIR}/testfiles"
-D "TEST_OUTPUT=${resultfile}.out"
@@ -174,10 +180,10 @@
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")
+ if (${resultcode} EQUAL 1)
set_tests_properties (H5LS-${resultfile} PROPERTIES WILL_FAIL "true")
endif ()
- if (NOT "${last_test}" STREQUAL "")
+ if (last_test)
set_tests_properties (H5LS-${resultfile} PROPERTIES DEPENDS ${last_test})
endif ()
else ()
@@ -192,7 +198,7 @@
add_test (
NAME H5LS-${resultfile}
COMMAND "${CMAKE_COMMAND}"
- -D "TEST_PROGRAM=$<TARGET_FILE:h5ls>"
+ -D "TEST_PROGRAM=$<TARGET_FILE:h5ls${tgt_ext}>"
-D "TEST_ARGS=${ARGN}"
-D "TEST_FOLDER=${PROJECT_BINARY_DIR}/testfiles"
-D "TEST_OUTPUT=${resultfile}.out"
@@ -218,7 +224,7 @@
add_test (
NAME H5LS_UD-${testname}
COMMAND "${CMAKE_COMMAND}"
- -D "TEST_PROGRAM=$<TARGET_FILE:h5ls>"
+ -D "TEST_PROGRAM=$<TARGET_FILE:h5ls${tgt_ext}>"
-D "TEST_ARGS=${ARGN}"
-D "TEST_FOLDER=${PROJECT_BINARY_DIR}/testfiles"
-D "TEST_OUTPUT=${resultfile}.out"
@@ -226,6 +232,7 @@
-D "TEST_REFERENCE=${resultfile}.ls"
-D "TEST_ENV_VAR=HDF5_PLUGIN_PATH"
-D "TEST_ENV_VALUE=${CMAKE_BINARY_DIR}/plugins"
+ -D "TEST_LIBRARY_DIRECTORY=${CMAKE_TEST_OUTPUT_DIRECTORY}"
-P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake"
)
set_tests_properties (H5LS_UD-${testname} PROPERTIES DEPENDS H5LS_UD-${testname}-clear-objects)
@@ -354,7 +361,7 @@
tvldtypes2be.out.err
)
set_tests_properties (H5LS-clearall-objects PROPERTIES WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles")
- if (NOT "${last_test}" STREQUAL "")
+ if (last_test)
set_tests_properties (H5LS-clearall-objects PROPERTIES DEPENDS ${last_test})
endif ()
set (last_test "H5LS-clearall-objects")
diff --git a/tools/test/h5ls/CMakeTestsVDS.cmake b/tools/test/h5ls/CMakeTestsVDS.cmake
index 2b6f61e..04fb306 100644
--- a/tools/test/h5ls/CMakeTestsVDS.cmake
+++ b/tools/test/h5ls/CMakeTestsVDS.cmake
@@ -80,15 +80,21 @@
##############################################################################
##############################################################################
+ if (NOT BUILD_SHARED_LIBS)
+ set (tgt_ext "")
+ else ()
+ set (tgt_ext "-shared")
+ endif ()
+
macro (ADD_H5_VDS_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})
+ add_test (NAME H5LS-${resultfile} COMMAND $<TARGET_FILE:h5ls${tgt_ext}> ${ARGN})
set_tests_properties (H5LS-${resultfile} PROPERTIES WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles/vds")
- if ("${resultcode}" STREQUAL "1")
+ if (${resultcode} EQUAL 1)
set_tests_properties (H5LS-${resultfile} PROPERTIES WILL_FAIL "true")
endif ()
- if (NOT "${last_test}" STREQUAL "")
+ if (last_test)
set_tests_properties (H5LS-${resultfile} PROPERTIES DEPENDS ${last_test})
endif ()
else ()
@@ -103,7 +109,7 @@
add_test (
NAME H5LS-${resultfile}
COMMAND "${CMAKE_COMMAND}"
- -D "TEST_PROGRAM=$<TARGET_FILE:h5ls>"
+ -D "TEST_PROGRAM=$<TARGET_FILE:h5ls${tgt_ext}>"
-D "TEST_ARGS=${ARGN}"
-D "TEST_FOLDER=${PROJECT_BINARY_DIR}/testfiles/vds"
-D "TEST_OUTPUT=${resultfile}.out"
@@ -118,15 +124,15 @@
macro (ADD_H5_VDS_PREFIX_TEST resultfile resultcode)
# If using memchecker add tests without using scripts
if (HDF5_ENABLE_USING_MEMCHECKER)
- add_test (NAME H5LS_PREFIX-${resultfile} COMMAND $<TARGET_FILE:h5ls> ${ARGN})
+ add_test (NAME H5LS_PREFIX-${resultfile} COMMAND $<TARGET_FILE:h5ls${tgt_ext}> ${ARGN})
set_tests_properties (H5LS_PREFIX-${resultfile} PROPERTIES
ENVIRONMENT "HDF5_VDS_PREFIX=\${ORIGIN}"
WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles"
)
- if ("${resultcode}" STREQUAL "1")
+ if (${resultcode} EQUAL 1)
set_tests_properties (H5LS_PREFIX-${resultfile} PROPERTIES WILL_FAIL "true")
endif ()
- if (NOT "${last_test}" STREQUAL "")
+ if (last_test)
set_tests_properties (H5LS_PREFIX-${resultfile} PROPERTIES DEPENDS ${last_test})
endif ()
else ()
@@ -141,7 +147,7 @@
add_test (
NAME H5LS_PREFIX-${resultfile}
COMMAND "${CMAKE_COMMAND}"
- -D "TEST_PROGRAM=$<TARGET_FILE:h5ls>"
+ -D "TEST_PROGRAM=$<TARGET_FILE:h5ls${tgt_ext}>"
-D "TEST_ARGS=${ARGN}"
-D "TEST_FOLDER=${PROJECT_BINARY_DIR}/testfiles"
-D "TEST_OUTPUT=vds/prefix/${resultfile}.out"
@@ -193,7 +199,7 @@
tvds_layout-5.out.err
)
set_tests_properties (H5LS_VDS-clearall-objects PROPERTIES WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles/vds")
- if (NOT "${last_test}" STREQUAL "")
+ if (last_test)
set_tests_properties (H5LS_VDS-clearall-objects PROPERTIES DEPENDS ${last_test})
endif ()
set (last_test "H5LS_VDS-clearall-objects")
diff --git a/tools/test/h5repack/CMakeLists.txt b/tools/test/h5repack/CMakeLists.txt
index 890d5d2..92b61fc 100644
--- a/tools/test/h5repack/CMakeLists.txt
+++ b/tools/test/h5repack/CMakeLists.txt
@@ -5,11 +5,16 @@ project (HDF5_TOOLS_TEST_H5REPACK C)
# Add h5Repack test executables
# --------------------------------------------------------------------
add_executable (testh5repack_detect_szip ${HDF5_TOOLS_TEST_H5REPACK_SOURCE_DIR}/testh5repack_detect_szip.c)
-target_include_directories(testh5repack_detect_szip
+target_include_directories (testh5repack_detect_szip
PRIVATE "${HDF5_TOOLS_SRC_H5REPACK_SOURCE_DIR};${HDF5_TOOLS_DIR}/lib;${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>"
)
-TARGET_C_PROPERTIES (testh5repack_detect_szip STATIC)
-target_link_libraries (testh5repack_detect_szip PRIVATE ${HDF5_LIB_TARGET} ${HDF5_TOOLS_LIB_TARGET} ${HDF5_TEST_LIB_TARGET})
+if (NOT ONLY_SHARED_LIBS)
+ TARGET_C_PROPERTIES (testh5repack_detect_szip STATIC)
+ target_link_libraries (testh5repack_detect_szip PRIVATE ${HDF5_TOOLS_LIB_TARGET} ${HDF5_LIB_TARGET} ${HDF5_TEST_LIB_TARGET})
+else ()
+ TARGET_C_PROPERTIES (testh5repack_detect_szip SHARED)
+ target_link_libraries (testh5repack_detect_szip PRIVATE ${HDF5_TOOLS_LIBSH_TARGET} ${HDF5_LIBSH_TARGET} ${HDF5_TEST_LIBSH_TARGET})
+endif ()
set_target_properties (testh5repack_detect_szip PROPERTIES FOLDER tools)
set (REPACK_COMMON_SOURCES
@@ -22,35 +27,40 @@ set (REPACK_COMMON_SOURCES
${HDF5_TOOLS_SRC_H5REPACK_SOURCE_DIR}/h5repack.c
)
add_executable (h5repacktest ${REPACK_COMMON_SOURCES} ${HDF5_TOOLS_TEST_H5REPACK_SOURCE_DIR}/h5repacktst.c)
-target_include_directories(h5repacktest
+target_include_directories (h5repacktest
PRIVATE "${HDF5_TOOLS_SRC_H5REPACK_SOURCE_DIR};${HDF5_TOOLS_DIR}/lib;${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>"
)
-TARGET_C_PROPERTIES (h5repacktest STATIC)
-target_link_libraries (h5repacktest PRIVATE ${HDF5_TOOLS_LIB_TARGET} ${HDF5_TEST_LIB_TARGET})
+if (NOT ONLY_SHARED_LIBS)
+ TARGET_C_PROPERTIES (h5repacktest STATIC)
+ target_link_libraries (h5repacktest PRIVATE ${HDF5_TOOLS_LIB_TARGET} ${HDF5_TEST_LIB_TARGET})
+else ()
+ TARGET_C_PROPERTIES (h5repacktest SHARED)
+ target_link_libraries (h5repacktest PRIVATE ${HDF5_TOOLS_LIBSH_TARGET} ${HDF5_TEST_LIBSH_TARGET})
+endif ()
set_target_properties (h5repacktest PROPERTIES FOLDER tools)
#-----------------------------------------------------------------------------
# If plugin library tests can be tested
#-----------------------------------------------------------------------------
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})
+ set (H5REPACK_TOOL_PLUGIN_LIB_CORENAME "dynlibadd")
+ set (H5REPACK_TOOL_PLUGIN_LIB_NAME "${HDF5_EXTERNAL_LIB_PREFIX}${H5REPACK_TOOL_PLUGIN_LIB_CORENAME}")
+ set (H5REPACK_TOOL_PLUGIN_LIB_TARGET ${H5REPACK_TOOL_PLUGIN_LIB_CORENAME})
+ set (H5REPACK_TOOL_PLUGIN_LIB_VCORENAME "dynlibvers")
+ set (H5REPACK_TOOL_PLUGIN_LIB_VNAME "${HDF5_EXTERNAL_LIB_PREFIX}${H5REPACK_TOOL_PLUGIN_LIB_VCORENAME}")
+ set (H5REPACK_TOOL_PLUGIN_LIB_VTARGET ${H5REPACK_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 (${H5REPACK_TOOL_PLUGIN_LIB_TARGET} SHARED dynlib_rpk.c)
+ target_include_directories (${H5REPACK_TOOL_PLUGIN_LIB_TARGET} PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>")
+ TARGET_C_PROPERTIES (${H5REPACK_TOOL_PLUGIN_LIB_TARGET} SHARED)
+ target_link_libraries (${H5REPACK_TOOL_PLUGIN_LIB_TARGET} PRIVATE ${HDF5_TEST_LIBSH_TARGET})
+ H5_SET_LIB_OPTIONS (${H5REPACK_TOOL_PLUGIN_LIB_TARGET} ${H5REPACK_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 (${H5REPACK_TOOL_PLUGIN_LIB_VTARGET} SHARED dynlib_vrpk.c)
+ target_include_directories (${H5REPACK_TOOL_PLUGIN_LIB_VTARGET} PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>")
+ TARGET_C_PROPERTIES (${H5REPACK_TOOL_PLUGIN_LIB_VTARGET} SHARED)
+ target_link_libraries (${H5REPACK_TOOL_PLUGIN_LIB_VTARGET} PRIVATE ${HDF5_TEST_LIBSH_TARGET})
+ H5_SET_LIB_OPTIONS (${H5REPACK_TOOL_PLUGIN_LIB_VTARGET} ${H5REPACK_TOOL_PLUGIN_LIB_VNAME} SHARED "LIB")
# make plugins dir
file (MAKE_DIRECTORY "${CMAKE_BINARY_DIR}/plugins")
@@ -58,20 +68,20 @@ if (BUILD_SHARED_LIBS)
# Copy plugin library to a plugins folder
#-----------------------------------------------------------------------------
add_custom_command (
- TARGET ${HDF5_TOOL_PLUGIN_LIB_TARGET}
+ TARGET ${H5REPACK_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}>"
+ "$<TARGET_FILE:${H5REPACK_TOOL_PLUGIN_LIB_TARGET}>"
+ "${CMAKE_BINARY_DIR}/plugins/$<TARGET_FILE_NAME:${H5REPACK_TOOL_PLUGIN_LIB_TARGET}>"
)
add_custom_command (
- TARGET ${HDF5_TOOL_PLUGIN_LIB_VTARGET}
+ TARGET ${H5REPACK_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}>"
+ "$<TARGET_FILE:${H5REPACK_TOOL_PLUGIN_LIB_VTARGET}>"
+ "${CMAKE_BINARY_DIR}/plugins/$<TARGET_FILE_NAME:${H5REPACK_TOOL_PLUGIN_LIB_VTARGET}>"
)
endif ()
diff --git a/tools/test/h5repack/CMakeTests.cmake b/tools/test/h5repack/CMakeTests.cmake
index c2a2be7..50be28a 100644
--- a/tools/test/h5repack/CMakeTests.cmake
+++ b/tools/test/h5repack/CMakeTests.cmake
@@ -157,12 +157,18 @@
##############################################################################
##############################################################################
+ if (NOT BUILD_SHARED_LIBS)
+ set (tgt_ext "")
+ else ()
+ set (tgt_ext "-shared")
+ endif ()
+
macro (ADD_HELP_TEST testname resultcode)
# If using memchecker add tests without using scripts
if (HDF5_ENABLE_USING_MEMCHECKER)
- add_test (NAME H5REPACK-h5repack-${testname} COMMAND $<TARGET_FILE:h5repack> ${ARGN})
+ add_test (NAME H5REPACK-h5repack-${testname} COMMAND $<TARGET_FILE:h5repack${tgt_ext}> ${ARGN})
set_tests_properties (H5REPACK-h5repack-${testname} PROPERTIES WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles")
- if (NOT "${last_test}" STREQUAL "")
+ if (last_test)
set_tests_properties (H5REPACK-h5repack-${testname} PROPERTIES DEPENDS ${last_test})
endif ()
set (last_test "H5REPACK-h5repack-${testname}")
@@ -174,13 +180,13 @@
testfiles/h5repack-${testname}.out
testfiles/h5repack-${testname}.out.err
)
- if (NOT "${last_test}" STREQUAL "")
+ if (last_test)
set_tests_properties (H5REPACK-h5repack-${testname}-clear-objects PROPERTIES DEPENDS ${last_test})
endif ()
add_test (
NAME H5REPACK-h5repack-${testname}
COMMAND "${CMAKE_COMMAND}"
- -D "TEST_PROGRAM=$<TARGET_FILE:h5repack>"
+ -D "TEST_PROGRAM=$<TARGET_FILE:h5repack${tgt_ext}>"
-D "TEST_ARGS:STRING=${ARGN}"
-D "TEST_FOLDER=${PROJECT_BINARY_DIR}/testfiles"
-D "TEST_OUTPUT=h5repack-${testname}.out"
@@ -208,17 +214,17 @@
-E remove
testfiles/out-${testname}.${testfile}
)
- if (NOT "${last_test}" STREQUAL "")
+ if (last_test)
set_tests_properties (H5REPACK_OLD-${testname}-clear-objects PROPERTIES DEPENDS ${last_test})
endif ()
add_test (
NAME H5REPACK_OLD-${testname}
- COMMAND $<TARGET_FILE:h5repack> ${ARGN} -i ${PROJECT_BINARY_DIR}/testfiles/${testfile} -o ${PROJECT_BINARY_DIR}/testfiles/out-${testname}.${testfile}
+ COMMAND $<TARGET_FILE:h5repack${tgt_ext}> ${ARGN} -i ${PROJECT_BINARY_DIR}/testfiles/${testfile} -o ${PROJECT_BINARY_DIR}/testfiles/out-${testname}.${testfile}
)
set_tests_properties (H5REPACK_OLD-${testname} PROPERTIES DEPENDS H5REPACK_OLD-${testname}-clear-objects)
add_test (
NAME H5REPACK_OLD-${testname}_DFF
- COMMAND $<TARGET_FILE:h5diff> ${PROJECT_BINARY_DIR}/testfiles/${testfile} ${PROJECT_BINARY_DIR}/testfiles/out-${testname}.${testfile}
+ COMMAND $<TARGET_FILE:h5diff${tgt_ext}> ${PROJECT_BINARY_DIR}/testfiles/${testfile} ${PROJECT_BINARY_DIR}/testfiles/out-${testname}.${testfile}
)
set_tests_properties (H5REPACK_OLD-${testname}_DFF PROPERTIES DEPENDS H5REPACK_OLD-${testname})
endif ()
@@ -240,17 +246,17 @@
-E remove
testfiles/out-${testname}.${testfile}
)
- if (NOT "${last_test}" STREQUAL "")
+ if (last_test)
set_tests_properties (H5REPACK-${testname}-clear-objects PROPERTIES DEPENDS ${last_test})
endif ()
add_test (
NAME H5REPACK-${testname}
- COMMAND $<TARGET_FILE:h5repack> --enable-error-stack ${ARGN} ${PROJECT_BINARY_DIR}/testfiles/${testfile} ${PROJECT_BINARY_DIR}/testfiles/out-${testname}.${testfile}
+ COMMAND $<TARGET_FILE:h5repack${tgt_ext}> --enable-error-stack ${ARGN} ${PROJECT_BINARY_DIR}/testfiles/${testfile} ${PROJECT_BINARY_DIR}/testfiles/out-${testname}.${testfile}
)
set_tests_properties (H5REPACK-${testname} PROPERTIES DEPENDS H5REPACK-${testname}-clear-objects)
add_test (
NAME H5REPACK-${testname}_DFF
- COMMAND $<TARGET_FILE:h5diff> --enable-error-stack ${PROJECT_BINARY_DIR}/testfiles/${testfile} ${PROJECT_BINARY_DIR}/testfiles/out-${testname}.${testfile}
+ COMMAND $<TARGET_FILE:h5diff${tgt_ext}> --enable-error-stack ${PROJECT_BINARY_DIR}/testfiles/${testfile} ${PROJECT_BINARY_DIR}/testfiles/out-${testname}.${testfile}
)
set_tests_properties (H5REPACK-${testname}_DFF PROPERTIES DEPENDS H5REPACK-${testname})
endif ()
@@ -270,9 +276,9 @@
if (HDF5_ENABLE_USING_MEMCHECKER)
add_test (
NAME H5REPACK_CMP-${testname}
- COMMAND $<TARGET_FILE:h5repack> ${ARGN} ${PROJECT_BINARY_DIR}/testfiles/${resultfile} ${PROJECT_BINARY_DIR}/testfiles/out-${testname}.${resultfile}
+ COMMAND $<TARGET_FILE:h5repack${tgt_ext}> ${ARGN} ${PROJECT_BINARY_DIR}/testfiles/${resultfile} ${PROJECT_BINARY_DIR}/testfiles/out-${testname}.${resultfile}
)
- if (NOT "${last_test}" STREQUAL "")
+ if (last_test)
set_tests_properties (H5REPACK_CMP-${testname} PROPERTIES DEPENDS ${last_test})
endif ()
else ()
@@ -284,13 +290,13 @@
testfiles/${resultfile}-${testname}.out
testfiles/${resultfile}-${testname}.out.err
)
- if (NOT "${last_test}" STREQUAL "")
+ if (last_test)
set_tests_properties (H5REPACK_CMP-${testname}-clear-objects PROPERTIES DEPENDS ${last_test})
endif ()
add_test (
NAME H5REPACK_CMP-${testname}
COMMAND "${CMAKE_COMMAND}"
- -D "TEST_PROGRAM=$<TARGET_FILE:h5repack>"
+ -D "TEST_PROGRAM=$<TARGET_FILE:h5repack${tgt_ext}>"
-D "TEST_ARGS:STRING=${ARGN};${resultfile};out-${testname}.${resultfile}"
-D "TEST_FOLDER=${PROJECT_BINARY_DIR}/testfiles"
-D "TEST_OUTPUT=${resultfile}-${testname}.out"
@@ -304,7 +310,7 @@
endif ()
endmacro ()
- macro (ADD_H5_MASK_TEST testname testtype resultcode resultfile)
+ macro (ADD_H5_MASK_TEST testname testtype resultcode result_errcheck resultfile)
if ("${testtype}" STREQUAL "SKIP")
if (NOT HDF5_ENABLE_USING_MEMCHECKER)
add_test (
@@ -318,9 +324,9 @@
if (HDF5_ENABLE_USING_MEMCHECKER)
add_test (
NAME H5REPACK_MASK-${testname}
- COMMAND $<TARGET_FILE:h5repack> ${ARGN} ${PROJECT_BINARY_DIR}/testfiles/${resultfile} ${PROJECT_BINARY_DIR}/testfiles/out-${testname}.${resultfile}
+ COMMAND $<TARGET_FILE:h5repack${tgt_ext}> ${ARGN} ${PROJECT_BINARY_DIR}/testfiles/${resultfile} ${PROJECT_BINARY_DIR}/testfiles/out-${testname}.${resultfile}
)
- if (NOT "${last_test}" STREQUAL "")
+ if (last_test)
set_tests_properties (H5REPACK_MASK-${testname} PROPERTIES DEPENDS ${last_test})
endif ()
else (HDF5_ENABLE_USING_MEMCHECKER)
@@ -332,21 +338,21 @@
testfiles/${resultfile}-${testname}.out
testfiles/${resultfile}-${testname}.out.err
)
- if (NOT "${last_test}" STREQUAL "")
+ if (last_test)
set_tests_properties (H5REPACK_MASK-${testname}-clear-objects PROPERTIES DEPENDS ${last_test})
endif ()
add_test (
NAME H5REPACK_MASK-${testname}
COMMAND "${CMAKE_COMMAND}"
- -D "TEST_PROGRAM=$<TARGET_FILE:h5repack>"
+ -D "TEST_PROGRAM=$<TARGET_FILE:h5repack${tgt_ext}>"
-D "TEST_ARGS:STRING=${ARGN};${resultfile};out-${testname}.${resultfile}"
-D "TEST_FOLDER=${PROJECT_BINARY_DIR}/testfiles"
-D "TEST_OUTPUT=${resultfile}-${testname}.out"
-D "TEST_EXPECT=${resultcode}"
- -D "TEST_MASK_ERROR=true"
+ -D "TEST_SKIP_COMPARE=true"
-D "TEST_REFERENCE=${resultfile}.mty"
- -D "TEST_ERRREF=${resultfile}-${testname}.tst"
- -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake"
+ -D "TEST_ERRREF=${result_errcheck}"
+ -P "${HDF_RESOURCES_EXT_DIR}/grepTest.cmake"
)
set_tests_properties (H5REPACK_MASK-${testname} PROPERTIES DEPENDS H5REPACK_MASK-${testname}-clear-objects)
endif ()
@@ -371,19 +377,19 @@
testfiles/${resultfile}-${testname}.out
testfiles/${resultfile}-${testname}.out.err
)
- if (NOT "${last_test}" STREQUAL "")
+ if (last_test)
set_tests_properties (H5REPACK_DMP-${testname}-clear-objects PROPERTIES DEPENDS ${last_test})
endif ()
add_test (
NAME H5REPACK_DMP-${testname}
- COMMAND $<TARGET_FILE:h5repack> ${ARGN} ${PROJECT_BINARY_DIR}/testfiles/${resultfile} ${PROJECT_BINARY_DIR}/testfiles/out-${testname}.${resultfile}
+ COMMAND $<TARGET_FILE:h5repack${tgt_ext}> ${ARGN} ${PROJECT_BINARY_DIR}/testfiles/${resultfile} ${PROJECT_BINARY_DIR}/testfiles/out-${testname}.${resultfile}
)
set_tests_properties (H5REPACK_DMP-${testname} PROPERTIES DEPENDS H5REPACK_DMP-${testname}-clear-objects)
if (NOT HDF5_ENABLE_USING_MEMCHECKER)
add_test (
NAME H5REPACK_DMP-h5dump-${testname}
COMMAND "${CMAKE_COMMAND}"
- -D "TEST_PROGRAM=$<TARGET_FILE:h5dump>"
+ -D "TEST_PROGRAM=$<TARGET_FILE:h5dump${tgt_ext}>"
-D "TEST_ARGS:STRING=-q;creation_order;-pH;out-${testname}.${resultfile}"
-D "TEST_FOLDER=${PROJECT_BINARY_DIR}/testfiles"
-D "TEST_OUTPUT=${resultfile}-${testname}.out"
@@ -414,19 +420,19 @@
testfiles/${resultfile}-${testname}.out
testfiles/${resultfile}-${testname}.out.err
)
- if (NOT "${last_test}" STREQUAL "")
+ if (last_test)
set_tests_properties (H5REPACK_STAT-${testname}-clear-objects PROPERTIES DEPENDS ${last_test})
endif ()
add_test (
NAME H5REPACK_STAT-${testname}
- COMMAND $<TARGET_FILE:h5repack> ${ARGN} ${PROJECT_BINARY_DIR}/testfiles/${resultfile} ${PROJECT_BINARY_DIR}/testfiles/out-${statarg}.${resultfile}
+ COMMAND $<TARGET_FILE:h5repack${tgt_ext}> ${ARGN} ${PROJECT_BINARY_DIR}/testfiles/${resultfile} ${PROJECT_BINARY_DIR}/testfiles/out-${statarg}.${resultfile}
)
set_tests_properties (H5REPACK_STAT-${testname} PROPERTIES DEPENDS H5REPACK_STAT-${testname}-clear-objects)
if (NOT HDF5_ENABLE_USING_MEMCHECKER)
add_test (
NAME H5REPACK_STAT-h5stat-${testname}
COMMAND "${CMAKE_COMMAND}"
- -D "TEST_PROGRAM=$<TARGET_FILE:h5stat>"
+ -D "TEST_PROGRAM=$<TARGET_FILE:h5stat${tgt_ext}>"
-D "TEST_ARGS:STRING=-S;-s;out-${statarg}.${resultfile}"
-D "TEST_FOLDER=${PROJECT_BINARY_DIR}/testfiles"
-D "TEST_OUTPUT=${resultfile}-${testname}.out"
@@ -458,24 +464,24 @@
testfiles/${testfile}-${testname}-v.out
testfiles/${testfile}-${testname}-v.out.err
)
- if (NOT "${last_test}" STREQUAL "")
+ if (last_test)
set_tests_properties (H5REPACK_VERIFY_LAYOUT-${testname}-clear-objects PROPERTIES DEPENDS ${last_test})
endif ()
add_test (
NAME H5REPACK_VERIFY_LAYOUT-${testname}
- COMMAND $<TARGET_FILE:h5repack> ${ARGN} ${PROJECT_BINARY_DIR}/testfiles/${testfile} ${PROJECT_BINARY_DIR}/testfiles/out-${testname}.${testfile}
+ COMMAND $<TARGET_FILE:h5repack${tgt_ext}> ${ARGN} ${PROJECT_BINARY_DIR}/testfiles/${testfile} ${PROJECT_BINARY_DIR}/testfiles/out-${testname}.${testfile}
)
set_tests_properties (H5REPACK_VERIFY_LAYOUT-${testname} PROPERTIES DEPENDS H5REPACK_VERIFY_LAYOUT-${testname}-clear-objects)
add_test (
NAME H5REPACK_VERIFY_LAYOUT-${testname}_DFF
- COMMAND $<TARGET_FILE:h5diff> ${PROJECT_BINARY_DIR}/testfiles/${testfile} ${PROJECT_BINARY_DIR}/testfiles/out-${testname}.${testfile}
+ COMMAND $<TARGET_FILE:h5diff${tgt_ext}> ${PROJECT_BINARY_DIR}/testfiles/${testfile} ${PROJECT_BINARY_DIR}/testfiles/out-${testname}.${testfile}
)
set_tests_properties (H5REPACK_VERIFY_LAYOUT-${testname}_DFF PROPERTIES DEPENDS H5REPACK_VERIFY_LAYOUT-${testname})
- if ("${resultcode}" STREQUAL "0")
+ if (NOT ${resultcode})
add_test (
NAME H5REPACK_VERIFY_LAYOUT-${testname}_DMP
COMMAND "${CMAKE_COMMAND}"
- -D "TEST_PROGRAM=$<TARGET_FILE:h5dump>"
+ -D "TEST_PROGRAM=$<TARGET_FILE:h5dump${tgt_ext}>"
-D "TEST_ARGS:STRING=-d;${testdset};-pH;out-${testname}.${testfile}"
-D "TEST_FOLDER=${PROJECT_BINARY_DIR}/testfiles"
-D "TEST_OUTPUT=${testfile}-${testname}-v.out"
@@ -498,7 +504,7 @@
add_test (
NAME H5REPACK_VERIFY_LAYOUT-${testname}_DMP
COMMAND "${CMAKE_COMMAND}"
- -D "TEST_PROGRAM=$<TARGET_FILE:h5dump>"
+ -D "TEST_PROGRAM=$<TARGET_FILE:h5dump${tgt_ext}>"
-D "TEST_ARGS:STRING=-pH;out-${testname}.${testfile}"
-D "TEST_FOLDER=${PROJECT_BINARY_DIR}/testfiles"
-D "TEST_OUTPUT=${testfile}-${testname}-v.out"
@@ -533,19 +539,19 @@
testfiles/${testfile}-${testname}-v.out
testfiles/${testfile}-${testname}-v.out.err
)
- if (NOT "${last_test}" STREQUAL "")
+ if (last_test)
set_tests_properties (H5REPACK_VERIFY_LAYOUT_VDS-${testname}-clear-objects PROPERTIES DEPENDS ${last_test})
endif ()
add_test (
NAME H5REPACK_VERIFY_LAYOUT_VDS-${testname}
- COMMAND $<TARGET_FILE:h5repack> ${ARGN} ${PROJECT_BINARY_DIR}/testfiles/${testfile} ${PROJECT_BINARY_DIR}/testfiles/out-${testname}.${testfile}
+ COMMAND $<TARGET_FILE:h5repack${tgt_ext}> ${ARGN} ${PROJECT_BINARY_DIR}/testfiles/${testfile} ${PROJECT_BINARY_DIR}/testfiles/out-${testname}.${testfile}
)
set_tests_properties (H5REPACK_VERIFY_LAYOUT_VDS-${testname} PROPERTIES WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles")
set_tests_properties (H5REPACK_VERIFY_LAYOUT_VDS-${testname} PROPERTIES DEPENDS H5REPACK_VERIFY_LAYOUT_VDS-${testname}-clear-objects)
add_test (
NAME H5REPACK_VERIFY_LAYOUT_VDS-${testname}_DMP
COMMAND "${CMAKE_COMMAND}"
- -D "TEST_PROGRAM=$<TARGET_FILE:h5dump>"
+ -D "TEST_PROGRAM=$<TARGET_FILE:h5dump${tgt_ext}>"
-D "TEST_ARGS:STRING=-d;${testdset};-p;out-${testname}.${testfile}"
-D "TEST_FOLDER=${PROJECT_BINARY_DIR}/testfiles"
-D "TEST_OUTPUT=${testfile}-${testname}-v.out"
@@ -570,18 +576,18 @@
testfiles/${testfile}-${testname}-v.out
testfiles/${testfile}-${testname}-v.out.err
)
- if (NOT "${last_test}" STREQUAL "")
+ if (last_test)
set_tests_properties (H5REPACK_VERIFY_SUPERBLOCK-${testname}-clear-objects PROPERTIES DEPENDS ${last_test})
endif ()
add_test (
NAME H5REPACK_VERIFY_SUPERBLOCK-${testname}
- COMMAND $<TARGET_FILE:h5repack> -j;${lowbound};-k;${highbound} ${PROJECT_BINARY_DIR}/testfiles/${testfile} ${PROJECT_BINARY_DIR}/testfiles/out-${testname}.${testfile}
+ COMMAND $<TARGET_FILE:h5repack${tgt_ext}> -j;${lowbound};-k;${highbound} ${PROJECT_BINARY_DIR}/testfiles/${testfile} ${PROJECT_BINARY_DIR}/testfiles/out-${testname}.${testfile}
)
set_tests_properties (H5REPACK_VERIFY_SUPERBLOCK-${testname} PROPERTIES DEPENDS H5REPACK_VERIFY_SUPERBLOCK-${testname}-clear-objects)
add_test (
NAME H5REPACK_VERIFY_SUPERBLOCK-${testname}_DMP
COMMAND "${CMAKE_COMMAND}"
- -D "TEST_PROGRAM=$<TARGET_FILE:h5dump>"
+ -D "TEST_PROGRAM=$<TARGET_FILE:h5dump${tgt_ext}>"
-D "TEST_ARGS:STRING=-H;-B;out-${testname}.${testfile}"
-D "TEST_FOLDER=${PROJECT_BINARY_DIR}/testfiles"
-D "TEST_OUTPUT=${testfile}-${testname}-v.out"
@@ -601,12 +607,12 @@
-E remove
testfiles/out-${testname}.${testfile}
)
- if (NOT "${last_test}" STREQUAL "")
+ if (last_test)
set_tests_properties (ADD_H5_VERIFY_INVALIDBOUNDS-h5repack-${testname}-clear-objects PROPERTIES DEPENDS ${last_test})
endif ()
add_test (
NAME ADD_H5_VERIFY_INVALIDBOUNDS-h5repack-${testname}
- COMMAND $<TARGET_FILE:h5repack> -j;${lowbound};-k;${highbound} ${PROJECT_BINARY_DIR}/testfiles/${testfile} ${PROJECT_BINARY_DIR}/testfiles/out-${testname}.${testfile}
+ COMMAND $<TARGET_FILE:h5repack${tgt_ext}> -j;${lowbound};-k;${highbound} ${PROJECT_BINARY_DIR}/testfiles/${testfile} ${PROJECT_BINARY_DIR}/testfiles/out-${testname}.${testfile}
)
set_tests_properties (
ADD_H5_VERIFY_INVALIDBOUNDS-h5repack-${testname} PROPERTIES
@@ -624,17 +630,17 @@
testfiles/out-${testname}_N.${testname}.h5
testfiles/out-${testname}_M.${testname}.h5
)
- if (NOT "${last_test}" STREQUAL "")
+ if (last_test)
set_tests_properties (H5REPACK_META-${testname}_N-clear-objects PROPERTIES DEPENDS ${last_test})
endif ()
add_test (
NAME H5REPACK_META-${testname}_N
- COMMAND $<TARGET_FILE:h5repack> ${PROJECT_BINARY_DIR}/testfiles/${testfile} ${PROJECT_BINARY_DIR}/testfiles/out-${testname}_N.${testname}.h5
+ COMMAND $<TARGET_FILE:h5repack${tgt_ext}> ${PROJECT_BINARY_DIR}/testfiles/${testfile} ${PROJECT_BINARY_DIR}/testfiles/out-${testname}_N.${testname}.h5
)
set_tests_properties (H5REPACK_META-${testname}_N PROPERTIES DEPENDS H5REPACK_META-${testname}_N-clear-objects)
add_test (
NAME H5REPACK_META-${testname}_M
- COMMAND $<TARGET_FILE:h5repack> ${ARGN} ${PROJECT_BINARY_DIR}/testfiles/${testfile} ${PROJECT_BINARY_DIR}/testfiles/out-${testname}_M.${testname}.h5
+ COMMAND $<TARGET_FILE:h5repack${tgt_ext}> ${ARGN} ${PROJECT_BINARY_DIR}/testfiles/${testfile} ${PROJECT_BINARY_DIR}/testfiles/out-${testname}_M.${testname}.h5
)
set_tests_properties (H5REPACK_META-${testname}_M PROPERTIES DEPENDS H5REPACK_META-${testname}_N)
@@ -656,13 +662,13 @@
testfiles/${resultfile}-${testname}.out
testfiles/${resultfile}-${testname}.out.err
)
- if (NOT "${last_test}" STREQUAL "")
+ if (last_test)
set_tests_properties (H5REPACK_UD-${testname}-clear-objects PROPERTIES DEPENDS ${last_test})
endif ()
add_test (
NAME H5REPACK_UD-${testname}
COMMAND "${CMAKE_COMMAND}"
- -D "TEST_PROGRAM=$<TARGET_FILE:h5repack>"
+ -D "TEST_PROGRAM=$<TARGET_FILE:h5repack-shared>"
-D "TEST_ARGS:STRING=${ARGN};${resultfile};out-${testname}.${resultfile}"
-D "TEST_FOLDER=${PROJECT_BINARY_DIR}/testfiles"
-D "TEST_EXPECT=${resultcode}"
@@ -671,13 +677,14 @@
-D "TEST_REFERENCE=${testname}.${resultfile}.tst"
-D "TEST_ENV_VAR=HDF5_PLUGIN_PATH"
-D "TEST_ENV_VALUE=${CMAKE_BINARY_DIR}/plugins"
+ -D "TEST_LIBRARY_DIRECTORY=${CMAKE_TEST_OUTPUT_DIRECTORY}"
-P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake"
)
set_tests_properties (H5REPACK_UD-${testname} PROPERTIES DEPENDS H5REPACK_UD-${testname}-clear-objects)
add_test (
NAME H5REPACK_UD-${testname}-h5dump
COMMAND "${CMAKE_COMMAND}"
- -D "TEST_PROGRAM=$<TARGET_FILE:h5dump>"
+ -D "TEST_PROGRAM=$<TARGET_FILE:h5dump-shared>"
-D "TEST_ARGS:STRING=-pH;out-${testname}.${resultfile}"
-D "TEST_FOLDER=${PROJECT_BINARY_DIR}/testfiles"
-D "TEST_OUTPUT=${resultfile}-${testname}.out"
@@ -685,6 +692,7 @@
-D "TEST_REFERENCE=${resultfile}-${testname}.ddl"
-D "TEST_ENV_VAR=HDF5_PLUGIN_PATH"
-D "TEST_ENV_VALUE=${CMAKE_BINARY_DIR}/plugins"
+ -D "TEST_LIBRARY_DIRECTORY=${CMAKE_TEST_OUTPUT_DIRECTORY}"
-P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake"
)
set_tests_properties (H5REPACK_UD-${testname}-h5dump PROPERTIES DEPENDS "H5REPACK_UD-${testname}")
@@ -901,7 +909,7 @@
COMMAND ${CMAKE_COMMAND} -E remove ${LIST_TO_CLEAR}
)
set_tests_properties (H5REPACK-clearall-objects PROPERTIES WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles")
- if (NOT "${last_test}" STREQUAL "")
+ if (last_test)
set_tests_properties (H5REPACK-clearall-objects PROPERTIES DEPENDS ${last_test})
endif ()
endif ()
@@ -1222,7 +1230,7 @@
ADD_H5_VERIFY_TEST (conti "TEST" 1 ${FILE4} null CONTIGUOUS -l CONTI)
ADD_H5_VERIFY_TEST (dset2_compa "TEST" 0 ${FILE4} dset2 COMPACT -l dset2:COMPA)
ADD_H5_VERIFY_TEST (compa "TEST" 1 ${FILE4} null COMPACT -l COMPA)
- ADD_H5_MASK_TEST (dset2_chunk_20x10-errstk "TEST" 0 ${FILE4} --layout=dset2:CHUNK=20x10x5 --enable-error-stack)
+ ADD_H5_MASK_TEST (dset2_chunk_20x10-errstk "TEST" 0 "dimensionality of chunks doesn't match the dataspace" ${FILE4} --layout=dset2:CHUNK=20x10x5 --enable-error-stack)
################################################################
# layout conversions (file has no filters)
diff --git a/tools/test/h5repack/CMakeVFDTests.cmake b/tools/test/h5repack/CMakeVFDTests.cmake
index 2042f31..e100e3c 100644
--- a/tools/test/h5repack/CMakeVFDTests.cmake
+++ b/tools/test/h5repack/CMakeVFDTests.cmake
@@ -47,7 +47,7 @@
-D "TEST_FOLDER=${PROJECT_BINARY_DIR}"
-P "${HDF_RESOURCES_DIR}/vfdTest.cmake"
)
- if (NOT "${last_test}" STREQUAL "")
+ if (last_test)
set_tests_properties (H5REPACK-VFD-${vfdname}-h5repacktest PROPERTIES DEPENDS ${last_test})
endif ()
set (last_test "H5REPACK-VFD-${vfdname}-h5repacktest")
diff --git a/tools/test/h5repack/h5repack.sh.in b/tools/test/h5repack/h5repack.sh.in
index a36eb08..282ba76 100644
--- a/tools/test/h5repack/h5repack.sh.in
+++ b/tools/test/h5repack/h5repack.sh.in
@@ -48,6 +48,10 @@ DIRNAME='dirname'
LS='ls'
AWK='awk'
+# Reset the VOL connector to only use the native connector, because of the
+# error stack checking. QAK - 2019/03/09
+ENVCMD="env HDF5_VOL_CONNECTOR=native"
+
H5DETECTSZIP=testh5repack_detect_szip
H5DETECTSZIP_BIN=`pwd`/$H5DETECTSZIP
@@ -284,7 +288,7 @@ TOOLTEST()
TESTING $H5REPACK $@
(
cd $TESTDIR
- $RUNSERIAL $H5REPACK_BIN "$@" $infile $outfile
+ $ENVCMD $RUNSERIAL $H5REPACK_BIN "$@" $infile $outfile
)
RET=$?
if [ $RET != 0 ] ; then
@@ -716,7 +720,7 @@ TOOLTESTM() {
TESTING $H5REPACK $@
(
cd $TESTDIR
- $RUNSERIAL $H5REPACK_BIN "$@" $infile $outfile
+ $ENVCMD $RUNSERIAL $H5REPACK_BIN "$@" $infile $outfile
) >$actual 2>$actual_err
# save actual and actual_err in case they are needed later.
diff --git a/tools/test/h5repack/h5repacktst.c b/tools/test/h5repack/h5repacktst.c
index 0ae570b..a89bf10 100644
--- a/tools/test/h5repack/h5repacktst.c
+++ b/tools/test/h5repack/h5repacktst.c
@@ -2907,10 +2907,10 @@ out:
static
int make_all_filters(hid_t loc_id)
{
- hid_t dcpl; /* dataset creation property list */
- hid_t sid; /* dataspace ID */
- hid_t dtid;
- hid_t dsid;
+ hid_t dcpl = H5I_INVALID_HID; /* dataset creation property list */
+ hid_t sid = H5I_INVALID_HID; /* dataspace ID */
+ hid_t dtid = H5I_INVALID_HID;
+ hid_t dsid = H5I_INVALID_HID;
#if defined (H5_HAVE_FILTER_SZIP)
unsigned szip_options_mask=H5_SZIP_ALLOW_K13_OPTION_MASK|H5_SZIP_NN_OPTION_MASK;
unsigned szip_pixels_per_block=8;
@@ -3083,7 +3083,7 @@ int make_early(void)
hid_t tid=-1;
hid_t dcpl=-1;
int i;
- char name[10];
+ char name[16];
int iter=100;
if ((fid = H5Fcreate(FNAME5, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0)
@@ -3178,7 +3178,7 @@ int make_layout(hid_t loc_id)
hsize_t chunk_dims[RANK]={CDIM1,CDIM2};
int buf[DIM1][DIM2];
int i, j, n;
- char name[6];
+ char name[16];
for (i=n=0; i<DIM1; i++)
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 1d2914b..3ff2170 100644
--- a/tools/test/h5repack/testfiles/h5repack_layout.h5-plugin_version_test.ddl
+++ b/tools/test/h5repack/testfiles/h5repack_layout.h5-plugin_version_test.ddl
@@ -11,7 +11,7 @@ GROUP "/" {
USER_DEFINED_FILTER {
FILTER_ID 260
COMMENT dynlib4
- PARAMS { 9 1 11 4 }
+ PARAMS { 9 1 11 6 }
}
}
FILLVALUE {
@@ -33,7 +33,7 @@ GROUP "/" {
USER_DEFINED_FILTER {
FILTER_ID 260
COMMENT dynlib4
- PARAMS { 9 1 11 4 }
+ PARAMS { 9 1 11 6 }
}
}
FILLVALUE {
@@ -55,7 +55,7 @@ GROUP "/" {
USER_DEFINED_FILTER {
FILTER_ID 260
COMMENT dynlib4
- PARAMS { 9 1 11 4 }
+ PARAMS { 9 1 11 6 }
}
}
FILLVALUE {
@@ -77,7 +77,7 @@ GROUP "/" {
USER_DEFINED_FILTER {
FILTER_ID 260
COMMENT dynlib4
- PARAMS { 9 1 11 4 }
+ PARAMS { 9 1 11 6 }
}
}
FILLVALUE {
@@ -99,7 +99,7 @@ GROUP "/" {
USER_DEFINED_FILTER {
FILTER_ID 260
COMMENT dynlib4
- PARAMS { 9 1 11 4 }
+ PARAMS { 9 1 11 6 }
}
}
FILLVALUE {
@@ -121,7 +121,7 @@ GROUP "/" {
USER_DEFINED_FILTER {
FILTER_ID 260
COMMENT dynlib4
- PARAMS { 9 1 11 4 }
+ PARAMS { 9 1 11 6 }
}
}
FILLVALUE {
@@ -143,7 +143,7 @@ GROUP "/" {
USER_DEFINED_FILTER {
FILTER_ID 260
COMMENT dynlib4
- PARAMS { 9 1 11 4 }
+ PARAMS { 9 1 11 6 }
}
}
FILLVALUE {
diff --git a/tools/test/h5stat/CMakeLists.txt b/tools/test/h5stat/CMakeLists.txt
index e65c76f..f3bd20b 100644
--- a/tools/test/h5stat/CMakeLists.txt
+++ b/tools/test/h5stat/CMakeLists.txt
@@ -4,9 +4,9 @@ project (HDF5_TOOLS_TEST_H5STAT C)
# --------------------------------------------------------------------
# Add the h5stat test executables
# --------------------------------------------------------------------
-if (HDF5_BUILD_GENERATORS)
+if (HDF5_BUILD_GENERATORS AND NOT ONLY_SHARED_LIBS)
add_executable (h5stat_gentest ${HDF5_TOOLS_TEST_H5STAT_SOURCE_DIR}/h5stat_gentest.c)
- target_include_directories(h5stat_gentest PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>")
+ target_include_directories (h5stat_gentest PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>")
TARGET_C_PROPERTIES (h5stat_gentest STATIC)
target_link_libraries (h5stat_gentest PRIVATE ${HDF5_LIB_TARGET})
set_target_properties (h5stat_gentest PROPERTIES FOLDER generator/tools)
diff --git a/tools/test/h5stat/CMakeTests.cmake b/tools/test/h5stat/CMakeTests.cmake
index ec8c9b1..63886d0 100644
--- a/tools/test/h5stat/CMakeTests.cmake
+++ b/tools/test/h5stat/CMakeTests.cmake
@@ -93,14 +93,20 @@
##############################################################################
##############################################################################
+ if (NOT BUILD_SHARED_LIBS)
+ set (tgt_ext "")
+ else ()
+ set (tgt_ext "-shared")
+ endif ()
+
macro (ADD_H5_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")
+ add_test (NAME H5STAT-${resultfile} COMMAND $<TARGET_FILE:h5stat${tgt_ext}> ${ARGN})
+ if (${resultcode})
set_tests_properties (H5STAT-${resultfile} PROPERTIES WILL_FAIL "true")
endif ()
- if (NOT "${last_test}" STREQUAL "")
+ if (last_test)
set_tests_properties (H5STAT-${resultfile} PROPERTIES DEPENDS ${last_test})
endif ()
else (HDF5_ENABLE_USING_MEMCHECKER)
@@ -111,13 +117,13 @@
${resultfile}.out
${resultfile}.out.err
)
- if (NOT "${last_test}" STREQUAL "")
+ if (last_test)
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_PROGRAM=$<TARGET_FILE:h5stat${tgt_ext}>"
-D "TEST_ARGS=${ARGN}"
-D "TEST_FOLDER=${PROJECT_BINARY_DIR}"
-D "TEST_OUTPUT=${resultfile}.out"
@@ -132,11 +138,11 @@
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")
+ add_test (NAME H5STAT-${resultfile} COMMAND $<TARGET_FILE:h5stat${tgt_ext}> ${ARGN})
+ if (${resultcode})
set_tests_properties (H5STAT-${resultfile} PROPERTIES WILL_FAIL "true")
endif ()
- if (NOT "${last_test}" STREQUAL "")
+ if (last_test)
set_tests_properties (H5STAT-${resultfile} PROPERTIES DEPENDS ${last_test})
endif ()
else (HDF5_ENABLE_USING_MEMCHECKER)
@@ -147,13 +153,13 @@
${resultfile}.out
${resultfile}.out.err
)
- if (NOT "${last_test}" STREQUAL "")
+ if (last_test)
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_PROGRAM=$<TARGET_FILE:h5stat${tgt_ext}>"
-D "TEST_ARGS=${ARGN}"
-D "TEST_FOLDER=${PROJECT_BINARY_DIR}"
-D "TEST_OUTPUT=${resultfile}.out"
@@ -182,7 +188,7 @@
COMMAND ${CMAKE_COMMAND}
-E remove ${CLEAR_LIST}
)
- if (NOT "${last_test}" STREQUAL "")
+ if (last_test)
set_tests_properties (H5STAT-clearall-objects PROPERTIES DEPENDS ${last_test})
endif ()
set (last_test "H5STAT-clearall-objects")
diff --git a/tools/test/misc/CMakeLists.txt b/tools/test/misc/CMakeLists.txt
index 556b5b2..f5e3ea3 100644
--- a/tools/test/misc/CMakeLists.txt
+++ b/tools/test/misc/CMakeLists.txt
@@ -4,18 +4,28 @@ project (HDF5_TOOLS_TEST_MISC C)
# --------------------------------------------------------------------
# Add the misc test executables
# --------------------------------------------------------------------
-if (HDF5_BUILD_GENERATORS)
+if (HDF5_BUILD_GENERATORS AND NOT ONLY_SHARED_LIBS)
add_executable (h5repart_gentest ${HDF5_TOOLS_TEST_MISC_SOURCE_DIR}/h5repart_gentest.c)
- target_include_directories(h5repart_gentest PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>")
- TARGET_C_PROPERTIES (h5repart_gentest STATIC)
- target_link_libraries (h5repart_gentest PRIVATE ${HDF5_LIB_TARGET} ${HDF5_TOOLS_LIB_TARGET})
+ target_include_directories (h5repart_gentest PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>")
+ if (NOT ONLY_SHARED_LIBS)
+ TARGET_C_PROPERTIES (h5repart_gentest STATIC)
+ target_link_libraries (h5repart_gentest PRIVATE ${HDF5_TOOLS_LIB_TARGET} ${HDF5_TEST_LIB_TARGET})
+ else ()
+ TARGET_C_PROPERTIES (h5repart_gentest SHARED)
+ target_link_libraries (h5repart_gentest PRIVATE ${HDF5_TOOLS_LIBSH_TARGET} ${HDF5_TEST_LIBSH_TARGET})
+ endif ()
set_target_properties (h5repart_gentest PROPERTIES FOLDER generator/tools)
#add_test (NAME h5repart_gentest COMMAND $<TARGET_FILE:h5repart_gentest>)
add_executable (h5clear_gentest ${HDF5_TOOLS_TEST_MISC_SOURCE_DIR}/h5clear_gentest.c)
- target_include_directories(h5clear_gentest PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>")
- TARGET_C_PROPERTIES (h5clear_gentest STATIC)
- target_link_libraries (h5clear_gentest PRIVATE ${HDF5_LIB_TARGET} ${HDF5_TOOLS_LIB_TARGET})
+ target_include_directories (h5clear_gentest PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>")
+ if (NOT ONLY_SHARED_LIBS)
+ TARGET_C_PROPERTIES (h5clear_gentest STATIC)
+ target_link_libraries (h5clear_gentest PRIVATE ${HDF5_TOOLS_LIB_TARGET} ${HDF5_TEST_LIB_TARGET})
+ else ()
+ TARGET_C_PROPERTIES (h5clear_gentest SHARED)
+ target_link_libraries (h5clear_gentest PRIVATE ${HDF5_TOOLS_LIBSH_TARGET} ${HDF5_TEST_LIBSH_TARGET})
+ endif ()
set_target_properties (h5clear_gentest PROPERTIES FOLDER tools)
#add_test (NAME H5CLEAR-h5clear_gentest COMMAND $<TARGET_FILE:h5clear_gentest>)
@@ -24,15 +34,25 @@ if (HDF5_BUILD_GENERATORS)
endif ()
add_executable (h5repart_test ${HDF5_TOOLS_TEST_MISC_SOURCE_DIR}/repart_test.c)
-target_include_directories(h5repart_test PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>")
-TARGET_C_PROPERTIES (h5repart_test STATIC)
-target_link_libraries (h5repart_test PRIVATE ${HDF5_LIB_TARGET} ${HDF5_TOOLS_LIB_TARGET})
+target_include_directories (h5repart_test PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>")
+if (NOT ONLY_SHARED_LIBS)
+ TARGET_C_PROPERTIES (h5repart_test STATIC)
+ target_link_libraries (h5repart_test PRIVATE ${HDF5_TOOLS_LIB_TARGET} ${HDF5_LIB_TARGET})
+else ()
+ TARGET_C_PROPERTIES (h5repart_test SHARED)
+ target_link_libraries (h5repart_test PRIVATE ${HDF5_TOOLS_LIBSH_TARGET} ${HDF5_LIBSH_TARGET})
+endif ()
set_target_properties (h5repart_test PROPERTIES FOLDER tools)
add_executable (clear_open_chk ${HDF5_TOOLS_TEST_MISC_SOURCE_DIR}/clear_open_chk.c)
-target_include_directories(clear_open_chk PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>")
-TARGET_C_PROPERTIES (clear_open_chk STATIC)
-target_link_libraries (clear_open_chk PRIVATE ${HDF5_LIB_TARGET} ${HDF5_TOOLS_LIB_TARGET})
+target_include_directories (clear_open_chk PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>")
+if (NOT ONLY_SHARED_LIBS)
+ TARGET_C_PROPERTIES (clear_open_chk STATIC)
+ target_link_libraries (clear_open_chk PRIVATE ${HDF5_TOOLS_LIB_TARGET} ${HDF5_LIB_TARGET})
+else ()
+ TARGET_C_PROPERTIES (clear_open_chk SHARED)
+ target_link_libraries (clear_open_chk PRIVATE ${HDF5_TOOLS_LIBSH_TARGET} ${HDF5_LIBSH_TARGET})
+endif ()
set_target_properties (clear_open_chk PROPERTIES FOLDER tools)
include (CMakeTestsRepart.cmake)
diff --git a/tools/test/misc/CMakeTestsClear.cmake b/tools/test/misc/CMakeTestsClear.cmake
index c46ac59..c7b2fe9 100644
--- a/tools/test/misc/CMakeTestsClear.cmake
+++ b/tools/test/misc/CMakeTestsClear.cmake
@@ -83,6 +83,12 @@
##############################################################################
##############################################################################
+ if (NOT BUILD_SHARED_LIBS)
+ set (tgt_ext "")
+ else ()
+ set (tgt_ext "-shared")
+ endif ()
+
# Need special dependencies for tests that use the same reference file
# This is an issue on Windows
macro (ADD_H5_CMP testname resultfile resultcode)
@@ -94,13 +100,13 @@
testfiles/${testname}.out
testfiles/${testname}.out.err
)
- if (NOT "${last_test}" STREQUAL "")
+ if (last_test)
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_PROGRAM=$<TARGET_FILE:h5clear${tgt_ext}>"
-D "TEST_ARGS:STRING=${ARGN}"
-D "TEST_FOLDER=${PROJECT_BINARY_DIR}/testfiles"
-D "TEST_OUTPUT=${testname}.out"
@@ -122,13 +128,13 @@
testfiles/${testname}.out
testfiles/${testname}.out.err
)
- if (NOT "${last_test}" STREQUAL "")
+ if (last_test)
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_PROGRAM=$<TARGET_FILE:h5clear${tgt_ext}>"
-D "TEST_ARGS:STRING=${ARGN}"
-D "TEST_FOLDER=${PROJECT_BINARY_DIR}/testfiles"
-D "TEST_OUTPUT=${testname}.out"
@@ -152,7 +158,7 @@
testfiles/${testname}.out.err
testfiles/${testfile}
)
- if (NOT "${last_test}" STREQUAL "")
+ if (last_test)
set_tests_properties (H5CLEAR_CMP-${testname}-clear-objects PROPERTIES DEPENDS ${last_test})
endif ()
add_test (
@@ -165,7 +171,7 @@
add_test (
NAME H5CLEAR_CMP-${testname}
COMMAND "${CMAKE_COMMAND}"
- -D "TEST_PROGRAM=$<TARGET_FILE:h5clear>"
+ -D "TEST_PROGRAM=$<TARGET_FILE:h5clear${tgt_ext}>"
-D "TEST_ARGS:STRING=${ARGN};${testfile}"
-D "TEST_FOLDER=${PROJECT_BINARY_DIR}/testfiles"
-D "TEST_OUTPUT=${testname}.out"
@@ -188,7 +194,7 @@
testfiles/${testname}.out.err
testfiles/${testfile}
)
- if (NOT "${last_test}" STREQUAL "")
+ if (last_test)
set_tests_properties (H5CLEAR_CMP-${testname}-clear-objects PROPERTIES DEPENDS ${last_test})
endif ()
add_test (
@@ -201,7 +207,7 @@
add_test (
NAME H5CLEAR_CMP-${testname}
COMMAND "${CMAKE_COMMAND}"
- -D "TEST_PROGRAM=$<TARGET_FILE:h5clear>"
+ -D "TEST_PROGRAM=$<TARGET_FILE:h5clear${tgt_ext}>"
-D "TEST_ARGS:STRING=${ARGN};${testfile}"
-D "TEST_FOLDER=${PROJECT_BINARY_DIR}/testfiles"
-D "TEST_OUTPUT=${testname}.out"
@@ -219,11 +225,11 @@
if (NOT HDF5_ENABLE_USING_MEMCHECKER)
add_test (
NAME H5CLEAR_RET-${testname}
- COMMAND $<TARGET_FILE:h5clear> ${ARGN}
+ COMMAND $<TARGET_FILE:h5clear${tgt_ext}> ${ARGN}
)
set_tests_properties (H5CLEAR_RET-${testname} PROPERTIES WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles")
set_tests_properties (H5CLEAR_RET-${testname} PROPERTIES WILL_FAIL "${resultcode}")
- if (NOT "${last_test}" STREQUAL "")
+ if (last_test)
set_tests_properties (H5CLEAR_RET-${testname} PROPERTIES DEPENDS ${last_test})
endif ()
set (last_test "H5CLEAR_RET-${testname}")
@@ -242,7 +248,7 @@
testfiles/${testname}_after_size.out.err
testfiles/${testname}.h5
)
- if (NOT "${last_test}" STREQUAL "")
+ if (last_test)
set_tests_properties (H5CLEAR_FILESIZE_TEST-${testname}-clear-objects PROPERTIES DEPENDS ${last_test})
endif ()
add_test (
@@ -255,7 +261,7 @@
add_test (
NAME H5CLEAR_FILESIZE_CMP-${testname}_before_size
COMMAND "${CMAKE_COMMAND}"
- -D "TEST_PROGRAM=$<TARGET_FILE:h5clear>"
+ -D "TEST_PROGRAM=$<TARGET_FILE:h5clear${tgt_ext}>"
-D "TEST_ARGS:STRING=--filesize;${testname}.h5"
-D "TEST_FOLDER=${PROJECT_BINARY_DIR}/testfiles"
-D "TEST_OUTPUT=${testname}_before_size.out"
@@ -267,12 +273,12 @@
if (NOT ${incr_size} MATCHES "NONE")
add_test (
NAME H5CLEAR_FILESIZE_INCR-${testname}
- COMMAND $<TARGET_FILE:h5clear> --increment=${incr_size} ${testname}.h5
+ COMMAND $<TARGET_FILE:h5clear${tgt_ext}> --increment=${incr_size} ${testname}.h5
)
else ()
add_test (
NAME H5CLEAR_FILESIZE_INCR-${testname}
- COMMAND $<TARGET_FILE:h5clear> --increment ${testname}.h5
+ COMMAND $<TARGET_FILE:h5clear${tgt_ext}> --increment ${testname}.h5
)
endif ()
set_tests_properties (H5CLEAR_FILESIZE_INCR-${testname} PROPERTIES WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles")
@@ -281,7 +287,7 @@
add_test (
NAME H5CLEAR_FILESIZE_CMP-${testname}_after_size
COMMAND "${CMAKE_COMMAND}"
- -D "TEST_PROGRAM=$<TARGET_FILE:h5clear>"
+ -D "TEST_PROGRAM=$<TARGET_FILE:h5clear${tgt_ext}>"
-D "TEST_ARGS:STRING=--filesize;${testname}.h5"
-D "TEST_FOLDER=${PROJECT_BINARY_DIR}/testfiles"
-D "TEST_OUTPUT=${testname}_after_size.out"
@@ -302,7 +308,7 @@
-E copy_if_different
"${PROJECT_SOURCE_DIR}/testfiles/${testfile}.h5" "${PROJECT_BINARY_DIR}/testfiles/${testfile}.h5"
)
- if (NOT "${last_test}" STREQUAL "")
+ if (last_test)
set_tests_properties (H5CLEAR-clr_open_chk-copy_${testname}.h5 PROPERTIES DEPENDS ${last_test})
endif ()
set (last_test "H5CLEAR-clr_open_chk-copy_${testname}.h5")
@@ -312,12 +318,12 @@
add_test (NAME H5CLEAR-clr_open_chk-${testname}_${resultcode} COMMAND $<TARGET_FILE:clear_open_chk> ${testfile}.h5)
set_tests_properties (H5CLEAR-clr_open_chk-${testname}_${resultcode} PROPERTIES WILL_FAIL "${resultcode}")
set_tests_properties (H5CLEAR-clr_open_chk-${testname}_${resultcode} PROPERTIES WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles")
- if (NOT "${last_test}" STREQUAL "")
+ if (last_test)
set_tests_properties (H5CLEAR-clr_open_chk-${testname}_${resultcode} PROPERTIES DEPENDS ${last_test})
endif ()
# After "h5clear" the file, the subsequent file open succeeds
- add_test (NAME H5CLEAR-h5clr-${testname} COMMAND $<TARGET_FILE:h5clear> -s ${testfile}.h5)
+ add_test (NAME H5CLEAR-h5clr-${testname} COMMAND $<TARGET_FILE:h5clear${tgt_ext}> -s ${testfile}.h5)
set_tests_properties (H5CLEAR-h5clr-${testname} PROPERTIES DEPENDS H5CLEAR-clr_open_chk-${testname}_${resultcode})
set_tests_properties (H5CLEAR-h5clr-${testname} PROPERTIES WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles")
add_test (NAME H5CLEAR-clr_open_chk-${testname} COMMAND $<TARGET_FILE:clear_open_chk> ${testfile}.h5)
@@ -356,7 +362,7 @@ if (HDF5_ENABLE_USING_MEMCHECKER)
mod_h5clear_mdc_image2.h5
${HDF5_TEST_FILES}
)
- if (NOT "${last_test}" STREQUAL "")
+ if (last_test)
set_tests_properties (H5CLEAR-clearall-objects PROPERTIES DEPENDS ${last_test})
endif ()
set (last_test "H5CLEAR-clearall-objects")
@@ -368,7 +374,7 @@ if (HDF5_ENABLE_USING_MEMCHECKER)
-E copy_if_different
"${PROJECT_SOURCE_DIR}/testfiles/${h5_file}" "${PROJECT_BINARY_DIR}/testfiles/${h5_file}"
)
- if (NOT "${last_test}" STREQUAL "")
+ if (last_test)
set_tests_properties (H5CLEAR-copy_${h5_file} PROPERTIES DEPENDS ${last_test})
endif ()
set (last_test "H5CLEAR-copy_${h5_file}")
@@ -381,7 +387,7 @@ if (HDF5_ENABLE_USING_MEMCHECKER)
-E copy_if_different
"${PROJECT_SOURCE_DIR}/testfiles/${h5_file}" "${PROJECT_BINARY_DIR}/testfiles/orig_${h5_file}"
)
- if (NOT "${last_test}" STREQUAL "")
+ if (last_test)
set_tests_properties (H5CLEAR-copy_orig_${h5_file} PROPERTIES DEPENDS ${last_test})
endif ()
set (last_test "H5CLEAR-copy_orig_${h5_file}")
@@ -393,7 +399,7 @@ if (HDF5_ENABLE_USING_MEMCHECKER)
-E copy_if_different
"${PROJECT_SOURCE_DIR}/testfiles/mod_h5clear_mdc_image.h5" "${PROJECT_BINARY_DIR}/testfiles/mod_h5clear_mdc_image2.h5"
)
- if (NOT "${last_test}" STREQUAL "")
+ if (last_test)
set_tests_properties (H5CLEAR-copy_mod_h5clr_mdc_image2.h5 PROPERTIES DEPENDS ${last_test})
endif ()
set (last_test "H5CLEAR-copy_mod_h5clr_mdc_image2.h5")
diff --git a/tools/test/misc/CMakeTestsMkgrp.cmake b/tools/test/misc/CMakeTestsMkgrp.cmake
index e99983b..db1f805 100644
--- a/tools/test/misc/CMakeTestsMkgrp.cmake
+++ b/tools/test/misc/CMakeTestsMkgrp.cmake
@@ -54,6 +54,12 @@
##############################################################################
##############################################################################
+ if (NOT BUILD_SHARED_LIBS)
+ set (tgt_ext "")
+ else ()
+ set (tgt_ext "-shared")
+ endif ()
+
macro (ADD_H5_TEST resultfile resultcode resultoption)
if (NOT HDF5_ENABLE_USING_MEMCHECKER)
add_test (
@@ -69,19 +75,19 @@
add_test (
NAME H5MKGRP-${resultfile}
- COMMAND $<TARGET_FILE:h5mkgrp> ${resultoption} ${resultfile}.h5 ${ARGN}
+ COMMAND $<TARGET_FILE:h5mkgrp${tgt_ext}> ${resultoption} ${resultfile}.h5 ${ARGN}
)
set_tests_properties (H5MKGRP-${resultfile} PROPERTIES WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles")
if (HDF5_ENABLE_USING_MEMCHECKER)
- if (NOT "${last_test}" STREQUAL "")
+ if (last_test)
set_tests_properties (H5MKGRP-${resultfile} PROPERTIES DEPENDS ${last_test})
endif ()
- else (HDF5_ENABLE_USING_MEMCHECKER)
+ else ()
set_tests_properties (H5MKGRP-${resultfile} PROPERTIES DEPENDS H5MKGRP-${resultfile}-clear-objects)
add_test (
NAME H5MKGRP-${resultfile}-h5ls
COMMAND "${CMAKE_COMMAND}"
- -D "TEST_PROGRAM=$<TARGET_FILE:h5ls>"
+ -D "TEST_PROGRAM=$<TARGET_FILE:h5ls${tgt_ext}>"
-D "TEST_ARGS:STRING=-v;-r;${resultfile}.h5"
-D "TEST_FOLDER=${PROJECT_BINARY_DIR}/testfiles"
-D "TEST_OUTPUT=${resultfile}.out"
@@ -110,7 +116,7 @@
add_test (
NAME H5MKGRP_CMP-${resultfile}
COMMAND "${CMAKE_COMMAND}"
- -D "TEST_PROGRAM=$<TARGET_FILE:h5mkgrp>"
+ -D "TEST_PROGRAM=$<TARGET_FILE:h5mkgrp${tgt_ext}>"
-D "TEST_ARGS:STRING=${ARGN}"
-D "TEST_FOLDER=${PROJECT_BINARY_DIR}/testfiles"
-D "TEST_OUTPUT=${resultfile}.out"
@@ -174,7 +180,7 @@
h5mkgrp_nested_mult_lp.out.err
)
set_tests_properties (H5MKGRP-clearall-objects PROPERTIES WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles")
- if (NOT "${last_test}" STREQUAL "")
+ if (last_test)
set_tests_properties (H5MKGRP-clearall-objects PROPERTIES DEPENDS ${last_test})
endif ()
set (last_test "H5MKGRP-clearall-objects")
diff --git a/tools/test/misc/CMakeTestsRepart.cmake b/tools/test/misc/CMakeTestsRepart.cmake
index 8edd243..53949a2 100644
--- a/tools/test/misc/CMakeTestsRepart.cmake
+++ b/tools/test/misc/CMakeTestsRepart.cmake
@@ -58,6 +58,12 @@
##############################################################################
##############################################################################
+ if (NOT BUILD_SHARED_LIBS)
+ set (tgt_ext "")
+ else ()
+ set (tgt_ext "-shared")
+ endif ()
+
# Remove any output file left over from previous test run
add_test (
NAME H5REPART-clearall-objects
@@ -74,25 +80,25 @@
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)
+ add_test (NAME H5REPART-h5repart_20K COMMAND $<TARGET_FILE:h5repart${tgt_ext}> -m 20000 family_file%05d.h5 fst_family%05d.h5)
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)
+ add_test (NAME H5REPART-h5repart_5K COMMAND $<TARGET_FILE:h5repart${tgt_ext}> -m 5k family_file%05d.h5 scd_family%05d.h5)
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)
+ add_test (NAME H5REPART-h5repart_single COMMAND $<TARGET_FILE:h5repart${tgt_ext}> -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)
+ add_test (NAME H5REPART-h5repart_sec2 COMMAND $<TARGET_FILE:h5repart${tgt_ext}> -m 20000 -family_to_sec2 family_file%05d.h5 family_to_sec2.h5)
set_tests_properties (H5REPART-h5repart_sec2 PROPERTIES
FIXTURES_REQUIRED clear_testrepart
)
diff --git a/tools/test/misc/vds/CMakeLists.txt b/tools/test/misc/vds/CMakeLists.txt
index 98bce4d..092cabc 100644
--- a/tools/test/misc/vds/CMakeLists.txt
+++ b/tools/test/misc/vds/CMakeLists.txt
@@ -3,9 +3,14 @@ project (HDF5_TOOLS_TEST_MISC_VDS C)
MACRO (ADD_H5_GENERATOR genfile)
add_executable (${genfile} ${HDF5_TOOLS_TEST_MISC_VDS_SOURCE_DIR}/${genfile}.c)
- target_include_directories(${genfile} PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>")
- TARGET_C_PROPERTIES (${genfile} STATIC)
- target_link_libraries (${genfile} PRIVATE ${HDF5_LIB_TARGET} ${HDF5_TOOLS_LIB_TARGET})
+ target_include_directories (${genfile} PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>")
+ if (NOT ONLY_SHARED_LIBS)
+ TARGET_C_PROPERTIES (${genfile} STATIC)
+ target_link_libraries (${genfile} PRIVATE ${HDF5_TOOLS_LIB_TARGET} ${HDF5_LIB_TARGET})
+ else ()
+ TARGET_C_PROPERTIES (${genfile} SHARED)
+ target_link_libraries (${genfile} PRIVATE ${HDF5_TOOLS_LIBSH_TARGET} ${HDF5_LIBSH_TARGET})
+ endif ()
set_target_properties (${genfile} PROPERTIES FOLDER generator/tools)
ENDMACRO ()
diff --git a/tools/test/perform/CMakeLists.txt b/tools/test/perform/CMakeLists.txt
index 14abdec..5a45d34 100644
--- a/tools/test/perform/CMakeLists.txt
+++ b/tools/test/perform/CMakeLists.txt
@@ -10,9 +10,14 @@ set (h5perf_serial_SOURCES
${HDF5_TOOLS_TEST_PERFORM_SOURCE_DIR}/sio_engine.c
)
add_executable (h5perf_serial ${h5perf_serial_SOURCES})
-target_include_directories(h5perf_serial PRIVATE "${HDF5_TEST_SRC_DIR};${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>")
-TARGET_C_PROPERTIES (h5perf_serial STATIC)
-target_link_libraries (h5perf_serial PRIVATE ${HDF5_LIB_TARGET} ${HDF5_TOOLS_LIB_TARGET})
+target_include_directories (h5perf_serial PRIVATE "${HDF5_TEST_SRC_DIR};${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>")
+if (NOT BUILD_SHARED_LIBS)
+ TARGET_C_PROPERTIES (h5perf_serial STATIC)
+ target_link_libraries (h5perf_serial PRIVATE ${HDF5_TOOLS_LIB_TARGET} ${HDF5_LIB_TARGET})
+else ()
+ TARGET_C_PROPERTIES (h5perf_serial SHARED)
+ target_link_libraries (h5perf_serial PRIVATE ${HDF5_TOOLS_LIBSH_TARGET} ${HDF5_LIBSH_TARGET})
+endif ()
set_target_properties (h5perf_serial PROPERTIES FOLDER perform)
if (HDF5_BUILD_PERFORM_STANDALONE)
@@ -20,11 +25,17 @@ if (HDF5_BUILD_PERFORM_STANDALONE)
set (h5perf_serial_alone_SOURCES
${HDF5_TOOLS_TEST_PERFORM_SOURCE_DIR}/sio_perf.c
${HDF5_TOOLS_TEST_PERFORM_SOURCE_DIR}/sio_engine.c
+ ${HDF5_TOOLS_TEST_PERFORM_SOURCE_DIR}/sio_standalone.c
)
add_executable (h5perf_serial_alone ${h5perf_serial_alone_SOURCES})
- target_include_directories(h5perf_serial_alone PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>")
- TARGET_C_PROPERTIES (h5perf_serial_alone STATIC)
- target_link_libraries (h5perf_serial_alone PRIVATE ${HDF5_LIB_TARGET} ${HDF5_TOOLS_LIB_TARGET})
+ target_include_directories (h5perf_serial_alone PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>")
+ if (NOT BUILD_SHARED_LIBS)
+ TARGET_C_PROPERTIES (h5perf_serial_alone STATIC)
+ target_link_libraries (h5perf_serial_alone PRIVATE ${HDF5_TOOLS_LIB_TARGET} ${HDF5_TEST_LIB_TARGET} ${HDF5_LIB_TARGET})
+ else ()
+ TARGET_C_PROPERTIES (h5perf_serial_alone SHARED)
+ target_link_libraries (h5perf_serial_alone PRIVATE ${HDF5_TOOLS_LIBSH_TARGET} ${HDF5_TEST_LIBSH_TARGET} ${HDF5_LIBSH_TARGET})
+ endif ()
set_target_properties (h5perf_serial_alone PROPERTIES FOLDER perform)
set_property (TARGET h5perf_serial_alone
APPEND PROPERTY COMPILE_DEFINITIONS STANDALONE
@@ -36,9 +47,14 @@ set (chunk_SOURCES
${HDF5_TOOLS_TEST_PERFORM_SOURCE_DIR}/chunk.c
)
add_executable(chunk ${chunk_SOURCES})
-target_include_directories(chunk PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>")
-TARGET_C_PROPERTIES (chunk STATIC)
-target_link_libraries(chunk PRIVATE ${HDF5_LIB_TARGET} ${HDF5_TOOLS_LIB_TARGET})
+target_include_directories (chunk PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>")
+if (NOT BUILD_SHARED_LIBS)
+ TARGET_C_PROPERTIES (chunk STATIC)
+ target_link_libraries (chunk PRIVATE ${HDF5_TOOLS_LIB_TARGET} ${HDF5_LIB_TARGET})
+else ()
+ TARGET_C_PROPERTIES (chunk SHARED)
+ target_link_libraries (chunk PRIVATE ${HDF5_TOOLS_LIBSH_TARGET} ${HDF5_LIBSH_TARGET})
+endif ()
set_target_properties (chunk PROPERTIES FOLDER perform)
#-- Adding test for iopipe
@@ -46,9 +62,14 @@ set (iopipe_SOURCES
${HDF5_TOOLS_TEST_PERFORM_SOURCE_DIR}/iopipe.c
)
add_executable (iopipe ${iopipe_SOURCES})
-target_include_directories(iopipe PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>")
-TARGET_C_PROPERTIES (iopipe STATIC)
-target_link_libraries (iopipe PRIVATE ${HDF5_LIB_TARGET} ${HDF5_TOOLS_LIB_TARGET})
+target_include_directories (iopipe PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>")
+if (NOT BUILD_SHARED_LIBS)
+ TARGET_C_PROPERTIES (iopipe STATIC)
+ target_link_libraries (iopipe PRIVATE ${HDF5_TOOLS_LIB_TARGET} ${HDF5_LIB_TARGET})
+else ()
+ TARGET_C_PROPERTIES (iopipe SHARED)
+ target_link_libraries (iopipe PRIVATE ${HDF5_TOOLS_LIBSH_TARGET} ${HDF5_LIBSH_TARGET})
+endif ()
set_target_properties (iopipe PROPERTIES FOLDER perform)
#-- Adding test for chunk_cache
@@ -56,9 +77,14 @@ set (chunk_cache_SOURCES
${HDF5_TOOLS_TEST_PERFORM_SOURCE_DIR}/chunk_cache.c
)
add_executable (chunk_cache ${chunk_cache_SOURCES})
-target_include_directories(chunk_cache PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>")
-TARGET_C_PROPERTIES (chunk_cache STATIC)
-target_link_libraries (chunk_cache PRIVATE ${HDF5_LIB_TARGET} ${HDF5_TOOLS_LIB_TARGET})
+target_include_directories (chunk_cache PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>")
+if (NOT BUILD_SHARED_LIBS)
+ TARGET_C_PROPERTIES (chunk_cache STATIC)
+ target_link_libraries (chunk_cache PRIVATE ${HDF5_TOOLS_LIB_TARGET} ${HDF5_LIB_TARGET})
+else ()
+ TARGET_C_PROPERTIES (chunk_cache SHARED)
+ target_link_libraries (chunk_cache PRIVATE ${HDF5_TOOLS_LIBSH_TARGET} ${HDF5_LIBSH_TARGET})
+endif ()
set_target_properties (chunk_cache PROPERTIES FOLDER perform)
#-- Adding test for overhead
@@ -66,9 +92,14 @@ set (overhead_SOURCES
${HDF5_TOOLS_TEST_PERFORM_SOURCE_DIR}/overhead.c
)
add_executable (overhead ${overhead_SOURCES})
-target_include_directories(overhead PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>")
-TARGET_C_PROPERTIES (overhead STATIC)
-target_link_libraries (overhead PRIVATE ${HDF5_LIB_TARGET} ${HDF5_TOOLS_LIB_TARGET})
+target_include_directories (overhead PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>")
+if (NOT BUILD_SHARED_LIBS)
+ TARGET_C_PROPERTIES (overhead STATIC)
+ target_link_libraries (overhead PRIVATE ${HDF5_TOOLS_LIB_TARGET} ${HDF5_LIB_TARGET})
+else ()
+ TARGET_C_PROPERTIES (overhead SHARED)
+ target_link_libraries (overhead PRIVATE ${HDF5_TOOLS_LIBSH_TARGET} ${HDF5_LIBSH_TARGET})
+endif ()
set_target_properties (overhead PROPERTIES FOLDER perform)
#-- Adding test for perf_meta
@@ -76,9 +107,14 @@ set (perf_meta_SOURCES
${HDF5_TOOLS_TEST_PERFORM_SOURCE_DIR}/perf_meta.c
)
add_executable (perf_meta ${perf_meta_SOURCES})
-target_include_directories(perf_meta PRIVATE "${HDF5_TEST_SRC_DIR};${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>")
-TARGET_C_PROPERTIES (perf_meta STATIC)
-target_link_libraries (perf_meta PRIVATE ${HDF5_LIB_TARGET} ${HDF5_TOOLS_LIB_TARGET} ${HDF5_TEST_LIB_TARGET})
+target_include_directories (perf_meta PRIVATE "${HDF5_TEST_SRC_DIR};${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>")
+if (NOT BUILD_SHARED_LIBS)
+ TARGET_C_PROPERTIES (perf_meta STATIC)
+ target_link_libraries (perf_meta PRIVATE ${HDF5_TOOLS_LIB_TARGET} ${HDF5_TEST_LIB_TARGET} ${HDF5_LIB_TARGET})
+else ()
+ TARGET_C_PROPERTIES (perf_meta SHARED)
+ target_link_libraries (perf_meta PRIVATE ${HDF5_TOOLS_LIBSH_TARGET} ${HDF5_TEST_LIBSH_TARGET} ${HDF5_LIBSH_TARGET})
+endif ()
set_target_properties (perf_meta PROPERTIES FOLDER perform)
#-- Adding test for zip_perf
@@ -86,9 +122,14 @@ set (zip_perf_SOURCES
${HDF5_TOOLS_TEST_PERFORM_SOURCE_DIR}/zip_perf.c
)
add_executable (zip_perf ${zip_perf_SOURCES})
-target_include_directories(zip_perf PRIVATE "${HDF5_TEST_SRC_DIR};${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>")
-TARGET_C_PROPERTIES (zip_perf STATIC)
-target_link_libraries (zip_perf PRIVATE ${HDF5_TOOLS_LIB_TARGET} ${HDF5_LIB_TARGET})
+target_include_directories (zip_perf PRIVATE "${HDF5_TEST_SRC_DIR};${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>")
+if (NOT BUILD_SHARED_LIBS)
+ TARGET_C_PROPERTIES (zip_perf STATIC)
+ target_link_libraries (zip_perf PRIVATE ${HDF5_TOOLS_LIB_TARGET} ${HDF5_LIB_TARGET} ${LINK_COMP_LIBS})
+else ()
+ TARGET_C_PROPERTIES (zip_perf SHARED)
+ target_link_libraries (zip_perf PRIVATE ${HDF5_TOOLS_LIBSH_TARGET} ${HDF5_LIBSH_TARGET} ${LINK_COMP_LIBS})
+endif ()
set_target_properties (zip_perf PROPERTIES FOLDER perform)
if (H5_HAVE_PARALLEL AND BUILD_TESTING)
@@ -98,9 +139,14 @@ if (H5_HAVE_PARALLEL AND BUILD_TESTING)
${HDF5_TOOLS_TEST_PERFORM_SOURCE_DIR}/pio_engine.c
)
add_executable (h5perf ${h5perf_SOURCES})
- target_include_directories(h5perf PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>")
- TARGET_C_PROPERTIES (h5perf STATIC)
- target_link_libraries (h5perf PRIVATE ${HDF5_LIB_TARGET} ${HDF5_TOOLS_LIB_TARGET} ${HDF5_TEST_LIB_TARGET})
+ target_include_directories (h5perf PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>")
+ if (NOT BUILD_SHARED_LIBS)
+ TARGET_C_PROPERTIES (h5perf STATIC)
+ target_link_libraries (h5perf PRIVATE ${HDF5_TOOLS_LIB_TARGET} ${HDF5_TEST_LIB_TARGET} ${HDF5_LIB_TARGET})
+ else ()
+ TARGET_C_PROPERTIES (h5perf SHARED)
+ target_link_libraries (h5perf PRIVATE ${HDF5_TOOLS_LIBSH_TARGET} ${HDF5_TEST_LIBSH_TARGET} ${HDF5_LIBSH_TARGET})
+ endif ()
set_target_properties (h5perf PROPERTIES FOLDER perform)
if (HDF5_BUILD_PERFORM_STANDALONE)
@@ -108,11 +154,17 @@ if (H5_HAVE_PARALLEL AND BUILD_TESTING)
set (h5perf_alone_SOURCES
${HDF5_TOOLS_TEST_PERFORM_SOURCE_DIR}/pio_perf.c
${HDF5_TOOLS_TEST_PERFORM_SOURCE_DIR}/pio_engine.c
+ ${HDF5_TOOLS_TEST_PERFORM_SOURCE_DIR}/pio_standalone.c
)
add_executable (h5perf_alone ${h5perf_alone_SOURCES})
- target_include_directories(h5perf_alone PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>")
- TARGET_C_PROPERTIES (h5perf_alone STATIC)
- target_link_libraries (h5perf_alone PRIVATE ${HDF5_LIB_TARGET} ${HDF5_TOOLS_LIB_TARGET} ${HDF5_TEST_LIB_TARGET})
+ target_include_directories (h5perf_alone PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>")
+ if (NOT BUILD_SHARED_LIBS)
+ TARGET_C_PROPERTIES (h5perf_alone STATIC)
+ target_link_libraries (h5perf_alone PRIVATE ${HDF5_TOOLS_LIB_TARGET} ${HDF5_TEST_LIB_TARGET} ${HDF5_LIB_TARGET})
+ else ()
+ TARGET_C_PROPERTIES (h5perf_alone SHARED)
+ target_link_libraries (h5perf_alone PRIVATE ${HDF5_TOOLS_LIBSH_TARGET} ${HDF5_TEST_LIBSH_TARGET} ${HDF5_LIBSH_TARGET})
+ endif ()
set_target_properties (h5perf_alone PROPERTIES FOLDER perform)
set_property (TARGET h5perf_alone
APPEND PROPERTY COMPILE_DEFINITIONS STANDALONE
diff --git a/tools/test/perform/CMakeTests.cmake b/tools/test/perform/CMakeTests.cmake
index 5abd038..36172d1 100644
--- a/tools/test/perform/CMakeTests.cmake
+++ b/tools/test/perform/CMakeTests.cmake
@@ -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/chunk_cache.c b/tools/test/perform/chunk_cache.c
index 429f70a..47734b6 100644
--- a/tools/test/perform/chunk_cache.c
+++ b/tools/test/perform/chunk_cache.c
@@ -106,8 +106,8 @@ cleanup (void)
*/
static int create_dset1(hid_t file)
{
- hid_t dataspace, dataset;
- hid_t dcpl;
+ hid_t dataspace = H5I_INVALID_HID, dataset = H5I_INVALID_HID;
+ hid_t dcpl = H5I_INVALID_HID;
hsize_t dims[RANK] = {DSET1_DIM1, DSET1_DIM2};
hsize_t chunk_dims[RANK] = {CHUNK1_DIM1, CHUNK1_DIM2};
int data[DSET1_DIM1][DSET1_DIM2]; /* data for writing */
@@ -167,8 +167,8 @@ error:
*/
static int create_dset2(hid_t file)
{
- hid_t dataspace, dataset;
- hid_t dcpl;
+ hid_t dataspace = H5I_INVALID_HID, dataset = H5I_INVALID_HID;
+ hid_t dcpl = H5I_INVALID_HID;
hsize_t dims[RANK] = {DSET2_DIM1, DSET2_DIM2};
hsize_t chunk_dims[RANK] = {CHUNK2_DIM1, CHUNK2_DIM2};
int data[DSET2_DIM1][DSET2_DIM2]; /* data for writing */
@@ -226,10 +226,10 @@ error:
*/
static int check_partial_chunks_perf(hid_t file)
{
- hid_t dataset;
- hid_t filespace;
- hid_t memspace;
- hid_t dapl;
+ hid_t dataset = H5I_INVALID_HID;
+ hid_t filespace = H5I_INVALID_HID;
+ hid_t memspace = H5I_INVALID_HID;
+ hid_t dapl = H5I_INVALID_HID;
int rdata[DSET1_DIM2]; /* data for reading */
int i;
@@ -297,10 +297,10 @@ error:
*/
static int check_hash_value_perf(hid_t file)
{
- hid_t dataset;
- hid_t filespace;
- hid_t memspace;
- hid_t dapl;
+ hid_t dataset = H5I_INVALID_HID;
+ hid_t filespace = H5I_INVALID_HID;
+ hid_t memspace = H5I_INVALID_HID;
+ hid_t dapl = H5I_INVALID_HID;
int rdata[DSET2_DIM1]; /* data for reading */
int i;
diff --git a/tools/test/perform/pio_engine.c b/tools/test/perform/pio_engine.c
index 1c0d621..43a0f64 100644
--- a/tools/test/perform/pio_engine.c
+++ b/tools/test/perform/pio_engine.c
@@ -82,6 +82,12 @@
/* POSIX I/O macros */
+#ifdef H5_HAVE_WIN32_API
+/* Can't link against the library, so this test will use the older, non-Unicode
+ * _open() call on Windows.
+ */
+#define HDopen(S,F,...) _open(S, F | _O_BINARY, __VA_ARGS__)
+#endif /* H5_HAVE_WIN32_API */
#define POSIXCREATE(fn) HDopen(fn, O_CREAT|O_TRUNC|O_RDWR, 0600)
#define POSIXOPEN(fn, F) HDopen(fn, F, 0600)
#define POSIXCLOSE(F) HDclose(F)
diff --git a/tools/test/perform/pio_standalone.c b/tools/test/perform/pio_standalone.c
index bd5fb6f..d5f681e 100644
--- a/tools/test/perform/pio_standalone.c
+++ b/tools/test/perform/pio_standalone.c
@@ -170,6 +170,7 @@ print_version(const char *progname)
MPI_Info h5_io_info_g=MPI_INFO_NULL;/* MPI INFO object for IO */
#endif
+#if 0
int
h5_set_info_object(void)
{
@@ -277,3 +278,6 @@ h5_dump_info_object(MPI_Info info)
}
}
+
+#endif
+
diff --git a/tools/test/perform/sio_engine.c b/tools/test/perform/sio_engine.c
index 4fead3f..11de229 100644
--- a/tools/test/perform/sio_engine.c
+++ b/tools/test/perform/sio_engine.c
@@ -54,6 +54,12 @@
} while(0)
/* POSIX I/O macros */
+#ifdef H5_HAVE_WIN32_API
+/* Can't link against the library, so this test will use the older, non-Unicode
+ * _open() call on Windows.
+ */
+#define HDopen(S,F,...) _open(S, F | _O_BINARY, __VA_ARGS__)
+#endif /* H5_HAVE_WIN32_API */
#define POSIXCREATE(fn) HDopen(fn, O_CREAT|O_TRUNC|O_RDWR, 0600)
#define POSIXOPEN(fn, F) HDopen(fn, F, 0600)
#define POSIXCLOSE(F) HDclose(F)
diff --git a/tools/testfiles/t128bit_float.h5 b/tools/testfiles/t128bit_float.h5
new file mode 100644
index 0000000..134d510
--- /dev/null
+++ b/tools/testfiles/t128bit_float.h5
Binary files differ