summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--.gitattributes872
-rw-r--r--.gitignore105
-rw-r--r--CMakeFilters.cmake37
-rw-r--r--CTestConfig.cmake2
-rw-r--r--MANIFEST19
-rwxr-xr-xbin/bbrelease21
-rwxr-xr-xbin/chkmanifest24
-rwxr-xr-xbin/h5vers6
-rwxr-xr-xbin/pkgscrpts/h5rmflags167
-rwxr-xr-xbin/pkgscrpts/makeHDF5BinaryTarfiles.pl368
-rwxr-xr-xbin/pkgscrpts/makeInternalREADME.pl215
-rwxr-xr-xbin/pkgscrpts/makeOuterREADME.pl182
-rw-r--r--c++/src/H5AbstractDs.cpp2
-rw-r--r--c++/src/H5Alltypes.h2
-rw-r--r--c++/src/H5ArrayType.cpp42
-rw-r--r--c++/src/H5ArrayType.h4
-rw-r--r--c++/src/H5AtomType.cpp2
-rw-r--r--c++/src/H5Attribute.cpp67
-rw-r--r--c++/src/H5Attribute.h19
-rw-r--r--c++/src/H5CommonFG.cpp1231
-rw-r--r--c++/src/H5CommonFG.h137
-rw-r--r--c++/src/H5CompType.cpp2
-rw-r--r--c++/src/H5DataSet.cpp39
-rw-r--r--c++/src/H5DataSet.h6
-rw-r--r--c++/src/H5DataSpace.cpp11
-rw-r--r--c++/src/H5DataSpace.h4
-rw-r--r--c++/src/H5DataType.cpp25
-rw-r--r--c++/src/H5DataType.h6
-rw-r--r--c++/src/H5DcreatProp.cpp14
-rw-r--r--c++/src/H5DcreatProp.h12
-rw-r--r--c++/src/H5DxferProp.cpp17
-rw-r--r--c++/src/H5DxferProp.h12
-rw-r--r--c++/src/H5EnumType.cpp2
-rw-r--r--c++/src/H5FaccProp.cpp43
-rw-r--r--c++/src/H5FaccProp.h11
-rw-r--r--c++/src/H5File.cpp23
-rw-r--r--c++/src/H5File.h12
-rw-r--r--c++/src/H5FloatType.cpp2
-rw-r--r--c++/src/H5Group.cpp1283
-rw-r--r--c++/src/H5Group.h148
-rw-r--r--c++/src/H5IntType.cpp2
-rw-r--r--c++/src/H5Library.cpp1
-rw-r--r--c++/src/H5Location.cpp282
-rw-r--r--c++/src/H5Location.h43
-rw-r--r--c++/src/H5Object.cpp278
-rw-r--r--c++/src/H5Object.h70
-rw-r--r--c++/src/H5PredType.cpp1
-rw-r--r--c++/src/H5StrType.cpp2
-rw-r--r--c++/src/H5VarLenType.cpp2
-rw-r--r--c++/test/CMakeLists.txt7
-rw-r--r--c++/test/CMakeTests.cmake15
-rw-r--r--c++/test/h5cpputil.h15
-rw-r--r--c++/test/tattr.cpp12
-rw-r--r--c++/test/testhdf5.cpp3
-rw-r--r--c++/test/tfile.cpp69
-rw-r--r--config/cmake/H5pubconf.h.in18
-rw-r--r--config/cmake/HDF518_Examples.cmake.in8
-rw-r--r--config/cmake/HDF5UseFortran.cmake109
-rw-r--r--config/cmake/HDF5_Examples.cmake.in8
-rw-r--r--config/cmake/README.txt.cmake.in2
-rw-r--r--config/cmake/cacheinit.cmake4
-rw-r--r--config/cmake/mccacheinit.cmake4
-rwxr-xr-xconfig/cmake/scripts/CTestScript.cmake8
-rwxr-xr-xconfig/cmake/scripts/HDF5config.cmake8
-rw-r--r--config/cmake_ext_mod/ConfigureChecks.cmake16
-rw-r--r--config/cmake_ext_mod/HDFCXXTests.cpp35
-rw-r--r--config/cmake_ext_mod/HDFMacros.cmake10
-rw-r--r--config/cmake_ext_mod/HDFTests.c49
-rw-r--r--config/cygwin (renamed from config/i386-pc-cygwin32)13
-rw-r--r--config/i686-pc-cygwin137
-rw-r--r--config/x86_64-pc-cygwin138
-rw-r--r--configure.ac256
-rw-r--r--examples/README2
-rw-r--r--fortran/test/tf.F906
-rw-r--r--hl/examples/CMakeTests.cmake16
-rw-r--r--hl/fortran/test/CMakeLists.txt8
-rw-r--r--hl/fortran/test/Makefile.am29
-rw-r--r--hl/fortran/test/tstlite.F903687
-rw-r--r--hl/fortran/test/tsttable.F9052
-rw-r--r--hl/src/H5DO.c41
-rw-r--r--hl/src/H5LT.c4
-rw-r--r--hl/test/CMakeTests.cmake64
-rw-r--r--hl/test/gen_test_ld.c4
-rw-r--r--hl/test/test_dset_append.c99
-rw-r--r--hl/test/test_dset_opt.c1
-rw-r--r--hl/test/test_packet_vlen.c282
-rw-r--r--hl/tools/gif2h5/CMakeTests.cmake25
-rw-r--r--java/CMakeLists.txt24
-rw-r--r--java/examples/datasets/CMakeLists.txt6
-rw-r--r--java/examples/datatypes/CMakeLists.txt6
-rw-r--r--java/examples/datatypes/H5Ex_T_ObjectReference.java8
-rw-r--r--java/examples/datatypes/H5Ex_T_ObjectReferenceAttribute.java8
-rw-r--r--java/examples/groups/CMakeLists.txt16
-rw-r--r--java/examples/intro/CMakeLists.txt6
-rw-r--r--java/examples/testfiles/examples.datatypes.H5Ex_T_ObjectReference.txt4
-rw-r--r--java/examples/testfiles/examples.datatypes.H5Ex_T_ObjectReferenceAttribute.txt4
-rw-r--r--java/src/hdf/hdf5lib/H5.java19
-rw-r--r--java/src/jni/CMakeLists.txt3
-rw-r--r--java/src/jni/h5aImp.c331
-rw-r--r--java/src/jni/h5dImp.c197
-rw-r--r--java/src/jni/h5eImp.c43
-rw-r--r--java/src/jni/h5fImp.c69
-rw-r--r--java/src/jni/h5gImp.c126
-rw-r--r--java/src/jni/h5iImp.c43
-rw-r--r--java/src/jni/h5iImp.h13
-rw-r--r--java/src/jni/h5jni.h162
-rw-r--r--java/src/jni/h5lImp.c445
-rw-r--r--java/src/jni/h5lImp.h2
-rw-r--r--java/src/jni/h5oImp.c674
-rw-r--r--java/src/jni/h5pImp.c798
-rw-r--r--java/src/jni/h5rImp.c56
-rw-r--r--java/src/jni/h5tImp.c189
-rw-r--r--java/src/jni/h5util.c115
-rw-r--r--java/src/jni/h5util.h9
-rw-r--r--java/test/CMakeLists.txt28
-rw-r--r--java/test/TestH5PL.java123
-rw-r--r--java/test/junit.sh.in2
-rw-r--r--m4/aclocal_cxx.m468
-rw-r--r--m4/aclocal_fc.f90136
-rw-r--r--m4/aclocal_fc.m4187
-rw-r--r--release_docs/INSTALL_CMake.txt10
-rw-r--r--release_docs/RELEASE.txt48
-rw-r--r--release_docs/USING_CMake_Examples.txt2
-rw-r--r--release_docs/USING_HDF5_CMake.txt8
-rw-r--r--src/H5AC.c4
-rw-r--r--src/H5Aint.c44
-rw-r--r--src/H5Dchunk.c19
-rw-r--r--src/H5Defl.c8
-rw-r--r--src/H5Dfill.c25
-rw-r--r--src/H5Dint.c5
-rw-r--r--src/H5Dio.c37
-rw-r--r--src/H5Dscatgath.c333
-rw-r--r--src/H5Dselect.c84
-rw-r--r--src/H5FDcore.c87
-rw-r--r--src/H5FDfamily.c44
-rw-r--r--src/H5FDmulti.c24
-rw-r--r--src/H5FL.c18
-rw-r--r--src/H5FLprivate.h12
-rw-r--r--src/H5FS.c2
-rw-r--r--src/H5FSpkg.h18
-rw-r--r--src/H5FSsection.c2
-rw-r--r--src/H5FSstat.c2
-rw-r--r--src/H5Fprivate.h2
-rw-r--r--src/H5G.c68
-rw-r--r--src/H5Gnode.c2
-rw-r--r--src/H5Gpkg.h2
-rw-r--r--src/H5Gpublic.h2
-rw-r--r--src/H5HFcache.c4
-rw-r--r--src/H5MFaggr.c26
-rw-r--r--src/H5Oalloc.c5
-rw-r--r--src/H5Oattr.c18
-rw-r--r--src/H5Ocache.c8
-rw-r--r--src/H5Oflush.c33
-rw-r--r--src/H5Opkg.h1
-rw-r--r--src/H5Oprivate.h2
-rw-r--r--src/H5Opublic.h1
-rw-r--r--src/H5PL.c90
-rw-r--r--src/H5Pfapl.c2
-rw-r--r--src/H5Shyper.c60
-rw-r--r--src/H5Spoint.c10
-rw-r--r--src/H5Sselect.c111
-rw-r--r--src/H5T.c115
-rw-r--r--src/H5Tprivate.h1
-rw-r--r--src/H5Tpublic.h2
-rw-r--r--src/H5Tvlen.c10
-rw-r--r--src/H5Zscaleoffset.c52
-rw-r--r--src/H5private.h4
-rw-r--r--src/H5system.c29
-rw-r--r--src/H5timer.c38
-rw-r--r--test/CMakeLists.txt1
-rw-r--r--test/CMakeTests.cmake142
-rw-r--r--test/H5srcdir.h42
-rw-r--r--test/Makefile.am5
-rw-r--r--test/big.c8
-rw-r--r--test/bittests.c64
-rw-r--r--test/cmpd_dset.c185
-rw-r--r--test/dsets.c659
-rw-r--r--test/dt_arith.c32
-rw-r--r--test/dtypes.c18
-rw-r--r--test/dynlib4.c104
-rw-r--r--test/error_test.c10
-rw-r--r--test/fheap.c12
-rw-r--r--test/file_image.c16
-rw-r--r--test/fillval.c44
-rw-r--r--test/filter_fail.c1
-rw-r--r--test/flush1.c28
-rw-r--r--test/flush2.c15
-rw-r--r--test/freespace.c16
-rw-r--r--test/gen_plist.c5
-rw-r--r--test/getname.c89
-rw-r--r--test/gheap.c68
-rw-r--r--test/h5test.c100
-rw-r--r--test/h5test.h1
-rw-r--r--test/hyperslab.c20
-rw-r--r--test/lheap.c12
-rw-r--r--test/links.c276
-rw-r--r--test/links_env.c8
-rw-r--r--test/mf.c200
-rw-r--r--test/mtime.c2
-rw-r--r--test/objcopy.c320
-rw-r--r--test/ohdr.c1
-rw-r--r--test/plugin.c41
-rw-r--r--test/set_extent.c6
-rw-r--r--test/tchecksum.c4
-rw-r--r--test/test_plugin.sh.in4
-rw-r--r--test/testframe.c55
-rw-r--r--test/testhdf5.c3
-rw-r--r--test/tfile.c19
-rw-r--r--test/tgenprop.c6
-rw-r--r--test/th5o.c34
-rw-r--r--test/th5s.c20
-rw-r--r--test/theap.c3
-rw-r--r--test/titerate.c14
-rw-r--r--test/tmeta.c2
-rw-r--r--test/trefer.c28
-rw-r--r--test/tselect.c30
-rw-r--r--test/tskiplist.c3
-rw-r--r--test/tsohm.c83
-rw-r--r--test/ttsafe.c3
-rw-r--r--test/ttst.c5
-rw-r--r--test/tunicode.c42
-rw-r--r--test/tvltypes.c94
-rw-r--r--test/unlink.c1
-rw-r--r--test/vds.c1
-rw-r--r--test/vfd.c566
-rw-r--r--testpar/t_mdset.c86
-rw-r--r--testpar/t_shapesame.c22
-rw-r--r--testpar/testphdf5.c9
-rw-r--r--testpar/testphdf5.h1
-rw-r--r--tools/h5copy/CMakeLists.txt2
-rw-r--r--tools/h5copy/CMakeTests.cmake10
-rw-r--r--tools/h5copy/h5copy.c24
-rw-r--r--tools/h5copy/h5copygentest.c84
-rw-r--r--tools/h5copy/testfiles/h5copytst.h5bin30448 -> 15900 bytes
-rw-r--r--tools/h5copy/testfiles/h5copytst_new.h5bin30280 -> 31856 bytes
-rw-r--r--tools/h5copy/testh5copy.sh.in4
-rw-r--r--tools/h5diff/CMakeTests.cmake76
-rw-r--r--tools/h5diff/h5diff_common.c9
-rw-r--r--tools/h5diff/h5diff_main.c5
-rw-r--r--tools/h5diff/h5diffgentest.c217
-rw-r--r--tools/h5diff/testh5diff.sh.in2
-rw-r--r--tools/h5dump/CMakeTests.cmake59
-rw-r--r--tools/h5dump/CMakeTestsPBITS.cmake32
-rw-r--r--tools/h5dump/CMakeTestsVDS.cmake36
-rw-r--r--tools/h5dump/CMakeTestsXML.cmake23
-rw-r--r--tools/h5dump/h5dump.c2
-rw-r--r--tools/h5dump/h5dumpgentest.c461
-rw-r--r--tools/h5dump/testh5dump.sh.in8
-rw-r--r--tools/h5dump/testh5dumppbits.sh.in2
-rw-r--r--tools/h5dump/testh5dumpvds.sh.in2
-rw-r--r--tools/h5dump/testh5dumpxml.sh.in2
-rw-r--r--tools/h5format_convert/CMakeTests.cmake19
-rw-r--r--tools/h5format_convert/h5fc_gentest.c4
-rw-r--r--tools/h5import/CMakeTests.cmake30
-rw-r--r--tools/h5import/h5import.c28
-rw-r--r--tools/h5import/h5importtest.c16
-rw-r--r--tools/h5import/h5importtestutil.sh.in2
-rw-r--r--tools/h5jam/CMakeTests.cmake19
-rw-r--r--tools/h5jam/h5jamgentest.c4
-rw-r--r--tools/h5jam/h5unjam.c10
-rw-r--r--tools/h5jam/testh5jam.sh.in2
-rw-r--r--tools/h5ls/CMakeTests.cmake17
-rw-r--r--tools/h5ls/CMakeTestsVDS.cmake15
-rw-r--r--tools/h5ls/h5ls.c119
-rw-r--r--tools/h5ls/testh5ls.sh.in2
-rw-r--r--tools/h5ls/testh5lsvds.sh.in2
-rw-r--r--tools/h5repack/CMakeTests.cmake41
-rw-r--r--tools/h5repack/h5repack.c512
-rw-r--r--tools/h5repack/h5repack.h16
-rw-r--r--tools/h5repack/h5repack_filters.c17
-rw-r--r--tools/h5repack/h5repack_main.c60
-rw-r--r--tools/h5repack/h5repack_opttable.c306
-rw-r--r--tools/h5repack/h5repack_parse.c776
-rw-r--r--tools/h5repack/h5repack_plugin.sh.in2
-rw-r--r--tools/h5repack/h5repacktst.c194
-rw-r--r--tools/h5repack/testfiles/h5repack_layout.h5-plugin_zero.tst9
-rw-r--r--tools/h5stat/CMakeTests.cmake19
-rw-r--r--tools/h5stat/testh5stat.sh.in2
-rw-r--r--tools/lib/h5diff_array.c4
-rw-r--r--tools/lib/h5diff_attr.c14
-rw-r--r--tools/lib/h5tools_filters.c4
-rw-r--r--tools/lib/h5tools_ref.c2
-rw-r--r--tools/lib/io_timer.c4
-rw-r--r--tools/misc/CMakeTests.cmake28
-rw-r--r--tools/misc/h5mkgrp.c4
-rw-r--r--tools/misc/h5repart.c18
-rw-r--r--tools/misc/h5repart_gentest.c3
-rw-r--r--tools/misc/testh5mkgrp.sh.in2
-rw-r--r--tools/misc/vds/UC_1.h29
-rw-r--r--tools/misc/vds/UC_1_one_dim_gen.c36
-rw-r--r--tools/misc/vds/UC_2.h41
-rw-r--r--tools/misc/vds/UC_2_two_dims_gen.c44
-rw-r--r--tools/misc/vds/UC_3.h4
-rw-r--r--tools/misc/vds/UC_4_printf_gen.c4
-rw-r--r--tools/misc/vds/UC_5_stride_gen.c6
-rw-r--r--tools/perform/CMakeTests.cmake10
-rw-r--r--tools/perform/chunk.c18
-rw-r--r--tools/perform/iopipe.c18
-rw-r--r--tools/perform/overhead.c19
-rw-r--r--tools/perform/sio_engine.c144
-rw-r--r--tools/perform/sio_perf.c89
-rw-r--r--tools/perform/sio_perf.h32
-rw-r--r--tools/perform/zip_perf.c24
-rw-r--r--tools/testfiles/tcompound_complex2.ddl1051
-rw-r--r--tools/testfiles/tcompound_complex2.h5bin0 -> 21880 bytes
-rw-r--r--tools/testfiles/textlinksrc-nodangle-1.ls4
-rw-r--r--tools/testfiles/tgroup-1.ls4
-rw-r--r--tools/testfiles/tvlenstr_array.ddl48
-rw-r--r--tools/testfiles/tvlenstr_array.h5bin0 -> 6720 bytes
309 files changed, 14976 insertions, 10319 deletions
diff --git a/.gitattributes b/.gitattributes
new file mode 100644
index 0000000..d18f9b9
--- /dev/null
+++ b/.gitattributes
@@ -0,0 +1,872 @@
+* text=auto !eol
+bin/bbrelease -text
+bin/genparser -text
+bin/switch_maint_mode -text
+c++/src/H5OcreatProp.cpp -text
+c++/src/H5OcreatProp.h -text
+c++/src/footer.html -text
+c++/src/header_files/hdf_logo.jpg -text
+c++/src/header_files/help.jpg -text
+c++/src/header_files/image001.jpg -text
+c++/src/header_files/image002.jpg -text
+c++/test/tarray.cpp -text
+c++/test/th5s.h5 -text
+config/cce-fflags -text
+config/cce-flags -text
+config/cmake/CMakeFindJavaCommon.cmake -text
+config/cmake/CPack.Info.plist.in -text svneol=unset#application/xml
+config/cmake/FindHDFJAVA.cmake.in -text
+config/cmake/FindJNI.cmake -text
+config/cmake/HDF5UseFortran.cmake -text
+config/cmake/HDF5_Examples.cmake.in -text
+config/cmake/HDF5_Process_Flex_Files.cmake -text
+config/cmake/HDFCompilerFlags.cmake -text
+config/cmake/UseJava.cmake -text
+config/cmake/UseJavaClassFilelist.cmake -text
+config/cmake/UseJavaSymlinks.cmake -text
+config/cmake/jrunTest.cmake -text
+config/cmake/patch.xml -text
+config/cmake/scripts/CTestScript.cmake -text
+config/cmake/scripts/HDF5config.cmake -text
+config/cmake_ext_mod/hdf.bmp -text
+config/cmake_ext_mod/hdf.icns -text
+config/cmake_ext_mod/hdf.ico -text
+config/conclude_fc.am -text
+config/gnu-cxxflags -text
+examples/h5_vds-eiger.c -text
+examples/h5_vds-exc.c -text
+examples/h5_vds-exclim.c -text
+examples/h5_vds-percival-unlim-maxmin.c -text
+examples/h5_vds-percival-unlim.c -text
+examples/h5_vds-percival.c -text
+examples/h5_vds-simpleIO.c -text
+examples/h5_vds.c -text
+fortran/src/H5_buildiface.F90 -text
+fortran/src/H5config_f.inc.cmake -text
+fortran/src/H5config_f.inc.in -text
+fortran/src/H5fort_type_defines.h.in -text
+fortran/src/H5fortkit.F90 -text
+fortran/test/H5_test_buildiface.F90 -text
+hl/fortran/src/H5HL_buildiface.F90 -text
+hl/fortran/src/hdf5_hl_fortrandll.def.in -text
+hl/src/H5LD.c -text
+hl/src/H5LDprivate.h -text
+hl/src/H5LDpublic.h -text
+hl/src/H5LTanalyze.c -text
+hl/src/H5LTparse.c -text
+hl/src/H5LTparse.h -text
+hl/test/gen_test_ds.c svneol=native#text/plain
+hl/test/gen_test_ld.c -text
+hl/test/test_ds_be.h5 -text
+hl/test/test_ds_le.h5 -text
+hl/test/test_dset_append.c -text
+hl/test/test_ld.c -text
+hl/test/test_ld.h5 -text
+hl/test/test_packet_vlen.c -text
+hl/test/test_table_be.h5 -text
+hl/test/test_table_cray.h5 -text
+hl/test/test_table_le.h5 -text
+hl/tools/gif2h5/CMakeLists.txt -text
+hl/tools/gif2h5/CMakeTests.cmake -text
+hl/tools/gif2h5/testfiles/README -text
+hl/tools/gif2h5/testfiles/ex_image2.h5 -text
+hl/tools/gif2h5/testfiles/h52giftst.h5 -text
+hl/tools/gif2h5/testfiles/image1.gif -text
+java/CMakeLists.txt -text
+java/COPYING -text
+java/Makefile.am -text
+java/examples/CMakeLists.txt -text
+java/examples/Makefile.am -text
+java/examples/datasets/CMakeLists.txt -text
+java/examples/datasets/H5Ex_D_Alloc.java -text
+java/examples/datasets/H5Ex_D_Checksum.java -text
+java/examples/datasets/H5Ex_D_Chunk.java -text
+java/examples/datasets/H5Ex_D_Compact.java -text
+java/examples/datasets/H5Ex_D_External.java -text
+java/examples/datasets/H5Ex_D_FillValue.java -text
+java/examples/datasets/H5Ex_D_Gzip.java -text
+java/examples/datasets/H5Ex_D_Hyperslab.java -text
+java/examples/datasets/H5Ex_D_Nbit.java -text
+java/examples/datasets/H5Ex_D_ReadWrite.java -text
+java/examples/datasets/H5Ex_D_Shuffle.java -text
+java/examples/datasets/H5Ex_D_Sofloat.java -text
+java/examples/datasets/H5Ex_D_Soint.java -text
+java/examples/datasets/H5Ex_D_Szip.java -text
+java/examples/datasets/H5Ex_D_Transform.java -text
+java/examples/datasets/H5Ex_D_UnlimitedAdd.java -text
+java/examples/datasets/H5Ex_D_UnlimitedGzip.java -text
+java/examples/datasets/H5Ex_D_UnlimitedMod.java -text
+java/examples/datasets/Makefile.am -text
+java/examples/datasets/runExample.sh.in -text
+java/examples/datatypes/CMakeLists.txt -text
+java/examples/datatypes/H5Ex_T_Array.java -text
+java/examples/datatypes/H5Ex_T_ArrayAttribute.java -text
+java/examples/datatypes/H5Ex_T_Bit.java -text
+java/examples/datatypes/H5Ex_T_BitAttribute.java -text
+java/examples/datatypes/H5Ex_T_Commit.java -text
+java/examples/datatypes/H5Ex_T_Compound.java -text
+java/examples/datatypes/H5Ex_T_CompoundAttribute.java -text
+java/examples/datatypes/H5Ex_T_Float.java -text
+java/examples/datatypes/H5Ex_T_FloatAttribute.java -text
+java/examples/datatypes/H5Ex_T_Integer.java -text
+java/examples/datatypes/H5Ex_T_IntegerAttribute.java -text
+java/examples/datatypes/H5Ex_T_ObjectReference.java -text
+java/examples/datatypes/H5Ex_T_ObjectReferenceAttribute.java -text
+java/examples/datatypes/H5Ex_T_Opaque.java -text
+java/examples/datatypes/H5Ex_T_OpaqueAttribute.java -text
+java/examples/datatypes/H5Ex_T_String.java -text
+java/examples/datatypes/H5Ex_T_StringAttribute.java -text
+java/examples/datatypes/H5Ex_T_VLString.java -text
+java/examples/datatypes/Makefile.am -text
+java/examples/datatypes/runExample.sh.in -text
+java/examples/groups/CMakeLists.txt -text
+java/examples/groups/H5Ex_G_Compact.java -text
+java/examples/groups/H5Ex_G_Corder.java -text
+java/examples/groups/H5Ex_G_Create.java -text
+java/examples/groups/H5Ex_G_Intermediate.java -text
+java/examples/groups/H5Ex_G_Iterate.java -text
+java/examples/groups/H5Ex_G_Phase.java -text
+java/examples/groups/H5Ex_G_Traverse.java -text
+java/examples/groups/H5Ex_G_Visit.java -text
+java/examples/groups/Makefile.am -text
+java/examples/groups/h5ex_g_iterate.h5 -text svneol=unset#application/x-hdf
+java/examples/groups/h5ex_g_visit.h5 -text svneol=unset#application/x-hdf
+java/examples/groups/runExample.sh.in -text
+java/examples/intro/CMakeLists.txt -text
+java/examples/intro/H5_CreateAttribute.java -text
+java/examples/intro/H5_CreateDataset.java -text
+java/examples/intro/H5_CreateFile.java -text
+java/examples/intro/H5_CreateGroup.java -text
+java/examples/intro/H5_CreateGroupAbsoluteRelative.java -text
+java/examples/intro/H5_CreateGroupDataset.java -text
+java/examples/intro/H5_ReadWrite.java -text
+java/examples/intro/Makefile.am -text
+java/examples/intro/runExample.sh.in -text
+java/examples/testfiles/examples.datasets.H5Ex_D_Alloc.txt -text
+java/examples/testfiles/examples.datasets.H5Ex_D_Checksum.txt -text
+java/examples/testfiles/examples.datasets.H5Ex_D_Chunk.txt -text
+java/examples/testfiles/examples.datasets.H5Ex_D_Compact.txt -text
+java/examples/testfiles/examples.datasets.H5Ex_D_External.txt -text
+java/examples/testfiles/examples.datasets.H5Ex_D_FillValue.txt -text
+java/examples/testfiles/examples.datasets.H5Ex_D_Gzip.txt -text
+java/examples/testfiles/examples.datasets.H5Ex_D_Hyperslab.txt -text
+java/examples/testfiles/examples.datasets.H5Ex_D_Nbit.txt -text
+java/examples/testfiles/examples.datasets.H5Ex_D_ReadWrite.txt -text
+java/examples/testfiles/examples.datasets.H5Ex_D_Shuffle.txt -text
+java/examples/testfiles/examples.datasets.H5Ex_D_Sofloat.txt -text
+java/examples/testfiles/examples.datasets.H5Ex_D_Soint.txt -text
+java/examples/testfiles/examples.datasets.H5Ex_D_Szip.txt -text
+java/examples/testfiles/examples.datasets.H5Ex_D_Transform.txt -text
+java/examples/testfiles/examples.datasets.H5Ex_D_UnlimitedAdd.txt -text
+java/examples/testfiles/examples.datasets.H5Ex_D_UnlimitedGzip.txt -text
+java/examples/testfiles/examples.datasets.H5Ex_D_UnlimitedMod.txt -text
+java/examples/testfiles/examples.datatypes.H5Ex_T_Array.txt -text
+java/examples/testfiles/examples.datatypes.H5Ex_T_ArrayAttribute.txt -text
+java/examples/testfiles/examples.datatypes.H5Ex_T_Bit.txt -text
+java/examples/testfiles/examples.datatypes.H5Ex_T_BitAttribute.txt -text
+java/examples/testfiles/examples.datatypes.H5Ex_T_Commit.txt -text
+java/examples/testfiles/examples.datatypes.H5Ex_T_Compound.txt -text
+java/examples/testfiles/examples.datatypes.H5Ex_T_CompoundAttribute.txt -text
+java/examples/testfiles/examples.datatypes.H5Ex_T_Float.txt -text
+java/examples/testfiles/examples.datatypes.H5Ex_T_FloatAttribute.txt -text
+java/examples/testfiles/examples.datatypes.H5Ex_T_Integer.txt -text
+java/examples/testfiles/examples.datatypes.H5Ex_T_IntegerAttribute.txt -text
+java/examples/testfiles/examples.datatypes.H5Ex_T_ObjectReference.txt -text
+java/examples/testfiles/examples.datatypes.H5Ex_T_ObjectReferenceAttribute.txt -text
+java/examples/testfiles/examples.datatypes.H5Ex_T_Opaque.txt -text
+java/examples/testfiles/examples.datatypes.H5Ex_T_OpaqueAttribute.txt -text
+java/examples/testfiles/examples.datatypes.H5Ex_T_String.txt -text
+java/examples/testfiles/examples.datatypes.H5Ex_T_StringAttribute.txt -text
+java/examples/testfiles/examples.datatypes.H5Ex_T_VLString.txt -text
+java/examples/testfiles/examples.groups.H5Ex_G_Compact.txt -text
+java/examples/testfiles/examples.groups.H5Ex_G_Corder.txt -text
+java/examples/testfiles/examples.groups.H5Ex_G_Create.txt -text
+java/examples/testfiles/examples.groups.H5Ex_G_Intermediate.txt -text
+java/examples/testfiles/examples.groups.H5Ex_G_Iterate.txt -text
+java/examples/testfiles/examples.groups.H5Ex_G_Phase.txt -text
+java/examples/testfiles/examples.groups.H5Ex_G_Visit.txt -text
+java/examples/testfiles/examples.intro.H5_CreateAttribute.txt -text
+java/examples/testfiles/examples.intro.H5_CreateDataset.txt -text
+java/examples/testfiles/examples.intro.H5_CreateFile.txt -text
+java/examples/testfiles/examples.intro.H5_CreateGroup.txt -text
+java/examples/testfiles/examples.intro.H5_CreateGroupAbsoluteRelative.txt -text
+java/examples/testfiles/examples.intro.H5_CreateGroupDataset.txt -text
+java/examples/testfiles/examples.intro.H5_ReadWrite.txt -text
+java/lib/ext/slf4j-nop-1.7.5.jar -text svneol=unset#application/zip
+java/lib/ext/slf4j-simple-1.7.5.jar -text svneol=unset#application/zip
+java/lib/hamcrest-core.jar -text svneol=unset#application/java-archive
+java/lib/junit.jar -text svneol=unset#application/java-archive
+java/lib/simplelogger.properties -text
+java/lib/slf4j-api-1.7.5.jar -text svneol=unset#application/zip
+java/src/CMakeLists.txt -text
+java/src/Makefile.am -text
+java/src/hdf/CMakeLists.txt -text
+java/src/hdf/hdf5lib/CMakeLists.txt -text
+java/src/hdf/hdf5lib/H5.java -text
+java/src/hdf/hdf5lib/HDF5Constants.java -text
+java/src/hdf/hdf5lib/HDF5GroupInfo.java -text
+java/src/hdf/hdf5lib/HDFArray.java -text
+java/src/hdf/hdf5lib/HDFNativeData.java -text
+java/src/hdf/hdf5lib/callbacks/Callbacks.java -text
+java/src/hdf/hdf5lib/callbacks/H5A_iterate_cb.java -text
+java/src/hdf/hdf5lib/callbacks/H5A_iterate_t.java -text
+java/src/hdf/hdf5lib/callbacks/H5D_append_cb.java -text
+java/src/hdf/hdf5lib/callbacks/H5D_append_t.java -text
+java/src/hdf/hdf5lib/callbacks/H5D_iterate_cb.java -text
+java/src/hdf/hdf5lib/callbacks/H5D_iterate_t.java -text
+java/src/hdf/hdf5lib/callbacks/H5E_walk_cb.java -text
+java/src/hdf/hdf5lib/callbacks/H5E_walk_t.java -text
+java/src/hdf/hdf5lib/callbacks/H5L_iterate_cb.java -text
+java/src/hdf/hdf5lib/callbacks/H5L_iterate_t.java -text
+java/src/hdf/hdf5lib/callbacks/H5O_iterate_cb.java -text
+java/src/hdf/hdf5lib/callbacks/H5O_iterate_t.java -text
+java/src/hdf/hdf5lib/callbacks/H5P_cls_close_func_cb.java -text
+java/src/hdf/hdf5lib/callbacks/H5P_cls_close_func_t.java -text
+java/src/hdf/hdf5lib/callbacks/H5P_cls_copy_func_cb.java -text
+java/src/hdf/hdf5lib/callbacks/H5P_cls_copy_func_t.java -text
+java/src/hdf/hdf5lib/callbacks/H5P_cls_create_func_cb.java -text
+java/src/hdf/hdf5lib/callbacks/H5P_cls_create_func_t.java -text
+java/src/hdf/hdf5lib/callbacks/H5P_iterate_cb.java -text
+java/src/hdf/hdf5lib/callbacks/H5P_iterate_t.java -text
+java/src/hdf/hdf5lib/callbacks/H5P_prp_close_func_cb.java -text
+java/src/hdf/hdf5lib/callbacks/H5P_prp_compare_func_cb.java -text
+java/src/hdf/hdf5lib/callbacks/H5P_prp_copy_func_cb.java -text
+java/src/hdf/hdf5lib/callbacks/H5P_prp_create_func_cb.java -text
+java/src/hdf/hdf5lib/callbacks/H5P_prp_delete_func_cb.java -text
+java/src/hdf/hdf5lib/callbacks/H5P_prp_get_func_cb.java -text
+java/src/hdf/hdf5lib/callbacks/H5P_prp_set_func_cb.java -text
+java/src/hdf/hdf5lib/exceptions/HDF5AtomException.java -text
+java/src/hdf/hdf5lib/exceptions/HDF5AttributeException.java -text
+java/src/hdf/hdf5lib/exceptions/HDF5BtreeException.java -text
+java/src/hdf/hdf5lib/exceptions/HDF5DataFiltersException.java -text
+java/src/hdf/hdf5lib/exceptions/HDF5DataStorageException.java -text
+java/src/hdf/hdf5lib/exceptions/HDF5DatasetInterfaceException.java -text
+java/src/hdf/hdf5lib/exceptions/HDF5DataspaceInterfaceException.java -text
+java/src/hdf/hdf5lib/exceptions/HDF5DatatypeInterfaceException.java -text
+java/src/hdf/hdf5lib/exceptions/HDF5Exception.java -text
+java/src/hdf/hdf5lib/exceptions/HDF5ExternalFileListException.java -text
+java/src/hdf/hdf5lib/exceptions/HDF5FileInterfaceException.java -text
+java/src/hdf/hdf5lib/exceptions/HDF5FunctionArgumentException.java -text
+java/src/hdf/hdf5lib/exceptions/HDF5FunctionEntryExitException.java -text
+java/src/hdf/hdf5lib/exceptions/HDF5HeapException.java -text
+java/src/hdf/hdf5lib/exceptions/HDF5InternalErrorException.java -text
+java/src/hdf/hdf5lib/exceptions/HDF5JavaException.java -text
+java/src/hdf/hdf5lib/exceptions/HDF5LibraryException.java -text
+java/src/hdf/hdf5lib/exceptions/HDF5LowLevelIOException.java -text
+java/src/hdf/hdf5lib/exceptions/HDF5MetaDataCacheException.java -text
+java/src/hdf/hdf5lib/exceptions/HDF5ObjectHeaderException.java -text
+java/src/hdf/hdf5lib/exceptions/HDF5PropertyListInterfaceException.java -text
+java/src/hdf/hdf5lib/exceptions/HDF5ReferenceException.java -text
+java/src/hdf/hdf5lib/exceptions/HDF5ResourceUnavailableException.java -text
+java/src/hdf/hdf5lib/exceptions/HDF5SymbolTableException.java -text
+java/src/hdf/hdf5lib/structs/H5AC_cache_config_t.java -text
+java/src/hdf/hdf5lib/structs/H5A_info_t.java -text
+java/src/hdf/hdf5lib/structs/H5E_error2_t.java -text
+java/src/hdf/hdf5lib/structs/H5F_info2_t.java -text
+java/src/hdf/hdf5lib/structs/H5G_info_t.java -text
+java/src/hdf/hdf5lib/structs/H5L_info_t.java -text
+java/src/hdf/hdf5lib/structs/H5O_hdr_info_t.java -text
+java/src/hdf/hdf5lib/structs/H5O_info_t.java -text
+java/src/hdf/hdf5lib/structs/H5_ih_info_t.java -text
+java/src/hdf/overview.html -text
+java/src/jni/CMakeLists.txt -text
+java/src/jni/Makefile.am -text
+java/src/jni/exceptionImp.c -text
+java/src/jni/exceptionImp.h -text
+java/src/jni/h5Constants.c -text
+java/src/jni/h5Imp.c -text
+java/src/jni/h5Imp.h -text
+java/src/jni/h5aImp.c -text
+java/src/jni/h5aImp.h -text
+java/src/jni/h5dImp.c -text
+java/src/jni/h5dImp.h -text
+java/src/jni/h5eImp.c -text
+java/src/jni/h5eImp.h -text
+java/src/jni/h5fImp.c -text
+java/src/jni/h5fImp.h -text
+java/src/jni/h5gImp.c -text
+java/src/jni/h5gImp.h -text
+java/src/jni/h5iImp.c -text
+java/src/jni/h5iImp.h -text
+java/src/jni/h5jni.h -text
+java/src/jni/h5lImp.c -text
+java/src/jni/h5lImp.h -text
+java/src/jni/h5oImp.c -text
+java/src/jni/h5oImp.h -text
+java/src/jni/h5pImp.c -text
+java/src/jni/h5pImp.h -text
+java/src/jni/h5plImp.c -text
+java/src/jni/h5plImp.h -text
+java/src/jni/h5rImp.c -text
+java/src/jni/h5rImp.h -text
+java/src/jni/h5sImp.c -text
+java/src/jni/h5sImp.h -text
+java/src/jni/h5tImp.c -text
+java/src/jni/h5tImp.h -text
+java/src/jni/h5util.c -text
+java/src/jni/h5util.h -text
+java/src/jni/h5zImp.c -text
+java/src/jni/h5zImp.h -text
+java/src/jni/nativeData.c -text
+java/src/jni/nativeData.h -text
+java/test/CMakeLists.txt -text
+java/test/JUnit-interface.ert -text
+java/test/JUnit-interface.txt -text
+java/test/Makefile.am -text
+java/test/TestAll.java -text
+java/test/TestH5.java -text
+java/test/TestH5A.java -text
+java/test/TestH5D.java -text
+java/test/TestH5Dparams.java -text
+java/test/TestH5Dplist.java -text
+java/test/TestH5E.java -text
+java/test/TestH5Edefault.java -text
+java/test/TestH5Eregister.java -text
+java/test/TestH5F.java -text
+java/test/TestH5Fbasic.java -text
+java/test/TestH5Fparams.java -text
+java/test/TestH5G.java -text
+java/test/TestH5Gbasic.java -text
+java/test/TestH5Giterate.java -text
+java/test/TestH5Lbasic.java -text
+java/test/TestH5Lcreate.java -text
+java/test/TestH5Lparams.java -text
+java/test/TestH5Obasic.java -text
+java/test/TestH5Ocopy.java -text
+java/test/TestH5Ocreate.java -text
+java/test/TestH5Oparams.java -text
+java/test/TestH5P.java -text
+java/test/TestH5PData.java -text
+java/test/TestH5PL.java -text
+java/test/TestH5Pfapl.java -text
+java/test/TestH5Plist.java -text
+java/test/TestH5Pvirtual.java -text
+java/test/TestH5R.java -text
+java/test/TestH5S.java -text
+java/test/TestH5Sbasic.java -text
+java/test/TestH5T.java -text
+java/test/TestH5Tbasic.java -text
+java/test/TestH5Tparams.java -text
+java/test/TestH5Z.java -text
+java/test/h5ex_g_iterate.orig -text svneol=unset#application/x-hdf
+java/test/junit.sh.in -text
+m4/aclocal_cxx.m4 -text
+m4/aclocal_fc.f90 -text
+m4/aclocal_fc.m4 -text
+m4/ax_check_class.m4 -text
+m4/ax_check_classpath.m4 -text
+m4/ax_check_java_home.m4 -text
+m4/ax_check_junit.m4 -text
+m4/ax_check_rqrd_class.m4 -text
+m4/ax_java_check_class.m4 -text
+m4/ax_java_options.m4 -text
+m4/ax_jni_include_dir.m4 -text
+m4/ax_prog_jar.m4 -text
+m4/ax_prog_java.m4 -text
+m4/ax_prog_java_cc.m4 -text
+m4/ax_prog_java_works.m4 -text
+m4/ax_prog_javac.m4 -text
+m4/ax_prog_javac_works.m4 -text
+m4/ax_prog_javadoc.m4 -text
+m4/ax_prog_javah.m4 -text
+m4/ax_try_compile_java.m4 -text
+m4/ax_try_run_java.m4 -text
+src/H5Cepoch.c -text
+src/H5Cquery.c -text
+src/H5Ctag.c -text
+src/H5Ctest.c -text
+src/H5Dnone.c -text
+src/H5Dsingle.c -text
+src/H5Oflush.c -text
+test/bad_compound.h5 -text
+test/be_data.h5 -text
+test/be_extlink1.h5 -text
+test/be_extlink2.h5 -text
+test/btree_idx_1_6.h5 -text
+test/btree_idx_1_8.h5 -text
+test/cork.c -text
+test/corrupt_stab_msg.h5 -text
+test/deflate.h5 -text
+test/dynlib4.c -text
+test/family_v16_00000.h5 -text
+test/family_v16_00001.h5 -text
+test/family_v16_00002.h5 -text
+test/family_v16_00003.h5 -text
+test/file_image_core_test.h5 -text
+test/filespace_1_6.h5 -text
+test/filespace_1_8.h5 -text
+test/fill_old.h5 -text
+test/filter_error.h5 -text
+test/group_old.h5 -text
+test/le_data.h5 -text
+test/le_extlink1.h5 -text
+test/le_extlink2.h5 -text
+test/mergemsg.h5 -text svneol=unset#application/hdf5
+test/multi_file_v16-r.h5 -text
+test/multi_file_v16-s.h5 -text
+test/noencoder.h5 -text
+test/specmetaread.h5 -text
+test/tarrold.h5 -text
+test/tbad_msg_count.h5 -text
+test/tbogus.h5 -text
+test/test_filters_be.h5 -text
+test/test_filters_le.h5 -text
+test/testfiles/plist_files/acpl_32be -text
+test/testfiles/plist_files/acpl_32le -text
+test/testfiles/plist_files/acpl_64be -text
+test/testfiles/plist_files/acpl_64le -text
+test/testfiles/plist_files/dapl_32be -text
+test/testfiles/plist_files/dapl_32le -text
+test/testfiles/plist_files/dapl_64be -text
+test/testfiles/plist_files/dapl_64le -text
+test/testfiles/plist_files/dcpl_32be -text
+test/testfiles/plist_files/dcpl_32le -text
+test/testfiles/plist_files/dcpl_64be -text
+test/testfiles/plist_files/dcpl_64le -text
+test/testfiles/plist_files/def_acpl_32be -text
+test/testfiles/plist_files/def_acpl_32le -text
+test/testfiles/plist_files/def_acpl_64be -text
+test/testfiles/plist_files/def_acpl_64le -text
+test/testfiles/plist_files/def_dapl_32be -text
+test/testfiles/plist_files/def_dapl_32le -text
+test/testfiles/plist_files/def_dapl_64be -text
+test/testfiles/plist_files/def_dapl_64le -text
+test/testfiles/plist_files/def_dcpl_32be -text
+test/testfiles/plist_files/def_dcpl_32le -text
+test/testfiles/plist_files/def_dcpl_64be -text
+test/testfiles/plist_files/def_dcpl_64le -text
+test/testfiles/plist_files/def_dxpl_32be -text
+test/testfiles/plist_files/def_dxpl_32le -text
+test/testfiles/plist_files/def_dxpl_64be -text
+test/testfiles/plist_files/def_dxpl_64le -text
+test/testfiles/plist_files/def_fapl_32be -text
+test/testfiles/plist_files/def_fapl_32le -text
+test/testfiles/plist_files/def_fapl_64be -text
+test/testfiles/plist_files/def_fapl_64le -text
+test/testfiles/plist_files/def_fcpl_32be -text
+test/testfiles/plist_files/def_fcpl_32le -text
+test/testfiles/plist_files/def_fcpl_64be -text
+test/testfiles/plist_files/def_fcpl_64le -text
+test/testfiles/plist_files/def_gcpl_32be -text
+test/testfiles/plist_files/def_gcpl_32le -text
+test/testfiles/plist_files/def_gcpl_64be -text
+test/testfiles/plist_files/def_gcpl_64le -text
+test/testfiles/plist_files/def_lapl_32be -text
+test/testfiles/plist_files/def_lapl_32le -text
+test/testfiles/plist_files/def_lapl_64be -text
+test/testfiles/plist_files/def_lapl_64le -text
+test/testfiles/plist_files/def_lcpl_32be -text
+test/testfiles/plist_files/def_lcpl_32le -text
+test/testfiles/plist_files/def_lcpl_64be -text
+test/testfiles/plist_files/def_lcpl_64le -text
+test/testfiles/plist_files/def_ocpl_32be -text
+test/testfiles/plist_files/def_ocpl_32le -text
+test/testfiles/plist_files/def_ocpl_64be -text
+test/testfiles/plist_files/def_ocpl_64le -text
+test/testfiles/plist_files/def_ocpypl_32be -text
+test/testfiles/plist_files/def_ocpypl_32le -text
+test/testfiles/plist_files/def_ocpypl_64be -text
+test/testfiles/plist_files/def_ocpypl_64le -text
+test/testfiles/plist_files/def_strcpl_32be -text
+test/testfiles/plist_files/def_strcpl_32le -text
+test/testfiles/plist_files/def_strcpl_64be -text
+test/testfiles/plist_files/def_strcpl_64le -text
+test/testfiles/plist_files/dxpl_32be -text
+test/testfiles/plist_files/dxpl_32le -text
+test/testfiles/plist_files/dxpl_64be -text
+test/testfiles/plist_files/dxpl_64le -text
+test/testfiles/plist_files/fapl_32be -text
+test/testfiles/plist_files/fapl_32le -text
+test/testfiles/plist_files/fapl_64be -text
+test/testfiles/plist_files/fapl_64le -text
+test/testfiles/plist_files/fcpl_32be -text
+test/testfiles/plist_files/fcpl_32le -text
+test/testfiles/plist_files/fcpl_64be -text
+test/testfiles/plist_files/fcpl_64le -text
+test/testfiles/plist_files/gcpl_32be -text
+test/testfiles/plist_files/gcpl_32le -text
+test/testfiles/plist_files/gcpl_64be -text
+test/testfiles/plist_files/gcpl_64le -text
+test/testfiles/plist_files/lapl_32be -text
+test/testfiles/plist_files/lapl_32le -text
+test/testfiles/plist_files/lapl_64be -text
+test/testfiles/plist_files/lapl_64le -text
+test/testfiles/plist_files/lcpl_32be -text
+test/testfiles/plist_files/lcpl_32le -text
+test/testfiles/plist_files/lcpl_64be -text
+test/testfiles/plist_files/lcpl_64le -text
+test/testfiles/plist_files/ocpl_32be -text
+test/testfiles/plist_files/ocpl_32le -text
+test/testfiles/plist_files/ocpl_64be -text
+test/testfiles/plist_files/ocpl_64le -text
+test/testfiles/plist_files/ocpypl_32be -text
+test/testfiles/plist_files/ocpypl_32le -text
+test/testfiles/plist_files/ocpypl_64be -text
+test/testfiles/plist_files/ocpypl_64le -text
+test/testfiles/plist_files/strcpl_32be -text
+test/testfiles/plist_files/strcpl_32le -text
+test/testfiles/plist_files/strcpl_64be -text
+test/testfiles/plist_files/strcpl_64le -text
+test/th5s.h5 -text
+test/tlayouto.h5 -text
+test/tmtimen.h5 -text
+test/tmtimeo.h5 -text
+test/tsizeslheap.h5 -text
+testpar/t_init_term.c -text
+testpar/t_prestart.c -text
+testpar/t_pshutdown.c -text
+tools/h5copy/testfiles/h5copy_extlinks_src.h5 -text
+tools/h5copy/testfiles/h5copy_extlinks_trg.h5 -text
+tools/h5copy/testfiles/h5copy_ref.h5 -text
+tools/h5copy/testfiles/h5copytst.h5 -text
+tools/h5copy/testfiles/h5copytst_new.h5 -text
+tools/h5copy/testfiles/h5copytst_new.out.ls -text
+tools/h5diff/testfiles/compounds_array_vlen1.h5 -text
+tools/h5diff/testfiles/compounds_array_vlen2.h5 -text
+tools/h5diff/testfiles/h5diff_attr1.h5 -text
+tools/h5diff/testfiles/h5diff_attr2.h5 -text
+tools/h5diff/testfiles/h5diff_attr_v_level1.h5 -text
+tools/h5diff/testfiles/h5diff_attr_v_level2.h5 -text
+tools/h5diff/testfiles/h5diff_basic1.h5 -text
+tools/h5diff/testfiles/h5diff_basic2.h5 -text
+tools/h5diff/testfiles/h5diff_comp_vl_strs.h5 -text
+tools/h5diff/testfiles/h5diff_danglelinks1.h5 -text
+tools/h5diff/testfiles/h5diff_danglelinks2.h5 -text
+tools/h5diff/testfiles/h5diff_dset1.h5 -text
+tools/h5diff/testfiles/h5diff_dset2.h5 -text
+tools/h5diff/testfiles/h5diff_dset_zero_dim_size1.h5 -text
+tools/h5diff/testfiles/h5diff_dset_zero_dim_size2.h5 -text
+tools/h5diff/testfiles/h5diff_dtypes.h5 -text
+tools/h5diff/testfiles/h5diff_empty.h5 -text
+tools/h5diff/testfiles/h5diff_enum_invalid_values.h5 -text
+tools/h5diff/testfiles/h5diff_exclude1-1.h5 -text
+tools/h5diff/testfiles/h5diff_exclude1-2.h5 -text
+tools/h5diff/testfiles/h5diff_exclude2-1.h5 -text
+tools/h5diff/testfiles/h5diff_exclude2-2.h5 -text
+tools/h5diff/testfiles/h5diff_exclude3-1.h5 -text
+tools/h5diff/testfiles/h5diff_exclude3-2.h5 -text
+tools/h5diff/testfiles/h5diff_ext2softlink_src.h5 -text
+tools/h5diff/testfiles/h5diff_ext2softlink_trg.h5 -text
+tools/h5diff/testfiles/h5diff_extlink_src.h5 -text
+tools/h5diff/testfiles/h5diff_extlink_trg.h5 -text
+tools/h5diff/testfiles/h5diff_grp_recurse1.h5 -text
+tools/h5diff/testfiles/h5diff_grp_recurse2.h5 -text
+tools/h5diff/testfiles/h5diff_grp_recurse_ext1.h5 -text
+tools/h5diff/testfiles/h5diff_grp_recurse_ext2-1.h5 -text
+tools/h5diff/testfiles/h5diff_grp_recurse_ext2-2.h5 -text
+tools/h5diff/testfiles/h5diff_grp_recurse_ext2-3.h5 -text
+tools/h5diff/testfiles/h5diff_hyper1.h5 -text
+tools/h5diff/testfiles/h5diff_hyper2.h5 -text
+tools/h5diff/testfiles/h5diff_linked_softlink.h5 -text
+tools/h5diff/testfiles/h5diff_links.h5 -text
+tools/h5diff/testfiles/h5diff_softlinks.h5 -text
+tools/h5diff/testfiles/h5diff_types.h5 -text
+tools/h5diff/testfiles/h5diff_v1.txt -text
+tools/h5diff/testfiles/h5diff_v2.txt -text
+tools/h5diff/testfiles/h5diff_v3.txt -text
+tools/h5diff/testfiles/non_comparables1.h5 -text
+tools/h5diff/testfiles/non_comparables2.h5 -text
+tools/h5diff/testfiles/tmpSingleSiteBethe.output.h5 -text
+tools/h5diff/testfiles/tmpSingleSiteBethe.reference.h5 -text
+tools/h5diff/testfiles/tmptest.he5 -text
+tools/h5diff/testfiles/tmptest2.he5 -text
+tools/h5dump/errfiles/non_existing.err -text
+tools/h5format_convert/CMakeLists.txt -text
+tools/h5format_convert/CMakeTests.cmake -text
+tools/h5format_convert/Makefile.am -text
+tools/h5format_convert/h5fc_chk_idx.c -text
+tools/h5format_convert/h5fc_gentest.c -text
+tools/h5format_convert/h5format_convert.c -text
+tools/h5format_convert/testfiles/h5fc_d_file.ddl -text
+tools/h5format_convert/testfiles/h5fc_dname.ddl -text
+tools/h5format_convert/testfiles/h5fc_edge_v3.h5 -text
+tools/h5format_convert/testfiles/h5fc_err_level.h5 -text
+tools/h5format_convert/testfiles/h5fc_ext1_f.ddl -text
+tools/h5format_convert/testfiles/h5fc_ext1_f.h5 -text
+tools/h5format_convert/testfiles/h5fc_ext1_i.ddl -text
+tools/h5format_convert/testfiles/h5fc_ext1_i.h5 -text
+tools/h5format_convert/testfiles/h5fc_ext1_s.ddl -text
+tools/h5format_convert/testfiles/h5fc_ext1_s.h5 -text
+tools/h5format_convert/testfiles/h5fc_ext2_if.ddl -text
+tools/h5format_convert/testfiles/h5fc_ext2_if.h5 -text
+tools/h5format_convert/testfiles/h5fc_ext2_is.ddl -text
+tools/h5format_convert/testfiles/h5fc_ext2_is.h5 -text
+tools/h5format_convert/testfiles/h5fc_ext2_sf.ddl -text
+tools/h5format_convert/testfiles/h5fc_ext2_sf.h5 -text
+tools/h5format_convert/testfiles/h5fc_ext3_isf.ddl -text
+tools/h5format_convert/testfiles/h5fc_ext3_isf.h5 -text
+tools/h5format_convert/testfiles/h5fc_ext_none.h5 -text
+tools/h5format_convert/testfiles/h5fc_help.ddl -text
+tools/h5format_convert/testfiles/h5fc_non_v3.h5 -text
+tools/h5format_convert/testfiles/h5fc_nonexistdset_file.ddl -text
+tools/h5format_convert/testfiles/h5fc_nonexistfile.ddl -text
+tools/h5format_convert/testfiles/h5fc_nooption.ddl -text
+tools/h5format_convert/testfiles/h5fc_v_all.ddl -text
+tools/h5format_convert/testfiles/h5fc_v_bt1.ddl -text
+tools/h5format_convert/testfiles/h5fc_v_err.ddl -text
+tools/h5format_convert/testfiles/h5fc_v_n_1d.ddl -text
+tools/h5format_convert/testfiles/h5fc_v_n_all.ddl -text
+tools/h5format_convert/testfiles/h5fc_v_ndata_bt1.ddl -text
+tools/h5format_convert/testfiles/h5fc_v_non_chunked.ddl -text
+tools/h5format_convert/testfiles/old_h5fc_ext1_f.ddl -text
+tools/h5format_convert/testfiles/old_h5fc_ext1_f.h5 -text
+tools/h5format_convert/testfiles/old_h5fc_ext1_i.ddl -text
+tools/h5format_convert/testfiles/old_h5fc_ext1_i.h5 -text
+tools/h5format_convert/testfiles/old_h5fc_ext1_s.ddl -text
+tools/h5format_convert/testfiles/old_h5fc_ext1_s.h5 -text
+tools/h5format_convert/testfiles/old_h5fc_ext2_if.ddl -text
+tools/h5format_convert/testfiles/old_h5fc_ext2_if.h5 -text
+tools/h5format_convert/testfiles/old_h5fc_ext2_is.ddl -text
+tools/h5format_convert/testfiles/old_h5fc_ext2_is.h5 -text
+tools/h5format_convert/testfiles/old_h5fc_ext2_sf.ddl -text
+tools/h5format_convert/testfiles/old_h5fc_ext2_sf.h5 -text
+tools/h5format_convert/testfiles/old_h5fc_ext3_isf.ddl -text
+tools/h5format_convert/testfiles/old_h5fc_ext3_isf.h5 -text
+tools/h5format_convert/testfiles/old_h5fc_ext_none.h5 -text
+tools/h5format_convert/testh5fc.sh.in -text
+tools/h5import/testfiles/binfp64.h5 -text
+tools/h5import/testfiles/binin16.h5 -text
+tools/h5import/testfiles/binin32.h5 -text
+tools/h5import/testfiles/binin8.h5 -text
+tools/h5import/testfiles/binin8w.h5 -text
+tools/h5import/testfiles/binuin16.h5 -text
+tools/h5import/testfiles/binuin32.h5 -text
+tools/h5import/testfiles/textpfe.h5 -text
+tools/h5import/testfiles/txtfp32.h5 -text
+tools/h5import/testfiles/txtfp64.h5 -text
+tools/h5import/testfiles/txtin16.h5 -text
+tools/h5import/testfiles/txtin32.h5 -text
+tools/h5import/testfiles/txtin8.h5 -text
+tools/h5import/testfiles/txtstr.h5 -text
+tools/h5import/testfiles/txtuin16.h5 -text
+tools/h5import/testfiles/txtuin32.h5 -text
+tools/h5jam/testfiles/tall.h5 -text
+tools/h5jam/testfiles/twithub.h5 -text
+tools/h5jam/testfiles/twithub513.h5 -text
+tools/h5repack/testfiles/1_vds.h5-vds_dset_chunk20x10x5-v.ddl -text
+tools/h5repack/testfiles/2_vds.h5-vds_chunk3x6x9-v.ddl -text
+tools/h5repack/testfiles/3_1_vds.h5-vds_chunk2x5x8-v.ddl -text
+tools/h5repack/testfiles/4_vds.h5-vds_compa-v.ddl -text
+tools/h5repack/testfiles/4_vds.h5-vds_conti-v.ddl -text
+tools/h5repack/testfiles/README -text
+tools/h5repack/testfiles/h5repack_attr.h5 -text
+tools/h5repack/testfiles/h5repack_attr_refs.h5 -text
+tools/h5repack/testfiles/h5repack_deflate.h5 -text
+tools/h5repack/testfiles/h5repack_early.h5 -text
+tools/h5repack/testfiles/h5repack_ext.bin -text
+tools/h5repack/testfiles/h5repack_ext.h5 -text
+tools/h5repack/testfiles/h5repack_fill.h5 -text
+tools/h5repack/testfiles/h5repack_filters.h5 -text
+tools/h5repack/testfiles/h5repack_filters.h5-gzip_verbose_filters.tst -text
+tools/h5repack/testfiles/h5repack_fletcher.h5 -text
+tools/h5repack/testfiles/h5repack_hlink.h5 -text
+tools/h5repack/testfiles/h5repack_layout.UD.h5 -text svneol=unset#application/x-hdf
+tools/h5repack/testfiles/h5repack_layout.h5 -text
+tools/h5repack/testfiles/h5repack_layout.h5-dset2_chunk_20x10-errstk.tst -text
+tools/h5repack/testfiles/h5repack_layout.h5-plugin_zero.tst -text
+tools/h5repack/testfiles/h5repack_layout2.h5 -text
+tools/h5repack/testfiles/h5repack_layout3.h5 -text
+tools/h5repack/testfiles/h5repack_layouto.h5 -text
+tools/h5repack/testfiles/h5repack_named_dtypes.h5 -text
+tools/h5repack/testfiles/h5repack_nbit.h5 -text
+tools/h5repack/testfiles/h5repack_nested_8bit_enum.h5 -text
+tools/h5repack/testfiles/h5repack_nested_8bit_enum_deflated.h5 -text
+tools/h5repack/testfiles/h5repack_objs.h5 -text
+tools/h5repack/testfiles/h5repack_refs.h5 -text
+tools/h5repack/testfiles/h5repack_shuffle.h5 -text
+tools/h5repack/testfiles/h5repack_soffset.h5 -text
+tools/h5repack/testfiles/h5repack_szip.h5 -text
+tools/h5repack/testfiles/ublock.bin -text
+tools/h5stat/testfiles/h5stat_filters.h5 -text
+tools/h5stat/testfiles/h5stat_idx.ddl -text
+tools/h5stat/testfiles/h5stat_idx.h5 -text
+tools/h5stat/testfiles/h5stat_newgrat.h5 -text
+tools/h5stat/testfiles/h5stat_threshold.h5 -text
+tools/h5stat/testfiles/h5stat_tsohm.h5 -text
+tools/lib/h5tools_error.h svneol=native#text/plain
+tools/testfiles/charsets.h5 -text
+tools/testfiles/family_file00000.h5 -text
+tools/testfiles/family_file00001.h5 -text
+tools/testfiles/family_file00002.h5 -text
+tools/testfiles/family_file00003.h5 -text
+tools/testfiles/family_file00004.h5 -text
+tools/testfiles/family_file00005.h5 -text
+tools/testfiles/family_file00006.h5 -text
+tools/testfiles/family_file00007.h5 -text
+tools/testfiles/family_file00008.h5 -text
+tools/testfiles/family_file00009.h5 -text
+tools/testfiles/family_file00010.h5 -text
+tools/testfiles/family_file00011.h5 -text
+tools/testfiles/family_file00012.h5 -text
+tools/testfiles/family_file00013.h5 -text
+tools/testfiles/family_file00014.h5 -text
+tools/testfiles/family_file00015.h5 -text
+tools/testfiles/family_file00016.h5 -text
+tools/testfiles/family_file00017.h5 -text
+tools/testfiles/file_space.h5 -text
+tools/testfiles/filter_fail.h5 -text
+tools/testfiles/non_existing.ddl -text
+tools/testfiles/packedbits.h5 -text
+tools/testfiles/taindices.h5 -text
+tools/testfiles/tall.h5 -text
+tools/testfiles/tarray1.h5 -text
+tools/testfiles/tarray1_big.h5 -text
+tools/testfiles/tarray2.h5 -text
+tools/testfiles/tarray3.h5 -text
+tools/testfiles/tarray4.h5 -text
+tools/testfiles/tarray5.h5 -text
+tools/testfiles/tarray6.h5 -text
+tools/testfiles/tarray7.h5 -text
+tools/testfiles/tarray8.h5 -text
+tools/testfiles/tattr.h5 -text
+tools/testfiles/tattr2.h5 -text
+tools/testfiles/tattr4_be.h5 -text
+tools/testfiles/tattrintsize.h5 -text
+tools/testfiles/tattrreg.h5 -text
+tools/testfiles/tbigdims.h5 -text
+tools/testfiles/tbinary.h5 -text
+tools/testfiles/tbitfields.h5 -text
+tools/testfiles/tbitnopaque.ddl -text
+tools/testfiles/tbitnopaque.h5 -text svneol=unset#application/x-hdf
+tools/testfiles/tchar.h5 -text
+tools/testfiles/tcmpdattrintsize.h5 -text
+tools/testfiles/tcmpdintarray.h5 -text svneol=unset#application/x-hdf
+tools/testfiles/tcmpdints.h5 -text svneol=unset#application/x-hdf
+tools/testfiles/tcmpdintsize.h5 -text
+tools/testfiles/tcompound.h5 -text
+tools/testfiles/tcompound2.h5 -text
+tools/testfiles/tcompound_complex.h5 -text
+tools/testfiles/tcompound_complex2.ddl -text
+tools/testfiles/tcompound_complex2.h5 -text svneol=unset#application/x-hdf
+tools/testfiles/tdatareg.h5 -text
+tools/testfiles/tdset.h5 -text
+tools/testfiles/tdset2.h5 -text
+tools/testfiles/tdset_idx.h5 -text
+tools/testfiles/tdset_idx.ls -text
+tools/testfiles/tempty.h5 -text
+tools/testfiles/tenum.h5 -text
+tools/testfiles/textlink.h5 -text
+tools/testfiles/textlinkfar.h5 -text
+tools/testfiles/textlinksrc.h5 -text
+tools/testfiles/textlinktar.h5 -text
+tools/testfiles/tfamily00000.h5 -text
+tools/testfiles/tfamily00001.h5 -text
+tools/testfiles/tfamily00002.h5 -text
+tools/testfiles/tfamily00003.h5 -text
+tools/testfiles/tfamily00004.h5 -text
+tools/testfiles/tfamily00005.h5 -text
+tools/testfiles/tfamily00006.h5 -text
+tools/testfiles/tfamily00007.h5 -text
+tools/testfiles/tfamily00008.h5 -text
+tools/testfiles/tfamily00009.h5 -text
+tools/testfiles/tfamily00010.h5 -text
+tools/testfiles/tfcontents1.h5 -text
+tools/testfiles/tfcontents2.h5 -text
+tools/testfiles/tfilters.h5 -text
+tools/testfiles/tfpformat.h5 -text
+tools/testfiles/tfvalues.h5 -text
+tools/testfiles/tgroup.h5 -text
+tools/testfiles/tgrp_comments.h5 -text
+tools/testfiles/thlink.h5 -text
+tools/testfiles/thyperslab.h5 -text
+tools/testfiles/tints4dims.ddl -text
+tools/testfiles/tints4dims.h5 -text svneol=unset#application/x-hdf
+tools/testfiles/tints4dimsBlock2.ddl -text
+tools/testfiles/tints4dimsBlockEq.ddl -text
+tools/testfiles/tints4dimsCount2.ddl -text
+tools/testfiles/tints4dimsCountEq.ddl -text
+tools/testfiles/tints4dimsStride2.ddl -text
+tools/testfiles/tintsattrs.h5 -text svneol=unset#application/x-hdf
+tools/testfiles/tlarge_objname.h5 -text
+tools/testfiles/tldouble.h5 -text
+tools/testfiles/tlonglinks.h5 -text
+tools/testfiles/tloop.h5 -text
+tools/testfiles/tloop2.h5 -text
+tools/testfiles/tmany.h5 -text
+tools/testfiles/tmulti-b.h5 -text
+tools/testfiles/tmulti-g.h5 -text svneol=unset#application/octet-stream
+tools/testfiles/tmulti-l.h5 -text
+tools/testfiles/tmulti-o.h5 -text
+tools/testfiles/tmulti-r.h5 -text
+tools/testfiles/tmulti-s.h5 -text
+tools/testfiles/tname-amp.h5 -text
+tools/testfiles/tname-apos.h5 -text
+tools/testfiles/tname-gt.h5 -text
+tools/testfiles/tname-lt.h5 -text
+tools/testfiles/tname-quot.h5 -text
+tools/testfiles/tname-sp.h5 -text
+tools/testfiles/tnamed_dtype_attr.h5 -text
+tools/testfiles/tnestedcmpddt.h5 -text
+tools/testfiles/tnestedcomp.h5 -text
+tools/testfiles/tno-subset.h5 -text
+tools/testfiles/tnodata.h5 -text
+tools/testfiles/tnullspace.h5 -text
+tools/testfiles/tobjref.h5 -text
+tools/testfiles/topaque.h5 -text
+tools/testfiles/torderattr.h5 -text
+tools/testfiles/tordergr.h5 -text
+tools/testfiles/tref-escapes-at.h5 -text
+tools/testfiles/tref-escapes.h5 -text
+tools/testfiles/tref.h5 -text
+tools/testfiles/tsaf.h5 -text
+tools/testfiles/tscalarattrintsize.h5 -text
+tools/testfiles/tscalarintattrsize.h5 -text svneol=unset#application/x-hdf
+tools/testfiles/tscalarintsize.h5 -text
+tools/testfiles/tscalarstring.h5 -text
+tools/testfiles/tslink.h5 -text
+tools/testfiles/tsoftlinks.h5 -text
+tools/testfiles/tsplit_file-m.h5 -text
+tools/testfiles/tsplit_file-r.h5 -text
+tools/testfiles/tstr.h5 -text
+tools/testfiles/tstr2.h5 -text
+tools/testfiles/tstr3.h5 -text
+tools/testfiles/tstring-at.h5 -text
+tools/testfiles/tstring.ddl -text svneol=unset#application/octet-stream
+tools/testfiles/tstring.h5 -text
+tools/testfiles/tudlink.h5 -text
+tools/testfiles/tvldtypes1.h5 -text
+tools/testfiles/tvldtypes2.h5 -text
+tools/testfiles/tvldtypes3.h5 -text
+tools/testfiles/tvldtypes4.h5 -text
+tools/testfiles/tvldtypes5.h5 -text
+tools/testfiles/tvlenstr_array.ddl -text
+tools/testfiles/tvlenstr_array.h5 -text svneol=unset#application/x-hdf
+tools/testfiles/tvlstr.h5 -text
+tools/testfiles/tvms.h5 -text
+tools/testfiles/vds/1_a.h5 -text svneol=unset#application/x-hdf
+tools/testfiles/vds/1_b.h5 -text svneol=unset#application/x-hdf
+tools/testfiles/vds/1_c.h5 -text svneol=unset#application/x-hdf
+tools/testfiles/vds/1_d.h5 -text svneol=unset#application/x-hdf
+tools/testfiles/vds/1_e.h5 -text svneol=unset#application/x-hdf
+tools/testfiles/vds/1_f.h5 -text svneol=unset#application/x-hdf
+tools/testfiles/vds/1_vds.h5 -text svneol=unset#application/x-hdf
+tools/testfiles/vds/2_a.h5 -text svneol=unset#application/x-hdf
+tools/testfiles/vds/2_b.h5 -text svneol=unset#application/x-hdf
+tools/testfiles/vds/2_c.h5 -text svneol=unset#application/x-hdf
+tools/testfiles/vds/2_d.h5 -text svneol=unset#application/x-hdf
+tools/testfiles/vds/2_e.h5 -text svneol=unset#application/x-hdf
+tools/testfiles/vds/2_vds.h5 -text svneol=unset#application/x-hdf
+tools/testfiles/vds/3_1_vds.h5 -text svneol=unset#application/x-hdf
+tools/testfiles/vds/3_2_vds.h5 -text svneol=unset#application/x-hdf
+tools/testfiles/vds/4_0.h5 -text svneol=unset#application/x-hdf
+tools/testfiles/vds/4_1.h5 -text svneol=unset#application/x-hdf
+tools/testfiles/vds/4_2.h5 -text svneol=unset#application/x-hdf
+tools/testfiles/vds/4_vds.h5 -text svneol=unset#application/x-hdf
+tools/testfiles/vds/5_a.h5 -text svneol=unset#application/x-hdf
+tools/testfiles/vds/5_b.h5 -text svneol=unset#application/x-hdf
+tools/testfiles/vds/5_c.h5 -text svneol=unset#application/x-hdf
+tools/testfiles/vds/5_vds.h5 -text svneol=unset#application/x-hdf
+tools/testfiles/vds/a.h5 -text svneol=unset#application/x-hdf
+tools/testfiles/vds/b.h5 -text svneol=unset#application/x-hdf
+tools/testfiles/vds/c.h5 -text svneol=unset#application/x-hdf
+tools/testfiles/vds/d.h5 -text svneol=unset#application/x-hdf
+tools/testfiles/vds/f-0.h5 -text svneol=unset#application/x-hdf
+tools/testfiles/vds/f-3.h5 -text svneol=unset#application/x-hdf
+tools/testfiles/vds/vds-eiger.h5 -text svneol=unset#application/x-hdf
+tools/testfiles/vds/vds-first.ddl -text
+tools/testfiles/vds/vds-gap1.ddl -text
+tools/testfiles/vds/vds-gap2.ddl -text
+tools/testfiles/vds/vds-percival-unlim-maxmin.h5 -text svneol=unset#application/x-hdf
+tools/testfiles/vds/vds_layout-eiger.ddl -text
+tools/testfiles/vds/vds_layout-maxmin.ddl -text
+tools/testfiles/zerodim.h5 -text
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..1c4acc6
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,105 @@
+/Makefile.in
+/aclocal.m4
+/autom4te.cache
+bin/Makefile.in
+bin/compile
+bin/config.guess
+bin/config.sub
+bin/depcomp
+bin/install-sh
+bin/ltmain.sh
+bin/missing
+bin/test-driver
+/build*
+c++/Makefile.in
+c++/examples/Makefile.in
+c++/src/Makefile.in
+c++/src/header_files/Makefile.in
+c++/test/Makefile.in
+config/Makefile.in
+config/cmake/Makefile.in
+config/cmake/UserMacros/Makefile.in
+config/cmake/scripts/Makefile.in
+config/cmake_ext_mod/Makefile.in
+config/site-specific/Makefile.in
+/configure
+examples/Makefile.in
+fortran/Makefile.in
+fortran/examples/Makefile.in
+fortran/src/Makefile.in
+fortran/test/Makefile.in
+fortran/testpar/Makefile.in
+hl/Makefile.in
+hl/c++/Makefile.in
+hl/c++/examples/Makefile.in
+hl/c++/src/Makefile.in
+hl/c++/test/Makefile.in
+hl/examples/Makefile.in
+hl/fortran/Makefile.in
+hl/fortran/examples/Makefile.in
+hl/fortran/src/Makefile.in
+hl/fortran/test/Makefile.in
+hl/src/Makefile.in
+hl/test/Makefile.in
+hl/tools/Makefile.in
+hl/tools/gif2h5/Makefile.in
+hl/tools/gif2h5/testfiles/Makefile.in
+java/Makefile.in
+java/examples/Makefile.in
+java/examples/datasets/.classes
+java/examples/datasets/Makefile.in
+java/examples/datatypes/.classes
+java/examples/datatypes/Makefile.in
+java/examples/groups/.classes
+java/examples/groups/Makefile.in
+java/examples/intro/.classes
+java/examples/intro/Makefile.in
+java/src/.classes
+java/src/Makefile.in
+java/src/jni/Makefile.in
+java/test/.classes
+java/test/Makefile.in
+m4/Makefile.in
+m4/libtool.m4
+m4/ltoptions.m4
+m4/ltsugar.m4
+m4/ltversion.m4
+m4/lt~obsolete.m4
+release_docs/Makefile.in
+src/H5Edefin.h
+src/H5Einit.h
+src/H5Epubgen.h
+src/H5Eterm.h
+src/H5config.h.in
+src/H5overflow.h
+src/H5version.h
+src/Makefile.in
+test/Makefile.in
+test/testfiles/Makefile.in
+test/testfiles/plist_files/Makefile.in
+testpar/Makefile.in
+tools/Makefile.in
+tools/h5copy/Makefile.in
+tools/h5copy/testfiles/Makefile.in
+tools/h5diff/Makefile.in
+tools/h5diff/testfiles/Makefile.in
+tools/h5dump/Makefile.in
+tools/h5dump/errfiles/Makefile.in
+tools/h5format_convert/Makefile.in
+tools/h5import/Makefile.in
+tools/h5import/testfiles/Makefile.in
+tools/h5jam/Makefile.in
+tools/h5jam/testfiles/Makefile.in
+tools/h5ls/Makefile.in
+tools/h5repack/Makefile.in
+tools/h5repack/testfiles/Makefile.in
+tools/h5stat/Makefile.in
+tools/h5stat/testfiles/Makefile.in
+tools/lib/Makefile.in
+tools/misc/Makefile.in
+tools/misc/testfiles/Makefile.in
+tools/misc/vds/Makefile.in
+tools/perform/Makefile.in
+tools/testfiles/Makefile.in
+tools/testfiles/pbits/Makefile.in
+tools/testfiles/vds/Makefile.in
diff --git a/CMakeFilters.cmake b/CMakeFilters.cmake
index c2b81dc..bb0d238 100644
--- a/CMakeFilters.cmake
+++ b/CMakeFilters.cmake
@@ -1,12 +1,15 @@
include (ExternalProject)
-#option (HDF5_ALLOW_EXTERNAL_SUPPORT "Allow External Library Building (NO SVN TGZ)" "NO")
+#option (HDF5_ALLOW_EXTERNAL_SUPPORT "Allow External Library Building (NO GIT SVN TGZ)" "NO")
set (HDF5_ALLOW_EXTERNAL_SUPPORT "NO" CACHE STRING "Allow External Library Building (NO SVN TGZ)")
-set_property (CACHE HDF5_ALLOW_EXTERNAL_SUPPORT PROPERTY STRINGS NO SVN TGZ)
-if (HDF5_ALLOW_EXTERNAL_SUPPORT MATCHES "SVN" OR HDF5_ALLOW_EXTERNAL_SUPPORT MATCHES "TGZ")
+set_property (CACHE HDF5_ALLOW_EXTERNAL_SUPPORT PROPERTY STRINGS NO GIT SVN TGZ)
+if (HDF5_ALLOW_EXTERNAL_SUPPORT MATCHES "GIT" OR HDF5_ALLOW_EXTERNAL_SUPPORT MATCHES "SVN" OR HDF5_ALLOW_EXTERNAL_SUPPORT MATCHES "TGZ")
option (ZLIB_USE_EXTERNAL "Use External Library Building for ZLIB" 1)
option (SZIP_USE_EXTERNAL "Use External Library Building for SZIP" 1)
- if (HDF5_ALLOW_EXTERNAL_SUPPORT MATCHES "SVN")
+ if (HDF5_ALLOW_EXTERNAL_SUPPORT MATCHES "GIT")
+ set (ZLIB_URL ${ZLIB_GIT_URL} CACHE STRING "Path to zlib git repository")
+ set (SZIP_URL ${SZIP_GIT_URL} CACHE STRING "Path to szip git repository")
+ elseif (HDF5_ALLOW_EXTERNAL_SUPPORT MATCHES "SVN")
set (ZLIB_URL ${ZLIB_SVN_URL} CACHE STRING "Path to zlib Subversion repository")
set (SZIP_URL ${SZIP_SVN_URL} CACHE STRING "Path to szip Subversion repository")
elseif (HDF5_ALLOW_EXTERNAL_SUPPORT MATCHES "TGZ")
@@ -15,11 +18,11 @@ if (HDF5_ALLOW_EXTERNAL_SUPPORT MATCHES "SVN" OR HDF5_ALLOW_EXTERNAL_SUPPORT MAT
endif (NOT TGZPATH)
set (ZLIB_URL ${TGZPATH}/${ZLIB_TGZ_NAME})
set (SZIP_URL ${TGZPATH}/${SZIP_TGZ_NAME})
- else (HDF5_ALLOW_EXTERNAL_SUPPORT MATCHES "SVN")
+ else (HDF5_ALLOW_EXTERNAL_SUPPORT MATCHES "GIT")
set (ZLIB_USE_EXTERNAL 0)
set (SZIP_USE_EXTERNAL 0)
- endif (HDF5_ALLOW_EXTERNAL_SUPPORT MATCHES "SVN")
-endif (HDF5_ALLOW_EXTERNAL_SUPPORT MATCHES "SVN" OR HDF5_ALLOW_EXTERNAL_SUPPORT MATCHES "TGZ")
+ endif (HDF5_ALLOW_EXTERNAL_SUPPORT MATCHES "GIT")
+endif (HDF5_ALLOW_EXTERNAL_SUPPORT MATCHES "GIT" OR HDF5_ALLOW_EXTERNAL_SUPPORT MATCHES "SVN" OR HDF5_ALLOW_EXTERNAL_SUPPORT MATCHES "TGZ")
#-----------------------------------------------------------------------------
# Option for ZLib support
@@ -45,15 +48,15 @@ if (HDF5_ENABLE_Z_LIB_SUPPORT)
set (ZLIB_INCLUDE_DIR_GEN ${ZLIB_INCLUDE_DIR})
set (ZLIB_INCLUDE_DIRS ${ZLIB_INCLUDE_DIRS} ${ZLIB_INCLUDE_DIR})
else (ZLIB_FOUND)
- if (HDF5_ALLOW_EXTERNAL_SUPPORT MATCHES "SVN" OR HDF5_ALLOW_EXTERNAL_SUPPORT MATCHES "TGZ")
+ if (HDF5_ALLOW_EXTERNAL_SUPPORT MATCHES "GIT" OR HDF5_ALLOW_EXTERNAL_SUPPORT MATCHES "SVN" OR HDF5_ALLOW_EXTERNAL_SUPPORT MATCHES "TGZ")
EXTERNAL_ZLIB_LIBRARY (${HDF5_ALLOW_EXTERNAL_SUPPORT})
set (H5_HAVE_FILTER_DEFLATE 1)
set (H5_HAVE_ZLIB_H 1)
set (H5_HAVE_LIBZ 1)
message (STATUS "Filter ZLIB is built")
- else (HDF5_ALLOW_EXTERNAL_SUPPORT MATCHES "SVN" OR HDF5_ALLOW_EXTERNAL_SUPPORT MATCHES "TGZ")
+ else (HDF5_ALLOW_EXTERNAL_SUPPORT MATCHES "GIT" OR HDF5_ALLOW_EXTERNAL_SUPPORT MATCHES "SVN" OR HDF5_ALLOW_EXTERNAL_SUPPORT MATCHES "TGZ")
message (FATAL_ERROR " ZLib is Required for ZLib support in HDF5")
- endif (HDF5_ALLOW_EXTERNAL_SUPPORT MATCHES "SVN" OR HDF5_ALLOW_EXTERNAL_SUPPORT MATCHES "TGZ")
+ endif (HDF5_ALLOW_EXTERNAL_SUPPORT MATCHES "GIT" OR HDF5_ALLOW_EXTERNAL_SUPPORT MATCHES "SVN" OR HDF5_ALLOW_EXTERNAL_SUPPORT MATCHES "TGZ")
endif (ZLIB_FOUND)
else (NOT H5_ZLIB_HEADER)
# This project is being called from within another and ZLib is already configured
@@ -64,9 +67,9 @@ if (HDF5_ENABLE_Z_LIB_SUPPORT)
if (H5_HAVE_FILTER_DEFLATE)
set (EXTERNAL_FILTERS "${EXTERNAL_FILTERS} DEFLATE")
endif (H5_HAVE_FILTER_DEFLATE)
- if (BUILD_SHARED_LIBS)
+ if (BUILD_SHARED_LIBS)
set (LINK_SHARED_LIBS ${LINK_SHARED_LIBS} ${ZLIB_SHARED_LIBRARY})
- endif (BUILD_SHARED_LIBS)
+ endif (BUILD_SHARED_LIBS)
set (LINK_LIBS ${LINK_LIBS} ${ZLIB_STATIC_LIBRARY})
INCLUDE_DIRECTORIES (${ZLIB_INCLUDE_DIRS})
message (STATUS "Filter ZLIB is ON")
@@ -95,19 +98,19 @@ if (HDF5_ENABLE_SZIP_SUPPORT)
set (SZIP_INCLUDE_DIR_GEN ${SZIP_INCLUDE_DIR})
set (SZIP_INCLUDE_DIRS ${SZIP_INCLUDE_DIRS} ${SZIP_INCLUDE_DIR})
else (SZIP_FOUND)
- if (HDF5_ALLOW_EXTERNAL_SUPPORT MATCHES "SVN" OR HDF5_ALLOW_EXTERNAL_SUPPORT MATCHES "TGZ")
+ if (HDF5_ALLOW_EXTERNAL_SUPPORT MATCHES "GIT" OR HDF5_ALLOW_EXTERNAL_SUPPORT MATCHES "SVN" OR HDF5_ALLOW_EXTERNAL_SUPPORT MATCHES "TGZ")
EXTERNAL_SZIP_LIBRARY (${HDF5_ALLOW_EXTERNAL_SUPPORT} ${HDF5_ENABLE_SZIP_ENCODING})
set (H5_HAVE_FILTER_SZIP 1)
set (H5_HAVE_SZLIB_H 1)
set (H5_HAVE_LIBSZ 1)
message (STATUS "Filter SZIP is built")
- else (HDF5_ALLOW_EXTERNAL_SUPPORT MATCHES "SVN" OR HDF5_ALLOW_EXTERNAL_SUPPORT MATCHES "TGZ")
+ else (HDF5_ALLOW_EXTERNAL_SUPPORT MATCHES "GIT" OR HDF5_ALLOW_EXTERNAL_SUPPORT MATCHES "SVN" OR HDF5_ALLOW_EXTERNAL_SUPPORT MATCHES "TGZ")
message (FATAL_ERROR "SZIP is Required for SZIP support in HDF5")
- endif (HDF5_ALLOW_EXTERNAL_SUPPORT MATCHES "SVN" OR HDF5_ALLOW_EXTERNAL_SUPPORT MATCHES "TGZ")
+ endif (HDF5_ALLOW_EXTERNAL_SUPPORT MATCHES "GIT" OR HDF5_ALLOW_EXTERNAL_SUPPORT MATCHES "SVN" OR HDF5_ALLOW_EXTERNAL_SUPPORT MATCHES "TGZ")
endif (SZIP_FOUND)
- if (BUILD_SHARED_LIBS)
+ if (BUILD_SHARED_LIBS)
set (LINK_SHARED_LIBS ${LINK_SHARED_LIBS} ${SZIP_SHARED_LIBRARY})
- endif (BUILD_SHARED_LIBS)
+ endif (BUILD_SHARED_LIBS)
set (LINK_LIBS ${LINK_LIBS} ${SZIP_STATIC_LIBRARY})
INCLUDE_DIRECTORIES (${SZIP_INCLUDE_DIRS})
message (STATUS "Filter SZIP is ON")
diff --git a/CTestConfig.cmake b/CTestConfig.cmake
index 36bf4a0..45fa7d5 100644
--- a/CTestConfig.cmake
+++ b/CTestConfig.cmake
@@ -9,7 +9,7 @@ set (CTEST_NIGHTLY_START_TIME "18:00:00 CST")
set (CTEST_DROP_METHOD "http")
if (CDASH_LOCAL)
- set (CTEST_DROP_SITE "10.10.10.82")
+ set (CTEST_DROP_SITE "cdash-internal.hdfgroup.org")
set (CTEST_DROP_LOCATION "/submit.php?project=HDF5Trunk")
else (CDASH_LOCAL)
set (CTEST_DROP_SITE "cdash.hdfgroup.org")
diff --git a/MANIFEST b/MANIFEST
index 13596d0..fb454c5 100644
--- a/MANIFEST
+++ b/MANIFEST
@@ -20,7 +20,9 @@
# in column one with a '#'.
#------------------------------------------------------------------------------
-./.autom4te.cfg _DO_NOT_DISTRIBUTE_
+./.gitattributes _DO_NOT_DISTRIBUTE_
+./.gitignore _DO_NOT_DISTRIBUTE_
+./.autom4te.cfg _DO_NOT_DISTRIBUTE_
./.h5chkright.ini _DO_NOT_DISTRIBUTE_
./ACKNOWLEDGMENTS
./COPYING
@@ -34,6 +36,7 @@
./m4/aclocal_cxx.m4
./m4/aclocal_fc.m4
+./m4/aclocal_fc.f90
./m4/ax_check_class.m4
./m4/ax_check_classpath.m4
./m4/ax_check_java_home.m4
@@ -88,6 +91,10 @@
./bin/timekeeper _DO_NOT_DISTRIBUTE_
./bin/trace
./bin/yodconfigure
+./bin/pkgscrpts/h5rmflags _DO_NOT_DISTRIBUTE_
+./bin/pkgscrpts/makeHDF5BinaryTarfiles.pl _DO_NOT_DISTRIBUTE_
+./bin/pkgscrpts/makeInternalREADME.pl _DO_NOT_DISTRIBUTE_
+./bin/pkgscrpts/makeOuterREADME.pl _DO_NOT_DISTRIBUTE_
./config/COPYING
./config/BlankForm
@@ -102,8 +109,7 @@
./config/gnu-cxxflags
./config/gnu-fflags
./config/gnu-flags
-./config/i386-pc-cygwin32
-./config/i686-pc-cygwin
+./config/cygwin
./config/ibm-aix
./config/ibm-flags
./config/intel-fflags
@@ -117,7 +123,6 @@
./config/pgi-fflags
./config/pgi-flags
./config/solaris
-./config/x86_64-pc-cygwin
./config/site-specific/BlankForm
@@ -895,6 +900,7 @@
./test/dynlib1.c
./test/dynlib2.c
./test/dynlib3.c
+./test/dynlib4.c
./test/earray.c
./test/efc.c
./test/enc_dec_plist.c
@@ -1540,6 +1546,8 @@
./tools/testfiles/tcompound.h5
./tools/testfiles/tcompound2.h5
./tools/testfiles/tcompound_complex.h5
+./tools/testfiles/tcompound_complex2.h5
+./tools/testfiles/tcompound_complex2.ddl
./tools/testfiles/tdatareg.h5
./tools/testfiles/tdatareg.ddl
./tools/testfiles/tdataregR.ddl
@@ -1709,6 +1717,8 @@
./tools/testfiles/tvldtypes4.h5
./tools/testfiles/tvldtypes5.ddl
./tools/testfiles/tvldtypes5.h5
+./tools/testfiles/tvlenstr_array.ddl
+./tools/testfiles/tvlenstr_array.h5
./tools/testfiles/tvlstr.h5
./tools/testfiles/tvlstr.ddl
./tools/testfiles/tvms.ddl
@@ -2303,6 +2313,7 @@
./tools/h5repack/testfiles/h5repack_layout.h5.ddl
./tools/h5repack/testfiles/h5repack_layout.UD.h5-plugin_none.ddl
./tools/h5repack/testfiles/h5repack_layout.h5-plugin_test.ddl
+./tools/h5repack/testfiles/h5repack_layout.h5-plugin_zero.tst
./tools/h5repack/testfiles/1_vds.h5-vds_dset_chunk20x10x5-v.ddl
./tools/h5repack/testfiles/2_vds.h5-vds_chunk3x6x9-v.ddl
./tools/h5repack/testfiles/3_1_vds.h5-vds_chunk2x5x8-v.ddl
diff --git a/bin/bbrelease b/bin/bbrelease
index cb79528..c5d562e 100755
--- a/bin/bbrelease
+++ b/bin/bbrelease
@@ -33,6 +33,15 @@
#
# James Laird, 2005-09-07
# Added the md5 method.
+#
+# Larry Knox, 2016-08-30
+# Added the --revision option to create private releases with the
+# code revision hash in the version strings. Currently the version
+# of this script with the --revision option is named bbrelease. It
+# can probably be merged into the original release script in the
+# future.
+# Commands to get the revision hash have now been converted to git
+# to match the source repository change.
# Function definitions
#
@@ -265,17 +274,18 @@ fi
if [ X$revmode = Xyes ]; then
VERS_OLD=$VERS
+ echo "Save old version $VERS_OLD for restoration later."
# Copy old version of config/lt_vers.am, since it's hard to
# "undo" changes to it.
cp config/lt_vers.am $tmpdir
- branch=`svn info | grep ^URL: | awk -F/ '{print $NF}'`
- revision=`svn info | grep "Revision:" | awk '{print $2}'`
- # Set version information to m.n.r-r$revision.
+ branch=`git branch | grep '*' | awk '{print $NF}'`
+ revision=`git rev-parse --short HEAD`
+# Set version information to m.n.r-r$revision.
# (h5vers does not correctly handle just m.n.r-$today.)
- VERS=`echo $VERS | sed -e s/-.*//`-r$revision
+ VERS=`echo $VERS | sed -e s/-.*//`-$revision
echo Private release of $VERS
bin/h5vers -s $VERS
- HDF5_VERS=hdf5-$branch-r$revision
+ HDF5_VERS=hdf5-$branch-$revision
# use a generic directory name for revision releases
HDF5_IN_VERS=hdfsrc
else
@@ -392,6 +402,7 @@ test -f $tmpdir/Makefile.x && mv $tmpdir/Makefile.x Makefile
# Restore OLD version information, then no need for trap.
if [ X$pmode = Xyes ] || [ X$revmode = Xyes ]; then
+ echo "Restore the original version $VERS_OLD"
RESTORE_VERSION
trap 0
fi
diff --git a/bin/chkmanifest b/bin/chkmanifest
index 701b6c4..a0b51af 100755
--- a/bin/chkmanifest
+++ b/bin/chkmanifest
@@ -54,8 +54,8 @@ fi
# Do an autogen if generated files (e.g., configure) is not present
if [ ! -f configure ]; then
- echo " running $AUTOGEN -p"
- $AUTOGEN -p > $AUTOGEN_LOG 2>&1
+ echo " running $AUTOGEN"
+ $AUTOGEN > $AUTOGEN_LOG 2>&1
if [ $? -ne 0 ]; then
echo $AUTOGEN encountered error. Abort.
echo output from $AUTOGEN:
@@ -93,23 +93,23 @@ done
# Get the list of files under version control and check that they are
# present.
#
-# First get a list of all the pending files with svn stat and
+# First get a list of all the pending files with git status and
# check those.
-svn_stat=`svn stat -q`
-for file in $svn_stat; do
+git_stat=`git status -s`
+for file in $git_stat; do
- # Newly added files are not listed by svn ls, which
+ # Newly added files are not listed by git ls-files, which
# we check later.
# The line listing new files starts with 'A'.
letter=`echo $file | head -c 1`
if [ "$letter" = "A" ]; then
- # Convert the seven Subversion status columns to './' so it matches
+ # Convert the git status columns to './' so it matches
# the manifest file name.
#
# There is a space between the status columns and file name, hence
- # the '8' instead of '7'.
- path=`echo $file | sed 's/^.\{8\}/\.\//g'`
+ # the '3'.
+ path=`echo $file | sed 's/^.\{3\}/\.\//g'`
# Ignore directories
if [ ! -d $path ]; then
if (grep ^$path$ $MANIFEST >/dev/null); then
@@ -122,10 +122,10 @@ for file in $svn_stat; do
fi
done
-# Next check svn ls, which gets a list of all files that are
+# Next check git ls-files, which gets a list of all files that are
# checked in.
-svn_ls=`svn ls -R`
-for file in $svn_ls; do
+git_ls=`git ls-files`
+for file in $git_ls; do
path="./${file}"
# Ignore directories
if [ ! -d $path ]; then
diff --git a/bin/h5vers b/bin/h5vers
index e9df387..9babf97 100755
--- a/bin/h5vers
+++ b/bin/h5vers
@@ -381,12 +381,12 @@ sub gen_configure {
$conf =~ /^(.*?)\/?configure.ac$/;
if ($1) {
- $rc = system("cd $1 && ./autogen.sh -p >/dev/null 2>/dev/null && rm -rf autom4te.cache");
+ $rc = system("cd $1 && ./autogen.sh >/dev/null 2>/dev/null && rm -rf autom4te.cache");
} else {
- $rc = system("./autogen.sh -p >/dev/null 2>/dev/null && rm -rf autom4te.cache");
+ $rc = system("./autogen.sh >/dev/null 2>/dev/null && rm -rf autom4te.cache");
}
if ($rc) {
- printf("./autogen.sh -p failed with exit code %d. Aborted.\n", $rc);
+ printf("./autogen.sh failed with exit code %d. Aborted.\n", $rc);
exit 1;
}
}
diff --git a/bin/pkgscrpts/h5rmflags b/bin/pkgscrpts/h5rmflags
new file mode 100755
index 0000000..32b8090
--- /dev/null
+++ b/bin/pkgscrpts/h5rmflags
@@ -0,0 +1,167 @@
+#! /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 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.
+#
+
+## Remove paths to libraries used to build HDF5 when packaging HDF5
+## binaries.
+## For help page, use "h5rmflags -help"
+
+# Constants definitions
+EXIT_SUCCESS=0
+EXIT_FAILURE=1
+
+# Function definitions
+
+# show help page
+usage() {
+ # A wonderfully informative "usage" message.
+ echo "usage: $prog_name [OPTIONS]"
+ echo " OPTIONS:"
+ echo " -help|help This help message"
+ echo " -echo Show all the shell commands executed"
+ echo " -force No prompt, just do it"
+ echo " -prefix=DIR New directory to find HDF5 lib/ and include/"
+ echo " subdirectories [default: current directory]"
+ echo " -tool=TOOL Tool to update. TOOL must be in the current"
+ echo " directory and writable. [default: $h5tools]"
+ echo " -show Show the commands without executing them"
+ echo " "
+ exit $EXIT_FAILURE
+}
+
+# display variable values
+dump_vars(){
+ echo "====Showing all variable values====="
+ echo prefix=$prefix
+ echo h5tools=$h5tools
+ echo "====End Showing====="
+}
+
+# show actions to be taken
+show_action()
+{
+ echo "Update the following tools because they are now installed at a new directory"
+ for t in $foundtools; do
+ echo "${t}:"
+ echo " current setting=`sed -e '/^prefix=/s/prefix=//p' -e d $t`"
+ echo " new setting="\""$prefix"\"
+ done
+}
+
+
+# Report Error message
+ERROR()
+{
+ echo "***ERROR***"
+ echo "$1"
+}
+
+# Main
+#
+# Initialization
+h5tools="h5cc h5pcc h5fc h5pfc h5c++" # possible hdf5 tools
+foundtools= # tools found and will be modified
+fmode= # force mode, default is off
+prefix=`(cd ..;pwd)`
+
+# Parse options
+for arg in $@ ; do
+ case "$arg" in
+ -prefix=*)
+ prefix="`expr "$arg" : '-prefix=\(.*\)'`"
+ ;;
+ -echo)
+ set -x
+ ;;
+ -show)
+ SHOW="echo"
+ ;;
+ -tool=*)
+ h5tools="`expr "$arg" : '-tool=\(.*\)'`"
+ ;;
+ -help|help)
+ usage
+ ;;
+ -force)
+ fmode=yes
+ ;;
+ *)
+ ERROR "Unknown Option($arg)"
+ usage
+ exit $EXIT_FAILURE
+ ;;
+ esac
+done
+
+# Sanity checks
+#if [ ! -d $prefix ]; then
+# ERROR "prefix($prefix) is not an existing directory"
+# exit $EXIT_FAILURE
+#fi
+
+for x in $h5tools; do
+ if [ -f $x ]; then
+ foundtools="$foundtools $x"
+ if [ ! -w $x ]; then
+ ERROR "h5tool($x) is not writable"
+ exit $EXIT_FAILURE
+ fi
+ fi
+done
+
+if [ -z "$foundtools" ]; then
+ ERROR "found no tools to modify"
+ exit $EXIT_FAILURE
+fi
+
+# Show actions to be taken and get consent
+show_action
+
+
+# Update them
+if [ "$SHOW" = "echo" ]; then
+ echo "===Update commands are:===="
+# cat $CMDFILE
+ echo "===End Update commands====="
+fi
+
+for t in $foundtools; do
+ echo Update $t ...
+# COMMAND="ed - $t"
+# if [ "$SHOW" = "echo" ]; then
+# echo $COMMAND
+# else
+# $COMMAND < $CMDFILE
+ ed - $t << end
+ g/^H5BLD_CPPFLAGS/s/-I\/.*include //g
+ g/^H5BLD_LDFLAGS/s/-L\/.*lib //g
+ g/^H5BLD_LDFLAGS/s/-L\/.*lib64 //g
+ .
+ w
+end
+# fi
+done
+
+
+# Cleanup
+#rm -f $CMDFILE
+exit $EXIT_SUCCESS
+
+# Some possible future features to add
+# CCBASE - Name of the alternative C compiler
+# CLINKERBASE - Name of the alternative linker
+# LDFLAGS - Path to different libraries your application will link with
+# (this path should include the path to the zlib library)
+# LIBS - Libraries your application will link with
diff --git a/bin/pkgscrpts/makeHDF5BinaryTarfiles.pl b/bin/pkgscrpts/makeHDF5BinaryTarfiles.pl
new file mode 100755
index 0000000..32b3049
--- /dev/null
+++ b/bin/pkgscrpts/makeHDF5BinaryTarfiles.pl
@@ -0,0 +1,368 @@
+#!/usr/bin/perl
+# makeTarFiles.pl
+
+# 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 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.
+#
+#
+#
+use warnings;
+use strict;
+use Cwd;
+use File::Basename;
+
+
+my %destsubdir = ('emu' => 'sunos-5.11-sparc-32-sunc512',
+ 'emu64' => 'sunos-5.11-sparc-64-sunc512',
+ 'ostrich' => 'linux-el6-ppc64-gcc447',
+ 'ostrichxl' => 'linux-el6-ppc64-xl13.1',
+ 'platypus' => 'linux-centos6-x86_64-gcc447',
+ 'platypus32' => 'linux-centos6-x86_64-32-gcc447',
+ 'moohan' => 'linux-centos7-x86_64-gcc485',
+ 'moohan32' => 'linux-centos7-x86_64-32-gcc485',
+ 'kite' => 'osx-10.8-x86_64-clang5.1',
+ 'quail' => 'osx-10.9-x86_64-clang6.0',
+ 'osx1010test' => 'osx-10.10-x86_64-clang6.0');
+
+my %szipdir = ('emu' => '/mnt/hdf/packages/szip/shared/encoder/SunOS-5.10',
+ 'emu-static' => '/mnt/hdf/packages/szip/static/encoder/SunOS-5.10',
+ 'emu64' => '/mnt/hdf/packages/szip-PIC/shared/encoder/SunOS-5.11-64',
+ 'emu64-static' => '/mnt/hdf/packages/szip-PIC/shared/encoder/SunOS-5.11-64',
+ 'kite' => '/mnt/hdf/packages/szip/shared/encoder/MacOS-10.8',
+ 'kite-static' => '/mnt/hdf/packages/szip-PIC/static/encoder/MacOS-10.8',
+ 'ostrich32' => '/mnt/hdf/packages/szip/shared/encoder/Linux2.6-ppc64-gcc',
+ 'ostrich32-static' => '/mnt/hdf/packages/szip/static/encoder/Linux2.6-ibmppc64-gcc-32',
+ 'ostrich' => '/mnt/hdf/packages/szip/shared/encoder/Linux2.6-ppc64-gcc-64',
+ 'ostrich-static' => '/mnt/hdf/packages/szip/static/encoder/Linux2.6-ibmppc64-gcc',
+ 'ostrichxl' => '/mnt/hdf/packages/szip/shared/encoder/Linux2.6-ppc64-gcc-64',
+ 'ostrichxl-static' => '/mnt/hdf/packages/szip/static/encoder/Linux2.6-ibmppc64-gcc',
+ 'osx1010test' => '/mnt/hdf/packages/szip/shared/encoder/MacOS-10.8',
+ 'osx1010test-static' => '/mnt/hdf/packages/szip-PIC/static/encoder/MacOS-10.8',
+ 'moohan' => '/mnt/hdf/packages/szip/shared/encoder/Linux2.6-x86_64-gcc',
+ 'moohan-static' => '/mnt/hdf/packages/szip/static/encoder/Linux2.6-x86_64-gcc',
+ 'moohan32' => '/mnt/hdf/packages/szip/shared/encoder/Linux2.6-x86_64-gcc-m32',
+ 'moohan32-static' => '/mnt/hdf/packages/szip-PIC/static/encoder/Linux2.6-x86_64-gcc-m32',
+ 'platypus32' => '/mnt/hdf/packages/szip/shared/encoder/Linux2.6-x86_64-gcc-m32',
+ 'platypus32-static' => '/mnt/hdf/packages/szip-PIC/static/encoder/Linux2.6-x86_64-gcc-m32',
+ 'platypus' => '/mnt/hdf/packages/szip/shared/encoder/Linux2.6-x86_64-gcc',
+ 'platypus-static' => '/mnt/hdf/packages/szip/static/encoder/Linux2.6-x86_64-gcc',
+ 'quail' => '/mnt/hdf/packages/szip/shared/encoder/MacOS-10.8',
+ 'quail-static' => '/mnt/hdf/packages/szip-PIC/static/encoder/MacOS-10.8');
+
+my %zlibdir = ('emu' => '/mnt/hdf/packages/zlib-125/shared/SunOS-5.10',
+ 'emu-static' => '/mnt/hdf/packages/zlib-125/static/SunOS-5.10',
+ 'emu64' => '/mnt/hdf/packages/zlib-123-PIC/SunOS-5.11-64',
+ 'emu64-static' => '/mnt/hdf/packages/zlib-123-PIC/SunOS-5.11-64',
+ 'kite' => ' /mnt/hdf/packages/zlib-125/shared/mac-intel-x86_64',
+ 'kite-static' => ' /mnt/hdf/packages/zlib-125/static/mac-intel-x86_64',
+ 'ostrich32' => '/mnt/hdf/packages/zlib-125/PIC/Linux2.6-ppc64-gcc',
+ 'ostrich32-static' => '/mnt/hdf/packages/zlib-125/PIC/Linux2.6-ppc64-gcc',
+ 'ostrich' => '/mnt/hdf/packages/zlib-125/PIC/Linux2.6-ppc64-gcc-64',
+ 'ostrich-static' => '/mnt/hdf/packages/zlib-125/PIC/Linux2.6-ppc64-gcc-64',
+ 'ostrichxl' => '/mnt/hdf/packages/zlib-125/PIC/Linux2.6-ppc64-gcc-64',
+ 'ostrichxl-static' => '/mnt/hdf/packages/zlib-125/PIC/Linux2.6-ppc64-gcc-64',
+ 'osx1010test' => ' /mnt/hdf/packages/zlib-125/shared/mac-intel-x86_64',
+ 'osx1010test-static' => ' /mnt/hdf/packages/zlib-125/static/mac-intel-x86_64',
+ 'moohan' => '/mnt/hdf/packages/zlib-125/shared/Linux2.6-x86_64-gcc',
+ 'moohan-static' => '/mnt/hdf/packages/zlib-125/static/Linux2.6-x86_64-gcc',
+ 'moohan32' => '/mnt/hdf/packages/zlib-128/Linux2.6-x86_64-gcc-m32',
+ 'moohan32-static' => '/mnt/hdf/packages/zlib-128/Linux2.6-x86_64-gcc-m32',
+ 'platypus32' => '/mnt/hdf/packages/zlib-128/Linux2.6-x86_64-gcc-m32',
+ 'platypus32-static' => '/mnt/hdf/packages/zlib-128/Linux2.6-x86_64-gcc-m32',
+ 'platypus' => '/mnt/hdf/packages/zlib-125/shared/Linux2.6-x86_64-gcc',
+ 'platypus-static' => '/mnt/hdf/packages/zlib-125/static/Linux2.6-x86_64-gcc',
+ 'quail' => ' /mnt/hdf/packages/zlib-125/shared/mac-intel-x86_64',
+ 'quail-static' => ' /mnt/hdf/packages/zlib-125/static/mac-intel-x86_64');
+
+my $indirectory = ".";
+$indirectory = shift;
+
+my $outdirectory = ".";
+$outdirectory = shift;
+
+my $key = ".";
+#$key = shift;
+
+my $scriptdirname = dirname(__FILE__);
+
+unless (-d $outdirectory) {
+ print "$outdirectory not found. Create it or choose another one and try again.\n";
+ exit 1;
+}
+
+print "Subdirectories of $indirectory will be tarred and stored in $outdirectory.\n";
+
+
+my $tarfilename;
+my $tardirname;
+my $output;
+my $cmd;
+
+# I'm currently copying system zlibs for at least solaris and FreeBSD machines. Since this script runs on jam it may require scp to get the libs.
+
+#For future reference
+# command for getting szlib files and links for shared binaries:
+# tar cvf - -C <szipDir>/lib . | tar xvf - -C <libdir> .
+# libz.so.1.2.3 and the static files should just be copied because they're in directories
+# with other files. Then create the libz.so.1 and libz.so symbolic links.
+sub addzandszlibs {
+ my $dir = shift;
+ my $indirectory = shift;
+ my $currentdir = getcwd();
+
+ if (-d "$indirectory/$dir" ) {
+ my $szdir = $szipdir{$dir};
+ my $zldir = $zlibdir{$dir};
+ if ($dir =~ /static/ || $dir =~ /ostrich/) {
+ $cmd = "cp $szdir/lib/libsz.a $indirectory/$dir/lib";
+ $output = `$cmd`;
+ print $output;
+ $cmd = "cp $zldir/lib/libz.a $indirectory/$dir/lib";
+ $output = `$cmd`;
+ print $output;
+ } elsif ($dir eq "freedom" || $dir eq "loyalty") {
+ $cmd = "cp $szdir/lib/libsz.so.2 $indirectory/$dir/lib";
+ $output = `$cmd`;
+ print $output;
+ $cmd = "cp $zldir/lib/libz.so.5 $indirectory/$dir/lib";
+ $output = `$cmd`;
+ print $output;
+
+ chdir "$indirectory/$dir/lib" or die "Couldn't change directory to $indirectory/$dir/lib, $!";
+ $cmd = "ln -s libsz.so.2 libsz.so";
+ $output = `$cmd`;
+ print $output;
+
+ $cmd = "ln -s libz.so.5 libz.so";
+ $output = `$cmd`;
+ print $output;
+
+ chdir $currentdir or die "Couldn't change directory back to $currentdir, $!";
+ } elsif ($dir eq "quail" || $dir eq "kite" || $dir eq "osx1010test") {
+ #we've been using the static libraries for the macs - built with -fPIC
+# $cmd = "cp $szdir/lib/libsz.a $indirectory/$dir/lib";
+# $output = `$cmd`;
+# print $output;
+# $cmd = "cp $zldir/lib/libz.a $indirectory/$dir/lib";
+# $output = `$cmd`;
+# print $output;
+ $cmd = "cp $szdir/lib/libsz.2.0.0.dylib $indirectory/$dir/lib";
+ $output = `$cmd`;
+ print $output;
+ $cmd = "cp $zldir/lib/libz.1.2.5.dylib $indirectory/$dir/lib";
+ $output = `$cmd`;
+ print $output;
+
+ chdir "$indirectory/$dir/lib" or die "Couldn't change directory to $indirectory/$dir/lib, $!";
+ $cmd = "ln -s libsz.2.0.0.dylib libsz.2.dylib";
+ $output = `$cmd`;
+ print $output;
+
+ $cmd = "ln -s libsz.2.0.0.dylib libsz.dylib";
+ $output = `$cmd`;
+ print $output;
+
+ $cmd = "ln -s libz.1.2.5.dylib libz.1.dylib";
+ $output = `$cmd`;
+ print $output;
+
+ $cmd = "ln -s libz.1.2.5.dylib libz.dylib";
+ $output = `$cmd`;
+ print $output;
+
+ chdir $currentdir or die "Couldn't change directory back to $currentdir, $!";
+
+ } elsif ($dir eq "emu64") {
+ $cmd = "cp $szdir/lib/libsz.so.2.0.0 $indirectory/$dir/lib";
+ $output = `$cmd`;
+ print $output;
+ $cmd = "cp $zldir/lib/libz.a $indirectory/$dir/lib";
+ $output = `$cmd`;
+ print $output;
+
+ chdir "$indirectory/$dir/lib" or die "Couldn't change directory to $indirectory/$dir/lib, $!";
+ $cmd = "ln -s libsz.so.2.0.0 libsz.so.2";
+ $output = `$cmd`;
+ print $output;
+
+ $cmd = "ln -s libsz.so.2.0.0 libsz.so";
+ $output = `$cmd`;
+ print $output;
+
+ chdir $currentdir or die "Couldn't change directory back to $currentdir, $!";
+
+ } elsif ($dir eq "platypus32" || $dir eq "moohan32") {
+ $cmd = "cp $szdir/lib/libsz.so.2.0.0 $indirectory/$dir/lib";
+ $output = `$cmd`;
+ print $output;
+
+ # $cmd = "cp $zldir/lib/libz.a $indirectory/$dir/lib";
+ # $output = `$cmd`;
+ # print $output;
+
+ chdir "$indirectory/$dir/lib" or die "Couldn't change directory to $indirectory/$dir/lib, $!";
+ $cmd = "ln -s libsz.so.2.0.0 libsz.so.2";
+ $output = `$cmd`;
+ print $output;
+
+ $cmd = "ln -s libsz.so.2.0.0 libsz.so";
+ $output = `$cmd`;
+ print $output;
+
+ # $cmd = "ln -s libz.so.1.2.8 libz.so.1";
+ # $output = `$cmd`;
+ # print $output;
+
+ # $cmd = "ln -s libz.so.1.2.8 libz.so";
+ # $output = `$cmd`;
+ # print $output;
+
+ chdir $currentdir or die "Couldn't change directory back to $currentdir, $!";
+
+ } else {
+ $cmd = "cp $szdir/lib/libsz.so.2.0.0 $indirectory/$dir/lib";
+ $output = `$cmd`;
+ print $output;
+
+ $cmd = "cp $zldir/lib/libz.so.1.2.5 $indirectory/$dir/lib";
+ $output = `$cmd`;
+ print $output;
+
+ chdir "$indirectory/$dir/lib" or die "Couldn't change directory to $indirectory/$dir/lib, $!";
+ $cmd = "ln -s libsz.so.2.0.0 libsz.so.2";
+ $output = `$cmd`;
+ print $output;
+
+ $cmd = "ln -s libsz.so.2.0.0 libsz.so";
+ $output = `$cmd`;
+ print $output;
+
+ $cmd = "ln -s libz.so.1.2.5 libz.so.1";
+ $output = `$cmd`;
+ print $output;
+
+ $cmd = "ln -s libz.so.1.2.5 libz.so";
+ $output = `$cmd`;
+ print $output;
+
+ chdir $currentdir or die "Couldn't change directory back to $currentdir, $!";
+ }
+ }
+}
+
+sub makeTarFile {
+ my $directoryname = shift;
+ my $origdirname = shift;
+ my $tarfilename = shift;
+ my $tardirname = shift;
+ $cmd = "mv $indirectory/$origdirname $indirectory/$tardirname";
+ $output = `$cmd`;
+ print $output;
+ if (-d $indirectory."/".$tardirname."/doc/hdf5/examples") {
+ $cmd = "mv $indirectory/$tardirname/doc/hdf5/examples $indirectory/$tardirname/examples";
+ $output = `$cmd`;
+ print $output;
+ $cmd = "rm -rf $indirectory/$tardirname/doc";
+ $output = `$cmd`;
+ print $output;
+ }
+ $cmd = "tar zcvf $outdirectory/$directoryname/$tarfilename -C $indirectory $tardirname";
+ print "Need to run $cmd.\n";
+ $output = `$cmd`;
+ sleep 10;
+ print "Create $tarfilename: $output\n";
+ $cmd = "mv $indirectory/$tardirname $indirectory/$origdirname";
+ $output = `$cmd`;
+ print $output;
+}
+
+foreach $key (keys %destsubdir) {
+ print "Process ".$key."\n\n";
+ #skip unless there's a directory by the name of $key or $key-static
+ next unless -d $indirectory.'/'.$key || -d $indirectory.'/'.$key."-static";
+ my $version;
+ # This assumes a static directory. Probably the others should be checked if this
+ # doesn't exist.
+ $cmd = "grep \"HDF5 Version\" $indirectory/$key/lib/libhdf5.settings";
+ $_ = `$cmd`;
+ print $_, "\n";
+ s/HDF5 Version://;
+ s/^\s+//;
+ chomp;
+ $version = $_;
+ #my $directoryname = substr $destsubdir{$key}, 0, rindex($destsubdir{$key}, '-');
+ my $directoryname = $destsubdir{$key};
+ mkdir $outdirectory."/".$directoryname, 0755 unless -d $outdirectory."/".$directoryname;
+ my $staticdir = $key."-static";
+ print $indirectory."/$key tarfile will be put in " . $outdirectory."/".$directoryname."\n";
+ if (-e $outdirectory."/".$destsubdir{$key}."/README") {
+ print $outdirectory."/".$destsubdir{$key}."/README" . " has already been created.\n";
+ }
+ else {
+ print "Make the Outer README file: ";
+ $cmd = "perl ./makeOuterREADME.pl $indirectory/$key $outdirectory $directoryname";
+ print $cmd, "\n";
+ my $output = `$cmd`;
+ print $output;
+ }
+ my $file = "";
+ my @dirnames = "";
+ opendir(DIR, $indirectory) or die "can't open .: $!";
+ while (defined($file = readdir(DIR))) {
+ next unless ($file eq $key || $file eq "$key-static") && -d $indirectory."/".$file;
+ push @dirnames, $file;
+ }
+ foreach my $dir (@dirnames) {
+ next if $dir eq "";
+ print "Make the Inner README files.\n";
+ $cmd = "perl ./makeInternalREADME.pl $indirectory/$dir";
+ print $cmd, "\n";
+ $output = `$cmd`;
+ print $output;
+ print "Add the zlib and szip files for $dir.\n";
+ &addzandszlibs($dir, $indirectory);
+ my $currentdir = getcwd();
+
+ print "Remove all lib*.la files from $dir/lib*.\n";
+ $cmd = "rm $indirectory/$dir/lib*/lib*.la";
+ print $cmd, "\n";
+ $output = `$cmd`;
+ print $output;
+
+ chdir "$indirectory/$dir/bin" or die "Couldn't change directory to $indirectory/$dir/bin, $!";
+
+ $cmd = "$scriptdirname/h5rmflags -force";
+ $output = `$cmd`;
+ print $output;
+ chdir $currentdir or die "Couldn't change directory back to $currentdir, $!";
+ print "Tar up the files into the output directory.\n";
+ if (-d $indirectory."/".$dir) {
+ if ($dir =~ /static/) {
+ $tarfilename = "hdf5-$version-$destsubdir{$key}-static.tar.gz";
+ $tardirname = "hdf5-$version-$destsubdir{$key}-static";
+ } else {
+ $tarfilename = "hdf5-$version-$destsubdir{$key}-shared.tar.gz";
+ $tardirname = "hdf5-$version-$destsubdir{$key}-shared";
+ }
+ &makeTarFile($directoryname, $dir, $tarfilename, $tardirname);
+ }
+ }
+ # If this copy is done after h5rmflags is run on all the directories the compile scripts
+ # in the utilities directory will already have the paths removed.
+ if (-d $indirectory."/".$staticdir) {
+ $cmd = "cp -prv $indirectory/$staticdir/bin $outdirectory/$directoryname/utilities";
+ $output = `$cmd`;
+ print $output;
+ }
+}
+
diff --git a/bin/pkgscrpts/makeInternalREADME.pl b/bin/pkgscrpts/makeInternalREADME.pl
new file mode 100755
index 0000000..355036f
--- /dev/null
+++ b/bin/pkgscrpts/makeInternalREADME.pl
@@ -0,0 +1,215 @@
+#!/usr/bin/perl
+# makeInternalREADME.pl
+#
+# Copyright by The HDF Group.
+# All rights reserved.
+#
+# This file is part of HDF4. The full HDF4 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 HDF4 document set and
+# is linked from the top-level documents page. It can also be found at
+# http://hdfgroup.org/HDF4/doc/Copyright.html. If you do not have
+# access to either file, you may request a copy from help@hdfgroup.org.
+#
+
+use warnings;
+use strict;
+
+my $section2="For information on compilers and settings used to build these HDF5
+libraries, please refer to:
+
+ ./lib/libhdf5.settings
+
+The contents of this directory are:
+
+ COPYING - Copyright notice
+ README - This file
+ RELEASE.txt - Detailed information regarding this release
+ bin/ - Directory containing HDF5 pre-compiled utilities
+ include/ - Directory containing HDF5 include files
+ lib/ - Directory containing HDF5 libraries and settings
+ share/ - Directory containing example code in C, C++, and
+ Fortran using HDF5 and HDF5 HL library APIs. The
+ shell scripts provided with these examples will
+ compile and run them, and will also test the
+ h5cc, h5c++, and h5fc compile scripts found
+ in the installed bin directory.
+
+These binaries were built with the ZLIB and SZIP (version 2.1, Encoder
+ENABLED) external libraries which are included in the lib directory for
+convenience.
+
+We also provide the ZLIB and SZIP source code on our ftp server at:
+
+ ftp://ftp.hdfgroup.org/lib-external/
+
+The official ZLIB and SZIP pages are at:
+
+ ZLIB: http://www.zlib.net/
+ SZIP: http://hdfgroup.org/doc_resource/SZIP/
+
+";
+
+my $section3 = "If using the shared libraries, you must add the HDF5 library path
+to the LD_LIBRARY_PATH variable.
+";
+
+my $section4 = "We provide scripts for compiling applications with the HDF5 libraries:
+
+ bin/h5cc - for C
+ bin/h5fc - for F90 (if Fortran 90 library is included with the binaries)
+ bin/h5c++ - for C++ (if C++ library is included with the binaries)
+
+After you have installed the binaries to their final destination, you can use
+these scripts (h5cc, h5fc, h5c++) to compile. However, you must first run
+./h5redeploy in the bin directory to change site specific paths in the scripts.
+
+You may also need to change other variables in the scripts, depending
+on how things are set up on your system. Here are some of the variables
+to check:
+
+ prefix - Path to the HDF5 top level installation directory
+ CCBASE - Name of the C compiler
+ CLINKERBASE - Name of the linker
+ LIBS - Libraries your application will link with
+
+For further details refer to the INSTALL files in
+ ftp://ftp.hdfgroup.org/HDF5/current/src/unpacked/release_docs/
+or in the ./release_docs/ directory of the HDF5 source code, which can be found
+on the HDF Group ftp server at ftp://ftp.hdfgroup.org/HDF5/current/src/.
+
+Please send questions, comments, and suggestions to the appropriate
+contact address from http://www.hdfgroup.org/about/contact.html
+
+
+";
+
+my $indirectory = ".";
+$indirectory = shift;
+my $linktype = "shared";
+if ($indirectory =~ /static/) {
+ $linktype = "static";
+}
+my $modestring="";
+if ($indirectory =~ /32/) {
+ $modestring = "in 32 bit mode ";
+}
+
+my $version;
+
+my $outfile = "$indirectory/README";
+open OUTFILE, ">$outfile" or die "$!Couldn't open $outfile - check permissions for $indirectory\n";
+my $hostname;
+my $cmd = "grep \"HDF5 Version\" $indirectory/lib/libhdf5.settings";
+$_ = `$cmd`;
+#print OUTFILE $_, "\n";
+s/HDF5 Version://;
+s/^\s+//;
+chomp;
+$version = $_;
+#print OUTFILE $_, "\n";
+
+my $versionstring= "This directory contains the $linktype binary distribution of HDF5-".$version;
+
+$cmd = "grep \"Uname information:\" $indirectory/lib/libhdf5.settings";
+$_ = `$cmd`;
+s/Uname information://;
+s/^\s+//;
+#print OUTFILE $_;
+chomp;
+#s/(^\w+)(\s)(\S+)/$1/;
+#s/(^.*)(-)(.*)(200[7-8])(.*)(\s)(\S+)/$1 $5/;
+#my $platformstring = "\nthat was compiled on:" . $_ . " ";
+my $platformstring = "";
+my $hostnamestring = $_;
+my @hostnamestring = split / /, $hostnamestring;
+#print OUTFILE "Size of hostnamestring is ", scalar @hostnamestring, "\n";
+#print OUTFILE $hostnamestring[0] . "\t" . $hostnamestring[2]."\t".$hostnamestring[19]."\n";
+$hostname = $hostnamestring[1];
+#my $size = scalar @hostnamestring;
+if ($hostname =~ /loyalty/) {
+ $platformstring = "\nthat was compiled " . $modestring . "on: " . $hostnamestring[0]." " . $hostnamestring[2]." " . $hostnamestring[-1] . " ";
+}
+elsif ($hostname =~ /freedom/) {
+ $platformstring = "\nthat was compiled " . $modestring . "on: " . $hostnamestring[0]." " . $hostnamestring[2]." " . $hostnamestring[-1] . " ";
+} elsif ($hostname =~ /emu/) {
+ $platformstring = "\nthat was compiled " . $modestring . "on: " . $hostnamestring[0]." " . $hostnamestring[2] . " " . $hostnamestring[-2] . " ";
+} elsif ($hostname =~ /fred/) {
+ $platformstring = "\nthat was compiled " . $modestring . "on: " . $hostnamestring[0]." " . $hostnamestring[2] . " " . $hostnamestring[-1] . " ";
+} else {
+ $_ = $hostnamestring[2];
+ my $pos = index $_, '-';
+ my $os = substr $_, 0, $pos;
+ $platformstring = "\nthat was compiled " . $modestring . "on: " . $hostnamestring[0] . " " . $os . " " . $hostnamestring[-2] . " ";
+}
+
+
+my $mappingstring = "";
+#no mappingstring for 1.6. Put it back for 1.8.
+#$cmd = "grep \"Default API Mapping:\" $indirectory/lib/libhdf5.settings";
+#$_ = `$cmd`;
+#s/Default API Mapping://;
+#s/^\s+//;
+#chomp;
+#if (/v\d+/) {
+# s/v//;
+# s/(\d)(\d)/$1\.$2/g;
+# $mappingstring = "using the default\nAPI mapping for VERSION ".$_.".";
+#
+#}
+print OUTFILE $versionstring;
+print OUTFILE $platformstring."\n\n";
+#print OUTFILE $mappingstring;
+
+#if ($hostname eq "loyalty.hdfgroup.uiuc.edu" || $hostname eq "freedom.hdfgroup.uiuc.edu") {
+# print OUTFILE " It includes the C APIs,\nbuilt using the following ";
+# print OUTFILE "compilers:\n\n";
+#}
+#else {
+if ($linktype eq "shared" && !($hostname =~ /32/)) {
+ print OUTFILE "\n\nIt includes the C, C++, F90 and Java APIs, built using the following\n";
+} else {
+ print OUTFILE "\n\nIt includes the C, C++, and F90 APIs, built using the following\n";
+}
+print OUTFILE "compilers:\n\n";
+#}
+
+# Only the gcc compiler version is in libhdf5.settings, so for now I looked
+# up the versions and hardcoded them here. We will put them in libhdf5.settings
+# for the next release.
+if ($indirectory =~ /gnu484/) {
+ print OUTFILE "\tgcc, g++, and gfortran 4.8.4\n\n";
+} elsif ($hostname =~ /jam/ || $hostname =~ /koala/) {
+ print OUTFILE "\tgcc, g++, and gfortran 4.1.2\n\n";
+} elsif ($hostname =~ /platypus/) {
+ print OUTFILE "\tgcc, g++, and gfortran 4.4.7\n\n";
+ if ($linktype eq "shared" && !($hostname =~ /32/)) {
+ print OUTFILE "\tjava 1.8.0_51\n\n";
+ }
+} elsif ($hostname =~ /moohan/) {
+ print OUTFILE "\tgcc, g++, and gfortran 4.8.5\n\n";
+ if ($linktype eq "shared" && !($hostname =~ /32/)) {
+ print OUTFILE "\tjava 1.8.0_51\n\n";
+ }
+} elsif ($hostname =~ /emu/) {
+ print OUTFILE "\tSun C and C++ 5.12, Sun Fortran 95 8.6\n\n";
+} elsif ($hostname =~ /loyalty/ || $hostname =~ /freedom/) {
+ print OUTFILE "\tgcc, g++, and gfortran 4.6.1\n\n";
+} elsif ($hostname =~ /duck/) {
+ print OUTFILE "\tApple clang/clang++ 3.0 from Xcode 4.6.1 and gfortran 4.8.2\n\n";
+} elsif ($hostname =~ /kite/) {
+ print OUTFILE "\tApple clang/clang++ 5.1 from Xcode 5.0.2 and gfortran 4.8.2\n\n";
+} elsif ($hostname =~ /quail/) {
+ print OUTFILE "\tgcc, g++ 5.1 from Xcode 5.1 and gfortran 4.8.2\n\n";
+} elsif ($hostname =~ /osx1010test/) {
+ print OUTFILE "\tgcc, g++ 5.1 from Xcode 5.1 and gfortran 4.8.2\n\n";
+}
+
+print OUTFILE $section2;
+
+print OUTFILE $section3;
+
+print OUTFILE $section4;
+
diff --git a/bin/pkgscrpts/makeOuterREADME.pl b/bin/pkgscrpts/makeOuterREADME.pl
new file mode 100755
index 0000000..602ad28
--- /dev/null
+++ b/bin/pkgscrpts/makeOuterREADME.pl
@@ -0,0 +1,182 @@
+#!/usr/bin/perl
+# makeOuterREADME.pl
+
+# Copyright by The HDF Group.
+# All rights reserved.
+#
+# This file is part of HDF4. The full HDF4 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 HDF4 document set and
+# is linked from the top-level documents page. It can also be found at
+# http://hdfgroup.org/HDF4/doc/Copyright.html. If you do not have
+# access to either file, you may request a copy from help@hdfgroup.org.
+#
+
+use warnings;
+use strict;
+
+my $indirectory = ".";
+$indirectory = shift;
+
+my $outdirectory = ".";
+$outdirectory = shift;
+
+my $outsubdir = shift;
+
+my $version;
+
+my $outfile = "$outdirectory/$outsubdir/README";
+open OUTFILE, ">$outfile";
+my $hostname="";
+my $cmd = "grep \"HDF5 Version\" $indirectory-static/lib/libhdf5.settings";
+$_ = `$cmd`;
+print OUTFILE $_, "\n";
+s/HDF5 Version://;
+s/^\s+//;
+chomp;
+$version = $_;
+#print OUTFILE $_, "\n";
+my $versionstring= "This directory contains the precompiled HDF5 $version binary distribution\n(include files, libraries, utilities) for";
+
+$cmd = "grep \"Uname information:\" $indirectory-static/lib/libhdf5.settings";
+$_ = `$cmd`;
+s/Uname information://;
+s/^\s+//;
+chomp;
+print "String to work with is $_\n";
+my $platformstring = "";
+my $hostnamestring = $_;
+my @hostnamestring = split / /, $hostnamestring;
+$platformstring = "$hostnamestring[0] ";
+if ($indirectory =~ /jam/ || $indirectory =~ /koala/) {
+ $hostnamestring = $hostnamestring[2];
+ my $pos = index $hostnamestring, "-";
+ if ($pos > 0) {
+ $platformstring .= substr $hostnamestring, 0, $pos;
+ } else {
+ $platformstring .= $hostnamestring[2];
+ }
+ $platformstring .= " ".$hostnamestring[-3];
+} elsif ($indirectory =~ /linew/) {
+ $platformstring .= "$hostnamestring[2] $hostnamestring[-2]";
+} else {
+ $platformstring .= "$hostnamestring[2] $hostnamestring[-1]";
+}
+
+print OUTFILE $versionstring." ".$platformstring.":\n\n";
+my $line1;
+my $line3;
+my $line5;
+my $compilerstring="";
+my $compilerstring1="";
+my $compilerstring2="";
+
+
+print $indirectory, "\n";
+
+if ($indirectory =~ /ostrich/) {
+# $line1 = " hdf5-$version-$outsubdir-16API.tar.gz - Includes C, C++, F90 APIs (using\n";
+ $line3 = " hdf5-$version-$outsubdir-static.tar.gz - Includes C, C++, F90 APIs (using";
+ $line5 = " hdf5-$version-$outsubdir-shared.tar.gz - Includes C, C++, F90 APIs (using";
+ $compilerstring = " gcc, g++, and gfortran 4.4.7)";
+}
+elsif ($indirectory =~ /platypus/) {
+# $line1 = " hdf5-$version-$outsubdir-16API.tar.gz - Includes C, C++, F90 APIs (using\n";
+ $line3 = " hdf5-$version-$outsubdir-static.tar.gz - Includes C, C++, F90 APIs (using";
+ $compilerstring1 = " gcc, g++, and gfortran 4.4.7)\n";
+ if ($indirectory =~ /32/) {
+ $line5 = " hdf5-$version-$outsubdir-shared.tar.gz - Includes C, C++, F90 and Java APIs (using";
+ $compilerstring2 = " gcc, g++, and gfortran 4.4.7)\n";
+ } else {
+ $line5 = " hdf5-$version-$outsubdir-shared.tar.gz - Includes C, C++, F90 and Java APIs (using";
+ $compilerstring2 = " gcc, g++, and gfortran 4.4.7 and java 1.8.0_51)\n";
+ }
+}
+elsif ($indirectory =~ /moohan/) {
+# $line1 = " hdf5-$version-$outsubdir-16API.tar.gz - Includes C, C++, F90 APIs (using\n";
+ $line3 = " hdf5-$version-$outsubdir-static.tar.gz - Includes C, C++, F90 APIs (using";
+ $compilerstring1 = " gcc, g++, and gfortran 4.8.5)\n";
+ if ($indirectory =~ /32/) {
+ $line5 = " hdf5-$version-$outsubdir-shared.tar.gz - Includes C, C++, F90 and Java APIs (using";
+ $compilerstring2 = " gcc, g++, and gfortran 4.4.7)\n";
+ } else {
+ $line5 = " hdf5-$version-$outsubdir-shared.tar.gz - Includes C, C++, F90 and Java APIs (using";
+ $compilerstring2 = " gcc, g++, and gfortran 4.8.5 and java 1.8.0_51)\n";
+ }
+}
+elsif ($indirectory =~ /emu/) {
+# $line1 = " hdf5-$version-$outsubdir-16API.tar.gz - Includes C, C++, F90 APIs (using\n";
+ $line3 = " hdf5-$version-$outsubdir-static.tar.gz - Includes C, C++, F90 APIs (using";
+ $line5 = " hdf5-$version-$outsubdir-shared.tar.gz - Includes C, C++, F90 APIs (using";
+ $compilerstring = " Sun C and C++ 5.12, Sun Fortran 95 8.6)\n";
+}
+elsif ($indirectory =~ /kite/) {
+ $line3 = " hfd5-$version-$outsubdir-static.tar.gz - Includes C, C++, F90 APIs (using";
+ $line5 = " hfd5-$version-$outsubdir-shared.tar.gz - Includes C, C++, F90 APIs (using";
+ $compilerstring = " Apple clang/clang++ 5.1 from Xcode 5.0.2,
+ gfortran 4.8.2)\n";
+}
+elsif ($indirectory =~ /quail/) {
+ $line3 = " hfd5-$version-$outsubdir-static.tar.gz - Includes C, C++, F90 APIs (using";
+ $line5 = " hfd5-$version-$outsubdir-shared.tar.gz - Includes C, C++, F90 APIs (using";
+ $compilerstring = " Apple clang/clang++ 6.0 from Xcode 5.1,
+ gfortran 4.9.2)\n";
+}
+elsif ($indirectory =~ /osx1010test/) {
+ $line3 = " hdf5-$version-$outsubdir-static.tar.gz - Includes C, C++, F90 APIs (using";
+ $line5 = " hdf5-$version-$outsubdir-shared.tar.gz - Includes C, C++, F90 APIs (using";
+ $compilerstring = " Apple clang/clang++ 6.1 from Xcode 6.1,
+ gfortran 4.9.2)\n";
+}
+elsif ($indirectory =~ /osx1011test/) {
+ $line3 = " hdf5-$version-$outsubdir-static.tar.gz - Includes C, C++, F90 APIs (using";
+ $line5 = " hdf5-$version-$outsubdir-shared.tar.gz - Includes C, C++, F90 APIs (using";
+ $compilerstring = " Apple clang/clang++ 7.0.2 from Xcode 7.0,
+ gfortran 5.2.0)\n";
+}
+
+ print OUTFILE $line3;
+ print OUTFILE $compilerstring1."\n";
+if ($line5 ne "") {
+ print OUTFILE $line5;
+ print OUTFILE $compilerstring2."\n";
+}
+#elsif ($indirectory =~ /-16API/) {
+# print OUTFILE $line1;
+# print OUTFILE $compilerstring;
+# print OUTFILE " USES THE VERSION 1.6 DEFAULT API\n";
+# print OUTFILE " MAPPING.\n\n";
+#}
+
+print OUTFILE " utilities/ - Directory containing the compiled HDF5 utilities.\n";
+print OUTFILE " These utilities are STATICALLY linked and will run as is.\n\n";
+#print OUTFILE " The tools can be downloaded separately, or ALL in one\n";
+#print OUTFILE " compressed file (5-$version-$outsubdir-static-util.tar.gz).\n\n";
+print OUTFILE "\n";
+print OUTFILE "To obtain the HDF5 distribution, 'unzip' and 'untar' the distribution\n";
+print OUTFILE "file:\n\n";
+print OUTFILE " gzip -cd <gz file from above> | tar xvf -\n";
+
+
+#$cmd = "grep \"Configured by:\" $indirectory/$key-static/lib/libhdf5.settings";
+#$_ = `$cmd`;
+#s/Configured by://;
+#s/^\s+//;
+#print OUTFILE $_;
+#chomp;
+#my $hostnamestring = $_;
+#s/(^\w+)(\s)(\S+)/$1/;
+#s/(^.*)(-)(.*)(200[7-8])(.*)(\s)(\S+)/$1 $5/;
+#my $platformstring = $_ . ":\n\n";
+#my @hostnamestring = split /@/, $hostnamestring;
+#print "Size of hostnamestring is ", scalar @hostnamestring, "\n";
+#print $hostnamestring[0] . "\t" . $hostnamestring[2]."\t".$hostnamestring[19]."\n";
+#my $platformstring = $hostnamestring[1].":\n\n";
+#$hostnamestring = $hostnamestring[1];
+#my $pos = index $hostnamestring, ".";
+#if ($pos > 0) {
+# @hostnamestring = split /\./, $hostnamestring;
+# $platformstring = $hostnamestring[0].":\n\n";
+#}
diff --git a/c++/src/H5AbstractDs.cpp b/c++/src/H5AbstractDs.cpp
index 51d5f88..f0579fc 100644
--- a/c++/src/H5AbstractDs.cpp
+++ b/c++/src/H5AbstractDs.cpp
@@ -19,12 +19,12 @@
#include "H5Exception.h"
#include "H5IdComponent.h"
#include "H5PropList.h"
+#include "H5Location.h"
#include "H5Object.h"
#include "H5AbstractDs.h"
#include "H5DataSpace.h"
#include "H5OcreatProp.h"
#include "H5DcreatProp.h"
-#include "H5CommonFG.h"
#include "H5Alltypes.h"
#ifndef H5_NO_NAMESPACE
diff --git a/c++/src/H5Alltypes.h b/c++/src/H5Alltypes.h
index b1d792d..df7213a 100644
--- a/c++/src/H5Alltypes.h
+++ b/c++/src/H5Alltypes.h
@@ -24,6 +24,6 @@
#include "H5IntType.h"
#include "H5FloatType.h"
#include "H5StrType.h"
-#include "H5CompType.h"
#include "H5ArrayType.h"
#include "H5VarLenType.h"
+#include "H5CompType.h"
diff --git a/c++/src/H5ArrayType.cpp b/c++/src/H5ArrayType.cpp
index e11227a..d7d1a35 100644
--- a/c++/src/H5ArrayType.cpp
+++ b/c++/src/H5ArrayType.cpp
@@ -19,10 +19,10 @@
#include "H5Exception.h"
#include "H5IdComponent.h"
#include "H5PropList.h"
+#include "H5Location.h"
#include "H5Object.h"
#include "H5OcreatProp.h"
#include "H5DcreatProp.h"
-#include "H5CommonFG.h"
#include "H5DataType.h"
#include "H5ArrayType.h"
@@ -80,10 +80,9 @@ ArrayType::ArrayType(const DataType& base_type, int ndims, const hsize_t* dims)
///\param rhs - IN: Reference to the existing array datatype
///\return Reference to ArrayType instance
///\exception H5::DataTypeIException
-/// std::bad_alloc
// Description
// Closes the id on the lhs object first with setId, then copies
-// each data member from the rhs object.
+// each data member from the rhs object. (Issue HDFFV-9562)
// Programmer Binh-Minh Ribler - Mar 2016
// Modification
//--------------------------------------------------------------------------
@@ -120,24 +119,7 @@ int ArrayType::getArrayNDims() const
int ndims = H5Tget_array_ndims(id);
if (ndims < 0)
{
- throw DataTypeIException("ArrayType::setArrayInfo", "H5Tget_array_ndims failed");
- }
-
- return(ndims);
-}
-//---------------------------- Deprecated ----------------------------------
-// Function: ArrayType::getArrayNDims
-// This non-const version of the above method is here for compatibility
-// purposes and may be removed in the future.
-// -BMR, Apr 2016
-//--------------------------------------------------------------------------
-int ArrayType::getArrayNDims()
-{
- // Get the rank of the array type specified by id from the C API
- int ndims = H5Tget_array_ndims(id);
- if (ndims < 0)
- {
- throw DataTypeIException("ArrayType::setArrayInfo", "H5Tget_array_ndims failed");
+ throw DataTypeIException("ArrayType::getArrayNDims", "H5Tget_array_ndims failed");
}
return(ndims);
@@ -159,23 +141,7 @@ int ArrayType::getArrayDims(hsize_t* dims) const
// Get the dimensions
int ndims = H5Tget_array_dims2(id, dims);
if (ndims < 0)
- throw DataTypeIException("ArrayType::setArrayInfo", "H5Tget_array_dims2 failed");
-
- // Return the number of dimensions
- return(ndims);
-}
-//---------------------------- Deprecated ----------------------------------
-// Function: ArrayType::getArrayDims
-// This non-const version of the above method is here for compatibility
-// purposes and may be removed in the future.
-// -BMR, Apr 2016
-//--------------------------------------------------------------------------
-int ArrayType::getArrayDims(hsize_t* dims)
-{
- // Get the dimensions
- int ndims = H5Tget_array_dims2(id, dims);
- if (ndims < 0)
- throw DataTypeIException("ArrayType::setArrayInfo", "H5Tget_array_dims2 failed");
+ throw DataTypeIException("ArrayType::getArrayDims", "H5Tget_array_dims2 failed");
// Return the number of dimensions
return(ndims);
diff --git a/c++/src/H5ArrayType.h b/c++/src/H5ArrayType.h
index eee430e..fb6c711 100644
--- a/c++/src/H5ArrayType.h
+++ b/c++/src/H5ArrayType.h
@@ -36,11 +36,11 @@ class H5_DLLCPP ArrayType : public DataType {
// Returns the number of dimensions of this array datatype.
int getArrayNDims() const;
- int getArrayNDims(); // deprecated
+ //int getArrayNDims(); // removed 1.8.18 and 1.10.1
// Returns the sizes of dimensions of this array datatype.
int getArrayDims(hsize_t* dims) const;
- int getArrayDims(hsize_t* dims); // deprecated
+ //int getArrayDims(hsize_t* dims); // removed 1.8.18 and 1.10.1
///\brief Returns this class name.
virtual H5std_string fromClass () const { return("ArrayType"); }
diff --git a/c++/src/H5AtomType.cpp b/c++/src/H5AtomType.cpp
index 90c2ae3..6308821 100644
--- a/c++/src/H5AtomType.cpp
+++ b/c++/src/H5AtomType.cpp
@@ -19,10 +19,10 @@
#include "H5Exception.h"
#include "H5IdComponent.h"
#include "H5PropList.h"
+#include "H5Location.h"
#include "H5Object.h"
#include "H5OcreatProp.h"
#include "H5DcreatProp.h"
-#include "H5CommonFG.h"
#include "H5DataType.h"
#include "H5AtomType.h"
diff --git a/c++/src/H5Attribute.cpp b/c++/src/H5Attribute.cpp
index 301aaf1..5454583 100644
--- a/c++/src/H5Attribute.cpp
+++ b/c++/src/H5Attribute.cpp
@@ -24,15 +24,16 @@
#include "H5Exception.h"
#include "H5IdComponent.h"
#include "H5PropList.h"
+#include "H5Location.h"
#include "H5Object.h"
#include "H5AbstractDs.h"
#include "H5FaccProp.h"
#include "H5FcreatProp.h"
#include "H5OcreatProp.h"
#include "H5DcreatProp.h"
-#include "H5CommonFG.h"
#include "H5DataType.h"
#include "H5DataSpace.h"
+#include "H5Group.h"
#include "H5File.h"
#include "H5Attribute.h"
#include "H5private.h" // for HDfree
@@ -52,7 +53,7 @@ class H5_DLLCPP H5Object; // forward declaration for UserData4Aiterate
///\brief Default constructor: Creates a stub attribute
// Programmer Binh-Minh Ribler - May, 2004
//--------------------------------------------------------------------------
-Attribute::Attribute() : AbstractDs(), IdComponent(), id(H5I_INVALID_HID) {}
+Attribute::Attribute() : AbstractDs(), H5Location(), id(H5I_INVALID_HID) {}
//--------------------------------------------------------------------------
// Function: Attribute copy constructor
@@ -60,7 +61,7 @@ Attribute::Attribute() : AbstractDs(), IdComponent(), id(H5I_INVALID_HID) {}
///\param original - IN: Original Attribute object to copy
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-Attribute::Attribute(const Attribute& original) : AbstractDs(), IdComponent(), id(original.id)
+Attribute::Attribute(const Attribute& original) : AbstractDs(), H5Location(), id(original.id)
{
incRefCount(); // increment number of references to this id
}
@@ -73,7 +74,7 @@ Attribute::Attribute(const Attribute& original) : AbstractDs(), IdComponent(), i
///\exception H5::AttributeIException
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-Attribute::Attribute(const hid_t existing_id) : AbstractDs(), IdComponent(), id(existing_id)
+Attribute::Attribute(const hid_t existing_id) : AbstractDs(), H5Location(), id(existing_id)
{
incRefCount(); // increment number of references to this id
}
@@ -282,23 +283,6 @@ DataSpace Attribute::getSpace() const
}
//--------------------------------------------------------------------------
-// Function: Attribute::getFileName
-///\brief Gets the name of the file, in which this attribute belongs.
-///\return File name
-///\exception H5::IdComponentException
-// Programmer Binh-Minh Ribler - Jul, 2004
-//--------------------------------------------------------------------------
-H5std_string Attribute::getFileName() const
-{
- try {
- return(p_get_file_name());
- }
- catch (IdComponentException& E) {
- throw FileIException("Attribute::getFileName", E.getDetailMsg());
- }
-}
-
-//--------------------------------------------------------------------------
// Function: Attribute::getName
///\brief Gets the name of this attribute, returning its length.
///\param attr_name - OUT: Buffer for the name string as char*
@@ -462,12 +446,13 @@ ssize_t Attribute::getName(H5std_string& attr_name, size_t len) const
// Programmer Binh-Minh Ribler - Nov, 2001
// Modification
// Modified to call its replacement. -BMR, 2014/04/16
-// Removed from documentation. -BMR, 2016/03/07
+// Removed from documentation. -BMR, 2016/03/07 1.8.17 and 1.10.0
+// Removed from code. -BMR, 2016/08/11 1.8.18 and 1.10.1
//--------------------------------------------------------------------------
-ssize_t Attribute::getName( size_t len, H5std_string& attr_name ) const
-{
- return (getName(attr_name, len));
-}
+//ssize_t Attribute::getName( size_t len, H5std_string& attr_name ) const
+//{
+// return (getName(attr_name, len));
+//}
//--------------------------------------------------------------------------
// Function: Attribute::getStorageSize
@@ -485,31 +470,6 @@ hsize_t Attribute::getStorageSize() const
}
//--------------------------------------------------------------------------
-// Function: Attribute::flush
-///\brief Flushes all buffers associated with a file specified by
-/// this attribute, to disk.
-///\param scope - IN: Specifies the scope of the flushing action,
-/// which can be either of these values:
-/// \li \c H5F_SCOPE_GLOBAL - Flushes the entire virtual file
-/// \li \c H5F_SCOPE_LOCAL - Flushes only the specified file
-///\exception H5::AttributeIException
-///\par Description
-/// This attribute is used to identify the file to be flushed.
-// Programmer Binh-Minh Ribler - 2012
-// Modification
-// Sep 2012 - BMR
-// Duplicated from H5Location
-//--------------------------------------------------------------------------
-void Attribute::flush(H5F_scope_t scope) const
-{
- herr_t ret_value = H5Fflush(getId(), scope);
- if( ret_value < 0 )
- {
- throw AttributeIException("Attribute::flush", "H5Fflush failed");
- }
-}
-
-//--------------------------------------------------------------------------
// Function: Attribute::getId
///\brief Get the id of this attribute
///\return Attribute identifier
@@ -519,6 +479,11 @@ void Attribute::flush(H5F_scope_t scope) const
// addition, member IdComponent::id is moved into subclasses, and
// IdComponent::getId now becomes pure virtual function.
// Programmer Binh-Minh Ribler - May, 2008
+// Modification
+// Aug 2016 - BMR
+// Note that Attribute is now inheriting from H5Location, because
+// an attribute id can be used to specify a location in HDF5
+// library.
//--------------------------------------------------------------------------
hid_t Attribute::getId() const
{
diff --git a/c++/src/H5Attribute.h b/c++/src/H5Attribute.h
index f5ee4a9..6590c23 100644
--- a/c++/src/H5Attribute.h
+++ b/c++/src/H5Attribute.h
@@ -26,10 +26,10 @@ namespace H5 {
An attribute has many characteristics similar to a dataset, thus both
Attribute and DataSet are derivatives of AbstractDs. Attribute also
- inherits from IdComponent because an attribute is an HDF5 component that
- is identified by an identifier.
+ inherits from H5Location because an attribute can be used to specify
+ a location.
*/
-class H5_DLLCPP Attribute : public AbstractDs, public IdComponent {
+class H5_DLLCPP Attribute : public AbstractDs, public H5Location {
public:
// Copy constructor: makes a copy of an existing Attribute object.
@@ -44,9 +44,6 @@ class H5_DLLCPP Attribute : public AbstractDs, public IdComponent {
// Closes this attribute.
virtual void close();
- // Gets the name of the file, in which this attribute belongs.
- H5std_string getFileName() const;
-
// Gets the name of this attribute.
ssize_t getName(char* attr_name, size_t buf_size = 0) const;
H5std_string getName(size_t len) const;
@@ -73,10 +70,6 @@ class H5_DLLCPP Attribute : public AbstractDs, public IdComponent {
void write(const DataType& mem_type, const void *buf ) const;
void write(const DataType& mem_type, const H5std_string& strg ) const;
- // Flushes all buffers associated with the file specified by this
- // attribute to disk.
- void flush( H5F_scope_t scope ) const;
-
///\brief Returns this class name.
virtual H5std_string fromClass () const { return("Attribute"); }
@@ -105,12 +98,6 @@ class H5_DLLCPP Attribute : public AbstractDs, public IdComponent {
void p_read_variable_len(const DataType& mem_type, H5std_string& strg) const;
void p_read_fixed_len(const DataType& mem_type, H5std_string& strg) const;
- // do not inherit H5Object::iterateAttrs
- int iterateAttrs() { return 0; }
-
- // do not inherit H5Object::renameAttr
- void renameAttr() {}
-
// Friend function to set Attribute id. For library use only.
friend void f_Attribute_setId(Attribute* attr, hid_t new_id);
diff --git a/c++/src/H5CommonFG.cpp b/c++/src/H5CommonFG.cpp
index 339af54..0c18293 100644
--- a/c++/src/H5CommonFG.cpp
+++ b/c++/src/H5CommonFG.cpp
@@ -19,6 +19,7 @@
#include "H5Exception.h"
#include "H5IdComponent.h"
#include "H5PropList.h"
+#include "H5Location.h"
#include "H5Object.h"
#include "H5FaccProp.h"
#include "H5FcreatProp.h"
@@ -42,7 +43,7 @@
// to call the right getId() - although, as the structure of the
// library at this time, getId() is basically the IdComponent::getId()
// - when a failure returned by the C API, the functions will call
-// throwException, which is a pure virtual function and is implemented
+// throwwException, which is a pure virtual function and is implemented
// by H5File to throw a FileIException and by Group to throw a
// GroupIException.
// December 2000
@@ -52,1204 +53,6 @@ namespace H5 {
using namespace std;
#endif
-//--------------------------------------------------------------------------
-// Function: CommonFG::createGroup
-///\brief Creates a new group at this location which can be a file
-/// or another group.
-///\param name - IN: Name of the group to create
-///\param size_hint - IN: Indicates the number of bytes to reserve for
-/// the names that will appear in the group
-///\return Group instance
-///\exception H5::FileIException or H5::GroupIException
-///\par Description
-/// The optional \a size_hint specifies how much file space to
-/// reserve for storing the names that will appear in this new
-/// group. If a non-positive value is provided for the \a size_hint
-/// then a default size is chosen.
-// Programmer Binh-Minh Ribler - 2000
-//--------------------------------------------------------------------------
- Group CommonFG::createGroup( const char* name, size_t size_hint ) const
-{
- // Group creation property list for size hint
- hid_t gcpl_id = 0;
-
- // Set the local heap size hint
- if (size_hint > 0)
- {
- // If the creation of the property list failed, throw an exception
- if ((gcpl_id = H5Pcreate(H5P_GROUP_CREATE)) < 0)
- throwException("createGroup", "H5Pcreate failed");
-
- if (H5Pset_local_heap_size_hint(gcpl_id, size_hint) < 0) {
- H5Pclose(gcpl_id);
- throwException("createGroup", "H5Pset_local_heap_size_hint failed");
- }
- }
-
- // Call C routine H5Gcreate2 to create the named group, giving the
- // location id which can be a file id or a group id
- hid_t group_id = H5Gcreate2( getLocId(), name, H5P_DEFAULT, gcpl_id, H5P_DEFAULT );
-
- // Close the group creation property list, if necessary
- if(gcpl_id > 0)
- H5Pclose(gcpl_id);
-
- // If the creation of the group failed, throw an exception
- if( group_id < 0 )
- throwException("createGroup", "H5Gcreate2 failed");
-
- // No failure, create and return the Group object
- Group group;
- CommonFG *ptr = &group;
- ptr->p_setId(group_id);
- return( group );
-}
-
-//--------------------------------------------------------------------------
-// Function: CommonFG::createGroup
-///\brief This is an overloaded member function, provided for convenience.
-/// It differs from the above function in that it takes an
-/// \c H5std_string for \a name.
-// Programmer Binh-Minh Ribler - 2000
-//--------------------------------------------------------------------------
-Group CommonFG::createGroup( const H5std_string& name, size_t size_hint ) const
-{
- return( createGroup( name.c_str(), size_hint ));
-}
-
-//--------------------------------------------------------------------------
-// Function: CommonFG::openGroup
-///\brief Opens an existing group in a location which can be a file
-/// or another group.
-///\param name - IN: Name of the group to open
-///\return Group instance
-///\exception H5::FileIException or H5::GroupIException
-// Programmer Binh-Minh Ribler - 2000
-//--------------------------------------------------------------------------
-Group CommonFG::openGroup( const char* name ) const
-{
- // Call C routine H5Gopen2 to open the named group, giving the
- // location id which can be a file id or a group id
- hid_t group_id = H5Gopen2( getLocId(), name, H5P_DEFAULT );
-
- // If the opening of the group failed, throw an exception
- if( group_id < 0 )
- throwException("openGroup", "H5Gopen2 failed");
-
- // No failure, create and return the Group object
- Group group;
- CommonFG *ptr = &group;
- ptr->p_setId(group_id);
- return( group );
-}
-
-//--------------------------------------------------------------------------
-// Function: CommonFG::openGroup
-///\brief This is an overloaded member function, provided for convenience.
-/// It differs from the above function in that it takes an
-/// \c H5std_string for \a name.
-// Programmer Binh-Minh Ribler - 2000
-//--------------------------------------------------------------------------
-Group CommonFG::openGroup( const H5std_string& name ) const
-{
- return( openGroup( name.c_str() ));
-}
-
-//--------------------------------------------------------------------------
-// Function: CommonFG::createDataSet
-///\brief Creates a new dataset at this location.
-///\param name - IN: Name of the dataset to create
-///\param data_type - IN: Datatype of the dataset
-///\param data_space - IN: Dataspace for the dataset
-///\param create_plist - IN: Creation properly list for the dataset
-///\return DataSet instance
-///\exception H5::FileIException or H5::GroupIException
-// Programmer Binh-Minh Ribler - 2000
-//--------------------------------------------------------------------------
-DataSet CommonFG::createDataSet( const char* name, const DataType& data_type, const DataSpace& data_space, const DSetCreatPropList& create_plist ) const
-{
- // Obtain identifiers for C API
- hid_t type_id = data_type.getId();
- hid_t space_id = data_space.getId();
- hid_t create_plist_id = create_plist.getId();
-
- // Call C routine H5Dcreate2 to create the named dataset
- hid_t dataset_id = H5Dcreate2( getLocId(), name, type_id, space_id, H5P_DEFAULT, create_plist_id, H5P_DEFAULT );
-
- // If the creation of the dataset failed, throw an exception
- if( dataset_id < 0 )
- throwException("createDataSet", "H5Dcreate2 failed");
-
- // No failure, create and return the DataSet object
- DataSet dataset;
- f_DataSet_setId(&dataset, dataset_id);
- return( dataset );
-}
-
-//--------------------------------------------------------------------------
-// Function: CommonFG::createDataSet
-///\brief This is an overloaded member function, provided for convenience.
-/// It differs from the above function in that it takes an
-/// \c H5std_string for \a name.
-// Programmer Binh-Minh Ribler - 2000
-//--------------------------------------------------------------------------
-DataSet CommonFG::createDataSet( const H5std_string& name, const DataType& data_type, const DataSpace& data_space, const DSetCreatPropList& create_plist ) const
-{
- return( createDataSet( name.c_str(), data_type, data_space, create_plist ));
-}
-
-//--------------------------------------------------------------------------
-// Function: CommonFG::openDataSet
-///\brief Opens an existing dataset at this location.
-///\param name - IN: Name of the dataset to open
-///\return DataSet instance
-///\exception H5::FileIException or H5::GroupIException
-// Programmer Binh-Minh Ribler - 2000
-//--------------------------------------------------------------------------
-DataSet CommonFG::openDataSet( const char* name ) const
-{
- // Call C function H5Dopen2 to open the specified dataset, giving
- // the location id and the dataset's name
- hid_t dataset_id = H5Dopen2( getLocId(), name, H5P_DEFAULT );
-
- // If the dataset's opening failed, throw an exception
- if(dataset_id < 0)
- throwException("openDataSet", "H5Dopen2 failed");
-
- // No failure, create and return the DataSet object
- DataSet dataset;
- f_DataSet_setId(&dataset, dataset_id);
- return( dataset );
-}
-
-//--------------------------------------------------------------------------
-// Function: CommonFG::openDataSet
-///\brief This is an overloaded member function, provided for convenience.
-/// It differs from the above function in that it takes an
-/// \c H5std_string for \a name.
-// Programmer Binh-Minh Ribler - 2000
-//--------------------------------------------------------------------------
-DataSet CommonFG::openDataSet( const H5std_string& name ) const
-{
- return( openDataSet( name.c_str() ));
-}
-
-//--------------------------------------------------------------------------
-// Function: CommonFG::link
-///\brief Creates a link of the specified type from \a new_name to
-/// \a curr_name.
-///\param link_type - IN: Link type; possible values are
-/// \li \c H5G_LINK_HARD
-/// \li \c H5G_LINK_SOFT
-///\param curr_name - IN: Name of the existing object if link is a hard
-/// link; can be anything for the soft link
-///\param new_name - IN: New name for the object
-///\exception H5::FileIException or H5::GroupIException
-///\par Description
-/// Note that both names are interpreted relative to the
-/// specified location.
-/// For information on creating hard link and soft link, please
-/// refer to the C layer Reference Manual at:
-/// http://hdfgroup.org/HDF5/doc/RM/RM_H5L.html#Link-CreateHard and
-/// http://hdfgroup.org/HDF5/doc/RM/RM_H5L.html#Link-CreateSoft
-// Programmer Binh-Minh Ribler - 2000
-// Modification
-// 2007: QAK modified to use H5L APIs - BMR
-//--------------------------------------------------------------------------
-void CommonFG::link( H5L_type_t link_type, const char* curr_name, const char* new_name ) const
-{
- herr_t ret_value = -1;
-
- switch(link_type) {
- case H5L_TYPE_HARD:
- ret_value = H5Lcreate_hard( getLocId(), curr_name, H5L_SAME_LOC, new_name, H5P_DEFAULT, H5P_DEFAULT );
- break;
-
- case H5L_TYPE_SOFT:
- ret_value = H5Lcreate_soft( curr_name, getLocId(), new_name, H5P_DEFAULT, H5P_DEFAULT );
- break;
-
- case H5L_TYPE_ERROR:
- case H5L_TYPE_EXTERNAL:
- case H5L_TYPE_MAX:
- default:
- throwException("link", "unknown link type");
- break;
- } /* end switch */
-
- if( ret_value < 0 )
- throwException("link", "creating link failed");
-}
-
-//--------------------------------------------------------------------------
-// Function: CommonFG::link
-///\brief This is an overloaded member function, provided for convenience.
-/// It differs from the above function in that it takes an
-/// \c H5std_string for \a curr_name and \a new_name.
-// Programmer Binh-Minh Ribler - 2000
-//--------------------------------------------------------------------------
-void CommonFG::link( H5L_type_t link_type, const H5std_string& curr_name, const H5std_string& new_name ) const
-{
- link( link_type, curr_name.c_str(), new_name.c_str() );
-}
-
-//--------------------------------------------------------------------------
-// Function: CommonFG::unlink
-///\brief Removes the specified name at this location.
-///\param name - IN: Name of the object to be removed
-///\exception H5::FileIException or H5::GroupIException
-// Programmer Binh-Minh Ribler - 2000
-// Modification
-// 2007: QAK modified to use H5L APIs - BMR
-//--------------------------------------------------------------------------
-void CommonFG::unlink( const char* name ) const
-{
- herr_t ret_value = H5Ldelete( getLocId(), name, H5P_DEFAULT );
- if( ret_value < 0 )
- throwException("unlink", "H5Ldelete failed");
-}
-
-//--------------------------------------------------------------------------
-// Function: CommonFG::unlink
-///\brief This is an overloaded member function, provided for convenience.
-/// It differs from the above function in that it takes an
-/// \c H5std_string for \a name.
-// Programmer Binh-Minh Ribler - 2000
-//--------------------------------------------------------------------------
-void CommonFG::unlink( const H5std_string& name ) const
-{
- unlink( name.c_str() );
-}
-
-//--------------------------------------------------------------------------
-// Function: CommonFG::move
-///\brief Renames an object at this location.
-///\param src - IN: Object's original name
-///\param dst - IN: Object's new name
-///\exception H5::FileIException or H5::GroupIException
-///\note
-/// Exercise care in moving groups as it is possible to render
-/// data in a file inaccessible with Group::move. Please refer
-/// to the Group Interface in the HDF5 User's Guide for details at:
-/// https://www.hdfgroup.org/HDF5/doc/UG/HDF5_Users_Guide-Responsive%20HTML5/index.html#t=HDF5_Users_Guide%2FGroups%2FHDF5_Groups.htm
-// Programmer Binh-Minh Ribler - 2000
-// Modification
-// 2007: QAK modified to use H5L APIs - BMR
-//--------------------------------------------------------------------------
-void CommonFG::move( const char* src, const char* dst ) const
-{
- herr_t ret_value = H5Lmove( getLocId(), src, H5L_SAME_LOC, dst, H5P_DEFAULT, H5P_DEFAULT );
- if( ret_value < 0 )
- throwException("move", "H5Lmove failed");
-}
-
-//--------------------------------------------------------------------------
-// Function: CommonFG::move
-///\brief This is an overloaded member function, provided for convenience.
-/// It differs from the above function in that it takes an
-/// \c H5std_string for \a src and \a dst.
-// Programmer Binh-Minh Ribler - 2000
-//--------------------------------------------------------------------------
-void CommonFG::move( const H5std_string& src, const H5std_string& dst ) const
-{
- move( src.c_str(), dst.c_str() );
-}
-
-#ifndef H5_NO_DEPRECATED_SYMBOLS
-//--------------------------------------------------------------------------
-// Function: CommonFG::getObjinfo
-///\brief Returns information about an object.
-///\param name - IN: Name of the object
-///\param follow_link - IN: Link flag
-///\param statbuf - OUT: Buffer to return information about the object
-///\exception H5::FileIException or H5::GroupIException
-///\par Description
-/// For more information, please refer to the C layer Reference
-/// Manual at:
-/// http://www.hdfgroup.org/HDF5/doc/RM/RM_H5G.html#Group-GetObjinfo
-// Programmer Binh-Minh Ribler - 2000
-//--------------------------------------------------------------------------
-void CommonFG::getObjinfo( const char* name, hbool_t follow_link, H5G_stat_t& statbuf ) const
-{
- herr_t ret_value = H5Gget_objinfo( getLocId(), name, follow_link, &statbuf );
- if( ret_value < 0 )
- throwException("getObjinfo", "H5Gget_objinfo failed");
-}
-
-//--------------------------------------------------------------------------
-// Function: CommonFG::getObjinfo
-///\brief This is an overloaded member function, provided for convenience.
-/// It differs from the above function in that it takes an
-/// \c H5std_string for \a name.
-// Programmer Binh-Minh Ribler - 2000
-//--------------------------------------------------------------------------
-void CommonFG::getObjinfo( const H5std_string& name, hbool_t follow_link, H5G_stat_t& statbuf ) const
-{
- getObjinfo( name.c_str(), follow_link, statbuf );
-}
-
-//--------------------------------------------------------------------------
-// Function: CommonFG::getObjinfo
-///\brief This is an overloaded member function, provided for convenience.
-/// It differs from the above functions in that it doesn't have
-/// the paramemter \a follow_link.
-// Programmer Binh-Minh Ribler - Nov, 2005
-// Note: need to modify to use H5Oget_info and H5Lget_info - BMR
-//--------------------------------------------------------------------------
-void CommonFG::getObjinfo( const char* name, H5G_stat_t& statbuf ) const
-{
- herr_t ret_value = H5Gget_objinfo( getLocId(), name, 0, &statbuf );
- if( ret_value < 0 )
- throwException("getObjinfo", "H5Gget_objinfo failed");
-}
-
-//--------------------------------------------------------------------------
-// Function: CommonFG::getObjinfo
-///\brief This is an overloaded member function, provided for convenience.
-/// It differs from the above function in that it takes an
-/// \c H5std_string for \a name.
-// Programmer Binh-Minh Ribler - Nov, 2005
-//--------------------------------------------------------------------------
-void CommonFG::getObjinfo( const H5std_string& name, H5G_stat_t& statbuf ) const
-{
- getObjinfo( name.c_str(), statbuf );
-}
-#endif /* H5_NO_DEPRECATED_SYMBOLS */
-
-//--------------------------------------------------------------------------
-// Function: CommonFG::getLinkval
-///\brief Returns the name of the object that the symbolic link points to.
-///\param name - IN: Symbolic link to the object
-///\param size - IN: Maximum number of characters of value to be returned
-///\return Name of the object
-///\exception H5::FileIException or H5::GroupIException
-// Programmer Binh-Minh Ribler - 2000
-//--------------------------------------------------------------------------
-H5std_string CommonFG::getLinkval( const char* name, size_t size ) const
-{
- H5L_info_t linkinfo;
- char *value_C; // value in C string
- size_t val_size = size;
- H5std_string value = "";
- herr_t ret_value;
-
- // if user doesn't provide buffer size, determine it
- if (size == 0)
- {
- ret_value = H5Lget_info(getLocId(), name, &linkinfo, H5P_DEFAULT);
- if( ret_value < 0 )
- throwException("getLinkval", "H5Lget_info to find buffer size failed");
-
- val_size = linkinfo.u.val_size;
- }
-
- // if link has value, retrieve the value, otherwise, return null string
- if (val_size > 0)
- {
- value_C = new char[val_size+1]; // temporary C-string for C API
- HDmemset(value_C, 0, val_size+1); // clear buffer
-
- ret_value = H5Lget_val(getLocId(), name, value_C, val_size, H5P_DEFAULT);
- if( ret_value < 0 )
- {
- delete []value_C;
- throwException("getLinkval", "H5Lget_val failed");
- }
-
- value = H5std_string(value_C);
- delete []value_C;
- }
- return(value);
-}
-
-//--------------------------------------------------------------------------
-// Function: CommonFG::getLinkval
-///\brief This is an overloaded member function, provided for convenience.
-/// It differs from the above function in that it takes an
-/// \c H5std_string for \a name.
-// Programmer Binh-Minh Ribler - 2000
-//--------------------------------------------------------------------------
-H5std_string CommonFG::getLinkval( const H5std_string& name, size_t size ) const
-{
- return( getLinkval( name.c_str(), size ));
-}
-
-//--------------------------------------------------------------------------
-// Function: CommonFG::mount
-///\brief Mounts the file \a child onto this group.
-///\param name - IN: Name of the group
-///\param child - IN: File to mount
-///\param plist - IN: Property list to use
-///\exception H5::FileIException or H5::GroupIException
-// Programmer Binh-Minh Ribler - 2014 (original 2000)
-//--------------------------------------------------------------------------
-void CommonFG::mount(const char* name, const H5File& child, const PropList& plist ) const
-{
- // Obtain identifiers for C API
- hid_t plist_id = plist.getId();
- hid_t child_id = child.getId();
-
- // Call C routine H5Fmount to do the mouting
- herr_t ret_value = H5Fmount( getLocId(), name, child_id, plist_id );
-
- // Raise exception if H5Fmount returns negative value
- if( ret_value < 0 )
- throwException("mount", "H5Fmount failed");
-}
-
-//--------------------------------------------------------------------------
-// Function: CommonFG::mount
-// Purpose This is an overloaded member function, kept for backward
-// compatibility. It differs from the above function in that it
-// misses const's. This wrapper will be removed in future release.
-// Param name - IN: Name of the group
-// Param child - IN: File to mount
-// Param plist - IN: Property list to use
-// Exception H5::FileIException or H5::GroupIException
-// Programmer Binh-Minh Ribler - 2000
-// Modification
-// Modified to call its replacement. -BMR, 2014/04/16
-// Removed from documentation. -BMR, 2016/03/07
-//--------------------------------------------------------------------------
-void CommonFG::mount(const char* name, H5File& child, PropList& plist) const
-{
- mount(name, child, plist);
-}
-
-//--------------------------------------------------------------------------
-// Function: CommonFG::mount
-///\brief This is an overloaded member function, provided for convenience.
-/// It takes an \c H5std_string for \a name.
-// Programmer Binh-Minh Ribler - 2000
-//--------------------------------------------------------------------------
-void CommonFG::mount(const H5std_string& name, const H5File& child, const PropList& plist) const
-{
- mount(name.c_str(), child, plist);
-}
-
-//--------------------------------------------------------------------------
-// Function: CommonFG::mount
-// Purpose This is an overloaded member function, kept for backward
-// compatibility. It differs from the above function in that it
-// misses const's. This wrapper will be removed in future release.
-// Programmer Binh-Minh Ribler - 2014
-// Modification
-// Modified to call its replacement. -BMR, 2014/04/16
-// Removed from documentation. -BMR, 2016/03/07
-//--------------------------------------------------------------------------
-void CommonFG::mount(const H5std_string& name, H5File& child, PropList& plist) const
-{
- mount(name.c_str(), child, plist);
-}
-
-//--------------------------------------------------------------------------
-// Function: CommonFG::unmount
-///\brief Unmounts the specified file.
-///\param name - IN: Name of the file to unmount
-///\exception H5::FileIException or H5::GroupIException
-// Programmer Binh-Minh Ribler - 2000
-//--------------------------------------------------------------------------
-void CommonFG::unmount( const char* name ) const
-{
- // Call C routine H5Fmount to do the mouting
- herr_t ret_value = H5Funmount( getLocId(), name );
-
- // Raise exception if H5Funmount returns negative value
- if( ret_value < 0 )
- throwException("unmount", "H5Funmount failed");
-}
-
-//--------------------------------------------------------------------------
-// Function: CommonFG::unmount
-///\brief This is an overloaded member function, provided for convenience.
-/// It differs from the above function in that it takes an
-/// \c H5std_string for \a name.
-// Programmer Binh-Minh Ribler - 2000
-//--------------------------------------------------------------------------
-void CommonFG::unmount( const H5std_string& name ) const
-{
- unmount( name.c_str() );
-}
-
-//--------------------------------------------------------------------------
-// Function: CommonFG::openDataType
-///\brief Opens the named generic datatype at this location.
-///\param name - IN: Name of the datatype to open
-///\return DataType instance
-///\exception H5::FileIException or H5::GroupIException
-// Programmer Binh-Minh Ribler - 2000
-//--------------------------------------------------------------------------
-DataType CommonFG::openDataType( const char* name ) const
-{
- // Call C function H5Topen2 to open the named datatype in this group,
- // given either the file or group id
- hid_t type_id = H5Topen2(getLocId(), name, H5P_DEFAULT);
-
- // If the datatype's opening failed, throw an exception
- if( type_id < 0 )
- throwException("openDataType", "H5Topen2 failed");
-
- // No failure, create and return the DataType object
- DataType data_type;
- f_DataType_setId(&data_type, type_id);
- return(data_type);
-}
-
-//--------------------------------------------------------------------------
-// Function: CommonFG::openDataType
-///\brief This is an overloaded member function, provided for convenience.
-/// It differs from the above function in that it takes an
-/// \c H5std_string for \a name.
-// Programmer Binh-Minh Ribler - 2000
-//--------------------------------------------------------------------------
-DataType CommonFG::openDataType( const H5std_string& name ) const
-{
- return( openDataType( name.c_str()) );
-}
-
-//--------------------------------------------------------------------------
-// Function: CommonFG::openArrayType
-///\brief Opens the named array datatype at this location.
-///\param name - IN: Name of the array datatype to open
-///\return ArrayType instance
-///\exception H5::FileIException or H5::GroupIException
-// Programmer Binh-Minh Ribler - Jul, 2005
-//--------------------------------------------------------------------------
-ArrayType CommonFG::openArrayType( const char* name ) const
-{
- // Call C function H5Topen2 to open the named datatype in this group,
- // given either the file or group id
- hid_t type_id = H5Topen2(getLocId(), name, H5P_DEFAULT);
-
- // If the datatype's opening failed, throw an exception
- if( type_id < 0 )
- throwException("openArrayType", "H5Topen2 failed");
-
- // No failure, create and return the ArrayType object
- ArrayType array_type;
- f_DataType_setId(&array_type, type_id);
- return(array_type);
-}
-
-//--------------------------------------------------------------------------
-// Function: CommonFG::openArrayType
-///\brief This is an overloaded member function, provided for convenience.
-/// It differs from the above function in that it takes an
-/// \c H5std_string for \a name.
-// Programmer Binh-Minh Ribler - Jul, 2005
-//--------------------------------------------------------------------------
-ArrayType CommonFG::openArrayType( const H5std_string& name ) const
-{
- return( openArrayType( name.c_str()) );
-}
-
-//--------------------------------------------------------------------------
-// Function: CommonFG::openCompType
-///\brief Opens the named compound datatype at this location.
-///\param name - IN: Name of the compound datatype to open
-///\return CompType instance
-///\exception H5::FileIException or H5::GroupIException
-// Programmer Binh-Minh Ribler - 2000
-//--------------------------------------------------------------------------
-CompType CommonFG::openCompType( const char* name ) const
-{
- // Call C function H5Topen2 to open the named datatype in this group,
- // given either the file or group id
- hid_t type_id = H5Topen2(getLocId(), name, H5P_DEFAULT);
-
- // If the datatype's opening failed, throw an exception
- if( type_id < 0 )
- throwException("openCompType", "H5Topen2 failed");
-
- // No failure, create and return the CompType object
- CompType comp_type;
- f_DataType_setId(&comp_type, type_id);
- return(comp_type);
-}
-
-//--------------------------------------------------------------------------
-// Function: CommonFG::openCompType
-///\brief This is an overloaded member function, provided for convenience.
-/// It differs from the above function in that it takes an
-/// \c H5std_string for \a name.
-// Programmer Binh-Minh Ribler - 2000
-//--------------------------------------------------------------------------
-CompType CommonFG::openCompType( const H5std_string& name ) const
-{
- return( openCompType( name.c_str()) );
-}
-
-//--------------------------------------------------------------------------
-// Function: CommonFG::openEnumType
-///\brief Opens the named enumeration datatype at this location.
-///\param name - IN: Name of the enumeration datatype to open
-///\return EnumType instance
-///\exception H5::FileIException or H5::GroupIException
-// Programmer Binh-Minh Ribler - 2000
-//--------------------------------------------------------------------------
-EnumType CommonFG::openEnumType( const char* name ) const
-{
- // Call C function H5Topen2 to open the named datatype in this group,
- // given either the file or group id
- hid_t type_id = H5Topen2(getLocId(), name, H5P_DEFAULT);
-
- // If the datatype's opening failed, throw an exception
- if( type_id < 0 )
- throwException("openEnumType", "H5Topen2 failed");
-
- // No failure, create and return the EnumType object
- EnumType enum_type;
- f_DataType_setId(&enum_type, type_id);
- return(enum_type);
-}
-
-//--------------------------------------------------------------------------
-// Function: CommonFG::openEnumType
-///\brief This is an overloaded member function, provided for convenience.
-/// It differs from the above function in that it takes an
-/// \c H5std_string for \a name.
-// Programmer Binh-Minh Ribler - 2000
-//--------------------------------------------------------------------------
-EnumType CommonFG::openEnumType( const H5std_string& name ) const
-{
- return( openEnumType( name.c_str()) );
-}
-
-//--------------------------------------------------------------------------
-// Function: CommonFG::openIntType
-///\brief Opens the named integer datatype at this location.
-///\param name - IN: Name of the integer datatype to open
-///\return IntType instance
-///\exception H5::FileIException or H5::GroupIException
-// Programmer Binh-Minh Ribler - 2000
-//--------------------------------------------------------------------------
-IntType CommonFG::openIntType( const char* name ) const
-{
- // Call C function H5Topen2 to open the named datatype in this group,
- // given either the file or group id
- hid_t type_id = H5Topen2(getLocId(), name, H5P_DEFAULT);
-
- // If the datatype's opening failed, throw an exception
- if( type_id < 0 )
- throwException("openIntType", "H5Topen2 failed");
-
- // No failure, create and return the IntType object
- IntType int_type;
- f_DataType_setId(&int_type, type_id);
- return(int_type);
-}
-
-//--------------------------------------------------------------------------
-// Function: CommonFG::openIntType
-///\brief This is an overloaded member function, provided for convenience.
-/// It differs from the above function in that it takes an
-/// \c H5std_string for \a name.
-// Programmer Binh-Minh Ribler - 2000
-//--------------------------------------------------------------------------
-IntType CommonFG::openIntType( const H5std_string& name ) const
-{
- return( openIntType( name.c_str()) );
-}
-
-//--------------------------------------------------------------------------
-// Function: CommonFG::openFloatType
-///\brief Opens the named floating-point datatype at this location.
-///\param name - IN: Name of the floating-point datatype to open
-///\return FloatType instance
-///\exception H5::FileIException or H5::GroupIException
-// Programmer Binh-Minh Ribler - 2000
-//--------------------------------------------------------------------------
-FloatType CommonFG::openFloatType( const char* name ) const
-{
- // Call C function H5Topen2 to open the named datatype in this group,
- // given either the file or group id
- hid_t type_id = H5Topen2(getLocId(), name, H5P_DEFAULT);
-
- // If the datatype's opening failed, throw an exception
- if( type_id < 0 )
- throwException("openFloatType", "H5Topen2 failed");
-
- // No failure, create and return the FloatType object
- FloatType float_type;
- f_DataType_setId(&float_type, type_id);
- return(float_type);
-}
-
-//--------------------------------------------------------------------------
-// Function: CommonFG::openFloatType
-///\brief This is an overloaded member function, provided for convenience.
-/// It differs from the above function in that it takes an
-/// \c H5std_string for \a name.
-// Programmer Binh-Minh Ribler - 2000
-//--------------------------------------------------------------------------
-FloatType CommonFG::openFloatType( const H5std_string& name ) const
-{
- return( openFloatType( name.c_str()) );
-}
-
-//--------------------------------------------------------------------------
-// Function: CommonFG::openStrType
-///\brief Opens the named string datatype at this location.
-///\param name - IN: Name of the string datatype to open
-///\return StrType instance
-///\exception H5::FileIException or H5::GroupIException
-// Programmer Binh-Minh Ribler - 2000
-//--------------------------------------------------------------------------
-StrType CommonFG::openStrType( const char* name ) const
-{
- // Call C function H5Topen2 to open the named datatype in this group,
- // given either the file or group id
- hid_t type_id = H5Topen2(getLocId(), name, H5P_DEFAULT);
-
- // If the datatype's opening failed, throw an exception
- if( type_id < 0 )
- throwException("openStrType", "H5Topen2 failed");
-
- // No failure, create and return the StrType object
- StrType str_type;
- f_DataType_setId(&str_type, type_id);
- return(str_type);
-}
-
-//--------------------------------------------------------------------------
-// Function: CommonFG::openStrType
-///\brief This is an overloaded member function, provided for convenience.
-/// It differs from the above function in that it takes an
-/// \c H5std_string for \a name.
-// Programmer Binh-Minh Ribler - 2000
-//--------------------------------------------------------------------------
-StrType CommonFG::openStrType( const H5std_string& name ) const
-{
- return( openStrType( name.c_str()) );
-}
-
-//--------------------------------------------------------------------------
-// Function: CommonFG::openVarLenType
-///\brief Opens the named variable length datatype at this location.
-///\param name - IN: Name of the variable length datatype to open
-///\return VarLenType instance
-///\exception H5::FileIException or H5::GroupIException
-// Programmer Binh-Minh Ribler - Jul, 2005
-//--------------------------------------------------------------------------
-VarLenType CommonFG::openVarLenType( const char* name ) const
-{
- // Call C function H5Topen2 to open the named datatype in this group,
- // given either the file or group id
- hid_t type_id = H5Topen2(getLocId(), name, H5P_DEFAULT);
-
- // If the datatype's opening failed, throw an exception
- if( type_id < 0 )
- throwException("openVarLenType", "H5Topen2 failed");
-
- // No failure, create and return the VarLenType object
- VarLenType varlen_type;
- f_DataType_setId(&varlen_type, type_id);
- return(varlen_type);
-}
-
-//--------------------------------------------------------------------------
-// Function: CommonFG::openVarLenType
-///\brief This is an overloaded member function, provided for convenience.
-/// It differs from the above function in that it takes an
-/// \c H5std_string for \a name.
-// Programmer Binh-Minh Ribler - Jul, 2005
-//--------------------------------------------------------------------------
-VarLenType CommonFG::openVarLenType( const H5std_string& name ) const
-{
- return( openVarLenType( name.c_str()) );
-}
-
-#ifndef H5_NO_DEPRECATED_SYMBOLS
-//--------------------------------------------------------------------------
-// Function: CommonFG::iterateElems
-///\brief Iterates a user's function over the entries of a group.
-///\param name - IN : Name of group to iterate over
-///\param idx - IN/OUT: Starting (IN) and ending (OUT) entry indices
-///\param op - IN : User's function to operate on each entry
-///\param op_data - IN/OUT: Data associated with the operation
-///\return The return value of the first operator that returns non-zero,
-/// or zero if all members were processed with no operator
-/// returning non-zero.
-///\exception H5::FileIException or H5::GroupIException
-// Programmer Binh-Minh Ribler - 2000
-//--------------------------------------------------------------------------
-int CommonFG::iterateElems( const char* name, int *idx, H5G_iterate_t op , void* op_data )
-{
- int ret_value = H5Giterate( getLocId(), name, idx, op, op_data );
- if( ret_value < 0 )
- {
- throwException("iterateElems", "H5Giterate failed");
- }
- return( ret_value );
-}
-
-//--------------------------------------------------------------------------
-// Function: CommonFG::iterateElems
-///\brief This is an overloaded member function, provided for convenience.
-/// It differs from the above function in that it takes an
-/// \c H5std_string for \a name.
-// Programmer Binh-Minh Ribler - 2000
-//--------------------------------------------------------------------------
-int CommonFG::iterateElems( const H5std_string& name, int *idx, H5G_iterate_t op , void* op_data )
-{
- return( iterateElems( name.c_str(), idx, op, op_data ));
-}
-#endif /* H5_NO_DEPRECATED_SYMBOLS */
-
-//--------------------------------------------------------------------------
-// Function: CommonFG::getNumObjs
-///\brief Returns the number of objects in this group.
-///\return Number of objects
-///\exception H5::FileIException or H5::GroupIException
-// Programmer Binh-Minh Ribler - January, 2003
-//--------------------------------------------------------------------------
-hsize_t CommonFG::getNumObjs() const
-{
- H5G_info_t ginfo; /* Group information */
-
- herr_t ret_value = H5Gget_info(getLocId(), &ginfo);
- if(ret_value < 0)
- throwException("getNumObjs", "H5Gget_info failed");
- return (ginfo.nlinks);
-}
-
-//--------------------------------------------------------------------------
-// Function: CommonFG::getObjnameByIdx
-///\brief Returns the name of an object in this group, given the
-/// object's index.
-///\param idx - IN: Transient index of the object
-///\return Object name
-///\exception H5::FileIException or H5::GroupIException
-///\par Description
-/// The value of idx can be any nonnegative number less than the
-/// total number of objects in the group, which is returned by
-/// the function \c CommonFG::getNumObjs. Note that this is a
-/// transient index; thus, an object may have a different index
-/// each time the group is opened.
-// Programmer Binh-Minh Ribler - Mar, 2005
-//--------------------------------------------------------------------------
-H5std_string CommonFG::getObjnameByIdx(hsize_t idx) const
-{
- // call H5Lget_name_by_idx with name as NULL to get its length
- ssize_t name_len = H5Lget_name_by_idx(getLocId(), ".", H5_INDEX_NAME, H5_ITER_INC, idx, NULL, 0, H5P_DEFAULT);
- if(name_len < 0)
- throwException("getObjnameByIdx", "H5Lget_name_by_idx failed");
-
- // now, allocate C buffer to get the name
- char* name_C = new char[name_len+1];
- HDmemset(name_C, 0, name_len+1); // clear buffer
-
- name_len = H5Lget_name_by_idx(getLocId(), ".", H5_INDEX_NAME, H5_ITER_INC, idx, name_C, name_len+1, H5P_DEFAULT);
-
- if (name_len < 0)
- {
- delete []name_C;
- throwException("getObjnameByIdx", "H5Lget_name_by_idx failed");
- }
-
- // clean up and return the string
- H5std_string name = H5std_string(name_C);
- delete []name_C;
- return (name);
-}
-
-//--------------------------------------------------------------------------
-// Function: CommonFG::getObjnameByIdx
-///\brief Retrieves the name of an object in this group, given the
-/// object's index.
-///\param idx - IN: Transient index of the object
-///\param name - IN/OUT: Retrieved name of the object
-///\param size - IN: Length to retrieve
-///\return Actual size of the object name or 0, if object has no name
-///\exception H5::FileIException or H5::GroupIException
-///\par Description
-/// The value of idx can be any nonnegative number less than the
-/// total number of objects in the group, which is returned by
-/// the function \c CommonFG::getNumObjs. Note that this is a
-/// transient index; thus, an object may have a different index
-/// each time the group is opened.
-// Programmer Binh-Minh Ribler - January, 2003
-//--------------------------------------------------------------------------
-ssize_t CommonFG::getObjnameByIdx(hsize_t idx, char* name, size_t size) const
-{
- ssize_t name_len = H5Lget_name_by_idx(getLocId(), ".", H5_INDEX_NAME, H5_ITER_INC, idx, name, size, H5P_DEFAULT);
- if(name_len < 0)
- throwException("getObjnameByIdx", "H5Lget_name_by_idx failed");
-
- return (name_len);
-}
-
-//--------------------------------------------------------------------------
-// Function: CommonFG::getObjnameByIdx
-///\brief This is an overloaded member function, provided for convenience.
-/// It differs from the above function in that it takes an
-/// \c H5std_string for \a name.
-// Programmer Binh-Minh Ribler - January, 2003
-//--------------------------------------------------------------------------
-ssize_t CommonFG::getObjnameByIdx(hsize_t idx, H5std_string& name, size_t size) const
-{
- char* name_C = new char[size+1]; // temporary C-string for object name
- HDmemset(name_C, 0, size+1); // clear buffer
-
- // call overloaded function to get the name
- ssize_t name_len = getObjnameByIdx(idx, name_C, size+1);
- if(name_len < 0)
- {
- delete []name_C;
- throwException("getObjnameByIdx", "H5Lget_name_by_idx failed");
- }
-
- // clean up and return the string
- name = H5std_string(name_C);
- delete []name_C;
- return (name_len);
-}
-
-//--------------------------------------------------------------------------
-// Function: CommonFG::childObjType
-///\brief Returns the type of an object in this file/group, given the
-/// object's name.
-///\param objname - IN: Name of the object
-///\return Object type, which can have the following values for group,
-/// dataset, and named datatype
-/// \li \c H5O_TYPE_GROUP
-/// \li \c H5O_TYPE_DATASET
-/// \li \c H5O_TYPE_NAMED_DATATYPE
-/// Refer to the C API documentation for more details:
-/// http://www.hdfgroup.org/HDF5/doc/RM/RM_H5O.html#Object-GetInfo
-///\exception H5::FileIException or H5::GroupIException
-/// Exception will be thrown when:
-/// - an error returned by the C API
-/// - object type is not one of the valid values above
-// Programmer Binh-Minh Ribler - April, 2014
-//--------------------------------------------------------------------------
-H5O_type_t CommonFG::childObjType(const char* objname) const
-{
- H5O_info_t objinfo;
- H5O_type_t objtype = H5O_TYPE_UNKNOWN;
-
- // Use C API to get information of the object
- herr_t ret_value = H5Oget_info_by_name(getLocId(), objname, &objinfo, H5P_DEFAULT);
-
- // Throw exception if C API returns failure
- if (ret_value < 0)
- throwException("childObjType", "H5Oget_info_by_name failed");
- // Return a valid type or throw an exception for unknown type
- else
- switch (objinfo.type)
- {
- case H5O_TYPE_GROUP:
- case H5O_TYPE_DATASET:
- case H5O_TYPE_NAMED_DATATYPE:
- objtype = objinfo.type;
- break;
- case H5O_TYPE_UNKNOWN:
- case H5O_TYPE_NTYPES:
- default:
- throwException("childObjType", "Unknown type of object");
- }
- return(objtype);
-}
-
-//--------------------------------------------------------------------------
-// Function: CommonFG::childObjType
-///\brief This is an overloaded member function, provided for convenience.
-/// It takes an \a H5std_string for the object's name.
-///\brief Returns the type of an object in this group, given the
-/// object's name.
-///\param objname - IN: Name of the object (H5std_string&)
-///\exception H5::FileIException or H5::GroupIException
-// Programmer Binh-Minh Ribler - April, 2014
-//--------------------------------------------------------------------------
-H5O_type_t CommonFG::childObjType(const H5std_string& objname) const
-{
- // Use overloaded function
- H5O_type_t objtype = childObjType(objname.c_str());
- return(objtype);
-}
-
-//--------------------------------------------------------------------------
-// Function: CommonFG::childObjType
-///\brief Returns the type of an object in this file/group, given the
-/// object's index and its type and order.
-///\param index - IN: Position of the object
-///\param index_type - IN: Type of the index, default to H5_INDEX_NAME
-///\param order - IN: Traversing order, default to H5_ITER_INC
-///\param objname - IN: Name of the object, default to "."
-///\return Object type, which can have the following values for group,
-/// dataset, and named datatype
-/// \li \c H5O_TYPE_GROUP
-/// \li \c H5O_TYPE_DATASET
-/// \li \c H5O_TYPE_NAMED_DATATYPE
-/// Refer to the C API documentation for more details:
-/// http://www.hdfgroup.org/HDF5/doc/RM/RM_H5O.html#Object-GetInfo
-///\exception H5::FileIException or H5::GroupIException
-/// Exception will be thrown when:
-/// - an error returned by the C API
-/// - object type is not one of the valid values above
-// Developer's Notes:
-// - this overload uses H5Oget_info_by_idx instead of H5Oget_info_by_name
-// like the previous childObjType()
-// - index is the required argument so, first
-// - objname is last because it's more likely the location is already
-// fully specified
-// - Leave property list out for now because C API is not using it, it
-// can be added later when needed.
-// Programmer Binh-Minh Ribler - April, 2014
-//--------------------------------------------------------------------------
-H5O_type_t CommonFG::childObjType(hsize_t index, H5_index_t index_type, H5_iter_order_t order, const char* objname) const
-{
- herr_t ret_value;
- H5O_info_t objinfo;
- H5O_type_t objtype = H5O_TYPE_UNKNOWN;
-
- // Use C API to get information of the object
- ret_value = H5Oget_info_by_idx(getLocId(), objname, index_type, order, index, &objinfo, H5P_DEFAULT);
-
- // Throw exception if C API returns failure
- if (ret_value < 0)
- throwException("childObjType", "H5Oget_info_by_idx failed");
- // Return a valid type or throw an exception for unknown type
- else
- switch (objinfo.type)
- {
- case H5O_TYPE_GROUP:
- case H5O_TYPE_DATASET:
- case H5O_TYPE_NAMED_DATATYPE:
- objtype = objinfo.type;
- break;
- case H5O_TYPE_UNKNOWN:
- case H5O_TYPE_NTYPES:
- default:
- throwException("childObjType", "Unknown type of object");
- }
- return(objtype);
-}
-
-//--------------------------------------------------------------------------
-// Function: CommonFG::childObjVersion
-///\brief Returns the object header version of an object in this file/group,
-/// given the object's name.
-///\param objname - IN: Name of the object
-///\return Object version, which can have the following values:
-/// \li \c H5O_VERSION_1
-/// \li \c H5O_VERSION_2
-///\exception H5::FileIException or H5::GroupIException
-/// Exception will be thrown when:
-/// - an error returned by the C API
-/// - version number is not one of the valid values above
-// Programmer Binh-Minh Ribler - April, 2014
-//--------------------------------------------------------------------------
-unsigned CommonFG::childObjVersion(const char* objname) const
-{
- H5O_info_t objinfo;
- unsigned version = 0;
-
- // Use C API to get information of the object
- herr_t ret_value = H5Oget_info_by_name(getLocId(), objname, &objinfo, H5P_DEFAULT);
-
- // Throw exception if C API returns failure
- if (ret_value < 0)
- throwException("childObjVersion", "H5Oget_info_by_name failed");
- // Return a valid version or throw an exception for invalid value
- else
- {
- version = objinfo.hdr.version;
- if (version != H5O_VERSION_1 && version != H5O_VERSION_2)
- throwException("childObjVersion", "Invalid version for object");
- }
- return(version);
-}
-
-//--------------------------------------------------------------------------
-// Function: CommonFG::childObjVersion
-///\brief This is an overloaded member function, provided for convenience.
-/// It takes an \a H5std_string for the object's name.
-///\brief Returns the type of an object in this group, given the
-/// object's name.
-///\param objname - IN: Name of the object (H5std_string&)
-///\exception H5::FileIException or H5::GroupIException
-// Programmer Binh-Minh Ribler - April, 2014
-//--------------------------------------------------------------------------
-unsigned CommonFG::childObjVersion(const H5std_string& objname) const
-{
- // Use overloaded function
- unsigned version = childObjVersion(objname.c_str());
- return(version);
-}
-
-#ifndef H5_NO_DEPRECATED_SYMBOLS
-#ifndef DOXYGEN_SHOULD_SKIP_THIS
-//--------------------------------------------------------------------------
-// Function: CommonFG::getObjTypeByIdx
-///\brief Returns the type of an object in this group, given the
-/// object's index.
-///\param idx - IN: Transient index of the object
-///\return Object type
-///\exception H5::FileIException or H5::GroupIException
-// Programmer Binh-Minh Ribler - January, 2003
-//--------------------------------------------------------------------------
-H5G_obj_t CommonFG::getObjTypeByIdx(hsize_t idx) const
-{
- H5G_obj_t obj_type = H5Gget_objtype_by_idx(getLocId(), idx);
- if (obj_type == H5G_UNKNOWN)
- throwException("getObjTypeByIdx", "H5Gget_objtype_by_idx failed");
-
- return (obj_type);
-}
-
-//--------------------------------------------------------------------------
-// Function: CommonFG::getObjTypeByIdx
-///\brief This is an overloaded member function, provided for convenience.
-/// It differs from the above function because it also provides
-/// the returned object type in text (char*)
-///\param idx - IN: Transient index of the object
-///\param type_name - OUT: Object type in text
-///\return Object type
-///\exception H5::FileIException or H5::GroupIException
-// Programmer Binh-Minh Ribler - May, 2010
-// Modification
-// Modified to use the other function. -BMR, 2016/03/07
-//--------------------------------------------------------------------------
-H5G_obj_t CommonFG::getObjTypeByIdx(hsize_t idx, char* type_name) const
-{
- H5std_string stype_name(type_name);
- return(getObjTypeByIdx(idx, stype_name));
-}
-//--------------------------------------------------------------------------
-// Function: CommonFG::getObjTypeByIdx
-///\brief This is an overloaded member function, provided for convenience.
-/// It differs from the above function because it also provides
-/// the returned object type in text (H5std_string&)
-///\param idx - IN: Transient index of the object
-///\param type_name - OUT: Object type in text
-///\return Object type
-///\exception H5::FileIException or H5::GroupIException
-// Programmer Binh-Minh Ribler - January, 2003
-//--------------------------------------------------------------------------
-H5G_obj_t CommonFG::getObjTypeByIdx(hsize_t idx, H5std_string& type_name) const
-{
- H5G_obj_t obj_type = H5Gget_objtype_by_idx(getLocId(), idx);
- switch (obj_type)
- {
- case H5G_LINK: type_name = H5std_string("symbolic link"); break;
- case H5G_GROUP: type_name = H5std_string("group"); break;
- case H5G_DATASET: type_name = H5std_string("dataset"); break;
- case H5G_TYPE: type_name = H5std_string("datatype"); break;
- case H5G_UNKNOWN:
- case H5G_UDLINK:
- case H5G_RESERVED_5:
- case H5G_RESERVED_6:
- case H5G_RESERVED_7:
- default:
- throwException("getObjTypeByIdx", "H5Gget_objtype_by_idx failed");
- }
- return (obj_type);
-}
-
-#endif // DOXYGEN_SHOULD_SKIP_THIS
-#endif /* H5_NO_DEPRECATED_SYMBOLS */
-
#ifndef DOXYGEN_SHOULD_SKIP_THIS
//--------------------------------------------------------------------------
// Function: CommonFG default constructor
@@ -1265,36 +68,6 @@ CommonFG::CommonFG() {}
//--------------------------------------------------------------------------
CommonFG::~CommonFG() {}
-//--------------------------------------------------------------------------
-// Function: f_DataType_setId - friend
-// Purpose: This function is friend to class H5::DataType so that it
-// can set DataType::id in order to work around a problem
-// described in the JIRA issue HDFFV-7947.
-// Applications shouldn't need to use it.
-// param dtype - IN/OUT: DataType object to be changed
-// param new_id - IN: New id to set
-// Programmer Binh-Minh Ribler - 2015
-//--------------------------------------------------------------------------
-void f_DataType_setId(DataType* dtype, hid_t new_id)
-{
- dtype->p_setId(new_id);
-}
-
-//--------------------------------------------------------------------------
-// Function: f_DataSet_setId - friend
-// Purpose: This function is friend to class H5::DataSet so that it
-// can set DataSet::id in order to work around a problem
-// described in the JIRA issue HDFFV-7947.
-// Applications shouldn't need to use it.
-// param dset - IN/OUT: DataSet object to be changed
-// param new_id - IN: New id to set
-// Programmer Binh-Minh Ribler - 2015
-//--------------------------------------------------------------------------
-void f_DataSet_setId(DataSet* dset, hid_t new_id)
-{
- dset->p_setId(new_id);
-}
-
#endif // DOXYGEN_SHOULD_SKIP_THIS
#ifndef H5_NO_NAMESPACE
diff --git a/c++/src/H5CommonFG.h b/c++/src/H5CommonFG.h
index d36d78c..956be21 100644
--- a/c++/src/H5CommonFG.h
+++ b/c++/src/H5CommonFG.h
@@ -21,145 +21,16 @@
namespace H5 {
#endif
-// Class forwarding
-class Group;
-class H5File;
-class ArrayType;
-class VarLenType;
-
/*! \class CommonFG
- \brief \a CommonFG is an abstract base class of H5File and H5Group.
+ \brief \a CommonFG was an abstract base class of H5File and H5Group.
- It provides common operations of H5File and H5Group.
+ It provided common operations of H5File and H5Group.
+ In release 1.10.1, the class structure is modified.
+ As a result, member functions of CommonFG are moved to Group.
*/
class H5_DLLCPP CommonFG {
public:
- // Creates a new group at this location which can be a file
- // or another group.
- Group createGroup(const char* name, size_t size_hint = 0) const;
- Group createGroup(const H5std_string& name, size_t size_hint = 0) const;
-
- // Opens an existing group in a location which can be a file
- // or another group.
- Group openGroup(const char* name) const;
- Group openGroup(const H5std_string& name) const;
-
- // Creates a new dataset at this location.
- DataSet createDataSet(const char* name, const DataType& data_type, const DataSpace& data_space, const DSetCreatPropList& create_plist = DSetCreatPropList::DEFAULT) const;
- DataSet createDataSet(const H5std_string& name, const DataType& data_type, const DataSpace& data_space, const DSetCreatPropList& create_plist = DSetCreatPropList::DEFAULT) const;
-
- // Opens an existing dataset at this location.
- DataSet openDataSet(const char* name) const;
- DataSet openDataSet(const H5std_string& name) const;
-
- // Returns the value of a symbolic link.
- H5std_string getLinkval(const char* link_name, size_t size=0) const;
- H5std_string getLinkval(const H5std_string& link_name, size_t size=0) const;
-
- // Returns the number of objects in this group.
- hsize_t getNumObjs() const;
-
- // Retrieves the name of an object in this group, given the
- // object's index.
- H5std_string getObjnameByIdx(hsize_t idx) const;
- ssize_t getObjnameByIdx(hsize_t idx, char* name, size_t size) const;
- ssize_t getObjnameByIdx(hsize_t idx, H5std_string& name, size_t size) const;
-
- // Retrieves the type of an object in this file or group, given the
- // object's name
- H5O_type_t childObjType(const H5std_string& objname) const;
- H5O_type_t childObjType(const char* objname) const;
- H5O_type_t childObjType(hsize_t index, H5_index_t index_type=H5_INDEX_NAME, H5_iter_order_t order=H5_ITER_INC, const char* objname=".") const;
-
- // Returns the object header version of an object in this file or group,
- // given the object's name.
- unsigned childObjVersion(const char* objname) const;
- unsigned childObjVersion(const H5std_string& objname) const;
-
-#ifndef H5_NO_DEPRECATED_SYMBOLS
- // Returns the type of an object in this group, given the
- // object's index.
- H5G_obj_t getObjTypeByIdx(hsize_t idx) const;
- H5G_obj_t getObjTypeByIdx(hsize_t idx, char* type_name) const;
- H5G_obj_t getObjTypeByIdx(hsize_t idx, H5std_string& type_name) const;
-
- // Returns information about an HDF5 object, given by its name,
- // at this location.
- void getObjinfo(const char* name, hbool_t follow_link, H5G_stat_t& statbuf) const;
- void getObjinfo(const H5std_string& name, hbool_t follow_link, H5G_stat_t& statbuf) const;
- void getObjinfo(const char* name, H5G_stat_t& statbuf) const;
- void getObjinfo(const H5std_string& name, H5G_stat_t& statbuf) const;
-
- // Iterates over the elements of this group - not implemented in
- // C++ style yet.
- int iterateElems(const char* name, int *idx, H5G_iterate_t op, void *op_data);
- int iterateElems(const H5std_string& name, int *idx, H5G_iterate_t op, void *op_data);
-#endif /* H5_NO_DEPRECATED_SYMBOLS */
-
- // Creates a link of the specified type from new_name to current_name;
- // both names are interpreted relative to the specified location id.
- void link(H5L_type_t link_type, const char* curr_name, const char* new_name) const;
- void link(H5L_type_t link_type, const H5std_string& curr_name, const H5std_string& new_name) const;
-
- // Removes the specified name at this location.
- void unlink(const char* name) const;
- void unlink(const H5std_string& name) const;
-
- // Mounts the file 'child' onto this location.
- void mount(const char* name, const H5File& child, const PropList& plist) const;
- void mount(const char* name, H5File& child, PropList& plist) const; // backward compatibility
- void mount(const H5std_string& name, const H5File& child, const PropList& plist) const;
- void mount(const H5std_string& name, H5File& child, PropList& plist) const; // backward compatibility
-
- // Unmounts the file named 'name' from this parent location.
- void unmount(const char* name) const;
- void unmount(const H5std_string& name) const;
-
- // Renames an object at this location.
- void move(const char* src, const char* dst) const;
- void move(const H5std_string& src, const H5std_string& dst) const;
-
- // Opens a generic named datatype in this location.
- DataType openDataType(const char* name) const;
- DataType openDataType(const H5std_string& name) const;
-
- // Opens a named array datatype in this location.
- ArrayType openArrayType(const char* name) const;
- ArrayType openArrayType(const H5std_string& name) const;
-
- // Opens a named compound datatype in this location.
- CompType openCompType(const char* name) const;
- CompType openCompType(const H5std_string& name) const;
-
- // Opens a named enumeration datatype in this location.
- EnumType openEnumType(const char* name) const;
- EnumType openEnumType(const H5std_string& name) const;
-
- // Opens a named integer datatype in this location.
- IntType openIntType(const char* name) const;
- IntType openIntType(const H5std_string& name) const;
-
- // Opens a named floating-point datatype in this location.
- FloatType openFloatType(const char* name) const;
- FloatType openFloatType(const H5std_string& name) const;
-
- // Opens a named string datatype in this location.
- StrType openStrType(const char* name) const;
- StrType openStrType(const H5std_string& name) const;
-
- // Opens a named variable length datatype in this location.
- VarLenType openVarLenType(const char* name) const;
- VarLenType openVarLenType(const H5std_string& name) const;
-
#ifndef DOXYGEN_SHOULD_SKIP_THIS
- /// For subclasses, H5File and Group, to return the correct
- /// object id, i.e. file or group id.
- virtual hid_t getLocId() const = 0;
-
-
- /// For subclasses, H5File and Group, to throw appropriate exception.
- virtual void throwException(const H5std_string& func_name, const H5std_string& msg) const = 0;
-
// Default constructor.
CommonFG();
diff --git a/c++/src/H5CompType.cpp b/c++/src/H5CompType.cpp
index 4585516..6105273 100644
--- a/c++/src/H5CompType.cpp
+++ b/c++/src/H5CompType.cpp
@@ -19,10 +19,10 @@
#include "H5Exception.h"
#include "H5IdComponent.h"
#include "H5PropList.h"
+#include "H5Location.h"
#include "H5Object.h"
#include "H5OcreatProp.h"
#include "H5DcreatProp.h"
-#include "H5CommonFG.h"
#include "H5Alltypes.h"
#include "H5AbstractDs.h"
#include "H5DxferProp.h"
diff --git a/c++/src/H5DataSet.cpp b/c++/src/H5DataSet.cpp
index 8f5ad6f..4b5d0b7 100644
--- a/c++/src/H5DataSet.cpp
+++ b/c++/src/H5DataSet.cpp
@@ -24,6 +24,7 @@
#include "H5Exception.h"
#include "H5IdComponent.h"
#include "H5PropList.h"
+#include "H5Location.h"
#include "H5Object.h"
#include "H5PropList.h"
#include "H5OcreatProp.h"
@@ -31,10 +32,10 @@
#include "H5DcreatProp.h"
#include "H5FaccProp.h"
#include "H5FcreatProp.h"
-#include "H5CommonFG.h"
#include "H5DataType.h"
#include "H5DataSpace.h"
#include "H5AbstractDs.h"
+#include "H5Group.h"
#include "H5File.h"
#include "H5Attribute.h"
#include "H5DataSet.h"
@@ -301,6 +302,8 @@ void DataSet::getSpaceStatus(H5D_space_status_t& status) const
//--------------------------------------------------------------------------
// Function: DataSet::getVlenBufSize
///\brief Returns the number of bytes required to store VL data.
+///\param type - IN: Datatype, which is the datatype for the buffer
+///\param space - IN: Selection for the memory buffer
///\return Amount of storage
///\exception H5::DataSetIException
// Programmer Binh-Minh Ribler - 2000
@@ -331,12 +334,13 @@ hsize_t DataSet::getVlenBufSize(const DataType& type, const DataSpace& space ) c
// Programmer Binh-Minh Ribler - 2000
// Modification
// Modified to call its replacement. -BMR, 2014/04/16
-// Removed from documentation. -BMR, 2016/03/07
+// Removed from documentation. -BMR, 2016/03/07 1.8.17 and 1.10.0
+// Removed from code. -BMR, 2016/08/11 1.8.18 and 1.10.1
//--------------------------------------------------------------------------
-hsize_t DataSet::getVlenBufSize( DataType& type, DataSpace& space ) const
-{
- return(getVlenBufSize(type, space));
-}
+//hsize_t DataSet::getVlenBufSize( DataType& type, DataSpace& space ) const
+//{
+// return(getVlenBufSize(type, space));
+//}
//--------------------------------------------------------------------------
// Function: DataSet::vlenReclaim
@@ -605,7 +609,6 @@ void DataSet::extend( const hsize_t* size ) const
///\exception H5::DataSetIException
// Programmer Binh-Minh Ribler - 2014
// Modification
-// Used the non-const version.
//--------------------------------------------------------------------------
void DataSet::fillMemBuf(const void *fill, const DataType& fill_type, void *buf, const DataType& buf_type, const DataSpace& space) const
{
@@ -633,12 +636,13 @@ void DataSet::fillMemBuf(const void *fill, const DataType& fill_type, void *buf,
// Programmer Binh-Minh Ribler - 2000
// Modification
// Modified to call its replacement. -BMR, 2014/04/16
-// Removed from documentation. -BMR, 2016/03/07
+// Removed from documentation. -BMR, 2016/03/07 1.8.17 and 1.10.0
+// Removed from code. -BMR, 2016/08/11 1.8.18 and 1.10.1
//--------------------------------------------------------------------------
-void DataSet::fillMemBuf(const void *fill, DataType& fill_type, void *buf, DataType& buf_type, DataSpace& space)
-{
- fillMemBuf(fill, (const DataType)fill_type, buf, (const DataType)buf_type, (const DataSpace)space);
-}
+//void DataSet::fillMemBuf(const void *fill, DataType& fill_type, void *buf, DataType& buf_type, DataSpace& space)
+//{
+// fillMemBuf(fill, (const DataType)fill_type, buf, (const DataType)buf_type, (const DataSpace)space);
+//}
//--------------------------------------------------------------------------
// Function: DataSet::fillMemBuf
@@ -672,12 +676,13 @@ void DataSet::fillMemBuf(void *buf, const DataType& buf_type, const DataSpace& s
// Programmer Binh-Minh Ribler - 2000
// Modification
// Modified to call its replacement. -BMR, 2014/04/16
-// Removed from documentation. -BMR, 2016/03/07
+// Removed from documentation. -BMR, 2016/03/07 1.8.17 and 1.10.0
+// Removed from code. -BMR, 2016/08/11 1.8.18 and 1.10.1
//--------------------------------------------------------------------------
-void DataSet::fillMemBuf(void *buf, DataType& buf_type, DataSpace& space)
-{
- fillMemBuf(buf, (const DataType)buf_type, (const DataSpace)space);
-}
+//void DataSet::fillMemBuf(void *buf, DataType& buf_type, DataSpace& space)
+//{
+// fillMemBuf(buf, (const DataType)buf_type, (const DataSpace)space);
+//}
//--------------------------------------------------------------------------
// Function: DataSet::getId
diff --git a/c++/src/H5DataSet.h b/c++/src/H5DataSet.h
index b2544a2..c97e5b0 100644
--- a/c++/src/H5DataSet.h
+++ b/c++/src/H5DataSet.h
@@ -39,11 +39,11 @@ class H5_DLLCPP DataSet : public H5Object, public AbstractDs {
// Fills a selection in memory with a value
void fillMemBuf(const void *fill, const DataType& fill_type, void *buf, const DataType& buf_type, const DataSpace& space) const;
- void fillMemBuf(const void *fill, DataType& fill_type, void *buf, DataType& buf_type, DataSpace& space); // kept for backward compatibility
+ //void fillMemBuf(const void *fill, DataType& fill_type, void *buf, DataType& buf_type, DataSpace& space); // removed from 1.8.18 and 1.10.1
// Fills a selection in memory with zero
void fillMemBuf(void *buf, const DataType& buf_type, const DataSpace& space) const;
- void fillMemBuf(void *buf, DataType& buf_type, DataSpace& space); // kept for backward compatibility
+ //void fillMemBuf(void *buf, DataType& buf_type, DataSpace& space); // removed from 1.8.18 and 1.10.1
// Gets the creation property list of this dataset.
DSetCreatPropList getCreatePlist() const;
@@ -65,7 +65,7 @@ class H5_DLLCPP DataSet : public H5Object, public AbstractDs {
// Returns the number of bytes required to store VL data.
hsize_t getVlenBufSize(const DataType& type, const DataSpace& space ) const;
- hsize_t getVlenBufSize(DataType& type, DataSpace& space) const; // kept for backward compatibility
+ //hsize_t getVlenBufSize(DataType& type, DataSpace& space) const; // removed from 1.8.18 and 1.10.1
// Reclaims VL datatype memory buffers.
static void vlenReclaim(const DataType& type, const DataSpace& space, const DSetMemXferPropList& xfer_plist, void* buf );
diff --git a/c++/src/H5DataSpace.cpp b/c++/src/H5DataSpace.cpp
index 7b6289c..b24e94f 100644
--- a/c++/src/H5DataSpace.cpp
+++ b/c++/src/H5DataSpace.cpp
@@ -348,12 +348,13 @@ void DataSpace::extentCopy (const DataSpace& dest_space) const
// Programmer Binh-Minh Ribler - 2000
// Modification
// Modified to call its replacement. -BMR, 2014/04/16
-// Removed from documentation. -BMR, 2016/03/07
+// Removed from documentation. -BMR, 2016/03/07 1.8.17 and 1.10.0
+// Removed from code. -BMR, 2016/08/11 1.8.18 and 1.10.1
//--------------------------------------------------------------------------
-void DataSpace::extentCopy( DataSpace& dest_space ) const
-{
- extentCopy(dest_space);
-}
+//void DataSpace::extentCopy( DataSpace& dest_space ) const
+//{
+// extentCopy(dest_space);
+//}
//--------------------------------------------------------------------------
// Function: DataSpace::setExtentSimple
diff --git a/c++/src/H5DataSpace.h b/c++/src/H5DataSpace.h
index 4cbe62c..384f1a3 100644
--- a/c++/src/H5DataSpace.h
+++ b/c++/src/H5DataSpace.h
@@ -50,8 +50,8 @@ class H5_DLLCPP DataSpace : public IdComponent {
// Copies the extent of this dataspace.
void extentCopy(const DataSpace& dest_space) const;
- // Kept for backward compatibility only.
- void extentCopy(DataSpace& dest_space) const;
+ // removed from 1.8.18 and 1.10.1
+ //void extentCopy(DataSpace& dest_space) const;
// Gets the bounding box containing the current selection.
void getSelectBounds( hsize_t* start, hsize_t* end ) const;
diff --git a/c++/src/H5DataType.cpp b/c++/src/H5DataType.cpp
index b7d787d..b784dd4 100644
--- a/c++/src/H5DataType.cpp
+++ b/c++/src/H5DataType.cpp
@@ -25,19 +25,20 @@
#include "H5IdComponent.h"
#include "H5PropList.h"
#include "H5DataSpace.h"
+#include "H5Location.h"
#include "H5Object.h"
#include "H5FaccProp.h"
#include "H5FcreatProp.h"
#include "H5OcreatProp.h"
#include "H5DcreatProp.h"
#include "H5DxferProp.h"
-#include "H5CommonFG.h"
#include "H5DataType.h"
#include "H5AtomType.h"
#include "H5PredType.h"
#include "H5private.h"
#include "H5AbstractDs.h"
#include "H5DataSet.h"
+#include "H5Group.h"
#include "H5File.h"
#include "H5Attribute.h"
@@ -313,12 +314,13 @@ void DataType::commit(const H5Location& loc, const char* name)
// Programmer Binh-Minh Ribler - Jan, 2007
// Modification
// Planned for removal. -BMR, 2014/04/16
-// Removed from documentation. -BMR, 2016/03/07
+// Removed from documentation. -BMR, 2016/03/07 1.8.17 and 1.10.0
+// Removed from code. -BMR, 2016/08/11 1.8.18 and 1.10.1
//--------------------------------------------------------------------------
-void DataType::commit(H5Location& loc, const char* name)
-{
- p_commit(loc.getId(), name);
-}
+//void DataType::commit(H5Location& loc, const char* name)
+//{
+// p_commit(loc.getId(), name);
+//}
//--------------------------------------------------------------------------
// Function: DataType::commit
@@ -343,12 +345,13 @@ void DataType::commit(const H5Location& loc, const H5std_string& name)
// Programmer Binh-Minh Ribler - Jan, 2007
// Modification
// Planned for removal. -BMR, 2014/04/16
-// Removed from documentation. -BMR, 2016/03/07
+// Removed from documentation. -BMR, 2016/03/07 1.8.17 and 1.10.0
+// Removed from code. -BMR, 2016/08/11 1.8.18 and 1.10.1
//--------------------------------------------------------------------------
-void DataType::commit(H5Location& loc, const H5std_string& name)
-{
- p_commit(loc.getId(), name.c_str());
-}
+//void DataType::commit(H5Location& loc, const H5std_string& name)
+//{
+// p_commit(loc.getId(), name.c_str());
+//}
//--------------------------------------------------------------------------
// Function: DataType::committed
diff --git a/c++/src/H5DataType.h b/c++/src/H5DataType.h
index 5705b83..7584cff 100644
--- a/c++/src/H5DataType.h
+++ b/c++/src/H5DataType.h
@@ -63,9 +63,9 @@ class H5_DLLCPP DataType : public H5Object {
void commit(const H5Location& loc, const char* name);
void commit(const H5Location& loc, const H5std_string& name);
// These two overloaded functions are kept for backward compatibility
- // only; they missed the const.
- void commit(H5Location& loc, const char* name);
- void commit(H5Location& loc, const H5std_string& name);
+ // only; they missed the const - removed from 1.8.18 and 1.10.1
+ //void commit(H5Location& loc, const char* name);
+ //void commit(H5Location& loc, const H5std_string& name);
// Determines whether this datatype is a named datatype or
// a transient datatype.
diff --git a/c++/src/H5DcreatProp.cpp b/c++/src/H5DcreatProp.cpp
index b2a3e96..06b5024 100644
--- a/c++/src/H5DcreatProp.cpp
+++ b/c++/src/H5DcreatProp.cpp
@@ -20,9 +20,9 @@
#include "H5IdComponent.h"
#include "H5PropList.h"
#include "H5OcreatProp.h"
+#include "H5Location.h"
#include "H5Object.h"
#include "H5DcreatProp.h"
-#include "H5CommonFG.h"
#include "H5DataType.h"
#ifndef H5_NO_NAMESPACE
@@ -333,7 +333,7 @@ void DSetCreatPropList::getFillValue( const DataType& fvalue_type, void* value )
///\exception H5::PropListIException
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-H5D_fill_value_t DSetCreatPropList::isFillValueDefined()
+H5D_fill_value_t DSetCreatPropList::isFillValueDefined() const
{
H5D_fill_value_t status;
herr_t ret_value = H5Pfill_value_defined(id, &status);
@@ -517,7 +517,7 @@ void DSetCreatPropList::modifyFilter( H5Z_filter_t filter_id, unsigned int
///\exception H5::PropListIException
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-bool DSetCreatPropList::allFiltersAvail()
+bool DSetCreatPropList::allFiltersAvail() const
{
htri_t ret_value = H5Pall_filters_avail(id);
if( ret_value > 0 )
@@ -565,7 +565,7 @@ void DSetCreatPropList::setShuffle() const
/// \li \c H5D_ALLOC_TIME_INCR
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-H5D_alloc_time_t DSetCreatPropList::getAllocTime()
+H5D_alloc_time_t DSetCreatPropList::getAllocTime() const
{
H5D_alloc_time_t alloc_time;
herr_t ret_value = H5Pget_alloc_time(id, &alloc_time);
@@ -589,7 +589,7 @@ H5D_alloc_time_t DSetCreatPropList::getAllocTime()
/// \li \c H5D_FILL_TIME_ALLOC.
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-H5D_fill_time_t DSetCreatPropList::getFillTime()
+H5D_fill_time_t DSetCreatPropList::getFillTime() const
{
H5D_fill_time_t fill_time;
herr_t ret_value = H5Pget_fill_time(id, &fill_time);
@@ -615,7 +615,7 @@ H5D_fill_time_t DSetCreatPropList::getFillTime()
/// \li \c H5D_ALLOC_TIME_INCR
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-void DSetCreatPropList::setAllocTime(H5D_alloc_time_t alloc_time)
+void DSetCreatPropList::setAllocTime(H5D_alloc_time_t alloc_time) const
{
herr_t ret_value = H5Pset_alloc_time(id, alloc_time);
if( ret_value < 0 )
@@ -636,7 +636,7 @@ void DSetCreatPropList::setAllocTime(H5D_alloc_time_t alloc_time)
/// \li \c H5D_FILL_TIME_ALLOC.
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-void DSetCreatPropList::setFillTime(H5D_fill_time_t fill_time)
+void DSetCreatPropList::setFillTime(H5D_fill_time_t fill_time) const
{
herr_t ret_value = H5Pset_fill_time(id, fill_time);
if( ret_value < 0 )
diff --git a/c++/src/H5DcreatProp.h b/c++/src/H5DcreatProp.h
index 51347e8..fed41b4 100644
--- a/c++/src/H5DcreatProp.h
+++ b/c++/src/H5DcreatProp.h
@@ -38,13 +38,13 @@ class H5_DLLCPP DSetCreatPropList : public ObjCreatPropList {
// Queries whether all the filters set in this property list are
// available currently.
- bool allFiltersAvail();
+ bool allFiltersAvail() const;
// Get space allocation time for this property.
- H5D_alloc_time_t getAllocTime();
+ H5D_alloc_time_t getAllocTime() const;
// Set space allocation time for dataset during creation.
- void setAllocTime(H5D_alloc_time_t alloc_time);
+ void setAllocTime(H5D_alloc_time_t alloc_time) const;
// Retrieves the size of the chunks used to store a chunked layout dataset.
int getChunk( int max_ndims, hsize_t* dim ) const;
@@ -59,10 +59,10 @@ class H5_DLLCPP DSetCreatPropList : public ObjCreatPropList {
int getExternalCount() const;
// Gets fill value writing time.
- H5D_fill_time_t getFillTime();
+ H5D_fill_time_t getFillTime() const;
// Sets fill value writing time for dataset.
- void setFillTime(H5D_fill_time_t fill_time);
+ void setFillTime(H5D_fill_time_t fill_time) const;
// Retrieves a dataset fill value.
void getFillValue( const DataType& fvalue_type, void* value ) const;
@@ -88,7 +88,7 @@ class H5_DLLCPP DSetCreatPropList : public ObjCreatPropList {
int getNfilters() const;
// Checks if fill value has been defined for this property.
- H5D_fill_value_t isFillValueDefined();
+ H5D_fill_value_t isFillValueDefined() const;
// Modifies the specified filter.
void modifyFilter( H5Z_filter_t filter_id, unsigned int flags, size_t cd_nelmts, const unsigned int cd_values[] ) const;
diff --git a/c++/src/H5DxferProp.cpp b/c++/src/H5DxferProp.cpp
index 49bbfe6..c228b44 100644
--- a/c++/src/H5DxferProp.cpp
+++ b/c++/src/H5DxferProp.cpp
@@ -145,13 +145,12 @@ void DSetMemXferPropList::setBuffer( size_t size, void* tconv, void* bkg ) const
//--------------------------------------------------------------------------
// Function: DSetMemXferPropList::getBuffer
///\brief Reads buffer settings.
-///\param tconv - IN: Pointer to application-allocated type conversion buffer
-///\param bkg - IN: Pointer to application-allocated background buffer
+///\param tconv - OUT: Pointer to application-allocated type conversion buf
+///\param bkg - OUT: Pointer to application-allocated background buffer
///\return Buffer size, in bytes
///\exception H5::PropListIException
// Programmer: Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-
size_t DSetMemXferPropList::getBuffer( void** tconv, void** bkg ) const
{
size_t buffer_size = H5Pget_buffer( id, tconv, bkg );
@@ -443,7 +442,7 @@ void DSetMemXferPropList::getVlenMemManager( H5MM_allocate_t& alloc_func, void**
/// http://www.hdfgroup.org/HDF5/doc/RM/RM_H5P.html#Property-SetSmallData
// Programmer: Binh-Minh Ribler - April, 2004
//--------------------------------------------------------------------------
-void DSetMemXferPropList::setSmallDataBlockSize(hsize_t size)
+void DSetMemXferPropList::setSmallDataBlockSize(hsize_t size) const
{
herr_t ret_value = H5Pset_small_data_block_size(id, size);
if (ret_value < 0)
@@ -460,7 +459,7 @@ void DSetMemXferPropList::setSmallDataBlockSize(hsize_t size)
///\exception H5::PropListIException
// Programmer: Binh-Minh Ribler - April, 2004
//--------------------------------------------------------------------------
-hsize_t DSetMemXferPropList::getSmallDataBlockSize()
+hsize_t DSetMemXferPropList::getSmallDataBlockSize() const
{
hsize_t size;
herr_t ret_value = H5Pget_small_data_block_size(id, &size);
@@ -483,7 +482,7 @@ hsize_t DSetMemXferPropList::getSmallDataBlockSize()
/// http://www.hdfgroup.org/HDF5/doc/RM/RM_H5P.html#Property-SetHyperVectorSize
// Programmer: Binh-Minh Ribler - April, 2004
//--------------------------------------------------------------------------
-void DSetMemXferPropList::setHyperVectorSize(size_t vector_size)
+void DSetMemXferPropList::setHyperVectorSize(size_t vector_size) const
{
herr_t ret_value = H5Pset_hyper_vector_size(id, vector_size);
if (ret_value < 0)
@@ -501,7 +500,7 @@ void DSetMemXferPropList::setHyperVectorSize(size_t vector_size)
///\exception H5::PropListIException
// Programmer: Binh-Minh Ribler - April, 2004
//--------------------------------------------------------------------------
-size_t DSetMemXferPropList::getHyperVectorSize()
+size_t DSetMemXferPropList::getHyperVectorSize() const
{
size_t vector_size;
herr_t ret_value = H5Pget_hyper_vector_size(id, &vector_size);
@@ -531,7 +530,7 @@ size_t DSetMemXferPropList::getHyperVectorSize()
/// \li \c H5Z_DISABLE_EDC
// Programmer: Binh-Minh Ribler - April, 2004
//--------------------------------------------------------------------------
-void DSetMemXferPropList::setEDCCheck(H5Z_EDC_t check)
+void DSetMemXferPropList::setEDCCheck(H5Z_EDC_t check) const
{
herr_t ret_value = H5Pset_edc_check(id, check);
if (ret_value < 0)
@@ -548,7 +547,7 @@ void DSetMemXferPropList::setEDCCheck(H5Z_EDC_t check)
///\exception H5::PropListIException
// Programmer: Binh-Minh Ribler - April, 2004
//--------------------------------------------------------------------------
-H5Z_EDC_t DSetMemXferPropList::getEDCCheck()
+H5Z_EDC_t DSetMemXferPropList::getEDCCheck() const
{
H5Z_EDC_t check = H5Pget_edc_check(id);
if (check < 0)
diff --git a/c++/src/H5DxferProp.h b/c++/src/H5DxferProp.h
index 52a9a48..31fc372 100644
--- a/c++/src/H5DxferProp.h
+++ b/c++/src/H5DxferProp.h
@@ -86,24 +86,24 @@ class H5_DLLCPP DSetMemXferPropList : public PropList {
H5MM_free_t& free, void** free_info ) const;
// Sets the size of a contiguous block reserved for small data.
- void setSmallDataBlockSize(hsize_t size);
+ void setSmallDataBlockSize(hsize_t size) const;
// Returns the current small data block size setting.
- hsize_t getSmallDataBlockSize();
+ hsize_t getSmallDataBlockSize() const;
// Sets number of I/O vectors to be read/written in hyperslab I/O.
- void setHyperVectorSize(size_t vector_size);
+ void setHyperVectorSize(size_t vector_size) const;
// Returns the number of I/O vectors to be read/written in
// hyperslab I/O.
- size_t getHyperVectorSize();
+ size_t getHyperVectorSize() const;
// Enables or disables error-detecting for a dataset reading
// process.
- void setEDCCheck(H5Z_EDC_t check);
+ void setEDCCheck(H5Z_EDC_t check) const;
// Determines whether error-detection is enabled for dataset reads.
- H5Z_EDC_t getEDCCheck();
+ H5Z_EDC_t getEDCCheck() const;
///\brief Returns this class name.
virtual H5std_string fromClass () const { return("DSetMemXferPropList"); }
diff --git a/c++/src/H5EnumType.cpp b/c++/src/H5EnumType.cpp
index b096a36..f0a2138 100644
--- a/c++/src/H5EnumType.cpp
+++ b/c++/src/H5EnumType.cpp
@@ -19,13 +19,13 @@
#include "H5Exception.h"
#include "H5IdComponent.h"
#include "H5PropList.h"
+#include "H5Location.h"
#include "H5Object.h"
#include "H5AbstractDs.h"
#include "H5DxferProp.h"
#include "H5DataSpace.h"
#include "H5OcreatProp.h"
#include "H5DcreatProp.h"
-#include "H5CommonFG.h"
#include "H5DataType.h"
#include "H5DataSet.h"
#include "H5AtomType.h"
diff --git a/c++/src/H5FaccProp.cpp b/c++/src/H5FaccProp.cpp
index c284500..972f915 100644
--- a/c++/src/H5FaccProp.cpp
+++ b/c++/src/H5FaccProp.cpp
@@ -330,26 +330,6 @@ void FileAccPropList::setSplit(const FileAccPropList& meta_plist, const FileAccP
//--------------------------------------------------------------------------
// Function: FileAccPropList::setSplit
-// Purpose This is an overloaded member function, kept for backward
-// compatibility. It differs from the above function in that it
-// misses const's. This wrapper will be removed in future release.
-// Param meta_plist - IN: File access plist for the metadata file
-// Param raw_plist - IN: File access plist for the raw data file
-// Param meta_ext - IN: Metadata filename extension as \c char*
-// Param raw_ext - IN: Raw data filename extension as \c char*
-// Exception H5::PropListIException
-// Programmer: Binh-Minh Ribler - April, 2004
-// Modification
-// Planned for removal. -BMR, 2014/04/16
-// Removed from documentation. -BMR, 2016/03/07
-//--------------------------------------------------------------------------
-void FileAccPropList::setSplit(FileAccPropList& meta_plist, FileAccPropList& raw_plist, const char* meta_ext, const char* raw_ext ) const
-{
- setSplit(meta_plist, raw_plist, meta_ext, raw_ext);
-}
-
-//--------------------------------------------------------------------------
-// Function: FileAccPropList::setSplit
///\brief This is an overloaded member function, provided for convenience.
/// It takes character arguments as \c H5std_string.
///\param meta_plist - IN: File access plist for the metadata file
@@ -364,25 +344,6 @@ void FileAccPropList::setSplit(const FileAccPropList& meta_plist, const FileAccP
setSplit( meta_plist, raw_plist, meta_ext.c_str(), raw_ext.c_str() );
}
-//--------------------------------------------------------------------------
-// Function: FileAccPropList::setSplit
-// Purpose This is an overloaded member function, kept for backward
-// compatibility. It differs from the above function in that it
-// misses const's. This wrapper will be removed in future release.
-// Param meta_plist - IN: File access plist for the metadata file
-// Param raw_plist - IN: File access plist for the raw data file
-// Param meta_ext - IN: Metadata filename extension as \c char*
-// Param raw_ext - IN: Raw data filename extension as \c char*
-// Exception H5::PropListIException
-// Modification
-// Planned for removal. -BMR, 2014/04/16
-// Removed from documentation. -BMR, 2016/03/07
-//--------------------------------------------------------------------------
-void FileAccPropList::setSplit(FileAccPropList& meta_plist, FileAccPropList& raw_plist, const H5std_string& meta_ext, const H5std_string& raw_ext ) const
-{
- setSplit(meta_plist, raw_plist, meta_ext.c_str(), raw_ext.c_str() );
-}
-
// Stream Virtual File Driver had been removed from the main library.
// FileAccPropList::[s,g]etStream are now removed from the C++ API.
// -BMR, March, 2012
@@ -652,7 +613,7 @@ void FileAccPropList::getCache( int& mdc_nelmts, size_t& rdcc_nelmts, size_t& rd
///\exception H5::PropListIException
// Programmer: Binh-Minh Ribler - April, 2004
//--------------------------------------------------------------------------
-void FileAccPropList::setFcloseDegree(H5F_close_degree_t degree)
+void FileAccPropList::setFcloseDegree(H5F_close_degree_t degree) const
{
herr_t ret_value = H5Pset_fclose_degree(id, degree);
if( ret_value < 0 )
@@ -668,7 +629,7 @@ void FileAccPropList::setFcloseDegree(H5F_close_degree_t degree)
///\exception H5::PropListIException
// Programmer: Binh-Minh Ribler - April, 2004
//--------------------------------------------------------------------------
-H5F_close_degree_t FileAccPropList::getFcloseDegree()
+H5F_close_degree_t FileAccPropList::getFcloseDegree() const
{
H5F_close_degree_t degree;
herr_t ret_value = H5Pget_fclose_degree(id, &degree);
diff --git a/c++/src/H5FaccProp.h b/c++/src/H5FaccProp.h
index b214447..831488c 100644
--- a/c++/src/H5FaccProp.h
+++ b/c++/src/H5FaccProp.h
@@ -74,13 +74,6 @@ class H5_DLLCPP FileAccPropList : public PropList {
const FileAccPropList& raw_plist,
const H5std_string& meta_ext = ".meta",
const H5std_string& raw_ext = ".raw") const;
- // These two overloaded functions are kept for backward compatibility
- // only; they missed the const's and will be removed in future release.
- void setSplit(FileAccPropList& meta_plist, FileAccPropList& raw_plist,
- const char* meta_ext=".meta", const char* raw_ext=".raw") const;
- void setSplit(FileAccPropList& meta_plist, FileAccPropList& raw_plist,
- const H5std_string& meta_ext=".meta",
- const H5std_string& raw_ext=".raw") const;
// Sets the maximum size of the data sieve buffer.
void setSieveBufSize(size_t bufsize) const;
@@ -119,10 +112,10 @@ class H5_DLLCPP FileAccPropList : public PropList {
void getCache( int& mdc_nelmts, size_t& rdcc_nelmts, size_t& rdcc_nbytes, double& rdcc_w0 ) const;
// Sets the degree for the file close behavior.
- void setFcloseDegree(H5F_close_degree_t degree);
+ void setFcloseDegree(H5F_close_degree_t degree) const;
// Returns the degree for the file close behavior.
- H5F_close_degree_t getFcloseDegree();
+ H5F_close_degree_t getFcloseDegree() const;
// Sets garbage collecting references flag.
void setGcReferences( unsigned gc_ref = 0 ) const;
diff --git a/c++/src/H5File.cpp b/c++/src/H5File.cpp
index 4602c6f..a81efd8 100644
--- a/c++/src/H5File.cpp
+++ b/c++/src/H5File.cpp
@@ -24,13 +24,13 @@
#include "H5Exception.h"
#include "H5IdComponent.h"
#include "H5PropList.h"
+#include "H5Location.h"
#include "H5Object.h"
#include "H5FaccProp.h"
#include "H5FcreatProp.h"
#include "H5OcreatProp.h"
#include "H5DxferProp.h"
#include "H5DcreatProp.h"
-#include "H5CommonFG.h"
#include "H5Group.h"
#include "H5AbstractDs.h"
#include "H5DataSpace.h"
@@ -51,7 +51,7 @@ namespace H5 {
///\brief Default constructor: creates a stub H5File object.
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-H5File::H5File() : H5Location(), CommonFG(), id(H5I_INVALID_HID) {}
+H5File::H5File() : Group(), id(H5I_INVALID_HID) {}
//--------------------------------------------------------------------------
// Function: H5File overloaded constructor
@@ -84,7 +84,7 @@ H5File::H5File() : H5Location(), CommonFG(), id(H5I_INVALID_HID) {}
// to catch then re-throw it. -BMR 2013/03/21
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-H5File::H5File( const char* name, unsigned int flags, const FileCreatPropList& create_plist, const FileAccPropList& access_plist ) : H5Location(), CommonFG(), id(H5I_INVALID_HID)
+H5File::H5File( const char* name, unsigned int flags, const FileCreatPropList& create_plist, const FileAccPropList& access_plist ) : Group(), id(H5I_INVALID_HID)
{
try {
p_get_file(name, flags, create_plist, access_plist);
@@ -109,7 +109,7 @@ H5File::H5File( const char* name, unsigned int flags, const FileCreatPropList& c
// to catch then re-throw it. -BMR 2013/03/21
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-H5File::H5File( const H5std_string& name, unsigned int flags, const FileCreatPropList& create_plist, const FileAccPropList& access_plist ) : H5Location(), CommonFG(), id(H5I_INVALID_HID)
+H5File::H5File( const H5std_string& name, unsigned int flags, const FileCreatPropList& create_plist, const FileAccPropList& access_plist ) : Group(), id(H5I_INVALID_HID)
{
try {
p_get_file(name.c_str(), flags, create_plist, access_plist);
@@ -166,7 +166,7 @@ void H5File::p_get_file(const char* name, unsigned int flags, const FileCreatPro
// constructor is needed by the library in order to return
// an object, H5File doesn't need it. -BMR (HDFFV-8766 partially)
//--------------------------------------------------------------------------
-H5File::H5File(hid_t existing_id) : H5Location(), CommonFG()
+H5File::H5File(hid_t existing_id) : Group()
{
id = existing_id;
incRefCount(); // increment number of references to this id
@@ -181,7 +181,7 @@ H5File::H5File(hid_t existing_id) : H5Location(), CommonFG()
///\param original - IN: H5File instance to copy
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-H5File::H5File(const H5File& original) : H5Location(), CommonFG()
+H5File::H5File(const H5File& original) : Group()
{
id = original.getId();
incRefCount(); // increment number of references to this id
@@ -477,12 +477,13 @@ void H5File::getVFDHandle(const FileAccPropList& fapl, void **file_handle) const
// Programmer Binh-Minh Ribler - May 2004
// Modification
// Planned for removal. -BMR, 2014/04/16
-// Removed from documentation. -BMR, 2016/03/07
+// Removed from documentation. -BMR, 2016/03/07 1.8.17 and 1.10.0
+// Removed from code. -BMR, 2016/08/11 1.8.18 and 1.10.1
//--------------------------------------------------------------------------
-void H5File::getVFDHandle(FileAccPropList& fapl, void **file_handle) const
-{
- getVFDHandle((const FileAccPropList)fapl, file_handle);
-}
+//void H5File::getVFDHandle(FileAccPropList& fapl, void **file_handle) const
+//{
+// getVFDHandle((const FileAccPropList)fapl, file_handle);
+//}
//--------------------------------------------------------------------------
// Function: H5File::getVFDHandle
diff --git a/c++/src/H5File.h b/c++/src/H5File.h
index 939ac8e..7ec92fe 100644
--- a/c++/src/H5File.h
+++ b/c++/src/H5File.h
@@ -17,6 +17,7 @@
#ifndef __H5File_H
#define __H5File_H
+
#ifndef H5_NO_NAMESPACE
namespace H5 {
#endif
@@ -26,7 +27,7 @@ namespace H5 {
It inherits from H5Location and CommonFG.
*/
-class H5_DLLCPP H5File : public H5Location, public CommonFG {
+class H5_DLLCPP H5File : public Group {
public:
// Creates or opens an HDF5 file.
H5File( const char* name, unsigned int flags,
@@ -68,7 +69,7 @@ class H5_DLLCPP H5File : public H5Location, public CommonFG {
// Returns the pointer to the file handle of the low-level file driver.
void getVFDHandle(void **file_handle) const;
void getVFDHandle(const FileAccPropList& fapl, void **file_handle) const;
- void getVFDHandle(FileAccPropList& fapl, void **file_handle) const; // kept for backward compatibility
+ //void getVFDHandle(FileAccPropList& fapl, void **file_handle) const; // removed from 1.8.18 and 1.10.1
// Determines if a file, specified by its name, is in HDF5 format
static bool isHdf5(const char* name );
@@ -80,9 +81,6 @@ class H5_DLLCPP H5File : public H5Location, public CommonFG {
#ifndef DOXYGEN_SHOULD_SKIP_THIS
void reopen(); // obsolete in favor of reOpen()
- // Gets the file id
- virtual hid_t getLocId() const;
-
// Creates an H5File using an existing file id. Not recommended
// in applications.
H5File(hid_t existing_id);
@@ -95,6 +93,9 @@ class H5_DLLCPP H5File : public H5Location, public CommonFG {
// Throw file exception.
virtual void throwException(const H5std_string& func_name, const H5std_string& msg) const;
+ // for CommonFG to get the file id.
+ virtual hid_t getLocId() const;
+
// Default constructor
H5File();
@@ -125,3 +126,4 @@ class H5_DLLCPP H5File : public H5Location, public CommonFG {
}
#endif
#endif // __H5File_H
+
diff --git a/c++/src/H5FloatType.cpp b/c++/src/H5FloatType.cpp
index cdf9872..ed17aeb 100644
--- a/c++/src/H5FloatType.cpp
+++ b/c++/src/H5FloatType.cpp
@@ -19,10 +19,10 @@
#include "H5Exception.h"
#include "H5IdComponent.h"
#include "H5PropList.h"
+#include "H5Location.h"
#include "H5Object.h"
#include "H5OcreatProp.h"
#include "H5DcreatProp.h"
-#include "H5CommonFG.h"
#include "H5DataType.h"
#include "H5AbstractDs.h"
#include "H5DxferProp.h"
diff --git a/c++/src/H5Group.cpp b/c++/src/H5Group.cpp
index 9d27b79..d93d3a1 100644
--- a/c++/src/H5Group.cpp
+++ b/c++/src/H5Group.cpp
@@ -24,6 +24,7 @@
#include "H5Exception.h"
#include "H5IdComponent.h"
#include "H5PropList.h"
+#include "H5Location.h"
#include "H5Object.h"
#include "H5AbstractDs.h"
#include "H5FaccProp.h"
@@ -33,11 +34,11 @@
#include "H5DxferProp.h"
#include "H5DataSpace.h"
#include "H5DataSet.h"
-#include "H5CommonFG.h"
#include "H5Attribute.h"
#include "H5Group.h"
#include "H5File.h"
#include "H5Alltypes.h"
+#include "H5private.h" // for HDstrcpy
#ifndef H5_NO_NAMESPACE
namespace H5 {
@@ -52,7 +53,7 @@ namespace H5 {
///\brief Default constructor: creates a stub Group.
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-Group::Group() : H5Object(), CommonFG(), id(H5I_INVALID_HID) {}
+Group::Group() : H5Object(), id(H5I_INVALID_HID) {}
//--------------------------------------------------------------------------
// Function: Group copy constructor
@@ -60,7 +61,7 @@ Group::Group() : H5Object(), CommonFG(), id(H5I_INVALID_HID) {}
///\param original - IN: Original group to copy
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-Group::Group(const Group& original) : H5Object(), CommonFG(), id(original.id)
+Group::Group(const Group& original) : H5Object(), id(original.id)
{
incRefCount(); // increment number of references to this id
}
@@ -70,6 +71,9 @@ Group::Group(const Group& original) : H5Object(), CommonFG(), id(original.id)
///\brief Returns the id of this group.
///\return Id of this group
// Programmer Binh-Minh Ribler - 2000
+// Deprecated:
+// After HDFFV-9920, the Group's methods can use getId() and getLocId()
+// is kept for backward compatibility. Aug 18, 2016 -BMR
//--------------------------------------------------------------------------
hid_t Group::getLocId() const
{
@@ -82,7 +86,7 @@ hid_t Group::getLocId() const
///\param existing_id - IN: Id of an existing group
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-Group::Group(const hid_t existing_id) : H5Object(), CommonFG(), id(existing_id)
+Group::Group(const hid_t existing_id) : H5Object(), id(existing_id)
{
incRefCount(); // increment number of references to this id
}
@@ -100,7 +104,7 @@ Group::Group(const hid_t existing_id) : H5Object(), CommonFG(), id(existing_id)
/// is a datatype that has been named by DataType::commit.
// Programmer Binh-Minh Ribler - Oct, 2006
//--------------------------------------------------------------------------
-Group::Group(const H5Location& loc, const void* ref, H5R_type_t ref_type, const PropList& plist) : H5Object(), CommonFG(), id(H5I_INVALID_HID)
+Group::Group(const H5Location& loc, const void* ref, H5R_type_t ref_type, const PropList& plist) : H5Object(), id(H5I_INVALID_HID)
{
id = H5Location::p_dereference(loc.getId(), ref, ref_type, plist, "constructor - by dereference");
}
@@ -115,7 +119,7 @@ Group::Group(const H5Location& loc, const void* ref, H5R_type_t ref_type, const
///\exception H5::ReferenceException
// Programmer Binh-Minh Ribler - Oct, 2006
//--------------------------------------------------------------------------
-Group::Group(const Attribute& attr, const void* ref, H5R_type_t ref_type, const PropList& plist) : H5Object(), CommonFG(), id(H5I_INVALID_HID)
+Group::Group(const Attribute& attr, const void* ref, H5R_type_t ref_type, const PropList& plist) : H5Object(), id(H5I_INVALID_HID)
{
id = H5Location::p_dereference(attr.getId(), ref, ref_type, plist, "constructor - by dereference");
}
@@ -157,7 +161,7 @@ void Group::p_setId(const hid_t new_id)
close();
}
catch (Exception& close_error) {
- throw GroupIException("Group::p_setId", close_error.getDetailMsg());
+ throwException("Group::p_setId", close_error.getDetailMsg());
}
// reset object's id to the given id
id = new_id;
@@ -178,7 +182,7 @@ void Group::close()
herr_t ret_value = H5Gclose( id );
if( ret_value < 0 )
{
- throw GroupIException("Group::close", "H5Gclose failed");
+ throwException("Group::close", "H5Gclose failed");
}
// reset the id
id = H5I_INVALID_HID;
@@ -226,6 +230,1269 @@ Group::~Group()
}
}
+
+// From H5CommonFG.cpp
+// Notes with "***Updated" are new and for Group.cpp
+// Original notes are from December 2000
+//
+// There are a few comments that are common to most of the functions
+// defined in this file so they are listed here.
+// - getLocId is called by all functions, that call a C API, to get
+// the location id, which can be either a file id or a group id.
+// This function is pure virtual and it's up to H5File and Group
+// to call the right getId() - although, as the structure of the
+// library at this time, getId() is basically the IdComponent::getId()
+// ***Updated: after the classes are rearranged (HDFFV-9920), functions
+// in CommonFG are moved to Group, and they can call getId()
+// instead of getLocId(). getLocId() is kept for backward
+// compatibility on user applications. Aug 18, 2016 -BMR
+// - when a failure returned by the C API, the functions will call
+// throwException, which is a pure virtual function and is implemented
+// by H5File to throw a FileIException and by Group to throw a
+// GroupIException.
+// ***Updated: after HDFFV-9920, methods in class Group use throwException
+// to distinguish the FileIException and GroupIException. CommonFG is no
+// longer used in the library. Aug 18, 2016 -BMR
+
+//--------------------------------------------------------------------------
+// Function: Group::createGroup
+///\brief Creates a new group at this location which can be a file
+/// or another group.
+///\param name - IN: Name of the group to create
+///\param size_hint - IN: Indicates the number of bytes to reserve for
+/// the names that will appear in the group
+///\return Group instance
+///\exception H5::FileIException or H5::GroupIException
+///\par Description
+/// The optional \a size_hint specifies how much file space to
+/// reserve for storing the names that will appear in this new
+/// group. If a non-positive value is provided for the \a size_hint
+/// then a default size is chosen.
+// Programmer Binh-Minh Ribler - 2000
+//--------------------------------------------------------------------------
+Group Group::createGroup( const char* name, size_t size_hint ) const
+{
+ // Group creation property list for size hint
+ hid_t gcpl_id = 0;
+
+ // Set the local heap size hint
+ if (size_hint > 0)
+ {
+ // If the creation of the property list failed, throw an exception
+ if ((gcpl_id = H5Pcreate(H5P_GROUP_CREATE)) < 0)
+ throwException("createGroup", "H5Pcreate failed");
+
+ if (H5Pset_local_heap_size_hint(gcpl_id, size_hint) < 0) {
+ H5Pclose(gcpl_id);
+ throwException("createGroup", "H5Pset_local_heap_size_hint failed");
+ }
+ }
+
+ // Call C routine H5Gcreate2 to create the named group, giving the
+ // location id which can be a file id or a group id
+ hid_t group_id = H5Gcreate2(getId(), name, H5P_DEFAULT, gcpl_id, H5P_DEFAULT );
+
+ // Close the group creation property list, if necessary
+ if(gcpl_id > 0)
+ H5Pclose(gcpl_id);
+
+ // If the creation of the group failed, throw an exception
+ if( group_id < 0 )
+ throwException("createGroup", "H5Gcreate2 failed");
+
+ // No failure, create and return the Group object
+ Group group;
+ group.p_setId(group_id);
+ // CommonFG *ptr = &group;
+ // ptr->p_setId(group_id);
+ return( group );
+}
+
+//--------------------------------------------------------------------------
+// Function: Group::createGroup
+///\brief This is an overloaded member function, provided for convenience.
+/// It differs from the above function in that it takes an
+/// \c H5std_string for \a name.
+// Programmer Binh-Minh Ribler - 2000
+//--------------------------------------------------------------------------
+Group Group::createGroup( const H5std_string& name, size_t size_hint ) const
+{
+ return( createGroup( name.c_str(), size_hint ));
+}
+
+//--------------------------------------------------------------------------
+// Function: Group::openGroup
+///\brief Opens an existing group in a location which can be a file
+/// or another group.
+///\param name - IN: Name of the group to open
+///\return Group instance
+///\exception H5::FileIException or H5::GroupIException
+// Programmer Binh-Minh Ribler - 2000
+//--------------------------------------------------------------------------
+Group Group::openGroup( const char* name ) const
+{
+ // Call C routine H5Gopen2 to open the named group, giving the
+ // location id which can be a file id or a group id
+ hid_t group_id = H5Gopen2(getId(), name, H5P_DEFAULT );
+
+ // If the opening of the group failed, throw an exception
+ if( group_id < 0 )
+ throwException("openGroup", "H5Gopen2 failed");
+
+ // No failure, create and return the Group object
+ Group group;
+ group.p_setId(group_id);
+ // CommonFG *ptr = &group;
+ // ptr->p_setId(group_id);
+ return( group );
+}
+
+//--------------------------------------------------------------------------
+// Function: Group::openGroup
+///\brief This is an overloaded member function, provided for convenience.
+/// It differs from the above function in that it takes an
+/// \c H5std_string for \a name.
+// Programmer Binh-Minh Ribler - 2000
+//--------------------------------------------------------------------------
+Group Group::openGroup( const H5std_string& name ) const
+{
+ return( openGroup( name.c_str() ));
+}
+
+//--------------------------------------------------------------------------
+// Function: Group::createDataSet
+///\brief Creates a new dataset at this location.
+///\param name - IN: Name of the dataset to create
+///\param data_type - IN: Datatype of the dataset
+///\param data_space - IN: Dataspace for the dataset
+///\param create_plist - IN: Creation properly list for the dataset
+///\return DataSet instance
+///\exception H5::FileIException or H5::GroupIException
+// Programmer Binh-Minh Ribler - 2000
+//--------------------------------------------------------------------------
+DataSet Group::createDataSet( const char* name, const DataType& data_type, const DataSpace& data_space, const DSetCreatPropList& create_plist ) const
+{
+ //cerr << "createDataSet( const char* name" << endl;
+ // Obtain identifiers for C API
+ hid_t type_id = data_type.getId();
+ hid_t space_id = data_space.getId();
+ hid_t create_plist_id = create_plist.getId();
+
+ // Call C routine H5Dcreate2 to create the named dataset
+ hid_t dataset_id = H5Dcreate2(getId(), name, type_id, space_id, H5P_DEFAULT, create_plist_id, H5P_DEFAULT );
+ //cerr << " H5Dcreate2 returns dataset_id " << dataset_id << endl;
+
+ // If the creation of the dataset failed, throw an exception
+ if( dataset_id < 0 )
+ throwException("createDataSet", "H5Dcreate2 failed");
+
+ // No failure, create and return the DataSet object
+ DataSet dataset;
+ f_DataSet_setId(&dataset, dataset_id);
+ return( dataset );
+}
+
+//--------------------------------------------------------------------------
+// Function: Group::createDataSet
+///\brief This is an overloaded member function, provided for convenience.
+/// It differs from the above function in that it takes an
+/// \c H5std_string for \a name.
+// Programmer Binh-Minh Ribler - 2000
+//--------------------------------------------------------------------------
+DataSet Group::createDataSet( const H5std_string& name, const DataType& data_type, const DataSpace& data_space, const DSetCreatPropList& create_plist ) const
+{
+ //cerr << "createDataSet( const H5std_string& name" << endl;
+ return( createDataSet( name.c_str(), data_type, data_space, create_plist ));
+}
+
+//--------------------------------------------------------------------------
+// Function: Group::openDataSet
+///\brief Opens an existing dataset at this location.
+///\param name - IN: Name of the dataset to open
+///\return DataSet instance
+///\exception H5::FileIException or H5::GroupIException
+// Programmer Binh-Minh Ribler - 2000
+//--------------------------------------------------------------------------
+DataSet Group::openDataSet( const char* name ) const
+{
+ // Call C function H5Dopen2 to open the specified dataset, giving
+ // the location id and the dataset's name
+ hid_t dataset_id = H5Dopen2(getId(), name, H5P_DEFAULT );
+
+ // If the dataset's opening failed, throw an exception
+ if(dataset_id < 0)
+ throwException("openDataSet", "H5Dopen2 failed");
+
+ // No failure, create and return the DataSet object
+ DataSet dataset;
+ f_DataSet_setId(&dataset, dataset_id);
+ return( dataset );
+}
+
+//--------------------------------------------------------------------------
+// Function: Group::openDataSet
+///\brief This is an overloaded member function, provided for convenience.
+/// It differs from the above function in that it takes an
+/// \c H5std_string for \a name.
+// Programmer Binh-Minh Ribler - 2000
+//--------------------------------------------------------------------------
+DataSet Group::openDataSet( const H5std_string& name ) const
+{
+ return( openDataSet( name.c_str() ));
+}
+
+//--------------------------------------------------------------------------
+// Function: Group::link
+///\brief Creates a link of the specified type from \a new_name to
+/// \a curr_name.
+///\param link_type - IN: Link type; possible values are
+/// \li \c H5G_LINK_HARD
+/// \li \c H5G_LINK_SOFT
+///\param curr_name - IN: Name of the existing object if link is a hard
+/// link; can be anything for the soft link
+///\param new_name - IN: New name for the object
+///\exception H5::FileIException or H5::GroupIException
+///\par Description
+/// Note that both names are interpreted relative to the
+/// specified location.
+/// For information on creating hard link and soft link, please
+/// refer to the C layer Reference Manual at:
+/// http://hdfgroup.org/HDF5/doc/RM/RM_H5L.html#Link-CreateHard and
+/// http://hdfgroup.org/HDF5/doc/RM/RM_H5L.html#Link-CreateSoft
+// Programmer Binh-Minh Ribler - 2000
+// Modification
+// 2007: QAK modified to use H5L APIs - BMR
+//--------------------------------------------------------------------------
+void Group::link( H5L_type_t link_type, const char* curr_name, const char* new_name ) const
+{
+ herr_t ret_value = -1;
+
+ switch(link_type) {
+ case H5L_TYPE_HARD:
+ ret_value = H5Lcreate_hard(getId(), curr_name, H5L_SAME_LOC, new_name, H5P_DEFAULT, H5P_DEFAULT );
+ break;
+
+ case H5L_TYPE_SOFT:
+ ret_value = H5Lcreate_soft( curr_name,getId(), new_name, H5P_DEFAULT, H5P_DEFAULT );
+ break;
+
+ case H5L_TYPE_ERROR:
+ case H5L_TYPE_EXTERNAL:
+ case H5L_TYPE_MAX:
+ default:
+ throwException("link", "unknown link type");
+ break;
+ } /* end switch */
+
+ if( ret_value < 0 )
+ throwException("link", "creating link failed");
+}
+
+//--------------------------------------------------------------------------
+// Function: Group::link
+///\brief This is an overloaded member function, provided for convenience.
+/// It differs from the above function in that it takes an
+/// \c H5std_string for \a curr_name and \a new_name.
+// Programmer Binh-Minh Ribler - 2000
+//--------------------------------------------------------------------------
+void Group::link( H5L_type_t link_type, const H5std_string& curr_name, const H5std_string& new_name ) const
+{
+ link( link_type, curr_name.c_str(), new_name.c_str() );
+}
+
+//--------------------------------------------------------------------------
+// Function: Group::unlink
+///\brief Removes the specified name at this location.
+///\param name - IN: Name of the object to be removed
+///\exception H5::FileIException or H5::GroupIException
+// Programmer Binh-Minh Ribler - 2000
+// Modification
+// 2007: QAK modified to use H5L APIs - BMR
+//--------------------------------------------------------------------------
+void Group::unlink( const char* name ) const
+{
+ herr_t ret_value = H5Ldelete(getId(), name, H5P_DEFAULT );
+ if( ret_value < 0 )
+ throwException("unlink", "H5Ldelete failed");
+}
+
+//--------------------------------------------------------------------------
+// Function: Group::unlink
+///\brief This is an overloaded member function, provided for convenience.
+/// It differs from the above function in that it takes an
+/// \c H5std_string for \a name.
+// Programmer Binh-Minh Ribler - 2000
+//--------------------------------------------------------------------------
+void Group::unlink( const H5std_string& name ) const
+{
+ unlink( name.c_str() );
+}
+
+//--------------------------------------------------------------------------
+// Function: Group::move
+///\brief Renames an object at this location.
+///\param src - IN: Object's original name
+///\param dst - IN: Object's new name
+///\exception H5::FileIException or H5::GroupIException
+///\note
+/// Exercise care in moving groups as it is possible to render
+/// data in a file inaccessible with Group::move. Please refer
+/// to the Group Interface in the HDF5 User's Guide for details at:
+/// https://www.hdfgroup.org/HDF5/doc/UG/HDF5_Users_Guide-Responsive%20HTML5/index.html#t=HDF5_Users_Guide%2FGroups%2FHDF5_Groups.htm
+// Programmer Binh-Minh Ribler - 2000
+// Modification
+// 2007: QAK modified to use H5L APIs - BMR
+//--------------------------------------------------------------------------
+void Group::move( const char* src, const char* dst ) const
+{
+ herr_t ret_value = H5Lmove(getId(), src, H5L_SAME_LOC, dst, H5P_DEFAULT, H5P_DEFAULT );
+ if( ret_value < 0 )
+ throwException("move", "H5Lmove failed");
+}
+
+//--------------------------------------------------------------------------
+// Function: Group::move
+///\brief This is an overloaded member function, provided for convenience.
+/// It differs from the above function in that it takes an
+/// \c H5std_string for \a src and \a dst.
+// Programmer Binh-Minh Ribler - 2000
+//--------------------------------------------------------------------------
+void Group::move( const H5std_string& src, const H5std_string& dst ) const
+{
+ move( src.c_str(), dst.c_str() );
+}
+
+#ifndef H5_NO_DEPRECATED_SYMBOLS
+//--------------------------------------------------------------------------
+// Function: Group::getObjinfo
+///\brief Returns information about an object.
+///\param name - IN: Name of the object
+///\param follow_link - IN: Link flag
+///\param statbuf - OUT: Buffer to return information about the object
+///\exception H5::FileIException or H5::GroupIException
+///\par Description
+/// For more information, please refer to the C layer Reference
+/// Manual at:
+/// http://www.hdfgroup.org/HDF5/doc/RM/RM_H5G.html#Group-GetObjinfo
+// Programmer Binh-Minh Ribler - 2000
+//--------------------------------------------------------------------------
+void Group::getObjinfo( const char* name, hbool_t follow_link, H5G_stat_t& statbuf ) const
+{
+ herr_t ret_value = H5Gget_objinfo(getId(), name, follow_link, &statbuf );
+ if( ret_value < 0 )
+ throwException("getObjinfo", "H5Gget_objinfo failed");
+}
+
+//--------------------------------------------------------------------------
+// Function: Group::getObjinfo
+///\brief This is an overloaded member function, provided for convenience.
+/// It differs from the above function in that it takes an
+/// \c H5std_string for \a name.
+// Programmer Binh-Minh Ribler - 2000
+//--------------------------------------------------------------------------
+void Group::getObjinfo( const H5std_string& name, hbool_t follow_link, H5G_stat_t& statbuf ) const
+{
+ getObjinfo( name.c_str(), follow_link, statbuf );
+}
+
+//--------------------------------------------------------------------------
+// Function: Group::getObjinfo
+///\brief This is an overloaded member function, provided for convenience.
+/// It differs from the above functions in that it doesn't have
+/// the paramemter \a follow_link.
+// Programmer Binh-Minh Ribler - Nov, 2005
+// Note: need to modify to use H5Oget_info and H5Lget_info - BMR
+//--------------------------------------------------------------------------
+void Group::getObjinfo( const char* name, H5G_stat_t& statbuf ) const
+{
+ herr_t ret_value = H5Gget_objinfo(getId(), name, 0, &statbuf );
+ if( ret_value < 0 )
+ throwException("getObjinfo", "H5Gget_objinfo failed");
+}
+
+//--------------------------------------------------------------------------
+// Function: Group::getObjinfo
+///\brief This is an overloaded member function, provided for convenience.
+/// It differs from the above function in that it takes an
+/// \c H5std_string for \a name.
+// Programmer Binh-Minh Ribler - Nov, 2005
+//--------------------------------------------------------------------------
+void Group::getObjinfo( const H5std_string& name, H5G_stat_t& statbuf ) const
+{
+ getObjinfo( name.c_str(), statbuf );
+}
+#endif /* H5_NO_DEPRECATED_SYMBOLS */
+
+//--------------------------------------------------------------------------
+// Function: Group::getLinkval
+///\brief Returns the name of the object that the symbolic link points to.
+///\param name - IN: Symbolic link to the object
+///\param size - IN: Maximum number of characters of value to be returned
+///\return Name of the object
+///\exception H5::FileIException or H5::GroupIException
+// Programmer Binh-Minh Ribler - 2000
+//--------------------------------------------------------------------------
+H5std_string Group::getLinkval( const char* name, size_t size ) const
+{
+ H5L_info_t linkinfo;
+ char *value_C; // value in C string
+ size_t val_size = size;
+ H5std_string value = "";
+ herr_t ret_value;
+
+ // if user doesn't provide buffer size, determine it
+ if (size == 0)
+ {
+ ret_value = H5Lget_info(getLocId(), name, &linkinfo, H5P_DEFAULT);
+ if( ret_value < 0 )
+ throwException("getLinkval", "H5Lget_info to find buffer size failed");
+
+ val_size = linkinfo.u.val_size;
+ }
+
+ // if link has value, retrieve the value, otherwise, return null string
+ if (val_size > 0)
+ {
+ value_C = new char[val_size+1]; // temporary C-string for C API
+ HDmemset(value_C, 0, val_size+1); // clear buffer
+
+ ret_value = H5Lget_val(getLocId(), name, value_C, val_size, H5P_DEFAULT);
+ if( ret_value < 0 )
+ {
+ delete []value_C;
+ throwException("getLinkval", "H5Lget_val failed");
+ }
+
+ value = H5std_string(value_C);
+ delete []value_C;
+ }
+ return(value);
+}
+
+//--------------------------------------------------------------------------
+// Function: Group::getLinkval
+///\brief This is an overloaded member function, provided for convenience.
+/// It differs from the above function in that it takes an
+/// \c H5std_string for \a name.
+// Programmer Binh-Minh Ribler - 2000
+//--------------------------------------------------------------------------
+H5std_string Group::getLinkval( const H5std_string& name, size_t size ) const
+{
+ return( getLinkval( name.c_str(), size ));
+}
+
+//--------------------------------------------------------------------------
+// Function: Group::mount
+///\brief Mounts the file \a child onto this group.
+///\param name - IN: Name of the group
+///\param child - IN: File to mount
+///\param plist - IN: Property list to use
+///\exception H5::FileIException or H5::GroupIException
+// Programmer Binh-Minh Ribler - 2014 (original 2000)
+//--------------------------------------------------------------------------
+void Group::mount(const char* name, const H5File& child, const PropList& plist ) const
+{
+ // Obtain identifiers for C API
+ hid_t plist_id = plist.getId();
+ hid_t child_id = child.getId();
+
+ // Call C routine H5Fmount to do the mouting
+ herr_t ret_value = H5Fmount(getId(), name, child_id, plist_id );
+
+ // Raise exception if H5Fmount returns negative value
+ if( ret_value < 0 )
+ throwException("mount", "H5Fmount failed");
+}
+
+//--------------------------------------------------------------------------
+// Function: Group::mount
+// Purpose This is an overloaded member function, kept for backward
+// compatibility. It differs from the above function in that it
+// misses const's. This wrapper will be removed in future release.
+// Param name - IN: Name of the group
+// Param child - IN: File to mount
+// Param plist - IN: Property list to use
+// Exception H5::FileIException or H5::GroupIException
+// Programmer Binh-Minh Ribler - 2000
+// Modification
+// Modified to call its replacement. -BMR, 2014/04/16
+// Removed from documentation. -BMR, 2016/03/07 1.8.17 and 1.10.0
+// Removed from code. -BMR, 2016/08/11 1.8.18 and 1.10.1
+//--------------------------------------------------------------------------
+//void Group::mount(const char* name, H5File& child, PropList& plist) const
+//{
+// mount(name, child, plist);
+//}
+
+//--------------------------------------------------------------------------
+// Function: Group::mount
+///\brief This is an overloaded member function, provided for convenience.
+/// It takes an \c H5std_string for \a name.
+// Programmer Binh-Minh Ribler - 2000
+//--------------------------------------------------------------------------
+void Group::mount(const H5std_string& name, const H5File& child, const PropList& plist) const
+{
+ mount(name.c_str(), child, plist);
+}
+
+//--------------------------------------------------------------------------
+// Function: Group::mount
+// Purpose This is an overloaded member function, kept for backward
+// compatibility. It differs from the above function in that it
+// misses const's. This wrapper will be removed in future release.
+// Programmer Binh-Minh Ribler - 2014
+// Modification
+// Modified to call its replacement. -BMR, 2014/04/16
+// Removed from documentation. -BMR, 2016/03/07 1.8.17 and 1.10.0
+// Removed from code. -BMR, 2016/08/11 1.8.18 and 1.10.1
+//--------------------------------------------------------------------------
+//void Group::mount(const H5std_string& name, H5File& child, PropList& plist) const
+//{
+// mount(name.c_str(), child, plist);
+//}
+
+//--------------------------------------------------------------------------
+// Function: Group::unmount
+///\brief Unmounts the specified file.
+///\param name - IN: Name of the file to unmount
+///\exception H5::FileIException or H5::GroupIException
+// Programmer Binh-Minh Ribler - 2000
+//--------------------------------------------------------------------------
+void Group::unmount( const char* name ) const
+{
+ // Call C routine H5Fmount to do the mouting
+ herr_t ret_value = H5Funmount(getId(), name );
+
+ // Raise exception if H5Funmount returns negative value
+ if( ret_value < 0 )
+ throwException("unmount", "H5Funmount failed");
+}
+
+//--------------------------------------------------------------------------
+// Function: Group::unmount
+///\brief This is an overloaded member function, provided for convenience.
+/// It differs from the above function in that it takes an
+/// \c H5std_string for \a name.
+// Programmer Binh-Minh Ribler - 2000
+//--------------------------------------------------------------------------
+void Group::unmount( const H5std_string& name ) const
+{
+ unmount( name.c_str() );
+}
+
+//--------------------------------------------------------------------------
+// Function: Group::openDataType
+///\brief Opens the named generic datatype at this location.
+///\param name - IN: Name of the datatype to open
+///\return DataType instance
+///\exception H5::FileIException or H5::GroupIException
+// Programmer Binh-Minh Ribler - 2000
+//--------------------------------------------------------------------------
+DataType Group::openDataType( const char* name ) const
+{
+ // Call C function H5Topen2 to open the named datatype in this group,
+ // given either the file or group id
+ hid_t type_id = H5Topen2(getLocId(), name, H5P_DEFAULT);
+
+ // If the datatype's opening failed, throw an exception
+ if( type_id < 0 )
+ throwException("openDataType", "H5Topen2 failed");
+
+ // No failure, create and return the DataType object
+ DataType data_type;
+ f_DataType_setId(&data_type, type_id);
+ return(data_type);
+}
+
+//--------------------------------------------------------------------------
+// Function: Group::openDataType
+///\brief This is an overloaded member function, provided for convenience.
+/// It differs from the above function in that it takes an
+/// \c H5std_string for \a name.
+// Programmer Binh-Minh Ribler - 2000
+//--------------------------------------------------------------------------
+DataType Group::openDataType( const H5std_string& name ) const
+{
+ return( openDataType( name.c_str()) );
+}
+
+//--------------------------------------------------------------------------
+// Function: Group::openArrayType
+///\brief Opens the named array datatype at this location.
+///\param name - IN: Name of the array datatype to open
+///\return ArrayType instance
+///\exception H5::FileIException or H5::GroupIException
+// Programmer Binh-Minh Ribler - Jul, 2005
+//--------------------------------------------------------------------------
+ArrayType Group::openArrayType( const char* name ) const
+{
+ // Call C function H5Topen2 to open the named datatype in this group,
+ // given either the file or group id
+ hid_t type_id = H5Topen2(getLocId(), name, H5P_DEFAULT);
+
+ // If the datatype's opening failed, throw an exception
+ if( type_id < 0 )
+ throwException("openArrayType", "H5Topen2 failed");
+
+ // No failure, create and return the ArrayType object
+ ArrayType array_type;
+ f_DataType_setId(&array_type, type_id);
+ return(array_type);
+}
+
+//--------------------------------------------------------------------------
+// Function: Group::openArrayType
+///\brief This is an overloaded member function, provided for convenience.
+/// It differs from the above function in that it takes an
+/// \c H5std_string for \a name.
+// Programmer Binh-Minh Ribler - Jul, 2005
+//--------------------------------------------------------------------------
+ArrayType Group::openArrayType( const H5std_string& name ) const
+{
+ return( openArrayType( name.c_str()) );
+}
+
+//--------------------------------------------------------------------------
+// Function: Group::openCompType
+///\brief Opens the named compound datatype at this location.
+///\param name - IN: Name of the compound datatype to open
+///\return CompType instance
+///\exception H5::FileIException or H5::GroupIException
+// Programmer Binh-Minh Ribler - 2000
+//--------------------------------------------------------------------------
+CompType Group::openCompType( const char* name ) const
+{
+ // Call C function H5Topen2 to open the named datatype in this group,
+ // given either the file or group id
+ hid_t type_id = H5Topen2(getLocId(), name, H5P_DEFAULT);
+
+ // If the datatype's opening failed, throw an exception
+ if( type_id < 0 )
+ throwException("openCompType", "H5Topen2 failed");
+
+ // No failure, create and return the CompType object
+ CompType comp_type;
+ f_DataType_setId(&comp_type, type_id);
+ return(comp_type);
+}
+
+//--------------------------------------------------------------------------
+// Function: Group::openCompType
+///\brief This is an overloaded member function, provided for convenience.
+/// It differs from the above function in that it takes an
+/// \c H5std_string for \a name.
+// Programmer Binh-Minh Ribler - 2000
+//--------------------------------------------------------------------------
+CompType Group::openCompType( const H5std_string& name ) const
+{
+ return( openCompType( name.c_str()) );
+}
+
+//--------------------------------------------------------------------------
+// Function: Group::openEnumType
+///\brief Opens the named enumeration datatype at this location.
+///\param name - IN: Name of the enumeration datatype to open
+///\return EnumType instance
+///\exception H5::FileIException or H5::GroupIException
+// Programmer Binh-Minh Ribler - 2000
+//--------------------------------------------------------------------------
+EnumType Group::openEnumType( const char* name ) const
+{
+ // Call C function H5Topen2 to open the named datatype in this group,
+ // given either the file or group id
+ hid_t type_id = H5Topen2(getLocId(), name, H5P_DEFAULT);
+
+ // If the datatype's opening failed, throw an exception
+ if( type_id < 0 )
+ throwException("openEnumType", "H5Topen2 failed");
+
+ // No failure, create and return the EnumType object
+ EnumType enum_type;
+ f_DataType_setId(&enum_type, type_id);
+ return(enum_type);
+}
+
+//--------------------------------------------------------------------------
+// Function: Group::openEnumType
+///\brief This is an overloaded member function, provided for convenience.
+/// It differs from the above function in that it takes an
+/// \c H5std_string for \a name.
+// Programmer Binh-Minh Ribler - 2000
+//--------------------------------------------------------------------------
+EnumType Group::openEnumType( const H5std_string& name ) const
+{
+ return( openEnumType( name.c_str()) );
+}
+
+//--------------------------------------------------------------------------
+// Function: Group::openIntType
+///\brief Opens the named integer datatype at this location.
+///\param name - IN: Name of the integer datatype to open
+///\return IntType instance
+///\exception H5::FileIException or H5::GroupIException
+// Programmer Binh-Minh Ribler - 2000
+//--------------------------------------------------------------------------
+IntType Group::openIntType( const char* name ) const
+{
+ // Call C function H5Topen2 to open the named datatype in this group,
+ // given either the file or group id
+ hid_t type_id = H5Topen2(getLocId(), name, H5P_DEFAULT);
+
+ // If the datatype's opening failed, throw an exception
+ if( type_id < 0 )
+ throwException("openIntType", "H5Topen2 failed");
+
+ // No failure, create and return the IntType object
+ IntType int_type;
+ f_DataType_setId(&int_type, type_id);
+ return(int_type);
+}
+
+//--------------------------------------------------------------------------
+// Function: Group::openIntType
+///\brief This is an overloaded member function, provided for convenience.
+/// It differs from the above function in that it takes an
+/// \c H5std_string for \a name.
+// Programmer Binh-Minh Ribler - 2000
+//--------------------------------------------------------------------------
+IntType Group::openIntType( const H5std_string& name ) const
+{
+ return( openIntType( name.c_str()) );
+}
+
+//--------------------------------------------------------------------------
+// Function: Group::openFloatType
+///\brief Opens the named floating-point datatype at this location.
+///\param name - IN: Name of the floating-point datatype to open
+///\return FloatType instance
+///\exception H5::FileIException or H5::GroupIException
+// Programmer Binh-Minh Ribler - 2000
+//--------------------------------------------------------------------------
+FloatType Group::openFloatType( const char* name ) const
+{
+ // Call C function H5Topen2 to open the named datatype in this group,
+ // given either the file or group id
+ hid_t type_id = H5Topen2(getLocId(), name, H5P_DEFAULT);
+
+ // If the datatype's opening failed, throw an exception
+ if( type_id < 0 )
+ throwException("openFloatType", "H5Topen2 failed");
+
+ // No failure, create and return the FloatType object
+ FloatType float_type;
+ f_DataType_setId(&float_type, type_id);
+ return(float_type);
+}
+
+//--------------------------------------------------------------------------
+// Function: Group::openFloatType
+///\brief This is an overloaded member function, provided for convenience.
+/// It differs from the above function in that it takes an
+/// \c H5std_string for \a name.
+// Programmer Binh-Minh Ribler - 2000
+//--------------------------------------------------------------------------
+FloatType Group::openFloatType( const H5std_string& name ) const
+{
+ return( openFloatType( name.c_str()) );
+}
+
+//--------------------------------------------------------------------------
+// Function: Group::openStrType
+///\brief Opens the named string datatype at this location.
+///\param name - IN: Name of the string datatype to open
+///\return StrType instance
+///\exception H5::FileIException or H5::GroupIException
+// Programmer Binh-Minh Ribler - 2000
+//--------------------------------------------------------------------------
+StrType Group::openStrType( const char* name ) const
+{
+ // Call C function H5Topen2 to open the named datatype in this group,
+ // given either the file or group id
+ hid_t type_id = H5Topen2(getLocId(), name, H5P_DEFAULT);
+
+ // If the datatype's opening failed, throw an exception
+ if( type_id < 0 )
+ throwException("openStrType", "H5Topen2 failed");
+
+ // No failure, create and return the StrType object
+ StrType str_type;
+ f_DataType_setId(&str_type, type_id);
+ return(str_type);
+}
+
+//--------------------------------------------------------------------------
+// Function: Group::openStrType
+///\brief This is an overloaded member function, provided for convenience.
+/// It differs from the above function in that it takes an
+/// \c H5std_string for \a name.
+// Programmer Binh-Minh Ribler - 2000
+//--------------------------------------------------------------------------
+StrType Group::openStrType( const H5std_string& name ) const
+{
+ return( openStrType( name.c_str()) );
+}
+
+//--------------------------------------------------------------------------
+// Function: Group::openVarLenType
+///\brief Opens the named variable length datatype at this location.
+///\param name - IN: Name of the variable length datatype to open
+///\return VarLenType instance
+///\exception H5::FileIException or H5::GroupIException
+// Programmer Binh-Minh Ribler - Jul, 2005
+//--------------------------------------------------------------------------
+VarLenType Group::openVarLenType( const char* name ) const
+{
+ // Call C function H5Topen2 to open the named datatype in this group,
+ // given either the file or group id
+ hid_t type_id = H5Topen2(getLocId(), name, H5P_DEFAULT);
+
+ // If the datatype's opening failed, throw an exception
+ if( type_id < 0 )
+ throwException("openVarLenType", "H5Topen2 failed");
+
+ // No failure, create and return the VarLenType object
+ VarLenType varlen_type;
+ f_DataType_setId(&varlen_type, type_id);
+ return(varlen_type);
+}
+
+//--------------------------------------------------------------------------
+// Function: Group::openVarLenType
+///\brief This is an overloaded member function, provided for convenience.
+/// It differs from the above function in that it takes an
+/// \c H5std_string for \a name.
+// Programmer Binh-Minh Ribler - Jul, 2005
+//--------------------------------------------------------------------------
+VarLenType Group::openVarLenType( const H5std_string& name ) const
+{
+ return( openVarLenType( name.c_str()) );
+}
+
+#ifndef H5_NO_DEPRECATED_SYMBOLS
+//--------------------------------------------------------------------------
+// Function: Group::iterateElems
+///\brief Iterates a user's function over the entries of a group.
+///\param name - IN : Name of group to iterate over
+///\param idx - IN/OUT: Starting (IN) and ending (OUT) entry indices
+///\param op - IN : User's function to operate on each entry
+///\param op_data - IN/OUT: Data associated with the operation
+///\return The return value of the first operator that returns non-zero,
+/// or zero if all members were processed with no operator
+/// returning non-zero.
+///\exception H5::FileIException or H5::GroupIException
+// Programmer Binh-Minh Ribler - 2000
+//--------------------------------------------------------------------------
+int Group::iterateElems( const char* name, int *idx, H5G_iterate_t op , void* op_data )
+{
+ int ret_value = H5Giterate(getId(), name, idx, op, op_data );
+ if( ret_value < 0 )
+ {
+ throwException("iterateElems", "H5Giterate failed");
+ }
+ return( ret_value );
+}
+
+//--------------------------------------------------------------------------
+// Function: Group::iterateElems
+///\brief This is an overloaded member function, provided for convenience.
+/// It differs from the above function in that it takes an
+/// \c H5std_string for \a name.
+// Programmer Binh-Minh Ribler - 2000
+//--------------------------------------------------------------------------
+int Group::iterateElems( const H5std_string& name, int *idx, H5G_iterate_t op , void* op_data )
+{
+ return( iterateElems( name.c_str(), idx, op, op_data ));
+}
+#endif /* H5_NO_DEPRECATED_SYMBOLS */
+
+//--------------------------------------------------------------------------
+// Function: Group::getNumObjs
+///\brief Returns the number of objects in this group.
+///\return Number of objects
+///\exception H5::FileIException or H5::GroupIException
+// Programmer Binh-Minh Ribler - January, 2003
+//--------------------------------------------------------------------------
+hsize_t Group::getNumObjs() const
+{
+ H5G_info_t ginfo; /* Group information */
+
+ herr_t ret_value = H5Gget_info(getLocId(), &ginfo);
+ if(ret_value < 0)
+ throwException("getNumObjs", "H5Gget_info failed");
+ return (ginfo.nlinks);
+}
+
+//--------------------------------------------------------------------------
+// Function: Group::getObjnameByIdx
+///\brief Returns the name of an object in this group, given the
+/// object's index.
+///\param idx - IN: Transient index of the object
+///\return Object name
+///\exception H5::FileIException or H5::GroupIException
+///\par Description
+/// The value of idx can be any nonnegative number less than the
+/// total number of objects in the group, which is returned by
+/// the function \c Group::getNumObjs. Note that this is a
+/// transient index; thus, an object may have a different index
+/// each time the group is opened.
+// Programmer Binh-Minh Ribler - Mar, 2005
+//--------------------------------------------------------------------------
+H5std_string Group::getObjnameByIdx(hsize_t idx) const
+{
+ // call H5Lget_name_by_idx with name as NULL to get its length
+ ssize_t name_len = H5Lget_name_by_idx(getLocId(), ".", H5_INDEX_NAME, H5_ITER_INC, idx, NULL, 0, H5P_DEFAULT);
+ if(name_len < 0)
+ throwException("getObjnameByIdx", "H5Lget_name_by_idx failed");
+
+ // now, allocate C buffer to get the name
+ char* name_C = new char[name_len+1];
+ HDmemset(name_C, 0, name_len+1); // clear buffer
+
+ name_len = H5Lget_name_by_idx(getLocId(), ".", H5_INDEX_NAME, H5_ITER_INC, idx, name_C, name_len+1, H5P_DEFAULT);
+
+ if (name_len < 0)
+ {
+ delete []name_C;
+ throwException("getObjnameByIdx", "H5Lget_name_by_idx failed");
+ }
+
+ // clean up and return the string
+ H5std_string name = H5std_string(name_C);
+ delete []name_C;
+ return (name);
+}
+
+//--------------------------------------------------------------------------
+// Function: Group::getObjnameByIdx
+///\brief Retrieves the name of an object in this group, given the
+/// object's index.
+///\param idx - IN: Transient index of the object
+///\param name - IN/OUT: Retrieved name of the object
+///\param size - IN: Length to retrieve
+///\return Actual size of the object name or 0, if object has no name
+///\exception H5::FileIException or H5::GroupIException
+///\par Description
+/// The value of idx can be any nonnegative number less than the
+/// total number of objects in the group, which is returned by
+/// the function \c Group::getNumObjs. Note that this is a
+/// transient index; thus, an object may have a different index
+/// each time the group is opened.
+// Programmer Binh-Minh Ribler - January, 2003
+//--------------------------------------------------------------------------
+ssize_t Group::getObjnameByIdx(hsize_t idx, char* name, size_t size) const
+{
+ ssize_t name_len = H5Lget_name_by_idx(getLocId(), ".", H5_INDEX_NAME, H5_ITER_INC, idx, name, size, H5P_DEFAULT);
+ if(name_len < 0)
+ throwException("getObjnameByIdx", "H5Lget_name_by_idx failed");
+
+ return (name_len);
+}
+
+//--------------------------------------------------------------------------
+// Function: Group::getObjnameByIdx
+///\brief This is an overloaded member function, provided for convenience.
+/// It differs from the above function in that it takes an
+/// \c H5std_string for \a name.
+// Programmer Binh-Minh Ribler - January, 2003
+//--------------------------------------------------------------------------
+ssize_t Group::getObjnameByIdx(hsize_t idx, H5std_string& name, size_t size) const
+{
+ char* name_C = new char[size+1]; // temporary C-string for object name
+ HDmemset(name_C, 0, size+1); // clear buffer
+
+ // call overloaded function to get the name
+ ssize_t name_len = getObjnameByIdx(idx, name_C, size+1);
+ if(name_len < 0)
+ {
+ delete []name_C;
+ throwException("getObjnameByIdx", "H5Lget_name_by_idx failed");
+ }
+
+ // clean up and return the string
+ name = H5std_string(name_C);
+ delete []name_C;
+ return (name_len);
+}
+
+//--------------------------------------------------------------------------
+// Function: Group::childObjType
+///\brief Returns the type of an object in this file/group, given the
+/// object's name.
+///\param objname - IN: Name of the object
+///\return Object type, which can have the following values for group,
+/// dataset, and named datatype
+/// \li \c H5O_TYPE_GROUP
+/// \li \c H5O_TYPE_DATASET
+/// \li \c H5O_TYPE_NAMED_DATATYPE
+/// Refer to the C API documentation for more details:
+/// http://www.hdfgroup.org/HDF5/doc/RM/RM_H5O.html#Object-GetInfo
+///\exception H5::FileIException or H5::GroupIException
+/// Exception will be thrown when:
+/// - an error returned by the C API
+/// - object type is not one of the valid values above
+// Programmer Binh-Minh Ribler - April, 2014
+//--------------------------------------------------------------------------
+H5O_type_t Group::childObjType(const char* objname) const
+{
+ H5O_info_t objinfo;
+ H5O_type_t objtype = H5O_TYPE_UNKNOWN;
+
+ // Use C API to get information of the object
+ herr_t ret_value = H5Oget_info_by_name(getLocId(), objname, &objinfo, H5P_DEFAULT);
+
+ // Throw exception if C API returns failure
+ if (ret_value < 0)
+ throwException("childObjType", "H5Oget_info_by_name failed");
+ // Return a valid type or throw an exception for unknown type
+ else
+ switch (objinfo.type)
+ {
+ case H5O_TYPE_GROUP:
+ case H5O_TYPE_DATASET:
+ case H5O_TYPE_NAMED_DATATYPE:
+ objtype = objinfo.type;
+ break;
+ case H5O_TYPE_UNKNOWN:
+ case H5O_TYPE_NTYPES:
+ default:
+ throwException("childObjType", "Unknown type of object");
+ }
+ return(objtype);
+}
+
+//--------------------------------------------------------------------------
+// Function: Group::childObjType
+///\brief This is an overloaded member function, provided for convenience.
+/// It takes an \a H5std_string for the object's name.
+///\brief Returns the type of an object in this group, given the
+/// object's name.
+///\param objname - IN: Name of the object (H5std_string&)
+///\exception H5::FileIException or H5::GroupIException
+// Programmer Binh-Minh Ribler - April, 2014
+//--------------------------------------------------------------------------
+H5O_type_t Group::childObjType(const H5std_string& objname) const
+{
+ // Use overloaded function
+ H5O_type_t objtype = childObjType(objname.c_str());
+ return(objtype);
+}
+
+//--------------------------------------------------------------------------
+// Function: Group::childObjType
+///\brief Returns the type of an object in this file/group, given the
+/// object's index and its type and order.
+///\param index - IN: Position of the object
+///\param index_type - IN: Type of the index, default to H5_INDEX_NAME
+///\param order - IN: Traversing order, default to H5_ITER_INC
+///\param objname - IN: Name of the object, default to "."
+///\return Object type, which can have the following values for group,
+/// dataset, and named datatype
+/// \li \c H5O_TYPE_GROUP
+/// \li \c H5O_TYPE_DATASET
+/// \li \c H5O_TYPE_NAMED_DATATYPE
+/// Refer to the C API documentation for more details:
+/// http://www.hdfgroup.org/HDF5/doc/RM/RM_H5O.html#Object-GetInfo
+///\exception H5::FileIException or H5::GroupIException
+/// Exception will be thrown when:
+/// - an error returned by the C API
+/// - object type is not one of the valid values above
+// Developer's Notes:
+// - this overload uses H5Oget_info_by_idx instead of H5Oget_info_by_name
+// like the previous childObjType()
+// - index is the required argument so, first
+// - objname is last because it's more likely the location is already
+// fully specified
+// - Leave property list out for now because C API is not using it, it
+// can be added later when needed.
+// Programmer Binh-Minh Ribler - April, 2014
+//--------------------------------------------------------------------------
+H5O_type_t Group::childObjType(hsize_t index, H5_index_t index_type, H5_iter_order_t order, const char* objname) const
+{
+ herr_t ret_value;
+ H5O_info_t objinfo;
+ H5O_type_t objtype = H5O_TYPE_UNKNOWN;
+
+ // Use C API to get information of the object
+ ret_value = H5Oget_info_by_idx(getLocId(), objname, index_type, order, index, &objinfo, H5P_DEFAULT);
+
+ // Throw exception if C API returns failure
+ if (ret_value < 0)
+ throwException("childObjType", "H5Oget_info_by_idx failed");
+ // Return a valid type or throw an exception for unknown type
+ else
+ switch (objinfo.type)
+ {
+ case H5O_TYPE_GROUP:
+ case H5O_TYPE_DATASET:
+ case H5O_TYPE_NAMED_DATATYPE:
+ objtype = objinfo.type;
+ break;
+ case H5O_TYPE_UNKNOWN:
+ case H5O_TYPE_NTYPES:
+ default:
+ throwException("childObjType", "Unknown type of object");
+ }
+ return(objtype);
+}
+
+//--------------------------------------------------------------------------
+// Function: Group::childObjVersion
+///\brief Returns the object header version of an object in this file/group,
+/// given the object's name.
+///\param objname - IN: Name of the object
+///\return Object version, which can have the following values:
+/// \li \c H5O_VERSION_1
+/// \li \c H5O_VERSION_2
+///\exception H5::FileIException or H5::GroupIException
+/// Exception will be thrown when:
+/// - an error returned by the C API
+/// - version number is not one of the valid values above
+// Programmer Binh-Minh Ribler - April, 2014
+//--------------------------------------------------------------------------
+unsigned Group::childObjVersion(const char* objname) const
+{
+ H5O_info_t objinfo;
+ unsigned version = 0;
+
+ // Use C API to get information of the object
+ herr_t ret_value = H5Oget_info_by_name(getLocId(), objname, &objinfo, H5P_DEFAULT);
+
+ // Throw exception if C API returns failure
+ if (ret_value < 0)
+ throwException("childObjVersion", "H5Oget_info_by_name failed");
+ // Return a valid version or throw an exception for invalid value
+ else
+ {
+ version = objinfo.hdr.version;
+ if (version != H5O_VERSION_1 && version != H5O_VERSION_2)
+ throwException("childObjVersion", "Invalid version for object");
+ }
+ return(version);
+}
+
+//--------------------------------------------------------------------------
+// Function: Group::childObjVersion
+///\brief This is an overloaded member function, provided for convenience.
+/// It takes an \a H5std_string for the object's name.
+///\brief Returns the type of an object in this group, given the
+/// object's name.
+///\param objname - IN: Name of the object (H5std_string&)
+///\exception H5::FileIException or H5::GroupIException
+// Programmer Binh-Minh Ribler - April, 2014
+//--------------------------------------------------------------------------
+unsigned Group::childObjVersion(const H5std_string& objname) const
+{
+ // Use overloaded function
+ unsigned version = childObjVersion(objname.c_str());
+ return(version);
+}
+
+#ifndef H5_NO_DEPRECATED_SYMBOLS
+#ifndef DOXYGEN_SHOULD_SKIP_THIS
+//--------------------------------------------------------------------------
+// Function: Group::getObjTypeByIdx
+///\brief Returns the type of an object in this group, given the
+/// object's index.
+///\param idx - IN: Transient index of the object
+///\return Object type
+///\exception H5::FileIException or H5::GroupIException
+// Programmer Binh-Minh Ribler - January, 2003
+//--------------------------------------------------------------------------
+H5G_obj_t Group::getObjTypeByIdx(hsize_t idx) const
+{
+ H5G_obj_t obj_type = H5Gget_objtype_by_idx(getLocId(), idx);
+ if (obj_type == H5G_UNKNOWN)
+ throwException("getObjTypeByIdx", "H5Gget_objtype_by_idx failed");
+
+ return (obj_type);
+}
+
+//--------------------------------------------------------------------------
+// Function: Group::getObjTypeByIdx
+///\brief This is an overloaded member function, provided for convenience.
+/// It differs from the above function because it also provides
+/// the returned object type in text (char*)
+///\param idx - IN: Transient index of the object
+///\param type_name - OUT: Object type in text
+///\return Object type
+///\exception H5::FileIException or H5::GroupIException
+// Programmer Binh-Minh Ribler - May, 2010
+// Modification
+// Modified to use the other function. -BMR, 2016/03/07
+//--------------------------------------------------------------------------
+H5G_obj_t Group::getObjTypeByIdx(hsize_t idx, char* type_name) const
+{
+ H5std_string stype_name(type_name);
+ return(getObjTypeByIdx(idx, stype_name));
+}
+//--------------------------------------------------------------------------
+// Function: Group::getObjTypeByIdx
+///\brief This is an overloaded member function, provided for convenience.
+/// It differs from the above function because it also provides
+/// the returned object type in text (H5std_string&)
+///\param idx - IN: Transient index of the object
+///\param type_name - OUT: Object type in text
+///\return Object type
+///\exception H5::FileIException or H5::GroupIException
+// Programmer Binh-Minh Ribler - January, 2003
+//--------------------------------------------------------------------------
+H5G_obj_t Group::getObjTypeByIdx(hsize_t idx, H5std_string& type_name) const
+{
+ H5G_obj_t obj_type = H5Gget_objtype_by_idx(getLocId(), idx);
+ switch (obj_type)
+ {
+ case H5G_LINK: type_name = H5std_string("symbolic link"); break;
+ case H5G_GROUP: type_name = H5std_string("group"); break;
+ case H5G_DATASET: type_name = H5std_string("dataset"); break;
+ case H5G_TYPE: type_name = H5std_string("datatype"); break;
+ case H5G_UNKNOWN:
+ case H5G_UDLINK:
+ case H5G_RESERVED_5:
+ case H5G_RESERVED_6:
+ case H5G_RESERVED_7:
+ default:
+ throwException("getObjTypeByIdx", "H5Gget_objtype_by_idx failed");
+ }
+ return (obj_type);
+}
+
+#endif // DOXYGEN_SHOULD_SKIP_THIS
+#endif /* H5_NO_DEPRECATED_SYMBOLS */
+
+#ifndef DOXYGEN_SHOULD_SKIP_THIS
+
+//--------------------------------------------------------------------------
+// Function: f_DataType_setId - friend
+// Purpose: This function is friend to class H5::DataType so that it
+// can set DataType::id in order to work around a problem
+// described in the JIRA issue HDFFV-7947.
+// Applications shouldn't need to use it.
+// param dtype - IN/OUT: DataType object to be changed
+// param new_id - IN: New id to set
+// Programmer Binh-Minh Ribler - 2015
+//--------------------------------------------------------------------------
+void f_DataType_setId(DataType* dtype, hid_t new_id)
+{
+ dtype->p_setId(new_id);
+}
+
+//--------------------------------------------------------------------------
+// Function: f_DataSet_setId - friend
+// Purpose: This function is friend to class H5::DataSet so that it
+// can set DataSet::id in order to work around a problem
+// described in the JIRA issue HDFFV-7947.
+// Applications shouldn't need to use it.
+// param dset - IN/OUT: DataSet object to be changed
+// param new_id - IN: New id to set
+// Programmer Binh-Minh Ribler - 2015
+//--------------------------------------------------------------------------
+void f_DataSet_setId(DataSet* dset, hid_t new_id)
+{
+ dset->p_setId(new_id);
+}
+
+#endif // DOXYGEN_SHOULD_SKIP_THIS
+
#ifndef H5_NO_NAMESPACE
} // end namespace
#endif
diff --git a/c++/src/H5Group.h b/c++/src/H5Group.h
index 1bd9882..e8527d8 100644
--- a/c++/src/H5Group.h
+++ b/c++/src/H5Group.h
@@ -14,8 +14,8 @@
* access to either file, you may request a copy from help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
-#ifndef __H5Group_H
-#define __H5Group_H
+#ifndef __Group_H
+#define __Group_H
#ifndef H5_NO_NAMESPACE
namespace H5 {
@@ -26,8 +26,147 @@ namespace H5 {
It inherits many operations from H5Location and CommonFG.
*/
-class H5_DLLCPP Group : public H5Object, public CommonFG {
+// Class forwarding
+//class Group;
+//class H5File;
+class ArrayType;
+class VarLenType;
+
+/*! \class CommonFG
+ \brief \a CommonFG is an abstract base class of H5File and Group.
+
+ It provides common operations of H5File and Group.
+*/
+class H5_DLLCPP Group : public H5Object {
public:
+ // Group constructor to create a group or file (aka root group).
+ Group(const char* name, size_t size_hint = 0);
+ Group(const H5std_string& name, size_t size_hint = 0);
+
+ // Group constructor to open a group or file (aka root group).
+ Group(const char* name);
+ Group(const H5std_string& name);
+
+// From CommonFG
+ // Creates a new group at this location which can be a file
+ // or another group.
+ Group createGroup(const char* name, size_t size_hint = 0) const;
+ Group createGroup(const H5std_string& name, size_t size_hint = 0) const;
+
+ // Opens an existing group in a location which can be a file
+ // or another group.
+ Group openGroup(const char* name) const;
+ Group openGroup(const H5std_string& name) const;
+
+ // Creates a new dataset in this group.
+ DataSet createDataSet(const char* name, const DataType& data_type, const DataSpace& data_space, const DSetCreatPropList& create_plist = DSetCreatPropList::DEFAULT) const;
+ DataSet createDataSet(const H5std_string& name, const DataType& data_type, const DataSpace& data_space, const DSetCreatPropList& create_plist = DSetCreatPropList::DEFAULT) const;
+
+ // Opens an existing dataset at this location.
+ DataSet openDataSet(const char* name) const;
+ DataSet openDataSet(const H5std_string& name) const;
+
+ // Returns the value of a symbolic link.
+ H5std_string getLinkval(const char* link_name, size_t size=0) const;
+ H5std_string getLinkval(const H5std_string& link_name, size_t size=0) const;
+
+ // Returns the number of objects in this group.
+ hsize_t getNumObjs() const;
+
+ // Retrieves the name of an object in this group, given the
+ // object's index.
+ H5std_string getObjnameByIdx(hsize_t idx) const;
+ ssize_t getObjnameByIdx(hsize_t idx, char* name, size_t size) const;
+ ssize_t getObjnameByIdx(hsize_t idx, H5std_string& name, size_t size) const;
+
+ // Retrieves the type of an object in this file or group, given the
+ // object's name
+ H5O_type_t childObjType(const H5std_string& objname) const;
+ H5O_type_t childObjType(const char* objname) const;
+ H5O_type_t childObjType(hsize_t index, H5_index_t index_type=H5_INDEX_NAME, H5_iter_order_t order=H5_ITER_INC, const char* objname=".") const;
+
+ // Returns the object header version of an object in this file or group,
+ // given the object's name.
+ unsigned childObjVersion(const char* objname) const;
+ unsigned childObjVersion(const H5std_string& objname) const;
+
+#ifndef H5_NO_DEPRECATED_SYMBOLS
+ // Returns the type of an object in this group, given the
+ // object's index.
+ H5G_obj_t getObjTypeByIdx(hsize_t idx) const;
+ H5G_obj_t getObjTypeByIdx(hsize_t idx, char* type_name) const;
+ H5G_obj_t getObjTypeByIdx(hsize_t idx, H5std_string& type_name) const;
+
+ // Returns information about an HDF5 object, given by its name,
+ // at this location.
+ void getObjinfo(const char* name, hbool_t follow_link, H5G_stat_t& statbuf) const;
+ void getObjinfo(const H5std_string& name, hbool_t follow_link, H5G_stat_t& statbuf) const;
+ void getObjinfo(const char* name, H5G_stat_t& statbuf) const;
+ void getObjinfo(const H5std_string& name, H5G_stat_t& statbuf) const;
+
+ // Iterates over the elements of this group - not implemented in
+ // C++ style yet.
+ int iterateElems(const char* name, int *idx, H5G_iterate_t op, void *op_data);
+ int iterateElems(const H5std_string& name, int *idx, H5G_iterate_t op, void *op_data);
+#endif /* H5_NO_DEPRECATED_SYMBOLS */
+
+ // Creates a link of the specified type from new_name to current_name;
+ // both names are interpreted relative to the specified location id.
+ void link(H5L_type_t link_type, const char* curr_name, const char* new_name) const;
+ void link(H5L_type_t link_type, const H5std_string& curr_name, const H5std_string& new_name) const;
+
+ // Removes the specified name at this location.
+ void unlink(const char* name) const;
+ void unlink(const H5std_string& name) const;
+
+ // Mounts the file 'child' onto this location.
+ void mount(const char* name, const H5File& child, const PropList& plist) const;
+ //void mount(const char* name, H5File& child, PropList& plist) const; // removed from 1.8.18 and 1.10.1
+ void mount(const H5std_string& name, const H5File& child, const PropList& plist) const;
+ //void mount(const H5std_string& name, H5File& child, PropList& plist) const; // removed from 1.8.18 and 1.10.1
+
+ // Unmounts the file named 'name' from this parent location.
+ void unmount(const char* name) const;
+ void unmount(const H5std_string& name) const;
+
+ // Renames an object at this location.
+ void move(const char* src, const char* dst) const;
+ void move(const H5std_string& src, const H5std_string& dst) const;
+
+ // Opens a generic named datatype in this location.
+ DataType openDataType(const char* name) const;
+ DataType openDataType(const H5std_string& name) const;
+
+ // Opens a named array datatype in this location.
+ ArrayType openArrayType(const char* name) const;
+ ArrayType openArrayType(const H5std_string& name) const;
+
+ // Opens a named compound datatype in this location.
+ CompType openCompType(const char* name) const;
+ CompType openCompType(const H5std_string& name) const;
+
+ // Opens a named enumeration datatype in this location.
+ EnumType openEnumType(const char* name) const;
+ EnumType openEnumType(const H5std_string& name) const;
+
+ // Opens a named integer datatype in this location.
+ IntType openIntType(const char* name) const;
+ IntType openIntType(const H5std_string& name) const;
+
+ // Opens a named floating-point datatype in this location.
+ FloatType openFloatType(const char* name) const;
+ FloatType openFloatType(const H5std_string& name) const;
+
+ // Opens a named string datatype in this location.
+ StrType openStrType(const char* name) const;
+ StrType openStrType(const H5std_string& name) const;
+
+ // Opens a named variable length datatype in this location.
+ VarLenType openVarLenType(const char* name) const;
+ VarLenType openVarLenType(const H5std_string& name) const;
+
+// end from CommonFG
+
// Close this group.
virtual void close();
@@ -68,7 +207,8 @@ class H5_DLLCPP Group : public H5Object, public CommonFG {
private:
hid_t id; // HDF5 group id
};
+
#ifndef H5_NO_NAMESPACE
}
#endif
-#endif // __H5Group_H
+#endif // __Group_H
diff --git a/c++/src/H5IntType.cpp b/c++/src/H5IntType.cpp
index 5719eed..780e44d 100644
--- a/c++/src/H5IntType.cpp
+++ b/c++/src/H5IntType.cpp
@@ -19,10 +19,10 @@
#include "H5Exception.h"
#include "H5IdComponent.h"
#include "H5PropList.h"
+#include "H5Location.h"
#include "H5Object.h"
#include "H5OcreatProp.h"
#include "H5DcreatProp.h"
-#include "H5CommonFG.h"
#include "H5DataType.h"
#include "H5AbstractDs.h"
#include "H5DxferProp.h"
diff --git a/c++/src/H5Library.cpp b/c++/src/H5Library.cpp
index 471dbad..30f68e2 100644
--- a/c++/src/H5Library.cpp
+++ b/c++/src/H5Library.cpp
@@ -25,6 +25,7 @@
#include "H5FcreatProp.h"
#include "H5OcreatProp.h"
#include "H5DxferProp.h"
+#include "H5Location.h"
#include "H5Object.h"
#include "H5DataType.h"
#include "H5DcreatProp.h"
diff --git a/c++/src/H5Location.cpp b/c++/src/H5Location.cpp
index c4debba..4048d94 100644
--- a/c++/src/H5Location.cpp
+++ b/c++/src/H5Location.cpp
@@ -26,10 +26,10 @@
#include "H5DxferProp.h"
#include "H5FaccProp.h"
#include "H5FcreatProp.h"
-#include "H5CommonFG.h"
#include "H5DataType.h"
#include "H5DataSpace.h"
#include "H5AbstractDs.h"
+#include "H5Group.h"
#include "H5File.h"
#include "H5DataSet.h"
#include "H5Attribute.h"
@@ -40,21 +40,6 @@ namespace H5 {
#endif
#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.
-extern "C" herr_t userAttrOpWrpr(hid_t loc_id, const char *attr_name,
- const H5A_info_t *ainfo, void *op_data)
-{
- H5std_string s_attr_name = H5std_string( attr_name );
-#ifdef NO_STATIC_CAST
- UserData4Aiterate* myData = (UserData4Aiterate *) op_data;
-#else
- UserData4Aiterate* myData = reinterpret_cast<UserData4Aiterate *> (op_data);
-#endif
- myData->op( *myData->location, s_attr_name, myData->opData );
- return 0;
-}
//--------------------------------------------------------------------------
// Function: H5Location default constructor (protected)
@@ -74,8 +59,9 @@ H5Location::H5Location() : IdComponent() {}
// been moved to the sub-classes. It will be removed in 1.10 release. If its
// removal does not raise any problems in 1.10, it will be removed from 1.8 in
// subsequent releases.
+// Removed in 1.10.1 - Aug 2016
//--------------------------------------------------------------------------
-H5Location::H5Location(const hid_t object_id) : IdComponent() {}
+// H5Location::H5Location(const hid_t object_id) : IdComponent() {}
//--------------------------------------------------------------------------
// Function: H5Location copy constructor
@@ -94,264 +80,6 @@ H5Location::H5Location(const hid_t object_id) : IdComponent() {}
#endif // DOXYGEN_SHOULD_SKIP_THIS
//--------------------------------------------------------------------------
-// Function: H5Location::createAttribute
-///\brief Creates an attribute for a group, dataset, or named datatype.
-///\param name - IN: Name of the attribute
-///\param data_type - IN: Datatype for the attribute
-///\param data_space - IN: Dataspace for the attribute - only simple
-/// dataspaces are allowed at this time
-///\param create_plist - IN: Creation property list - default to
-/// PropList::DEFAULT
-///\return Attribute instance
-///\exception H5::AttributeIException
-///\par Description
-/// The attribute name specified in \a name must be unique.
-/// Attempting to create an attribute with the same name as an
-/// existing attribute will raise an exception, leaving the
-/// pre-existing attribute intact. To overwrite an existing
-/// attribute with a new attribute of the same name, first
-/// delete the existing one with \c H5Location::removeAttr, then
-/// recreate it with this function.
-// Programmer Binh-Minh Ribler - 2000
-//--------------------------------------------------------------------------
-Attribute H5Location::createAttribute( const char* name, const DataType& data_type, const DataSpace& data_space, const PropList& create_plist ) const
-{
- hid_t type_id = data_type.getId();
- hid_t space_id = data_space.getId();
- hid_t plist_id = create_plist.getId();
- hid_t attr_id = H5Acreate2(getId(), name, type_id, space_id, plist_id, H5P_DEFAULT );
-
- // If the attribute id is valid, create and return the Attribute object
- if( attr_id > 0 )
- {
- Attribute attr;
- f_Attribute_setId(&attr, attr_id);
- return( attr );
- }
- else
- throw AttributeIException(inMemFunc("createAttribute"), "H5Acreate2 failed");
-}
-
-//--------------------------------------------------------------------------
-// Function: H5Location::createAttribute
-///\brief This is an overloaded member function, provided for convenience.
-/// It differs from the above function in that it takes
-/// a reference to an \c H5std_string for \a name.
-// Programmer Binh-Minh Ribler - 2000
-//--------------------------------------------------------------------------
-Attribute H5Location::createAttribute( const H5std_string& name, const DataType& data_type, const DataSpace& data_space, const PropList& create_plist ) const
-{
- return( createAttribute( name.c_str(), data_type, data_space, create_plist ));
-}
-
-//--------------------------------------------------------------------------
-// Function: H5Location::openAttribute
-///\brief Opens an attribute given its name.
-///\param name - IN: Name of the attribute
-///\return Attribute instance
-///\exception H5::AttributeIException
-// Programmer Binh-Minh Ribler - 2000
-//--------------------------------------------------------------------------
-Attribute H5Location::openAttribute( const char* name ) const
-{
- hid_t attr_id = H5Aopen(getId(), name, H5P_DEFAULT);
- if( attr_id > 0 )
- {
- Attribute attr;
- f_Attribute_setId(&attr, attr_id);
- return( attr );
- }
- else
- {
- throw AttributeIException(inMemFunc("openAttribute"), "H5Aopen failed");
- }
-}
-
-//--------------------------------------------------------------------------
-// Function: H5Location::openAttribute
-///\brief This is an overloaded member function, provided for convenience.
-/// It differs from the above function in that it takes
-/// a reference to an \c H5std_string for \a name.
-// Programmer Binh-Minh Ribler - 2000
-//--------------------------------------------------------------------------
-Attribute H5Location::openAttribute( const H5std_string& name ) const
-{
- return( openAttribute( name.c_str()) );
-}
-
-//--------------------------------------------------------------------------
-// Function: H5Location::openAttribute
-///\brief Opens an attribute given its index.
-///\param idx - IN: Index of the attribute, a 0-based, non-negative integer
-///\return Attribute instance
-///\exception H5::AttributeIException
-// Programmer Binh-Minh Ribler - 2000
-//--------------------------------------------------------------------------
-Attribute H5Location::openAttribute( const unsigned int idx ) const
-{
- hid_t attr_id = H5Aopen_by_idx(getId(), ".", H5_INDEX_CRT_ORDER,
- H5_ITER_INC, static_cast<hsize_t>(idx), H5P_DEFAULT, H5P_DEFAULT);
- if( attr_id > 0 )
- {
- Attribute attr;
- f_Attribute_setId(&attr, attr_id);
- return(attr);
- }
- else
- {
- throw AttributeIException(inMemFunc("openAttribute"), "H5Aopen_by_idx failed");
- }
-}
-
-//--------------------------------------------------------------------------
-// Function: H5Location::iterateAttrs
-///\brief Iterates a user's function over all the attributes of an H5
-/// object, which may be a group, dataset or named datatype.
-///\param user_op - IN: User's function to operate on each attribute
-///\param _idx - IN/OUT: Starting (IN) and ending (OUT) attribute indices
-///\param op_data - IN: User's data to pass to user's operator function
-///\return Returned value of the last operator if it was non-zero, or
-/// zero if all attributes were processed
-///\exception H5::AttributeIException
-///\par Description
-/// The signature of user_op is
-/// void (*)(H5::H5Location&, H5std_string, void*).
-/// For information, please refer to the C layer Reference Manual
-/// at:
-/// http://www.hdfgroup.org/HDF5/doc/RM/RM_H5A.html#Annot-Iterate
-// Programmer Binh-Minh Ribler - 2000
-//--------------------------------------------------------------------------
-int H5Location::iterateAttrs( attr_operator_t user_op, unsigned *_idx, void *op_data )
-{
- // store the user's function and data
- UserData4Aiterate* userData = new UserData4Aiterate;
- userData->opData = op_data;
- userData->op = user_op;
- userData->location = this;
-
- // call the C library routine H5Aiterate2 to iterate the attributes
- hsize_t idx = _idx ? static_cast<hsize_t>(*_idx) : 0;
- int ret_value = H5Aiterate2(getId(), H5_INDEX_NAME, H5_ITER_INC, &idx,
- userAttrOpWrpr, reinterpret_cast<void *>(userData));
-
- // release memory
- delete userData;
-
- if( ret_value >= 0 ) {
- /* Pass back update index value to calling code */
- if (_idx)
- *_idx = static_cast<unsigned>(idx);
-
- return( ret_value );
- }
- else // raise exception when H5Aiterate returns a negative value
- throw AttributeIException(inMemFunc("iterateAttrs"), "H5Aiterate2 failed");
-}
-
-//--------------------------------------------------------------------------
-// Function: H5Location::getNumAttrs
-///\brief Returns the number of attributes attached to this HDF5 object.
-///\return Number of attributes
-///\exception H5::AttributeIException
-// Programmer Binh-Minh Ribler - 2000
-//--------------------------------------------------------------------------
-int H5Location::getNumAttrs() const
-{
- H5O_info_t oinfo; /* Object info */
-
- if(H5Oget_info(getId(), &oinfo) < 0)
- throw AttributeIException(inMemFunc("getNumAttrs"), "H5Oget_info failed");
- else
- return(static_cast<int>(oinfo.num_attrs));
-}
-
-//--------------------------------------------------------------------------
-// Function: H5Location::attrExists
-///\brief Checks whether the named attribute exists at this location.
-///\param name - IN: Name of the attribute to be queried
-///\exception H5::AttributeIException
-// Programmer Binh-Minh Ribler - 2013
-//--------------------------------------------------------------------------
-bool H5Location::attrExists(const char* name) const
-{
- // Call C routine H5Aexists to determine whether an attribute exists
- // at this location, which could be specified by a file, group, dataset,
- // or named datatype.
- herr_t ret_value = H5Aexists(getId(), name);
- if( ret_value > 0 )
- return true;
- else if(ret_value == 0)
- return false;
- else // Raise exception when H5Aexists returns a negative value
- throw AttributeIException(inMemFunc("attrExists"), "H5Aexists failed");
-}
-
-//--------------------------------------------------------------------------
-// Function: H5Location::attrExists
-///\brief This is an overloaded member function, provided for convenience.
-/// It differs from the above function in that it takes
-/// a reference to an \c H5std_string for \a name.
-// Programmer Binh-Minh Ribler - 2000
-//--------------------------------------------------------------------------
-bool H5Location::attrExists(const H5std_string& name) const
-{
- return(attrExists(name.c_str()));
-}
-
-//--------------------------------------------------------------------------
-// Function: H5Location::removeAttr
-///\brief Removes the named attribute from this object.
-///\param name - IN: Name of the attribute to be removed
-///\exception H5::AttributeIException
-// Programmer Binh-Minh Ribler - 2000
-//--------------------------------------------------------------------------
-void H5Location::removeAttr( const char* name ) const
-{
- herr_t ret_value = H5Adelete(getId(), name);
- if( ret_value < 0 )
- throw AttributeIException(inMemFunc("removeAttr"), "H5Adelete failed");
-}
-
-//--------------------------------------------------------------------------
-// Function: H5Location::removeAttr
-///\brief This is an overloaded member function, provided for convenience.
-/// It differs from the above function in that it takes
-/// a reference to an \c H5std_string for \a name.
-// Programmer Binh-Minh Ribler - 2000
-//--------------------------------------------------------------------------
-void H5Location::removeAttr( const H5std_string& name ) const
-{
- removeAttr( name.c_str() );
-}
-
-//--------------------------------------------------------------------------
-// Function: H5Location::renameAttr
-///\brief Renames the named attribute from this object.
-///\param oldname - IN: Name of the attribute to be renamed
-///\param newname - IN: New name ame of the attribute
-///\exception H5::AttributeIException
-// Programmer Binh-Minh Ribler - Mar, 2005
-//--------------------------------------------------------------------------
-void H5Location::renameAttr(const char* oldname, const char* newname) const
-{
- herr_t ret_value = H5Arename(getId(), oldname, newname);
- if (ret_value < 0)
- throw AttributeIException(inMemFunc("renameAttr"), "H5Arename failed");
-}
-
-//--------------------------------------------------------------------------
-// Function: H5Location::renameAttr
-///\brief This is an overloaded member function, provided for convenience.
-/// It differs from the above function in that it takes
-/// a reference to an \c H5std_string for the names.
-// Programmer Binh-Minh Ribler - Mar, 2005
-//--------------------------------------------------------------------------
-void H5Location::renameAttr(const H5std_string& oldname, const H5std_string& newname) const
-{
- renameAttr (oldname.c_str(), newname.c_str());
-}
-
-//--------------------------------------------------------------------------
// Function: H5Location::flush
///\brief Flushes all buffers associated with a location to disk.
///\param scope - IN: Specifies the scope of the flushing action,
@@ -563,8 +291,8 @@ H5std_string H5Location::getComment(const char* name, size_t buf_size) const
HDmemset(comment_C, 0, tmp_len+1); // clear buffer
// Used overloaded function
- ssize_t comment_len = getComment(name, tmp_len+1, comment_C);
- if (comment_len < 0)
+ ssize_t temp_len = getComment(name, tmp_len+1, comment_C);
+ if (temp_len < 0)
{
delete []comment_C;
throw LocationException("H5Location::getComment", "H5Oget_comment_by_name failed");
diff --git a/c++/src/H5Location.h b/c++/src/H5Location.h
index 9e4ec05..9000c5c 100644
--- a/c++/src/H5Location.h
+++ b/c++/src/H5Location.h
@@ -23,20 +23,21 @@
namespace H5 {
#endif
-class H5_DLLCPP H5Location; // forward declaration for UserData4Aiterate
+//class H5_DLLCPP H5Location; // forward declaration for UserData4Aiterate
// Define the operator function pointer for H5Aiterate().
-typedef void (*attr_operator_t)( H5Location& loc/*in*/,
- const H5std_string attr_name/*in*/,
- void *operator_data/*in,out*/);
+//typedef void (*attr_operator_t)( H5Location& loc/*in*/,
+ //const H5std_string attr_name/*in*/,
+ //void *operator_data/*in,out*/);
//! User data for attribute iteration
-class UserData4Aiterate {
+ /* class UserData4Aiterate {
public:
attr_operator_t op;
void* opData;
H5Location* location;
};
+ */
/*! \class H5Location
\brief H5Location is an abstract base class, added in version 1.8.12.
@@ -49,29 +50,12 @@ class UserData4Aiterate {
// a location can be a file, group, dataset, or named datatype. -BMR, 2013-10-1
class H5_DLLCPP H5Location : public IdComponent {
public:
- // Creates an attribute for the specified object at this location
- // PropList is currently not used, so always be default.
- Attribute createAttribute( const char* name, const DataType& type, const DataSpace& space, const PropList& create_plist = PropList::DEFAULT ) const;
- Attribute createAttribute( const H5std_string& name, const DataType& type, const DataSpace& space, const PropList& create_plist = PropList::DEFAULT ) const;
-
- // Given its name, opens the attribute that belongs to an object at
- // this location.
- Attribute openAttribute( const char* name ) const;
- Attribute openAttribute( const H5std_string& name ) const;
-
- // Given its index, opens the attribute that belongs to an object at
- // this location.
- Attribute openAttribute( const unsigned int idx ) const;
-
// Flushes all buffers associated with this location to disk.
void flush( H5F_scope_t scope ) const;
// Gets the name of the file, specified by this location.
H5std_string getFileName() const;
- // Determines the number of attributes at this location.
- int getNumAttrs() const;
-
#ifndef H5_NO_DEPRECATED_SYMBOLS
// Retrieves the type of object that an object reference points to.
H5G_obj_t getObjType(void *ref, H5R_type_t ref_type = H5R_OBJECT) const;
@@ -82,21 +66,6 @@ class H5_DLLCPP H5Location : public IdComponent {
// Note: getRefObjType deprecates getObjType, but getObjType's name is
// misleading, so getRefObjType is used in the new function instead.
- // Iterate user's function over the attributes at this location.
- int iterateAttrs(attr_operator_t user_op, unsigned* idx = NULL, void* op_data = NULL);
-
- // Checks whether the named attribute exists at this location.
- bool attrExists(const char* name) const;
- bool attrExists(const H5std_string& name) const;
-
- // Renames the named attribute to a new name.
- void renameAttr(const char* oldname, const char* newname) const;
- void renameAttr(const H5std_string& oldname, const H5std_string& newname) const;
-
- // Removes the named attribute from this location.
- void removeAttr(const char* name) const;
- void removeAttr(const H5std_string& name) const;
-
// Sets the comment for an HDF5 object specified by its name.
void setComment(const char* name, const char* comment) const;
void setComment(const H5std_string& name, const H5std_string& comment) const;
diff --git a/c++/src/H5Object.cpp b/c++/src/H5Object.cpp
index 3cce9fe..0cb392d 100644
--- a/c++/src/H5Object.cpp
+++ b/c++/src/H5Object.cpp
@@ -19,16 +19,17 @@
#include "H5Exception.h"
#include "H5IdComponent.h"
#include "H5PropList.h"
+#include "H5Location.h"
#include "H5Object.h"
#include "H5OcreatProp.h"
#include "H5DcreatProp.h"
#include "H5DxferProp.h"
#include "H5FaccProp.h"
#include "H5FcreatProp.h"
-#include "H5CommonFG.h"
#include "H5DataType.h"
#include "H5DataSpace.h"
#include "H5AbstractDs.h"
+#include "H5Group.h"
#include "H5File.h"
#include "H5DataSet.h"
#include "H5Attribute.h"
@@ -39,6 +40,19 @@ namespace H5 {
#endif
#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.
+extern "C" herr_t userAttrOpWrpr(hid_t loc_id, const char *attr_name,
+ const H5A_info_t *ainfo, void *op_data)
+{
+ H5std_string s_attr_name = H5std_string( attr_name );
+ UserData4Aiterate* myData = reinterpret_cast<UserData4Aiterate *> (op_data);
+ myData->op( *myData->location, s_attr_name, myData->opData );
+ return 0;
+}
+#endif
+
//--------------------------------------------------------------------------
// Function: H5Object default constructor (protected)
// Programmer Binh-Minh Ribler - 2000
@@ -56,8 +70,9 @@ H5Object::H5Object() : H5Location() {}
// been moved to the sub-classes. It will be removed in 1.10 release. If its
// removal does not raise any problems in 1.10, it will be removed from 1.8 in
// subsequent releases.
+// Removed in 1.10.1 - Aug 2016
//--------------------------------------------------------------------------
-H5Object::H5Object(const hid_t object_id) : H5Location() {}
+//H5Object::H5Object(const hid_t object_id) : H5Location() {}
//--------------------------------------------------------------------------
// Function: H5Object copy constructor
@@ -72,6 +87,264 @@ H5Object::H5Object(const hid_t object_id) : H5Location() {}
//--------------------------------------------------------------------------
// H5Object::H5Object(const H5Object& original) : H5Location() {}
+
+//--------------------------------------------------------------------------
+// Function: H5Object::createAttribute
+///\brief Creates an attribute for a group, dataset, or named datatype.
+///\param name - IN: Name of the attribute
+///\param data_type - IN: Datatype for the attribute
+///\param data_space - IN: Dataspace for the attribute - only simple
+/// dataspaces are allowed at this time
+///\param create_plist - IN: Creation property list - default to
+/// PropList::DEFAULT
+///\return Attribute instance
+///\exception H5::AttributeIException
+///\par Description
+/// The attribute name specified in \a name must be unique.
+/// Attempting to create an attribute with the same name as an
+/// existing attribute will raise an exception, leaving the
+/// pre-existing attribute intact. To overwrite an existing
+/// attribute with a new attribute of the same name, first
+/// delete the existing one with \c H5Object::removeAttr, then
+/// recreate it with this function.
+// Programmer Binh-Minh Ribler - 2000
+//--------------------------------------------------------------------------
+Attribute H5Object::createAttribute( const char* name, const DataType& data_type, const DataSpace& data_space, const PropList& create_plist ) const
+{
+ hid_t type_id = data_type.getId();
+ hid_t space_id = data_space.getId();
+ hid_t plist_id = create_plist.getId();
+ hid_t attr_id = H5Acreate2(getId(), name, type_id, space_id, plist_id, H5P_DEFAULT );
+
+ // If the attribute id is valid, create and return the Attribute object
+ if( attr_id > 0 )
+ {
+ Attribute attr;
+ f_Attribute_setId(&attr, attr_id);
+ return( attr );
+ }
+ else
+ throw AttributeIException(inMemFunc("createAttribute"), "H5Acreate2 failed");
+}
+
+//--------------------------------------------------------------------------
+// Function: H5Object::createAttribute
+///\brief This is an overloaded member function, provided for convenience.
+/// It differs from the above function in that it takes
+/// a reference to an \c H5std_string for \a name.
+// Programmer Binh-Minh Ribler - 2000
+//--------------------------------------------------------------------------
+Attribute H5Object::createAttribute( const H5std_string& name, const DataType& data_type, const DataSpace& data_space, const PropList& create_plist ) const
+{
+ return( createAttribute( name.c_str(), data_type, data_space, create_plist ));
+}
+
+//--------------------------------------------------------------------------
+// Function: H5Object::openAttribute
+///\brief Opens an attribute given its name.
+///\param name - IN: Name of the attribute
+///\return Attribute instance
+///\exception H5::AttributeIException
+// Programmer Binh-Minh Ribler - 2000
+//--------------------------------------------------------------------------
+Attribute H5Object::openAttribute( const char* name ) const
+{
+ hid_t attr_id = H5Aopen(getId(), name, H5P_DEFAULT);
+ if( attr_id > 0 )
+ {
+ Attribute attr;
+ f_Attribute_setId(&attr, attr_id);
+ return( attr );
+ }
+ else
+ {
+ throw AttributeIException(inMemFunc("openAttribute"), "H5Aopen failed");
+ }
+}
+
+//--------------------------------------------------------------------------
+// Function: H5Object::openAttribute
+///\brief This is an overloaded member function, provided for convenience.
+/// It differs from the above function in that it takes
+/// a reference to an \c H5std_string for \a name.
+// Programmer Binh-Minh Ribler - 2000
+//--------------------------------------------------------------------------
+Attribute H5Object::openAttribute( const H5std_string& name ) const
+{
+ return( openAttribute( name.c_str()) );
+}
+
+//--------------------------------------------------------------------------
+// Function: H5Object::openAttribute
+///\brief Opens an attribute given its index.
+///\param idx - IN: Index of the attribute, a 0-based, non-negative integer
+///\return Attribute instance
+///\exception H5::AttributeIException
+// Programmer Binh-Minh Ribler - 2000
+//--------------------------------------------------------------------------
+Attribute H5Object::openAttribute( const unsigned int idx ) const
+{
+ hid_t attr_id = H5Aopen_by_idx(getId(), ".", H5_INDEX_CRT_ORDER,
+ H5_ITER_INC, static_cast<hsize_t>(idx), H5P_DEFAULT, H5P_DEFAULT);
+ if( attr_id > 0 )
+ {
+ Attribute attr;
+ f_Attribute_setId(&attr, attr_id);
+ return(attr);
+ }
+ else
+ {
+ throw AttributeIException(inMemFunc("openAttribute"), "H5Aopen_by_idx failed");
+ }
+}
+
+//--------------------------------------------------------------------------
+// Function: H5Object::iterateAttrs
+///\brief Iterates a user's function over all the attributes of an H5
+/// object, which may be a group, dataset or named datatype.
+///\param user_op - IN: User's function to operate on each attribute
+///\param _idx - IN/OUT: Starting (IN) and ending (OUT) attribute indices
+///\param op_data - IN: User's data to pass to user's operator function
+///\return Returned value of the last operator if it was non-zero, or
+/// zero if all attributes were processed
+///\exception H5::AttributeIException
+///\par Description
+/// The signature of user_op is
+/// void (*)(H5::H5Location&, H5std_string, void*).
+/// For information, please refer to the C layer Reference Manual
+/// at:
+/// http://www.hdfgroup.org/HDF5/doc/RM/RM_H5A.html#Annot-Iterate
+// Programmer Binh-Minh Ribler - 2000
+//--------------------------------------------------------------------------
+int H5Object::iterateAttrs( attr_operator_t user_op, unsigned *_idx, void *op_data )
+{
+ // store the user's function and data
+ UserData4Aiterate* userData = new UserData4Aiterate;
+ userData->opData = op_data;
+ userData->op = user_op;
+ userData->location = this;
+
+ // call the C library routine H5Aiterate2 to iterate the attributes
+ hsize_t idx = _idx ? static_cast<hsize_t>(*_idx) : 0;
+ int ret_value = H5Aiterate2(getId(), H5_INDEX_NAME, H5_ITER_INC, &idx,
+ userAttrOpWrpr, reinterpret_cast<void *>(userData));
+
+ // release memory
+ delete userData;
+
+ if( ret_value >= 0 ) {
+ /* Pass back update index value to calling code */
+ if (_idx)
+ *_idx = static_cast<unsigned>(idx);
+
+ return( ret_value );
+ }
+ else // raise exception when H5Aiterate returns a negative value
+ throw AttributeIException(inMemFunc("iterateAttrs"), "H5Aiterate2 failed");
+}
+
+//--------------------------------------------------------------------------
+// Function: H5Object::getNumAttrs
+///\brief Returns the number of attributes attached to this HDF5 object.
+///\return Number of attributes
+///\exception H5::AttributeIException
+// Programmer Binh-Minh Ribler - 2000
+//--------------------------------------------------------------------------
+int H5Object::getNumAttrs() const
+{
+ H5O_info_t oinfo; /* Object info */
+
+ if(H5Oget_info(getId(), &oinfo) < 0)
+ throw AttributeIException(inMemFunc("getNumAttrs"), "H5Oget_info failed");
+ else
+ return(static_cast<int>(oinfo.num_attrs));
+}
+
+//--------------------------------------------------------------------------
+// Function: H5Object::attrExists
+///\brief Checks whether the named attribute exists at this location.
+///\param name - IN: Name of the attribute to be queried
+///\exception H5::AttributeIException
+// Programmer Binh-Minh Ribler - 2013
+//--------------------------------------------------------------------------
+bool H5Object::attrExists(const char* name) const
+{
+ // Call C routine H5Aexists to determine whether an attribute exists
+ // at this location, which could be specified by a file, group, dataset,
+ // or named datatype.
+ herr_t ret_value = H5Aexists(getId(), name);
+ if( ret_value > 0 )
+ return true;
+ else if(ret_value == 0)
+ return false;
+ else // Raise exception when H5Aexists returns a negative value
+ throw AttributeIException(inMemFunc("attrExists"), "H5Aexists failed");
+}
+
+//--------------------------------------------------------------------------
+// Function: H5Object::attrExists
+///\brief This is an overloaded member function, provided for convenience.
+/// It differs from the above function in that it takes
+/// a reference to an \c H5std_string for \a name.
+// Programmer Binh-Minh Ribler - 2000
+//--------------------------------------------------------------------------
+bool H5Object::attrExists(const H5std_string& name) const
+{
+ return(attrExists(name.c_str()));
+}
+
+//--------------------------------------------------------------------------
+// Function: H5Object::removeAttr
+///\brief Removes the named attribute from this object.
+///\param name - IN: Name of the attribute to be removed
+///\exception H5::AttributeIException
+// Programmer Binh-Minh Ribler - 2000
+//--------------------------------------------------------------------------
+void H5Object::removeAttr( const char* name ) const
+{
+ herr_t ret_value = H5Adelete(getId(), name);
+ if( ret_value < 0 )
+ throw AttributeIException(inMemFunc("removeAttr"), "H5Adelete failed");
+}
+
+//--------------------------------------------------------------------------
+// Function: H5Object::removeAttr
+///\brief This is an overloaded member function, provided for convenience.
+/// It differs from the above function in that it takes
+/// a reference to an \c H5std_string for \a name.
+// Programmer Binh-Minh Ribler - 2000
+//--------------------------------------------------------------------------
+void H5Object::removeAttr( const H5std_string& name ) const
+{
+ removeAttr( name.c_str() );
+}
+
+//--------------------------------------------------------------------------
+// Function: H5Object::renameAttr
+///\brief Renames the named attribute from this object.
+///\param oldname - IN: Name of the attribute to be renamed
+///\param newname - IN: New name ame of the attribute
+///\exception H5::AttributeIException
+// Programmer Binh-Minh Ribler - Mar, 2005
+//--------------------------------------------------------------------------
+void H5Object::renameAttr(const char* oldname, const char* newname) const
+{
+ herr_t ret_value = H5Arename(getId(), oldname, newname);
+ if (ret_value < 0)
+ throw AttributeIException(inMemFunc("renameAttr"), "H5Arename failed");
+}
+
+//--------------------------------------------------------------------------
+// Function: H5Object::renameAttr
+///\brief This is an overloaded member function, provided for convenience.
+/// It differs from the above function in that it takes
+/// a reference to an \c H5std_string for the names.
+// Programmer Binh-Minh Ribler - Mar, 2005
+//--------------------------------------------------------------------------
+void H5Object::renameAttr(const H5std_string& oldname, const H5std_string& newname) const
+{
+ renameAttr (oldname.c_str(), newname.c_str());
+}
//--------------------------------------------------------------------------
// Function: getObjName
///\brief Given an id, returns the type of the object.
@@ -183,6 +456,7 @@ ssize_t H5Object::getObjName(H5std_string& obj_name, size_t len) const
return(name_size);
}
+#ifndef DOXYGEN_SHOULD_SKIP_THIS
//--------------------------------------------------------------------------
// Function: H5Object destructor
///\brief Noop destructor.
diff --git a/c++/src/H5Object.h b/c++/src/H5Object.h
index f8ac792..c39de3a 100644
--- a/c++/src/H5Object.h
+++ b/c++/src/H5Object.h
@@ -17,8 +17,8 @@
#ifndef __H5Object_H
#define __H5Object_H
-#include "H5Location.h"
-#include "H5Classes.h" // constains forward class declarations
+//#include "H5Location.h"
+//#include "H5Classes.h" // constains forward class declarations
// H5Object is a baseclass. It has these subclasses:
// Group, DataSet, and DataType.
@@ -38,6 +38,21 @@
namespace H5 {
#endif
+class H5_DLLCPP H5Object;
+
+// 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*/);
+
+// User data for attribute iteration
+class UserData4Aiterate {
+ public:
+ attr_operator_t op;
+ void* opData;
+ H5Object* location;
+};
+
/*! \class H5Object
\brief Class H5Object is a bridge between H5Location and DataSet, DataType,
and Group.
@@ -46,16 +61,52 @@ namespace H5 {
*/
class H5_DLLCPP H5Object : public H5Location {
public:
+// Rearranging classes (HDFFV-9920) moved H5A wrappers back into H5Object.
+// That way, C functions that takes attribute id can be in
+// H5Location and those that cannot take attribute id can be in H5Object.
+
+ // Creates an attribute for the specified object
+ // PropList is currently not used, so always be default.
+ Attribute createAttribute( const char* name, const DataType& type, const DataSpace& space, const PropList& create_plist = PropList::DEFAULT ) const;
+ Attribute createAttribute( const H5std_string& name, const DataType& type, const DataSpace& space, const PropList& create_plist = PropList::DEFAULT ) const;
+
+ // Given its name, opens the attribute that belongs to an object at
+ // this location.
+ Attribute openAttribute( const char* name ) const;
+ Attribute openAttribute( const H5std_string& name ) const;
+
+ // Given its index, opens the attribute that belongs to an object at
+ // this location.
+ Attribute openAttribute( const unsigned int idx ) const;
+
+ // Iterate user's function over the attributes of this object.
+ int iterateAttrs(attr_operator_t user_op, unsigned* idx = NULL, void* op_data = NULL);
+
+ // Determines the number of attributes belong to this object.
+ int getNumAttrs() const;
+
+ // Checks whether the named attribute exists for this object.
+ bool attrExists(const char* name) const;
+ bool attrExists(const H5std_string& name) const;
+
+ // Renames the named attribute to a new name.
+ void renameAttr(const char* oldname, const char* newname) const;
+ void renameAttr(const H5std_string& oldname, const H5std_string& newname) const;
+
+ // Removes the named attribute from this object.
+ void removeAttr(const char* name) const;
+ void removeAttr(const H5std_string& name) const;
+
+ // Returns an identifier.
+ virtual hid_t getId() const = 0;
+
#ifndef DOXYGEN_SHOULD_SKIP_THIS
// Gets the name of this HDF5 object, i.e., Group, DataSet, or
- // DataType.
+ // DataType. These should have const but are retiring anyway.
ssize_t getObjName(char *obj_name, size_t buf_size = 0) const;
ssize_t getObjName(H5std_string& obj_name, size_t len = 0) const;
H5std_string getObjName() const;
- // Noop destructor.
- virtual ~H5Object();
-
protected:
// Default constructor
H5Object();
@@ -73,6 +124,13 @@ class H5_DLLCPP H5Object : public H5Location {
// Copy constructor: makes copy of an H5Object object.
// H5Object(const H5Object& original);
+ // Sets the identifier of this object to a new value. - this one
+ // doesn't increment reference count
+ virtual void p_setId(const hid_t new_id) = 0;
+
+ // Noop destructor.
+ virtual ~H5Object();
+
#endif // DOXYGEN_SHOULD_SKIP_THIS
}; /* end class H5Object */
diff --git a/c++/src/H5PredType.cpp b/c++/src/H5PredType.cpp
index fb29f1e..3fe9a8a 100644
--- a/c++/src/H5PredType.cpp
+++ b/c++/src/H5PredType.cpp
@@ -19,6 +19,7 @@
#include "H5Exception.h"
#include "H5IdComponent.h"
#include "H5PropList.h"
+#include "H5Location.h"
#include "H5Object.h"
#include "H5DataType.h"
#include "H5AtomType.h"
diff --git a/c++/src/H5StrType.cpp b/c++/src/H5StrType.cpp
index 3cfa342..8e1672b 100644
--- a/c++/src/H5StrType.cpp
+++ b/c++/src/H5StrType.cpp
@@ -19,10 +19,10 @@
#include "H5Exception.h"
#include "H5IdComponent.h"
#include "H5PropList.h"
+#include "H5Location.h"
#include "H5Object.h"
#include "H5OcreatProp.h"
#include "H5DcreatProp.h"
-#include "H5CommonFG.h"
#include "H5DataType.h"
#include "H5AtomType.h"
#include "H5AbstractDs.h"
diff --git a/c++/src/H5VarLenType.cpp b/c++/src/H5VarLenType.cpp
index 2fab1f3..67334d3 100644
--- a/c++/src/H5VarLenType.cpp
+++ b/c++/src/H5VarLenType.cpp
@@ -19,10 +19,10 @@
#include "H5Exception.h"
#include "H5IdComponent.h"
#include "H5PropList.h"
+#include "H5Location.h"
#include "H5Object.h"
#include "H5OcreatProp.h"
#include "H5DcreatProp.h"
-#include "H5CommonFG.h"
#include "H5DataType.h"
#include "H5VarLenType.h"
diff --git a/c++/test/CMakeLists.txt b/c++/test/CMakeLists.txt
index dffe7a4..9d98d11 100644
--- a/c++/test/CMakeLists.txt
+++ b/c++/test/CMakeLists.txt
@@ -48,11 +48,4 @@ set_target_properties (cpp_testhdf5 PROPERTIES
INTERFACE_INCLUDE_DIRECTORIES "$<INSTALL_INTERFACE:$<INSTALL_PREFIX>/include>"
)
-add_custom_command (
- TARGET cpp_testhdf5
- POST_BUILD
- COMMAND ${CMAKE_COMMAND}
- ARGS -E copy_if_different ${HDF5_CPP_TEST_SOURCE_DIR}/th5s.h5 ${PROJECT_BINARY_DIR}/th5s.h5
-)
-
include (CMakeTests.cmake)
diff --git a/c++/test/CMakeTests.cmake b/c++/test/CMakeTests.cmake
index c725f69..91c36b0 100644
--- a/c++/test/CMakeTests.cmake
+++ b/c++/test/CMakeTests.cmake
@@ -1,3 +1,5 @@
+HDFTEST_COPY_FILE("${HDF5_CPP_TEST_SOURCE_DIR}/th5s.h5" "${PROJECT_BINARY_DIR}/th5s.h5" "cpp_testhdf5_files")
+add_custom_target(cpp_testhdf5_files ALL COMMENT "Copying files needed by cpp_testhdf5 tests" DEPENDS ${cpp_testhdf5_files_list})
##############################################################################
##############################################################################
@@ -8,7 +10,7 @@
add_test (
NAME CPP_testhdf5-clear-objects
COMMAND ${CMAKE_COMMAND}
- -E remove
+ -E remove
tattr_basic.h5
tattr_compound.h5
tattr_dtype.h5
@@ -30,17 +32,18 @@ if (HDF5_TEST_VFD)
multi
family
)
-
+
if (DIRECT_VFD)
set (VFD_LIST ${VFD_LIST} direct)
endif (DIRECT_VFD)
MACRO (ADD_VFD_TEST vfdname resultcode)
if (NOT HDF5_ENABLE_USING_MEMCHECKER)
+ file (MAKE_DIRECTORY "${PROJECT_BINARY_DIR}/${vfdname}")
add_test (
NAME CPP_VFD-${vfdname}-cpp_testhdf5-clear-objects
COMMAND ${CMAKE_COMMAND}
- -E remove
+ -E remove
tattr_basic.h5
tattr_compound.h5
tattr_dtype.h5
@@ -49,21 +52,21 @@ if (HDF5_TEST_VFD)
tfattrs.h5
)
add_test (
- NAME CPP_VFD-${vfdname}-cpp_testhdf5
+ NAME CPP_VFD-${vfdname}-cpp_testhdf5
COMMAND "${CMAKE_COMMAND}"
-D "TEST_PROGRAM=$<TARGET_FILE:cpp_testhdf5>"
-D "TEST_ARGS:STRING="
-D "TEST_VFD:STRING=${vfdname}"
-D "TEST_EXPECT=${resultcode}"
-D "TEST_OUTPUT=cpp_testhdf5"
- -D "TEST_FOLDER=${PROJECT_BINARY_DIR}"
+ -D "TEST_FOLDER=${PROJECT_BINARY_DIR}/${vfdname}"
-P "${HDF_RESOURCES_DIR}/vfdTest.cmake"
)
set_tests_properties (CPP_VFD-${vfdname}-cpp_testhdf5 PROPERTIES DEPENDS CPP_VFD-${vfdname}-cpp_testhdf5-clear-objects)
set_tests_properties (CPP_VFD-${vfdname}-cpp_testhdf5 PROPERTIES TIMEOUT 30)
endif (NOT HDF5_ENABLE_USING_MEMCHECKER)
ENDMACRO (ADD_VFD_TEST)
-
+
# Run test with different Virtual File Driver
foreach (vfd ${VFD_LIST})
ADD_VFD_TEST (${vfd} 0)
diff --git a/c++/test/h5cpputil.h b/c++/test/h5cpputil.h
index b615194..50cde99 100644
--- a/c++/test/h5cpputil.h
+++ b/c++/test/h5cpputil.h
@@ -89,7 +89,7 @@ template <class Type1, class Type2>
{
cerr << endl;
cerr << "*** UNEXPECTED VALUE: " << file_name << ":line " << line
- << ":" << msg << " different: " << x << ", should be " << value
+ << ": " << msg << " different: " << x << ", should be " << value
<< endl;
IncTestNumErrs();
throw TestFailedException(file_name, msg);
@@ -127,6 +127,19 @@ template <class Type1, class Type2>
}
}
+template <class Type1, class Type2>
+ void verify_val(Type1 x, Type2 value, float epsilon, const char* msg, int line, const char* file_name)
+{
+ if (x == value)
+ {
+ cerr << endl;
+ cerr << "*** UNEXPECTED FLOAT VALUE: " << file_name << ":line " << line
+ << ": " << msg << " different: " << x << ", should be " << value
+ << " (epsilon=" << epsilon << ")" << endl;
+ IncTestNumErrs();
+ throw TestFailedException(file_name, msg);
+ }
+}
/* Prototypes for the test routines */
#ifdef __cplusplus
diff --git a/c++/test/tattr.cpp b/c++/test/tattr.cpp
index e8c2a78..2dfa562 100644
--- a/c++/test/tattr.cpp
+++ b/c++/test/tattr.cpp
@@ -830,6 +830,9 @@ static void test_attr_scalar_write()
** test_attr_scalar_read(): Test scalar attribute reading functionality.
**
****************************************************************/
+/* Epsilon for floating-point comparisons */
+#define FP_EPSILON 0.000001F
+
static void test_attr_scalar_read()
{
// Output message about test being performed
@@ -852,7 +855,8 @@ static void test_attr_scalar_read()
// Read attribute information
float read_data2=0.0; // Buffer for reading 1st attribute
ds_attr.read(PredType::NATIVE_FLOAT,&read_data2);
- verify_val(read_data2, attr_data5, "Attribute::read", __LINE__, __FILE__);
+ if (HDfabs(read_data2 - attr_data5) > FP_EPSILON)
+ verify_val(read_data2, attr_data5, FP_EPSILON, "Attribute::read", __LINE__, __FILE__);
// Get the dataspace of the attribute
DataSpace att_space = ds_attr.getSpace();
@@ -1714,7 +1718,7 @@ static void test_attr_corder_create_basic(FileCreatPropList& fcpl,
// Get creation order indexing on object
unsigned crt_order_flags = 0;
crt_order_flags = dcpl.getAttrCrtOrder();
- verify_val(crt_order_flags, 0, "DSetCreatPropList::getAttrCrtOrder",__LINE__,__FILE__);
+ verify_val(crt_order_flags, (unsigned)0, "DSetCreatPropList::getAttrCrtOrder",__LINE__,__FILE__);
// Setting invalid combination of a attribute order creation order
// indexing on should fail
@@ -1731,7 +1735,7 @@ static void test_attr_corder_create_basic(FileCreatPropList& fcpl,
// verify them
dcpl.setAttrCrtOrder(H5P_CRT_ORDER_TRACKED | H5P_CRT_ORDER_INDEXED);
crt_order_flags = dcpl.getAttrCrtOrder();
- verify_val(crt_order_flags, (H5P_CRT_ORDER_TRACKED | H5P_CRT_ORDER_INDEXED), "DSetCreatPropList::getAttrCrtOrder",__LINE__,__FILE__);
+ verify_val(crt_order_flags, (unsigned)(H5P_CRT_ORDER_TRACKED | H5P_CRT_ORDER_INDEXED), "DSetCreatPropList::getAttrCrtOrder",__LINE__,__FILE__);
// Create dataspace for dataset
DataSpace ds_space(H5S_SCALAR);
@@ -1766,7 +1770,7 @@ static void test_attr_corder_create_basic(FileCreatPropList& fcpl,
// Query the attribute creation properties
crt_order_flags = dcpl.getAttrCrtOrder();
- verify_val(crt_order_flags, (H5P_CRT_ORDER_TRACKED | H5P_CRT_ORDER_INDEXED), "DSetCreatPropList::getAttrCrtOrder",__LINE__,__FILE__);
+ verify_val(crt_order_flags, (unsigned)(H5P_CRT_ORDER_TRACKED | H5P_CRT_ORDER_INDEXED), "DSetCreatPropList::getAttrCrtOrder",__LINE__,__FILE__);
PASSED();
} // end try block
diff --git a/c++/test/testhdf5.cpp b/c++/test/testhdf5.cpp
index b3415f1..b17d942 100644
--- a/c++/test/testhdf5.cpp
+++ b/c++/test/testhdf5.cpp
@@ -132,6 +132,9 @@ Comment out tests that are not done yet */
if (GetTestCleanup() && !getenv("HDF5_NOCLEANUP"))
TestCleanup();
+ /* Release test infrastructure */
+ TestShutdown();
+
return (GetTestNumErrs());
}
diff --git a/c++/test/tfile.cpp b/c++/test/tfile.cpp
index 763f9f0..0eabfb9 100644
--- a/c++/test/tfile.cpp
+++ b/c++/test/tfile.cpp
@@ -515,8 +515,6 @@ static void test_file_name()
} // test_file_name()
-#define NUM_OBJS 4
-#define NUM_ATTRS 3
const int RANK1 = 1;
const int ATTR1_DIM1 = 3;
const H5std_string FILE5("tfattrs.h5");
@@ -742,6 +740,70 @@ static void test_libver_bounds()
} /* end test_libver_bounds() */
/*-------------------------------------------------------------------------
+ * Function: test_commonfg
+ *
+ * Purpose: Verify that a file created and modified with the
+ * specified libver bounds has the specified object header
+ * versions for the right objects.
+ *
+ * Return: None
+ *
+ * Programmer: Binh-Minh Ribler (use C version)
+ * March, 2015
+ *
+ *-------------------------------------------------------------------------
+ */
+static void test_commonfg()
+{
+ // Output message about test being performed
+ SUBTEST("Root group");
+
+ try {
+ // Create a file using default properties.
+ H5File file4(FILE4, H5F_ACC_TRUNC);
+
+ // Try opening the root group.
+ Group rootgroup(file4.openGroup(ROOTGROUP));
+
+ // Create a group in the root group.
+ Group group(rootgroup.createGroup(GROUPNAME, 0));
+
+ // Create the data space.
+ hsize_t dims[RANK] = {NX, NY};
+ DataSpace space(RANK, dims);
+
+ // Create a new dataset.
+ DataSet dataset(group.createDataSet (DSETNAME, PredType::NATIVE_INT, space));
+
+ // Get and verify file name via a dataset.
+ H5std_string file_name = dataset.getFileName();
+ verify_val(file_name, FILE4, "DataSet::getFileName", __LINE__, __FILE__);
+
+ // Create an attribute for the dataset.
+ Attribute attr(dataset.createAttribute(DATTRNAME, PredType::NATIVE_INT, space));
+
+ // Get and verify file name via an attribute.
+ file_name = attr.getFileName();
+ verify_val(file_name, FILE4, "Attribute::getFileName", __LINE__, __FILE__);
+
+ // Create an attribute for the file via root group.
+ Attribute rootg_attr(rootgroup.createAttribute(FATTRNAME, PredType::NATIVE_INT, space));
+
+ // Get and verify file name via an attribute.
+ file_name = attr.getFileName();
+ verify_val(file_name, FILE4, "Attribute::getFileName", __LINE__, __FILE__);
+
+ PASSED();
+ } // end of try block
+
+ catch (Exception& E)
+ {
+ issue_fail_msg("test_commonfg()", __LINE__, __FILE__, E.getCDetailMsg());
+ }
+
+} /* end test_commonfg() */
+
+/*-------------------------------------------------------------------------
* Function: test_file
*
* Purpose: Main file testing routine
@@ -769,6 +831,7 @@ void test_file()
test_file_name(); // Test getting file's name
test_file_attribute(); // Test file attribute feature
test_libver_bounds(); // Test format version
+ test_commonfg();
} // test_file()
@@ -793,7 +856,7 @@ void cleanup_file()
HDremove(FILE1.c_str());
HDremove(FILE2.c_str());
HDremove(FILE3.c_str());
- HDremove(FILE4.c_str());
+// HDremove(FILE4.c_str());
HDremove(FILE5.c_str());
HDremove(FILE6.c_str());
} // cleanup_file
diff --git a/config/cmake/H5pubconf.h.in b/config/cmake/H5pubconf.h.in
index 31c5afb..5dad4f3 100644
--- a/config/cmake/H5pubconf.h.in
+++ b/config/cmake/H5pubconf.h.in
@@ -199,9 +199,21 @@
/* Define to 1 if you have the `z' library (-lz). */
#cmakedefine H5_HAVE_LIBZ @H5_HAVE_LIBZ@
+/* Define to 1 if you have the `llround' function. */
+#cmakedefine H5_HAVE_LLROUND @H5_HAVE_LLROUND@
+
+/* Define to 1 if you have the `llroundf' function. */
+#cmakedefine H5_HAVE_LLROUNDF @H5_HAVE_LLROUNDF@
+
/* Define to 1 if you have the `longjmp' function. */
#cmakedefine H5_HAVE_LONGJMP @H5_HAVE_LONGJMP@
+/* Define to 1 if you have the `lround' function. */
+#cmakedefine H5_HAVE_LROUND @H5_HAVE_LROUND@
+
+/* Define to 1 if you have the `lroundf' function. */
+#cmakedefine H5_HAVE_LROUNDF @H5_HAVE_LROUNDF@
+
/* Define to 1 if you have the `lseek64' function. */
#cmakedefine H5_HAVE_LSEEK64 @H5_HAVE_LSEEK64@
@@ -241,6 +253,12 @@
/* Define to 1 if you have the `rand_r' function. */
#cmakedefine H5_HAVE_RAND_R @H5_HAVE_RAND_R@
+/* Define to 1 if you have the `round' function. */
+#cmakedefine H5_HAVE_ROUNDF @H5_HAVE_ROUNDF@
+
+/* Define to 1 if you have the `roundf' function. */
+#cmakedefine H5_HAVE_ROUND @H5_HAVE_ROUND@
+
/* Define to 1 if you have the `setjmp' function. */
#cmakedefine H5_HAVE_SETJMP @H5_HAVE_SETJMP@
diff --git a/config/cmake/HDF518_Examples.cmake.in b/config/cmake/HDF518_Examples.cmake.in
index 135dcfc..561bdb7 100644
--- a/config/cmake/HDF518_Examples.cmake.in
+++ b/config/cmake/HDF518_Examples.cmake.in
@@ -10,7 +10,7 @@ set(CTEST_DASHBOARD_ROOT ${CTEST_SCRIPT_DIRECTORY})
# handle input parameters to script.
#INSTALLDIR - HDF5-1.8 root folder
-#CTEST_BUILD_CONFIGURATION - Release, Debug, RelWithDebInfo
+#CTEST_CONFIGURATION_TYPE - Release, Debug, RelWithDebInfo
#CTEST_SOURCE_NAME - name of source folder; HDF4Examples
#STATIC_LIBRARIES - Default is YES
#FORTRAN_LIBRARIES - Default is NO
@@ -29,8 +29,8 @@ endif()
if(NOT DEFINED INSTALLDIR)
set(INSTALLDIR "@CMAKE_INSTALL_PREFIX@")
endif()
-if(NOT DEFINED CTEST_BUILD_CONFIGURATION)
- set(CTEST_BUILD_CONFIGURATION "Release")
+if(NOT DEFINED CTEST_CONFIGURATION_TYPE)
+ set(CTEST_CONFIGURATION_TYPE "Release")
endif()
if(NOT DEFINED CTEST_SOURCE_NAME)
set(CTEST_SOURCE_NAME "HDF5Examples")
@@ -143,7 +143,7 @@ if(NOT N EQUAL 0)
set(ctest_test_args ${ctest_test_args} PARALLEL_LEVEL ${N})
endif()
set (CTEST_CONFIGURE_COMMAND
- "${CTEST_CMAKE_COMMAND} -C \"${CTEST_SOURCE_DIRECTORY}/config/cmake/cacheinit.cmake\" -DCMAKE_BUILD_TYPE:STRING=${CTEST_BUILD_CONFIGURATION} ${BUILD_OPTIONS} \"-G${CTEST_CMAKE_GENERATOR}\" \"${CTEST_SOURCE_DIRECTORY}\""
+ "${CTEST_CMAKE_COMMAND} -C \"${CTEST_SOURCE_DIRECTORY}/config/cmake/cacheinit.cmake\" -DCMAKE_BUILD_TYPE:STRING=${CTEST_CONFIGURATION_TYPE} ${BUILD_OPTIONS} \"-G${CTEST_CMAKE_GENERATOR}\" \"${CTEST_SOURCE_DIRECTORY}\""
)
#-----------------------------------------------------------------------------
diff --git a/config/cmake/HDF5UseFortran.cmake b/config/cmake/HDF5UseFortran.cmake
index 66e70b4..41efadc 100644
--- a/config/cmake/HDF5UseFortran.cmake
+++ b/config/cmake/HDF5UseFortran.cmake
@@ -19,7 +19,7 @@ ENABLE_LANGUAGE (Fortran)
# so this one is used.
#-----------------------------------------------------------------------------
MACRO (FORTRAN_RUN FUNCTION CODE RUN_RESULT_VAR1 COMPILE_RESULT_VAR RETURN)
-# MSB CHECK WHY THIS CHECK?
+#
# if (NOT DEFINED ${RUN_RESULT_VAR})
message (STATUS "Detecting Fortran ${FUNCTION}")
if (CMAKE_REQUIRED_LIBRARIES)
@@ -39,8 +39,6 @@ MACRO (FORTRAN_RUN FUNCTION CODE RUN_RESULT_VAR1 COMPILE_RESULT_VAR RETURN)
RUN_OUTPUT_VARIABLE OUTPUT
)
-
-
set(${RETURN} ${OUTPUT})
#message ( "Test result1 ${RETURN} ")
@@ -70,17 +68,22 @@ MACRO (FORTRAN_RUN FUNCTION CODE RUN_RESULT_VAR1 COMPILE_RESULT_VAR RETURN)
# endif (NOT DEFINED ${RUN_RESULT_VAR})
ENDMACRO (FORTRAN_RUN)
+# Read source line beginning at the line matching Input:"START" and ending at the line matching Input:"END"
+MACRO (READ_SOURCE START END RETURN)
+ file(READ "${HDF5_SOURCE_DIR}/m4/aclocal_fc.f90" CODE)
+ string(REGEX MATCH "${START}[\\\t\\\n\\\r[].+]*${END}" CODE ${CODE})
+ set(RETURN "${CODE}")
+ENDMACRO (READ_SOURCE START END RETURN)
+
#-----------------------------------------------------------------------------
# Check to see C_LONG_DOUBLE is available
+
+READ_SOURCE("PROGRAM PROG_FC_HAVE_C_LONG_DOUBLE" "END PROGRAM PROG_FC_HAVE_C_LONG_DOUBLE" CODE)
CHECK_FORTRAN_FEATURE(c_long_double
- "
- PROGRAM main
- USE ISO_C_BINDING
- REAL(KIND=C_LONG_DOUBLE) :: d
- END PROGRAM
- "
+ "${CODE}"
FORTRAN_HAVE_C_LONG_DOUBLE
)
+
if (${FORTRAN_HAVE_C_LONG_DOUBLE})
set(FORTRAN_HAVE_C_LONG_DOUBLE 1)
else ()
@@ -89,31 +92,9 @@ endif()
# Check to see C_LONG_DOUBLE is different from C_DOUBLE
+READ_SOURCE("MODULE type_mod" "END PROGRAM PROG_FC_C_LONG_DOUBLE_EQ_C_DOUBLE" CODE)
CHECK_FORTRAN_FEATURE(c_long_double
- "
- MODULE type_mod
- USE ISO_C_BINDING
- INTERFACE h5t
- MODULE PROCEDURE h5t_c_double
- MODULE PROCEDURE h5t_c_long_double
- END INTERFACE
- CONTAINS
- SUBROUTINE h5t_c_double(r)
- REAL(KIND=C_DOUBLE) :: r
- END SUBROUTINE h5t_c_double
- SUBROUTINE h5t_c_long_double(d)
- REAL(KIND=C_LONG_DOUBLE) :: d
- END SUBROUTINE h5t_c_long_double
- END MODULE type_mod
- PROGRAM main
- USE ISO_C_BINDING
- USE type_mod
- REAL(KIND=C_DOUBLE) :: r
- REAL(KIND=C_LONG_DOUBLE) :: d
- CALL h5t(r)
- CALL h5t(d)
- END PROGRAM main
- "
+ "${CODE}"
FORTRAN_C_LONG_DOUBLE_IS_UNIQUE
)
if (${FORTRAN_C_LONG_DOUBLE_IS_UNIQUE})
@@ -139,66 +120,9 @@ endif(FORTRAN_HAVE_STORAGE_SIZE)
# Determine the available KINDs for REALs and INTEGERs
#-----------------------------------------------------------------------------
+READ_SOURCE("PROGRAM FC_AVAIL_KINDS" "END PROGRAM FC_AVAIL_KINDS" CODE)
FORTRAN_RUN("REAL and INTEGER KINDs"
- "
- PROGRAM main
- IMPLICIT NONE
- INTEGER :: ik, jk, k, max_decimal_prec
- INTEGER :: num_rkinds = 1, num_ikinds = 1
- INTEGER, DIMENSION(1:10) :: list_ikinds = -1
- INTEGER, DIMENSION(1:10) :: list_rkinds = -1
-
- ! Find integer KINDs
- list_ikinds(num_ikinds)=SELECTED_INT_KIND(1)
- DO ik = 2, 36
- k = SELECTED_INT_KIND(ik)
- IF(k.LT.0) EXIT
- IF(k.GT.list_ikinds(num_ikinds))THEN
- num_ikinds = num_ikinds + 1
- list_ikinds(num_ikinds) = k
- ENDIF
- ENDDO
-
- DO k = 1, num_ikinds
- WRITE(*,'(I0)', ADVANCE='NO') list_ikinds(k)
- IF(k.NE.num_ikinds)THEN
- WRITE(*,'(A)',ADVANCE='NO') ','
- ELSE
- WRITE(*,'()')
- ENDIF
- ENDDO
-
- ! Find real KINDs
- list_rkinds(num_rkinds)=SELECTED_REAL_KIND(1)
- max_decimal_prec = 1
-
- prec: DO ik = 2, 36
- exp: DO jk = 1, 17000
- k = SELECTED_REAL_KIND(ik,jk)
- IF(k.LT.0) EXIT exp
- IF(k.GT.list_rkinds(num_rkinds))THEN
- num_rkinds = num_rkinds + 1
- list_rkinds(num_rkinds) = k
- ENDIF
- max_decimal_prec = ik
- ENDDO exp
- ENDDO prec
-
- DO k = 1, num_rkinds
- WRITE(*,'(I0)', ADVANCE='NO') list_rkinds(k)
- IF(k.NE.num_rkinds)THEN
- WRITE(*,'(A)',ADVANCE='NO') ','
- ELSE
- WRITE(*,'()')
- ENDIF
- ENDDO
-
- WRITE(*,'(I0)') max_decimal_prec
- WRITE(*,'(I0)') num_ikinds
- WRITE(*,'(I0)') num_rkinds
-
- END PROGRAM main
- "
+ "${CODE}"
XX
YY
PROG_OUTPUT
@@ -210,6 +134,7 @@ FORTRAN_RUN("REAL and INTEGER KINDs"
# dnl -- LINE 4 -- number of valid integer kinds
# dnl -- LINE 5 -- number of valid real kinds
+file(READ "${CMAKE_BINARY_DIR}/pac_fconftest.out" PROG_OUTPUT)
# Convert the string to a list of strings by replacing the carriage return with a semicolon
string(REGEX REPLACE "\n" ";" PROG_OUTPUT "${PROG_OUTPUT}")
diff --git a/config/cmake/HDF5_Examples.cmake.in b/config/cmake/HDF5_Examples.cmake.in
index 3dce88e..d7e2591 100644
--- a/config/cmake/HDF5_Examples.cmake.in
+++ b/config/cmake/HDF5_Examples.cmake.in
@@ -10,7 +10,7 @@ set(CTEST_DASHBOARD_ROOT ${CTEST_SCRIPT_DIRECTORY})
# handle input parameters to script.
#INSTALLDIR - HDF5 root folder
-#CTEST_BUILD_CONFIGURATION - Release, Debug, RelWithDebInfo
+#CTEST_CONFIGURATION_TYPE - Release, Debug, RelWithDebInfo
#CTEST_SOURCE_NAME - name of source folder; HDF4Examples
#STATIC_LIBRARIES - Default is YES
#FORTRAN_LIBRARIES - Default is NO
@@ -30,8 +30,8 @@ endif()
if(NOT DEFINED INSTALLDIR)
set(INSTALLDIR "@CMAKE_INSTALL_PREFIX@")
endif()
-if(NOT DEFINED CTEST_BUILD_CONFIGURATION)
- set(CTEST_BUILD_CONFIGURATION "Release")
+if(NOT DEFINED CTEST_CONFIGURATION_TYPE)
+ set(CTEST_CONFIGURATION_TYPE "Release")
endif()
if(NOT DEFINED CTEST_SOURCE_NAME)
set(CTEST_SOURCE_NAME "HDF5Examples")
@@ -154,7 +154,7 @@ if(NOT N EQUAL 0)
set(ctest_test_args ${ctest_test_args} PARALLEL_LEVEL ${N})
endif()
set (CTEST_CONFIGURE_COMMAND
- "${CTEST_CMAKE_COMMAND} -C \"${CTEST_SOURCE_DIRECTORY}/config/cmake/cacheinit.cmake\" -DCMAKE_BUILD_TYPE:STRING=${CTEST_BUILD_CONFIGURATION} ${BUILD_OPTIONS} \"-G${CTEST_CMAKE_GENERATOR}\" \"${CTEST_SOURCE_DIRECTORY}\""
+ "${CTEST_CMAKE_COMMAND} -C \"${CTEST_SOURCE_DIRECTORY}/config/cmake/cacheinit.cmake\" -DCMAKE_BUILD_TYPE:STRING=${CTEST_CONFIGURATION_TYPE} ${BUILD_OPTIONS} \"-G${CTEST_CMAKE_GENERATOR}\" \"${CTEST_SOURCE_DIRECTORY}\""
)
#-----------------------------------------------------------------------------
diff --git a/config/cmake/README.txt.cmake.in b/config/cmake/README.txt.cmake.in
index 4c4ffd5..7ab3c35 100644
--- a/config/cmake/README.txt.cmake.in
+++ b/config/cmake/README.txt.cmake.in
@@ -40,7 +40,7 @@ To test the installation with the examples;
The default installation folder is defined as "@CMAKE_INSTALL_PREFIX@".
It can be changed with the INSTALLDIR script option.
The default ctest configuration is defined as "Release". It can be changed
- with the CTEST_BUILD_CONFIGURATION script option. Note that this must
+ 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 STATICLIBRARIES script option set to "NO".
diff --git a/config/cmake/cacheinit.cmake b/config/cmake/cacheinit.cmake
index 8e88aea..176547b 100644
--- a/config/cmake/cacheinit.cmake
+++ b/config/cmake/cacheinit.cmake
@@ -22,7 +22,7 @@ set (HDF5_ENABLE_SZIP_ENCODING ON CACHE BOOL "Use SZip Encoding" FORCE)
set (HDF5_ENABLE_HSIZET ON CACHE BOOL "Enable datasets larger than memory" FORCE)
-set (HDF5_ENABLE_UNSUPPORTED OFF CACHE BOOL "Enable unsupported combinations of configuration options" FORCE)
+set (ALLOW_UNSUPPORTED OFF CACHE BOOL "Enable unsupported combinations of configuration options" FORCE)
set (HDF5_ENABLE_DEPRECATED_SYMBOLS ON CACHE BOOL "Enable deprecated public API symbols" FORCE)
@@ -56,7 +56,7 @@ set (HDF5_PACKAGE_EXTLIBS OFF CACHE BOOL "(WINDOWS)CPACK - include external libr
set (HDF5_NO_PACKAGES OFF CACHE BOOL "CPACK - Disable packaging" FORCE)
-set (HDF5_ALLOW_EXTERNAL_SUPPORT "NO" CACHE STRING "Allow External Library Building (NO SVN TGZ)" FORCE)
+set (HDF5_ALLOW_EXTERNAL_SUPPORT "NO" CACHE STRING "Allow External Library Building (NO GIT SVN TGZ)" FORCE)
set_property (CACHE HDF5_ALLOW_EXTERNAL_SUPPORT PROPERTY STRINGS NO SVN TGZ)
set (ZLIB_TGZ_NAME "ZLib.tar.gz" CACHE STRING "Use ZLib from compressed file" FORCE)
diff --git a/config/cmake/mccacheinit.cmake b/config/cmake/mccacheinit.cmake
index 2bebcf2..b605f58 100644
--- a/config/cmake/mccacheinit.cmake
+++ b/config/cmake/mccacheinit.cmake
@@ -34,7 +34,7 @@ set (HDF5_ENABLE_SZIP_ENCODING ON CACHE BOOL "Use SZip Encoding" FORCE)
set (HDF5_ENABLE_HSIZET ON CACHE BOOL "Enable datasets larger than memory" FORCE)
-set (HDF5_ENABLE_UNSUPPORTED OFF CACHE BOOL "Enable unsupported combinations of configuration options" FORCE)
+set (ALLOW_UNSUPPORTED OFF CACHE BOOL "Enable unsupported combinations of configuration options" FORCE)
set (HDF5_ENABLE_DEPRECATED_SYMBOLS ON CACHE BOOL "Enable deprecated public API symbols" FORCE)
@@ -75,7 +75,7 @@ set (SZIP_TGZ_NAME "SZip.tar.gz" CACHE STRING "Use SZip from compressed file" FO
set (CMAKE_BUILD_TYPE "Debug" CACHE STRING "Build Debug" FORCE)
-set (CTEST_BUILD_CONFIGURATION "Debug" CACHE STRING "Build Debug" FORCE)
+set (CTEST_CONFIGURATION_TYPE "Debug" CACHE STRING "Build Debug" FORCE)
set (ZLIB_PACKAGE_NAME "zlib" CACHE STRING "Name of ZLIB package" FORCE)
diff --git a/config/cmake/scripts/CTestScript.cmake b/config/cmake/scripts/CTestScript.cmake
index 403eedd..8a08caa 100755
--- a/config/cmake/scripts/CTestScript.cmake
+++ b/config/cmake/scripts/CTestScript.cmake
@@ -208,14 +208,14 @@ else(USE_AUTOTOOLS)
if(LOCAL_MEMCHECK_TEST)
find_program(CTEST_MEMORYCHECK_COMMAND NAMES valgrind)
set (CTEST_CONFIGURE_COMMAND
- "${CTEST_CMAKE_COMMAND} -C \"${CTEST_SOURCE_DIRECTORY}/config/cmake/mccacheinit.cmake\" -DCMAKE_BUILD_TYPE:STRING=${CTEST_BUILD_CONFIGURATION} ${BUILD_OPTIONS} \"-G${CTEST_CMAKE_GENERATOR}\" \"${CTEST_SOURCE_DIRECTORY}\""
+ "${CTEST_CMAKE_COMMAND} -C \"${CTEST_SOURCE_DIRECTORY}/config/cmake/mccacheinit.cmake\" -DCMAKE_BUILD_TYPE:STRING=${CTEST_CONFIGURATION_TYPE} ${BUILD_OPTIONS} \"-G${CTEST_CMAKE_GENERATOR}\" \"${CTEST_SOURCE_DIRECTORY}\""
)
else()
if(LOCAL_COVERAGE_TEST)
find_program(CTEST_COVERAGE_COMMAND NAMES gcov)
endif()
set (CTEST_CONFIGURE_COMMAND
- "${CTEST_CMAKE_COMMAND} -C \"${CTEST_SOURCE_DIRECTORY}/config/cmake/cacheinit.cmake\" -DCMAKE_BUILD_TYPE:STRING=${CTEST_BUILD_CONFIGURATION} ${BUILD_OPTIONS} \"-G${CTEST_CMAKE_GENERATOR}\" \"${CTEST_SOURCE_DIRECTORY}\""
+ "${CTEST_CMAKE_COMMAND} -C \"${CTEST_SOURCE_DIRECTORY}/config/cmake/cacheinit.cmake\" -DCMAKE_BUILD_TYPE:STRING=${CTEST_CONFIGURATION_TYPE} ${BUILD_OPTIONS} \"-G${CTEST_CMAKE_GENERATOR}\" \"${CTEST_SOURCE_DIRECTORY}\""
)
endif()
endif()
@@ -231,7 +231,7 @@ foreach(v
CTEST_SOURCE_DIRECTORY
CTEST_BINARY_DIRECTORY
CTEST_CMAKE_GENERATOR
- CTEST_BUILD_CONFIGURATION
+ CTEST_CONFIGURATION_TYPE
CTEST_GIT_COMMAND
CTEST_CHECKOUT_COMMAND
CTEST_CONFIGURE_COMMAND
@@ -294,7 +294,7 @@ message(STATUS "Dashboard script configuration:\n${vars}\n")
##-----------------------------------------------
## Package the product
##-----------------------------------------------
- execute_process(COMMAND cpack -C ${CTEST_BUILD_CONFIGURATION} -V
+ execute_process(COMMAND cpack -C ${CTEST_CONFIGURATION_TYPE} -V
WORKING_DIRECTORY ${CTEST_BINARY_DIRECTORY}
RESULT_VARIABLE cpackResult
OUTPUT_VARIABLE cpackLog
diff --git a/config/cmake/scripts/HDF5config.cmake b/config/cmake/scripts/HDF5config.cmake
index 4ab9650..672026f 100755
--- a/config/cmake/scripts/HDF5config.cmake
+++ b/config/cmake/scripts/HDF5config.cmake
@@ -19,7 +19,7 @@ cmake_minimum_required(VERSION 3.1.0 FATAL_ERROR)
# VS201264 * Visual Studio 11 2012 Win64
#
# INSTALLDIR - root folder where hdf5 is installed
-# CTEST_BUILD_CONFIGURATION - Release, Debug, etc
+# CTEST_CONFIGURATION_TYPE - Release, Debug, etc
# CTEST_SOURCE_NAME - source folder
# STATIC_LIBRARIES - Build/use static libraries
# FORTRAN_LIBRARIES - Build/use fortran libraries
@@ -34,7 +34,7 @@ set(CTEST_SOURCE_VERSEXT "")
# handle input parameters to script.
#BUILD_GENERATOR - which CMake generator to use, required
#INSTALLDIR - HDF5-1.10.0 root folder
-#CTEST_BUILD_CONFIGURATION - Release, Debug, RelWithDebInfo
+#CTEST_CONFIGURATION_TYPE - Release, Debug, RelWithDebInfo
#CTEST_SOURCE_NAME - name of source folder; HDF5-1.10.0
#STATIC_LIBRARIES - Default is YES
#FORTRAN_LIBRARIES - Default is NO
@@ -82,8 +82,8 @@ if(NOT DEFINED INSTALLDIR)
set(INSTALLDIR "/usr/local/myhdf5")
endif()
endif()
-if(NOT DEFINED CTEST_BUILD_CONFIGURATION)
- set(CTEST_BUILD_CONFIGURATION "Release")
+if(NOT DEFINED CTEST_CONFIGURATION_TYPE)
+ set(CTEST_CONFIGURATION_TYPE "Release")
endif()
if(NOT DEFINED CTEST_SOURCE_NAME)
set(CTEST_SOURCE_NAME "hdf5-${CTEST_SOURCE_VERSION}${CTEST_SOURCE_VERSEXT}")
diff --git a/config/cmake_ext_mod/ConfigureChecks.cmake b/config/cmake_ext_mod/ConfigureChecks.cmake
index cfda66b..5a14990 100644
--- a/config/cmake_ext_mod/ConfigureChecks.cmake
+++ b/config/cmake_ext_mod/ConfigureChecks.cmake
@@ -484,6 +484,13 @@ if (NOT WINDOWS)
endif (NOT CYGWIN AND NOT MINGW)
CHECK_SYMBOL_EXISTS (TIOCGWINSZ "sys/ioctl.h" ${HDF_PREFIX}_HAVE_TIOCGWINSZ)
CHECK_SYMBOL_EXISTS (TIOCGETD "sys/ioctl.h" ${HDF_PREFIX}_HAVE_TIOCGETD)
+
+ # ----------------------------------------------------------------------
+ # cygwin user credentials are different then on linux
+ #
+ if (NOT CYGWIN AND NOT MINGW)
+ CHECK_FUNCTION_EXISTS (getpwuid ${HDF_PREFIX}_HAVE_GETPWUID)
+ endif (NOT CYGWIN AND NOT MINGW)
endif (NOT WINDOWS)
#-----------------------------------------------------------------------------
@@ -497,12 +504,17 @@ CHECK_FUNCTION_EXISTS (frexpf ${HDF_PREFIX}_HAVE_FREXPF)
CHECK_FUNCTION_EXISTS (frexpl ${HDF_PREFIX}_HAVE_FREXPL)
CHECK_FUNCTION_EXISTS (gethostname ${HDF_PREFIX}_HAVE_GETHOSTNAME)
-CHECK_FUNCTION_EXISTS (getpwuid ${HDF_PREFIX}_HAVE_GETPWUID)
CHECK_FUNCTION_EXISTS (getrusage ${HDF_PREFIX}_HAVE_GETRUSAGE)
+CHECK_FUNCTION_EXISTS (llround ${HDF_PREFIX}_HAVE_LLROUND)
+CHECK_FUNCTION_EXISTS (llroundf ${HDF_PREFIX}_HAVE_LLROUNDF)
+CHECK_FUNCTION_EXISTS (lround ${HDF_PREFIX}_HAVE_LROUND)
+CHECK_FUNCTION_EXISTS (lroundf ${HDF_PREFIX}_HAVE_LROUNDF)
CHECK_FUNCTION_EXISTS (lstat ${HDF_PREFIX}_HAVE_LSTAT)
CHECK_FUNCTION_EXISTS (rand_r ${HDF_PREFIX}_HAVE_RAND_R)
CHECK_FUNCTION_EXISTS (random ${HDF_PREFIX}_HAVE_RANDOM)
+CHECK_FUNCTION_EXISTS (round ${HDF_PREFIX}_HAVE_ROUND)
+CHECK_FUNCTION_EXISTS (roundf ${HDF_PREFIX}_HAVE_ROUNDF)
CHECK_FUNCTION_EXISTS (setsysinfo ${HDF_PREFIX}_HAVE_SETSYSINFO)
CHECK_FUNCTION_EXISTS (signal ${HDF_PREFIX}_HAVE_SIGNAL)
@@ -554,7 +566,6 @@ if (NOT WINDOWS)
HAVE_C99_DESIGNATED_INITIALIZER
SYSTEM_SCOPE_THREADS
HAVE_SOCKLEN_T
- CXX_HAVE_OFFSETOF
)
HDF_FUNCTION_TEST (${test})
endforeach (test)
@@ -618,6 +629,7 @@ if (CMAKE_CXX_COMPILER_LOADED)
${HDF_PREFIX}_NO_STD
BOOL_NOTDEFINED
NO_STATIC_CAST
+ CXX_HAVE_OFFSETOF
)
HDF_CXX_FUNCTION_TEST (${test})
endforeach (test)
diff --git a/config/cmake_ext_mod/HDFCXXTests.cpp b/config/cmake_ext_mod/HDFCXXTests.cpp
index 6b47421..f5f6644 100644
--- a/config/cmake_ext_mod/HDFCXXTests.cpp
+++ b/config/cmake_ext_mod/HDFCXXTests.cpp
@@ -54,3 +54,38 @@ int main(void) {
}
#endif
+
+#ifdef CXX_HAVE_OFFSETOF
+
+#include <stdio.h>
+#include <stddef.h>
+
+#ifdef FC_DUMMY_MAIN
+#ifndef FC_DUMMY_MAIN_EQ_F77
+# ifdef __cplusplus
+extern "C"
+# endif
+int FC_DUMMY_MAIN()
+{ return 1;}
+#endif
+#endif
+int
+main ()
+{
+
+ struct index_st
+ {
+ unsigned char type;
+ unsigned char num;
+ unsigned int len;
+ };
+ typedef struct index_st index_t;
+ int x,y;
+ x = offsetof(struct index_st, len);
+ y = offsetof(index_t, num)
+
+ ;
+ return 0;
+}
+
+#endif
diff --git a/config/cmake_ext_mod/HDFMacros.cmake b/config/cmake_ext_mod/HDFMacros.cmake
index b2c4997..1d6b49a 100644
--- a/config/cmake_ext_mod/HDFMacros.cmake
+++ b/config/cmake_ext_mod/HDFMacros.cmake
@@ -279,3 +279,13 @@ macro (HDF_README_PROPERTIES target_fortran)
${CMAKE_BINARY_DIR}/README.txt @ONLY
)
endmacro (HDF_README_PROPERTIES)
+
+macro (HDFTEST_COPY_FILE src dest target)
+ add_custom_command(
+ OUTPUT "${dest}"
+ COMMAND "${CMAKE_COMMAND}"
+ ARGS -E copy_if_different "${src}" "${dest}"
+ DEPENDS "${src}"
+ )
+ list (APPEND ${target}_list "${dest}")
+endmacro ()
diff --git a/config/cmake_ext_mod/HDFTests.c b/config/cmake_ext_mod/HDFTests.c
index 8478d1b..648f795 100644
--- a/config/cmake_ext_mod/HDFTests.c
+++ b/config/cmake_ext_mod/HDFTests.c
@@ -389,55 +389,20 @@ int main(void)
}
#endif
-#ifdef CXX_HAVE_OFFSETOF
-
-#include <stdio.h>
-#include <stddef.h>
-
-#ifdef FC_DUMMY_MAIN
-#ifndef FC_DUMMY_MAIN_EQ_F77
-# ifdef __cplusplus
-extern "C"
-# endif
-int FC_DUMMY_MAIN()
-{ return 1;}
-#endif
-#endif
-int
-main ()
-{
-
- struct index_st
- {
- unsigned char type;
- unsigned char num;
- unsigned int len;
- };
- typedef struct index_st index_t;
- int x,y;
- x = offsetof(struct index_st, len);
- y = offsetof(index_t, num)
-
- ;
- return 0;
-}
-
-#endif
-
#ifdef HAVE_IOEO
#include <windows.h>
typedef void (WINAPI *PGNSI)(LPSYSTEM_INFO);
int main ()
{
- PGNSI pGNSI;
- pGNSI = (PGNSI) GetProcAddress(
- GetModuleHandle(TEXT("kernel32.dll")),
+ PGNSI pGNSI;
+ pGNSI = (PGNSI) GetProcAddress(
+ GetModuleHandle(TEXT("kernel32.dll")),
"InitOnceExecuteOnce");
- if(NULL == pGNSI)
- return 1;
- else
- return 0;
+ if(NULL == pGNSI)
+ return 1;
+ else
+ return 0;
}
#endif /* HAVE_IOEO */
diff --git a/config/i386-pc-cygwin32 b/config/cygwin
index 93a8d29..7423403 100644
--- a/config/i386-pc-cygwin32
+++ b/config/cygwin
@@ -1,4 +1,4 @@
-# -*- shell-script -*-
+# -*- shell-script -*-
#
# Copyright by The HDF Group.
# Copyright by the Board of Trustees of the University of Illinois.
@@ -20,12 +20,5 @@
#
# See BlankForm in this directory for details.
-# The default compiler is `gcc'.
-if test "X-" = "X-$CC"; then
- CC=gcc
- CC_BASENAME=gcc
- LD=ld
-fi
-
-# Figure out compiler flags
-. $srcdir/config/gnu-flags
+# Use the linux-gnulibc1 file.
+. $srcdir/config/linux-gnulibc1
diff --git a/config/i686-pc-cygwin b/config/i686-pc-cygwin
deleted file mode 100644
index 7355e4a..0000000
--- a/config/i686-pc-cygwin
+++ /dev/null
@@ -1,137 +0,0 @@
-# -*- shell-script -*-
-#
-# 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 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.
-
-
-# This file is part of the HDF5 build script. It is processed shortly
-# after configure starts and defines, among other things, flags for
-# the various compile modes.
-#
-# See BlankForm in this directory for details.
-
-# The default compiler is `gcc'.
-if test -z "$CC"; then
- CC=gcc
- CC_BASENAME=gcc
-fi
-
-# Figure out GNU C compiler flags
-. $srcdir/config/gnu-flags
-
-# Figure out PGI C compiler flags
-. $srcdir/config/pgi-flags
-
-# Figure out Intel C compiler flags
-. $srcdir/config/intel-flags
-
-# The default Fortran 90 compiler
-if test "X-" = "X-$FC"; then
- case $CC_BASENAME in
- gcc*)
- FC=gfortran
- FCLIBS=-lgcc
- FC_BASENAME=gfortran
- ;;
- pgcc*)
- FC=pgf90
- FC_BASENAME=pgf90
- ;;
- icc*)
- FC=ifort
- FC_BASENAME=ifort
- ;;
- mpicc*)
- FC=mpif90
- FC_BASENAME=mpif90
- ;;
- esac
-else
- case $FC in
- # The PGI and Intel compilers are automatically detected below
- ifc*|ifort*|pgf90*)
- ;;
- gfortran)
- FCLIBS=-lgcc
- ;;
- g95)
- FCLIBS=-lgcc
- ;;
- *)
- # Figure out which compiler we are using: pgf90 or Absoft f95
- RM='rm -f'
- tmpfile=/tmp/cmpver.$$
- $FC -V >$tmpfile
- if test -s "$tmpfile"; then
- if( grep -s 'Absoft' $tmpfile > /dev/null) then
- FC_BASENAME=f95
- fi
- if( grep -s 'pgf90' $tmpfile > /dev/null) then
- FC_BASENAME=pgf90
- fi
- fi
- $RM $tmpfile
- ;;
- esac
-fi
-
-# Figure out PGI F90 compiler flags
-. $srcdir/config/pgi-fflags
-
-# Figure out Intel F90 compiler flags
-. $srcdir/config/intel-fflags
-
-case $FC_BASENAME in
- #
- # Absoft compiler
- #
- f95)
- # Set required flag for compiling C stubs
- H5_CFLAGS="$H5_CFLAGS -DH5_ABSOFT"
-
- F9XSUFFIXFLAG=""
-# We force compiler to use upper case for external names
-# (just in case since this should be a default EIP)
- H5_FCFLAGS="$H5_FCFLAGS -YEXT_NAMES=UCS"
- FSEARCH_DIRS=""
-
- # Production
- PROD_FCFLAGS=
-
- # Debug
- DEBUG_FCFLAGS=
-
- # Symbols
- SYMBOLS_FCFLAGS="-g"
- NO_SYMBOLS_FCFLAGS="-s"
-
- # Profiling
- PROFILE_FCFLAGS="-pg"
-
- # Optimization
- HIGH_OPT_FCFLAGS="-O"
- DEBUG_OPT_FCFLAGS=
- NO_OPT_FCFLAGS=
-
- f9x_flags_set=yes
- ;;
-
-esac
-
-# The default C++ compiler
-
-# The default compiler is `g++'.
-if test -z "$CXX"; then
- CXX=g++
- CXX_BASENAME=g++
-fi
diff --git a/config/x86_64-pc-cygwin b/config/x86_64-pc-cygwin
deleted file mode 100644
index 210aa2b..0000000
--- a/config/x86_64-pc-cygwin
+++ /dev/null
@@ -1,138 +0,0 @@
-# -*- shell-script -*-
-#
-# 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 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.
-
-
-# This file is part of the HDF5 build script. It is processed shortly
-# after configure starts and defines, among other things, flags for
-# the various compile modes.
-#
-# See BlankForm in this directory for details.
-
-# The default compiler is `gcc'.
-if test -z "$CC"; then
- CC=gcc
- CC_BASENAME=gcc
-fi
-
-# Figure out GNU C compiler flags
-. $srcdir/config/gnu-flags
-
-# Figure out PGI C compiler flags
-. $srcdir/config/pgi-flags
-
-# Figure out Intel C compiler flags
-. $srcdir/config/intel-flags
-
-# The default Fortran 90 compiler
-if test "X-" = "X-$FC"; then
- case $CC_BASENAME in
- gcc*)
- FC=gfortran
- FCLIBS=-lgcc
- FC_BASENAME=gfortran
- ;;
- pgcc*)
- FC=pgf90
- FC_BASENAME=pgf90
- ;;
- icc*)
- FC=ifort
- FC_BASENAME=ifort
- ;;
- mpicc*)
- FC=mpif90
- FC_BASENAME=mpif90
- ;;
- esac
-else
- case $FC in
- # The PGI and Intel compilers are automatically detected below
- ifc*|ifort*|pgf90*)
- ;;
- gfortran)
- FCLIBS=-lgcc
- ;;
- g95)
- FCLIBS=-lgcc
- ;;
- *)
- # Figure out which compiler we are using: pgf90 or Absoft f95
- RM='rm -f'
- tmpfile=/tmp/cmpver.$$
- $FC -V >$tmpfile
- if test -s "$tmpfile"; then
- if( grep -s 'Absoft' $tmpfile > /dev/null) then
- FC_BASENAME=f95
- fi
- if( grep -s 'pgf90' $tmpfile > /dev/null) then
- FC_BASENAME=pgf90
- fi
- fi
- $RM $tmpfile
- ;;
- esac
-fi
-
-# Figure out PGI F90 compiler flags
-. $srcdir/config/pgi-fflags
-
-# Figure out Intel F90 compiler flags
-. $srcdir/config/intel-fflags
-
-case $FC_BASENAME in
- #
- # Absoft compiler
- #
- f95)
- # Set required flag for compiling C stubs
- H5_CFLAGS="$H5_CFLAGS -DH5_ABSOFT"
-
- F9XSUFFIXFLAG=""
-# We force compiler to use upper case for external names
-# (just in case since this should be a default EIP)
- H5_FCFLAGS="$H5_FCFLAGS -YEXT_NAMES=UCS"
- FSEARCH_DIRS=""
-
- # Production
- PROD_FCFLAGS=
-
- # Debug
- DEBUG_FCFLAGS=
-
- # Symbols
- SYMBOLS_FCFLAGS="-g"
- NO_SYMBOLS_FCFLAGS="-s"
-
- # Profiling
- PROFILE_FCFLAGS="-pg"
-
- # Optimization
- HIGH_OPT_FCFLAGS="-O"
- DEBUG_OPT_FCFLAGS=
- NO_OPT_FCFLAGS=
-
- f9x_flags_set=yes
- ;;
-
-esac
-
-# The default C++ compiler
-
-# The default compiler is `g++'.
-if test -z "$CXX"; then
- CXX=g++
- CXX_BASENAME=g++
-fi
-
diff --git a/configure.ac b/configure.ac
index b6bb44c..59d1bef 100644
--- a/configure.ac
+++ b/configure.ac
@@ -281,6 +281,7 @@ while test -n "$hname"; do
test "$hname_tmp" = "$hname" && break
done
+
## ----------------------------------------------------------------------
## Determine build mode (debug, production, clean).
## This has to be done early since the build mode is referred to
@@ -694,12 +695,14 @@ if test "X$HDF_CXX" = "Xyes"; then
## Checking if C++ can handle namespaces
PAC_PROG_CXX_NAMESPACE
- ## Checking if C++ has offsetof extension
- PAC_PROG_CXX_OFFSETOF
-
## if C++ can handle static cast
PAC_PROG_CXX_STATIC_CAST
+ ## Checking if C++ has offsetof extension,
+ ## note: this test has to be the last of the C++ tests because it sets a definition
+ ## which would be used in the other tests, causing them to fail.
+ PAC_PROG_CXX_OFFSETOF
+
else
AC_MSG_RESULT([no])
CXX="no"
@@ -1798,7 +1801,7 @@ case "`uname`" in
CYGWIN*)
;;
*)
- AC_CHECK_FUNCS([GetConsoleScreenBufferInfo])
+ AC_CHECK_FUNCS([GetConsoleScreenBufferInfo getpwuid])
;;
esac
AC_CHECK_FUNCS([_scrsize ioctl])
@@ -1843,11 +1846,12 @@ AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
## so we'll search for it before calling AC_CHECK_FUNCS.
AC_SEARCH_LIBS([clock_gettime], [rt posix4])
AC_CHECK_FUNCS([alarm clock_gettime difftime fcntl flock fork frexpf])
-AC_CHECK_FUNCS([frexpl gethostname getpwuid getrusage gettimeofday])
+AC_CHECK_FUNCS([frexpl gethostname getrusage gettimeofday])
AC_CHECK_FUNCS([lstat rand_r random setsysinfo])
AC_CHECK_FUNCS([signal longjmp setjmp siglongjmp sigsetjmp sigprocmask])
AC_CHECK_FUNCS([snprintf srandom strdup symlink system])
AC_CHECK_FUNCS([tmpfile asprintf vasprintf vsnprintf waitpid])
+AC_CHECK_FUNCS([roundf lroundf llroundf round lround llround])
## ----------------------------------------------------------------------
## Check compiler characteristics
@@ -2793,63 +2797,18 @@ esac
##
AC_MSG_CHECKING([if using special algorithm to convert long double to (unsigned) long values])
+## NOTE: Place all configure test programs into cmake's source file, then use a preprocessor directive
+## to select the proper test program. This is done by echoing the #define and cat'ing the cmake
+## source file. (HDFFV-9467)
+
+TEST_SRC="`(echo \"#define H5_LDOUBLE_TO_LONG_SPECIAL_TEST 1\"; cat $srcdir/config/cmake/ConversionTests.c)`"
+
if test ${ac_cv_sizeof_long_double} = 0; then
hdf5_cv_ldouble_to_long_special=${hdf5_cv_ldouble_to_long_special=no}
else
AC_CACHE_VAL([hdf5_cv_ldouble_to_long_special],
[AC_RUN_IFELSE(
- [AC_LANG_PROGRAM([
- #include <string.h>
- ],[[
- long double ld = 20041683600089727.779961L;
- long ll;
- unsigned long ull;
- unsigned char s[16];
- unsigned char s2[8];
- int ret = 1;
-
- if(sizeof(long double) == 16 && sizeof(long) == 8) {
- /*make sure the long double type has 16 bytes in size and
- * 11 bits of exponent. If it is,
- *the bit sequence should be like below. It's not
- *a decent way to check but this info isn't available. */
- memcpy(s, &ld, 16);
- if(s[0]==0x43 && s[1]==0x51 && s[2]==0xcc && s[3]==0xf3 &&
- s[4]==0x85 && s[5]==0xeb && s[6]==0xc8 && s[7]==0xa0 &&
- s[8]==0xbf && s[9]==0xcc && s[10]==0x2a && s[11]==0x3c) {
-
- /* Assign the hexadecimal value of long double type. */
- s[0]=0x43; s[1]=0x51; s[2]=0xcc; s[3]=0xf3;
- s[4]=0x85; s[5]=0xeb; s[6]=0xc8; s[7]=0xa0;
- s[8]=0xbf; s[9]=0xcc; s[10]=0x2a; s[11]=0x3c;
- s[12]=0x3d; s[13]=0x85; s[14]=0x56; s[15]=0x20;
-
- memcpy(&ld, s, 16);
-
- ll = (long)ld;
- memcpy(s2, &ll, 8);
-
- /* The library's algorithm converts it to 0x 00 47 33 ce 17 af 22 82
- * and gets wrong value 20041683600089730 on the IBM Power6 Linux.
- * But the IBM Power6 Linux converts it to 0x00 47 33 ce 17 af 22 7f
- * and gets the correct value 20041683600089727. It uses some special
- * algorithm. We're going to define the macro and skip the test until
- * we can figure out how they do it. */
- if(s2[0]==0x00 && s2[1]==0x47 && s2[2]==0x33 && s2[3]==0xce &&
- s2[4]==0x17 && s2[5]==0xaf && s2[6]==0x22 && s2[7]==0x7f)
- ret = 0;
-
- ull = (unsigned long)ld;
- memcpy(s2, &ull, 8);
-
- /* The unsigned long is the same as signed long. */
- if(s2[0]==0x00 && s2[1]==0x47 && s2[2]==0x33 && s2[3]==0xce &&
- s2[4]==0x17 && s2[5]==0xaf && s2[6]==0x22 && s2[7]==0x7f)
- ret = 0;
- }
- }
- exit(ret);
- ]])]
+ [AC_LANG_SOURCE([$TEST_SRC])]
, [hdf5_cv_ldouble_to_long_special=yes], [hdf5_cv_ldouble_to_long_special=no],)])
fi
@@ -2871,66 +2830,14 @@ fi
##
AC_MSG_CHECKING([if using special algorithm to convert (unsigned) long to long double values])
+TEST_SRC="`(echo \"#define H5_LONG_TO_LDOUBLE_SPECIAL_TEST 1\"; cat $srcdir/config/cmake/ConversionTests.c)`"
+
if test ${ac_cv_sizeof_long_double} = 0; then
hdf5_cv_long_to_ldouble_special=${hdf5_cv_long_to_ldouble_special=no}
else
AC_CACHE_VAL([hdf5_cv_long_to_ldouble_special],
[AC_RUN_IFELSE(
- [AC_LANG_PROGRAM([
- #include <string.h>
- ],[[
- long double ld;
- long ll;
- unsigned long ull;
- unsigned char s[16];
- int flag=0, ret=1;
-
- /*Determine if long double has 16 byte in size, 11 bit exponent, and
- *the bias is 0x3ff */
- if(sizeof(long double) == 16) {
- ld = 1.0L;
- memcpy(s, &ld, 16);
- if(s[0]==0x3f && s[1]==0xf0 && s[2]==0x00 && s[3]==0x00 &&
- s[4]==0x00 && s[5]==0x00 && s[6]==0x00 && s[7]==0x00)
- flag = 1;
- }
-
- if(flag==1 && sizeof(long)==8) {
- ll = 0x003fffffffffffffL;
- ld = (long double)ll;
- memcpy(s, &ld, 16);
- /* The library converts the value to 0x434fffffffffffff8000000000000000.
- * In decimal it is 18014398509481982.000000, one value short of the original.
- * The IBM Power6 Linux converts it to 0x4350000000000000bff0000000000000.
- * The value is correct in decimal. It uses some special
- * algorithm. We're going to define the macro and skip the test until
- * we can figure out how they do it. */
- if(s[0]==0x43 && s[1]==0x50 && s[2]==0x00 && s[3]==0x00 &&
- s[4]==0x00 && s[5]==0x00 && s[6]==0x00 && s[7]==0x00 &&
- s[8]==0xbf && s[9]==0xf0 && s[10]==0x00 && s[11]==0x00 &&
- s[12]==0x00 && s[13]==0x00 && s[14]==0x00 && s[15]==0x00)
- ret = 0;
- }
- if(flag==1 && sizeof(unsigned long)==8) {
- ull = 0xffffffffffffffffUL;
- ld = (long double)ull;
- memcpy(s, &ld, 16);
- /* Use a different value from signed long to test. The problem is the same
- * for both long and unsigned long. The value is 18446744073709551615.
- * The library converts the value to 0x43effffffffffffffe000000000000000.
- * In decimal it's 18446744073709548544.000000, very different from the original.
- * The IBM Power6 Linux converts it to 0x43f0000000000000bff0000000000000.
- * The value is correct in decimal. It uses some special
- * algorithm. We're going to define the macro and skip the test until
- * we can figure out how they do it. */
- if(s[0]==0x43 && s[1]==0xf0 && s[2]==0x00 && s[3]==0x00 &&
- s[4]==0x00 && s[5]==0x00 && s[6]==0x00 && s[7]==0x00 &&
- s[8]==0xbf && s[9]==0xf0 && s[10]==0x00 && s[11]==0x00 &&
- s[12]==0x00 && s[13]==0x00 && s[14]==0x00 && s[15]==0x00)
- ret = 0;
- }
- exit(ret);
- ]])]
+ [AC_LANG_SOURCE([$TEST_SRC])]
, [hdf5_cv_long_to_ldouble_special=yes], [hdf5_cv_long_to_ldouble_special=no],)])
fi
@@ -2955,48 +2862,14 @@ fi
##
AC_MSG_CHECKING([if correctly converting long double to (unsigned) long long values])
+TEST_SRC="`(echo \"#define H5_LDOUBLE_TO_LLONG_ACCURATE_TEST 1\"; cat $srcdir/config/cmake/ConversionTests.c)`"
+
if test ${ac_cv_sizeof_long_double} = 0; then
hdf5_cv_ldouble_to_llong_accurate=${hdf5_cv_ldouble_to_llong_accurate=no}
else
AC_CACHE_VAL([hdf5_cv_ldouble_to_llong_accurate],
- [AC_RUN_IFELSE([AC_LANG_SOURCE([[
- int main(void)
- {
- long double ld = 20041683600089727.779961L;
- long long ll;
- unsigned long long ull;
- unsigned char s[16];
- int ret = 0;
-
- if(sizeof(long double) == 16) {
- /*make sure the long double type is the same as the failing type
- *which has 16 bytes in size and 11 bits of exponent. If it is,
- *the bit sequence should be like below. It's not
- *a decent way to check but this info isn't available. */
- memcpy(s, &ld, 16);
- if(s[0]==0x43 && s[1]==0x51 && s[2]==0xcc && s[3]==0xf3 &&
- s[4]==0x85 && s[5]==0xeb && s[6]==0xc8 && s[7]==0xa0 &&
- s[8]==0xbf && s[9]==0xcc && s[10]==0x2a && s[11]==0x3c) {
-
- /*slightly adjust the bit sequence (s[8]=0xdf). The converted
- *values will go wild on Mac OS 10.4 and IRIX64 6.5.*/
- s[0]=0x43; s[1]=0x51; s[2]=0xcc; s[3]=0xf3;
- s[4]=0x85; s[5]=0xeb; s[6]=0xc8; s[7]=0xa0;
- s[8]=0xdf; s[9]=0xcc; s[10]=0x2a; s[11]=0x3c;
- s[12]=0x3d; s[13]=0x85; s[14]=0x56; s[15]=0x20;
-
- memcpy(&ld, s, 16);
- ll = (long long)ld;
- ull = (unsigned long long)ld;
-
- if(ll != 20041683600089728 || ull != 20041683600089728)
- ret = 1;
- }
- }
- done:
- exit(ret);
- }
- ]])], [hdf5_cv_ldouble_to_llong_accurate=yes], [hdf5_cv_ldouble_to_llong_accurate=no],[])])
+ [AC_RUN_IFELSE([AC_LANG_SOURCE([$TEST_SRC])],
+ [hdf5_cv_ldouble_to_llong_accurate=yes], [hdf5_cv_ldouble_to_llong_accurate=no],[])])
fi
if test ${hdf5_cv_ldouble_to_llong_accurate} = "yes"; then
@@ -3018,52 +2891,14 @@ fi
##
AC_MSG_CHECKING([if correctly converting (unsigned) long long to long double values])
+TEST_SRC="`(echo \"#define H5_LLONG_TO_LDOUBLE_CORRECT_TEST 1\"; cat $srcdir/config/cmake/ConversionTests.c)`"
+
if test ${ac_cv_sizeof_long_double} = 0; then
hdf5_cv_llong_to_ldouble_correct=${hdf5_cv_llong_to_ldouble_correct=no}
else
AC_CACHE_VAL([hdf5_cv_llong_to_ldouble_correct],
- [AC_RUN_IFELSE([AC_LANG_SOURCE([[
- int main(void)
- {
- long double ld;
- long long ll;
- unsigned long long ull;
- unsigned char s[16];
- int flag=0, ret=0;
-
- /*Determine if long double has 16 byte in size, 11 bit exponent, and
- *the bias is 0x3ff */
- if(sizeof(long double) == 16) {
- ld = 1.0L;
- memcpy(s, &ld, 16);
- if(s[0]==0x3f && s[1]==0xf0 && s[2]==0x00 && s[3]==0x00 &&
- s[4]==0x00 && s[5]==0x00 && s[6]==0x00 && s[7]==0x00)
- flag = 1;
- }
-
- if(flag==1 && sizeof(long long)==8) {
- ll = 0x01ffffffffffffffLL;
- ld = (long double)ll;
- memcpy(s, &ld, 16);
- /*Check if the bit sequence is as supposed to be*/
- if(s[0]!=0x43 || s[1]!=0x7f || s[2]!=0xff || s[3]!=0xff ||
- s[4]!=0xff || s[5]!=0xff || s[6]!=0xff || s[7]!=0xff ||
- s[8]!=0xf0 || s[9]!=0x00 || s[10]!=0x00 || s[11]!=0x00)
- ret = 1;
- }
- if(flag==1 && sizeof(unsigned long long)==8) {
- ull = 0x01ffffffffffffffULL;
- ld = (long double)ull;
- memcpy(s, &ld, 16);
- if(s[0]!=0x43 || s[1]!=0x7f || s[2]!=0xff || s[3]!=0xff ||
- s[4]!=0xff || s[5]!=0xff || s[6]!=0xff || s[7]!=0xff ||
- s[8]!=0xf0 || s[9]!=0x00 || s[10]!=0x00 || s[11]!=0x00)
- ret = 1;
- }
- done:
- exit(ret);
- }
- ]])],[hdf5_cv_llong_to_ldouble_correct=yes], [hdf5_cv_llong_to_ldouble_correct=no],[])])
+ [AC_RUN_IFELSE([AC_LANG_SOURCE([$TEST_SRC])],
+ [hdf5_cv_llong_to_ldouble_correct=yes], [hdf5_cv_llong_to_ldouble_correct=no],[])])
fi
if test ${hdf5_cv_llong_to_ldouble_correct} = "yes"; then
@@ -3357,40 +3192,11 @@ AC_ARG_ENABLE([embedded-libinfo],
## Check if pointer alignments are enforced
##
AC_MSG_CHECKING([if alignment restrictions are strictly enforced])
+
+TEST_SRC="`(echo \"#define H5_NO_ALIGNMENT_RESTRICTIONS_TEST 1\"; cat $srcdir/config/cmake/ConversionTests.c)`"
+
AC_RUN_IFELSE([
- AC_LANG_PROGRAM([
- #include <stdlib.h>
- #include <string.h>
-
- typedef struct {
- size_t len;
- void *p;
- } hvl_t;
- ], [
- char *chp = "beefs";
- char **chpp = malloc (2 * sizeof (char *));
- char **chpp2;
- hvl_t vl = { 12345, (void *) chp };
- hvl_t *vlp;
- hvl_t *vlp2;
-
- memcpy ((void *) ((char *) chpp + 1), &chp, sizeof (char *));
- chpp2 = (char **) ((char *) chpp + 1);
- if (strcmp (*chpp2, chp)) {
- free (chpp);
- return 1;
- }
- free (chpp);
-
- vlp = malloc (2 * sizeof (hvl_t));
- memcpy ((void *) ((char *) vlp + 1), &vl, sizeof (hvl_t));
- vlp2 = (hvl_t *) ((char *) vlp + 1);
- if (vlp2->len != vl.len || vlp2->p != vl.p) {
- free (vlp);
- return 1;
- }
- free (vlp);
- ])
+ AC_LANG_SOURCE([$TEST_SRC])
], [
AC_DEFINE([NO_ALIGNMENT_RESTRICTIONS], [1], [Define if we can violate pointer alignment restrictions])
AC_MSG_RESULT([no])
diff --git a/examples/README b/examples/README
index 0550b15..e0a3364 100644
--- a/examples/README
+++ b/examples/README
@@ -2,7 +2,7 @@
This directory contains example programs for the installed APIs and scripts to
compile and run them. Examples in the c and hl/c subdirectories are always
-installed, and those in fortan, hl/fortran, c++ and hl/c++ will be installed
+installed, and those in fortran, hl/fortran, c++ and hl/c++ will be installed
when fortran or c++ are enabled.
Running the run-all-ex.sh script in this directory will run the scripts and in
diff --git a/fortran/test/tf.F90 b/fortran/test/tf.F90
index e9baf43..219254b 100644
--- a/fortran/test/tf.F90
+++ b/fortran/test/tf.F90
@@ -339,7 +339,11 @@ CONTAINS
#ifdef H5_FORTRAN_HAVE_C_SIZEOF
H5_SIZEOF_CMPD = C_SIZEOF(a)
#else
- H5_SIZEOF_CMPD = SIZEOF(a)
+# ifdef H5_FORTRAN_HAVE_STORAGE_SIZE
+ H5_SIZEOF_CMPD = storage_size(a, c_size_t)/storage_size(c_char_'a',c_size_t)
+# else
+ H5_SIZEOF_CMPD = SIZEOF(a)
+# endif
#endif
END FUNCTION H5_SIZEOF_CMPD
diff --git a/hl/examples/CMakeTests.cmake b/hl/examples/CMakeTests.cmake
index 8cf74d9..6384aa5 100644
--- a/hl/examples/CMakeTests.cmake
+++ b/hl/examples/CMakeTests.cmake
@@ -11,21 +11,15 @@ set (HDF5_TEST_FILES
)
foreach (h5_file ${HDF5_TEST_FILES})
- set (dest "${PROJECT_BINARY_DIR}/${h5_file}")
- #message (STATUS " Copying ${h5_file}")
- add_custom_command (
- TARGET hl_ex_ex_ds1
- POST_BUILD
- COMMAND ${CMAKE_COMMAND}
- ARGS -E copy_if_different ${PROJECT_SOURCE_DIR}/${h5_file} ${dest}
- )
+ HDFTEST_COPY_FILE("${PROJECT_SOURCE_DIR}/${h5_file}" "${PROJECT_BINARY_DIR}/${h5_file}" "hl_ex_ex_ds1_files")
endforeach (h5_file ${HDF5_TEST_FILES})
+add_custom_target(hl_ex_ex_ds1_files ALL COMMENT "Copying files needed by hl_ex_ex_ds1 tests" DEPENDS ${hl_ex_ex_ds1_files_list})
# Remove any output file left over from previous test run
add_test (
NAME HL_ex-clear-objects
COMMAND ${CMAKE_COMMAND}
- -E remove
+ -E remove
ex_lite1.h5
ex_lite2.h5
ex_lite3.h5
@@ -48,13 +42,13 @@ endforeach (h5_file ${HDF5_TEST_FILES})
)
if (NOT "${last_test}" STREQUAL "")
set_tests_properties (HL_ex-clear-objects PROPERTIES DEPENDS ${last_test})
- endif (NOT "${last_test}" STREQUAL "")
+ endif ()
set (last_test "HL_ex-clear-objects")
foreach (example ${examples})
add_test (NAME HL_ex_${example} COMMAND $<TARGET_FILE:hl_ex_${example}>)
if (NOT "${last_test}" STREQUAL "")
set_tests_properties (HL_ex_${example} PROPERTIES DEPENDS ${last_test})
- endif (NOT "${last_test}" STREQUAL "")
+ endif ()
set (last_test "HL_ex_${example}")
endforeach (example ${examples})
diff --git a/hl/fortran/test/CMakeLists.txt b/hl/fortran/test/CMakeLists.txt
index fc703dc..13cb177 100644
--- a/hl/fortran/test/CMakeLists.txt
+++ b/hl/fortran/test/CMakeLists.txt
@@ -31,7 +31,7 @@ endif (BUILD_SHARED_LIBS AND NOT SKIP_HDF5_FORTRAN_SHARED)
add_executable (hl_f90_tstlite tstlite.F90)
TARGET_NAMING (hl_f90_tstlite STATIC)
TARGET_FORTRAN_PROPERTIES (hl_f90_tstlite STATIC " " " ")
-target_link_libraries (hl_f90_tstlite ${HDF5_HL_F90_LIB_TARGET} ${HDF5_F90_LIB_TARGET})
+target_link_libraries (hl_f90_tstlite ${HDF5_HL_F90_LIB_TARGET} ${HDF5_F90_LIB_TARGET} ${HDF5_F90_TEST_LIB_TARGET})
target_include_directories (hl_f90_tstlite PRIVATE ${CMAKE_Fortran_MODULE_DIRECTORY}/static)
set_target_properties (hl_f90_tstlite PROPERTIES LINKER_LANGUAGE Fortran)
set_target_properties (hl_f90_tstlite PROPERTIES FOLDER test/hl/fortran)
@@ -39,7 +39,7 @@ if (BUILD_SHARED_LIBS AND NOT SKIP_HDF5_FORTRAN_SHARED)
add_executable (hl_f90_tstlite-shared tstlite.F90)
TARGET_NAMING (hl_f90_tstlite-shared SHARED)
TARGET_FORTRAN_PROPERTIES (hl_f90_tstlite-shared SHARED " " " ")
- target_link_libraries (hl_f90_tstlite-shared ${HDF5_HL_F90_LIBSH_TARGET} ${HDF5_F90_LIBSH_TARGET})
+ target_link_libraries (hl_f90_tstlite-shared ${HDF5_HL_F90_LIBSH_TARGET} ${HDF5_F90_LIBSH_TARGET} ${HDF5_F90_TEST_LIBSH_TARGET})
target_include_directories (hl_f90_tstlite-shared PRIVATE ${CMAKE_Fortran_MODULE_DIRECTORY}/shared)
set_target_properties (hl_f90_tstlite-shared PROPERTIES
LINKER_LANGUAGE Fortran
@@ -73,7 +73,7 @@ endif (BUILD_SHARED_LIBS AND NOT SKIP_HDF5_FORTRAN_SHARED)
add_executable (hl_f90_tsttable tsttable.F90)
TARGET_NAMING (hl_f90_tsttable STATIC)
TARGET_FORTRAN_PROPERTIES (hl_f90_tsttable STATIC " " " ")
-target_link_libraries (hl_f90_tsttable ${HDF5_HL_F90_LIB_TARGET} ${HDF5_F90_LIB_TARGET})
+target_link_libraries (hl_f90_tsttable ${HDF5_HL_F90_LIB_TARGET} ${HDF5_F90_LIB_TARGET} ${HDF5_F90_TEST_LIB_TARGET})
target_include_directories (hl_f90_tsttable PRIVATE ${CMAKE_Fortran_MODULE_DIRECTORY}/static)
set_target_properties (hl_f90_tsttable PROPERTIES LINKER_LANGUAGE Fortran)
set_target_properties (hl_f90_tsttable PROPERTIES FOLDER test/hl/fortran)
@@ -81,7 +81,7 @@ if (BUILD_SHARED_LIBS AND NOT SKIP_HDF5_FORTRAN_SHARED)
add_executable (hl_f90_tsttable-shared tsttable.F90)
TARGET_NAMING (hl_f90_tsttable-shared SHARED)
TARGET_FORTRAN_PROPERTIES (hl_f90_tsttable-shared SHARED " " " ")
- target_link_libraries (hl_f90_tsttable-shared ${HDF5_HL_F90_LIBSH_TARGET} ${HDF5_F90_LIBSH_TARGET})
+ target_link_libraries (hl_f90_tsttable-shared ${HDF5_HL_F90_LIBSH_TARGET} ${HDF5_F90_LIBSH_TARGET} ${HDF5_F90_TEST_LIBSH_TARGET})
target_include_directories (hl_f90_tsttable-shared PRIVATE ${CMAKE_Fortran_MODULE_DIRECTORY}/shared)
set_target_properties (hl_f90_tsttable-shared PROPERTIES
LINKER_LANGUAGE Fortran
diff --git a/hl/fortran/test/Makefile.am b/hl/fortran/test/Makefile.am
index 32d367c..4013d39 100644
--- a/hl/fortran/test/Makefile.am
+++ b/hl/fortran/test/Makefile.am
@@ -22,7 +22,7 @@
include $(top_srcdir)/config/commence.am
AM_CPPFLAGS+=-I$(top_srcdir)/src -I$(top_builddir)/src -I$(top_srcdir)/hl/src
-AM_FCFLAGS+=-I$(top_builddir)/fortran/src -I$(top_builddir)/hl/fortran/src $(F9XMODFLAG)$(top_builddir)/fortran/src $(F9XMODFLAG)$(top_builddir)/hl/fortran/src
+AM_FCFLAGS+=-I$(top_builddir)/fortran/src -I$(top_builddir)/hl/fortran/src -I$(top_builddir)/fortran/test $(F9XMODFLAG)$(top_builddir)/fortran/src $(F9XMODFLAG)$(top_builddir)/fortran/test $(F9XMODFLAG)$(top_builddir)/hl/fortran/src
# Some Fortran compilers can't build shared libraries, so sometimes we
# need to make sure the Fortran programs link against the static version
@@ -36,7 +36,9 @@ endif
TEST_PROG=tstds tstlite tstimage tsttable
check_PROGRAMS=$(TEST_PROG)
-LDADD= $(LIBH5F_HL) $(LIBH5F) $(LIBH5_HL) $(LIBHDF5)
+LIBOBJS=$(top_builddir)/fortran/test/tf_gen.o
+
+LDADD=$(LIBOBJS) $(LIBH5F_HL) $(LIBH5F) $(LIBH5_HL) $(LIBHDF5)
# Source files for the programs
tstds_SOURCES=tstds.F90
@@ -47,6 +49,29 @@ tsttable_SOURCES=tsttable.F90
# Temporary files.
CHECK_CLEANFILES+=dsetf[1-5].h5 f1img.h5 f[1-2]tab.h5 tstds.h5
+# Fortran module files can have different extensions and different names
+# (e.g., different capitalizations) on different platforms. Write rules
+# for them explicitly rather than trying to teach automake about them.
+# They should be installed as headers and removed during clean.
+maintainer-clean-local: clean-local
+distclean-local: clean-local
+clean-local:
+ @if test -n "$(F9XMODEXT)" && test "X$(F9XMODEXT)" != "Xo"; then \
+ $(RM) *.$(F9XMODEXT); \
+ fi
+
+install-data-local:
+ @if test -n "$(F9XMODEXT)" && test "X$(F9XMODEXT)" != "Xo"; then \
+ $(CP) $(top_builddir)/$(subdir)/*.$(F9XMODEXT) $(DESTDIR)$(includedir)/. ; \
+ fi
+
+uninstall-local:
+ @if test -n "$(F9XMODEXT)" -a "X$(F9XMODEXT)" != "Xo"; then \
+ if test -f "$(includedir)/hdf5.$(F9XMODEXT)" -o -f "$(DESTDIR)$(includedir)/HDF5.$(F9XMODEXT)"; then \
+ set -x; $(RM) $(includedir)/*.$(F9XMODEXT); \
+ fi; \
+ fi
+
# Mark this directory as part of the Fortran API (this affects output
# from tests in conclude.am)
FORTRAN_API=yes
diff --git a/hl/fortran/test/tstlite.F90 b/hl/fortran/test/tstlite.F90
index 9d47c59..b19ca5a 100644
--- a/hl/fortran/test/tstlite.F90
+++ b/hl/fortran/test/tstlite.F90
@@ -20,1900 +20,1902 @@
MODULE TSTLITE
-CONTAINS
-
-!-------------------------------------------------------------------------
-! test_begin
-!-------------------------------------------------------------------------
-
-SUBROUTINE test_begin(string)
- CHARACTER(LEN=*), INTENT(IN) :: string
- WRITE(*, fmt = '(14a)', advance = 'no') string
- WRITE(*, fmt = '(40x,a)', advance = 'no') ' '
-END SUBROUTINE test_begin
-
-!-------------------------------------------------------------------------
-! passed
-!-------------------------------------------------------------------------
-
-SUBROUTINE passed()
- WRITE(*, fmt = '(6a)') 'PASSED'
-END SUBROUTINE passed
-
-END MODULE TSTLITE
-
-MODULE TSTLITE_TESTS
+ USE TH5_MISC_GEN
+ IMPLICIT NONE
CONTAINS
-
-!-------------------------------------------------------------------------
-! test_dataset1D
-!-------------------------------------------------------------------------
-
-SUBROUTINE test_dataset1D()
-
- USE, INTRINSIC :: ISO_C_BINDING
- USE H5LT ! module of H5LT
- USE HDF5 ! module of HDF5 library
- USE TSTLITE ! module for testing lite support routines
-
- IMPLICIT NONE
-
- INTEGER, PARAMETER :: DIM1 = 4 ! Dimension of array
- CHARACTER(len=9), PARAMETER :: filename = "dsetf1.h5"! File name
- CHARACTER(LEN=5), PARAMETER :: dsetname1 = "dset1" ! Dataset name
- CHARACTER(LEN=5), PARAMETER :: dsetname2 = "dset2" ! Dataset name
- CHARACTER(LEN=5), PARAMETER :: dsetname3 = "dset3" ! Dataset name
- INTEGER(HID_T) :: file_id ! File identifier
- INTEGER(HSIZE_T), DIMENSION(1) :: dims = (/DIM1/) ! Dataset dimensions
- INTEGER :: rank = 1 ! Dataset rank
- INTEGER, DIMENSION(DIM1) :: buf1 ! Data buffer
- INTEGER, DIMENSION(DIM1) :: bufr1 ! Data buffer
- REAL, DIMENSION(DIM1) :: buf2 ! Data buffer
- REAL, DIMENSION(DIM1) :: bufr2 ! Data buffer
- DOUBLE PRECISION, DIMENSION(DIM1), TARGET :: buf3 ! Data buffer
- DOUBLE PRECISION, DIMENSION(DIM1), TARGET :: bufr3 ! Data buffer
- INTEGER :: errcode ! Error flag
- INTEGER :: i ! general purpose integer
- TYPE(C_PTR) :: f_ptr
- integer(HID_T) :: mytype
-
- CALL test_begin(' Make/Read datasets (1D) ')
-
- !
- ! Initialize the data array.
- !
- DO i = 1, DIM1
- buf1(i) = i
- buf2(i) = i
- buf3(i) = i
- END DO
-
- !
- ! Initialize FORTRAN predefined datatypes.
- !
- CALL h5open_f(errcode)
-
- !
- ! Create a new file using default properties.
- !
- CALL h5fcreate_f(filename, H5F_ACC_TRUNC_F, file_id, errcode)
-
!-------------------------------------------------------------------------
- ! H5T_NATIVE_INTEGER
+ ! test_begin
!-------------------------------------------------------------------------
- !
- ! write dataset.
- !
- CALL h5ltmake_dataset_f(file_id, dsetname1, rank, dims, H5T_NATIVE_INTEGER, buf1, errcode)
- !
- ! read dataset.
- !
- CALL h5ltread_dataset_f(file_id, dsetname1, H5T_NATIVE_INTEGER, bufr1, dims, errcode)
-
- !
- ! compare read and write buffers.
- !
- DO i = 1, DIM1
- IF ( buf1(i) .NE. bufr1(i) ) THEN
- PRINT *, 'read buffer differs from write buffer (I)'
- PRINT *, bufr1(i), ' and ', buf1(i)
- STOP
- ENDIF
- END DO
+ SUBROUTINE test_begin(string)
+ IMPLICIT NONE
+ CHARACTER(LEN=*), INTENT(IN) :: string
+ WRITE(*, fmt = '(14a)', advance = 'no') string
+ WRITE(*, fmt = '(40x,a)', advance = 'no') ' '
+ END SUBROUTINE test_begin
!-------------------------------------------------------------------------
- ! H5T_NATIVE_REAL
+ ! passed
!-------------------------------------------------------------------------
- !
- ! write dataset.
- !
- CALL h5ltmake_dataset_f(file_id, dsetname2, rank, dims, H5T_NATIVE_REAL, buf2, errcode)
-
- !
- ! read dataset.
- !
- CALL h5ltread_dataset_f(file_id, dsetname2, H5T_NATIVE_REAL, bufr2, dims, errcode)
-
- !
- ! compare read and write buffers.
- !
- DO i = 1, DIM1
- IF ( buf2(i) .NE. bufr2(i) ) THEN
- PRINT *, 'read buffer differs from write buffer (R)'
- PRINT *, bufr2(i), ' and ', buf2(i)
- STOP
- ENDIF
- END DO
+ SUBROUTINE passed()
+ IMPLICIT NONE
+ WRITE(*, fmt = '(6a)') 'PASSED'
+ END SUBROUTINE passed
- !-------------------------------------------------------------------------
- ! H5T_NATIVE_DOUBLE
- !-------------------------------------------------------------------------
+END MODULE TSTLITE
- !
- ! write dataset.
- !
- f_ptr = C_LOC(buf3(1))
- mytype = h5kind_to_type(KIND(buf3(1)), H5_REAL_KIND)
- CALL h5ltmake_dataset_f(file_id, dsetname3, rank, dims, &
- mytype, f_ptr, errcode)
- !CALL h5ltmake_dataset_f(file_id, dsetname3, rank, dims, H5T_NATIVE_DOUBLE, buf3, errcode)
- ! h5kind_to_type(KIND(buf3(1)), H5_REAL_KIND)
- !
- ! read dataset.
- !
- f_ptr = C_LOC(bufr3(1))
- CALL h5ltread_dataset_f(file_id, dsetname3, &
- h5kind_to_type(KIND(bufr3(1)), H5_REAL_KIND), f_ptr, errcode)
- !CALL h5ltread_dataset_f(file_id, dsetname3, H5T_NATIVE_DOUBLE, bufr3, dims, errcode)
-
- !
- ! compare read and write buffers.
- !
- DO i = 1, DIM1
- IF ( buf3(i) .NE. bufr3(i) ) THEN
- PRINT *, 'read buffer differs from write buffer (D)'
- PRINT *, bufr3(i), ' and ', buf3(i)
- STOP
- ENDIF
- END DO
-
- !
- ! Close the file.
- !
- CALL h5fclose_f(file_id, errcode)
-
- !
- ! Close FORTRAN predefined datatypes.
- !
- CALL h5close_f(errcode)
-
- CALL passed()
- !
- ! end function.
- !
-END SUBROUTINE test_dataset1D
-
-!-------------------------------------------------------------------------
-! test_dataset2D
-!-------------------------------------------------------------------------
-
-SUBROUTINE test_dataset2D()
+MODULE TSTLITE_TESTS
USE, INTRINSIC :: ISO_C_BINDING
- USE H5LT ! module of H5LT
- USE HDF5 ! module of HDF5 library
+ USE H5LT ! module of H5LT
+ USE HDF5 ! module of HDF5 library
USE TSTLITE ! module for testing lite support routines
-
IMPLICIT NONE
+CONTAINS
- INTEGER(HSIZE_T), PARAMETER :: DIM1 = 4 ! columns
- INTEGER(HSIZE_T), PARAMETER :: DIM2 = 6 ! rows
- CHARACTER(len=9), PARAMETER :: filename = "dsetf2.h5"! File name
- CHARACTER(LEN=5), PARAMETER :: dsetname1 = "dset1" ! Dataset name
- CHARACTER(LEN=5), PARAMETER :: dsetname2 = "dset2" ! Dataset name
- CHARACTER(LEN=5), PARAMETER :: dsetname3 = "dset3" ! Dataset name
- CHARACTER(LEN=5), PARAMETER :: dsetname4 = "dset4" ! Dataset name
- INTEGER(HID_T) :: file_id ! File identifier
- INTEGER(HSIZE_T), DIMENSION(2) :: dims = (/4,6/) ! Dataset dimensions
- INTEGER :: rank = 2 ! Dataset rank
- INTEGER, DIMENSION(DIM1*DIM2) :: buf ! Data buffer
- INTEGER, DIMENSION(DIM1*DIM2) :: bufr ! Data buffer
- INTEGER, DIMENSION(DIM1,DIM2) :: buf2 ! Data buffer
- INTEGER, DIMENSION(DIM1,DIM2) :: buf2r ! Data buffer
- REAL, DIMENSION(DIM1,DIM2), TARGET :: buf3 ! Data buffer
- REAL, DIMENSION(DIM1,DIM2), TARGET :: buf3r ! Data buffer
- DOUBLE PRECISION, DIMENSION(DIM1,DIM2), TARGET :: buf4 ! Data buffer
- DOUBLE PRECISION, DIMENSION(DIM1,DIM2), TARGET :: buf4r ! Data buffer
- INTEGER :: errcode ! Error flag
- INTEGER(HSIZE_T) :: i, j, n ! general purpose integers
- TYPE(C_PTR) :: f_ptr
-
- CALL test_begin(' Make/Read datasets (2D) ')
-
-
- !
- ! Initialize the data arrays.
- !
- n=1
- DO i = 1, DIM1*DIM2
- buf(i) = INT(n)
- n = n + 1
- END DO
-
- DO i = 1, dims(1)
- DO j = 1, dims(2)
- buf2(i,j) = INT((i-1)*dims(2) + j)
- buf3(i,j) = INT((i-1)*dims(2) + j)
- buf4(i,j) = INT((i-1)*dims(2) + j)
- END DO
- END DO
-
- !
- ! Initialize FORTRAN predefined datatypes.
- !
- CALL h5open_f(errcode)
-
- !
- ! Create a new file using default properties.
- !
- CALL h5fcreate_f(filename, H5F_ACC_TRUNC_F, file_id, errcode)
!-------------------------------------------------------------------------
- ! H5T_NATIVE_INT 1D buffer
+ ! test_dataset1D
!-------------------------------------------------------------------------
- !
- ! write dataset.
- !
- CALL h5ltmake_dataset_f(file_id, dsetname1, rank, dims, H5T_NATIVE_INTEGER, buf, errcode)
-
- !
- ! read dataset.
- !
- CALL h5ltread_dataset_f(file_id, dsetname1, H5T_NATIVE_INTEGER, bufr, dims, errcode)
-
- !
- ! compare read and write buffers.
- !
- DO i = 1, DIM1*DIM2
- IF ( buf(i) .NE. bufr(i) ) THEN
- PRINT *, 'read buffer differs from write buffer'
- PRINT *, bufr(i), ' and ', buf(i)
- STOP
- ENDIF
- END DO
+ SUBROUTINE test_dataset1D()
+
+ IMPLICIT NONE
+
+ INTEGER, PARAMETER :: DIM1 = 4 ! Dimension of array
+ CHARACTER(len=9), PARAMETER :: filename = "dsetf1.h5"! File name
+ CHARACTER(LEN=5), PARAMETER :: dsetname1 = "dset1" ! Dataset name
+ CHARACTER(LEN=5), PARAMETER :: dsetname2 = "dset2" ! Dataset name
+ CHARACTER(LEN=5), PARAMETER :: dsetname3 = "dset3" ! Dataset name
+ INTEGER(HID_T) :: file_id ! File identifier
+ INTEGER(HSIZE_T), DIMENSION(1) :: dims = (/DIM1/) ! Dataset dimensions
+ INTEGER :: rank = 1 ! Dataset rank
+ INTEGER, DIMENSION(DIM1) :: buf1 ! Data buffer
+ INTEGER, DIMENSION(DIM1) :: bufr1 ! Data buffer
+ REAL, DIMENSION(DIM1) :: buf2 ! Data buffer
+ REAL, DIMENSION(DIM1) :: bufr2 ! Data buffer
+ DOUBLE PRECISION, DIMENSION(DIM1), TARGET :: buf3 ! Data buffer
+ DOUBLE PRECISION, DIMENSION(DIM1), TARGET :: bufr3 ! Data buffer
+ INTEGER :: errcode ! Error flag
+ INTEGER :: i ! general purpose integer
+ TYPE(C_PTR) :: f_ptr
+ integer(HID_T) :: mytype
+
+ CALL test_begin(' Make/Read datasets (1D) ')
+
+ !
+ ! Initialize the data array.
+ !
+ DO i = 1, DIM1
+ buf1(i) = i
+ buf2(i) = i
+ buf3(i) = i
+ END DO
+
+ !
+ ! Initialize FORTRAN predefined datatypes.
+ !
+ CALL h5open_f(errcode)
+
+ !
+ ! Create a new file using default properties.
+ !
+ CALL h5fcreate_f(filename, H5F_ACC_TRUNC_F, file_id, errcode)
+
+ !-------------------------------------------------------------------------
+ ! H5T_NATIVE_INTEGER
+ !-------------------------------------------------------------------------
+
+ !
+ ! write dataset.
+ !
+ CALL h5ltmake_dataset_f(file_id, dsetname1, rank, dims, H5T_NATIVE_INTEGER, buf1, errcode)
+ !
+ ! read dataset.
+ !
+ CALL h5ltread_dataset_f(file_id, dsetname1, H5T_NATIVE_INTEGER, bufr1, dims, errcode)
+
+ !
+ ! compare read and write buffers.
+ !
+ DO i = 1, DIM1
+ CALL VERIFY("h5ltread_dataset_f",buf1(i), bufr1(i), errcode)
+ IF (errcode .NE.0 ) THEN
+ PRINT *, 'read buffer differs from write buffer (I)'
+ PRINT *, bufr1(i), ' and ', buf1(i)
+ STOP
+ ENDIF
+ END DO
+
+ !-------------------------------------------------------------------------
+ ! H5T_NATIVE_REAL
+ !-------------------------------------------------------------------------
+
+ !
+ ! write dataset.
+ !
+ CALL h5ltmake_dataset_f(file_id, dsetname2, rank, dims, H5T_NATIVE_REAL, buf2, errcode)
+
+ !
+ ! read dataset.
+ !
+ CALL h5ltread_dataset_f(file_id, dsetname2, H5T_NATIVE_REAL, bufr2, dims, errcode)
+
+ !
+ ! compare read and write buffers.
+ !
+ DO i = 1, DIM1
+ CALL VERIFY("h5ltread_dataset_f",buf2(i), bufr2(i), errcode)
+ IF (errcode .NE.0 ) THEN
+ PRINT *, 'read buffer differs from write buffer (R)'
+ PRINT *, bufr2(i), ' and ', buf2(i)
+ STOP
+ ENDIF
+ END DO
+
+ !-------------------------------------------------------------------------
+ ! H5T_NATIVE_DOUBLE
+ !-------------------------------------------------------------------------
+
+ !
+ ! write dataset.
+ !
+ f_ptr = C_LOC(buf3(1))
+ mytype = h5kind_to_type(KIND(buf3(1)), H5_REAL_KIND)
+ CALL h5ltmake_dataset_f(file_id, dsetname3, rank, dims, &
+ mytype, f_ptr, errcode)
+ !CALL h5ltmake_dataset_f(file_id, dsetname3, rank, dims, H5T_NATIVE_DOUBLE, buf3, errcode)
+ ! h5kind_to_type(KIND(buf3(1)), H5_REAL_KIND)
+ !
+ ! read dataset.
+ !
+ f_ptr = C_LOC(bufr3(1))
+ CALL h5ltread_dataset_f(file_id, dsetname3, &
+ h5kind_to_type(KIND(bufr3(1)), H5_REAL_KIND), f_ptr, errcode)
+ !CALL h5ltread_dataset_f(file_id, dsetname3, H5T_NATIVE_DOUBLE, bufr3, dims, errcode)
+
+ !
+ ! compare read and write buffers.
+ !
+ DO i = 1, DIM1
+ CALL VERIFY("h5ltread_dataset_f",buf3(i), bufr3(i), errcode)
+ IF (errcode .NE.0 ) THEN
+ PRINT *, 'read buffer differs from write buffer (D)'
+ PRINT *, bufr3(i), ' and ', buf3(i)
+ STOP
+ ENDIF
+ END DO
+
+ !
+ ! Close the file.
+ !
+ CALL h5fclose_f(file_id, errcode)
+
+ !
+ ! Close FORTRAN predefined datatypes.
+ !
+ CALL h5close_f(errcode)
+
+ CALL passed()
+ !
+ ! end function.
+ !
+ END SUBROUTINE test_dataset1D
!-------------------------------------------------------------------------
- ! H5T_NATIVE_INT 2D buffer
+ ! test_dataset2D
!-------------------------------------------------------------------------
- !
- ! write dataset.
- !
- CALL h5ltmake_dataset_f(file_id, dsetname2, rank, dims, H5T_NATIVE_INTEGER, buf2, errcode)
-
- !
- ! read dataset.
- !
- CALL h5ltread_dataset_f(file_id, dsetname2, H5T_NATIVE_INTEGER, buf2r, dims, errcode)
-
- !
- ! compare read and write buffers.
- !
- DO i = 1, dims(1)
- DO j = 1, dims(2)
- IF ( buf2(i,j) .NE. buf2r(i,j) ) THEN
- PRINT *, 'read buffer differs from write buffer'
- PRINT *, buf2r(i,j), ' and ', buf2(i,j)
- STOP
- ENDIF
- END DO
- END DO
-
- !-------------------------------------------------------------------------
- ! H5T_NATIVE_REAL
- !-------------------------------------------------------------------------
+ SUBROUTINE test_dataset2D()
+
+ IMPLICIT NONE
+
+ INTEGER(HSIZE_T), PARAMETER :: DIM1 = 4 ! columns
+ INTEGER(HSIZE_T), PARAMETER :: DIM2 = 6 ! rows
+ CHARACTER(len=9), PARAMETER :: filename = "dsetf2.h5"! File name
+ CHARACTER(LEN=5), PARAMETER :: dsetname1 = "dset1" ! Dataset name
+ CHARACTER(LEN=5), PARAMETER :: dsetname2 = "dset2" ! Dataset name
+ CHARACTER(LEN=5), PARAMETER :: dsetname3 = "dset3" ! Dataset name
+ CHARACTER(LEN=5), PARAMETER :: dsetname4 = "dset4" ! Dataset name
+ INTEGER(HID_T) :: file_id ! File identifier
+ INTEGER(HSIZE_T), DIMENSION(2) :: dims = (/4,6/) ! Dataset dimensions
+ INTEGER :: rank = 2 ! Dataset rank
+ INTEGER, DIMENSION(DIM1*DIM2) :: buf ! Data buffer
+ INTEGER, DIMENSION(DIM1*DIM2) :: bufr ! Data buffer
+ INTEGER, DIMENSION(DIM1,DIM2) :: buf2 ! Data buffer
+ INTEGER, DIMENSION(DIM1,DIM2) :: buf2r ! Data buffer
+ REAL, DIMENSION(DIM1,DIM2), TARGET :: buf3 ! Data buffer
+ REAL, DIMENSION(DIM1,DIM2), TARGET :: buf3r ! Data buffer
+ DOUBLE PRECISION, DIMENSION(DIM1,DIM2), TARGET :: buf4 ! Data buffer
+ DOUBLE PRECISION, DIMENSION(DIM1,DIM2), TARGET :: buf4r ! Data buffer
+ INTEGER :: errcode ! Error flag
+ INTEGER(HSIZE_T) :: i, j, n ! general purpose integers
+ TYPE(C_PTR) :: f_ptr
+
+ CALL test_begin(' Make/Read datasets (2D) ')
+
+
+ !
+ ! Initialize the data arrays.
+ !
+ n=1
+ DO i = 1, DIM1*DIM2
+ buf(i) = INT(n)
+ n = n + 1
+ END DO
+
+ DO i = 1, dims(1)
+ DO j = 1, dims(2)
+ buf2(i,j) = INT((i-1)*dims(2) + j)
+ buf3(i,j) = INT((i-1)*dims(2) + j)
+ buf4(i,j) = INT((i-1)*dims(2) + j)
+ END DO
+ END DO
+
+ !
+ ! Initialize FORTRAN predefined datatypes.
+ !
+ CALL h5open_f(errcode)
+
+ !
+ ! Create a new file using default properties.
+ !
+ CALL h5fcreate_f(filename, H5F_ACC_TRUNC_F, file_id, errcode)
+
+ !-------------------------------------------------------------------------
+ ! H5T_NATIVE_INT 1D buffer
+ !-------------------------------------------------------------------------
+
+ !
+ ! write dataset.
+ !
+ CALL h5ltmake_dataset_f(file_id, dsetname1, rank, dims, H5T_NATIVE_INTEGER, buf, errcode)
+
+ !
+ ! read dataset.
+ !
+ CALL h5ltread_dataset_f(file_id, dsetname1, H5T_NATIVE_INTEGER, bufr, dims, errcode)
+
+ !
+ ! compare read and write buffers.
+ !
+ DO i = 1, DIM1*DIM2
+ IF ( buf(i) .NE. bufr(i) ) THEN
+ PRINT *, 'read buffer differs from write buffer'
+ PRINT *, bufr(i), ' and ', buf(i)
+ STOP
+ ENDIF
+ END DO
+
+ !-------------------------------------------------------------------------
+ ! H5T_NATIVE_INT 2D buffer
+ !-------------------------------------------------------------------------
+
+ !
+ ! write dataset.
+ !
+ CALL h5ltmake_dataset_f(file_id, dsetname2, rank, dims, H5T_NATIVE_INTEGER, buf2, errcode)
+
+ !
+ ! read dataset.
+ !
+ CALL h5ltread_dataset_f(file_id, dsetname2, H5T_NATIVE_INTEGER, buf2r, dims, errcode)
+
+ !
+ ! compare read and write buffers.
+ !
+ DO i = 1, dims(1)
+ DO j = 1, dims(2)
+ IF ( buf2(i,j) .NE. buf2r(i,j) ) THEN
+ PRINT *, 'read buffer differs from write buffer'
+ PRINT *, buf2r(i,j), ' and ', buf2(i,j)
+ STOP
+ ENDIF
+ END DO
+ END DO
+
+ !-------------------------------------------------------------------------
+ ! H5T_NATIVE_REAL
+ !-------------------------------------------------------------------------
+
+ !
+ ! write dataset.
+ !
+ f_ptr = C_LOC(buf3(1,1))
+ CALL h5ltmake_dataset_f(file_id, dsetname3, rank, dims, H5T_NATIVE_REAL, f_ptr, errcode)
+ !CALL h5ltmake_dataset_f(file_id, dsetname3, rank, dims, H5T_NATIVE_REAL, buf3, errcode)
+
+ !
+ ! read dataset.
+ !
+ f_ptr = C_LOC(buf3r(1,1))
+ CALL h5ltread_dataset_f(file_id, dsetname3, H5T_NATIVE_REAL, f_ptr, errcode)
+ !CALL h5ltread_dataset_f(file_id, dsetname3, H5T_NATIVE_REAL, buf3r, dims, errcode)
+
+ !
+ ! compare read and write buffers.
+ !
+ DO i = 1, dims(1)
+ DO j = 1, dims(2)
+ CALL VERIFY("h5ltread_dataset_f",buf3(i,j), buf3r(i,j), errcode)
+ IF (errcode .NE.0 ) THEN
+ PRINT *, 'read buffer differs from write buffer'
+ PRINT *, buf3r(i,j), ' and ', buf3(i,j)
+ STOP
+ ENDIF
+ END DO
+ END DO
+
+ !-------------------------------------------------------------------------
+ ! H5T_NATIVE_DOUBLE
+ !-------------------------------------------------------------------------
+
+ !
+ ! write dataset.
+ !
+ f_ptr = C_LOC(buf4(1,1))
+ CALL h5ltmake_dataset_f(file_id, dsetname4, rank, dims, H5T_NATIVE_DOUBLE, f_ptr, errcode)
+ !CALL h5ltmake_dataset_f(file_id, dsetname4, rank, dims, H5T_NATIVE_DOUBLE, buf4, errcode)
+
+ !
+ ! read dataset.
+ f_ptr = C_LOC(buf4r(1,1))
+ CALL h5ltread_dataset_f(file_id, dsetname4, H5T_NATIVE_DOUBLE, f_ptr, errcode)
+
+ !CALL h5ltread_dataset_f(file_id, dsetname4, H5T_NATIVE_DOUBLE, buf4r, dims, errcode)
+
+ !
+ ! compare read and write buffers.
+ !
+ DO i = 1, dims(1)
+ DO j = 1, dims(2)
+ CALL VERIFY("h5ltread_dataset_f", buf4(i,j), buf4r(i,j), errcode)
+ IF (errcode .NE.0 ) THEN
+ PRINT *, 'read buffer differs from write buffer'
+ PRINT *, buf4r(i,j), ' and ', buf4(i,j)
+ STOP
+ ENDIF
+ END DO
+ END DO
+
+ !
+ ! Close the file.
+ !
+ CALL h5fclose_f(file_id, errcode)
+
+ !
+ ! Close FORTRAN predefined datatypes.
+ !
+ CALL h5close_f(errcode)
+
+ CALL passed()
+ !
+ ! end function.
+ !
+ END SUBROUTINE test_dataset2D
- !
- ! write dataset.
- !
- f_ptr = C_LOC(buf3(1,1))
- CALL h5ltmake_dataset_f(file_id, dsetname3, rank, dims, H5T_NATIVE_REAL, f_ptr, errcode)
- !CALL h5ltmake_dataset_f(file_id, dsetname3, rank, dims, H5T_NATIVE_REAL, buf3, errcode)
-
- !
- ! read dataset.
- !
- f_ptr = C_LOC(buf3r(1,1))
- CALL h5ltread_dataset_f(file_id, dsetname3, H5T_NATIVE_REAL, f_ptr, errcode)
- !CALL h5ltread_dataset_f(file_id, dsetname3, H5T_NATIVE_REAL, buf3r, dims, errcode)
-
- !
- ! compare read and write buffers.
- !
- DO i = 1, dims(1)
- DO j = 1, dims(2)
- IF ( buf3(i,j) .NE. buf3r(i,j) ) THEN
- PRINT *, 'read buffer differs from write buffer'
- PRINT *, buf3r(i,j), ' and ', buf3(i,j)
- STOP
- ENDIF
- END DO
- END DO
!-------------------------------------------------------------------------
- ! H5T_NATIVE_DOUBLE
+ ! test_dataset3D
!-------------------------------------------------------------------------
- !
- ! write dataset.
- !
- f_ptr = C_LOC(buf4(1,1))
- CALL h5ltmake_dataset_f(file_id, dsetname4, rank, dims, H5T_NATIVE_DOUBLE, f_ptr, errcode)
- !CALL h5ltmake_dataset_f(file_id, dsetname4, rank, dims, H5T_NATIVE_DOUBLE, buf4, errcode)
-
- !
- ! read dataset.
- f_ptr = C_LOC(buf4r(1,1))
- CALL h5ltread_dataset_f(file_id, dsetname4, H5T_NATIVE_DOUBLE, f_ptr, errcode)
-
- !CALL h5ltread_dataset_f(file_id, dsetname4, H5T_NATIVE_DOUBLE, buf4r, dims, errcode)
-
- !
- ! compare read and write buffers.
- !
- DO i = 1, dims(1)
- DO j = 1, dims(2)
- IF ( buf4(i,j) .NE. buf4r(i,j) ) THEN
- PRINT *, 'read buffer differs from write buffer'
- PRINT *, buf4r(i,j), ' and ', buf4(i,j)
- STOP
- ENDIF
- END DO
- END DO
-
- !
- ! Close the file.
- !
- CALL h5fclose_f(file_id, errcode)
-
- !
- ! Close FORTRAN predefined datatypes.
- !
- CALL h5close_f(errcode)
-
- CALL passed()
- !
- ! end function.
- !
-END SUBROUTINE test_dataset2D
-
-
-!-------------------------------------------------------------------------
-! test_dataset3D
-!-------------------------------------------------------------------------
-
-
-SUBROUTINE test_dataset3D()
- USE, INTRINSIC :: ISO_C_BINDING
- USE H5LT ! module of H5LT
- USE HDF5 ! module of HDF5 library
- USE TSTLITE ! module for testing lite support routines
- IMPLICIT NONE
-
- INTEGER, PARAMETER :: DIM1 = 6 ! columns
- INTEGER, PARAMETER :: DIM2 = 4 ! rows
- INTEGER, PARAMETER :: DIM3 = 2 ! layers
- CHARACTER(len=9), PARAMETER :: filename = "dsetf3.h5" ! File name
- CHARACTER(LEN=5), PARAMETER :: dsetname1 = "dset1" ! Dataset name
- CHARACTER(LEN=5), PARAMETER :: dsetname2 = "dset2" ! Dataset name
- CHARACTER(LEN=5), PARAMETER :: dsetname3 = "dset3" ! Dataset name
- CHARACTER(LEN=5), PARAMETER :: dsetname4 = "dset4" ! Dataset name
- INTEGER(HID_T) :: file_id ! File identifier
- INTEGER(HSIZE_T), DIMENSION(3) :: dims = (/DIM1,DIM2,DIM3/) ! Dataset dimensions
- INTEGER(HSIZE_T), DIMENSION(3) :: dimsr ! Dataset dimensions
- INTEGER, DIMENSION(DIM1*DIM2*DIM3) :: buf ! Data buffer
- INTEGER, DIMENSION(DIM1*DIM2*DIM3) :: bufr ! Data buffer
- INTEGER, DIMENSION(DIM1,DIM2,DIM3) :: buf2 ! Data buffer
- INTEGER, DIMENSION(DIM1,DIM2,DIM3) :: buf2r ! Data buffer
- REAL, DIMENSION(DIM1,DIM2,DIM3), TARGET :: buf3 ! Data buffer
- REAL, DIMENSION(DIM1,DIM2,DIM3), TARGET :: buf3r ! Data buffer
- DOUBLE PRECISION, DIMENSION(DIM1,DIM2,DIM3), TARGET :: buf4 ! Data buffer
- DOUBLE PRECISION, DIMENSION(DIM1,DIM2,DIM3), TARGET :: buf4r ! Data buffer
- INTEGER :: rank = 3 ! Dataset rank
- INTEGER :: errcode ! Error flag
- INTEGER(HSIZE_T) :: i, j, k, n ! general purpose integers
- INTEGER :: type_class
- INTEGER(SIZE_T) :: type_size
- TYPE(C_PTR) :: f_ptr
+ SUBROUTINE test_dataset3D()
+
+ IMPLICIT NONE
+
+ INTEGER, PARAMETER :: DIM1 = 6 ! columns
+ INTEGER, PARAMETER :: DIM2 = 4 ! rows
+ INTEGER, PARAMETER :: DIM3 = 2 ! layers
+ CHARACTER(len=9), PARAMETER :: filename = "dsetf3.h5" ! File name
+ CHARACTER(LEN=5), PARAMETER :: dsetname1 = "dset1" ! Dataset name
+ CHARACTER(LEN=5), PARAMETER :: dsetname2 = "dset2" ! Dataset name
+ CHARACTER(LEN=5), PARAMETER :: dsetname3 = "dset3" ! Dataset name
+ CHARACTER(LEN=5), PARAMETER :: dsetname4 = "dset4" ! Dataset name
+ INTEGER(HID_T) :: file_id ! File identifier
+ INTEGER(HSIZE_T), DIMENSION(3) :: dims = (/DIM1,DIM2,DIM3/) ! Dataset dimensions
+ INTEGER(HSIZE_T), DIMENSION(3) :: dimsr ! Dataset dimensions
+ INTEGER, DIMENSION(DIM1*DIM2*DIM3) :: buf ! Data buffer
+ INTEGER, DIMENSION(DIM1*DIM2*DIM3) :: bufr ! Data buffer
+ INTEGER, DIMENSION(DIM1,DIM2,DIM3) :: buf2 ! Data buffer
+ INTEGER, DIMENSION(DIM1,DIM2,DIM3) :: buf2r ! Data buffer
+ REAL, DIMENSION(DIM1,DIM2,DIM3), TARGET :: buf3 ! Data buffer
+ REAL, DIMENSION(DIM1,DIM2,DIM3), TARGET :: buf3r ! Data buffer
+ DOUBLE PRECISION, DIMENSION(DIM1,DIM2,DIM3), TARGET :: buf4 ! Data buffer
+ DOUBLE PRECISION, DIMENSION(DIM1,DIM2,DIM3), TARGET :: buf4r ! Data buffer
+ INTEGER :: rank = 3 ! Dataset rank
+ INTEGER :: errcode ! Error flag
+ INTEGER(HSIZE_T) :: i, j, k, n ! general purpose integers
+ INTEGER :: type_class
+ INTEGER(SIZE_T) :: type_size
+ TYPE(C_PTR) :: f_ptr
#if H5_HAVE_Fortran_INTEGER_SIZEOF_16!=0
- INTEGER, PARAMETER :: int_kind_32 = SELECTED_INT_KIND(36) !should map to INTEGER*16 on most modern processors
- INTEGER(int_kind_32), DIMENSION(DIM1,DIM2,DIM3), TARGET :: dset_data_i32, data_out_i32
- CHARACTER(LEN=7), PARAMETER :: dsetname16a = "dset16a" ! Dataset name
- CHARACTER(LEN=7), PARAMETER :: dsetname16b = "dset16b" ! Dataset name
- CHARACTER(LEN=7), PARAMETER :: dsetname16c = "dset16c" ! Dataset name
- INTEGER(HID_T) :: type_id
+ INTEGER, PARAMETER :: int_kind_32 = SELECTED_INT_KIND(36) !should map to INTEGER*16 on most modern processors
+ INTEGER(int_kind_32), DIMENSION(DIM1,DIM2,DIM3), TARGET :: dset_data_i32, data_out_i32
+ CHARACTER(LEN=7), PARAMETER :: dsetname16a = "dset16a" ! Dataset name
+ CHARACTER(LEN=7), PARAMETER :: dsetname16b = "dset16b" ! Dataset name
+ CHARACTER(LEN=7), PARAMETER :: dsetname16c = "dset16c" ! Dataset name
+ INTEGER(HID_T) :: type_id
#endif
- CALL test_begin(' Make/Read datasets (3D) ')
-
-
- !
- ! Initialize the data array.
- !
- n=1
- DO i = 1, DIM1*DIM2*DIM3
- buf(i) = INT(n)
- n = n + 1
- END DO
-
- n = 1
- DO i = 1, dims(1)
- DO j = 1, dims(2)
- DO k = 1, dims(3)
- buf2(i,j,k) = INT(n)
- buf3(i,j,k) = INT(n)
- buf4(i,j,k) = INT(n)
+ CALL test_begin(' Make/Read datasets (3D) ')
+
+
+ !
+ ! Initialize the data array.
+ !
+ n=1
+ DO i = 1, DIM1*DIM2*DIM3
+ buf(i) = INT(n)
+ n = n + 1
+ END DO
+
+ n = 1
+ DO i = 1, dims(1)
+ DO j = 1, dims(2)
+ DO k = 1, dims(3)
+ buf2(i,j,k) = INT(n)
+ buf3(i,j,k) = INT(n)
+ buf4(i,j,k) = INT(n)
#if H5_HAVE_Fortran_INTEGER_SIZEOF_16!=0
- dset_data_i32(i,j,k) = HUGE(1_int_kind_32)-INT(n,int_kind_32)
+ dset_data_i32(i,j,k) = HUGE(1_int_kind_32)-INT(n,int_kind_32)
#endif
- n = n + 1
- END DO
- END DO
- END DO
-
- !
- ! Initialize FORTRAN predefined datatypes.
- !
- CALL h5open_f(errcode)
-
- !
- ! Create a new file using default properties.
- !
- CALL h5fcreate_f(filename, H5F_ACC_TRUNC_F, file_id, errcode)
-
- !-------------------------------------------------------------------------
- ! H5T_NATIVE_INT 1D buffer
- !-------------------------------------------------------------------------
-
- !
- ! write dataset.
- !
- CALL h5ltmake_dataset_f(file_id, dsetname1, rank, dims, H5T_NATIVE_INTEGER, buf, errcode)
-
- !
- ! read dataset.
- !
- CALL h5ltread_dataset_f(file_id, dsetname1, H5T_NATIVE_INTEGER, bufr, dims, errcode)
-
- !
- ! compare read and write buffers.
- !
- DO i = 1, DIM1*DIM2*DIM3
- IF ( buf(i) .NE. bufr(i) ) THEN
- PRINT *, 'read buffer differs from write buffer'
- PRINT *, bufr(i), ' and ', buf(i)
- STOP
- ENDIF
- END DO
-
- !-------------------------------------------------------------------------
- ! H5T_NATIVE_INT 3D buffer
- !-------------------------------------------------------------------------
-
- !
- ! write dataset.
- !
- CALL h5ltmake_dataset_f(file_id, dsetname2, rank, dims, H5T_NATIVE_INTEGER, buf2, errcode)
-
- !
- ! read dataset.
- !
- CALL h5ltread_dataset_f(file_id, dsetname2, H5T_NATIVE_INTEGER, buf2r, dims, errcode)
-
- !
- ! compare read and write buffers.
- !
- DO i = 1, dims(1)
- DO j = 1, dims(2)
- DO k = 1, dims(3)
- IF ( buf2(i,j,k) .NE. buf2r(i,j,k) ) THEN
- PRINT *, 'read buffer differs from write buffer'
- PRINT *, buf2r(i,j,k), ' and ', buf2(i,j,k)
- STOP
- ENDIF
- END DO
- END DO
- END DO
-
- !-------------------------------------------------------------------------
- ! H5T_NATIVE_REAL
- !-------------------------------------------------------------------------
-
- !
- ! write dataset.
- !
- f_ptr = C_LOC(buf3(1,1,1))
- CALL h5ltmake_dataset_f(file_id, dsetname3, rank, dims, H5T_NATIVE_REAL, f_ptr, errcode)
- !CALL h5ltmake_dataset_f(file_id, dsetname3, rank, dims, H5T_NATIVE_REAL, buf3, errcode)
-
- !
- ! read dataset.
- !
- f_ptr = C_LOC(buf3r(1,1,1))
- CALL h5ltread_dataset_f(file_id, dsetname3, H5T_NATIVE_REAL, f_ptr, errcode)
- !CALL h5ltread_dataset_f(file_id, dsetname3, H5T_NATIVE_REAL, buf3r, dims, errcode)
-
- !
- ! compare read and write buffers.
- !
- DO i = 1, dims(1)
- DO j = 1, dims(2)
- DO k = 1, dims(3)
- IF ( buf3(i,j,k) .NE. buf3r(i,j,k) ) THEN
- PRINT *, 'read buffer differs from write buffer'
- PRINT *, buf3r(i,j,k), ' and ', buf3(i,j,k)
- STOP
- ENDIF
- END DO
- END DO
- END DO
-
- !-------------------------------------------------------------------------
- ! H5T_NATIVE_DOUBLE
- !-------------------------------------------------------------------------
-
- !
- ! write dataset.
- !
- f_ptr = C_LOC(buf4(1,1,1))
- CALL h5ltmake_dataset_f(file_id, dsetname4, rank, dims, H5T_NATIVE_DOUBLE, f_ptr, errcode)
-
- !
- ! read dataset.
- !
- f_ptr = C_LOC(buf4r(1,1,1))
- CALL h5ltread_dataset_f(file_id, dsetname4, H5T_NATIVE_DOUBLE, f_ptr, errcode)
-
- !
- ! compare read and write buffers.
- !
- DO i = 1, dims(1)
- DO j = 1, dims(2)
- DO k = 1, dims(3)
- IF ( buf4(i,j,k) .NE. buf4r(i,j,k) ) THEN
- PRINT *, 'read buffer differs from write buffer'
- PRINT *, buf4r(i,j,k), ' and ', buf4(i,j,k)
- STOP
- ENDIF
- END DO
- END DO
- END DO
-
- CALL h5ltget_dataset_info_f(file_id,dsetname4,dimsr,type_class,type_size,errcode )
-
- !
- ! compare dimensions
- !
- DO i = 1, rank
- IF ( dimsr(i) .NE. dims(i) ) THEN
- PRINT *, 'dimensions differ '
- STOP
- ENDIF
- END DO
-
- !-------------------------------------------------------------------------
- ! CHECKING NON-NATIVE INTEGER TYPES
- !-------------------------------------------------------------------------
+ n = n + 1
+ END DO
+ END DO
+ END DO
+
+ !
+ ! Initialize FORTRAN predefined datatypes.
+ !
+ CALL h5open_f(errcode)
+
+ !
+ ! Create a new file using default properties.
+ !
+ CALL h5fcreate_f(filename, H5F_ACC_TRUNC_F, file_id, errcode)
+
+ !-------------------------------------------------------------------------
+ ! H5T_NATIVE_INT 1D buffer
+ !-------------------------------------------------------------------------
+
+ !
+ ! write dataset.
+ !
+ CALL h5ltmake_dataset_f(file_id, dsetname1, rank, dims, H5T_NATIVE_INTEGER, buf, errcode)
+
+ !
+ ! read dataset.
+ !
+ CALL h5ltread_dataset_f(file_id, dsetname1, H5T_NATIVE_INTEGER, bufr, dims, errcode)
+
+ !
+ ! compare read and write buffers.
+ !
+ DO i = 1, DIM1*DIM2*DIM3
+ IF ( buf(i) .NE. bufr(i) ) THEN
+ PRINT *, 'read buffer differs from write buffer'
+ PRINT *, bufr(i), ' and ', buf(i)
+ STOP
+ ENDIF
+ END DO
+
+ !-------------------------------------------------------------------------
+ ! H5T_NATIVE_INT 3D buffer
+ !-------------------------------------------------------------------------
+
+ !
+ ! write dataset.
+ !
+ CALL h5ltmake_dataset_f(file_id, dsetname2, rank, dims, H5T_NATIVE_INTEGER, buf2, errcode)
+
+ !
+ ! read dataset.
+ !
+ CALL h5ltread_dataset_f(file_id, dsetname2, H5T_NATIVE_INTEGER, buf2r, dims, errcode)
+
+ !
+ ! compare read and write buffers.
+ !
+ DO i = 1, dims(1)
+ DO j = 1, dims(2)
+ DO k = 1, dims(3)
+ IF ( buf2(i,j,k) .NE. buf2r(i,j,k) ) THEN
+ PRINT *, 'read buffer differs from write buffer'
+ PRINT *, buf2r(i,j,k), ' and ', buf2(i,j,k)
+ STOP
+ ENDIF
+ END DO
+ END DO
+ END DO
+
+ !-------------------------------------------------------------------------
+ ! H5T_NATIVE_REAL
+ !-------------------------------------------------------------------------
+
+ !
+ ! write dataset.
+ !
+ f_ptr = C_LOC(buf3(1,1,1))
+ CALL h5ltmake_dataset_f(file_id, dsetname3, rank, dims, H5T_NATIVE_REAL, f_ptr, errcode)
+ !CALL h5ltmake_dataset_f(file_id, dsetname3, rank, dims, H5T_NATIVE_REAL, buf3, errcode)
+
+ !
+ ! read dataset.
+ !
+ f_ptr = C_LOC(buf3r(1,1,1))
+ CALL h5ltread_dataset_f(file_id, dsetname3, H5T_NATIVE_REAL, f_ptr, errcode)
+ !CALL h5ltread_dataset_f(file_id, dsetname3, H5T_NATIVE_REAL, buf3r, dims, errcode)
+
+ !
+ ! compare read and write buffers.
+ !
+ DO i = 1, dims(1)
+ DO j = 1, dims(2)
+ DO k = 1, dims(3)
+ CALL VERIFY("h5ltread_dataset_f",buf3(i,j,k), buf3r(i,j,k), errcode)
+ IF (errcode .NE.0 ) THEN
+ PRINT *, 'read buffer differs from write buffer'
+ PRINT *, buf3r(i,j,k), ' and ', buf3(i,j,k)
+ STOP
+ ENDIF
+ END DO
+ END DO
+ END DO
+
+ !-------------------------------------------------------------------------
+ ! H5T_NATIVE_DOUBLE
+ !-------------------------------------------------------------------------
+
+ !
+ ! write dataset.
+ !
+ f_ptr = C_LOC(buf4(1,1,1))
+ CALL h5ltmake_dataset_f(file_id, dsetname4, rank, dims, H5T_NATIVE_DOUBLE, f_ptr, errcode)
+
+ !
+ ! read dataset.
+ !
+ f_ptr = C_LOC(buf4r(1,1,1))
+ CALL h5ltread_dataset_f(file_id, dsetname4, H5T_NATIVE_DOUBLE, f_ptr, errcode)
+
+ !
+ ! compare read and write buffers.
+ !
+ DO i = 1, dims(1)
+ DO j = 1, dims(2)
+ DO k = 1, dims(3)
+ CALL VERIFY("h5ltread_dataset_f", buf4(i,j,k), buf4r(i,j,k), errcode)
+ IF (errcode .NE.0 ) THEN
+ PRINT *, 'read buffer differs from write buffer'
+ PRINT *, buf4r(i,j,k), ' and ', buf4(i,j,k)
+ STOP
+ ENDIF
+ END DO
+ END DO
+ END DO
+
+ CALL h5ltget_dataset_info_f(file_id,dsetname4,dimsr,type_class,type_size,errcode )
+
+ !
+ ! compare dimensions
+ !
+ DO i = 1, rank
+ IF ( dimsr(i) .NE. dims(i) ) THEN
+ PRINT *, 'dimensions differ '
+ STOP
+ ENDIF
+ END DO
+
+ !-------------------------------------------------------------------------
+ ! CHECKING NON-NATIVE INTEGER TYPES
+ !-------------------------------------------------------------------------
#if H5_HAVE_Fortran_INTEGER_SIZEOF_16!=0
- ! (A) CHECKING INTEGER*16
- !
- ! (i.a) write dataset using F2003 interface
- !
- type_id = H5kind_to_type(KIND(dset_data_i32(1,1,1)), H5_INTEGER_KIND)
- f_ptr = C_LOC(dset_data_i32(1,1,1))
- CALL h5ltmake_dataset_f(file_id, dsetname16a, rank, dims, type_id, f_ptr, errcode)
- !
- ! (i.b) read dataset using F2003 interface
- !
- f_ptr = C_LOC(data_out_i32(1,1,1))
- CALL h5ltread_dataset_f(file_id, dsetname16a, type_id, f_ptr, errcode)
-
- !
- ! compare read and write buffers.
- !
- DO i = 1, dims(1)
- DO j = 1, dims(2)
- DO k = 1, dims(3)
- IF ( dset_data_i32(i,j,k) .NE. data_out_i32(i,j,k) ) THEN
- PRINT *, 'read buffer differs from write buffer'
- PRINT *, dset_data_i32(i,j,k), ' and ', data_out_i32(i,j,k)
- STOP
- ENDIF
- END DO
- END DO
- ENDDO
-
- !
- ! (ii.a) write dataset using F90 interface
- !
- type_id = H5kind_to_type(KIND(dset_data_i32(1,1,1)), H5_INTEGER_KIND)
- CALL h5ltmake_dataset_f(file_id, dsetname16b, rank, dims, type_id, dset_data_i32, errcode)
- !
- ! (ii.b) read dataset using F90 interface
- !
- CALL h5ltread_dataset_f(file_id, dsetname16b, type_id, data_out_i32, dims, errcode)
-
- !
- ! compare read and write buffers.
- !
- DO i = 1, dims(1)
- DO j = 1, dims(2)
- DO k = 1, dims(3)
- IF ( dset_data_i32(i,j,k) .NE. data_out_i32(i,j,k) ) THEN
- PRINT *, 'read buffer differs from write buffer'
- PRINT *, dset_data_i32(i,j,k), ' and ', data_out_i32(i,j,k)
- STOP
- ENDIF
- END DO
- END DO
- ENDDO
-
- !
- ! (iii.a) write dataset using F90 H5LTmake_dataset_int_f interface
- !
- CALL h5ltmake_dataset_int_f(file_id, dsetname16c, rank, dims, dset_data_i32, errcode)
-
- !
- ! (iii.b) read dataset using F90 H5LTmake_dataset_int_f interface
- !
- CALL h5ltread_dataset_int_f(file_id, dsetname16c, data_out_i32, dims, errcode)
-
- !
- ! compare read and write buffers.
- !
- DO i = 1, dims(1)
- DO j = 1, dims(2)
- DO k = 1, dims(3)
- IF ( dset_data_i32(i,j,k) .NE. data_out_i32(i,j,k) ) THEN
- PRINT *, 'read buffer differs from write buffer'
- PRINT *, dset_data_i32(i,j,k), ' and ', data_out_i32(i,j,k)
- STOP
- ENDIF
- END DO
- END DO
- ENDDO
+ ! (A) CHECKING INTEGER*16
+ !
+ ! (i.a) write dataset using F2003 interface
+ !
+ type_id = H5kind_to_type(KIND(dset_data_i32(1,1,1)), H5_INTEGER_KIND)
+ f_ptr = C_LOC(dset_data_i32(1,1,1))
+ CALL h5ltmake_dataset_f(file_id, dsetname16a, rank, dims, type_id, f_ptr, errcode)
+ !
+ ! (i.b) read dataset using F2003 interface
+ !
+ f_ptr = C_LOC(data_out_i32(1,1,1))
+ CALL h5ltread_dataset_f(file_id, dsetname16a, type_id, f_ptr, errcode)
+
+ !
+ ! compare read and write buffers.
+ !
+ DO i = 1, dims(1)
+ DO j = 1, dims(2)
+ DO k = 1, dims(3)
+ IF ( dset_data_i32(i,j,k) .NE. data_out_i32(i,j,k) ) THEN
+ PRINT *, 'read buffer differs from write buffer'
+ PRINT *, dset_data_i32(i,j,k), ' and ', data_out_i32(i,j,k)
+ STOP
+ ENDIF
+ END DO
+ END DO
+ ENDDO
+
+ !
+ ! (ii.a) write dataset using F90 interface
+ !
+ type_id = H5kind_to_type(KIND(dset_data_i32(1,1,1)), H5_INTEGER_KIND)
+ CALL h5ltmake_dataset_f(file_id, dsetname16b, rank, dims, type_id, dset_data_i32, errcode)
+ !
+ ! (ii.b) read dataset using F90 interface
+ !
+ CALL h5ltread_dataset_f(file_id, dsetname16b, type_id, data_out_i32, dims, errcode)
+
+ !
+ ! compare read and write buffers.
+ !
+ DO i = 1, dims(1)
+ DO j = 1, dims(2)
+ DO k = 1, dims(3)
+ IF ( dset_data_i32(i,j,k) .NE. data_out_i32(i,j,k) ) THEN
+ PRINT *, 'read buffer differs from write buffer'
+ PRINT *, dset_data_i32(i,j,k), ' and ', data_out_i32(i,j,k)
+ STOP
+ ENDIF
+ END DO
+ END DO
+ ENDDO
+
+ !
+ ! (iii.a) write dataset using F90 H5LTmake_dataset_int_f interface
+ !
+ CALL h5ltmake_dataset_int_f(file_id, dsetname16c, rank, dims, dset_data_i32, errcode)
+
+ !
+ ! (iii.b) read dataset using F90 H5LTmake_dataset_int_f interface
+ !
+ CALL h5ltread_dataset_int_f(file_id, dsetname16c, data_out_i32, dims, errcode)
+
+ !
+ ! compare read and write buffers.
+ !
+ DO i = 1, dims(1)
+ DO j = 1, dims(2)
+ DO k = 1, dims(3)
+ IF ( dset_data_i32(i,j,k) .NE. data_out_i32(i,j,k) ) THEN
+ PRINT *, 'read buffer differs from write buffer'
+ PRINT *, dset_data_i32(i,j,k), ' and ', data_out_i32(i,j,k)
+ STOP
+ ENDIF
+ END DO
+ END DO
+ ENDDO
#endif
- !
- ! Close the file.
- !
- CALL h5fclose_f(file_id, errcode)
-
- !
- ! Close FORTRAN predefined datatypes.
- !
- CALL h5close_f(errcode)
-
- CALL passed()
- !
- ! end function.
- !
-END SUBROUTINE test_dataset3D
-
-!-------------------------------------------------------------------------
-! test_datasetND
-!-------------------------------------------------------------------------
-
-
-SUBROUTINE test_datasetND(rank)
-
- USE, INTRINSIC :: ISO_C_BINDING
- USE H5LT ! module of H5LT
- USE HDF5 ! module of HDF5 library
- USE TSTLITE ! module for testing lite support routines
-
- IMPLICIT NONE
-
- INTEGER :: rank ! Dataset rank
-
- INTEGER, PARAMETER :: DIM1 = 2 ! columns
- INTEGER, PARAMETER :: DIM2 = 4 ! rows
- INTEGER, PARAMETER :: DIM3 = 2 ! layers
- INTEGER, PARAMETER :: DIM4 = 5 ! columns
- INTEGER, PARAMETER :: DIM5 = 4 ! rows
- INTEGER, PARAMETER :: DIM6 = 3 ! layers
- INTEGER, PARAMETER :: DIM7 = 2 ! layers
- CHARACTER(len=9), PARAMETER :: filename = "dsetf3.h5" ! File name
- CHARACTER(LEN=5), PARAMETER :: dsetname2 = "dset2" ! Dataset name
- CHARACTER(LEN=5), PARAMETER :: dsetname3 = "dset3" ! Dataset name
- CHARACTER(LEN=5), PARAMETER :: dsetname4 = "dset4" ! Dataset name
- CHARACTER(LEN=5), PARAMETER :: dsetname5 = "dset5" ! Dataset name
- INTEGER(HID_T) :: file_id ! File identifier
- INTEGER(HSIZE_T), DIMENSION(7) :: dims
- INTEGER(HSIZE_T), DIMENSION(7) :: dimsr ! Dataset dimensions
- INTEGER, ALLOCATABLE, DIMENSION(:,:,:,:) :: ibuf_4 ! Data buffer
- INTEGER, ALLOCATABLE, DIMENSION(:,:,:,:) :: ibufr_4 ! Data buffer
- INTEGER, ALLOCATABLE, DIMENSION(:,:,:,:,:), TARGET :: ibuf_5 ! Data buffer
- INTEGER, ALLOCATABLE, DIMENSION(:,:,:,:,:), TARGET :: ibufr_5 ! Data buffer
- INTEGER, ALLOCATABLE, DIMENSION(:,:,:,:,:,:) :: ibuf_6 ! Data buffer
- INTEGER, ALLOCATABLE, DIMENSION(:,:,:,:,:,:) :: ibufr_6 ! Data buffer
- INTEGER, ALLOCATABLE, DIMENSION(:,:,:,:,:,:,:) :: ibuf_7 ! Data buffer
- INTEGER, ALLOCATABLE, DIMENSION(:,:,:,:,:,:,:) :: ibufr_7 ! Data buffer
- REAL, ALLOCATABLE, DIMENSION(:,:,:,:), TARGET :: rbuf_4 ! Data buffer
- REAL, ALLOCATABLE, DIMENSION(:,:,:,:), TARGET :: rbufr_4 ! Data buffer
- REAL, ALLOCATABLE, DIMENSION(:,:,:,:,:), TARGET :: rbuf_5 ! Data buffer
- REAL, ALLOCATABLE, DIMENSION(:,:,:,:,:), TARGET :: rbufr_5 ! Data buffer
- REAL, ALLOCATABLE, DIMENSION(:,:,:,:,:,:), TARGET :: rbuf_6 ! Data buffer
- REAL, ALLOCATABLE, DIMENSION(:,:,:,:,:,:), TARGET :: rbufr_6 ! Data buffer
- REAL, ALLOCATABLE, DIMENSION(:,:,:,:,:,:,:), TARGET :: rbuf_7 ! Data buffer
- REAL, ALLOCATABLE, DIMENSION(:,:,:,:,:,:,:), TARGET :: rbufr_7 ! Data buffer
- DOUBLE PRECISION, ALLOCATABLE, DIMENSION(:,:,:,:), TARGET :: dbuf_4 ! Data buffer
- DOUBLE PRECISION, ALLOCATABLE, DIMENSION(:,:,:,:), TARGET :: dbufr_4 ! Data buffer
- DOUBLE PRECISION, ALLOCATABLE, DIMENSION(:,:,:,:,:), TARGET :: dbuf_5 ! Data buffer
- DOUBLE PRECISION, ALLOCATABLE, DIMENSION(:,:,:,:,:), TARGET :: dbufr_5 ! Data buffer
- DOUBLE PRECISION, ALLOCATABLE, DIMENSION(:,:,:,:,:,:), TARGET :: dbuf_6 ! Data buffer
- DOUBLE PRECISION, ALLOCATABLE, DIMENSION(:,:,:,:,:,:), TARGET :: dbufr_6 ! Data buffer
- DOUBLE PRECISION, ALLOCATABLE, DIMENSION(:,:,:,:,:,:,:), TARGET :: dbuf_7 ! Data buffer
- DOUBLE PRECISION, ALLOCATABLE, DIMENSION(:,:,:,:,:,:,:), TARGET :: dbufr_7 ! Data buffer
- CHARACTER(LEN=5), ALLOCATABLE, DIMENSION(:,:,:,:), TARGET :: cbuf_4 ! Data buffer
- CHARACTER(LEN=5), ALLOCATABLE, DIMENSION(:,:,:,:), TARGET :: cbufr_4 ! Data buffer
- CHARACTER(LEN=5), ALLOCATABLE, DIMENSION(:,:,:,:,:), TARGET :: cbuf_5 ! Data buffer
- CHARACTER(LEN=5), ALLOCATABLE, DIMENSION(:,:,:,:,:), TARGET :: cbufr_5 ! Data buffer
- CHARACTER(LEN=5), ALLOCATABLE, DIMENSION(:,:,:,:,:,:), TARGET :: cbuf_6 ! Data buffer
- CHARACTER(LEN=5), ALLOCATABLE, DIMENSION(:,:,:,:,:,:), TARGET :: cbufr_6 ! Data buffer
- CHARACTER(LEN=5), ALLOCATABLE, DIMENSION(:,:,:,:,:,:,:), TARGET :: cbuf_7 ! Data buffer
- CHARACTER(LEN=5), ALLOCATABLE, DIMENSION(:,:,:,:,:,:,:), TARGET :: cbufr_7 ! Data buffer
- INTEGER :: errcode ! Error flag
- INTEGER(HSIZE_T) :: i, j, k, l, m, n, o, nn ! general purpose integers
- INTEGER :: type_class
- INTEGER(SIZE_T) :: type_size
- CHARACTER(LEN=1) :: ichr1
- TYPE(C_PTR) :: f_ptr
- INTEGER(HID_T) :: type_id
-
- WRITE(ichr1,'(I1.1)') rank
- CALL test_begin(' Make/Read datasets ('//ichr1//'D) ')
- !
- ! Initialize the data array.
- !
- IF(rank.EQ.4)THEN
-
- ALLOCATE(ibuf_4 (1:DIM1,1:DIM2,1:DIM3,1:DIM4))
- ALLOCATE(ibufr_4(1:DIM1,1:DIM2,1:DIM3,1:DIM4))
- ALLOCATE(rbuf_4 (1:DIM1,1:DIM2,1:DIM3,1:DIM4))
- ALLOCATE(rbufr_4(1:DIM1,1:DIM2,1:DIM3,1:DIM4))
- ALLOCATE(dbuf_4 (1:DIM1,1:DIM2,1:DIM3,1:DIM4))
- ALLOCATE(dbufr_4(1:DIM1,1:DIM2,1:DIM3,1:DIM4))
- ALLOCATE(cbuf_4 (1:DIM1,1:DIM2,1:DIM3,1:DIM4))
- ALLOCATE(cbufr_4(1:DIM1,1:DIM2,1:DIM3,1:DIM4))
-
- dims(1:7) = (/DIM1,DIM2,DIM3,DIM4,0,0,0/)
-
- nn = 1
- DO i = 1, DIM1
- DO j = 1, DIM2
- DO k = 1, DIM3
- DO l = 1, DIM4
- ibuf_4(i,j,k,l) = INT(nn)
- rbuf_4(i,j,k,l) = INT(nn)
- dbuf_4(i,j,k,l) = INT(nn)
- WRITE(cbuf_4(i,j,k,l),'(I5.5)') nn
- nn = nn + 1
- END DO
- END DO
- END DO
-
- ENDDO
-
- ELSE IF(rank.EQ.5)THEN
-
- ALLOCATE(ibuf_5 (1:DIM1,1:DIM2,1:DIM3,1:DIM4,1:DIM5))
- ALLOCATE(ibufr_5(1:DIM1,1:DIM2,1:DIM3,1:DIM4,1:DIM5))
- ALLOCATE(rbuf_5 (1:DIM1,1:DIM2,1:DIM3,1:DIM4,1:DIM5))
- ALLOCATE(rbufr_5(1:DIM1,1:DIM2,1:DIM3,1:DIM4,1:DIM5))
- ALLOCATE(dbuf_5 (1:DIM1,1:DIM2,1:DIM3,1:DIM4,1:DIM5))
- ALLOCATE(dbufr_5(1:DIM1,1:DIM2,1:DIM3,1:DIM4,1:DIM5))
- ALLOCATE(cbuf_5 (1:DIM1,1:DIM2,1:DIM3,1:DIM4,1:DIM5))
- ALLOCATE(cbufr_5(1:DIM1,1:DIM2,1:DIM3,1:DIM4,1:DIM5))
-
- dims(1:7) = (/DIM1,DIM2,DIM3,DIM4,DIM5,0,0/)
-
- nn = 1
- DO i = 1, DIM1
- DO j = 1, DIM2
- DO k = 1, DIM3
- DO l = 1, DIM4
- DO m = 1, DIM5
- ibuf_5(i,j,k,l,m) = INT(nn)
- rbuf_5(i,j,k,l,m) = INT(nn)
- dbuf_5(i,j,k,l,m) = INT(nn)
- WRITE(cbuf_5(i,j,k,l,m),'(I5.5)') nn
- nn = nn + 1
- END DO
- END DO
- END DO
- ENDDO
- ENDDO
-
- ELSE IF(rank.EQ.6)THEN
-
- ALLOCATE(ibuf_6 (1:DIM1,1:DIM2,1:DIM3,1:DIM4,1:DIM5,1:DIM6))
- ALLOCATE(ibufr_6(1:DIM1,1:DIM2,1:DIM3,1:DIM4,1:DIM5,1:DIM6))
- ALLOCATE(rbuf_6 (1:DIM1,1:DIM2,1:DIM3,1:DIM4,1:DIM5,1:DIM6))
- ALLOCATE(rbufr_6(1:DIM1,1:DIM2,1:DIM3,1:DIM4,1:DIM5,1:DIM6))
- ALLOCATE(dbuf_6 (1:DIM1,1:DIM2,1:DIM3,1:DIM4,1:DIM5,1:DIM6))
- ALLOCATE(dbufr_6(1:DIM1,1:DIM2,1:DIM3,1:DIM4,1:DIM5,1:DIM6))
- ALLOCATE(cbuf_6 (1:DIM1,1:DIM2,1:DIM3,1:DIM4,1:DIM5,1:DIM6))
- ALLOCATE(cbufr_6(1:DIM1,1:DIM2,1:DIM3,1:DIM4,1:DIM5,1:DIM6))
-
- dims(1:7) = (/DIM1,DIM2,DIM3,DIM4,DIM5,DIM6,0/)
-
- nn = 1
- DO i = 1, DIM1
- DO j = 1, DIM2
- DO k = 1, DIM3
- DO l = 1, DIM4
- DO m = 1, DIM5
- DO n = 1, DIM6
- ibuf_6(i,j,k,l,m,n) = INT(nn)
- rbuf_6(i,j,k,l,m,n) = INT(nn)
- dbuf_6(i,j,k,l,m,n) = INT(nn)
- WRITE(cbuf_6(i,j,k,l,m,n),'(I5.5)') nn
- nn = nn + 1
- END DO
- END DO
- END DO
- ENDDO
- ENDDO
- ENDDO
-
- ELSE IF(rank.EQ.7)THEN
-
- ALLOCATE(ibuf_7 (1:DIM1,1:DIM2,1:DIM3,1:DIM4,1:DIM5,1:DIM6,1:DIM7))
- ALLOCATE(ibufr_7(1:DIM1,1:DIM2,1:DIM3,1:DIM4,1:DIM5,1:DIM6,1:DIM7))
- ALLOCATE(rbuf_7 (1:DIM1,1:DIM2,1:DIM3,1:DIM4,1:DIM5,1:DIM6,1:DIM7))
- ALLOCATE(rbufr_7(1:DIM1,1:DIM2,1:DIM3,1:DIM4,1:DIM5,1:DIM6,1:DIM7))
- ALLOCATE(dbuf_7 (1:DIM1,1:DIM2,1:DIM3,1:DIM4,1:DIM5,1:DIM6,1:DIM7))
- ALLOCATE(dbufr_7(1:DIM1,1:DIM2,1:DIM3,1:DIM4,1:DIM5,1:DIM6,1:DIM7))
- ALLOCATE(cbuf_7 (1:DIM1,1:DIM2,1:DIM3,1:DIM4,1:DIM5,1:DIM6,1:DIM7))
- ALLOCATE(cbufr_7(1:DIM1,1:DIM2,1:DIM3,1:DIM4,1:DIM5,1:DIM6,1:DIM7))
-
- dims(1:7) = (/DIM1,DIM2,DIM3,DIM4,DIM5,DIM6,DIM7/)
-
- nn = 1
- DO i = 1, DIM1
- DO j = 1, DIM2
- DO k = 1, DIM3
- DO l = 1, DIM4
- DO m = 1, DIM5
- DO n = 1, DIM6
- DO o = 1, DIM7
- ibuf_7(i,j,k,l,m,n,o) = INT(nn)
- rbuf_7(i,j,k,l,m,n,o) = INT(nn)
- dbuf_7(i,j,k,l,m,n,o) = INT(nn)
- WRITE(cbuf_7(i,j,k,l,m,n,o),'(I5.5)') nn
- nn = nn + 1
- END DO
- END DO
- END DO
- ENDDO
- ENDDO
- ENDDO
- ENDDO
-
- ENDIF
-
- !
- ! Initialize FORTRAN predefined datatypes.
- !
- CALL h5open_f(errcode)
-
- !
- ! Create a new file using default properties.
- !
- CALL h5fcreate_f(filename, H5F_ACC_TRUNC_F, file_id, errcode)
-
- !-------------------------------------------------------------------------
- ! H5T_NATIVE_INT ND buffer
- !-------------------------------------------------------------------------
-
- !
- ! write dataset.
- !
- IF(rank.EQ.4)THEN
- CALL h5ltmake_dataset_f(file_id, dsetname2, rank, dims(1:rank), H5T_NATIVE_INTEGER, ibuf_4, errcode)
- ELSE IF(rank.EQ.5)THEN
- f_ptr = C_LOC(ibuf_5(1,1,1,1,1))
- CALL h5ltmake_dataset_f(file_id, dsetname2, rank, dims(1:rank), H5T_NATIVE_INTEGER, f_ptr, errcode)
- ELSE IF(rank.EQ.6)THEN
- CALL h5ltmake_dataset_f(file_id, dsetname2, rank, dims(1:rank), H5T_NATIVE_INTEGER, ibuf_6, errcode)
- ELSE IF(rank.EQ.7)THEN
- CALL h5ltmake_dataset_f(file_id, dsetname2, rank, dims(1:rank), H5T_NATIVE_INTEGER, ibuf_7, errcode)
- ENDIF
-
-
- !
- ! read dataset.
- !
- IF(rank.EQ.4)THEN
- CALL h5ltread_dataset_f(file_id, dsetname2, H5T_NATIVE_INTEGER, ibufr_4, dims(1:rank), errcode)
- ELSE IF(rank.EQ.5)THEN
- f_ptr = C_LOC(ibufr_5(1,1,1,1,1))
- CALL h5ltread_dataset_f(file_id, dsetname2, H5T_NATIVE_INTEGER, f_ptr, errcode)
- ELSE IF(rank.EQ.6)THEN
- CALL h5ltread_dataset_f(file_id, dsetname2, H5T_NATIVE_INTEGER, ibufr_6, dims(1:rank), errcode)
- ELSE IF(rank.EQ.7)THEN
- CALL h5ltread_dataset_f(file_id, dsetname2, H5T_NATIVE_INTEGER, ibufr_7, dims(1:rank), errcode)
- ENDIF
-
- !
- ! compare read and write buffers.
- !
- DO i = 1, dims(1)
- DO j = 1, dims(2)
- DO k = 1, dims(3)
- DO l = 1, dims(4)
- IF(rank.EQ.4)THEN
- IF ( ibuf_4(i,j,k,l) .NE. ibufr_4(i,j,k,l) ) THEN
- PRINT *, 'read buffer differs from write buffer'
- PRINT *, ibuf_4(i,j,k,l), ' and ', ibufr_4(i,j,k,l)
- STOP
- ENDIF
- ENDIF
- DO m = 1, dims(5)
- IF(rank.EQ.5)THEN
- IF ( ibuf_5(i,j,k,l,m) .NE. ibufr_5(i,j,k,l,m) ) THEN
- PRINT *, 'read buffer differs from write buffer'
- PRINT *, ibuf_5(i,j,k,l,m), ' and ', ibufr_5(i,j,k,l,m)
- STOP
- ENDIF
- ENDIF
- DO n = 1, dims(6)
- IF(rank.EQ.6)THEN
- IF ( ibuf_6(i,j,k,l,m,n) .NE. ibufr_6(i,j,k,l,m,n) ) THEN
- PRINT *, 'read buffer differs from write buffer'
- PRINT *, ibuf_6(i,j,k,l,m,n), ' and ', ibufr_6(i,j,k,l,m,n)
- STOP
- ENDIF
- ENDIF
- DO o = 1, dims(7)
- IF(rank.EQ.7)THEN
- IF ( ibuf_7(i,j,k,l,m,n,o) .NE. ibufr_7(i,j,k,l,m,n,o) ) THEN
- PRINT *, 'read buffer differs from write buffer'
- PRINT *, ibuf_7(i,j,k,l,m,n,o), ' and ', ibufr_7(i,j,k,l,m,n,o)
- STOP
- ENDIF
- ENDIF
- ENDDO
- ENDDO
- ENDDO
- ENDDO
- ENDDO
- ENDDO
- ENDDO
- !-------------------------------------------------------------------------
- ! H5T_NATIVE_REAL
- !-------------------------------------------------------------------------
-
- !
- ! write dataset.
- !
- IF(rank.EQ.4)THEN
- f_ptr = C_LOC(rbuf_4(1,1,1,1))
- CALL h5ltmake_dataset_f(file_id, dsetname3, rank, dims(1:rank), H5T_NATIVE_REAL, f_ptr, errcode)
- ! CALL h5ltmake_dataset_f(file_id, dsetname3, rank, dims(1:rank), H5T_NATIVE_REAL, rbuf_4, errcode)
- ELSE IF(rank.EQ.5)THEN
- f_ptr = C_LOC(rbuf_5(1,1,1,1,1))
- CALL h5ltmake_dataset_f(file_id, dsetname3, rank, dims(1:rank), H5T_NATIVE_REAL, f_ptr, errcode)
- ELSE IF(rank.EQ.6)THEN
- f_ptr = C_LOC(rbuf_6(1,1,1,1,1,1))
- CALL h5ltmake_dataset_f(file_id, dsetname3, rank, dims(1:rank), H5T_NATIVE_REAL, f_ptr, errcode)
- !CALL h5ltmake_dataset_f(file_id, dsetname3, rank, dims(1:rank), H5T_NATIVE_REAL, rbuf_6, errcode)
- ELSE IF(rank.EQ.7)THEN
- f_ptr = C_LOC(rbuf_7(1,1,1,1,1,1,1))
- CALL h5ltmake_dataset_f(file_id, dsetname3, rank, dims(1:rank), H5T_NATIVE_REAL, f_ptr, errcode)
- !CALL h5ltmake_dataset_f(file_id, dsetname3, rank, dims(1:rank), H5T_NATIVE_REAL, rbuf_7, errcode)
- ENDIF
-
-
- !
- ! read dataset.
- !
- IF(rank.EQ.4)THEN
- f_ptr = C_LOC(rbufr_4(1,1,1,1))
- CALL h5ltread_dataset_f(file_id, dsetname3, H5T_NATIVE_REAL, f_ptr, errcode)
- ELSE IF(rank.EQ.5)THEN
- f_ptr = C_LOC(rbufr_5(1,1,1,1,1))
- CALL h5ltread_dataset_f(file_id, dsetname3, H5T_NATIVE_REAL, f_ptr, errcode)
- ELSE IF(rank.EQ.6)THEN
- f_ptr = C_LOC(rbufr_6(1,1,1,1,1,1))
- CALL h5ltread_dataset_f(file_id, dsetname3, H5T_NATIVE_REAL, f_ptr, errcode)
- ELSE IF(rank.EQ.7)THEN
- f_ptr = C_LOC(rbufr_7(1,1,1,1,1,1,1))
- CALL h5ltread_dataset_f(file_id, dsetname3, H5T_NATIVE_REAL, f_ptr, errcode)
- ENDIF
-
- !
- ! compare read and write buffers.
- !
- DO i = 1, dims(1)
- DO j = 1, dims(2)
- DO k = 1, dims(3)
- DO l = 1, dims(4)
- IF(rank.EQ.4)THEN
- IF ( rbuf_4(i,j,k,l) .NE. rbufr_4(i,j,k,l) ) THEN
- PRINT *, 'read buffer differs from write buffer'
- PRINT *, rbuf_4(i,j,k,l), ' and ', rbufr_4(i,j,k,l)
- STOP
- ENDIF
- ENDIF
- DO m = 1, dims(5)
- IF(rank.EQ.5)THEN
- IF ( rbuf_5(i,j,k,l,m) .NE. rbufr_5(i,j,k,l,m) ) THEN
- PRINT *, 'read buffer differs from write buffer'
- PRINT *, rbuf_5(i,j,k,l,m), ' and ', rbufr_5(i,j,k,l,m)
- STOP
- ENDIF
- ENDIF
- DO n = 1, dims(6)
- IF(rank.EQ.6)THEN
- IF ( rbuf_6(i,j,k,l,m,n) .NE. rbufr_6(i,j,k,l,m,n) ) THEN
- PRINT *, 'read buffer differs from write buffer'
- PRINT *, rbuf_6(i,j,k,l,m,n), ' and ', rbufr_6(i,j,k,l,m,n)
- STOP
- ENDIF
- ENDIF
- DO o = 1, dims(7)
- IF(rank.EQ.7)THEN
- IF ( rbuf_7(i,j,k,l,m,n,o) .NE. rbufr_7(i,j,k,l,m,n,o) ) THEN
- PRINT *, 'read buffer differs from write buffer'
- PRINT *, rbuf_7(i,j,k,l,m,n,o), ' and ', rbufr_7(i,j,k,l,m,n,o)
- STOP
- ENDIF
- ENDIF
- ENDDO
- ENDDO
- ENDDO
- ENDDO
- ENDDO
- ENDDO
- ENDDO
-
- !-------------------------------------------------------------------------
- ! H5T_NATIVE_DOUBLE
- !-------------------------------------------------------------------------
-
- !
- ! write dataset.
- !
- IF(rank.EQ.4)THEN
- f_ptr = C_LOC(dbuf_4(1,1,1,1))
- CALL h5ltmake_dataset_f(file_id, dsetname4, rank, dims(1:rank), H5T_NATIVE_DOUBLE, f_ptr, errcode)
- ELSE IF(rank.EQ.5)THEN
- f_ptr = C_LOC(dbuf_5(1,1,1,1,1))
- CALL h5ltmake_dataset_f(file_id, dsetname4, rank, dims(1:rank), H5T_NATIVE_DOUBLE, f_ptr, errcode)
- ELSE IF(rank.EQ.6)THEN
- f_ptr = C_LOC(dbuf_6(1,1,1,1,1,1))
- CALL h5ltmake_dataset_f(file_id, dsetname4, rank, dims(1:rank), H5T_NATIVE_DOUBLE, f_ptr, errcode)
- ELSE IF(rank.EQ.7)THEN
- f_ptr = C_LOC(dbuf_7(1,1,1,1,1,1,1))
- CALL h5ltmake_dataset_f(file_id, dsetname4, rank, dims(1:rank), H5T_NATIVE_DOUBLE, f_ptr, errcode)
- ENDIF
-
- !
- ! read dataset.
- !
- IF(rank.EQ.4)THEN
- f_ptr = C_LOC(dbufr_4(1,1,1,1))
- CALL h5ltread_dataset_f(file_id, dsetname4, H5T_NATIVE_DOUBLE, f_ptr, errcode)
- ELSE IF(rank.EQ.5)THEN
- f_ptr = C_LOC(dbufr_5(1,1,1,1,1))
- CALL h5ltread_dataset_f(file_id, dsetname4, H5T_NATIVE_DOUBLE, f_ptr, errcode)
- ELSE IF(rank.EQ.6)THEN
- f_ptr = C_LOC(dbufr_6(1,1,1,1,1,1))
- CALL h5ltread_dataset_f(file_id, dsetname4, H5T_NATIVE_DOUBLE, f_ptr, errcode)
- ELSE IF(rank.EQ.7)THEN
- f_ptr = C_LOC(dbufr_7(1,1,1,1,1,1,1))
- CALL h5ltread_dataset_f(file_id, dsetname4, H5T_NATIVE_DOUBLE, f_ptr, errcode)
- ENDIF
-
- !
- ! compare read and write buffers.
- !
- DO i = 1, dims(1)
- DO j = 1, dims(2)
- DO k = 1, dims(3)
- DO l = 1, dims(4)
- IF(rank.EQ.4)THEN
- IF ( dbuf_4(i,j,k,l) .NE. dbufr_4(i,j,k,l) ) THEN
- PRINT *, 'read buffer differs from write buffer'
- PRINT *, dbuf_4(i,j,k,l), ' and ', dbufr_4(i,j,k,l)
- STOP
- ENDIF
- ENDIF
- DO m = 1, dims(5)
- IF(rank.EQ.5)THEN
- IF ( dbuf_5(i,j,k,l,m) .NE. dbufr_5(i,j,k,l,m) ) THEN
- PRINT *, 'read buffer differs from write buffer'
- PRINT *, dbuf_5(i,j,k,l,m), ' and ', dbufr_5(i,j,k,l,m)
- STOP
- ENDIF
- ENDIF
- DO n = 1, dims(6)
- IF(rank.EQ.6)THEN
- IF ( dbuf_6(i,j,k,l,m,n) .NE. dbufr_6(i,j,k,l,m,n) ) THEN
- PRINT *, 'read buffer differs from write buffer'
- PRINT *, dbuf_6(i,j,k,l,m,n), ' and ', dbufr_6(i,j,k,l,m,n)
- STOP
- ENDIF
- ENDIF
- DO o = 1, dims(7)
- IF(rank.EQ.7)THEN
- IF ( dbuf_7(i,j,k,l,m,n,o) .NE. dbufr_7(i,j,k,l,m,n,o) ) THEN
- PRINT *, 'read buffer differs from write buffer'
- PRINT *, dbuf_7(i,j,k,l,m,n,o), ' and ', dbufr_7(i,j,k,l,m,n,o)
- STOP
- ENDIF
- ENDIF
- ENDDO
- ENDDO
- ENDDO
- ENDDO
- ENDDO
- ENDDO
- ENDDO
-
- !-------------------------------------------------------------------------
- ! H5T_NATIVE_CHARACTER ND buffer
- !-------------------------------------------------------------------------
-
- CALL H5Tcopy_f(H5T_FORTRAN_S1, type_id, errcode)
- CALL H5Tset_size_f(type_id, 5_SIZE_T, errcode)
- !
- ! write dataset.
- !
- IF(rank.EQ.4)THEN
- f_ptr = C_LOC(cbuf_4(1,1,1,1)(1:1))
- CALL h5ltmake_dataset_f(file_id, dsetname5, rank, dims(1:rank), type_id, f_ptr, errcode)
- ELSE IF(rank.EQ.5)THEN
- f_ptr = C_LOC(cbuf_5(1,1,1,1,1)(1:1))
- CALL h5ltmake_dataset_f(file_id, dsetname5, rank, dims(1:rank), type_id, f_ptr, errcode)
- ELSE IF(rank.EQ.6)THEN
- f_ptr = C_LOC(cbuf_6(1,1,1,1,1,1)(1:1))
- CALL h5ltmake_dataset_f(file_id, dsetname5, rank, dims(1:rank), type_id, f_ptr, errcode)
- ELSE IF(rank.EQ.7)THEN
- f_ptr = C_LOC(cbuf_7(1,1,1,1,1,1,1)(1:1))
- CALL h5ltmake_dataset_f(file_id, dsetname5, rank, dims(1:rank), type_id, f_ptr, errcode)
- ENDIF
-
- !
- ! read dataset.
- !
- IF(rank.EQ.4)THEN
- f_ptr = C_LOC(cbufr_4(1,1,1,1)(1:1))
- CALL h5ltread_dataset_f(file_id, dsetname5, type_id, f_ptr, errcode)
- ELSE IF(rank.EQ.5)THEN
- f_ptr = C_LOC(cbufr_5(1,1,1,1,1)(1:1))
- CALL h5ltread_dataset_f(file_id, dsetname5, type_id, f_ptr, errcode)
- ELSE IF(rank.EQ.6)THEN
- f_ptr = C_LOC(cbufr_6(1,1,1,1,1,1)(1:1))
- CALL h5ltread_dataset_f(file_id, dsetname5, type_id, f_ptr, errcode)
- ELSE IF(rank.EQ.7)THEN
- f_ptr = C_LOC(cbufr_7(1,1,1,1,1,1,1)(1:1))
- CALL h5ltread_dataset_f(file_id, dsetname5, type_id, f_ptr, errcode)
- ENDIF
-
-
- !
- ! compare read and write buffers.
- !
- DO i = 1, dims(1)
- DO j = 1, dims(2)
- DO k = 1, dims(3)
- DO l = 1, dims(4)
- IF(rank.EQ.4)THEN
- IF ( cbuf_4(i,j,k,l) .NE. cbufr_4(i,j,k,l) ) THEN
- PRINT *, 'read buffer differs from write buffer (character)'
- PRINT *, cbuf_4(i,j,k,l), ' and ', cbufr_4(i,j,k,l)
- STOP
- ENDIF
- ENDIF
- DO m = 1, dims(5)
- IF(rank.EQ.5)THEN
- IF ( cbuf_5(i,j,k,l,m) .NE. cbufr_5(i,j,k,l,m) ) THEN
- PRINT *, 'read buffer differs from write buffer (character)'
- PRINT *, cbuf_5(i,j,k,l,m), ' and ', cbufr_5(i,j,k,l,m)
- STOP
- ENDIF
- ENDIF
- DO n = 1, dims(6)
- IF(rank.EQ.6)THEN
- IF ( cbuf_6(i,j,k,l,m,n) .NE. cbufr_6(i,j,k,l,m,n) ) THEN
- PRINT *, 'read buffer differs from write buffer (character)'
- PRINT *, cbuf_6(i,j,k,l,m,n), ' and ', cbufr_6(i,j,k,l,m,n)
- STOP
- ENDIF
- ENDIF
- DO o = 1, dims(7)
- IF(rank.EQ.7)THEN
- IF ( cbuf_7(i,j,k,l,m,n,o) .NE. cbufr_7(i,j,k,l,m,n,o) ) THEN
- PRINT *, 'read buffer differs from write buffer (character)'
- PRINT *, cbuf_7(i,j,k,l,m,n,o), ' and ', cbufr_7(i,j,k,l,m,n,o)
- STOP
- ENDIF
- ENDIF
- ENDDO
- ENDDO
- ENDDO
- ENDDO
- ENDDO
- ENDDO
- ENDDO
-
- CALL h5ltget_dataset_info_f(file_id,dsetname4,dimsr,type_class,type_size,errcode )
-
- CALL h5tclose_f(type_id,errcode)
-
- !
- ! compare dimensions
- !
- DO i = 1, rank
- IF ( dimsr(i) .NE. dims(i) ) THEN
- PRINT *, 'dimensions differ '
- STOP
- ENDIF
- END DO
-
- !
- ! Close the file.
- !
- CALL h5fclose_f(file_id, errcode)
-
- !
- ! Close FORTRAN predefined datatypes.
- !
- CALL h5close_f(errcode)
-
- ! DEALLOCATE RESOURCES
-
- IF(rank.EQ.4)THEN
- DEALLOCATE(ibuf_4, ibufr_4, rbuf_4, rbufr_4, dbuf_4, dbufr_4, cbuf_4, cbufr_4)
- ELSE IF(rank.EQ.5)THEN
- DEALLOCATE(ibuf_5, ibufr_5, rbuf_5, rbufr_5, dbuf_5, dbufr_5, cbuf_5, cbufr_5)
- ELSE IF(rank.EQ.6)THEN
- DEALLOCATE(ibuf_6, ibufr_6, rbuf_6, rbufr_6, dbuf_6, dbufr_6, cbuf_6, cbufr_6)
- ELSE IF(rank.EQ.7)THEN
- DEALLOCATE(ibuf_7, ibufr_7, rbuf_7, rbufr_7, dbuf_7, dbufr_7, cbuf_7, cbufr_7)
- ENDIF
-
- CALL passed()
- !
- ! end function.
- !
-END SUBROUTINE test_datasetND
-
-
-!-------------------------------------------------------------------------
-! test_datasets
-!-------------------------------------------------------------------------
-
-SUBROUTINE test_datasets()
-
- USE, INTRINSIC :: ISO_C_BINDING
- USE H5LT ! module of H5LT
- USE HDF5 ! module of HDF5 library
- USE TSTLITE ! module for testing lite support routines
-
- IMPLICIT NONE
-
- CHARACTER(len=9), PARAMETER :: filename = "dsetf4.h5"! File name
- INTEGER(HID_T) :: file_id ! File identifier
- INTEGER :: errcode ! Error flag
- INTEGER, PARAMETER :: DIM1 = 10 ! Dimension of array
- INTEGER, PARAMETER :: LEN0 = 3
- INTEGER, PARAMETER :: LEN1 = 12
- CHARACTER(LEN=5), PARAMETER :: dsetname2 = "dset2" ! Dataset name
- CHARACTER(LEN=5), PARAMETER :: dsetname3 = "dset3" ! Dataset name
- CHARACTER(LEN=5), PARAMETER :: dsetname4 = "dset4" ! Dataset name
- CHARACTER(LEN=5), PARAMETER :: dsetname5 = "dset5" ! Dataset name
- CHARACTER(LEN=5), PARAMETER :: dsetname6 = "dset6" ! Dataset name
- INTEGER(HSIZE_T), DIMENSION(1) :: dims = (/DIM1/) ! Dataset dimensions
- INTEGER(HSIZE_T), DIMENSION(1) :: dimsr ! Dataset dimensions
- INTEGER :: rank = 1 ! Dataset rank
- INTEGER :: rankr ! Dataset rank
- CHARACTER(LEN=8), PARAMETER :: buf1 = "mystring" ! Data buffer
- CHARACTER(LEN=8) :: buf1r ! Data buffer
- INTEGER, DIMENSION(DIM1) :: buf2 ! Data buffer
- INTEGER, DIMENSION(DIM1) :: bufr2 ! Data buffer
- REAL, DIMENSION(DIM1), TARGET :: buf3 ! Data buffer
- REAL, DIMENSION(DIM1) , TARGET :: bufr3 ! Data buffer
- DOUBLE PRECISION, DIMENSION(DIM1), TARGET :: buf4 ! Data buffer
- DOUBLE PRECISION, DIMENSION(DIM1), TARGET :: bufr4 ! Data buffer
- INTEGER :: i, j, n ! general purpose integer
- INTEGER :: has ! general purpose integer
- INTEGER :: type_class
- INTEGER(SIZE_T) :: type_size
- LOGICAL :: path_valid ! status of the path
- CHARACTER(LEN=6) :: chr_exact
- CHARACTER(LEN=8) :: chr_lg
- TYPE(C_PTR) :: f_ptr
-
- ! vl data
- TYPE vl
- INTEGER, DIMENSION(:), POINTER :: DATA
- END TYPE vl
- TYPE(vl), DIMENSION(:), ALLOCATABLE, TARGET :: ptr
- TYPE(hvl_t), DIMENSION(1:2), TARGET :: wdata ! Array of vlen structures
- TYPE(hvl_t), DIMENSION(1:2), TARGET :: rdata ! Pointer to vlen structures
- INTEGER(hsize_t), DIMENSION(1:1) :: dims_vl = (/2/)
- INTEGER, DIMENSION(:), POINTER :: ptr_r
- INTEGER(HID_T) :: type_id
-
- !
- ! Initialize FORTRAN predefined datatypes.
- !
- CALL h5open_f(errcode)
-
- !
- ! Create a new file using default properties.
- !
- CALL h5fcreate_f(filename, H5F_ACC_TRUNC_F, file_id, errcode)
-
- !
- ! Initialize the data array.
- !
- n = 1
- DO i = 1, DIM1
- buf2(i) = n
- buf3(i) = n
- buf4(i) = n
- n = n + 1
- END DO
-
- !
- ! Initialize variable-length data. wdata(1) is a countdown of
- ! length LEN0, wdata(2) is a Fibonacci sequence of length LEN1.
- !
- wdata(1)%len = LEN0
- wdata(2)%len = LEN1
-
- ALLOCATE( ptr(1:2) )
- ALLOCATE( ptr(1)%data(1:wdata(1)%len) )
- ALLOCATE( ptr(2)%data(1:wdata(2)%len) )
-
- DO i=1, wdata(1)%len
- ptr(1)%data(i) = wdata(1)%len - i + 1 ! 3 2 1
- ENDDO
- wdata(1)%p = C_LOC(ptr(1)%data(1))
-
- ptr(2)%data(1:2) = 1
- DO i = 3, wdata(2)%len
- ptr(2)%data(i) = ptr(2)%data(i-1) + ptr(2)%data(i-2) ! (1 1 2 3 5 8 etc.)
- ENDDO
- wdata(2)%p = C_LOC(ptr(2)%data(1))
-
- !-------------------------------------------------------------------------
- ! int
- !-------------------------------------------------------------------------
-
- CALL test_begin(' Make/Read datasets (integer) ')
-
- !
- ! write dataset.
- !
- CALL h5ltmake_dataset_int_f(file_id, dsetname2, rank, dims, buf2, errcode)
-
- !
- ! read dataset.
- !
- CALL h5ltread_dataset_int_f(file_id, dsetname2, bufr2, dims, errcode)
-
- !
- ! compare read and write buffers.
- !
- DO i = 1, DIM1
- IF ( buf2(i) .NE. bufr2(i) ) THEN
- PRINT *, 'read buffer differs from write buffer'
- PRINT *, bufr2(i), ' and ', buf2(i)
- STOP
- ENDIF
- END DO
-
- CALL passed()
-
-
- !-------------------------------------------------------------------------
- ! real
- !-------------------------------------------------------------------------
-
- CALL test_begin(' Make/Read datasets (float) ')
-
-
- !
- ! write dataset.
- !
- f_ptr = C_LOC(buf3(1))
- CALL h5ltmake_dataset_f(file_id, dsetname3, rank, dims, H5T_NATIVE_REAL, f_ptr, errcode)
-
- !
- ! read dataset.
- !
- f_ptr = C_LOC(bufr3(1))
- CALL h5ltread_dataset_f(file_id, dsetname3, H5T_NATIVE_REAL, f_ptr, errcode)
-
- !
- ! compare read and write buffers.
- !
- DO i = 1, DIM1
- IF ( buf3(i) .NE. bufr3(i) ) THEN
- PRINT *, 'read buffer differs from write buffer'
- PRINT *, bufr3(i), ' and ', buf3(i)
- STOP
- ENDIF
- END DO
-
- CALL passed()
+ !
+ ! Close the file.
+ !
+ CALL h5fclose_f(file_id, errcode)
- !-------------------------------------------------------------------------
- ! double
- !-------------------------------------------------------------------------
-
- CALL test_begin(' Make/Read datasets (double) ')
-
-
- !
- ! write dataset.
- !
- !f_ptr = C_LOC(buf4(1))
- !CALL h5ltmake_dataset_f(file_id, dsetname4, rank, dims, H5T_NATIVE_DOUBLE, f_ptr, errcode)
- CALL h5ltmake_dataset_double_f(file_id, dsetname4, rank, dims, buf4, errcode)
-
- !
- ! read dataset.
- !
- !f_ptr = C_LOC(buf4(1))
- !CALL h5ltread_dataset_f(file_id, dsetname4, H5T_NATIVE_DOUBLE, f_ptr, errcode)
- CALL h5ltread_dataset_double_f(file_id, dsetname4, bufr4, dims, errcode)
-
- !
- ! compare read and write buffers.
- !
- DO i = 1, DIM1
- IF ( buf4(i) .NE. bufr4(i) ) THEN
- PRINT *, 'read buffer differs from write buffer'
- PRINT *, bufr4(i), ' and ', buf4(i)
- STOP
- ENDIF
- END DO
-
- CALL passed()
+ !
+ ! Close FORTRAN predefined datatypes.
+ !
+ CALL h5close_f(errcode)
+ CALL passed()
+ !
+ ! end function.
+ !
+ END SUBROUTINE test_dataset3D
!-------------------------------------------------------------------------
- ! string
+ ! test_datasetND
!-------------------------------------------------------------------------
- CALL test_begin(' Make/Read datasets (string) ')
-
-
- !
- ! write dataset.
- !
- CALL h5ltmake_dataset_string_f(file_id, dsetname5, buf1, errcode)
- !
- ! read dataset.
- !
- CALL h5ltread_dataset_string_f(file_id, dsetname5, buf1r, errcode)
+ SUBROUTINE test_datasetND(rank)
+
+ IMPLICIT NONE
+
+ INTEGER :: rank ! Dataset rank
+
+ INTEGER, PARAMETER :: DIM1 = 2 ! columns
+ INTEGER, PARAMETER :: DIM2 = 4 ! rows
+ INTEGER, PARAMETER :: DIM3 = 2 ! layers
+ INTEGER, PARAMETER :: DIM4 = 5 ! columns
+ INTEGER, PARAMETER :: DIM5 = 4 ! rows
+ INTEGER, PARAMETER :: DIM6 = 3 ! layers
+ INTEGER, PARAMETER :: DIM7 = 2 ! layers
+ CHARACTER(len=9), PARAMETER :: filename = "dsetf3.h5" ! File name
+ CHARACTER(LEN=5), PARAMETER :: dsetname2 = "dset2" ! Dataset name
+ CHARACTER(LEN=5), PARAMETER :: dsetname3 = "dset3" ! Dataset name
+ CHARACTER(LEN=5), PARAMETER :: dsetname4 = "dset4" ! Dataset name
+ CHARACTER(LEN=5), PARAMETER :: dsetname5 = "dset5" ! Dataset name
+ INTEGER(HID_T) :: file_id ! File identifier
+ INTEGER(HSIZE_T), DIMENSION(7) :: dims
+ INTEGER(HSIZE_T), DIMENSION(7) :: dimsr ! Dataset dimensions
+ INTEGER, ALLOCATABLE, DIMENSION(:,:,:,:) :: ibuf_4 ! Data buffer
+ INTEGER, ALLOCATABLE, DIMENSION(:,:,:,:) :: ibufr_4 ! Data buffer
+ INTEGER, ALLOCATABLE, DIMENSION(:,:,:,:,:), TARGET :: ibuf_5 ! Data buffer
+ INTEGER, ALLOCATABLE, DIMENSION(:,:,:,:,:), TARGET :: ibufr_5 ! Data buffer
+ INTEGER, ALLOCATABLE, DIMENSION(:,:,:,:,:,:) :: ibuf_6 ! Data buffer
+ INTEGER, ALLOCATABLE, DIMENSION(:,:,:,:,:,:) :: ibufr_6 ! Data buffer
+ INTEGER, ALLOCATABLE, DIMENSION(:,:,:,:,:,:,:) :: ibuf_7 ! Data buffer
+ INTEGER, ALLOCATABLE, DIMENSION(:,:,:,:,:,:,:) :: ibufr_7 ! Data buffer
+ REAL, ALLOCATABLE, DIMENSION(:,:,:,:), TARGET :: rbuf_4 ! Data buffer
+ REAL, ALLOCATABLE, DIMENSION(:,:,:,:), TARGET :: rbufr_4 ! Data buffer
+ REAL, ALLOCATABLE, DIMENSION(:,:,:,:,:), TARGET :: rbuf_5 ! Data buffer
+ REAL, ALLOCATABLE, DIMENSION(:,:,:,:,:), TARGET :: rbufr_5 ! Data buffer
+ REAL, ALLOCATABLE, DIMENSION(:,:,:,:,:,:), TARGET :: rbuf_6 ! Data buffer
+ REAL, ALLOCATABLE, DIMENSION(:,:,:,:,:,:), TARGET :: rbufr_6 ! Data buffer
+ REAL, ALLOCATABLE, DIMENSION(:,:,:,:,:,:,:), TARGET :: rbuf_7 ! Data buffer
+ REAL, ALLOCATABLE, DIMENSION(:,:,:,:,:,:,:), TARGET :: rbufr_7 ! Data buffer
+ DOUBLE PRECISION, ALLOCATABLE, DIMENSION(:,:,:,:), TARGET :: dbuf_4 ! Data buffer
+ DOUBLE PRECISION, ALLOCATABLE, DIMENSION(:,:,:,:), TARGET :: dbufr_4 ! Data buffer
+ DOUBLE PRECISION, ALLOCATABLE, DIMENSION(:,:,:,:,:), TARGET :: dbuf_5 ! Data buffer
+ DOUBLE PRECISION, ALLOCATABLE, DIMENSION(:,:,:,:,:), TARGET :: dbufr_5 ! Data buffer
+ DOUBLE PRECISION, ALLOCATABLE, DIMENSION(:,:,:,:,:,:), TARGET :: dbuf_6 ! Data buffer
+ DOUBLE PRECISION, ALLOCATABLE, DIMENSION(:,:,:,:,:,:), TARGET :: dbufr_6 ! Data buffer
+ DOUBLE PRECISION, ALLOCATABLE, DIMENSION(:,:,:,:,:,:,:), TARGET :: dbuf_7 ! Data buffer
+ DOUBLE PRECISION, ALLOCATABLE, DIMENSION(:,:,:,:,:,:,:), TARGET :: dbufr_7 ! Data buffer
+ CHARACTER(LEN=5), ALLOCATABLE, DIMENSION(:,:,:,:), TARGET :: cbuf_4 ! Data buffer
+ CHARACTER(LEN=5), ALLOCATABLE, DIMENSION(:,:,:,:), TARGET :: cbufr_4 ! Data buffer
+ CHARACTER(LEN=5), ALLOCATABLE, DIMENSION(:,:,:,:,:), TARGET :: cbuf_5 ! Data buffer
+ CHARACTER(LEN=5), ALLOCATABLE, DIMENSION(:,:,:,:,:), TARGET :: cbufr_5 ! Data buffer
+ CHARACTER(LEN=5), ALLOCATABLE, DIMENSION(:,:,:,:,:,:), TARGET :: cbuf_6 ! Data buffer
+ CHARACTER(LEN=5), ALLOCATABLE, DIMENSION(:,:,:,:,:,:), TARGET :: cbufr_6 ! Data buffer
+ CHARACTER(LEN=5), ALLOCATABLE, DIMENSION(:,:,:,:,:,:,:), TARGET :: cbuf_7 ! Data buffer
+ CHARACTER(LEN=5), ALLOCATABLE, DIMENSION(:,:,:,:,:,:,:), TARGET :: cbufr_7 ! Data buffer
+ INTEGER :: errcode ! Error flag
+ INTEGER(HSIZE_T) :: i, j, k, l, m, n, o, nn ! general purpose integers
+ INTEGER :: type_class
+ INTEGER(SIZE_T) :: type_size
+ CHARACTER(LEN=1) :: ichr1
+ TYPE(C_PTR) :: f_ptr
+ INTEGER(HID_T) :: type_id
+
+ WRITE(ichr1,'(I1.1)') rank
+ CALL test_begin(' Make/Read datasets ('//ichr1//'D) ')
+ !
+ ! Initialize the data array.
+ !
+ IF(rank.EQ.4)THEN
+
+ ALLOCATE(ibuf_4 (1:DIM1,1:DIM2,1:DIM3,1:DIM4))
+ ALLOCATE(ibufr_4(1:DIM1,1:DIM2,1:DIM3,1:DIM4))
+ ALLOCATE(rbuf_4 (1:DIM1,1:DIM2,1:DIM3,1:DIM4))
+ ALLOCATE(rbufr_4(1:DIM1,1:DIM2,1:DIM3,1:DIM4))
+ ALLOCATE(dbuf_4 (1:DIM1,1:DIM2,1:DIM3,1:DIM4))
+ ALLOCATE(dbufr_4(1:DIM1,1:DIM2,1:DIM3,1:DIM4))
+ ALLOCATE(cbuf_4 (1:DIM1,1:DIM2,1:DIM3,1:DIM4))
+ ALLOCATE(cbufr_4(1:DIM1,1:DIM2,1:DIM3,1:DIM4))
+
+ dims(1:7) = (/DIM1,DIM2,DIM3,DIM4,0,0,0/)
+
+ nn = 1
+ DO i = 1, DIM1
+ DO j = 1, DIM2
+ DO k = 1, DIM3
+ DO l = 1, DIM4
+ ibuf_4(i,j,k,l) = INT(nn)
+ rbuf_4(i,j,k,l) = INT(nn)
+ dbuf_4(i,j,k,l) = INT(nn)
+ WRITE(cbuf_4(i,j,k,l),'(I5.5)') nn
+ nn = nn + 1
+ END DO
+ END DO
+ END DO
+
+ ENDDO
+
+ ELSE IF(rank.EQ.5)THEN
+
+ ALLOCATE(ibuf_5 (1:DIM1,1:DIM2,1:DIM3,1:DIM4,1:DIM5))
+ ALLOCATE(ibufr_5(1:DIM1,1:DIM2,1:DIM3,1:DIM4,1:DIM5))
+ ALLOCATE(rbuf_5 (1:DIM1,1:DIM2,1:DIM3,1:DIM4,1:DIM5))
+ ALLOCATE(rbufr_5(1:DIM1,1:DIM2,1:DIM3,1:DIM4,1:DIM5))
+ ALLOCATE(dbuf_5 (1:DIM1,1:DIM2,1:DIM3,1:DIM4,1:DIM5))
+ ALLOCATE(dbufr_5(1:DIM1,1:DIM2,1:DIM3,1:DIM4,1:DIM5))
+ ALLOCATE(cbuf_5 (1:DIM1,1:DIM2,1:DIM3,1:DIM4,1:DIM5))
+ ALLOCATE(cbufr_5(1:DIM1,1:DIM2,1:DIM3,1:DIM4,1:DIM5))
+
+ dims(1:7) = (/DIM1,DIM2,DIM3,DIM4,DIM5,0,0/)
+
+ nn = 1
+ DO i = 1, DIM1
+ DO j = 1, DIM2
+ DO k = 1, DIM3
+ DO l = 1, DIM4
+ DO m = 1, DIM5
+ ibuf_5(i,j,k,l,m) = INT(nn)
+ rbuf_5(i,j,k,l,m) = INT(nn)
+ dbuf_5(i,j,k,l,m) = INT(nn)
+ WRITE(cbuf_5(i,j,k,l,m),'(I5.5)') nn
+ nn = nn + 1
+ END DO
+ END DO
+ END DO
+ ENDDO
+ ENDDO
+
+ ELSE IF(rank.EQ.6)THEN
+
+ ALLOCATE(ibuf_6 (1:DIM1,1:DIM2,1:DIM3,1:DIM4,1:DIM5,1:DIM6))
+ ALLOCATE(ibufr_6(1:DIM1,1:DIM2,1:DIM3,1:DIM4,1:DIM5,1:DIM6))
+ ALLOCATE(rbuf_6 (1:DIM1,1:DIM2,1:DIM3,1:DIM4,1:DIM5,1:DIM6))
+ ALLOCATE(rbufr_6(1:DIM1,1:DIM2,1:DIM3,1:DIM4,1:DIM5,1:DIM6))
+ ALLOCATE(dbuf_6 (1:DIM1,1:DIM2,1:DIM3,1:DIM4,1:DIM5,1:DIM6))
+ ALLOCATE(dbufr_6(1:DIM1,1:DIM2,1:DIM3,1:DIM4,1:DIM5,1:DIM6))
+ ALLOCATE(cbuf_6 (1:DIM1,1:DIM2,1:DIM3,1:DIM4,1:DIM5,1:DIM6))
+ ALLOCATE(cbufr_6(1:DIM1,1:DIM2,1:DIM3,1:DIM4,1:DIM5,1:DIM6))
+
+ dims(1:7) = (/DIM1,DIM2,DIM3,DIM4,DIM5,DIM6,0/)
+
+ nn = 1
+ DO i = 1, DIM1
+ DO j = 1, DIM2
+ DO k = 1, DIM3
+ DO l = 1, DIM4
+ DO m = 1, DIM5
+ DO n = 1, DIM6
+ ibuf_6(i,j,k,l,m,n) = INT(nn)
+ rbuf_6(i,j,k,l,m,n) = INT(nn)
+ dbuf_6(i,j,k,l,m,n) = INT(nn)
+ WRITE(cbuf_6(i,j,k,l,m,n),'(I5.5)') nn
+ nn = nn + 1
+ END DO
+ END DO
+ END DO
+ ENDDO
+ ENDDO
+ ENDDO
+
+ ELSE IF(rank.EQ.7)THEN
+
+ ALLOCATE(ibuf_7 (1:DIM1,1:DIM2,1:DIM3,1:DIM4,1:DIM5,1:DIM6,1:DIM7))
+ ALLOCATE(ibufr_7(1:DIM1,1:DIM2,1:DIM3,1:DIM4,1:DIM5,1:DIM6,1:DIM7))
+ ALLOCATE(rbuf_7 (1:DIM1,1:DIM2,1:DIM3,1:DIM4,1:DIM5,1:DIM6,1:DIM7))
+ ALLOCATE(rbufr_7(1:DIM1,1:DIM2,1:DIM3,1:DIM4,1:DIM5,1:DIM6,1:DIM7))
+ ALLOCATE(dbuf_7 (1:DIM1,1:DIM2,1:DIM3,1:DIM4,1:DIM5,1:DIM6,1:DIM7))
+ ALLOCATE(dbufr_7(1:DIM1,1:DIM2,1:DIM3,1:DIM4,1:DIM5,1:DIM6,1:DIM7))
+ ALLOCATE(cbuf_7 (1:DIM1,1:DIM2,1:DIM3,1:DIM4,1:DIM5,1:DIM6,1:DIM7))
+ ALLOCATE(cbufr_7(1:DIM1,1:DIM2,1:DIM3,1:DIM4,1:DIM5,1:DIM6,1:DIM7))
+
+ dims(1:7) = (/DIM1,DIM2,DIM3,DIM4,DIM5,DIM6,DIM7/)
+
+ nn = 1
+ DO i = 1, DIM1
+ DO j = 1, DIM2
+ DO k = 1, DIM3
+ DO l = 1, DIM4
+ DO m = 1, DIM5
+ DO n = 1, DIM6
+ DO o = 1, DIM7
+ ibuf_7(i,j,k,l,m,n,o) = INT(nn)
+ rbuf_7(i,j,k,l,m,n,o) = INT(nn)
+ dbuf_7(i,j,k,l,m,n,o) = INT(nn)
+ WRITE(cbuf_7(i,j,k,l,m,n,o),'(I5.5)') nn
+ nn = nn + 1
+ END DO
+ END DO
+ END DO
+ ENDDO
+ ENDDO
+ ENDDO
+ ENDDO
+
+ ENDIF
+
+ !
+ ! Initialize FORTRAN predefined datatypes.
+ !
+ CALL h5open_f(errcode)
+
+ !
+ ! Create a new file using default properties.
+ !
+ CALL h5fcreate_f(filename, H5F_ACC_TRUNC_F, file_id, errcode)
+
+ !-------------------------------------------------------------------------
+ ! H5T_NATIVE_INT ND buffer
+ !-------------------------------------------------------------------------
+
+ !
+ ! write dataset.
+ !
+ IF(rank.EQ.4)THEN
+ CALL h5ltmake_dataset_f(file_id, dsetname2, rank, dims(1:rank), H5T_NATIVE_INTEGER, ibuf_4, errcode)
+ ELSE IF(rank.EQ.5)THEN
+ f_ptr = C_LOC(ibuf_5(1,1,1,1,1))
+ CALL h5ltmake_dataset_f(file_id, dsetname2, rank, dims(1:rank), H5T_NATIVE_INTEGER, f_ptr, errcode)
+ ELSE IF(rank.EQ.6)THEN
+ CALL h5ltmake_dataset_f(file_id, dsetname2, rank, dims(1:rank), H5T_NATIVE_INTEGER, ibuf_6, errcode)
+ ELSE IF(rank.EQ.7)THEN
+ CALL h5ltmake_dataset_f(file_id, dsetname2, rank, dims(1:rank), H5T_NATIVE_INTEGER, ibuf_7, errcode)
+ ENDIF
+
+
+ !
+ ! read dataset.
+ !
+ IF(rank.EQ.4)THEN
+ CALL h5ltread_dataset_f(file_id, dsetname2, H5T_NATIVE_INTEGER, ibufr_4, dims(1:rank), errcode)
+ ELSE IF(rank.EQ.5)THEN
+ f_ptr = C_LOC(ibufr_5(1,1,1,1,1))
+ CALL h5ltread_dataset_f(file_id, dsetname2, H5T_NATIVE_INTEGER, f_ptr, errcode)
+ ELSE IF(rank.EQ.6)THEN
+ CALL h5ltread_dataset_f(file_id, dsetname2, H5T_NATIVE_INTEGER, ibufr_6, dims(1:rank), errcode)
+ ELSE IF(rank.EQ.7)THEN
+ CALL h5ltread_dataset_f(file_id, dsetname2, H5T_NATIVE_INTEGER, ibufr_7, dims(1:rank), errcode)
+ ENDIF
+
+ !
+ ! compare read and write buffers.
+ !
+ DO i = 1, dims(1)
+ DO j = 1, dims(2)
+ DO k = 1, dims(3)
+ DO l = 1, dims(4)
+ IF(rank.EQ.4)THEN
+ IF ( ibuf_4(i,j,k,l) .NE. ibufr_4(i,j,k,l) ) THEN
+ PRINT *, 'read buffer differs from write buffer'
+ PRINT *, ibuf_4(i,j,k,l), ' and ', ibufr_4(i,j,k,l)
+ STOP
+ ENDIF
+ ENDIF
+ DO m = 1, dims(5)
+ IF(rank.EQ.5)THEN
+ IF ( ibuf_5(i,j,k,l,m) .NE. ibufr_5(i,j,k,l,m) ) THEN
+ PRINT *, 'read buffer differs from write buffer'
+ PRINT *, ibuf_5(i,j,k,l,m), ' and ', ibufr_5(i,j,k,l,m)
+ STOP
+ ENDIF
+ ENDIF
+ DO n = 1, dims(6)
+ IF(rank.EQ.6)THEN
+ IF ( ibuf_6(i,j,k,l,m,n) .NE. ibufr_6(i,j,k,l,m,n) ) THEN
+ PRINT *, 'read buffer differs from write buffer'
+ PRINT *, ibuf_6(i,j,k,l,m,n), ' and ', ibufr_6(i,j,k,l,m,n)
+ STOP
+ ENDIF
+ ENDIF
+ DO o = 1, dims(7)
+ IF(rank.EQ.7)THEN
+ IF ( ibuf_7(i,j,k,l,m,n,o) .NE. ibufr_7(i,j,k,l,m,n,o) ) THEN
+ PRINT *, 'read buffer differs from write buffer'
+ PRINT *, ibuf_7(i,j,k,l,m,n,o), ' and ', ibufr_7(i,j,k,l,m,n,o)
+ STOP
+ ENDIF
+ ENDIF
+ ENDDO
+ ENDDO
+ ENDDO
+ ENDDO
+ ENDDO
+ ENDDO
+ ENDDO
+ !-------------------------------------------------------------------------
+ ! H5T_NATIVE_REAL
+ !-------------------------------------------------------------------------
+
+ !
+ ! write dataset.
+ !
+ IF(rank.EQ.4)THEN
+ f_ptr = C_LOC(rbuf_4(1,1,1,1))
+ CALL h5ltmake_dataset_f(file_id, dsetname3, rank, dims(1:rank), H5T_NATIVE_REAL, f_ptr, errcode)
+ ! CALL h5ltmake_dataset_f(file_id, dsetname3, rank, dims(1:rank), H5T_NATIVE_REAL, rbuf_4, errcode)
+ ELSE IF(rank.EQ.5)THEN
+ f_ptr = C_LOC(rbuf_5(1,1,1,1,1))
+ CALL h5ltmake_dataset_f(file_id, dsetname3, rank, dims(1:rank), H5T_NATIVE_REAL, f_ptr, errcode)
+ ELSE IF(rank.EQ.6)THEN
+ f_ptr = C_LOC(rbuf_6(1,1,1,1,1,1))
+ CALL h5ltmake_dataset_f(file_id, dsetname3, rank, dims(1:rank), H5T_NATIVE_REAL, f_ptr, errcode)
+ !CALL h5ltmake_dataset_f(file_id, dsetname3, rank, dims(1:rank), H5T_NATIVE_REAL, rbuf_6, errcode)
+ ELSE IF(rank.EQ.7)THEN
+ f_ptr = C_LOC(rbuf_7(1,1,1,1,1,1,1))
+ CALL h5ltmake_dataset_f(file_id, dsetname3, rank, dims(1:rank), H5T_NATIVE_REAL, f_ptr, errcode)
+ !CALL h5ltmake_dataset_f(file_id, dsetname3, rank, dims(1:rank), H5T_NATIVE_REAL, rbuf_7, errcode)
+ ENDIF
+
+
+ !
+ ! read dataset.
+ !
+ IF(rank.EQ.4)THEN
+ f_ptr = C_LOC(rbufr_4(1,1,1,1))
+ CALL h5ltread_dataset_f(file_id, dsetname3, H5T_NATIVE_REAL, f_ptr, errcode)
+ ELSE IF(rank.EQ.5)THEN
+ f_ptr = C_LOC(rbufr_5(1,1,1,1,1))
+ CALL h5ltread_dataset_f(file_id, dsetname3, H5T_NATIVE_REAL, f_ptr, errcode)
+ ELSE IF(rank.EQ.6)THEN
+ f_ptr = C_LOC(rbufr_6(1,1,1,1,1,1))
+ CALL h5ltread_dataset_f(file_id, dsetname3, H5T_NATIVE_REAL, f_ptr, errcode)
+ ELSE IF(rank.EQ.7)THEN
+ f_ptr = C_LOC(rbufr_7(1,1,1,1,1,1,1))
+ CALL h5ltread_dataset_f(file_id, dsetname3, H5T_NATIVE_REAL, f_ptr, errcode)
+ ENDIF
+
+ !
+ ! compare read and write buffers.
+ !
+ DO i = 1, dims(1)
+ DO j = 1, dims(2)
+ DO k = 1, dims(3)
+ DO l = 1, dims(4)
+ IF(rank.EQ.4)THEN
+ CALL VERIFY("h5ltread_dataset_f",rbuf_4(i,j,k,l), rbufr_4(i,j,k,l), errcode)
+ IF (errcode .NE.0 ) THEN
+ PRINT *, 'read buffer differs from write buffer'
+ PRINT *, rbuf_4(i,j,k,l), ' and ', rbufr_4(i,j,k,l)
+ STOP
+ ENDIF
+ ENDIF
+ DO m = 1, dims(5)
+ IF(rank.EQ.5)THEN
+ CALL VERIFY("h5ltread_dataset_f",rbuf_5(i,j,k,l,m), rbufr_5(i,j,k,l,m), errcode)
+ IF (errcode .NE.0 ) THEN
+ PRINT *, 'read buffer differs from write buffer'
+ PRINT *, rbuf_5(i,j,k,l,m), ' and ', rbufr_5(i,j,k,l,m)
+ STOP
+ ENDIF
+ ENDIF
+ DO n = 1, dims(6)
+ IF(rank.EQ.6)THEN
+ CALL VERIFY("h5ltread_dataset_f",rbuf_6(i,j,k,l,m,n), rbufr_6(i,j,k,l,m,n), errcode)
+ IF (errcode .NE.0 ) THEN
+ PRINT *, 'read buffer differs from write buffer'
+ PRINT *, rbuf_6(i,j,k,l,m,n), ' and ', rbufr_6(i,j,k,l,m,n)
+ STOP
+ ENDIF
+ ENDIF
+ DO o = 1, dims(7)
+ IF(rank.EQ.7)THEN
+ CALL VERIFY("h5ltread_dataset_f",rbuf_7(i,j,k,l,m,n,o), rbufr_7(i,j,k,l,m,n,o), errcode)
+ IF (errcode .NE.0 ) THEN
+ PRINT *, 'read buffer differs from write buffer'
+ PRINT *, rbuf_7(i,j,k,l,m,n,o), ' and ', rbufr_7(i,j,k,l,m,n,o)
+ STOP
+ ENDIF
+ ENDIF
+ ENDDO
+ ENDDO
+ ENDDO
+ ENDDO
+ ENDDO
+ ENDDO
+ ENDDO
+
+ !-------------------------------------------------------------------------
+ ! H5T_NATIVE_DOUBLE
+ !-------------------------------------------------------------------------
+
+ !
+ ! write dataset.
+ !
+ IF(rank.EQ.4)THEN
+ f_ptr = C_LOC(dbuf_4(1,1,1,1))
+ CALL h5ltmake_dataset_f(file_id, dsetname4, rank, dims(1:rank), H5T_NATIVE_DOUBLE, f_ptr, errcode)
+ ELSE IF(rank.EQ.5)THEN
+ f_ptr = C_LOC(dbuf_5(1,1,1,1,1))
+ CALL h5ltmake_dataset_f(file_id, dsetname4, rank, dims(1:rank), H5T_NATIVE_DOUBLE, f_ptr, errcode)
+ ELSE IF(rank.EQ.6)THEN
+ f_ptr = C_LOC(dbuf_6(1,1,1,1,1,1))
+ CALL h5ltmake_dataset_f(file_id, dsetname4, rank, dims(1:rank), H5T_NATIVE_DOUBLE, f_ptr, errcode)
+ ELSE IF(rank.EQ.7)THEN
+ f_ptr = C_LOC(dbuf_7(1,1,1,1,1,1,1))
+ CALL h5ltmake_dataset_f(file_id, dsetname4, rank, dims(1:rank), H5T_NATIVE_DOUBLE, f_ptr, errcode)
+ ENDIF
+
+ !
+ ! read dataset.
+ !
+ IF(rank.EQ.4)THEN
+ f_ptr = C_LOC(dbufr_4(1,1,1,1))
+ CALL h5ltread_dataset_f(file_id, dsetname4, H5T_NATIVE_DOUBLE, f_ptr, errcode)
+ ELSE IF(rank.EQ.5)THEN
+ f_ptr = C_LOC(dbufr_5(1,1,1,1,1))
+ CALL h5ltread_dataset_f(file_id, dsetname4, H5T_NATIVE_DOUBLE, f_ptr, errcode)
+ ELSE IF(rank.EQ.6)THEN
+ f_ptr = C_LOC(dbufr_6(1,1,1,1,1,1))
+ CALL h5ltread_dataset_f(file_id, dsetname4, H5T_NATIVE_DOUBLE, f_ptr, errcode)
+ ELSE IF(rank.EQ.7)THEN
+ f_ptr = C_LOC(dbufr_7(1,1,1,1,1,1,1))
+ CALL h5ltread_dataset_f(file_id, dsetname4, H5T_NATIVE_DOUBLE, f_ptr, errcode)
+ ENDIF
+
+ !
+ ! compare read and write buffers.
+ !
+ DO i = 1, dims(1)
+ DO j = 1, dims(2)
+ DO k = 1, dims(3)
+ DO l = 1, dims(4)
+ IF(rank.EQ.4)THEN
+ CALL VERIFY("h5ltread_dataset_f",dbuf_4(i,j,k,l), dbufr_4(i,j,k,l), errcode)
+ IF (errcode .NE.0 ) THEN
+ PRINT *, 'read buffer differs from write buffer'
+ PRINT *, dbuf_4(i,j,k,l), ' and ', dbufr_4(i,j,k,l)
+ STOP
+ ENDIF
+ ENDIF
+ DO m = 1, dims(5)
+ IF(rank.EQ.5)THEN
+ CALL VERIFY("h5ltread_dataset_f",dbuf_5(i,j,k,l,m), dbufr_5(i,j,k,l,m), errcode)
+ IF (errcode .NE.0 ) THEN
+ PRINT *, 'read buffer differs from write buffer'
+ PRINT *, dbuf_5(i,j,k,l,m), ' and ', dbufr_5(i,j,k,l,m)
+ STOP
+ ENDIF
+ ENDIF
+ DO n = 1, dims(6)
+ IF(rank.EQ.6)THEN
+ CALL VERIFY("h5ltread_dataset_f",dbuf_6(i,j,k,l,m,n), dbufr_6(i,j,k,l,m,n), errcode)
+ IF (errcode .NE.0 ) THEN
+ PRINT *, 'read buffer differs from write buffer'
+ PRINT *, dbuf_6(i,j,k,l,m,n), ' and ', dbufr_6(i,j,k,l,m,n)
+ STOP
+ ENDIF
+ ENDIF
+ DO o = 1, dims(7)
+ IF(rank.EQ.7)THEN
+ CALL VERIFY("h5ltread_dataset_f",dbuf_7(i,j,k,l,m,n,o), dbufr_7(i,j,k,l,m,n,o), errcode)
+ IF (errcode .NE.0 ) THEN
+ PRINT *, 'read buffer differs from write buffer'
+ PRINT *, dbuf_7(i,j,k,l,m,n,o), ' and ', dbufr_7(i,j,k,l,m,n,o)
+ STOP
+ ENDIF
+ ENDIF
+ ENDDO
+ ENDDO
+ ENDDO
+ ENDDO
+ ENDDO
+ ENDDO
+ ENDDO
+
+ !-------------------------------------------------------------------------
+ ! H5T_NATIVE_CHARACTER ND buffer
+ !-------------------------------------------------------------------------
+
+ CALL H5Tcopy_f(H5T_FORTRAN_S1, type_id, errcode)
+ CALL H5Tset_size_f(type_id, 5_SIZE_T, errcode)
+ !
+ ! write dataset.
+ !
+ IF(rank.EQ.4)THEN
+ f_ptr = C_LOC(cbuf_4(1,1,1,1)(1:1))
+ CALL h5ltmake_dataset_f(file_id, dsetname5, rank, dims(1:rank), type_id, f_ptr, errcode)
+ ELSE IF(rank.EQ.5)THEN
+ f_ptr = C_LOC(cbuf_5(1,1,1,1,1)(1:1))
+ CALL h5ltmake_dataset_f(file_id, dsetname5, rank, dims(1:rank), type_id, f_ptr, errcode)
+ ELSE IF(rank.EQ.6)THEN
+ f_ptr = C_LOC(cbuf_6(1,1,1,1,1,1)(1:1))
+ CALL h5ltmake_dataset_f(file_id, dsetname5, rank, dims(1:rank), type_id, f_ptr, errcode)
+ ELSE IF(rank.EQ.7)THEN
+ f_ptr = C_LOC(cbuf_7(1,1,1,1,1,1,1)(1:1))
+ CALL h5ltmake_dataset_f(file_id, dsetname5, rank, dims(1:rank), type_id, f_ptr, errcode)
+ ENDIF
+
+ !
+ ! read dataset.
+ !
+ IF(rank.EQ.4)THEN
+ f_ptr = C_LOC(cbufr_4(1,1,1,1)(1:1))
+ CALL h5ltread_dataset_f(file_id, dsetname5, type_id, f_ptr, errcode)
+ ELSE IF(rank.EQ.5)THEN
+ f_ptr = C_LOC(cbufr_5(1,1,1,1,1)(1:1))
+ CALL h5ltread_dataset_f(file_id, dsetname5, type_id, f_ptr, errcode)
+ ELSE IF(rank.EQ.6)THEN
+ f_ptr = C_LOC(cbufr_6(1,1,1,1,1,1)(1:1))
+ CALL h5ltread_dataset_f(file_id, dsetname5, type_id, f_ptr, errcode)
+ ELSE IF(rank.EQ.7)THEN
+ f_ptr = C_LOC(cbufr_7(1,1,1,1,1,1,1)(1:1))
+ CALL h5ltread_dataset_f(file_id, dsetname5, type_id, f_ptr, errcode)
+ ENDIF
+
+
+ !
+ ! compare read and write buffers.
+ !
+ DO i = 1, dims(1)
+ DO j = 1, dims(2)
+ DO k = 1, dims(3)
+ DO l = 1, dims(4)
+ IF(rank.EQ.4)THEN
+ IF ( cbuf_4(i,j,k,l) .NE. cbufr_4(i,j,k,l) ) THEN
+ PRINT *, 'read buffer differs from write buffer (character)'
+ PRINT *, cbuf_4(i,j,k,l), ' and ', cbufr_4(i,j,k,l)
+ STOP
+ ENDIF
+ ENDIF
+ DO m = 1, dims(5)
+ IF(rank.EQ.5)THEN
+ IF ( cbuf_5(i,j,k,l,m) .NE. cbufr_5(i,j,k,l,m) ) THEN
+ PRINT *, 'read buffer differs from write buffer (character)'
+ PRINT *, cbuf_5(i,j,k,l,m), ' and ', cbufr_5(i,j,k,l,m)
+ STOP
+ ENDIF
+ ENDIF
+ DO n = 1, dims(6)
+ IF(rank.EQ.6)THEN
+ IF ( cbuf_6(i,j,k,l,m,n) .NE. cbufr_6(i,j,k,l,m,n) ) THEN
+ PRINT *, 'read buffer differs from write buffer (character)'
+ PRINT *, cbuf_6(i,j,k,l,m,n), ' and ', cbufr_6(i,j,k,l,m,n)
+ STOP
+ ENDIF
+ ENDIF
+ DO o = 1, dims(7)
+ IF(rank.EQ.7)THEN
+ IF ( cbuf_7(i,j,k,l,m,n,o) .NE. cbufr_7(i,j,k,l,m,n,o) ) THEN
+ PRINT *, 'read buffer differs from write buffer (character)'
+ PRINT *, cbuf_7(i,j,k,l,m,n,o), ' and ', cbufr_7(i,j,k,l,m,n,o)
+ STOP
+ ENDIF
+ ENDIF
+ ENDDO
+ ENDDO
+ ENDDO
+ ENDDO
+ ENDDO
+ ENDDO
+ ENDDO
+
+ CALL h5ltget_dataset_info_f(file_id,dsetname4,dimsr,type_class,type_size,errcode )
+
+ CALL h5tclose_f(type_id,errcode)
+
+ !
+ ! compare dimensions
+ !
+ DO i = 1, rank
+ IF ( dimsr(i) .NE. dims(i) ) THEN
+ PRINT *, 'dimensions differ '
+ STOP
+ ENDIF
+ END DO
+
+ !
+ ! Close the file.
+ !
+ CALL h5fclose_f(file_id, errcode)
+
+ !
+ ! Close FORTRAN predefined datatypes.
+ !
+ CALL h5close_f(errcode)
+
+ ! DEALLOCATE RESOURCES
+
+ IF(rank.EQ.4)THEN
+ DEALLOCATE(ibuf_4, ibufr_4, rbuf_4, rbufr_4, dbuf_4, dbufr_4, cbuf_4, cbufr_4)
+ ELSE IF(rank.EQ.5)THEN
+ DEALLOCATE(ibuf_5, ibufr_5, rbuf_5, rbufr_5, dbuf_5, dbufr_5, cbuf_5, cbufr_5)
+ ELSE IF(rank.EQ.6)THEN
+ DEALLOCATE(ibuf_6, ibufr_6, rbuf_6, rbufr_6, dbuf_6, dbufr_6, cbuf_6, cbufr_6)
+ ELSE IF(rank.EQ.7)THEN
+ DEALLOCATE(ibuf_7, ibufr_7, rbuf_7, rbufr_7, dbuf_7, dbufr_7, cbuf_7, cbufr_7)
+ ENDIF
+
+ CALL passed()
+ !
+ ! end function.
+ !
+ END SUBROUTINE test_datasetND
- !
- ! compare read and write buffers.
- !
- IF ( buf1 .NE. buf1r ) THEN
- PRINT *, 'read buffer differs from write buffer'
- PRINT *, buf1, ' and ', buf1r
- STOP
- ENDIF
-
- CALL passed()
-
-
- !-------------------------------------------------------------------------
- ! variable-length dataset
- !-------------------------------------------------------------------------
- CALL test_begin(' Make/Read datasets (vl) ')
- !
- ! Create variable-length datatype.
- !
- CALL H5Tvlen_create_f(H5T_NATIVE_INTEGER, type_id, errcode)
-
- f_ptr = C_LOC(wdata(1))
- CALL h5ltmake_dataset_f(file_id, dsetname6, 1, dims_vl, type_id, f_ptr, errcode)
-
- ! Read the variable-length datatype
- f_ptr = C_LOC(rdata(1))
- CALL h5ltread_dataset_f(file_id, dsetname6, type_id, f_ptr, errcode)
-
- DO i = 1, INT(dims_vl(1))
- CALL c_f_pointer(rdata(i)%p, ptr_r, [rdata(i)%len] )
- DO j = 1, rdata(i)%len
- IF(ptr_r(j).NE.ptr(i)%data(j))THEN
- PRINT *, 'Writing/Reading variable-length dataset failed'
- STOP
- ENDIF
- ENDDO
- ENDDO
-
- CALL H5Tclose_f(type_id, errcode)
- DEALLOCATE(ptr)
-
- CALL passed()
-
- CALL test_begin(' Test h5ltpath_valid_f ')
- !
- ! test function h5ltpath_valid_f
- !
- chr_exact = "/"//dsetname2 ! test character buffer the exact size needed
- CALL h5ltpath_valid_f(file_id, chr_exact, .TRUE., path_valid, errcode)
- IF(errcode.LT.0.OR..NOT.path_valid)THEN
- PRINT *, 'error in h5ltpath_valid_f'
- STOP
- ENDIF
- chr_lg = "/"//dsetname2 ! test character buffer larger then needed
- CALL h5ltpath_valid_f(file_id, chr_lg, .TRUE., path_valid, errcode)
- IF(errcode.LT.0.OR..NOT.path_valid)THEN
- PRINT *, 'error in h5ltpath_valid_f'
- STOP
- ENDIF
-
- CALL h5ltpath_valid_f(file_id, chr_lg, .FALSE., path_valid, errcode)
- IF(errcode.LT.0.OR..NOT.path_valid)THEN
- PRINT *, 'error in h5ltpath_valid_f'
- STOP
- ENDIF
-
- ! Should fail, dataset does not exist
- CALL h5ltpath_valid_f(file_id, "/"//dsetname2//"junk", .TRUE., path_valid, errcode)
- IF(errcode.LT.0.OR.path_valid)THEN
- PRINT *, 'error in h5ltpath_valid_f'
- STOP
- ENDIF
-
- CALL h5ltpath_valid_f(file_id, "/"//dsetname2//"junk", .FALSE., path_valid, errcode)
- IF(errcode.LT.0.OR.path_valid)THEN
- PRINT *, 'error in h5ltpath_valid_f'
- STOP
- ENDIF
-
- ! Create a dangling soft link
- CALL h5lcreate_soft_f("/G2", file_id, "/G3", errcode)
-
- ! Should pass, does not check for dangled link
- CALL h5ltpath_valid_f(file_id, "/G3", .FALSE., path_valid, errcode)
- IF(.NOT.path_valid)THEN
- PRINT *, 'error in h5ltpath_valid_f'
- STOP
- ENDIF
-
- ! Should fail, dangled link
- CALL h5ltpath_valid_f(file_id, "/G2", .TRUE., path_valid, errcode)
- IF(path_valid)THEN
- PRINT *, 'error in h5ltpath_valid_f'
- STOP
- ENDIF
-
- CALL passed()
-
- CALL test_begin(' Get dataset dimensions/info ')
!-------------------------------------------------------------------------
- ! h5ltget_dataset_ndims_f
+ ! test_datasets
!-------------------------------------------------------------------------
- CALL h5ltget_dataset_ndims_f(file_id, dsetname4, rankr, errcode)
- IF ( rankr .NE. rank ) THEN
- PRINT *, 'h5ltget_dataset_ndims_f return error'
- STOP
- ENDIF
-
- !-------------------------------------------------------------------------
- ! test h5ltfind_dataset_f function
- !-------------------------------------------------------------------------
+ SUBROUTINE test_datasets()
+
+ IMPLICIT NONE
+
+ CHARACTER(len=9), PARAMETER :: filename = "dsetf4.h5"! File name
+ INTEGER(HID_T) :: file_id ! File identifier
+ INTEGER :: errcode ! Error flag
+ INTEGER, PARAMETER :: DIM1 = 10 ! Dimension of array
+ INTEGER, PARAMETER :: LEN0 = 3
+ INTEGER, PARAMETER :: LEN1 = 12
+ CHARACTER(LEN=5), PARAMETER :: dsetname2 = "dset2" ! Dataset name
+ CHARACTER(LEN=5), PARAMETER :: dsetname3 = "dset3" ! Dataset name
+ CHARACTER(LEN=5), PARAMETER :: dsetname4 = "dset4" ! Dataset name
+ CHARACTER(LEN=5), PARAMETER :: dsetname5 = "dset5" ! Dataset name
+ CHARACTER(LEN=5), PARAMETER :: dsetname6 = "dset6" ! Dataset name
+ INTEGER(HSIZE_T), DIMENSION(1) :: dims = (/DIM1/) ! Dataset dimensions
+ INTEGER(HSIZE_T), DIMENSION(1) :: dimsr ! Dataset dimensions
+ INTEGER :: rank = 1 ! Dataset rank
+ INTEGER :: rankr ! Dataset rank
+ CHARACTER(LEN=8), PARAMETER :: buf1 = "mystring" ! Data buffer
+ CHARACTER(LEN=8) :: buf1r ! Data buffer
+ INTEGER, DIMENSION(DIM1) :: buf2 ! Data buffer
+ INTEGER, DIMENSION(DIM1) :: bufr2 ! Data buffer
+ REAL, DIMENSION(DIM1), TARGET :: buf3 ! Data buffer
+ REAL, DIMENSION(DIM1) , TARGET :: bufr3 ! Data buffer
+ DOUBLE PRECISION, DIMENSION(DIM1), TARGET :: buf4 ! Data buffer
+ DOUBLE PRECISION, DIMENSION(DIM1), TARGET :: bufr4 ! Data buffer
+ INTEGER :: i, n ! general purpose integer
+ INTEGER(SIZE_T) :: i_sz, j_sz ! general purpose integer
+ INTEGER :: has ! general purpose integer
+ INTEGER :: type_class
+ INTEGER(SIZE_T) :: type_size
+ LOGICAL :: path_valid ! status of the path
+ CHARACTER(LEN=6) :: chr_exact
+ CHARACTER(LEN=8) :: chr_lg
+ TYPE(C_PTR) :: f_ptr
+
+ ! vl data
+ TYPE vl
+ INTEGER, DIMENSION(:), POINTER :: DATA
+ END TYPE vl
+ TYPE(vl), DIMENSION(:), ALLOCATABLE, TARGET :: ptr
+ TYPE(hvl_t), DIMENSION(1:2), TARGET :: wdata ! Array of vlen structures
+ TYPE(hvl_t), DIMENSION(1:2), TARGET :: rdata ! Pointer to vlen structures
+ INTEGER(hsize_t), DIMENSION(1:1) :: dims_vl = (/2/)
+ INTEGER, DIMENSION(:), POINTER :: ptr_r
+ INTEGER(HID_T) :: type_id
+
+ !
+ ! Initialize FORTRAN predefined datatypes.
+ !
+ CALL h5open_f(errcode)
+
+ !
+ ! Create a new file using default properties.
+ !
+ CALL h5fcreate_f(filename, H5F_ACC_TRUNC_F, file_id, errcode)
+
+ !
+ ! Initialize the data array.
+ !
+ n = 1
+ DO i = 1, DIM1
+ buf2(i) = n
+ buf3(i) = n
+ buf4(i) = n
+ n = n + 1
+ END DO
+
+ !
+ ! Initialize variable-length data. wdata(1) is a countdown of
+ ! length LEN0, wdata(2) is a Fibonacci sequence of length LEN1.
+ !
+ wdata(1)%len = LEN0
+ wdata(2)%len = LEN1
+
+ ALLOCATE( ptr(1:2) )
+ ALLOCATE( ptr(1)%data(1:wdata(1)%len) )
+ ALLOCATE( ptr(2)%data(1:wdata(2)%len) )
+
+ DO i_sz=1, wdata(1)%len
+ ptr(1)%data(i_sz) = INT(wdata(1)%len) - INT(i_sz) + 1 ! 3 2 1
+ ENDDO
+ wdata(1)%p = C_LOC(ptr(1)%data(1))
+
+ ptr(2)%data(1:2) = 1
+ DO i_sz = 3, wdata(2)%len
+ ptr(2)%data(i_sz) = ptr(2)%data(i_sz-1_size_t) + ptr(2)%data(i_sz-2_size_t) ! (1 1 2 3 5 8 etc.)
+ ENDDO
+ wdata(2)%p = C_LOC(ptr(2)%data(1))
+
+ !-------------------------------------------------------------------------
+ ! int
+ !-------------------------------------------------------------------------
+
+ CALL test_begin(' Make/Read datasets (integer) ')
+
+ !
+ ! write dataset.
+ !
+ CALL h5ltmake_dataset_int_f(file_id, dsetname2, rank, dims, buf2, errcode)
+
+ !
+ ! read dataset.
+ !
+ CALL h5ltread_dataset_int_f(file_id, dsetname2, bufr2, dims, errcode)
+
+ !
+ ! compare read and write buffers.
+ !
+ DO i = 1, DIM1
+ IF ( buf2(i) .NE. bufr2(i) ) THEN
+ PRINT *, 'read buffer differs from write buffer'
+ PRINT *, bufr2(i), ' and ', buf2(i)
+ STOP
+ ENDIF
+ END DO
+
+ CALL passed()
+
+
+ !-------------------------------------------------------------------------
+ ! real
+ !-------------------------------------------------------------------------
+
+ CALL test_begin(' Make/Read datasets (float) ')
+
+
+ !
+ ! write dataset.
+ !
+ f_ptr = C_LOC(buf3(1))
+ CALL h5ltmake_dataset_f(file_id, dsetname3, rank, dims, H5T_NATIVE_REAL, f_ptr, errcode)
+
+ !
+ ! read dataset.
+ !
+ f_ptr = C_LOC(bufr3(1))
+ CALL h5ltread_dataset_f(file_id, dsetname3, H5T_NATIVE_REAL, f_ptr, errcode)
+
+ !
+ ! compare read and write buffers.
+ !
+ DO i = 1, DIM1
+ CALL VERIFY("h5ltread_dataset_f", buf3(i), bufr3(i), errcode)
+ IF (errcode .NE.0 ) THEN
+ PRINT *, 'read buffer differs from write buffer'
+ PRINT *, bufr3(i), ' and ', buf3(i)
+ STOP
+ ENDIF
+ END DO
+
+ CALL passed()
+
+ !-------------------------------------------------------------------------
+ ! double
+ !-------------------------------------------------------------------------
+
+ CALL test_begin(' Make/Read datasets (double) ')
+
+
+ !
+ ! write dataset.
+ !
+ !f_ptr = C_LOC(buf4(1))
+ !CALL h5ltmake_dataset_f(file_id, dsetname4, rank, dims, H5T_NATIVE_DOUBLE, f_ptr, errcode)
+ CALL h5ltmake_dataset_double_f(file_id, dsetname4, rank, dims, buf4, errcode)
+
+ !
+ ! read dataset.
+ !
+ !f_ptr = C_LOC(buf4(1))
+ !CALL h5ltread_dataset_f(file_id, dsetname4, H5T_NATIVE_DOUBLE, f_ptr, errcode)
+ CALL h5ltread_dataset_double_f(file_id, dsetname4, bufr4, dims, errcode)
+
+ !
+ ! compare read and write buffers.
+ !
+ DO i = 1, DIM1
+ CALL VERIFY("h5ltread_dataset_double_f", buf4(i), bufr4(i), errcode)
+ IF (errcode .NE.0 ) THEN
+ PRINT *, 'read buffer differs from write buffer'
+ PRINT *, bufr4(i), ' and ', buf4(i)
+ STOP
+ ENDIF
+ END DO
+
+ CALL passed()
+
+
+ !-------------------------------------------------------------------------
+ ! string
+ !-------------------------------------------------------------------------
+
+ CALL test_begin(' Make/Read datasets (string) ')
+
+
+ !
+ ! write dataset.
+ !
+ CALL h5ltmake_dataset_string_f(file_id, dsetname5, buf1, errcode)
+
+ !
+ ! read dataset.
+ !
+ CALL h5ltread_dataset_string_f(file_id, dsetname5, buf1r, errcode)
+
+ !
+ ! compare read and write buffers.
+ !
+ IF ( buf1 .NE. buf1r ) THEN
+ PRINT *, 'read buffer differs from write buffer'
+ PRINT *, buf1, ' and ', buf1r
+ STOP
+ ENDIF
+
+ CALL passed()
+
+
+ !-------------------------------------------------------------------------
+ ! variable-length dataset
+ !-------------------------------------------------------------------------
+ CALL test_begin(' Make/Read datasets (vl) ')
+ !
+ ! Create variable-length datatype.
+ !
+ CALL H5Tvlen_create_f(H5T_NATIVE_INTEGER, type_id, errcode)
+
+ f_ptr = C_LOC(wdata(1))
+ CALL h5ltmake_dataset_f(file_id, dsetname6, 1, dims_vl, type_id, f_ptr, errcode)
+
+ ! Read the variable-length datatype
+ f_ptr = C_LOC(rdata(1))
+ CALL h5ltread_dataset_f(file_id, dsetname6, type_id, f_ptr, errcode)
+
+ DO i = 1, INT(dims_vl(1))
+ CALL c_f_pointer(rdata(i)%p, ptr_r, [rdata(i)%len] )
+ DO j_sz = 1, rdata(i)%len
+ CALL VERIFY("h5ltread_dataset_f", ptr_r(j_sz), ptr(i)%data(j_sz), errcode)
+ IF (errcode .NE.0 ) THEN
+ PRINT *, 'Writing/Reading variable-length dataset failed'
+ STOP
+ ENDIF
+ ENDDO
+ ENDDO
+
+ CALL H5Tclose_f(type_id, errcode)
+ DEALLOCATE(ptr)
+
+ CALL passed()
+
+ CALL test_begin(' Test h5ltpath_valid_f ')
+ !
+ ! test function h5ltpath_valid_f
+ !
+ chr_exact = "/"//dsetname2 ! test character buffer the exact size needed
+ CALL h5ltpath_valid_f(file_id, chr_exact, .TRUE., path_valid, errcode)
+ IF(errcode.LT.0.OR..NOT.path_valid)THEN
+ PRINT *, 'error in h5ltpath_valid_f'
+ STOP
+ ENDIF
+ chr_lg = "/"//dsetname2 ! test character buffer larger then needed
+ CALL h5ltpath_valid_f(file_id, chr_lg, .TRUE., path_valid, errcode)
+ IF(errcode.LT.0.OR..NOT.path_valid)THEN
+ PRINT *, 'error in h5ltpath_valid_f'
+ STOP
+ ENDIF
+
+ CALL h5ltpath_valid_f(file_id, chr_lg, .FALSE., path_valid, errcode)
+ IF(errcode.LT.0.OR..NOT.path_valid)THEN
+ PRINT *, 'error in h5ltpath_valid_f'
+ STOP
+ ENDIF
+
+ ! Should fail, dataset does not exist
+ CALL h5ltpath_valid_f(file_id, "/"//dsetname2//"junk", .TRUE., path_valid, errcode)
+ IF(errcode.LT.0.OR.path_valid)THEN
+ PRINT *, 'error in h5ltpath_valid_f'
+ STOP
+ ENDIF
+
+ CALL h5ltpath_valid_f(file_id, "/"//dsetname2//"junk", .FALSE., path_valid, errcode)
+ IF(errcode.LT.0.OR.path_valid)THEN
+ PRINT *, 'error in h5ltpath_valid_f'
+ STOP
+ ENDIF
+
+ ! Create a dangling soft link
+ CALL h5lcreate_soft_f("/G2", file_id, "/G3", errcode)
+
+ ! Should pass, does not check for dangled link
+ CALL h5ltpath_valid_f(file_id, "/G3", .FALSE., path_valid, errcode)
+ IF(.NOT.path_valid)THEN
+ PRINT *, 'error in h5ltpath_valid_f'
+ STOP
+ ENDIF
+
+ ! Should fail, dangled link
+ CALL h5ltpath_valid_f(file_id, "/G2", .TRUE., path_valid, errcode)
+ IF(path_valid)THEN
+ PRINT *, 'error in h5ltpath_valid_f'
+ STOP
+ ENDIF
+
+ CALL passed()
+
+ CALL test_begin(' Get dataset dimensions/info ')
+
+ !-------------------------------------------------------------------------
+ ! h5ltget_dataset_ndims_f
+ !-------------------------------------------------------------------------
+
+ CALL h5ltget_dataset_ndims_f(file_id, dsetname4, rankr, errcode)
+ IF ( rankr .NE. rank ) THEN
+ PRINT *, 'h5ltget_dataset_ndims_f return error'
+ STOP
+ ENDIF
+
+ !-------------------------------------------------------------------------
+ ! test h5ltfind_dataset_f function
+ !-------------------------------------------------------------------------
+
+
+ has = h5ltfind_dataset_f(file_id,dsetname4)
+ IF ( has .NE. 1 ) THEN
+ PRINT *, 'h5ltfind_dataset_f return error'
+ STOP
+ ENDIF
+
+ !-------------------------------------------------------------------------
+ ! test h5ltget_dataset_info_f function
+ !-------------------------------------------------------------------------
+
+ CALL h5ltget_dataset_info_f(file_id,dsetname4,dimsr,type_class,type_size,errcode )
+
+ !
+ ! compare dimensions
+ !
+ DO i = 1, rank
+ IF ( dimsr(i) .NE. dims(i) ) THEN
+ PRINT *, 'dimensions differ '
+ STOP
+ ENDIF
+ END DO
+
+ IF ( type_class .NE. 1 ) THEN ! H5T_FLOAT
+ PRINT *, 'wrong type class '
+ STOP
+ ENDIF
+
+ CALL passed()
+
+ !
+ ! Close the file.
+ !
+ CALL h5fclose_f(file_id, errcode)
+ !
+ ! Close FORTRAN predefined datatypes.
+ !
+ CALL h5close_f(errcode)
+
+ !
+ ! end function.
+ !
+ END SUBROUTINE test_datasets
- has = h5ltfind_dataset_f(file_id,dsetname4)
- IF ( has .NE. 1 ) THEN
- PRINT *, 'h5ltfind_dataset_f return error'
- STOP
- ENDIF
-
!-------------------------------------------------------------------------
- ! test h5ltget_dataset_info_f function
+ ! test_attributes
!-------------------------------------------------------------------------
- CALL h5ltget_dataset_info_f(file_id,dsetname4,dimsr,type_class,type_size,errcode )
-
- !
- ! compare dimensions
- !
- DO i = 1, rank
- IF ( dimsr(i) .NE. dims(i) ) THEN
- PRINT *, 'dimensions differ '
- STOP
- ENDIF
- END DO
+ SUBROUTINE test_attributes()
- IF ( type_class .NE. 1 ) THEN ! H5T_FLOAT
- PRINT *, 'wrong type class '
- STOP
- ENDIF
+ IMPLICIT NONE
- CALL passed()
-
- !
- ! Close the file.
- !
- CALL h5fclose_f(file_id, errcode)
- !
- ! Close FORTRAN predefined datatypes.
- !
- CALL h5close_f(errcode)
-
- !
- ! end function.
- !
-END SUBROUTINE test_datasets
-
-
-!-------------------------------------------------------------------------
-! test_attributes
-!-------------------------------------------------------------------------
-
-SUBROUTINE test_attributes()
-
- USE, INTRINSIC :: ISO_C_BINDING
- USE H5LT ! module of H5LT
- USE HDF5 ! module of HDF5 library
- USE TSTLITE ! module for testing lite support routines
-
- IMPLICIT NONE
-
- CHARACTER(len=9), PARAMETER :: filename = "dsetf5.h5"! File name
+ CHARACTER(len=9), PARAMETER :: filename = "dsetf5.h5"! File name
!!$ CHARACTER(len=9), PARAMETER :: filename1 ="tattr.h5" ! C written attribute file
- INTEGER(HID_T) :: file_id ! File identifier
- ! INTEGER(HID_T) :: file_id1
- INTEGER, PARAMETER :: DIM1 = 10 ! Dimension of array
- CHARACTER(LEN=5), PARAMETER :: attrname2 = "attr2" ! Attribute name
- CHARACTER(LEN=5), PARAMETER :: attrname3 = "attr3" ! Attribute name
- CHARACTER(LEN=5), PARAMETER :: attrname4 = "attr4" ! Attribute name
- CHARACTER(LEN=5), PARAMETER :: attrname5 = "attr5" ! Attribute name
- CHARACTER(LEN=8), PARAMETER :: buf1 = "mystring" ! Data buffer
+ INTEGER(HID_T) :: file_id ! File identifier
+ ! INTEGER(HID_T) :: file_id1
+ INTEGER, PARAMETER :: DIM1 = 10 ! Dimension of array
+ CHARACTER(LEN=5), PARAMETER :: attrname2 = "attr2" ! Attribute name
+ CHARACTER(LEN=5), PARAMETER :: attrname3 = "attr3" ! Attribute name
+ CHARACTER(LEN=5), PARAMETER :: attrname4 = "attr4" ! Attribute name
+ CHARACTER(LEN=5), PARAMETER :: attrname5 = "attr5" ! Attribute name
+ CHARACTER(LEN=8), PARAMETER :: buf1 = "mystring" ! Data buffer
!!$ CHARACTER(LEN=16), PARAMETER :: buf_c = "string attribute"
- CHARACTER(LEN=8) :: bufr1 ! Data buffer
- CHARACTER(LEN=10) :: bufr1_lg ! Data buffer
- ! CHARACTER(LEN=16) :: bufr_c ! Data buffer
- ! CHARACTER(LEN=18) :: bufr_c_lg ! Data buffer
- INTEGER, DIMENSION(DIM1) :: buf2 ! Data buffer
- INTEGER, DIMENSION(DIM1) :: bufr2 ! Data buffer
- REAL, DIMENSION(DIM1), target :: buf3 ! Data buffer
- REAL, DIMENSION(DIM1), target :: bufr3 ! Data buffer
- DOUBLE PRECISION, DIMENSION(DIM1), TARGET :: buf4 ! Data buffer
- DOUBLE PRECISION, DIMENSION(DIM1), TARGET :: bufr4 ! Data buffer
- INTEGER :: errcode ! Error flag
- INTEGER :: i, n ! general purpose integer
- INTEGER(SIZE_T) size ! size of attribute array
- INTEGER :: rankr ! rank
- INTEGER(HSIZE_T), DIMENSION(1) :: dimsr ! attribute dimensions
- INTEGER :: type_class
- INTEGER(SIZE_T) :: type_size
- INTEGER(HSIZE_T), DIMENSION(1) :: dims = (/DIM1/) ! Dataset dimensions
- INTEGER :: rank = 1 ! Dataset rank
- CHARACTER(LEN=5), PARAMETER :: dsetname1 = "dset1" ! Dataset name
- INTEGER, DIMENSION(DIM1) :: buf ! Data buffer
- INTEGER(SIZE_T) :: SizeOf_buf_type
- TYPE(C_PTR) :: f_ptr
-
- !
- ! Initialize FORTRAN predefined datatypes.
- !
- CALL h5open_f(errcode)
- !
- ! Create a new file using default properties.
- !
- CALL h5fcreate_f(filename, H5F_ACC_TRUNC_F, file_id, errcode)
- !
- ! make a dataset.
- !
- CALL h5ltmake_dataset_int_f(file_id, dsetname1, rank, dims, buf, errcode)
-
- !
- ! Initialize the data array.
- !
- size = DIM1
- n = 1
- DO i = 1, DIM1
- buf2(i) = n
- buf3(i) = n
- buf4(i) = n
- n = n + 1
- END DO
-
-
- !-------------------------------------------------------------------------
- ! int
- !-------------------------------------------------------------------------
-
- CALL test_begin(' Set/Get attributes int ')
-
-
- !
- ! write attribute.
- !
- CALL h5ltset_attribute_int_f(file_id,dsetname1,attrname2,buf2,size,errcode)
-
- !
- ! read attribute.
- !
- CALL h5ltget_attribute_int_f(file_id,dsetname1,attrname2,bufr2,errcode)
-
- !
- ! compare read and write buffers.
- !
- DO i = 1, DIM1
- IF ( buf2(i) .NE. bufr2(i) ) THEN
- PRINT *, 'read buffer differs from write buffer'
- PRINT *, bufr2(i), ' and ', buf2(i)
- STOP
- ENDIF
- END DO
-
- CALL passed()
-
- !-------------------------------------------------------------------------
- ! float
- !-------------------------------------------------------------------------
-
- CALL test_begin(' Set/Get attributes float ')
-
-
- !
- ! write attribute.
- !
+ CHARACTER(LEN=8) :: bufr1 ! Data buffer
+ CHARACTER(LEN=10) :: bufr1_lg ! Data buffer
+ ! CHARACTER(LEN=16) :: bufr_c ! Data buffer
+ ! CHARACTER(LEN=18) :: bufr_c_lg ! Data buffer
+ INTEGER, DIMENSION(DIM1) :: buf2 ! Data buffer
+ INTEGER, DIMENSION(DIM1) :: bufr2 ! Data buffer
+ REAL, DIMENSION(DIM1), target :: buf3 ! Data buffer
+ REAL, DIMENSION(DIM1), target :: bufr3 ! Data buffer
+ DOUBLE PRECISION, DIMENSION(DIM1), TARGET :: buf4 ! Data buffer
+ DOUBLE PRECISION, DIMENSION(DIM1), TARGET :: bufr4 ! Data buffer
+ INTEGER :: errcode ! Error flag
+ INTEGER :: i, n ! general purpose integer
+ INTEGER(SIZE_T) size ! size of attribute array
+ INTEGER :: rankr ! rank
+ INTEGER(HSIZE_T), DIMENSION(1) :: dimsr ! attribute dimensions
+ INTEGER :: type_class
+ INTEGER(SIZE_T) :: type_size
+ INTEGER(HSIZE_T), DIMENSION(1) :: dims = (/DIM1/) ! Dataset dimensions
+ INTEGER :: rank = 1 ! Dataset rank
+ CHARACTER(LEN=5), PARAMETER :: dsetname1 = "dset1" ! Dataset name
+ INTEGER, DIMENSION(DIM1) :: buf ! Data buffer
+ INTEGER(SIZE_T) :: SizeOf_buf_type
+ TYPE(C_PTR) :: f_ptr
+
+ !
+ ! Initialize FORTRAN predefined datatypes.
+ !
+ CALL h5open_f(errcode)
+ !
+ ! Create a new file using default properties.
+ !
+ CALL h5fcreate_f(filename, H5F_ACC_TRUNC_F, file_id, errcode)
+ !
+ ! make a dataset.
+ !
+ CALL h5ltmake_dataset_int_f(file_id, dsetname1, rank, dims, buf, errcode)
+
+ !
+ ! Initialize the data array.
+ !
+ size = DIM1
+ n = 1
+ DO i = 1, DIM1
+ buf2(i) = n
+ buf3(i) = n
+ buf4(i) = n
+ n = n + 1
+ END DO
+
+
+ !-------------------------------------------------------------------------
+ ! int
+ !-------------------------------------------------------------------------
+
+ CALL test_begin(' Set/Get attributes int ')
+
+
+ !
+ ! write attribute.
+ !
+ CALL h5ltset_attribute_int_f(file_id,dsetname1,attrname2,buf2,size,errcode)
+
+ !
+ ! read attribute.
+ !
+ CALL h5ltget_attribute_int_f(file_id,dsetname1,attrname2,bufr2,errcode)
+
+ !
+ ! compare read and write buffers.
+ !
+ DO i = 1, DIM1
+ IF ( buf2(i) .NE. bufr2(i) ) THEN
+ PRINT *, 'read buffer differs from write buffer'
+ PRINT *, bufr2(i), ' and ', buf2(i)
+ STOP
+ ENDIF
+ END DO
+
+ CALL passed()
+
+ !-------------------------------------------------------------------------
+ ! float
+ !-------------------------------------------------------------------------
+
+ CALL test_begin(' Set/Get attributes float ')
+
+
+ !
+ ! write attribute.
+ !
#ifdef H5_FORTRAN_HAVE_STORAGE_SIZE
- SizeOf_buf_type = STORAGE_SIZE(buf3(1), c_size_t)/STORAGE_SIZE(c_char_'a',c_size_t)
+ SizeOf_buf_type = STORAGE_SIZE(buf3(1), c_size_t)/STORAGE_SIZE(c_char_'a',c_size_t)
#else
- SizeOf_buf_type = SIZEOF(buf3(1))
+ SizeOf_buf_type = SIZEOF(buf3(1))
#endif
- f_ptr = C_LOC(buf3(1))
- CALL h5ltset_attribute_f(file_id,dsetname1,attrname3,f_ptr,"REAL", SizeOf_buf_type, size,errcode)
- !CALL h5ltset_attribute_float_f(file_id,dsetname1,attrname3,buf3,size,errcode)
- !
- ! read attribute.
- !
+ f_ptr = C_LOC(buf3(1))
+ CALL h5ltset_attribute_f(file_id,dsetname1,attrname3,f_ptr,"REAL", SizeOf_buf_type, size,errcode)
+ !CALL h5ltset_attribute_float_f(file_id,dsetname1,attrname3,buf3,size,errcode)
+ !
+ ! read attribute.
+ !
#ifdef H5_FORTRAN_HAVE_STORAGE_SIZE
- SizeOf_buf_type = STORAGE_SIZE(bufr3(1), c_size_t)/STORAGE_SIZE(c_char_'a',c_size_t)
+ SizeOf_buf_type = STORAGE_SIZE(bufr3(1), c_size_t)/STORAGE_SIZE(c_char_'a',c_size_t)
#else
- SizeOf_buf_type = SIZEOF(bufr3(1))
+ SizeOf_buf_type = SIZEOF(bufr3(1))
#endif
- f_ptr = C_LOC(bufr3(1))
- CALL h5ltget_attribute_f(file_id,dsetname1,attrname3,f_ptr,"REAL",SizeOf_buf_type,errcode)
- !CALL h5ltget_attribute_float_f(file_id,dsetname1,attrname3,bufr3,errcode)
+ f_ptr = C_LOC(bufr3(1))
+ CALL h5ltget_attribute_f(file_id,dsetname1,attrname3,f_ptr,"REAL",SizeOf_buf_type,errcode)
+ !CALL h5ltget_attribute_float_f(file_id,dsetname1,attrname3,bufr3,errcode)
- !
- ! compare read and write buffers.
- !
- DO i = 1, DIM1
- IF ( buf3(i) .NE. bufr3(i) ) THEN
- PRINT *, 'read buffer differs from write buffer'
- PRINT *, bufr3(i), ' and ', buf3(i)
- STOP
- ENDIF
- END DO
+ !
+ ! compare read and write buffers.
+ !
+ DO i = 1, DIM1
+ CALL VERIFY("h5ltget_attribute_f",buf3(i), bufr3(i), errcode)
+ IF (errcode .NE.0 ) THEN
+ PRINT *, 'read buffer differs from write buffer'
+ PRINT *, bufr3(i), ' and ', buf3(i)
+ STOP
+ ENDIF
+ END DO
- CALL passed()
+ CALL passed()
- !-------------------------------------------------------------------------
- ! double
- !-------------------------------------------------------------------------
+ !-------------------------------------------------------------------------
+ ! double
+ !-------------------------------------------------------------------------
#ifdef H5_FORTRAN_HAVE_STORAGE_SIZE
- SizeOf_buf_type = STORAGE_SIZE(buf4(1), c_size_t)/STORAGE_SIZE(c_char_'a',c_size_t)
+ SizeOf_buf_type = STORAGE_SIZE(buf4(1), c_size_t)/STORAGE_SIZE(c_char_'a',c_size_t)
#else
- SizeOf_buf_type = SIZEOF(buf4(1))
+ SizeOf_buf_type = SIZEOF(buf4(1))
#endif
- IF(SizeOf_buf_type.LT.16)THEN ! MSB can't handle 16 byte reals
+ IF(SizeOf_buf_type.LT.16)THEN ! MSB can't handle 16 byte reals
- CALL test_begin(' Set/Get attributes double ')
+ CALL test_begin(' Set/Get attributes double ')
- !
- ! write attribute.
- !
- f_ptr = C_LOC(buf4(1))
- CALL h5ltset_attribute_f(file_id,dsetname1,attrname4,f_ptr,"real", SizeOf_buf_type, size, errcode)
+ !
+ ! write attribute.
+ !
+ f_ptr = C_LOC(buf4(1))
+ CALL h5ltset_attribute_f(file_id,dsetname1,attrname4,f_ptr,"real", SizeOf_buf_type, size, errcode)
- ! CALL h5ltset_attribute_double_f(file_id,dsetname1,attrname4,buf4, size, errcode)
+ ! CALL h5ltset_attribute_double_f(file_id,dsetname1,attrname4,buf4, size, errcode)
- !
- ! read attribute.
- !
+ !
+ ! read attribute.
+ !
#ifdef H5_FORTRAN_HAVE_STORAGE_SIZE
- SizeOf_buf_type = STORAGE_SIZE(bufr4(1), c_size_t)/STORAGE_SIZE(c_char_'a',c_size_t)
+ SizeOf_buf_type = STORAGE_SIZE(bufr4(1), c_size_t)/STORAGE_SIZE(c_char_'a',c_size_t)
#else
- SizeOf_buf_type = SIZEOF(bufr4(1))
+ SizeOf_buf_type = SIZEOF(bufr4(1))
#endif
- f_ptr = C_LOC(bufr4(1))
- CALL h5ltget_attribute_f(file_id,dsetname1,attrname4,f_ptr,"REAL",SizeOf_buf_type,errcode)
-
- !
- ! compare read and write buffers.
- !
- DO i = 1, DIM1
- IF ( buf4(i) .NE. bufr4(i) ) THEN
- PRINT *, 'read buffer differs from write buffer'
- PRINT *, bufr4(i), ' and ', buf4(i)
- STOP
- ENDIF
- END DO
-
- CALL passed()
-
- ENDIF
-
- !-------------------------------------------------------------------------
- ! string
- !-------------------------------------------------------------------------
-
- CALL test_begin(' Set/Get attributes string ')
-
- !
- ! write attribute.
- !
- CALL h5ltset_attribute_string_f(file_id,dsetname1,attrname5,buf1,errcode)
-
- !
- ! read attribute into a fortran character buf that is the same size as buf1.
- !
- CALL h5ltget_attribute_string_f(file_id,dsetname1,attrname5,bufr1,errcode)
-
- !
- ! compare read and write buffers.
- !
- IF ( buf1 .NE. bufr1 ) THEN
- PRINT *, 'read buffer differs from write buffer'
- PRINT *, buf1, ' and ', bufr1
- STOP
- ENDIF
-
- !
- ! read attribute into a fortran character buf that is larger then buf1.
- !
- CALL h5ltget_attribute_string_f(file_id,dsetname1,attrname5,bufr1_lg,errcode)
-
- !
- ! compare read and write buffers, make sure C NULL character was removed.
- !
- IF ( buf1(1:8) .NE. bufr1_lg(1:8) .AND. bufr1_lg(9:10) .NE. ' ' ) THEN
- PRINT *, 'larger read buffer differs from write buffer'
- PRINT *, buf1, ' and ', bufr1_lg
- STOP
- ENDIF
-
- !
- ! ** Test reading a string that was created with a C program **
- !
+ f_ptr = C_LOC(bufr4(1))
+ CALL h5ltget_attribute_f(file_id,dsetname1,attrname4,f_ptr,"REAL",SizeOf_buf_type,errcode)
+
+ !
+ ! compare read and write buffers.
+ !
+ DO i = 1, DIM1
+ CALL VERIFY("h5ltget_attribute_f",buf4(i), bufr4(i), errcode)
+ IF (errcode .NE.0 ) THEN
+ PRINT *, 'read buffer differs from write buffer'
+ PRINT *, bufr4(i), ' and ', buf4(i)
+ STOP
+ ENDIF
+ END DO
+
+ CALL passed()
+
+ ENDIF
+
+ !-------------------------------------------------------------------------
+ ! string
+ !-------------------------------------------------------------------------
+
+ CALL test_begin(' Set/Get attributes string ')
+
+ !
+ ! write attribute.
+ !
+ CALL h5ltset_attribute_string_f(file_id,dsetname1,attrname5,buf1,errcode)
+
+ !
+ ! read attribute into a fortran character buf that is the same size as buf1.
+ !
+ CALL h5ltget_attribute_string_f(file_id,dsetname1,attrname5,bufr1,errcode)
+
+ !
+ ! compare read and write buffers.
+ !
+ IF ( buf1 .NE. bufr1 ) THEN
+ PRINT *, 'read buffer differs from write buffer'
+ PRINT *, buf1, ' and ', bufr1
+ STOP
+ ENDIF
+
+ !
+ ! read attribute into a fortran character buf that is larger then buf1.
+ !
+ CALL h5ltget_attribute_string_f(file_id,dsetname1,attrname5,bufr1_lg,errcode)
+
+ !
+ ! compare read and write buffers, make sure C NULL character was removed.
+ !
+ IF ( buf1(1:8) .NE. bufr1_lg(1:8) .AND. bufr1_lg(9:10) .NE. ' ' ) THEN
+ PRINT *, 'larger read buffer differs from write buffer'
+ PRINT *, buf1, ' and ', bufr1_lg
+ STOP
+ ENDIF
+
+ !
+ ! ** Test reading a string that was created with a C program **
+ !
!!$ CALL h5fopen_f(filename1, H5F_ACC_RDONLY_F, file_id1, errcode)
!!$
@@ -1942,59 +1944,58 @@ SUBROUTINE test_attributes()
!!$ CALL h5fclose_f(file_id1, errcode)
- CALL passed()
+ CALL passed()
- !-------------------------------------------------------------------------
- ! get attribute rank
- !-------------------------------------------------------------------------
+ !-------------------------------------------------------------------------
+ ! get attribute rank
+ !-------------------------------------------------------------------------
- CALL test_begin(' Get attribute rank/info ')
+ CALL test_begin(' Get attribute rank/info ')
- CALL h5ltget_attribute_ndims_f(file_id,dsetname1,attrname2,rankr,errcode)
+ CALL h5ltget_attribute_ndims_f(file_id,dsetname1,attrname2,rankr,errcode)
- IF ( rankr .NE. 1 ) THEN
- PRINT *, 'h5ltget_attribute_ndims_f return error'
- STOP
- ENDIF
+ IF ( rankr .NE. 1 ) THEN
+ PRINT *, 'h5ltget_attribute_ndims_f return error'
+ STOP
+ ENDIF
- CALL h5ltget_attribute_info_f(file_id,dsetname1,attrname2,dimsr,type_class,type_size,errcode)
+ CALL h5ltget_attribute_info_f(file_id,dsetname1,attrname2,dimsr,type_class,type_size,errcode)
- !
- ! compare dimensions
- !
- DO i = 1, rank
- IF ( dimsr(i) .NE. dims(i) ) THEN
- PRINT *, 'dimensions differ '
- STOP
- ENDIF
- END DO
+ !
+ ! compare dimensions
+ !
+ DO i = 1, rank
+ IF ( dimsr(i) .NE. dims(i) ) THEN
+ PRINT *, 'dimensions differ '
+ STOP
+ ENDIF
+ END DO
- !
- ! Close the file.
- !
- CALL h5fclose_f(file_id, errcode)
- !
- ! Close FORTRAN predefined datatypes.
- !
- CALL h5close_f(errcode)
+ !
+ ! Close the file.
+ !
+ CALL h5fclose_f(file_id, errcode)
+ !
+ ! Close FORTRAN predefined datatypes.
+ !
+ CALL h5close_f(errcode)
- CALL passed()
- !
- ! end function.
- !
-END SUBROUTINE test_attributes
+ CALL passed()
+ !
+ ! end function.
+ !
+ END SUBROUTINE test_attributes
END MODULE TSTLITE_TESTS
PROGRAM lite_test
-
+
USE TSTLITE_TESTS ! module for testing lite routines
-
IMPLICIT NONE
-
+
CALL test_dataset1D()
CALL test_dataset2D()
CALL test_dataset3D()
diff --git a/hl/fortran/test/tsttable.F90 b/hl/fortran/test/tsttable.F90
index 822f116..62d291f 100644
--- a/hl/fortran/test/tsttable.F90
+++ b/hl/fortran/test/tsttable.F90
@@ -44,6 +44,9 @@ END MODULE TSTTABLE
MODULE TSTTABLE_TESTS
+ USE TH5_MISC_GEN
+ IMPLICIT NONE
+
CONTAINS
!-------------------------------------------------------------------------
@@ -283,7 +286,8 @@ SUBROUTINE test_table1()
! compare read and write buffers.
!
DO i = 1, nrecords
- IF ( bufrr(i) .NE. bufr(i) ) THEN
+ CALL VERIFY("h5tbread_field_name_f", bufrr(i), bufr(i), errcode)
+ IF (errcode .NE.0 ) THEN
PRINT *, 'read buffer differs from write buffer'
PRINT *, bufrr(i), ' and ', bufr(i)
STOP
@@ -298,7 +302,8 @@ SUBROUTINE test_table1()
! compare read and write buffers.
!
DO i = 1, nrecords
- IF ( bufdr(i) .NE. bufd(i) ) THEN
+ CALL VERIFY("h5tbread_field_name_f", bufdr(i), bufd(i), errcode)
+ IF (errcode .NE.0 ) THEN
PRINT *, 'read buffer differs from write buffer'
PRINT *, bufdr(i), ' and ', bufd(i)
STOP
@@ -315,7 +320,8 @@ SUBROUTINE test_table1()
! compare read and write buffers.
!
DO i = 1, nrecords
- IF ( bufrr(i) .NE. bufr(i) ) THEN
+ CALL VERIFY("h5tbread_field_name_f", bufrr(i), bufr(i), errcode)
+ IF (errcode .NE.0 ) THEN
PRINT *, 'read buffer differs from write buffer'
PRINT *, bufrr(i), ' and ', bufr(i)
STOP
@@ -362,7 +368,8 @@ SUBROUTINE test_table1()
! compare read and write buffers.
!
DO i = 1, nrecords
- IF ( bufsr(i) .NE. bufs(i) ) THEN
+ CALL VERIFY("h5tbread_field_index_f", bufsr(i), bufs(i), errcode)
+ IF (errcode .NE.0 ) THEN
PRINT *, 'read buffer differs from write buffer'
PRINT *, bufsr(i), ' and ', bufs(i)
STOP
@@ -376,7 +383,8 @@ SUBROUTINE test_table1()
! compare read and write buffers.
!
DO i = 1, nrecords
- IF ( bufir(i) .NE. bufi(i) ) THEN
+ CALL VERIFY("h5tbread_field_index_f", bufir(i), bufi(i), errcode)
+ IF (errcode .NE.0 ) THEN
PRINT *, 'read buffer differs from write buffer'
PRINT *, bufir(i), ' and ', bufi(i)
STOP
@@ -390,7 +398,8 @@ SUBROUTINE test_table1()
! compare read and write buffers.
!
DO i = 1, nrecords
- IF ( bufrr(i) .NE. bufr(i) ) THEN
+ CALL VERIFY("h5tbread_field_index_f", bufrr(i), bufr(i), errcode)
+ IF (errcode .NE.0 ) THEN
PRINT *, 'read buffer differs from write buffer'
PRINT *, bufrr(i), ' and ', bufr(i)
STOP
@@ -404,7 +413,8 @@ SUBROUTINE test_table1()
! compare read and write buffers.
!
DO i = 1, nrecords
- IF ( bufdr(i) .NE. bufd(i) ) THEN
+ CALL VERIFY("h5tbread_field_index_f", bufdr(i), bufd(i), errcode)
+ IF (errcode .NE.0 ) THEN
PRINT *, 'read buffer differs from write buffer'
PRINT *, bufdr(i), ' and ', bufd(i)
STOP
@@ -419,7 +429,8 @@ SUBROUTINE test_table1()
! compare read and write buffers.
!
DO i = 1, nrecords
- IF ( bufrr(i) .NE. bufr(i) ) THEN
+ CALL VERIFY("h5tbread_field_index_f", bufrr(i), bufr(i), errcode)
+ IF (errcode .NE.0 ) THEN
PRINT *, 'read buffer differs from write buffer'
PRINT *, bufrr(i), ' and ', bufr(i)
STOP
@@ -444,7 +455,8 @@ SUBROUTINE test_table1()
! compare read and write buffers.
!
DO i = 1, nrecords
- IF ( bufrr(i) .NE. bufr(i) ) THEN
+ CALL VERIFY("h5tbread_field_index_f", bufrr(i), bufr(i), errcode)
+ IF (errcode .NE.0 ) THEN
PRINT *, 'read buffer differs from write buffer'
PRINT *, bufrr(i), ' and ', bufr(i)
STOP
@@ -670,11 +682,12 @@ SUBROUTINE test_table2()
CALL h5tbread_table_f(file_id, table_name_fill, nfields, dst_size, dst_offset, dst_sizes, f_ptr3, errcode)
DO i = 1, nfields
- IF(r_data(i)%name.NE.fill_data(i)%name.OR. &
- r_data(i)%lati.NE.fill_data(i)%lati.OR. &
- r_data(i)%long.NE.fill_data(i)%long.OR. &
- r_data(i)%pressure.NE.fill_data(i)%pressure.OR. &
- r_data(i)%temperature.NE.fill_data(i)%temperature)THEN
+ CALL VERIFY("h5tbread_table_f", r_data(i)%name, fill_data(i)%name, errcode)
+ CALL VERIFY("h5tbread_table_f", r_data(i)%lati, fill_data(i)%lati, errcode)
+ CALL VERIFY("h5tbread_table_f", r_data(i)%long, fill_data(i)%long, errcode)
+ CALL VERIFY("h5tbread_table_f", r_data(i)%pressure, fill_data(i)%pressure, errcode)
+ CALL VERIFY("h5tbread_table_f", r_data(i)%temperature, fill_data(i)%temperature, errcode)
+ IF (errcode .NE.0 ) THEN
PRINT*,'H5TBmake/read_table_f --filled-- FAILED'
STOP
ENDIF
@@ -693,11 +706,12 @@ SUBROUTINE test_table2()
CALL h5tbread_table_f(file_id, table_name, nfields, dst_size, dst_offset, dst_sizes, f_ptr3, errcode)
DO i = 1, nfields
- IF(r_data(i)%name.NE.p_data(i)%name.OR. &
- r_data(i)%lati.NE.p_data(i)%lati.OR. &
- r_data(i)%long.NE.p_data(i)%long.OR. &
- r_data(i)%pressure.NE.p_data(i)%pressure.OR. &
- r_data(i)%temperature.NE.p_data(i)%temperature)THEN
+ CALL VERIFY("h5tbread_table_f", r_data(i)%name, p_data(i)%name, errcode)
+ CALL VERIFY("h5tbread_table_f", r_data(i)%lati, p_data(i)%lati, errcode)
+ CALL VERIFY("h5tbread_table_f", r_data(i)%long, p_data(i)%long, errcode)
+ CALL VERIFY("h5tbread_table_f", r_data(i)%pressure, p_data(i)%pressure, errcode)
+ CALL VERIFY("h5tbread_table_f", r_data(i)%temperature, p_data(i)%temperature, errcode)
+ IF (errcode .NE.0 ) THEN
PRINT*,'H5TBmake/read_table_f FAILED'
STOP
ENDIF
diff --git a/hl/src/H5DO.c b/hl/src/H5DO.c
index bfadfaa..e2b436a 100644
--- a/hl/src/H5DO.c
+++ b/hl/src/H5DO.c
@@ -165,7 +165,7 @@ H5DOappend(hid_t dset_id, hid_t dxpl_id, unsigned axis, size_t extension,
created_dxpl = TRUE;
} /* end if */
else if(TRUE != H5Pisa_class(dxpl_id, H5P_DATASET_XFER))
- goto done;
+ goto done;
/* Get the dataspace of the dataset */
if(FAIL == (space_id = H5Dget_space(dset_id)))
@@ -219,7 +219,8 @@ H5DOappend(hid_t dset_id, hid_t dxpl_id, unsigned axis, size_t extension,
nelmts = (hsize_t)snelmts;
/* create a memory space */
- mem_space_id = H5Screate_simple(1, &nelmts, NULL);
+ if(FAIL == (mem_space_id = H5Screate_simple(1, &nelmts, NULL)))
+ goto done;
/* Write the data */
if(H5Dwrite(dset_id, memtype, mem_space_id, new_space_id, dxpl_id, buf) < 0)
@@ -237,24 +238,24 @@ H5DOappend(hid_t dset_id, hid_t dxpl_id, unsigned axis, size_t extension,
goto done;
/* No boundary for this axis */
- if(boundary[axis] == 0)
- goto done;
-
- /* Determine whether a boundary is hit or not */
- for(k = start[axis]; k < size[axis]; k++)
- if(!((k + 1) % boundary[axis])) {
- hit = TRUE;
- break;
- }
-
- if(hit) { /* Hit the boundary */
- /* Invoke callback if there is one */
- if(append_cb && append_cb(dset_id, size, udata) < 0)
- goto done;
-
- /* Do a dataset flush */
- if(H5Dflush(dset_id) < 0)
- goto done;
+ if(boundary[axis] != 0) {
+
+ /* Determine whether a boundary is hit or not */
+ for(k = start[axis]; k < size[axis]; k++)
+ if(!((k + 1) % boundary[axis])) {
+ hit = TRUE;
+ break;
+ }
+
+ if(hit) { /* Hit the boundary */
+ /* Invoke callback if there is one */
+ if(append_cb && append_cb(dset_id, size, udata) < 0)
+ goto done;
+
+ /* Do a dataset flush */
+ if(H5Dflush(dset_id) < 0)
+ goto done;
+ } /* end if */
} /* end if */
/* Indicate success */
diff --git a/hl/src/H5LT.c b/hl/src/H5LT.c
index 107e238..b7e0b4a 100644
--- a/hl/src/H5LT.c
+++ b/hl/src/H5LT.c
@@ -894,8 +894,8 @@ hid_t H5LTopen_file_image(void *buf_ptr, size_t buf_size, unsigned flags)
/* set allocation increment to a percentage of the supplied buffer size, or
* a pre-defined minimum increment value, whichever is larger
*/
- if ((buf_prcnt * buf_size) > min_incr)
- alloc_incr = (size_t)(buf_prcnt * buf_size);
+ if ((size_t)(buf_prcnt * (double)buf_size) > min_incr)
+ alloc_incr = (size_t)(buf_prcnt * (double)buf_size);
else
alloc_incr = min_incr;
diff --git a/hl/test/CMakeTests.cmake b/hl/test/CMakeTests.cmake
index 95eca4b..228853d 100644
--- a/hl/test/CMakeTests.cmake
+++ b/hl/test/CMakeTests.cmake
@@ -5,32 +5,44 @@
##############################################################################
##############################################################################
+set (HL_REFERENCE_TEST_FILES
+ dtype_file.txt
+ image8.txt
+ sepia.pal
+ earth.pal
+ image24pixel.txt
+ image24plane.txt
+ usa.wri
+ test_table_be.h5
+ test_table_cray.h5
+ test_table_le.h5
+ dsdata.txt
+ dslat.txt
+ dslon.txt
+ test_ds_be.h5
+ test_ds_le.h5
+ test_ld.h5
+)
+
+# --------------------------------------------------------------------
+#-- Copy the necessary files.
+# --------------------------------------------------------------------
+foreach (h5_file ${HL_REFERENCE_TEST_FILES})
+ HDFTEST_COPY_FILE("${HDF5_HL_TEST_SOURCE_DIR}/${h5_file}" "${HDF5_HL_TEST_BINARY_DIR}/${h5_file}" "hl_test_files")
+endforeach (h5_file ${HL_REFERENCE_TEST_FILES})
+add_custom_target(hl_test_files ALL COMMENT "Copying files needed by hl_test tests" DEPENDS ${hl_test_files_list})
+
# --------------------------------------------------------------------
# Macro used to add a unit test
# --------------------------------------------------------------------
-MACRO (HL_ADD_TEST hl_name files)
+MACRO (HL_ADD_TEST hl_name)
add_test (NAME HL_${hl_name} COMMAND $<TARGET_FILE:hl_${hl_name}>)
if (NOT "${last_test}" STREQUAL "")
set_tests_properties (HL_${hl_name} PROPERTIES DEPENDS ${last_test}
ENVIRONMENT "srcdir=${HDF5_HL_TEST_BINARY_DIR}"
WORKING_DIRECTORY ${HDF5_HL_TEST_BINARY_DIR}
)
- endif (NOT "${last_test}" STREQUAL "")
-
- # --------------------------------------------------------------------
- #-- Copy the necessary files.
- # --------------------------------------------------------------------
- foreach (h5_file ${files})
- set (dest "${HDF5_HL_TEST_BINARY_DIR}/${h5_file}")
- #message (STATUS " Copying HL Test File ${h5_file} to ${dest}")
- add_custom_command (
- TARGET hl_${hl_name}
- PRE_BUILD
- COMMAND ${CMAKE_COMMAND}
- ARGS -E copy_if_different ${HDF5_HL_TEST_SOURCE_DIR}/${h5_file} ${dest}
- )
-
- endforeach (h5_file ${HL_REFERENCE_TEST_FILES})
+ endif ()
ENDMACRO (HL_ADD_TEST)
# Remove any output file left over from previous test run
@@ -73,13 +85,13 @@ if (NOT "${last_test}" STREQUAL "")
endif (NOT "${last_test}" STREQUAL "")
set (last_test "HL_test-clear-objects")
-HL_add_test (test_lite "dtype_file.txt")
-HL_add_test (test_image "image8.txt;sepia.pal;earth.pal;image24pixel.txt;image24plane.txt;usa.wri")
-HL_add_test (test_file_image "")
-HL_add_test (test_table "test_table_be.h5;test_table_cray.h5;test_table_le.h5")
-HL_add_test (test_ds "dsdata.txt;dslat.txt;dslon.txt;test_ds_be.h5;test_ds_le.h5")
-HL_add_test (test_packet "")
-HL_add_test (test_dset_opt "")
-HL_add_test (test_ld "test_ld.h5")
-HL_add_test (test_dset_append "")
+HL_add_test (test_lite )
+HL_add_test (test_image)
+HL_add_test (test_file_image)
+HL_add_test (test_table)
+HL_add_test (test_ds)
+HL_add_test (test_packet)
+HL_add_test (test_dset_opt)
+HL_add_test (test_ld)
+HL_add_test (test_dset_append)
diff --git a/hl/test/gen_test_ld.c b/hl/test/gen_test_ld.c
index 1313d2a..cf7b321 100644
--- a/hl/test/gen_test_ld.c
+++ b/hl/test/gen_test_ld.c
@@ -1,9 +1,5 @@
#include "hdf5.h"
#include "H5LDprivate.h"
-#include <time.h>
-#include <sys/time.h>
-#include <sys/resource.h>
-#include <stdlib.h>
/*
* WATCH.h5: file with various types of datasets for testing--
diff --git a/hl/test/test_dset_append.c b/hl/test/test_dset_append.c
index 0f193d9..a5c9abc 100644
--- a/hl/test/test_dset_append.c
+++ b/hl/test/test_dset_append.c
@@ -16,7 +16,6 @@
#include <stdlib.h>
#include <string.h>
#include "h5hltest.h"
-#include "H5srcdir.h"
#include "H5DOpublic.h"
#include <math.h>
@@ -28,6 +27,7 @@
#endif
#define FILE "test_append.h5"
+#define DNAME_NOTSET "dataset_notset"
#define DNAME_UNLIM "dataset_unlim"
#define DNAME_LESS "dataset_less"
#define DNAME_VARY "dataset_vary"
@@ -36,6 +36,101 @@
#define DBUGNAME1 "dataset_bug1"
#define DBUGNAME2 "dataset_bug2"
+/*-------------------------------------------------------------------------
+ * Function: test_dataset_append_notset
+ *
+ * Purpose: Verify that H5DOappend works properly with default dapl.
+ * That is, H5Pset_append_flush() is not used to set boundary
+ * and callback in dapl.
+ *
+ * Return: Success: 0
+ * Failure: 1
+ *
+ * Programmer: Vailin Choi; Aug 2016
+ *
+ *-------------------------------------------------------------------------
+ */
+static int
+test_dataset_append_notset(hid_t fid)
+{
+ hid_t did = -1; /* Dataset ID */
+ hid_t sid = -1; /* Dataspace ID */
+ hid_t dcpl = -1; /* A copy of dataset creation property */
+ hid_t ffapl = -1; /* The file's file access property list */
+
+ hsize_t dims[2] = {0, 10}; /* Current dimension sizes */
+ hsize_t maxdims[2] = {H5S_UNLIMITED, 20}; /* Maximum dimension sizes */
+ hsize_t chunk_dims[2] = {2,5}; /* Chunk dimension sizes */
+ int lbuf[10]; /* The data buffers */
+ int i, j; /* Local index variables */
+ h5_stat_t sb1, sb2; /* File info */
+
+ TESTING("Append flush with H5DOappend()--append rows with default dapl");
+
+ /* Get the file's file access property list */
+ if((ffapl = H5Fget_access_plist(fid)) < 0)
+ FAIL_STACK_ERROR;
+
+ /* Set to create a chunked dataset with extendible dimensions */
+ if((sid = H5Screate_simple(2, dims, maxdims)) < 0)
+ FAIL_STACK_ERROR;
+ if((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0)
+ FAIL_STACK_ERROR;
+ if(H5Pset_chunk(dcpl, 2, chunk_dims) < 0)
+ FAIL_STACK_ERROR;
+
+ /* Create the dataset */
+ if((did = H5Dcreate2(fid, DNAME_NOTSET, H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR;
+
+ /* Append 6 rows to the dataset */
+ for(i = 0; i < 6; i++) {
+ for(j = 0; j < 10; j++)
+ lbuf[j] = (i * 10) + (j + 1);
+ /* Append without boundary, callback and flush */
+ if(H5DOappend(did, H5P_DEFAULT, 0, (size_t)1, H5T_NATIVE_INT, lbuf) < 0)
+ FAIL_STACK_ERROR;
+ } /* end for */
+
+ /* File size when not flushed */
+ if(HDstat(FILE, &sb1) < 0)
+ TEST_ERROR;
+
+ /* Close the dataset */
+ if(H5Dclose(did) < 0)
+ FAIL_STACK_ERROR;
+
+ /* File size after flushing */
+ if(HDstat(FILE, &sb2) < 0)
+ TEST_ERROR;
+
+ /* File size before flushing should be less */
+ if(sb1.st_size > sb2.st_size)
+ TEST_ERROR;
+
+ /* Closing */
+ if(H5Sclose(sid) < 0)
+ FAIL_STACK_ERROR;
+ if(H5Pclose(dcpl) < 0)
+ FAIL_STACK_ERROR;
+ if(H5Pclose(ffapl) < 0)
+ FAIL_STACK_ERROR;
+
+ PASSED();
+
+ return 0;
+
+error:
+ H5E_BEGIN_TRY {
+ H5Pclose(dcpl);
+ H5Pclose(sid);
+ H5Dclose(did);
+ H5Pclose(ffapl);
+ } H5E_END_TRY;
+
+ return 1;
+} /* test_dataset_append_notset() */
+
/* The callback function for the object flush property */
static herr_t
flush_func(hid_t H5_ATTR_UNUSED obj_id, void *_udata)
@@ -1151,6 +1246,8 @@ int main(void)
if((fid = H5Fcreate(FILE, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
FAIL_STACK_ERROR;
+ nerrors += test_dataset_append_notset(fid);
+
nerrors += test_dataset_append_rows(fid);
flush_ct = 0; /* Reset flush counter */
diff --git a/hl/test/test_dset_opt.c b/hl/test/test_dset_opt.c
index c1e369e..b03ab44 100644
--- a/hl/test/test_dset_opt.c
+++ b/hl/test/test_dset_opt.c
@@ -16,7 +16,6 @@
#include <stdlib.h>
#include <string.h>
#include "h5hltest.h"
-#include "H5srcdir.h"
#include "H5DOpublic.h"
#include <math.h>
diff --git a/hl/test/test_packet_vlen.c b/hl/test/test_packet_vlen.c
index 82c8d1c..f1e4e00 100644
--- a/hl/test/test_packet_vlen.c
+++ b/hl/test/test_packet_vlen.c
@@ -60,7 +60,7 @@ static int test_VLof_atomic(void)
hid_t ptable=H5I_INVALID_HID; /* Packet table identifier */
hid_t vltype=H5I_INVALID_HID; /* Variable length datatype */
hsize_t count; /* Number of records in the table */
- int ii, jj; /* Loop variables */
+ unsigned uu, vv; /* Loop variables */
hvl_t writeBuf[NRECORDS]; /* Buffer to hold data to be written */
hvl_t readBuf[NRECORDS]; /* Buffer to hold read data */
char msg[80]; /* For error message */
@@ -69,15 +69,15 @@ static int test_VLof_atomic(void)
TESTING3(" with vlen of atomic");
/* Allocate and initialize VL data to write (copied from C test) */
- for (ii=0; ii<NRECORDS; ii++) {
- writeBuf[ii].p = HDmalloc((ii+1)*sizeof(unsigned int));
- if (writeBuf[ii].p == NULL) {
- fprintf(stderr, "Cannot allocate memory for VL data! ii=%u\n",ii);
+ for (uu = 0; uu < NRECORDS; uu++) {
+ writeBuf[uu].p = HDmalloc((uu + 1) * sizeof(unsigned int));
+ if (writeBuf[uu].p == NULL) {
+ fprintf(stderr, "Cannot allocate memory for VL data! uu=%u\n", uu);
goto error;
}
- writeBuf[ii].len = ii+1;
- for (jj=0; jj<(ii+1); jj++)
- ((unsigned int *)writeBuf[ii].p)[jj] = ii * 10 + jj;
+ writeBuf[uu].len = uu + 1;
+ for (vv = 0; vv < (uu + 1); vv++)
+ ((unsigned int *)writeBuf[uu].p)[vv] = uu * 10 + vv;
} /* end for */
/* Open the file */
@@ -119,12 +119,12 @@ static int test_VLof_atomic(void)
if (ret < 0)
goto error;
- for (ii = 0; ii < NRECORDS; ii++)
- for (jj=0; jj<(ii+1); jj++)
+ for (uu = 0; uu < NRECORDS; uu++)
+ for (vv = 0; vv < (uu + 1); vv++)
{
- if (((unsigned int *)readBuf[ii].p)[jj] != ((unsigned int *)writeBuf[ii].p)[jj]) {
- printf("Packet %d's value should be %d\n", ii, ((unsigned int *)writeBuf[ii].p)[jj]);
- printf("Packet %d's value in readBuf is %d\n", ii, ((unsigned int *)readBuf[ii].p)[jj]);
+ if (((unsigned int *)readBuf[uu].p)[vv] != ((unsigned int *)writeBuf[uu].p)[vv]) {
+ printf("Packet %u's value should be %d\n", uu, ((unsigned int *)writeBuf[uu].p)[vv]);
+ printf("Packet %u's value in readBuf is %d\n", uu, ((unsigned int *)readBuf[uu].p)[vv]);
}
}
@@ -168,7 +168,7 @@ static int test_VLof_comptype(void)
{
/* Struct that the VL sequences are composed of */
typedef struct {
- int i;
+ unsigned u;
float f;
} VLcomp_t;
hid_t fid=H5I_INVALID_HID; /* Test file identifier */
@@ -178,23 +178,23 @@ static int test_VLof_comptype(void)
hvl_t writeBuf[NRECORDS]; /* Buffer to hold data to be written */
hvl_t readBuf[NRECORDS]; /* Buffer to hold read data */
hsize_t count; /* Number of records in the table */
- int ii, jj; /* Loop variables */
+ unsigned uu, vv; /* Loop variables */
char msg[80]; /* For error message */
herr_t ret;
TESTING3(" with vlen of compound datatypes");
/* Allocate and initialize VL data to write (copied from C test) */
- for (ii=0; ii<NRECORDS; ii++) {
- writeBuf[ii].p = HDmalloc((ii+1)*sizeof(VLcomp_t));
- if(writeBuf[ii].p == NULL) {
- fprintf(stderr, "Cannot allocate memory for VL data! ii=%u\n",ii);
+ for (uu = 0; uu < NRECORDS; uu++) {
+ writeBuf[uu].p = HDmalloc((uu + 1) * sizeof(VLcomp_t));
+ if(writeBuf[uu].p == NULL) {
+ fprintf(stderr, "Cannot allocate memory for VL data! uu=%u\n", uu);
goto error;
}
- writeBuf[ii].len = ii+1;
- for (jj=0; jj<(ii+1); jj++) {
- ((VLcomp_t *)writeBuf[ii].p)[jj].i = ii+jj;
- ((VLcomp_t *)writeBuf[ii].p)[jj].f = (float)((ii+jj)/3.0F);
+ writeBuf[uu].len = uu + 1;
+ for (vv = 0; vv < (uu + 1); vv++) {
+ ((VLcomp_t *)writeBuf[uu].p)[vv].u = uu + vv;
+ ((VLcomp_t *)writeBuf[uu].p)[vv].f = (float)(uu + vv) / 3.0F;
} /* end for */
} /* end for */
@@ -209,7 +209,7 @@ static int test_VLof_comptype(void)
goto error;
/* Insert fields */
- ret = H5Tinsert(cmptype, "i", HOFFSET(VLcomp_t, i), H5T_NATIVE_INT);
+ ret = H5Tinsert(cmptype, "u", HOFFSET(VLcomp_t, u), H5T_NATIVE_UINT);
if (ret < 0)
goto error;
ret = H5Tinsert(cmptype, "f", HOFFSET(VLcomp_t, f), H5T_NATIVE_FLOAT);
@@ -251,15 +251,15 @@ static int test_VLof_comptype(void)
goto error;
/* Compare data read in */
- for (ii = 0; ii < NRECORDS; ii++) {
- if (writeBuf[ii].len != readBuf[ii].len) {
- fprintf(stderr, "%d: VL data length don't match!, writeBuf[%d].len=%d, readBuf[%d].len=%d\n",__LINE__,(int)ii,(int)writeBuf[ii].len,(int)ii,(int)readBuf[ii].len);
+ for (uu = 0; uu < NRECORDS; uu++) {
+ if (writeBuf[uu].len != readBuf[uu].len) {
+ fprintf(stderr, "%d: VL data length don't match!, writeBuf[%u].len=%d, readBuf[%u].len=%d\n", __LINE__, uu, (int)writeBuf[uu].len, uu, (int)readBuf[uu].len);
continue;
} /* write len != read len */
- for (jj=0; jj<(ii+1); jj++) {
- if (((unsigned int *)writeBuf[ii].p)[jj] != ((unsigned int *)readBuf[ii].p)[jj] ) {
- fprintf(stderr, "VL data values don't match!, writeBuf[ii].p[%d]=%d, readBuf[ii].p[%d]=%d\n",(int)jj, (int)((unsigned int *)writeBuf[ii].p)[jj], (int)jj, (int)((unsigned int *)readBuf[ii].p)[jj]);
+ for (vv = 0; vv < (uu + 1); vv++) {
+ if (((unsigned int *)writeBuf[uu].p)[vv] != ((unsigned int *)readBuf[uu].p)[vv] ) {
+ fprintf(stderr, "VL data values don't match!, writeBuf[uu].p[%d]=%d, readBuf[uu].p[%d]=%d\n", vv, (int)((unsigned int *)writeBuf[uu].p)[vv], vv, (int)((unsigned int *)readBuf[uu].p)[vv]);
continue;
} /* write value != read value */
}
@@ -306,7 +306,7 @@ static int test_compound_VL_VLtype(void)
{
/* Struct that the VL sequences are composed of */
typedef struct {
- int i;
+ unsigned u;
float f;
hvl_t v;
} compVLVL_t;
@@ -322,32 +322,32 @@ static int test_compound_VL_VLtype(void)
compVLVL_t writeBuf[NRECORDS];/* Buffer to hold data to be written */
compVLVL_t readBuf[NRECORDS]; /* Buffer to hold read data */
hvl_t *t1, *t2;
- int ii, jj, kk; /* Loop variables */
+ unsigned uu, vv, ww; /* Loop variables */
char msg[80]; /* For error message */
herr_t ret; /* Returned status from a callee */
TESTING3(" with compound datatype containing vlen datatype");
/* Allocate and initialize VL data to write (copied from C test) */
- for (ii=0; ii<NRECORDS; ii++) {
- writeBuf[ii].i = ii*10;
- writeBuf[ii].f = (float)((ii*20)/3.0F);
- writeBuf[ii].v.p = HDmalloc((ii+L1_INCM)*sizeof(hvl_t));
- if (writeBuf[ii].v.p == NULL) {
- fprintf(stderr, "Cannot allocate memory for VL data! ii=%d\n",ii);
+ for (uu = 0; uu < NRECORDS; uu++) {
+ writeBuf[uu].u = uu * 10;
+ writeBuf[uu].f = (float)(uu * 20) / 3.0F;
+ writeBuf[uu].v.p = HDmalloc((uu + L1_INCM) * sizeof(hvl_t));
+ if (writeBuf[uu].v.p == NULL) {
+ fprintf(stderr, "Cannot allocate memory for VL data! uu=%u\n", uu);
goto error;
}
- writeBuf[ii].v.len=ii+L1_INCM;
- for (t1=(hvl_t *)((writeBuf[ii].v).p), jj=0; jj<(ii+L1_INCM); jj++, t1++)
+ writeBuf[uu].v.len = uu + L1_INCM;
+ for (t1 = (hvl_t *)((writeBuf[uu].v).p), vv = 0; vv < (uu + L1_INCM); vv++, t1++)
{
- t1->p = HDmalloc((jj+L2_INCM)*sizeof(unsigned int));
+ t1->p = HDmalloc((vv + L2_INCM) * sizeof(unsigned int));
if (t1->p == NULL) {
- fprintf(stderr, "Cannot allocate memory for VL data! ii=%d\n",ii);
+ fprintf(stderr, "Cannot allocate memory for VL data! uu=%u\n", uu);
goto error;
}
- t1->len = jj+L2_INCM;
- for (kk=0; kk<jj+L2_INCM; kk++)
- ((unsigned int*)t1->p)[kk] = ii*100 + jj*10 + kk;
+ t1->len = vv + L2_INCM;
+ for (ww = 0; ww < vv + L2_INCM; ww++)
+ ((unsigned int *)t1->p)[ww] = uu * 100 + vv * 10 + ww;
}
} /* end for */
@@ -377,7 +377,7 @@ static int test_compound_VL_VLtype(void)
goto error;
/* Insert fields: atomic, atomic, vlen */
- ret = H5Tinsert(comp_vlvl, "i", HOFFSET(compVLVL_t, i), H5T_NATIVE_INT);
+ ret = H5Tinsert(comp_vlvl, "u", HOFFSET(compVLVL_t, u), H5T_NATIVE_UINT);
if (ret < 0)
goto error;
ret = H5Tinsert(comp_vlvl, "f", HOFFSET(compVLVL_t, f), H5T_NATIVE_FLOAT);
@@ -417,29 +417,29 @@ static int test_compound_VL_VLtype(void)
goto error;
/* Compare data read in */
- for (ii = 0; ii < NRECORDS; ii++) {
- if (writeBuf[ii].i != readBuf[ii].i) {
- fprintf(stderr, "Integer components don't match!, writeBuf[%d].i=%d, readBuf[%d].i=%d\n",(int)ii,(int)writeBuf[ii].i,(int)ii,(int)readBuf[ii].i);
+ for (uu = 0; uu < NRECORDS; uu++) {
+ if (writeBuf[uu].u != readBuf[uu].u) {
+ fprintf(stderr, "Integer components don't match!, writeBuf[%u].u=%u, readBuf[%u].u=%u\n", uu, writeBuf[uu].u, uu, readBuf[uu].u);
continue;
} /* end if */
- if (!H5_FLT_ABS_EQUAL(writeBuf[ii].f,readBuf[ii].f)) {
- fprintf(stderr, "Float components don't match!, writeBuf[%d].f=%f, readBuf[%d].f=%f\n",(int)ii,(double)writeBuf[ii].f,(int)ii,(double)readBuf[ii].f);
+ if (!H5_FLT_ABS_EQUAL(writeBuf[uu].f,readBuf[uu].f)) {
+ fprintf(stderr, "Float components don't match!, writeBuf[%u].f=%f, readBuf[%u].f=%f\n", uu, (double)writeBuf[uu].f, uu, (double)readBuf[uu].f);
continue;
} /* end if */
- if (writeBuf[ii].v.len != readBuf[ii].v.len) {
- fprintf(stderr, "%d: VL data length don't match!, writeBuf[%d].v.len=%d, readBuf[%d].v.len=%d\n",__LINE__,(int)ii,(int)writeBuf[ii].v.len,(int)ii,(int)readBuf[ii].v.len);
+ if (writeBuf[uu].v.len != readBuf[uu].v.len) {
+ fprintf(stderr, "%d: VL data length don't match!, writeBuf[%d].v.len=%zu, readBuf[%d].v.len=%zu\n", __LINE__, uu, writeBuf[uu].v.len, uu, readBuf[uu].v.len);
continue;
} /* end if */
- for (t1=(hvl_t *)(writeBuf[ii].v.p), t2=(hvl_t *)(readBuf[ii].v.p), jj=0; (size_t)jj<readBuf[ii].v.len; jj++, t1++, t2++) {
+ for (t1 = (hvl_t *)(writeBuf[uu].v.p), t2 = (hvl_t *)(readBuf[uu].v.p), vv = 0; (size_t)vv < readBuf[uu].v.len; vv++, t1++, t2++) {
if (t1->len != t2->len) {
- fprintf(stderr, "%d: VL data length don't match!, ii=%d, jj=%d, t1->len=%d, t2->len=%d\n",__LINE__,(int)ii,(int)jj,(int)t1->len,(int)t2->len);
+ fprintf(stderr, "%d: VL data length don't match!, uu=%u, vv=%u, t1->len=%zu, t2->len=%zu\n", __LINE__, uu, vv, t1->len, t2->len);
continue;
} /* end if */
- for (kk=0; (size_t)kk<t2->len; kk++) {
- if (((unsigned int *)t1->p)[kk] != ((unsigned int *)t2->p)[kk] ) {
- fprintf(stderr, "VL data values don't match!, t1->p[%d]=%d, t2->p[%d]=%d\n",(int)kk, (int)((unsigned int *)t1->p)[kk], (int)kk, (int)((unsigned int *)t2->p)[kk]);
+ for (ww = 0; (size_t)ww < t2->len; ww++) {
+ if (((unsigned int *)t1->p)[ww] != ((unsigned int *)t2->p)[ww] ) {
+ fprintf(stderr, "VL data values don't match!, t1->p[%u]=%u, t2->p[%u]=%u\n", ww, ((unsigned int *)t1->p)[ww], ww, ((unsigned int *)t2->p)[ww]);
continue;
} /* end if */
} /* end for */
@@ -497,7 +497,7 @@ static int test_VLof_VLtype(void)
hid_t vlofvl=H5I_INVALID_HID; /* VL datatype of VL datatypes */
hsize_t count; /* Number of records in the table */
hvl_t *t1; /* pointer to advance */
- int ii, jj, kk; /* Loop variables */
+ unsigned uu, vv, ww; /* Loop variables */
hvl_t writeBuf[NRECORDS]; /* Buffer to hold data to be written */
hvl_t readBuf[NRECORDS]; /* Buffer to hold read data */
char msg[80]; /* For error message */
@@ -506,23 +506,23 @@ static int test_VLof_VLtype(void)
TESTING3(" with vlen datatype of vlen datatype");
/* Allocate and initialize VL data to write (copied from C test) */
- for (ii=0; ii< NRECORDS; ii++) {
- writeBuf[ii].p = HDmalloc((ii+1)*sizeof(hvl_t));
- if (writeBuf[ii].p == NULL) {
- fprintf(stderr, "Cannot allocate memory for VL data! ii=%u\n",ii);
+ for (uu = 0; uu < NRECORDS; uu++) {
+ writeBuf[uu].p = HDmalloc((uu + 1) * sizeof(hvl_t));
+ if (writeBuf[uu].p == NULL) {
+ fprintf(stderr, "Cannot allocate memory for VL data! uu=%u\n", uu);
goto error;
} /* end if */
- writeBuf[ii].len = ii+1;
- for (t1=(hvl_t *)(writeBuf[ii].p), jj=0; jj<(ii+1); jj++, t1++)
+ writeBuf[uu].len = uu + 1;
+ for (t1=(hvl_t *)(writeBuf[uu].p), vv = 0; vv < (uu + 1); vv++, t1++)
{
- t1->p = HDmalloc((jj+1)*sizeof(unsigned int));
+ t1->p = HDmalloc((vv + 1) * sizeof(unsigned int));
if (t1->p == NULL) {
- fprintf(stderr, "Cannot allocate memory for VL data! ii=%u\n",ii);
+ fprintf(stderr, "Cannot allocate memory for VL data! uu=%u\n", uu);
goto error;
}
- t1->len = jj+1;
- for (kk=0; kk<(jj+1); kk++)
- ((unsigned int *)t1->p)[kk] = ii*100+jj*10+kk;
+ t1->len = vv * 1;
+ for (ww = 0; ww < (vv * 1); ww++)
+ ((unsigned int *)t1->p)[ww] = uu * 100 + vv * 10 + ww;
} /* end for */
} /* end for */
@@ -958,6 +958,8 @@ static herr_t verify_accessors(const char *table_name, herr_t expected_value)
/* Check if the packet table's name matches its associated dataset's. */
*buf = '\0';
name_size = H5Iget_name(dset_id, (char*)buf, NAME_BUF_SIZE);
+ if (name_size < 0)
+ goto error;
VERIFY(HDstrcmp(buf, table_name), "Names of dataset and packet table don't match");
/* Get the packet table's datatype ID */
@@ -1059,7 +1061,7 @@ static int testfl_VLof_atomic(void)
hid_t ptable=H5I_INVALID_HID; /* Packet table identifier */
hid_t vltype=H5I_INVALID_HID; /* Variable length datatype */
hsize_t count; /* Number of records in the table */
- int ii, jj; /* Loop variables */
+ unsigned uu, vv; /* Loop variables */
hvl_t writeBuf[NRECORDS]; /* Buffer to hold data to be written */
hvl_t readBuf[NRECORDS]; /* Buffer to hold read data */
char msg[80]; /* For error message */
@@ -1068,15 +1070,15 @@ static int testfl_VLof_atomic(void)
TESTING3(" with vlen of atomic");
/* Allocate and initialize VL data to write (copied from C test) */
- for (ii=0; ii<NRECORDS; ii++) {
- writeBuf[ii].p = HDmalloc((ii+1)*sizeof(unsigned int));
- if (writeBuf[ii].p == NULL) {
- fprintf(stderr, "Cannot allocate memory for VL data! ii=%u\n",ii);
+ for (uu = 0; uu < NRECORDS; uu++) {
+ writeBuf[uu].p = HDmalloc((uu + 1) * sizeof(unsigned int));
+ if (writeBuf[uu].p == NULL) {
+ fprintf(stderr, "Cannot allocate memory for VL data! uu=%u\n", uu);
goto error;
}
- writeBuf[ii].len = ii+1;
- for (jj=0; jj<(ii+1); jj++)
- ((unsigned int *)writeBuf[ii].p)[jj] = ii * 10 + jj;
+ writeBuf[uu].len = uu + 1;
+ for (vv = 0; vv < (uu + 1); vv++)
+ ((unsigned int *)writeBuf[uu].p)[vv] = uu * 10 + vv;
} /* end for */
/* Open the file */
@@ -1118,12 +1120,12 @@ static int testfl_VLof_atomic(void)
if (ret < 0)
goto error;
- for (ii = 0; ii < NRECORDS; ii++)
- for (jj=0; jj<(ii+1); jj++)
+ for (uu = 0; uu < NRECORDS; uu++)
+ for (vv = 0; vv < (uu + 1); vv++)
{
- if (((unsigned int *)readBuf[ii].p)[jj] != ((unsigned int *)writeBuf[ii].p)[jj]) {
- printf("Packet %d's value should be %d\n", ii, ((unsigned int *)writeBuf[ii].p)[jj]);
- printf("Packet %d's value in readBuf is %d\n", ii, ((unsigned int *)readBuf[ii].p)[jj]);
+ if (((unsigned int *)readBuf[uu].p)[vv] != ((unsigned int *)writeBuf[uu].p)[vv]) {
+ printf("Packet %d's value should be %d\n", uu, ((unsigned int *)writeBuf[uu].p)[vv]);
+ printf("Packet %d's value in readBuf is %d\n", uu, ((unsigned int *)readBuf[uu].p)[vv]);
}
}
@@ -1167,7 +1169,7 @@ static int testfl_VLof_comptype(void)
{
/* Struct that the VL sequences are composed of */
typedef struct {
- int i;
+ unsigned u;
float f;
} VLcomp_t;
hid_t fid=H5I_INVALID_HID; /* Test file identifier */
@@ -1177,23 +1179,23 @@ static int testfl_VLof_comptype(void)
hvl_t writeBuf[NRECORDS]; /* Buffer to hold data to be written */
hvl_t readBuf[NRECORDS]; /* Buffer to hold read data */
hsize_t count; /* Number of records in the table */
- int ii, jj; /* Loop variables */
+ unsigned uu, vv; /* Loop variables */
char msg[80]; /* For error message */
herr_t ret;
TESTING3(" with vlen of compound datatypes");
/* Allocate and initialize VL data to write (copied from C test) */
- for (ii=0; ii<NRECORDS; ii++) {
- writeBuf[ii].p = HDmalloc((ii+1)*sizeof(VLcomp_t));
- if(writeBuf[ii].p == NULL) {
- fprintf(stderr, "Cannot allocate memory for VL data! ii=%u\n",ii);
+ for (uu = 0; uu < NRECORDS; uu++) {
+ writeBuf[uu].p = HDmalloc((uu + 1) * sizeof(VLcomp_t));
+ if(writeBuf[uu].p == NULL) {
+ fprintf(stderr, "Cannot allocate memory for VL data! uu=%u\n", uu);
goto error;
}
- writeBuf[ii].len = ii+1;
- for (jj=0; jj<(ii+1); jj++) {
- ((VLcomp_t *)writeBuf[ii].p)[jj].i = ii+jj;
- ((VLcomp_t *)writeBuf[ii].p)[jj].f = (float)((ii+jj)/3.0F);
+ writeBuf[uu].len = uu + 1;
+ for (vv = 0; vv < (uu + 1); vv++) {
+ ((VLcomp_t *)writeBuf[uu].p)[vv].u = uu + vv;
+ ((VLcomp_t *)writeBuf[uu].p)[vv].f = (float)(uu + vv) / 3.0F;
} /* end for */
} /* end for */
@@ -1208,7 +1210,7 @@ static int testfl_VLof_comptype(void)
goto error;
/* Insert fields */
- ret = H5Tinsert(cmptype, "i", HOFFSET(VLcomp_t, i), H5T_NATIVE_INT);
+ ret = H5Tinsert(cmptype, "u", HOFFSET(VLcomp_t, u), H5T_NATIVE_UINT);
if (ret < 0)
goto error;
ret = H5Tinsert(cmptype, "f", HOFFSET(VLcomp_t, f), H5T_NATIVE_FLOAT);
@@ -1250,15 +1252,15 @@ static int testfl_VLof_comptype(void)
goto error;
/* Compare data read in */
- for (ii = 0; ii < NRECORDS; ii++) {
- if (writeBuf[ii].len != readBuf[ii].len) {
- fprintf(stderr, "%d: VL data length don't match!, writeBuf[%d].len=%d, readBuf[%d].len=%d\n",__LINE__,(int)ii,(int)writeBuf[ii].len,(int)ii,(int)readBuf[ii].len);
+ for (uu = 0; uu < NRECORDS; uu++) {
+ if (writeBuf[uu].len != readBuf[uu].len) {
+ fprintf(stderr, "%d: VL data length don't match!, writeBuf[%u].len=%zu, readBuf[%u].len=%zu\n",__LINE__, uu, writeBuf[uu].len, uu, readBuf[uu].len);
continue;
} /* write len != read len */
- for (jj=0; jj<(ii+1); jj++) {
- if (((unsigned int *)writeBuf[ii].p)[jj] != ((unsigned int *)readBuf[ii].p)[jj] ) {
- fprintf(stderr, "VL data values don't match!, writeBuf[ii].p[%d]=%d, readBuf[ii].p[%d]=%d\n",(int)jj, (int)((unsigned int *)writeBuf[ii].p)[jj], (int)jj, (int)((unsigned int *)readBuf[ii].p)[jj]);
+ for (vv = 0; vv < (uu + 1); vv++) {
+ if (((unsigned int *)writeBuf[uu].p)[vv] != ((unsigned int *)readBuf[uu].p)[vv] ) {
+ fprintf(stderr, "VL data values don't match!, writeBuf[uu].p[%u]=%u, readBuf[uu].p[%u]=%u\n", vv, ((unsigned int *)writeBuf[uu].p)[vv], vv, ((unsigned int *)readBuf[uu].p)[vv]);
continue;
} /* write value != read value */
}
@@ -1305,7 +1307,7 @@ static int testfl_compound_VL_VLtype(void)
{
/* Struct that the VL sequences are composed of */
typedef struct {
- int i;
+ unsigned u;
float f;
hvl_t v;
} compVLVL_t;
@@ -1321,32 +1323,32 @@ static int testfl_compound_VL_VLtype(void)
compVLVL_t writeBuf[NRECORDS];/* Buffer to hold data to be written */
compVLVL_t readBuf[NRECORDS]; /* Buffer to hold read data */
hvl_t *t1, *t2;
- int ii, jj, kk; /* Loop variables */
+ unsigned uu, vv, ww; /* Loop variables */
char msg[80]; /* For error message */
herr_t ret; /* Returned status from a callee */
TESTING3(" with compound datatype containing vlen datatype");
/* Allocate and initialize VL data to write (copied from C test) */
- for (ii=0; ii<NRECORDS; ii++) {
- writeBuf[ii].i = ii*10;
- writeBuf[ii].f = (float)((ii*20)/3.0F);
- writeBuf[ii].v.p = HDmalloc((ii+L1_INCM)*sizeof(hvl_t));
- if (writeBuf[ii].v.p == NULL) {
- fprintf(stderr, "Cannot allocate memory for VL data! ii=%d\n",ii);
+ for (uu = 0; uu < NRECORDS; uu++) {
+ writeBuf[uu].u = uu * 10;
+ writeBuf[uu].f = (float)(uu * 20) / 3.0F;
+ writeBuf[uu].v.p = HDmalloc((uu + L1_INCM) * sizeof(hvl_t));
+ if (writeBuf[uu].v.p == NULL) {
+ fprintf(stderr, "Cannot allocate memory for VL data! uu=%u\n", uu);
goto error;
}
- writeBuf[ii].v.len=ii+L1_INCM;
- for (t1=(hvl_t *)((writeBuf[ii].v).p), jj=0; jj<(ii+L1_INCM); jj++, t1++)
+ writeBuf[uu].v.len = uu + L1_INCM;
+ for (t1 = (hvl_t *)((writeBuf[uu].v).p), vv = 0; vv < (uu + L1_INCM); vv++, t1++)
{
- t1->p = HDmalloc((jj+L2_INCM)*sizeof(unsigned int));
+ t1->p = HDmalloc((vv + L2_INCM) * sizeof(unsigned int));
if (t1->p == NULL) {
- fprintf(stderr, "Cannot allocate memory for VL data! ii=%d\n",ii);
+ fprintf(stderr, "Cannot allocate memory for VL data! uu=%u\n", uu);
goto error;
}
- t1->len = jj+L2_INCM;
- for (kk=0; kk<jj+L2_INCM; kk++)
- ((unsigned int*)t1->p)[kk] = ii*100 + jj*10 + kk;
+ t1->len = vv + L2_INCM;
+ for (ww = 0; ww < vv + L2_INCM; ww++)
+ ((unsigned int*)t1->p)[ww] = uu * 100 + vv * 10 + ww;
}
} /* end for */
@@ -1376,7 +1378,7 @@ static int testfl_compound_VL_VLtype(void)
goto error;
/* Insert fields: atomic, atomic, vlen */
- ret = H5Tinsert(comp_vlvl, "i", HOFFSET(compVLVL_t, i), H5T_NATIVE_INT);
+ ret = H5Tinsert(comp_vlvl, "u", HOFFSET(compVLVL_t, u), H5T_NATIVE_UINT);
if (ret < 0)
goto error;
ret = H5Tinsert(comp_vlvl, "f", HOFFSET(compVLVL_t, f), H5T_NATIVE_FLOAT);
@@ -1416,29 +1418,29 @@ static int testfl_compound_VL_VLtype(void)
goto error;
/* Compare data read in */
- for (ii = 0; ii < NRECORDS; ii++) {
- if (writeBuf[ii].i != readBuf[ii].i) {
- fprintf(stderr, "Integer components don't match!, writeBuf[%d].i=%d, readBuf[%d].i=%d\n",(int)ii,(int)writeBuf[ii].i,(int)ii,(int)readBuf[ii].i);
+ for (uu = 0; uu < NRECORDS; uu++) {
+ if (writeBuf[uu].u != readBuf[uu].u) {
+ fprintf(stderr, "Integer components don't match!, writeBuf[%u].u=%u, readBuf[%u].u=%u\n", uu, writeBuf[uu].u, uu, readBuf[uu].u);
continue;
} /* end if */
- if (!H5_FLT_ABS_EQUAL(writeBuf[ii].f,readBuf[ii].f)) {
- fprintf(stderr, "Float components don't match!, writeBuf[%d].f=%f, readBuf[%d].f=%f\n",(int)ii,(double)writeBuf[ii].f,(int)ii,(double)readBuf[ii].f);
+ if (!H5_FLT_ABS_EQUAL(writeBuf[uu].f, readBuf[uu].f)) {
+ fprintf(stderr, "Float components don't match!, writeBuf[%u].f=%f, readBuf[%u].f=%f\n", uu, (double)writeBuf[uu].f, uu, (double)readBuf[uu].f);
continue;
} /* end if */
- if (writeBuf[ii].v.len != readBuf[ii].v.len) {
- fprintf(stderr, "%d: VL data length don't match!, writeBuf[%d].v.len=%d, readBuf[%d].v.len=%d\n",__LINE__,(int)ii,(int)writeBuf[ii].v.len,(int)ii,(int)readBuf[ii].v.len);
+ if (writeBuf[uu].v.len != readBuf[uu].v.len) {
+ fprintf(stderr, "%d: VL data length don't match!, writeBuf[%u].v.len=%zu, readBuf[%u].v.len=%zu\n", __LINE__, uu, writeBuf[uu].v.len, uu, readBuf[uu].v.len);
continue;
} /* end if */
- for (t1=(hvl_t *)(writeBuf[ii].v.p), t2=(hvl_t *)(readBuf[ii].v.p), jj=0; (size_t)jj<readBuf[ii].v.len; jj++, t1++, t2++) {
+ for (t1 = (hvl_t *)(writeBuf[uu].v.p), t2 = (hvl_t *)(readBuf[uu].v.p), vv = 0; (size_t)vv < readBuf[uu].v.len; vv++, t1++, t2++) {
if (t1->len != t2->len) {
- fprintf(stderr, "%d: VL data length don't match!, ii=%d, jj=%d, t1->len=%d, t2->len=%d\n",__LINE__,(int)ii,(int)jj,(int)t1->len,(int)t2->len);
+ fprintf(stderr, "%d: VL data length don't match!, uu=%u, vv=%u, t1->len=%zu, t2->len=%zu\n", __LINE__, uu, vv, t1->len, t2->len);
continue;
} /* end if */
- for (kk=0; (size_t)kk<t2->len; kk++) {
- if (((unsigned int *)t1->p)[kk] != ((unsigned int *)t2->p)[kk] ) {
- fprintf(stderr, "VL data values don't match!, t1->p[%d]=%d, t2->p[%d]=%d\n",(int)kk, (int)((unsigned int *)t1->p)[kk], (int)kk, (int)((unsigned int *)t2->p)[kk]);
+ for (ww = 0; (size_t)ww < t2->len; ww++) {
+ if (((unsigned int *)t1->p)[ww] != ((unsigned int *)t2->p)[ww] ) {
+ fprintf(stderr, "VL data values don't match!, t1->p[%u]=%u, t2->p[%u]=%u\n", ww, ((unsigned int *)t1->p)[ww], ww, ((unsigned int *)t2->p)[ww]);
continue;
} /* end if */
} /* end for */
@@ -1496,7 +1498,7 @@ static int testfl_VLof_VLtype(void)
hid_t vlofvl=H5I_INVALID_HID; /* VL datatype of VL datatypes */
hsize_t count; /* Number of records in the table */
hvl_t *t1; /* pointer to advance */
- int ii, jj, kk; /* Loop variables */
+ unsigned uu, vv, ww; /* Loop variables */
hvl_t writeBuf[NRECORDS]; /* Buffer to hold data to be written */
hvl_t readBuf[NRECORDS]; /* Buffer to hold read data */
char msg[80]; /* For error message */
@@ -1505,23 +1507,23 @@ static int testfl_VLof_VLtype(void)
TESTING3(" with vlen datatype of vlen datatype");
/* Allocate and initialize VL data to write (copied from C test) */
- for (ii=0; ii< NRECORDS; ii++) {
- writeBuf[ii].p = HDmalloc((ii+1)*sizeof(hvl_t));
- if (writeBuf[ii].p == NULL) {
- fprintf(stderr, "Cannot allocate memory for VL data! ii=%u\n",ii);
+ for (uu = 0; uu < NRECORDS; uu++) {
+ writeBuf[uu].p = HDmalloc((uu + 1) * sizeof(hvl_t));
+ if (writeBuf[uu].p == NULL) {
+ fprintf(stderr, "Cannot allocate memory for VL data! uu=%u\n", uu);
goto error;
} /* end if */
- writeBuf[ii].len = ii+1;
- for (t1=(hvl_t *)(writeBuf[ii].p), jj=0; jj<(ii+1); jj++, t1++)
+ writeBuf[uu].len = uu + 1;
+ for (t1 = (hvl_t *)(writeBuf[uu].p), vv = 0; vv < (uu + 1); vv++, t1++)
{
- t1->p = HDmalloc((jj+1)*sizeof(unsigned int));
+ t1->p = HDmalloc((vv + 1) * sizeof(unsigned int));
if (t1->p == NULL) {
- fprintf(stderr, "Cannot allocate memory for VL data! ii=%u\n",ii);
+ fprintf(stderr, "Cannot allocate memory for VL data! uu=%u\n", uu);
goto error;
}
- t1->len = jj+1;
- for (kk=0; kk<(jj+1); kk++)
- ((unsigned int *)t1->p)[kk] = ii*100+jj*10+kk;
+ t1->len = vv + 1;
+ for (ww = 0; ww < (vv + 1); ww++)
+ ((unsigned int *)t1->p)[ww] = uu * 100 + vv * 10 + ww;
} /* end for */
} /* end for */
diff --git a/hl/tools/gif2h5/CMakeTests.cmake b/hl/tools/gif2h5/CMakeTests.cmake
index 832d2df..1cffe55 100644
--- a/hl/tools/gif2h5/CMakeTests.cmake
+++ b/hl/tools/gif2h5/CMakeTests.cmake
@@ -11,27 +11,10 @@ file (MAKE_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles")
#
# copy test files from source to build dir
#
-
-add_custom_command (
- TARGET gif2h5
- POST_BUILD
- COMMAND ${CMAKE_COMMAND}
- ARGS -E copy_if_different ${HDF5_HL_TOOLS_GIF2H5_SOURCE_DIR}/testfiles/image1.gif ${PROJECT_BINARY_DIR}/testfiles/image1.gif
-)
-
-add_custom_command (
- TARGET h52gif
- POST_BUILD
- COMMAND ${CMAKE_COMMAND}
- ARGS -E copy_if_different ${HDF5_HL_TOOLS_GIF2H5_SOURCE_DIR}/testfiles/h52giftst.h5 ${PROJECT_BINARY_DIR}/testfiles/h52giftst.h5
-)
-
-add_custom_command (
- TARGET h52gif
- POST_BUILD
- COMMAND ${CMAKE_COMMAND}
- ARGS -E copy_if_different ${HDF5_HL_TOOLS_GIF2H5_SOURCE_DIR}/testfiles/ex_image2.h5 ${PROJECT_BINARY_DIR}/testfiles/ex_image2.h5
-)
+HDFTEST_COPY_FILE("${HDF5_HL_TOOLS_GIF2H5_SOURCE_DIR}/testfiles/image1.gif" "${PROJECT_BINARY_DIR}/testfiles/image1.gif" "gif2h5_files")
+HDFTEST_COPY_FILE("${HDF5_HL_TOOLS_GIF2H5_SOURCE_DIR}/testfiles/h52giftst.h5" "${PROJECT_BINARY_DIR}/testfiles/h52giftst.h5" "gif2h5_files")
+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})
# Remove any output file left over from previous test run
add_test (
diff --git a/java/CMakeLists.txt b/java/CMakeLists.txt
index 0440d41..706b196 100644
--- a/java/CMakeLists.txt
+++ b/java/CMakeLists.txt
@@ -13,6 +13,12 @@ find_package (JNI)
INCLUDE_DIRECTORIES ( ${JNI_INCLUDE_DIRS} )
+if (WIN32)
+ set (HDF_JRE_DIRECTORY "C:/Program Files/Java/jre8")
+else (WIN32)
+ set (HDF_JRE_DIRECTORY "/usr/lib/jvm/jre")
+endif (WIN32)
+
#-----------------------------------------------------------------------------
# Include the main src and config directories
#-----------------------------------------------------------------------------
@@ -61,17 +67,9 @@ install (
#-----------------------------------------------------------------------------
option (HDF5_JAVA_PACK_JRE "Package a JRE installer directory" OFF)
if (HDF5_JAVA_PACK_JRE)
- if (WIN32)
- install (
- DIRECTORY "C:/Program Files/Java/jre8"
- DESTINATION ${HDF5_INSTALL_BIN_DIR}
- USE_SOURCE_PERMISSIONS
- )
- else (WIN32)
- install (
- DIRECTORY "/usr/lib/jvm/jre"
- DESTINATION ${HDF5_INSTALL_BIN_DIR}
- USE_SOURCE_PERMISSIONS
- )
- endif (WIN32)
+ install (
+ DIRECTORY ${HDF_JRE_DIRECTORY}
+ DESTINATION ${HDF5_INSTALL_BIN_DIR}
+ USE_SOURCE_PERMISSIONS
+ )
endif (HDF5_JAVA_PACK_JRE)
diff --git a/java/examples/datasets/CMakeLists.txt b/java/examples/datasets/CMakeLists.txt
index 5f5f37c..0ba2331 100644
--- a/java/examples/datasets/CMakeLists.txt
+++ b/java/examples/datasets/CMakeLists.txt
@@ -63,7 +63,11 @@ endforeach (HDFJAVA_JAR)
MACRO (ADD_H5_TEST resultfile resultcode)
if (CMAKE_BUILD_TYPE MATCHES Debug)
- set (CMD_ARGS "-Dhdf.hdf5lib.H5.loadLibraryName=hdf5_java_debug;")
+ if (WIN32)
+ set (CMD_ARGS "-Dhdf.hdf5lib.H5.loadLibraryName=hdf5_java_D;")
+ else()
+ set (CMD_ARGS "-Dhdf.hdf5lib.H5.loadLibraryName=hdf5_java_debug;")
+ endif()
endif(CMAKE_BUILD_TYPE MATCHES Debug)
add_test (
NAME JAVA_datasets-${resultfile}
diff --git a/java/examples/datatypes/CMakeLists.txt b/java/examples/datatypes/CMakeLists.txt
index 1e305be..5ab513c 100644
--- a/java/examples/datatypes/CMakeLists.txt
+++ b/java/examples/datatypes/CMakeLists.txt
@@ -63,7 +63,11 @@ endforeach (HDFJAVA_JAR)
MACRO (ADD_H5_TEST resultfile resultcode)
if (CMAKE_BUILD_TYPE MATCHES Debug)
- set (CMD_ARGS "-Dhdf.hdf5lib.H5.loadLibraryName=hdf5_java_debug;")
+ if (WIN32)
+ set (CMD_ARGS "-Dhdf.hdf5lib.H5.loadLibraryName=hdf5_java_D;")
+ else()
+ set (CMD_ARGS "-Dhdf.hdf5lib.H5.loadLibraryName=hdf5_java_debug;")
+ endif()
endif(CMAKE_BUILD_TYPE MATCHES Debug)
add_test (
NAME JAVA_datatypes-${resultfile}
diff --git a/java/examples/datatypes/H5Ex_T_ObjectReference.java b/java/examples/datatypes/H5Ex_T_ObjectReference.java
index 3cad6c9..8a09f5b 100644
--- a/java/examples/datatypes/H5Ex_T_ObjectReference.java
+++ b/java/examples/datatypes/H5Ex_T_ObjectReference.java
@@ -256,11 +256,10 @@ public class H5Ex_T_ObjectReference {
object_id = H5.H5Rdereference(dataset_id, HDF5Constants.H5P_DEFAULT, HDF5Constants.H5R_OBJECT, dset_data[indx]);
object_type = H5.H5Rget_obj_type(dataset_id, HDF5Constants.H5R_OBJECT, dset_data[indx]);
}
- String[] obj_name = new String[1];
- long name_size = 1;
+ String obj_name = null;
if (object_type >= 0) {
// Get the length of the name and retrieve the name.
- name_size = 1 + H5.H5Iget_name(object_id, obj_name, name_size);
+ obj_name = H5.H5Iget_name(object_id);
}
if ((object_id >= 0) && (object_type >= -1)) {
switch (H5G_obj.get(object_type)) {
@@ -299,8 +298,7 @@ public class H5Ex_T_ObjectReference {
}
}
// Print the name.
- if (name_size > 1)
- System.out.println(": " + obj_name[0]);
+ System.out.println(": " + obj_name);
}
catch (Exception e) {
e.printStackTrace();
diff --git a/java/examples/datatypes/H5Ex_T_ObjectReferenceAttribute.java b/java/examples/datatypes/H5Ex_T_ObjectReferenceAttribute.java
index e354029..e366681 100644
--- a/java/examples/datatypes/H5Ex_T_ObjectReferenceAttribute.java
+++ b/java/examples/datatypes/H5Ex_T_ObjectReferenceAttribute.java
@@ -289,11 +289,10 @@ public class H5Ex_T_ObjectReferenceAttribute {
object_id = H5.H5Rdereference(dataset_id, HDF5Constants.H5P_DEFAULT, HDF5Constants.H5R_OBJECT, dset_data[indx]);
object_type = H5.H5Rget_obj_type(dataset_id, HDF5Constants.H5R_OBJECT, dset_data[indx]);
}
- String[] obj_name = new String[1];
- long name_size = 1;
+ String obj_name = null;
if (object_type >= 0) {
// Get the length of the name and retrieve the name.
- name_size = 1 + H5.H5Iget_name(object_id, obj_name, name_size);
+ obj_name = H5.H5Iget_name(object_id);
}
if ((object_id >= 0) && (object_type >= -1)) {
switch (H5G_obj.get(object_type)) {
@@ -332,8 +331,7 @@ public class H5Ex_T_ObjectReferenceAttribute {
}
}
// Print the name.
- if (name_size > 1)
- System.out.println(": " + obj_name[0]);
+ System.out.println(": " + obj_name);
}
catch (Exception e) {
e.printStackTrace();
diff --git a/java/examples/groups/CMakeLists.txt b/java/examples/groups/CMakeLists.txt
index 1d61614..c23b7d3 100644
--- a/java/examples/groups/CMakeLists.txt
+++ b/java/examples/groups/CMakeLists.txt
@@ -56,19 +56,17 @@ set (HDF_JAVA_TEST_FILES
)
foreach (h5_file ${HDF_JAVA_TEST_FILES})
- set (dest "${PROJECT_BINARY_DIR}/${h5_file}")
- #message (STATUS " Copying ${h5_file}")
- add_custom_command (
- TARGET H5Ex_G_Visit
- POST_BUILD
- COMMAND ${CMAKE_COMMAND}
- ARGS -E copy_if_different ${PROJECT_SOURCE_DIR}/${h5_file} ${dest}
- )
+ HDFTEST_COPY_FILE("${PROJECT_SOURCE_DIR}/${h5_file}" "${PROJECT_BINARY_DIR}/${h5_file}" "H5Ex_G_Visit_files")
endforeach (h5_file ${HDF_JAVA_TEST_FILES})
+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)
if (CMAKE_BUILD_TYPE MATCHES Debug)
- set (CMD_ARGS "-Dhdf.hdf5lib.H5.loadLibraryName=hdf5_java_debug;")
+ if (WIN32)
+ set (CMD_ARGS "-Dhdf.hdf5lib.H5.loadLibraryName=hdf5_java_D;")
+ else()
+ set (CMD_ARGS "-Dhdf.hdf5lib.H5.loadLibraryName=hdf5_java_debug;")
+ endif()
endif(CMAKE_BUILD_TYPE MATCHES Debug)
add_test (
NAME JAVA_groups-${resultfile}
diff --git a/java/examples/intro/CMakeLists.txt b/java/examples/intro/CMakeLists.txt
index 8679943..6b77382 100644
--- a/java/examples/intro/CMakeLists.txt
+++ b/java/examples/intro/CMakeLists.txt
@@ -64,7 +64,11 @@ endforeach (example ${HDF_JAVA_OBJECT_EXAMPLES})
MACRO (ADD_H5_TEST resultfile resultcode)
if (CMAKE_BUILD_TYPE MATCHES Debug)
- set (CMD_ARGS "-Dhdf.hdf5lib.H5.loadLibraryName=hdf5_java_debug;")
+ if (WIN32)
+ set (CMD_ARGS "-Dhdf.hdf5lib.H5.loadLibraryName=hdf5_java_D;")
+ else()
+ set (CMD_ARGS "-Dhdf.hdf5lib.H5.loadLibraryName=hdf5_java_debug;")
+ endif()
endif(CMAKE_BUILD_TYPE MATCHES Debug)
add_test (
NAME JAVA_intro-${resultfile}
diff --git a/java/examples/testfiles/examples.datatypes.H5Ex_T_ObjectReference.txt b/java/examples/testfiles/examples.datatypes.H5Ex_T_ObjectReference.txt
index 827c042..d8afa56 100644
--- a/java/examples/testfiles/examples.datatypes.H5Ex_T_ObjectReference.txt
+++ b/java/examples/testfiles/examples.datatypes.H5Ex_T_ObjectReference.txt
@@ -1,4 +1,4 @@
DS1[0]:
- ->H5G_GROUP:
+ ->H5G_GROUP: /G1
DS1[1]:
- ->H5G_DATASET:
+ ->H5G_DATASET: /DS2
diff --git a/java/examples/testfiles/examples.datatypes.H5Ex_T_ObjectReferenceAttribute.txt b/java/examples/testfiles/examples.datatypes.H5Ex_T_ObjectReferenceAttribute.txt
index fe3cdc0..3fabd66 100644
--- a/java/examples/testfiles/examples.datatypes.H5Ex_T_ObjectReferenceAttribute.txt
+++ b/java/examples/testfiles/examples.datatypes.H5Ex_T_ObjectReferenceAttribute.txt
@@ -1,4 +1,4 @@
A1[0]:
- ->H5G_GROUP:
+ ->H5G_GROUP: /G1
A1[1]:
- ->H5G_DATASET:
+ ->H5G_DATASET: /DS2
diff --git a/java/src/hdf/hdf5lib/H5.java b/java/src/hdf/hdf5lib/H5.java
index e555a4f..7614292 100644
--- a/java/src/hdf/hdf5lib/H5.java
+++ b/java/src/hdf/hdf5lib/H5.java
@@ -1061,6 +1061,9 @@ public class H5 implements java.io.Serializable {
public synchronized static native int H5AreadVL(long attr_id, long mem_type_id, String[] buf)
throws HDF5LibraryException, NullPointerException;
+ public synchronized static native int H5AreadComplex(long attr_id, long mem_type_id, String[] buf)
+ throws HDF5LibraryException, NullPointerException;
+
/**
* H5Arename changes the name of attribute that is attached to the object specified by loc_id. The attribute named
* old_attr_name is renamed new_attr_name.
@@ -3348,8 +3351,22 @@ public class H5 implements java.io.Serializable {
public synchronized static native long H5Iget_file_id(long obj_id) throws HDF5LibraryException;
- public synchronized static native long H5Iget_name(long obj_id, String[] name, long size)
+ @Deprecated
+ public synchronized static native long H5Iget_name_long(long obj_id, String[] name, long size)
throws HDF5LibraryException, NullPointerException;
+ /**
+ * H5Iget_name_str retrieves the name of an object specified by the identifier, obj_id.
+ *
+ * @param obj_id
+ * IN: Identifier of the object.
+ *
+ * @return String for Attribute name.
+ *
+ * @exception HDF5LibraryException
+ * - Error from the HDF-5 Library.
+ **/
+ public synchronized static native String H5Iget_name(long obj_id)
+ throws HDF5LibraryException;
public synchronized static native int H5Iget_ref(long obj_id) throws HDF5LibraryException, NullPointerException;
diff --git a/java/src/jni/CMakeLists.txt b/java/src/jni/CMakeLists.txt
index ef80072..2e4a821 100644
--- a/java/src/jni/CMakeLists.txt
+++ b/java/src/jni/CMakeLists.txt
@@ -57,6 +57,9 @@ SET_GLOBAL_VARIABLE (HDF5_LIBRARIES_TO_EXPORT "${HDF5_LIBRARIES_TO_EXPORT};${HDF
H5_SET_LIB_OPTIONS (${HDF5_JAVA_JNI_LIB_TARGET} ${HDF5_JAVA_JNI_LIB_NAME} SHARED ${HDF5_JAVA_PACKAGE_SOVERSION})
if (WIN32)
get_filename_component (HDF5_JAVA_JNI_DLL_NAME ${HDF5_JAVA_JNI_LIB_TARGET} NAME_WE)
+ if (CMAKE_BUILD_TYPE MATCHES Debug)
+ set (HDF5_JAVA_JNI_DLL_NAME "${HDF5_JAVA_JNI_DLL_NAME}_D")
+ endif ()
# message (STATUS "HDF5_JAVA_JNI_DLL_NAME: ${HDF5_JAVA_JNI_DLL_NAME}")
if (BUILD_TESTING)
add_custom_target (HDF5_JAVA_JNI-Test-Copy ALL
diff --git a/java/src/jni/h5aImp.c b/java/src/jni/h5aImp.c
index 5af60fb..5af8aae 100644
--- a/java/src/jni/h5aImp.c
+++ b/java/src/jni/h5aImp.c
@@ -67,14 +67,15 @@ Java_hdf_hdf5lib_H5__1H5Acreate
hid_t attr_id = -1;
const char *aName;
- PIN_JAVA_STRING(name, aName, -1);
+ 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);
- attr_id = H5Acreate2((hid_t)loc_id, aName, (hid_t)type_id, (hid_t)space_id, (hid_t)create_plist, (hid_t)H5P_DEFAULT);
+ UNPIN_JAVA_STRING(name, aName);
- UNPIN_JAVA_STRING(name, aName);
-
- if (attr_id < 0)
- h5libraryError(env);
+ if (attr_id < 0)
+ h5libraryError(env);
+ }
return (jlong)attr_id;
} /* end Java_hdf_hdf5lib_H5__1H5Acreate */
@@ -91,14 +92,15 @@ Java_hdf_hdf5lib_H5__1H5Aopen_1name
hid_t attr_id = -1;
const char *aName;
- PIN_JAVA_STRING(name, aName, -1);
+ PIN_JAVA_STRING(name, aName);
+ if (aName != NULL) {
+ attr_id = H5Aopen_name((hid_t)loc_id, aName);
- attr_id = H5Aopen_name((hid_t)loc_id, aName);
+ UNPIN_JAVA_STRING(name,aName);
- UNPIN_JAVA_STRING(name,aName);
-
- if (attr_id < 0)
- h5libraryError(env);
+ if (attr_id < 0)
+ h5libraryError(env);
+ }
return (jlong)attr_id;
} /* end Java_hdf_hdf5lib_H5__1H5Aopen_1name */
@@ -242,8 +244,7 @@ Java_hdf_hdf5lib_H5_H5Aget_1name
ssize_t buf_size;
/* get the length of the name */
- buf_size = H5Aget_name((hid_t)attr_id, NULL, 0);
-
+ buf_size = H5Aget_name((hid_t)attr_id, 0, NULL);
if (buf_size <= 0) {
h5badArgument(env, "H5Aget_name: buf_size <= 0");
} /* end if */
@@ -299,14 +300,15 @@ Java_hdf_hdf5lib_H5_H5Adelete
herr_t status = -1;
const char *aName;
- PIN_JAVA_STRING(name, aName, -1);
-
- status = H5Adelete((hid_t)loc_id, aName);
+ PIN_JAVA_STRING(name, aName);
+ if (aName != NULL) {
+ status = H5Adelete((hid_t)loc_id, aName);
- UNPIN_JAVA_STRING(name, aName);
+ UNPIN_JAVA_STRING(name, aName);
- if (status < 0)
- h5libraryError(env);
+ if (status < 0)
+ h5libraryError(env);
+ }
return (jint)status;
} /* end Java_hdf_hdf5lib_H5_H5Adelete */
@@ -344,15 +346,16 @@ Java_hdf_hdf5lib_H5__1H5Acreate2
hid_t status = -1;
const char *aName;
- PIN_JAVA_STRING(name, aName, -1);
+ 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 );
- status = H5Acreate2((hid_t)loc_id, aName, (hid_t)type_id,
- (hid_t)space_id, (hid_t)create_plist, (hid_t)access_plist );
+ UNPIN_JAVA_STRING(name, aName);
- UNPIN_JAVA_STRING(name, aName);
-
- if (status < 0)
- h5libraryError(env);
+ if (status < 0)
+ h5libraryError(env);
+ }
return (jlong)status;
} /* end Java_hdf_hdf5lib_H5__1H5Acreate2 */
@@ -371,14 +374,15 @@ Java_hdf_hdf5lib_H5__1H5Aopen
hid_t retVal = -1;
const char *aName;
- PIN_JAVA_STRING(name, aName, -1);
+ PIN_JAVA_STRING(name, aName);
+ if (aName != NULL) {
+ retVal = H5Aopen((hid_t)obj_id, aName, (hid_t)access_plist);
- retVal = H5Aopen((hid_t)obj_id, aName, (hid_t)access_plist);
+ UNPIN_JAVA_STRING(name, aName);
- UNPIN_JAVA_STRING(name, aName);
-
- if (retVal < 0)
- h5libraryError(env);
+ if (retVal < 0)
+ h5libraryError(env);
+ }
return (jlong)retVal;
} /* end Java_hdf_hdf5lib_H5__1H5Aopen */
@@ -395,15 +399,16 @@ Java_hdf_hdf5lib_H5__1H5Aopen_1by_1idx
hid_t retVal = -1;
const char *aName;
- PIN_JAVA_STRING(name, aName, -1);
-
- 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);
+ 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);
- UNPIN_JAVA_STRING(name, aName);
+ UNPIN_JAVA_STRING(name, aName);
- if (retVal < 0)
- h5libraryError(env);
+ if (retVal < 0)
+ h5libraryError(env);
+ }
return (jlong)retVal;
} /* end Java_hdf_hdf5lib_H5__1H5Aopen_1by_1idx */
@@ -421,15 +426,16 @@ Java_hdf_hdf5lib_H5__1H5Acreate_1by_1name
const char *aName;
const char *attrName;
- PIN_JAVA_STRING_TWO(obj_name, aName, attr_name, attrName, -1);
-
- 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);
+ 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);
- UNPIN_JAVA_STRING_TWO(obj_name, aName, attr_name, attrName);
+ UNPIN_JAVA_STRING_TWO(obj_name, aName, attr_name, attrName);
- if (retVal < 0)
- h5libraryError(env);
+ if (retVal < 0)
+ h5libraryError(env);
+ }
return (jlong)retVal;
} /* end Java_hdf_hdf5lib_H5__1H5Acreate_1by_1name */
@@ -443,20 +449,23 @@ 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)
{
- htri_t retVal = -1;
+ htri_t bval = JNI_FALSE;
const char *aName;
const char *attrName;
- PIN_JAVA_STRING_TWO(obj_name, aName, attr_name, attrName, JNI_FALSE);
-
- retVal = H5Aexists_by_name((hid_t)loc_id, aName, attrName, (hid_t)lapl_id);
+ 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);
- UNPIN_JAVA_STRING_TWO(obj_name, aName, attr_name, attrName);
+ UNPIN_JAVA_STRING_TWO(obj_name, aName, attr_name, attrName);
- if (retVal < 0)
- h5libraryError(env);
+ if (bval > 0)
+ bval = JNI_TRUE;
+ else if (bval < 0)
+ h5libraryError(env);
+ }
- return (jboolean)retVal;
+ return (jboolean)bval;
} /* end Java_hdf_hdf5lib_H5_H5Aexists_1by_1name */
/*
@@ -472,14 +481,15 @@ Java_hdf_hdf5lib_H5_H5Arename
const char *oName;
const char *nName;
- PIN_JAVA_STRING_TWO(old_attr_name, oName, new_attr_name, nName, -1);
-
- retVal = H5Arename((hid_t)loc_id, oName, nName);
+ 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);
- UNPIN_JAVA_STRING_TWO(old_attr_name, oName, new_attr_name, nName);
+ UNPIN_JAVA_STRING_TWO(old_attr_name, oName, new_attr_name, nName);
- if (retVal < 0)
- h5libraryError(env);
+ if (retVal < 0)
+ h5libraryError(env);
+ }
return (jint)retVal;
} /* end Java_hdf_hdf5lib_H5_H5Arename */
@@ -499,14 +509,15 @@ Java_hdf_hdf5lib_H5_H5Arename_1by_1name
const char *oName;
const char *nName;
- PIN_JAVA_STRING_THREE(obj_name, aName, old_attr_name, oName, new_attr_name, nName, -1);
-
- retVal = H5Arename_by_name((hid_t)loc_id, aName, oName, nName, (hid_t)lapl_id);
+ 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);
+ UNPIN_JAVA_STRING_THREE(obj_name, aName, old_attr_name, oName, new_attr_name, nName);
- if (retVal < 0)
- h5libraryError(env);
+ if (retVal < 0)
+ h5libraryError(env);
+ }
return (jint)retVal;
} /* end Java_hdf_hdf5lib_H5_H5Arename_1by_1name */
@@ -526,44 +537,45 @@ Java_hdf_hdf5lib_H5_H5Aget_1name_1by_1idx
jstring str = NULL;
const char *aName;
- PIN_JAVA_STRING(obj_name, aName, NULL);
+ 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);
- /* 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) {
+ if(status_size < 0) {
UNPIN_JAVA_STRING(obj_name, aName);
- h5outOfMemory(env, "H5Aget_name_by_idx: malloc failed ");
+ h5libraryError(env);
} /* 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);
+ buf_size = (size_t)status_size + 1;/* add extra space for the null terminator */
- if (status_size < 0) {
- HDfree(aValue);
- h5libraryError(env);
+ 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 {
- str = ENVPTR->NewStringUTF(ENVPAR aValue);
- HDfree(aValue);
- if (str == NULL) {
- /* exception -- fatal JNI error */
- h5JNIFatalError(env, "H5Aget_name_by_idx: return string not created");
+ 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 */
- } /* end else */
+ }
return str;
} /* end Java_hdf_hdf5lib_H5_H5Aget_1name_1by_1idx */
@@ -628,23 +640,24 @@ Java_hdf_hdf5lib_H5_H5Aget_1info_1by_1idx
jobject ret_obj = NULL;
const char *aName;
- PIN_JAVA_STRING(obj_name, aName, NULL);
+ 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);
- 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);
-
- UNPIN_JAVA_STRING(obj_name, aName);
+ UNPIN_JAVA_STRING(obj_name, aName);
- 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 (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 */
@@ -664,22 +677,23 @@ Java_hdf_hdf5lib_H5_H5Aget_1info_1by_1name
jvalue args[4];
jobject ret_obj = NULL;
- PIN_JAVA_STRING_TWO(obj_name, aName, attr_name, attrName, 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);
- status = H5Aget_info_by_name((hid_t)loc_id, aName, attrName, &ainfo, (hid_t)lapl_id);
+ UNPIN_JAVA_STRING_TWO(obj_name, aName, attr_name, attrName);
- UNPIN_JAVA_STRING_TWO(obj_name, aName, attr_name, attrName);
-
- 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 (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 */
@@ -696,14 +710,15 @@ Java_hdf_hdf5lib_H5_H5Adelete_1by_1name
const char *aName;
const char *attrName;
- PIN_JAVA_STRING_TWO(obj_name, aName, attr_name, attrName, -1);
-
- retVal = H5Adelete_by_name((hid_t)loc_id, aName, attrName, (hid_t)lapl_id);
+ 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);
- UNPIN_JAVA_STRING_TWO(obj_name, aName, attr_name, attrName);
+ UNPIN_JAVA_STRING_TWO(obj_name, aName, attr_name, attrName);
- if (retVal < 0)
- h5libraryError(env);
+ if (retVal < 0)
+ h5libraryError(env);
+ }
return (jint)retVal;
} /* end Java_hdf_hdf5lib_H5_H5Adelete_1by_1name */
@@ -720,16 +735,17 @@ Java_hdf_hdf5lib_H5_H5Aexists
htri_t bval = JNI_FALSE;
const char *aName;
- PIN_JAVA_STRING(attr_name, aName, JNI_FALSE);
+ PIN_JAVA_STRING(attr_name, aName);
+ if (aName != NULL) {
+ bval = H5Aexists((hid_t)obj_id, aName);
- bval = H5Aexists((hid_t)obj_id, aName);
+ UNPIN_JAVA_STRING(attr_name, aName);
- UNPIN_JAVA_STRING(attr_name, aName);
-
- if (bval > 0)
- bval = JNI_TRUE;
- else if (bval < 0)
- h5libraryError(env);
+ if (bval > 0)
+ bval = JNI_TRUE;
+ else if (bval < 0)
+ h5libraryError(env);
+ }
return (jboolean)bval;
} /* end Java_hdf_hdf5lib_H5_H5Aexists */
@@ -746,14 +762,15 @@ Java_hdf_hdf5lib_H5_H5Adelete_1by_1idx
herr_t status = -1;
const char *aName;
- PIN_JAVA_STRING0(obj_name, aName);
-
- 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);
+ 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);
- UNPIN_JAVA_STRING(obj_name, aName);
+ UNPIN_JAVA_STRING(obj_name, aName);
- if (status < 0)
- h5libraryError(env);
+ if (status < 0)
+ h5libraryError(env);
+ }
} /* end Java_hdf_hdf5lib_H5_H5Adelete_1by_1idx */
/*
@@ -770,14 +787,15 @@ Java_hdf_hdf5lib_H5__1H5Aopen_1by_1name
const char *aName;
const char *oName;
- PIN_JAVA_STRING_TWO(obj_name, oName, attr_name, aName, -1);
-
- status = H5Aopen_by_name((hid_t)loc_id, oName, aName, (hid_t)aapl_id, (hid_t)lapl_id);
+ 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);
- UNPIN_JAVA_STRING_TWO(obj_name, oName, attr_name, aName);
+ UNPIN_JAVA_STRING_TWO(obj_name, oName, attr_name, aName);
- if (status < 0)
- h5libraryError(env);
+ if (status < 0)
+ h5libraryError(env);
+ }
return (jlong)status;
} /* end Java_hdf_hdf5lib_H5__1H5Aopen_1by_1name */
@@ -892,14 +910,15 @@ Java_hdf_hdf5lib_H5_H5Aiterate_1by_1name
h5nullArgument(env, "H5Literate_by_name: op_data or callback_op is NULL");
} /* end if */
else {
- PIN_JAVA_STRING(name, lName, -1);
+ 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*)op_data, (hid_t)access_id);
- 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*)op_data, (hid_t)access_id);
+ UNPIN_JAVA_STRING(name, lName);
- UNPIN_JAVA_STRING(name, lName);
-
- if (status < 0)
- h5libraryError(env);
+ if (status < 0)
+ h5libraryError(env);
+ }
} /* end else */
return (jint)status;
diff --git a/java/src/jni/h5dImp.c b/java/src/jni/h5dImp.c
index 9bcbd5f..ed1db41 100644
--- a/java/src/jni/h5dImp.c
+++ b/java/src/jni/h5dImp.c
@@ -161,14 +161,15 @@ Java_hdf_hdf5lib_H5__1H5Dcreate
hid_t dset_id = -1;
const char *fileName;
- PIN_JAVA_STRING(name, fileName, -1);
+ 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);
- 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);
+ UNPIN_JAVA_STRING(name, fileName);
- UNPIN_JAVA_STRING(name, fileName);
-
- if (dset_id < 0)
- h5libraryError(env);
+ if (dset_id < 0)
+ h5libraryError(env);
+ }
return (jlong)dset_id;
} /* end Java_hdf_hdf5lib_H5__1H5Dcreate */
@@ -185,13 +186,14 @@ Java_hdf_hdf5lib_H5__1H5Dopen
hid_t dset_id = -1;
const char *fileName;
- PIN_JAVA_STRING(name, fileName, -1);
-
- dset_id = H5Dopen2((hid_t)loc_id, fileName, H5P_DEFAULT);
+ PIN_JAVA_STRING(name, fileName);
+ if (fileName != NULL) {
+ dset_id = H5Dopen2((hid_t)loc_id, fileName, H5P_DEFAULT);
- UNPIN_JAVA_STRING(name, fileName);
- if (dset_id < 0)
- h5libraryError(env);
+ UNPIN_JAVA_STRING(name, fileName);
+ if (dset_id < 0)
+ h5libraryError(env);
+ }
return (jlong)dset_id;
} /* end Java_hdf_hdf5lib_H5__1H5Dopen */
@@ -285,7 +287,7 @@ 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;
+ herr_t status = -1;
jbyte *buffP;
jboolean isCopy;
htri_t data_class;
@@ -341,7 +343,7 @@ 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;
+ herr_t status = -1;
jbyte *buffP;
jboolean isCopy;
htri_t data_class;
@@ -1151,7 +1153,7 @@ Java_hdf_hdf5lib_H5_H5Dread_1VLStrings
h5nullArgument(env, "H5Dread_VLStrings: buf is NULL");
} /* end if */
else {
- isVlenStr = H5Tis_variable_str((hid_t)mem_type_id);
+ isVlenStr = H5Tdetect_class((hid_t)mem_type_id, H5T_STRING);
if (isVlenStr) {
status = H5DreadVL_str(env, (hid_t)dataset_id, (hid_t)mem_type_id,
@@ -1445,13 +1447,14 @@ Java_hdf_hdf5lib_H5__1H5Dcreate2
hid_t dset_id = -1;
const char *fileName;
- PIN_JAVA_STRING(name, fileName, -1);
-
- 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);
+ 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);
- UNPIN_JAVA_STRING(name, fileName);
- if (dset_id < 0)
- h5libraryError(env);
+ UNPIN_JAVA_STRING(name, fileName);
+ if (dset_id < 0)
+ h5libraryError(env);
+ }
return (jlong)dset_id;
} /* end Java_hdf_hdf5lib_H5__1H5Dcreate2 */
@@ -1465,16 +1468,17 @@ JNIEXPORT jlong JNICALL
Java_hdf_hdf5lib_H5__1H5Dopen2
(JNIEnv *env, jclass clss, jlong loc_id, jstring name, jlong access_plist)
{
- hid_t dset_id;
+ hid_t dset_id = -1;
const char *fileName;
- PIN_JAVA_STRING(name, fileName, -1);
+ PIN_JAVA_STRING(name, fileName);
+ if (fileName != NULL) {
+ dset_id = H5Dopen2((hid_t)loc_id, fileName, (hid_t)access_plist);
- dset_id = H5Dopen2((hid_t)loc_id, fileName, (hid_t)access_plist);
-
- UNPIN_JAVA_STRING(name, fileName);
- if (dset_id < 0)
- h5libraryError(env);
+ UNPIN_JAVA_STRING(name, fileName);
+ if (dset_id < 0)
+ h5libraryError(env);
+ }
return (jlong)dset_id;
} /* end Java_hdf_hdf5lib_H5__1H5Dopen2 */
@@ -1585,39 +1589,40 @@ Java_hdf_hdf5lib_H5_H5Dfill
if (buf == NULL) {
h5nullArgument(env, "H5Dfill: buf is NULL");
- return;
} /* end if */
- buffP = ENVPTR->GetByteArrayElements(ENVPAR buf, &isCopy2);
- if (buffP == NULL) {
- h5JNIFatalError(env, "H5Dfill: buf not pinned");
- return;
- } /* end if */
-
- 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;
+ else {
+ buffP = ENVPTR->GetByteArrayElements(ENVPAR buf, &isCopy2);
+ if (buffP == NULL) {
+ h5JNIFatalError(env, "H5Dfill: buf not pinned");
} /* end if */
- } /* end if */
- else
- fillP = NULL;
+ 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 */
- /* end if */ ENVPTR->ReleaseByteArrayElements(ENVPAR fill, fillP, JNI_ABORT);
+ 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 (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 */
} /* end Java_hdf_hdf5lib_H5_H5Dfill */
/*
@@ -1638,35 +1643,35 @@ Java_hdf_hdf5lib_H5_H5Dset_1extent
if (buf == NULL) {
h5nullArgument(env, "H5Dset_extent: buf is NULL");
- return;
- } /* end if */
-
- 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");
+ rank = ENVPTR->GetArrayLength(ENVPAR buf);
+ if (rank <= 0) {
+ h5JNIFatalError(env, "H5Dset_extent: rank <=0");
} /* 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];
+ 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);
+ status = H5Dset_extent((hid_t)loc_id, (hsize_t*)dims);
- HDfree (dims);
+ HDfree (dims);
- /* free the buffer without copying back */
- ENVPTR->ReleaseLongArrayElements(ENVPAR buf, buffP, JNI_ABORT);
+ /* free the buffer without copying back */
+ ENVPTR->ReleaseLongArrayElements(ENVPAR buf, buffP, JNI_ABORT);
- if (status < 0) {
- h5libraryError(env);
- } /* end if */
+ if (status < 0) {
+ h5libraryError(env);
+ } /* end if */
+ } /* end else */
} /* end else */
- } /* end else */
+ }
} /* end Java_hdf_hdf5lib_H5_H5Dset_1extent */
static herr_t
@@ -1747,34 +1752,32 @@ Java_hdf_hdf5lib_H5_H5Diterate
if (op_data == NULL) {
h5nullArgument(env, "H5Diterate: op_data is NULL");
- return -1;
} /* end if */
- if (callback_op == NULL) {
+ else if (callback_op == NULL) {
h5nullArgument(env, "H5Diterate: callback_op is NULL");
- return -1;
} /* end if */
-
- if (buf == NULL) {
+ else if (buf == NULL) {
h5nullArgument(env, "H5Diterate: buf is NULL");
- return -1;
- } /* end if */
- 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*)op_data);
-
- if (status < 0) {
- ENVPTR->ReleaseByteArrayElements(ENVPAR buf, buffP, JNI_ABORT);
- h5libraryError(env);
+ buffP = ENVPTR->GetByteArrayElements(ENVPAR buf, &isCopy);
+ if (buffP == NULL) {
+ h5JNIFatalError(env, "H5Diterate: buf not pinned");
} /* end if */
else {
- if (isCopy == JNI_TRUE) {
- ENVPTR->ReleaseByteArrayElements(ENVPAR buf, buffP, 0);
+ status = H5Diterate((void*)buffP, (hid_t)buf_type, (hid_t)space, (H5D_operator_t)H5D_iterate_cb, (void*)op_data);
+
+ 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 */
- } /* end else */
+ }
return (jint)status;
} /* end Java_hdf_hdf5lib_H5_H5Diterate */
@@ -1786,7 +1789,7 @@ Java_hdf_hdf5lib_H5_H5Diterate
*/
JNIEXPORT void JNICALL
Java_hdf_hdf5lib_H5_H5Dflush
- (JNIEnv *env, jclass clss, jlong loc_id)
+ (JNIEnv *env, jclass clss, jlong loc_id)
{
if (H5Dflush((hid_t)loc_id) < 0)
h5libraryError(env);
@@ -1799,7 +1802,7 @@ Java_hdf_hdf5lib_H5_H5Dflush
*/
JNIEXPORT void JNICALL
Java_hdf_hdf5lib_H5_H5Drefresh
- (JNIEnv *env, jclass clss, jlong loc_id)
+ (JNIEnv *env, jclass clss, jlong loc_id)
{
if (H5Drefresh((hid_t)loc_id) < 0)
h5libraryError(env);
diff --git a/java/src/jni/h5eImp.c b/java/src/jni/h5eImp.c
index 84cbacd..6e05515 100644
--- a/java/src/jni/h5eImp.c
+++ b/java/src/jni/h5eImp.c
@@ -98,14 +98,15 @@ Java_hdf_hdf5lib_H5_H5Eregister_1class
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, -1);
+ 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);
- 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);
- UNPIN_JAVA_STRING_THREE(cls_name, the_cls_name, lib_name, the_lib_name, version, the_version);
-
- if (ret_val < 0)
- h5libraryError(env);
+ if (ret_val < 0)
+ h5libraryError(env);
+ }
return (jlong)ret_val;
} /* end Java_hdf_hdf5lib_H5_H5Eregister_1class */
@@ -159,14 +160,15 @@ Java_hdf_hdf5lib_H5_H5Ecreate_1msg
h5badArgument(env, "H5Ecreate_msg: invalid argument");
} /* end if */
else {
- PIN_JAVA_STRING(err_msg, the_err_msg, -1);
-
- ret_val = H5Ecreate_msg((hid_t)err_id, error_msg_type, the_err_msg);
+ 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);
- UNPIN_JAVA_STRING(err_msg, the_err_msg);
+ UNPIN_JAVA_STRING(err_msg, the_err_msg);
- if (ret_val < 0)
- h5libraryError(env);
+ if (ret_val < 0)
+ h5libraryError(env);
+ }
} /* end else */
return (jlong)ret_val;
@@ -305,7 +307,7 @@ 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 cls, jlong stk_id)
{
if (stk_id < 0) {
h5badArgument(env, "H5Eset_current_stack: invalid argument");
@@ -358,15 +360,16 @@ Java_hdf_hdf5lib_H5_H5Epush2
h5badArgument(env, "H5Epush: invalid minor_id argument");
} /* end else if */
else {
- PIN_JAVA_STRING_THREE0(filename, fName, funcname, fncName, err_desc, errMsg);
+ 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);
- 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);
- UNPIN_JAVA_STRING_THREE(filename, fName, funcname, fncName, err_desc, errMsg);
-
- if (ret_val < 0)
- h5libraryError(env);
+ if (ret_val < 0)
+ h5libraryError(env);
+ }
} /* end else */
} /* end Java_hdf_hdf5lib_H5_H5Epush2 */
diff --git a/java/src/jni/h5fImp.c b/java/src/jni/h5fImp.c
index 33a5932..5862ae7 100644
--- a/java/src/jni/h5fImp.c
+++ b/java/src/jni/h5fImp.c
@@ -45,14 +45,15 @@ Java_hdf_hdf5lib_H5__1H5Fopen
hid_t status = -1;
const char *fileName;
- PIN_JAVA_STRING(name, fileName, -1);
+ PIN_JAVA_STRING(name, fileName);
+ if (fileName != NULL) {
+ status = H5Fopen(fileName, (unsigned)flags, (hid_t)access_id );
- status = H5Fopen(fileName, (unsigned)flags, (hid_t)access_id );
+ UNPIN_JAVA_STRING(name, fileName);
- UNPIN_JAVA_STRING(name, fileName);
-
- if (status < 0)
- h5libraryError(env);
+ if (status < 0)
+ h5libraryError(env);
+ }
return (jlong)status;
} /* end Java_hdf_hdf5lib_H5__1H5Fopen */
@@ -69,14 +70,15 @@ Java_hdf_hdf5lib_H5__1H5Fcreate
hid_t status = -1;
const char *fileName;
- PIN_JAVA_STRING(name, fileName, -1);
+ PIN_JAVA_STRING(name, fileName);
+ if (fileName != NULL) {
+ status = H5Fcreate(fileName, (unsigned)flags, create_id, access_id);
- status = H5Fcreate(fileName, (unsigned)flags, create_id, access_id);
+ UNPIN_JAVA_STRING(name, fileName);
- UNPIN_JAVA_STRING(name, fileName);
-
- if (status < 0)
- h5libraryError(env);
+ if (status < 0)
+ h5libraryError(env);
+ }
return (jlong)status;
} /* end Java_hdf_hdf5lib_H5__1H5Fcreate */
@@ -152,16 +154,17 @@ Java_hdf_hdf5lib_H5_H5Fis_1hdf5
htri_t bval = JNI_FALSE;
const char *fileName;
- PIN_JAVA_STRING(name, fileName, JNI_FALSE);
-
- bval = H5Fis_hdf5(fileName);
+ PIN_JAVA_STRING(name, fileName);
+ if (fileName != NULL) {
+ bval = H5Fis_hdf5(fileName);
- UNPIN_JAVA_STRING(name, fileName);
+ UNPIN_JAVA_STRING(name, fileName);
- if (bval > 0)
- bval = JNI_TRUE;
- else if (bval < 0)
- h5libraryError(env);
+ if (bval > 0)
+ bval = JNI_TRUE;
+ else if (bval < 0)
+ h5libraryError(env);
+ }
return (jboolean)bval;
} /* end Java_hdf_hdf5lib_H5_H5Fis_1hdf5 */
@@ -251,14 +254,15 @@ Java_hdf_hdf5lib_H5_H5Fmount
herr_t status = -1;
const char *fileName;
- PIN_JAVA_STRING(name, fileName, -1);
-
- status = H5Fmount((hid_t)loc_id, fileName, (hid_t)child_id, (hid_t)plist_id);
+ PIN_JAVA_STRING(name, fileName);
+ if (fileName != NULL) {
+ status = H5Fmount((hid_t)loc_id, fileName, (hid_t)child_id, (hid_t)plist_id);
- UNPIN_JAVA_STRING(name, fileName);
+ UNPIN_JAVA_STRING(name, fileName);
- if (status < 0)
- h5libraryError(env);
+ if (status < 0)
+ h5libraryError(env);
+ }
return (jint)status;
} /* end Java_hdf_hdf5lib_H5_H5Fmount */
@@ -275,14 +279,15 @@ Java_hdf_hdf5lib_H5_H5Funmount
herr_t status = -1;
const char *fileName;
- PIN_JAVA_STRING(name, fileName, -1);
+ PIN_JAVA_STRING(name, fileName);
+ if (fileName != NULL) {
+ status = H5Funmount((hid_t)loc_id, fileName);
- status = H5Funmount((hid_t)loc_id, fileName);
+ UNPIN_JAVA_STRING(name, fileName);
- UNPIN_JAVA_STRING(name, fileName);
-
- if (status < 0)
- h5libraryError(env);
+ if (status < 0)
+ h5libraryError(env);
+ }
return (jint)status;
} /* end Java_hdf_hdf5lib_H5_H5Funmount */
diff --git a/java/src/jni/h5gImp.c b/java/src/jni/h5gImp.c
index a2c0de0..c40ed64 100644
--- a/java/src/jni/h5gImp.c
+++ b/java/src/jni/h5gImp.c
@@ -69,33 +69,30 @@ create_H5G_info_t
jclass cls;
jboolean jmounted;
jint storage_type;
- jobject obj;
+ 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)
- return NULL;
-
- obj = ENVPTR->AllocObject(ENVPAR cls);
- if (obj == NULL)
- return NULL;
-
- fid_storage_type = ENVPTR->GetFieldID(ENVPAR cls, "storage_type", "I");
- fid_nlinks = ENVPTR->GetFieldID(ENVPAR cls, "nlinks", "J");
- fid_max_corder = ENVPTR->GetFieldID(ENVPAR cls, "max_corder", "J");
- fid_mounted = ENVPTR->GetFieldID(ENVPAR cls, "mounted", "Z");
-
- if (fid_storage_type==NULL || fid_nlinks==NULL || fid_max_corder==NULL || fid_mounted == NULL)
- return 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 (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);
+ }
+ }
+ }
+ }
+ }
+ }
return obj;
} /* end create_H5G_info_t */
@@ -112,13 +109,14 @@ Java_hdf_hdf5lib_H5__1H5Gcreate2
hid_t group_id = -1;
const char *gName;
- PIN_JAVA_STRING(name, gName, -1);
+ 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 );
- group_id = H5Gcreate2((hid_t)loc_id, gName, (hid_t)link_plist_id, (hid_t)create_plist_id, (hid_t)access_plist_id );
-
- UNPIN_JAVA_STRING(name, gName);
- if (group_id < 0)
- h5libraryError(env);
+ UNPIN_JAVA_STRING(name, gName);
+ if (group_id < 0)
+ h5libraryError(env);
+ }
return (jlong)group_id;
} /* end Java_hdf_hdf5lib_H5__1H5Gcreate2 */
@@ -153,14 +151,15 @@ Java_hdf_hdf5lib_H5__1H5Gopen2
hid_t group_id = -1;
const char *gName;
- PIN_JAVA_STRING(name, gName, -1);
+ PIN_JAVA_STRING(name, gName);
+ if (gName != NULL) {
+ group_id = H5Gopen2((hid_t)loc_id, gName, (hid_t)access_plist_id );
- group_id = H5Gopen2((hid_t)loc_id, gName, (hid_t)access_plist_id );
+ UNPIN_JAVA_STRING(name, gName);
- UNPIN_JAVA_STRING(name, gName);
-
- if (group_id < 0)
- h5libraryError(env);
+ if (group_id < 0)
+ h5libraryError(env);
+ }
return (jlong)group_id;
} /* end Java_hdf_hdf5lib_H5__1H5Gopen2 */
@@ -192,14 +191,15 @@ JNIEXPORT jobject JNICALL
Java_hdf_hdf5lib_H5_H5Gget_1info
(JNIEnv *env, jclass cls, jlong loc_id)
{
+ jobject obj = NULL;
H5G_info_t group_info;
- if (H5Gget_info((hid_t)loc_id, &group_info) < 0) {
+ if (H5Gget_info((hid_t)loc_id, &group_info) < 0)
h5libraryError(env);
- return NULL;
- } /* end if */
+ else
+ obj = create_H5G_info_t(env, group_info);
- return create_H5G_info_t(env, group_info);
+ return obj;
} /* end Java_hdf_hdf5lib_H5_H5Gget_1info */
/*
@@ -211,22 +211,24 @@ JNIEXPORT jobject JNICALL
Java_hdf_hdf5lib_H5_H5Gget_1info_1by_1name
(JNIEnv *env, jclass cls, jlong loc_id, jstring name, jlong lapl_id)
{
+ jobject obj = NULL;
herr_t ret_val = -1;
const char *gName;
H5G_info_t group_info;
- PIN_JAVA_STRING(name, gName, NULL);
+ PIN_JAVA_STRING(name, gName);
+ if (gName != NULL) {
+ ret_val = H5Gget_info_by_name((hid_t)loc_id, gName, &group_info, (hid_t)lapl_id);
- ret_val = H5Gget_info_by_name((hid_t)loc_id, gName, &group_info, (hid_t)lapl_id);
+ UNPIN_JAVA_STRING(name, gName);
- UNPIN_JAVA_STRING(name, gName);
-
- if (ret_val < 0) {
- h5libraryError(env);
- return NULL;
- } /* end if */
+ if (ret_val < 0)
+ h5libraryError(env);
+ else
+ obj = create_H5G_info_t(env, group_info);
+ }
- return create_H5G_info_t(env, group_info);
+ return obj;
} /* end Java_hdf_hdf5lib_H5_H5Gget_1info_1by_1name */
/*
@@ -239,25 +241,27 @@ Java_hdf_hdf5lib_H5_H5Gget_1info_1by_1idx
(JNIEnv *env, jclass cls, jlong loc_id, jstring name, jint index_type,
jint order, jlong n, jlong lapl_id)
{
+ jobject obj = NULL;
herr_t ret_val = -1;
const char *gName;
H5G_info_t group_info;
H5_index_t cindex_type = (H5_index_t)index_type;
H5_iter_order_t corder = (H5_iter_order_t)order;
- PIN_JAVA_STRING(name, gName, NULL);
-
- ret_val = H5Gget_info_by_idx((hid_t)loc_id, gName, cindex_type,
- corder, (hsize_t)n, &group_info, (hid_t)lapl_id);
+ 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);
+ UNPIN_JAVA_STRING(name, gName);
- if (ret_val < 0) {
- h5libraryError(env);
- return NULL;
- } /* end if */
+ if (ret_val < 0)
+ h5libraryError(env);
+ else
+ obj = create_H5G_info_t(env, group_info);
+ }
- return create_H5G_info_t(env, group_info);
+ return obj;
} /* end Java_hdf_hdf5lib_H5_H5Gget_1info_1by_1idx */
/*
@@ -267,7 +271,7 @@ Java_hdf_hdf5lib_H5_H5Gget_1info_1by_1idx
*/
JNIEXPORT void JNICALL
Java_hdf_hdf5lib_H5_H5Gflush
- (JNIEnv *env, jclass clss, jlong loc_id)
+ (JNIEnv *env, jclass clss, jlong loc_id)
{
if (H5Gflush((hid_t)loc_id) < 0)
h5libraryError(env);
@@ -280,7 +284,7 @@ Java_hdf_hdf5lib_H5_H5Gflush
*/
JNIEXPORT void JNICALL
Java_hdf_hdf5lib_H5_H5Grefresh
- (JNIEnv *env, jclass clss, jlong loc_id)
+ (JNIEnv *env, jclass clss, jlong loc_id)
{
if (H5Grefresh((hid_t)loc_id) < 0)
h5libraryError(env);
diff --git a/java/src/jni/h5iImp.c b/java/src/jni/h5iImp.c
index 9fce3ef..71e1b71 100644
--- a/java/src/jni/h5iImp.c
+++ b/java/src/jni/h5iImp.c
@@ -52,11 +52,11 @@ Java_hdf_hdf5lib_H5_H5Iget_1type
/*
* Class: hdf_hdf5lib_H5
- * Method: H5Iget_name
+ * Method: H5Iget_name_long
* Signature: (JLjava/lang/String;J)J
*/
JNIEXPORT jlong JNICALL
-Java_hdf_hdf5lib_H5_H5Iget_1name
+Java_hdf_hdf5lib_H5_H5Iget_1name_1long
(JNIEnv *env, jclass clss, jlong obj_id, jobjectArray name, jlong buf_size)
{
char *aName;
@@ -91,6 +91,45 @@ Java_hdf_hdf5lib_H5_H5Iget_1name
/*
* Class: hdf_hdf5lib_H5
+ * Method: H5Iget_name
+ * Signature: (J)Ljava/lang/String;
+ */
+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);
+ }
+ }
+ return str;
+} /* end Java_hdf_hdf5lib_H5_H5Iget_1name */
+
+/*
+ * Class: hdf_hdf5lib_H5
* Method: H5Iget_ref
* Signature: (J)I
*/
diff --git a/java/src/jni/h5iImp.h b/java/src/jni/h5iImp.h
index f7472b8..2bf839bc 100644
--- a/java/src/jni/h5iImp.h
+++ b/java/src/jni/h5iImp.h
@@ -34,15 +34,24 @@ Java_hdf_hdf5lib_H5_H5Iget_1type
/*
* Class: hdf_hdf5lib_H5
- * Method: H5Iget_name
+ * Method: H5Iget_name_long
* Signature: (JLjava/lang/String;J)J
*/
JNIEXPORT jlong JNICALL
-Java_hdf_hdf5lib_H5_H5Iget_1name
+Java_hdf_hdf5lib_H5_H5Iget_1name_1long
(JNIEnv*, jclass, jlong, jobjectArray, jlong);
/*
* Class: hdf_hdf5lib_H5
+ * Method: H5Iget_name
+ * Signature: (J)Ljava/lang/String;
+ */
+JNIEXPORT jstring JNICALL
+Java_hdf_hdf5lib_H5_H5Iget_1name
+ (JNIEnv*, jclass, jlong);
+
+/*
+ * Class: hdf_hdf5lib_H5
* Method: H5Iget_ref
* Signature: (J)I
*/
diff --git a/java/src/jni/h5jni.h b/java/src/jni/h5jni.h
index da49eeb..9414d31 100644
--- a/java/src/jni/h5jni.h
+++ b/java/src/jni/h5jni.h
@@ -67,29 +67,17 @@
/* Macros for string access */
-#define PIN_JAVA_STRING(javastr,localstr,retdefault) { \
+#define PIN_JAVA_STRING(javastr,localstr) { \
jboolean isCopy; \
+ (localstr) = NULL; \
if ((javastr) == NULL) { \
h5nullArgument(env, "java string is NULL"); \
- return (retdefault); \
} \
- (localstr) = ENVPTR->GetStringUTFChars(ENVPAR (javastr), &isCopy); \
- if ((localstr) == NULL) { \
- h5JNIFatalError(env, "local c string is not pinned"); \
- return (retdefault); \
- } \
-}
-
-#define PIN_JAVA_STRING0(javastr,localstr) { \
- jboolean isCopy; \
- if ((javastr) == NULL) { \
- h5nullArgument(env, "java string is NULL"); \
- return; \
- } \
- (localstr) = ENVPTR->GetStringUTFChars(ENVPAR (javastr), &isCopy); \
- if ((localstr) == NULL) { \
- h5JNIFatalError(env, "local c string is not pinned"); \
- return; \
+ else { \
+ (localstr) = ENVPTR->GetStringUTFChars(ENVPAR (javastr), &isCopy); \
+ if ((localstr) == NULL) { \
+ h5JNIFatalError(env, "local c string is not pinned"); \
+ } \
} \
}
@@ -97,49 +85,28 @@
ENVPTR->ReleaseStringUTFChars(ENVPAR (javastr), (localstr)); \
}
-#define PIN_JAVA_STRING_TWO(javastr,localstr,java2str,local2str,retdefault) { \
+#define PIN_JAVA_STRING_TWO(javastr,localstr,java2str,local2str) { \
jboolean isCopy; \
+ (localstr) = NULL; \
+ (local2str) = NULL; \
if ((javastr) == NULL) { \
h5nullArgument(env, "java string is NULL"); \
- return (retdefault); \
} \
- if ((java2str) == NULL) { \
+ else if ((java2str) == NULL) { \
h5nullArgument(env, "second java string is NULL"); \
- return (retdefault); \
} \
- (localstr) = ENVPTR->GetStringUTFChars(ENVPAR (javastr), &isCopy); \
- if ((localstr) == NULL) { \
- h5JNIFatalError(env, "local c string is not pinned"); \
- return (retdefault); \
- } \
- (local2str) = ENVPTR->GetStringUTFChars(ENVPAR (java2str), &isCopy); \
- if ((local2str) == NULL) { \
- ENVPTR->ReleaseStringUTFChars(ENVPAR (javastr), (localstr)); \
- h5JNIFatalError(env, "second local c string is not pinned"); \
- return (retdefault); \
- } \
-}
-
-#define PIN_JAVA_STRING_TWO0(javastr,localstr,java2str,local2str) { \
- jboolean isCopy; \
- if ((javastr) == NULL) { \
- h5nullArgument(env, "java string is NULL"); \
- return; \
- } \
- if ((java2str) == NULL) { \
- h5nullArgument(env, "second java string is NULL"); \
- return; \
- } \
- (localstr) = ENVPTR->GetStringUTFChars(ENVPAR (javastr), &isCopy); \
- if ((localstr) == NULL) { \
- h5JNIFatalError(env, "local c string is not pinned"); \
- return; \
- } \
- (local2str) = ENVPTR->GetStringUTFChars(ENVPAR (java2str), &isCopy); \
- if ((local2str) == NULL) { \
- ENVPTR->ReleaseStringUTFChars(ENVPAR (javastr), (localstr)); \
- h5JNIFatalError(env, "second local c string is not pinned"); \
- return; \
+ 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"); \
+ } \
+ } \
} \
}
@@ -148,71 +115,40 @@
ENVPTR->ReleaseStringUTFChars(ENVPAR (java2str), (local2str)); \
}
-#define PIN_JAVA_STRING_THREE(javastr,localstr,java2str,local2str,java3str,local3str,retdefault) { \
- jboolean isCopy; \
- if ((javastr) == NULL) { \
- h5nullArgument(env, "java string is NULL"); \
- return (retdefault); \
- } \
- if ((java2str) == NULL) { \
- h5nullArgument(env, "second java string is NULL"); \
- return (retdefault); \
- } \
- if ((java3str) == NULL) { \
- h5nullArgument(env, "third java string is NULL"); \
- return (retdefault); \
- } \
- (localstr) = ENVPTR->GetStringUTFChars(ENVPAR (javastr), &isCopy); \
- if ((localstr) == NULL) { \
- h5JNIFatalError(env, "local c string is not pinned"); \
- return (retdefault); \
- } \
- (local2str) = ENVPTR->GetStringUTFChars(ENVPAR (java2str), &isCopy); \
- if ((local2str) == NULL) { \
- ENVPTR->ReleaseStringUTFChars(ENVPAR (javastr), (localstr)); \
- h5JNIFatalError(env, "second local c string is not pinned"); \
- return (retdefault); \
- } \
- (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"); \
- return (retdefault); \
- } \
-}
-
-#define PIN_JAVA_STRING_THREE0(javastr,localstr,java2str,local2str,java3str,local3str) { \
+#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"); \
- return; \
} \
- if ((java2str) == NULL) { \
+ else if ((java2str) == NULL) { \
h5nullArgument(env, "second java string is NULL"); \
- return; \
} \
- if ((java3str) == NULL) { \
+ else if ((java3str) == NULL) { \
h5nullArgument(env, "third java string is NULL"); \
- return; \
- } \
- (localstr) = ENVPTR->GetStringUTFChars(ENVPAR (javastr), &isCopy); \
- if ((localstr) == NULL) { \
- h5JNIFatalError(env, "local c string is not pinned"); \
- return; \
- } \
- (local2str) = ENVPTR->GetStringUTFChars(ENVPAR (java2str), &isCopy); \
- if ((local2str) == NULL) { \
- ENVPTR->ReleaseStringUTFChars(ENVPAR (javastr), (localstr)); \
- h5JNIFatalError(env, "second local c string is not pinned"); \
- return; \
} \
- (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"); \
- return; \
+ 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"); \
+ } \
+ } \
+ } \
} \
}
diff --git a/java/src/jni/h5lImp.c b/java/src/jni/h5lImp.c
index eecb1cd..473b1c7 100644
--- a/java/src/jni/h5lImp.c
+++ b/java/src/jni/h5lImp.c
@@ -52,14 +52,15 @@ Java_hdf_hdf5lib_H5_H5Lcopy
const char *lCurName;
const char *lDstName;
- PIN_JAVA_STRING_TWO0(cur_name, lCurName, dst_name, lDstName);
+ 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);
- status = H5Lcopy((hid_t)cur_loc_id, lCurName, (hid_t)dst_loc_id, lDstName, (hid_t)create_id, (hid_t)access_id);
+ UNPIN_JAVA_STRING_TWO(cur_name, lCurName, dst_name, lDstName);
- UNPIN_JAVA_STRING_TWO(cur_name, lCurName, dst_name, lDstName);
-
- if (status < 0)
- h5libraryError(env);
+ if (status < 0)
+ h5libraryError(env);
+ }
} /* end Java_hdf_hdf5lib_H5_H5Lcopy */
/*
@@ -77,14 +78,15 @@ Java_hdf_hdf5lib_H5_H5Lcreate_1external
const char *lCurName;
const char *lDstName;
- PIN_JAVA_STRING_THREE0(file_name, lFileName, cur_name, lCurName, dst_name, lDstName);
-
- status = H5Lcreate_external(lFileName, lCurName, (hid_t)dst_loc_id, lDstName, (hid_t)create_id, (hid_t)access_id);
+ 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);
+ UNPIN_JAVA_STRING_THREE(file_name, lFileName, cur_name, lCurName, dst_name, lDstName);
- if (status < 0)
- h5libraryError(env);
+ if (status < 0)
+ h5libraryError(env);
+ }
} /* end Java_hdf_hdf5lib_H5_H5Lcreate_1external */
/*
@@ -101,14 +103,15 @@ Java_hdf_hdf5lib_H5_H5Lcreate_1hard
const char *lCurName;
const char *lDstName;
- PIN_JAVA_STRING_TWO0(cur_name, lCurName, dst_name, lDstName);
+ 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);
- status = H5Lcreate_hard((hid_t)cur_loc_id, lCurName, (hid_t)dst_loc_id, lDstName, (hid_t)create_id, (hid_t)access_id);
+ UNPIN_JAVA_STRING_TWO(cur_name, lCurName, dst_name, lDstName);
- UNPIN_JAVA_STRING_TWO(cur_name, lCurName, dst_name, lDstName);
-
- if (status < 0)
- h5libraryError(env);
+ if (status < 0)
+ h5libraryError(env);
+ }
} /* end Java_hdf_hdf5lib_H5_H5Lcreate_1hard */
/*
@@ -125,14 +128,15 @@ Java_hdf_hdf5lib_H5_H5Lcreate_1soft
const char *lCurName;
const char *lDstName;
- PIN_JAVA_STRING_TWO0(cur_name, lCurName, dst_name, lDstName);
-
- status = H5Lcreate_soft(lCurName, (hid_t)dst_loc_id, lDstName, (hid_t)create_id, (hid_t)access_id);
+ 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);
- UNPIN_JAVA_STRING_TWO(cur_name, lCurName, dst_name, lDstName);
+ UNPIN_JAVA_STRING_TWO(cur_name, lCurName, dst_name, lDstName);
- if (status < 0)
- h5libraryError(env);
+ if (status < 0)
+ h5libraryError(env);
+ }
} /* end Java_hdf_hdf5lib_H5_H5Lcreate_1soft */
/*
@@ -147,14 +151,15 @@ Java_hdf_hdf5lib_H5_H5Ldelete
herr_t status = -1;
const char *lName;
- PIN_JAVA_STRING0(name, lName);
-
- status = H5Ldelete((hid_t)loc_id, lName, (hid_t)access_id);
+ PIN_JAVA_STRING(name, lName);
+ if (lName != NULL) {
+ status = H5Ldelete((hid_t)loc_id, lName, (hid_t)access_id);
- UNPIN_JAVA_STRING(name, lName);
+ UNPIN_JAVA_STRING(name, lName);
- if (status < 0)
- h5libraryError(env);
+ if (status < 0)
+ h5libraryError(env);
+ }
} /* end Java_hdf_hdf5lib_H5_H5Ldelete */
/*
@@ -171,14 +176,15 @@ Java_hdf_hdf5lib_H5_H5Ldelete_1by_1idx
herr_t status;
const char *lName;
- PIN_JAVA_STRING0(name, lName);
-
- status = H5Ldelete_by_idx((hid_t)loc_id, lName, (H5_index_t)index_field, (H5_iter_order_t)order, n, (hid_t)access_id);
+ 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);
- UNPIN_JAVA_STRING(name, lName);
+ UNPIN_JAVA_STRING(name, lName);
- if (status < 0)
- h5libraryError(env);
+ if (status < 0)
+ h5libraryError(env);
+ }
} /* end Java_hdf_hdf5lib_H5_H5Ldelete_1by_1idx */
/*
@@ -193,16 +199,17 @@ Java_hdf_hdf5lib_H5_H5Lexists
htri_t bval = JNI_FALSE;
const char *lName;
- PIN_JAVA_STRING(name, lName, JNI_FALSE);
-
- bval = H5Lexists((hid_t)loc_id, lName, (hid_t)access_id);
+ PIN_JAVA_STRING(name, lName);
+ if (lName != NULL) {
+ bval = H5Lexists((hid_t)loc_id, lName, (hid_t)access_id);
- UNPIN_JAVA_STRING(name, lName);
+ UNPIN_JAVA_STRING(name, lName);
- if (bval > 0)
- bval = JNI_TRUE;
- else if (bval < 0)
- h5libraryError(env);
+ if (bval > 0)
+ bval = JNI_TRUE;
+ else if (bval < 0)
+ h5libraryError(env);
+ }
return (jboolean)bval;
} /* end Java_hdf_hdf5lib_H5_H5Lexists */
@@ -222,26 +229,27 @@ Java_hdf_hdf5lib_H5_H5Lget_1info
H5L_info_t infobuf;
const char *lName;
- PIN_JAVA_STRING(name, lName, NULL);
+ PIN_JAVA_STRING(name, lName);
+ if (lName != NULL) {
+ status = H5Lget_info((hid_t)loc_id, lName, &infobuf, (hid_t)access_id);
- status = H5Lget_info((hid_t)loc_id, lName, &infobuf, (hid_t)access_id);
-
- UNPIN_JAVA_STRING(name, lName);
+ UNPIN_JAVA_STRING(name, lName);
- if (status < 0) {
- h5libraryError(env);
+ 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 */
- 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 */
return ret_obj;
} /* end Java_hdf_hdf5lib_H5_H5Lget_1info */
@@ -261,26 +269,27 @@ Java_hdf_hdf5lib_H5_H5Lget_1info_1by_1idx
H5L_info_t infobuf;
const char *lName;
- PIN_JAVA_STRING(name, lName, NULL);
+ 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);
- 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);
+ 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 */
+ 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 */
+ }
return ret_obj;
} /* end Java_hdf_hdf5lib_H5_H5Lget_1info_1by_1idx */
@@ -289,7 +298,7 @@ Java_hdf_hdf5lib_H5_H5Lget_1info_1by_1idx
* Method: H5Lget_name_by_idx
* Signature: (JLjava/lang/String;IIJJ)Ljava/lang/String;
*/
-JNIEXPORT jobject JNICALL
+JNIEXPORT jstring JNICALL
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)
@@ -300,39 +309,38 @@ Java_hdf_hdf5lib_H5_H5Lget_1name_1by_1idx
const char *lName;
char *lValue;
- PIN_JAVA_STRING(name, 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) {
- UNPIN_JAVA_STRING(name, lName);
- 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) {
- UNPIN_JAVA_STRING(name, lName);
- h5outOfMemory(env, "H5Lget_name_by_idx: malloc failed ");
+ 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 {
- 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);
+ buf_size = (size_t)status_size + 1;/* add extra space for the null terminator */
- UNPIN_JAVA_STRING(name, lName);
-
- if (status_size < 0) {
- HDfree(lValue);
- h5libraryError(env);
+ lValue = (char*)HDmalloc(sizeof(char) * buf_size);
+ if (lValue == NULL) {
+ h5outOfMemory(env, "H5Lget_name_by_idx: malloc failed ");
} /* end if */
else {
- str = ENVPTR->NewStringUTF(ENVPAR lValue);
- HDfree(lValue);
- if (str == NULL)
- h5JNIFatalError(env, "H5Lget_name_by_idx: return string not created");
+ 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 */
- } /* end else */
+ UNPIN_JAVA_STRING(name, lName);
+ }
+
return str;
} /* end Java_hdf_hdf5lib_H5_H5Lget_1name_1by_1idx */
@@ -354,79 +362,70 @@ Java_hdf_hdf5lib_H5_H5Lget_1value
const char *obj_name;
jstring str;
- PIN_JAVA_STRING(name, lName, -1);
-
infobuf.type = -1;
- /* get the length of the link val */
- status = H5Lget_info((hid_t)loc_id, lName, &infobuf, H5P_DEFAULT);
- if(status < 0) {
- UNPIN_JAVA_STRING(name, lName);
- 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) {
- UNPIN_JAVA_STRING(name, lName);
- h5JNIFatalError(env, "H5Lget_val: link is hard type");
+ 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 {
- lValue = (char*)HDmalloc(sizeof(char) * buf_size);
- if (lValue == NULL) {
- UNPIN_JAVA_STRING(name, lName);
- h5outOfMemory(env, "H5Lget_val: malloc failed");
+ 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 {
- status = H5Lget_val((hid_t)loc_id, lName, (void*)lValue, buf_size, (hid_t)access_id);
-
- UNPIN_JAVA_STRING(name, lName);
-
- if (status < 0) {
- HDfree(lValue);
- h5libraryError(env);
+ lValue = (char*)HDmalloc(sizeof(char) * buf_size);
+ if (lValue == NULL) {
+ h5outOfMemory(env, "H5Lget_val: malloc failed");
} /* 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);
+ else {
+ status = H5Lget_val((hid_t)loc_id, lName, (void*)lValue, buf_size, (hid_t)access_id);
+
if (status < 0) {
- HDfree(lValue);
h5libraryError(env);
} /* end if */
- else {
- str = ENVPTR->NewStringUTF(ENVPAR obj_name);
- if (str == NULL) {
- HDfree(lValue);
- h5JNIFatalError(env, "H5Lget_val: return string not created");
+ 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 {
- ENVPTR->SetObjectArrayElement(ENVPAR link_value, 0, str);
-
- str = ENVPTR->NewStringUTF(ENVPAR file_name);
+ str = ENVPTR->NewStringUTF(ENVPAR obj_name);
if (str == NULL) {
- HDfree(lValue);
h5JNIFatalError(env, "H5Lget_val: return string not created");
} /* end if */
else {
- ENVPTR->SetObjectArrayElement(ENVPAR link_value, 1, str);
- HDfree(lValue);
+ 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 */
- } /* end else if */
- else {
- str = ENVPTR->NewStringUTF(ENVPAR lValue);
- if (str == NULL) {
- /* exception -- fatal JNI error */
- HDfree(lValue);
- h5JNIFatalError(env, "H5Lget_val: return string not created");
- } /* end if */
+ } /* end else if */
else {
- ENVPTR->SetObjectArrayElement(ENVPAR link_value, 0, str);
- HDfree(lValue);
+ 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 */
- } /* end else */
+ UNPIN_JAVA_STRING(name, lName);
+ }
return infobuf.type;
} /* end Java_hdf_hdf5lib_H5_H5Lget_1val */
@@ -450,80 +449,69 @@ Java_hdf_hdf5lib_H5_H5Lget_1value_1by_1idx
const char *obj_name;
jstring str;
- PIN_JAVA_STRING(name, lName, -1);
-
infobuf.type = -1;
- /* 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) {
- UNPIN_JAVA_STRING(name, lName);
- h5libraryError(env);
- return -1;
- } /* end if */
- else {
- buf_size = infobuf.u.val_size;
- if(buf_size < 0) {
- UNPIN_JAVA_STRING(name, lName);
+ 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);
- return -1;
} /* end if */
else {
- lValue = (void*)HDmalloc(buf_size);
- if (lValue == NULL) {
- UNPIN_JAVA_STRING(name, lName);
- h5outOfMemory(env, "H5Lget_val_by_idx: malloc failed ");
- return -1;
+ buf_size = infobuf.u.val_size;
+ if(buf_size < 0) {
+ h5libraryError(env);
} /* 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);
-
- UNPIN_JAVA_STRING(name, lName);
-
- if (status < 0) {
- HDfree(lValue);
- h5libraryError(env);
+ lValue = (void*)HDmalloc(buf_size);
+ if (lValue == NULL) {
+ h5outOfMemory(env, "H5Lget_val_by_idx: malloc failed ");
} /* 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);
+ 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) {
- HDfree(lValue);
h5libraryError(env);
} /* end if */
- else {
- str = ENVPTR->NewStringUTF(ENVPAR obj_name);
- if (str == NULL) {
- HDfree(lValue);
- h5JNIFatalError(env, "H5Lget_val_by_idx: return string not created");
+ 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 {
- ENVPTR->SetObjectArrayElement(ENVPAR link_value, 0, str);
-
- str = ENVPTR->NewStringUTF(ENVPAR file_name);
+ str = ENVPTR->NewStringUTF(ENVPAR obj_name);
if (str == NULL) {
- HDfree(lValue);
h5JNIFatalError(env, "H5Lget_val_by_idx: return string not created");
} /* end if */
else {
- ENVPTR->SetObjectArrayElement(ENVPAR link_value, 1, str);
- HDfree(lValue);
+ 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 */
- } /* end else if */
- else {
- str = ENVPTR->NewStringUTF(ENVPAR (char *)lValue);
- if (str == NULL) {
- HDfree(lValue);
- h5JNIFatalError(env, "H5Lget_val_by_idx: return string not created");
- } /* end if */
+ } /* end else if */
else {
- ENVPTR->SetObjectArrayElement(ENVPAR link_value, 0, str);
- HDfree(lValue);
+ 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 */
- } /* end else */
+ UNPIN_JAVA_STRING(name, lName);
+ }
+
return infobuf.type;
} /* end Java_hdf_hdf5lib_H5_H5Lget_1val_1by_1idx */
@@ -541,20 +529,21 @@ Java_hdf_hdf5lib_H5_H5Lmove
const char *lCurName;
const char *lDstName;
- PIN_JAVA_STRING_TWO0(cur_name, lCurName, dst_name, lDstName);
+ 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);
- status = H5Lmove((hid_t)cur_loc_id, lCurName, (hid_t)dst_loc_id, lDstName, (hid_t)create_id, (hid_t)access_id);
+ UNPIN_JAVA_STRING_TWO(cur_name, lCurName, dst_name, lDstName);
- UNPIN_JAVA_STRING_TWO(cur_name, lCurName, dst_name, lDstName);
-
- if (status < 0)
- h5libraryError(env);
+ if (status < 0)
+ h5libraryError(env);
+ }
} /* 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 *op_data)
+ (hid_t g_id, const char *name, const H5L_info_t *info, void *op_data)
{
JNIEnv *cbenv;
jint status;
@@ -645,14 +634,15 @@ Java_hdf_hdf5lib_H5_H5Lvisit_1by_1name
h5nullArgument(env, "H5Lvisit_by_name: op_data or callback_op is NULL");
} /* end if */
else {
- PIN_JAVA_STRING(name, lName, -1);
-
- 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*)op_data, (hid_t)access_id);
+ 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*)op_data, (hid_t)access_id);
- UNPIN_JAVA_STRING(name, lName);
+ UNPIN_JAVA_STRING(name, lName);
- if (status < 0)
- h5libraryError(env);
+ if (status < 0)
+ h5libraryError(env);
+ }
} /* end else */
return status;
@@ -708,14 +698,15 @@ Java_hdf_hdf5lib_H5_H5Literate_1by_1name
h5nullArgument(env, "H5Literate_by_name: op_data or callback_op is NULL");
} /* end if */
else {
- PIN_JAVA_STRING(name, lName, -1);
+ 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*)op_data, (hid_t)access_id);
- 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*)op_data, (hid_t)access_id);
-
- UNPIN_JAVA_STRING(name, lName);
+ UNPIN_JAVA_STRING(name, lName);
- if (status < 0)
- h5libraryError(env);
+ if (status < 0)
+ h5libraryError(env);
+ }
} /* end else */
return status;
diff --git a/java/src/jni/h5lImp.h b/java/src/jni/h5lImp.h
index 93a187b..6b2f3e1 100644
--- a/java/src/jni/h5lImp.h
+++ b/java/src/jni/h5lImp.h
@@ -110,7 +110,7 @@ Java_hdf_hdf5lib_H5_H5Lget_1info_1by_1idx
* Method: H5Lget_name_by_idx
* Signature: (JLjava/lang/String;IIJJ)Ljava/lang/String;
*/
-JNIEXPORT jobject JNICALL
+JNIEXPORT jstring JNICALL
Java_hdf_hdf5lib_H5_H5Lget_1name_1by_1idx
(JNIEnv*, jclass, jlong, jstring, jint, jint, jlong, jlong);
diff --git a/java/src/jni/h5oImp.c b/java/src/jni/h5oImp.c
index 872bb4c..24f6988 100644
--- a/java/src/jni/h5oImp.c
+++ b/java/src/jni/h5oImp.c
@@ -46,17 +46,18 @@ JNIEXPORT jlong JNICALL
Java_hdf_hdf5lib_H5__1H5Oopen
(JNIEnv *env, jclass clss, jlong loc_id, jstring name, jlong access_plist_id)
{
- hid_t status;
+ hid_t status = -1;
const char *oName;
- PIN_JAVA_STRING(name, oName, -1);
+ PIN_JAVA_STRING(name, oName);
+ if (oName != NULL) {
+ status = H5Oopen((hid_t)loc_id, oName, (hid_t)access_plist_id );
- status = H5Oopen((hid_t)loc_id, oName, (hid_t)access_plist_id );
-
- UNPIN_JAVA_STRING(name, oName);
+ UNPIN_JAVA_STRING(name, oName);
- if (status < 0)
- h5libraryError(env);
+ if (status < 0)
+ h5libraryError(env);
+ }
return (jlong)status;
} /* end Java_hdf_hdf5lib_H5__1H5Oopen */
@@ -92,14 +93,15 @@ Java_hdf_hdf5lib_H5_H5Ocopy
const char *lCurName;
const char *lDstName;
- PIN_JAVA_STRING_TWO0(cur_name, lCurName, dst_name, lDstName);
+ 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);
- status = H5Ocopy((hid_t)cur_loc_id, lCurName, (hid_t)dst_loc_id, lDstName, (hid_t)create_id, (hid_t)access_id);
+ UNPIN_JAVA_STRING_TWO(cur_name, lCurName, dst_name, lDstName);
- UNPIN_JAVA_STRING_TWO(cur_name, lCurName, dst_name, lDstName);
-
- if (status < 0)
- h5libraryError(env);
+ if (status < 0)
+ h5libraryError(env);
+ }
} /* end Java_hdf_hdf5lib_H5_H5Ocopy */
/*
@@ -123,44 +125,44 @@ Java_hdf_hdf5lib_H5_H5Oget_1info
if (status < 0) {
h5libraryError(env);
- return NULL;
} /* end if */
-
- 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);
+ 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);
+ }
return ret_obj;
} /* end Java_hdf_hdf5lib_H5_H5Oget_1info */
@@ -183,52 +185,53 @@ Java_hdf_hdf5lib_H5_H5Oget_1info_1by_1name
jobject ihinfobuf2;
jobject ret_obj = NULL;
- PIN_JAVA_STRING(name, lName, NULL);
-
- status = H5Oget_info_by_name((hid_t)loc_id, lName, &infobuf, (hid_t)access_id);
+ PIN_JAVA_STRING(name, lName);
+ if (lName != NULL) {
+ status = H5Oget_info_by_name((hid_t)loc_id, lName, &infobuf, (hid_t)access_id);
- UNPIN_JAVA_STRING(name, lName);
+ UNPIN_JAVA_STRING(name, lName);
- if (status < 0) {
- h5libraryError(env);
- return NULL;
- } /* end if */
-
- 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);
+ 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);
+ }
+ }
return ret_obj;
} /* end Java_hdf_hdf5lib_H5_H5Oget_1info_1by_1name */
@@ -252,52 +255,53 @@ Java_hdf_hdf5lib_H5_H5Oget_1info_1by_1idx
jobject ihinfobuf2;
jobject ret_obj = NULL;
- PIN_JAVA_STRING(name, lName, NULL);
+ PIN_JAVA_STRING(name, lName);
+ if (lName != NULL) {
+ status = H5Oget_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);
- status = H5Oget_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);
- UNPIN_JAVA_STRING(name, lName);
-
- if (status < 0) {
- h5libraryError(env);
- return NULL;
- } /* end if */
-
- 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);
+ 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);
+ }
+ }
return ret_obj;
} /* end Java_hdf_hdf5lib_H5_H5Oget_1info_1by_1idx */
@@ -315,14 +319,15 @@ Java_hdf_hdf5lib_H5_H5Olink
herr_t status = -1;
const char *lDstName;
- PIN_JAVA_STRING0(dst_name, lDstName);
-
- status = H5Olink((hid_t)cur_loc_id, (hid_t)dst_loc_id, lDstName, (hid_t)create_id, (hid_t)access_id);
+ 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);
- UNPIN_JAVA_STRING(dst_name, lDstName);
+ UNPIN_JAVA_STRING(dst_name, lDstName);
- if (status < 0)
- h5libraryError(env);
+ if (status < 0)
+ h5libraryError(env);
+ }
} /* end Java_hdf_hdf5lib_H5_H5Olink */
static herr_t
@@ -347,90 +352,71 @@ H5O_iterate_cb
return -1;
} /* end if */
cls = CBENVPTR->GetObjectClass(CBENVPAR visit_callback);
- if (cls == 0) {
- /* printf("JNI H5O_iterate_cb error: GetObjectClass failed\n"); */
- JVMPTR->DetachCurrentThread(JVMPAR);
- return -1;
- } /* end if */
- 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) {
- /* printf("JNI H5O_iterate_cb error: GetMethodID failed\n"); */
- JVMPTR->DetachCurrentThread(JVMPAR);
- return -1;
+ 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);
+
+ 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);
+ 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);
+
+ 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);
+
+ status = CBENVPTR->CallIntMethod(CBENVPAR visit_callback, mid, g_id, str, cb_info_t, op_data);
+ }
+ }
+ }
+ }
+ }
+ }
+ }
} /* end if */
- 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) {
- JVMPTR->DetachCurrentThread(JVMPAR);
- return -1;
- } /* end if */
- // get a reference to the constructor; the name is <init>
- constructor = CBENVPTR->GetMethodID(CBENVPAR cls, "<init>", "(IIIIJJJJJJ)V");
- if (constructor == 0) {
- JVMPTR->DetachCurrentThread(JVMPAR);
- return -1;
- } /* end if */
- hdrinfobuf = CBENVPTR->NewObjectA(CBENVPAR cls, constructor, args);
-
- 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) {
- JVMPTR->DetachCurrentThread(JVMPAR);
- return -1;
- } /* end if */
- // get a reference to the constructor; the name is <init>
- constructor = CBENVPTR->GetMethodID(CBENVPAR cls, "<init>", "(JJ)V");
- if (constructor == 0) {
- JVMPTR->DetachCurrentThread(JVMPAR);
- return -1;
- } /* end if */
- ihinfobuf1 = CBENVPTR->NewObjectA(CBENVPAR cls, constructor, args);
- 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);
-
- 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) {
- JVMPTR->DetachCurrentThread(JVMPAR);
- return -1;
- } /* end if */
- // 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) {
- JVMPTR->DetachCurrentThread(JVMPAR);
- return -1;
- } /* end if */
- cb_info_t = CBENVPTR->NewObjectA(CBENVPAR cls, constructor, args);
-
- status = CBENVPTR->CallIntMethod(CBENVPAR visit_callback, mid, g_id, str, cb_info_t, op_data);
-
JVMPTR->DetachCurrentThread(JVMPAR);
return status;
@@ -453,17 +439,16 @@ Java_hdf_hdf5lib_H5_H5Ovisit
if (op_data == NULL) {
h5nullArgument(env, "H5Ovisit: op_data is NULL");
- return -1;
} /* end if */
- if (callback_op == NULL) {
+ else if (callback_op == NULL) {
h5nullArgument(env, "H5Ovisit: callback_op is NULL");
- return -1;
} /* end if */
+ else {
+ status = H5Ovisit((hid_t)grp_id, (H5_index_t)idx_type, (H5_iter_order_t)order, (H5O_iterate_t)H5O_iterate_cb, (void*)op_data);
- status = H5Ovisit((hid_t)grp_id, (H5_index_t)idx_type, (H5_iter_order_t)order, (H5O_iterate_t)H5O_iterate_cb, (void*)op_data);
-
- if (status < 0)
- h5libraryError(env);
+ if (status < 0)
+ h5libraryError(env);
+ }
return status;
} /* end Java_hdf_hdf5lib_H5_H5Ovisit */
@@ -488,19 +473,21 @@ Java_hdf_hdf5lib_H5_H5Ovisit_1by_1name
h5nullArgument(env, "H5Ovisit_by_name: op_data is NULL");
return -1;
} /* end if */
- if (callback_op == NULL) {
+ 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_name((hid_t)grp_id, lName, (H5_index_t)idx_type, (H5_iter_order_t)order, (H5O_iterate_t)H5O_iterate_cb, (void*)op_data, (hid_t)access_id);
- PIN_JAVA_STRING(name, lName, -1);
-
- status = H5Ovisit_by_name((hid_t)grp_id, lName, (H5_index_t)idx_type, (H5_iter_order_t)order, (H5O_iterate_t)H5O_iterate_cb, (void*)op_data, (hid_t)access_id);
-
- UNPIN_JAVA_STRING(name, lName);
+ UNPIN_JAVA_STRING(name, lName);
- if (status < 0)
- h5libraryError(env);
+ if (status < 0)
+ h5libraryError(env);
+ }
+ }
return status;
} /* end Java_hdf_hdf5lib_H5_H5Ovisit_1by_1name */
@@ -515,24 +502,20 @@ Java_hdf_hdf5lib_H5_H5Oset_1comment
(JNIEnv *env, jclass clss, jlong loc_id, jstring comment)
{
herr_t status = -1;
- const char *oComment;
+ const char *oComment = NULL;
jboolean isCopy;
if (comment == NULL) {
- oComment = NULL;
+ status = H5Oset_comment((hid_t)loc_id, oComment);
} /* end if */
else {
oComment = ENVPTR->GetStringUTFChars(ENVPAR comment, &isCopy);
- if (oComment == NULL) {
- h5JNIFatalError( env, "H5Oset_comment: comment not pinned");
- return;
- } /* end if */
- } /* end else */
-
- status = H5Oset_comment((hid_t)loc_id, oComment);
+ if (oComment != NULL) {
+ status = H5Oset_comment((hid_t)loc_id, oComment);
- if(oComment)
- ENVPTR->ReleaseStringUTFChars(ENVPAR comment, oComment);
+ ENVPTR->ReleaseStringUTFChars(ENVPAR comment, oComment);
+ }
+ } /* end else */
if (status < 0)
h5libraryError(env);
@@ -552,30 +535,25 @@ Java_hdf_hdf5lib_H5_H5Oset_1comment_1by_1name
const char *oName;
const char *oComment;
- PIN_JAVA_STRING0(name, oName);
-
- if (comment == NULL) {
- oComment = NULL;
- } /* end if */
- else {
- jboolean isCopy;
- oComment = ENVPTR->GetStringUTFChars(ENVPAR comment, &isCopy);
- if (oComment == NULL) {
- UNPIN_JAVA_STRING(name, oName);
- h5JNIFatalError( env, "H5Oset_comment_by_name: comment not pinned");
- return;
+ 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 */
- } /* end else */
-
- status = H5Oset_comment_by_name((hid_t)loc_id, oName, oComment, (hid_t)access_id);
+ 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(oComment)
- ENVPTR->ReleaseStringUTFChars(ENVPAR comment, oComment);
+ UNPIN_JAVA_STRING(name, oName);
- if (status < 0)
- h5libraryError(env);
+ if (status < 0)
+ h5libraryError(env);
+ }
} /* end Java_hdf_hdf5lib_H5_H5Oset_1comment_1by_1name */
/*
@@ -596,34 +574,30 @@ Java_hdf_hdf5lib_H5_H5Oget_1comment
buf_size = H5Oget_comment((hid_t)loc_id, NULL, 0);
if (buf_size < 0) {
h5badArgument( env, "H5Oget_comment: buf_size < 0");
- return NULL;
- } /* end if */
- if (buf_size == 0) {
- return NULL;
} /* end if */
-
- 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");
- return NULL;
- } /* end if */
-
- status = H5Oget_comment((hid_t)loc_id, oComment, (size_t)buf_size);
-
- if (status >= 0) {
- /* may throw OutOfMemoryError */
- str = ENVPTR->NewStringUTF(ENVPAR oComment);
- HDfree(oComment);
- if (str == NULL) {
- h5JNIFatalError( env, "H5Oget_comment: return string not allocated");
+ 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 */
- } /* end if */
- else {
- HDfree(oComment);
- h5libraryError(env);
- } /* end else */
+ 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 */
return (jstring)str;
} /* end Java_hdf_hdf5lib_H5_H5Oget_1comment */
@@ -643,43 +617,37 @@ Java_hdf_hdf5lib_H5_H5Oget_1comment_1by_1name
ssize_t status;
jstring str = NULL;
- PIN_JAVA_STRING(name, 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) {
- UNPIN_JAVA_STRING(name, oName);
- h5badArgument( env, "H5Oget_comment_by_name: buf_size < 0");
- return NULL;
- } /* end if */
- if (buf_size == 0) {
- UNPIN_JAVA_STRING(name, oName);
- return NULL;
- } /* end if */
-
- buf_size++; /* add extra space for the null terminator */
- oComment = (char *)HDmalloc(sizeof(char) * (size_t)buf_size);
- if (oComment == NULL) {
- UNPIN_JAVA_STRING(name, oName);
- h5outOfMemory( env, "H5Oget_comment_by_name: malloc failed");
- return NULL;
- } /* end if */
-
- status = H5Oget_comment_by_name((hid_t)loc_id, oName, oComment, (size_t)buf_size, (hid_t)access_id);
- UNPIN_JAVA_STRING(name, oName);
-
- if (status >= 0) {
- /* may throw OutOfMemoryError */
- str = ENVPTR->NewStringUTF(ENVPAR oComment);
- HDfree(oComment);
- if (str == NULL) {
- h5JNIFatalError( env, "H5Oget_comment_by_name: return string not allocated");
+ 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 */
- } /* end if */
- else {
- HDfree(oComment);
- h5libraryError(env);
- } /* end else */
+ 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);
+ }
return (jstring)str;
} /* end Java_hdf_hdf5lib_H5_H5Oget_1comment_1by_1name */
@@ -696,16 +664,17 @@ Java_hdf_hdf5lib_H5_H5Oexists_1by_1name
htri_t bval = JNI_FALSE;
const char *oName;
- PIN_JAVA_STRING(name, oName, JNI_FALSE);
-
- bval = H5Oexists_by_name((hid_t)loc_id, oName, (hid_t)access_id);
+ PIN_JAVA_STRING(name, oName);
+ if (oName != NULL) {
+ bval = H5Oexists_by_name((hid_t)loc_id, oName, (hid_t)access_id);
- UNPIN_JAVA_STRING(name, oName);
+ UNPIN_JAVA_STRING(name, oName);
- if (bval > 0)
- bval = JNI_TRUE;
- else if (bval < 0)
- h5libraryError(env);
+ if (bval > 0)
+ bval = JNI_TRUE;
+ else if (bval < 0)
+ h5libraryError(env);
+ }
return (jboolean)bval;
} /* end Java_hdf_hdf5lib_H5_H5Oexists_1by_1name */
@@ -767,14 +736,15 @@ Java_hdf_hdf5lib_H5__1H5Oopen_1by_1idx
hid_t retVal = -1;
const char *oName;
- PIN_JAVA_STRING(name, oName, -1);
+ 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 );
- 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 );
+ UNPIN_JAVA_STRING(name, oName);
- UNPIN_JAVA_STRING(name, oName);
-
- if (retVal < 0)
- h5libraryError(env);
+ if (retVal < 0)
+ h5libraryError(env);
+ }
return (jlong)retVal;
} /* end Java_hdf_hdf5lib_H5__1H5Oopen_1by_1idx */
@@ -786,7 +756,7 @@ Java_hdf_hdf5lib_H5__1H5Oopen_1by_1idx
*/
JNIEXPORT void JNICALL
Java_hdf_hdf5lib_H5_H5Oflush
- (JNIEnv *env, jclass clss, jlong loc_id)
+ (JNIEnv *env, jclass clss, jlong loc_id)
{
if (H5Oflush((hid_t)loc_id) < 0)
h5libraryError(env);
@@ -799,7 +769,7 @@ Java_hdf_hdf5lib_H5_H5Oflush
*/
JNIEXPORT void JNICALL
Java_hdf_hdf5lib_H5_H5Orefresh
- (JNIEnv *env, jclass clss, jlong loc_id)
+ (JNIEnv *env, jclass clss, jlong loc_id)
{
if (H5Orefresh((hid_t)loc_id) < 0)
h5libraryError(env);
diff --git a/java/src/jni/h5pImp.c b/java/src/jni/h5pImp.c
index 11dcbe5..ad79733 100644
--- a/java/src/jni/h5pImp.c
+++ b/java/src/jni/h5pImp.c
@@ -632,14 +632,15 @@ Java_hdf_hdf5lib_H5_H5Pset_1external
off = (off_t)offset;
sz = (hsize_t)size;
- PIN_JAVA_STRING(name, fileName, -1);
+ PIN_JAVA_STRING(name, fileName);
+ if (fileName != NULL) {
+ status = H5Pset_external(plid, fileName, off, sz);
- status = H5Pset_external(plid, fileName, off, sz);
+ UNPIN_JAVA_STRING(name, fileName);
- UNPIN_JAVA_STRING(name, fileName);
-
- if (status < 0)
- h5libraryError(env);
+ if (status < 0)
+ h5libraryError(env);
+ }
return (jint)status;
} /* end Java_hdf_hdf5lib_H5_H5Pset_1external */
@@ -675,66 +676,57 @@ Java_hdf_hdf5lib_H5_H5Pget_1external
herr_t status = -1;
jlong *theArray;
jboolean isCopy;
- char *file;
+ char *file = NULL;
jstring str;
off_t o;
hsize_t s;
if (name_size < 0) {
h5badArgument(env, "H5Pget_external: name_size < 0");
- return -1;
} /* end if */
- else if (name_size == 0) {
- file = NULL;
+ else if ((size != NULL) && (ENVPTR->GetArrayLength(ENVPAR size) < 2)) {
+ h5badArgument(env, "H5Pget_external: size input array < 2");
} /* end else if */
else {
- file = (char *)HDmalloc(sizeof(char)*(size_t)name_size);
- } /* end else */
+ if (name_size > 0) {
+ file = (char *)HDmalloc(sizeof(char)*(size_t)name_size);
+ } /* end else */
- if (size != NULL) {
- if (ENVPTR->GetArrayLength(ENVPAR size) < 2) {
- HDfree(file);
- h5badArgument(env, "H5Pget_external: size input array < 2");
- return -1;
- } /* end if */
- theArray = (jlong *)ENVPTR->GetLongArrayElements(ENVPAR size, &isCopy);
- if (theArray == NULL) {
+ status = H5Pget_external((hid_t) plist, (unsigned)idx, (size_t)name_size,
+ file, (off_t *)&o, (hsize_t *)&s);
+ if (status < 0) {
HDfree(file);
- h5JNIFatalError( env, "H5Pget_external: size array not pinned");
- return -1;
- } /* end if */
- } /* end if */
-
- status = H5Pget_external((hid_t) plist, (unsigned)idx, (size_t)name_size,
- file, (off_t *)&o, (hsize_t *)&s);
- if (status < 0) {
- if (size != NULL) {
- ENVPTR->ReleaseLongArrayElements(ENVPAR size, theArray, JNI_ABORT);
- } /* end if */
- HDfree(file);
- h5libraryError(env);
- } /* end if */
- else {
- if (size != NULL) {
- theArray[0] = o;
- theArray[1] = (jlong)s;
- ENVPTR->ReleaseLongArrayElements(ENVPAR size, theArray, 0);
+ 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");
+ 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 */
- else {
- /* SetObjectArrayElement may raise exceptions */
- ENVPTR->SetObjectArrayElement(ENVPAR name, 0, (jobject)str);
- HDfree(file);
- } /* end else */
- } /* end if */
- } /* end else */
+ } /* end else */
+ }
+
return (jint)status;
} /* end Java_hdf_hdf5lib_H5_H5Pget_1external */
@@ -748,26 +740,28 @@ Java_hdf_hdf5lib_H5_H5Pset_1fill_1value
(JNIEnv *env, jclass clss, jlong plist_id, jlong type_id, jbyteArray value)
{
jint status = -1;
- jbyte *byteP;
+ 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");
- return -1;
} /* end if */
- } /* end if */
-
- status = H5Pset_fill_value((hid_t)plist_id, (hid_t)type_id, byteP);
+ else {
+ status = H5Pset_fill_value((hid_t)plist_id, (hid_t)type_id, byteP);
- if (value != NULL)
- ENVPTR->ReleaseByteArrayElements(ENVPAR value, byteP, JNI_ABORT);
+ 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 status;
+ return (jint)status;
} /* end Java_hdf_hdf5lib_H5_H5Pset_1fill_1value */
/*
@@ -802,7 +796,7 @@ Java_hdf_hdf5lib_H5_H5Pget_1fill_1value
} /* end else */
} /* end else */
- return status;
+ return (jint)status;
} /* end Java_hdf_hdf5lib_H5_H5Pget_1fill_1value */
/*
@@ -874,6 +868,7 @@ Java_hdf_hdf5lib_H5_H5Pget_1filter
jint *flagsArray;
jlong *cd_nelmtsArray;
jint *cd_valuesArray;
+ jint mode = JNI_ABORT;
jboolean isCopy;
jstring str;
char *filter;
@@ -893,65 +888,59 @@ Java_hdf_hdf5lib_H5_H5Pget_1filter
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 */
- cd_valuesArray = (jint *)ENVPTR->GetIntArrayElements(ENVPAR cd_values, &isCopy);
- if (cd_valuesArray == NULL) {
- 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;
- 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) {
- ENVPTR->ReleaseIntArrayElements(ENVPAR cd_values, cd_valuesArray, JNI_ABORT);
- ENVPTR->ReleaseLongArrayElements(ENVPAR cd_nelmts, cd_nelmtsArray, JNI_ABORT);
- ENVPTR->ReleaseIntArrayElements(ENVPAR flags, flagsArray, JNI_ABORT);
- HDfree(filter);
- h5libraryError(env);
+ h5outOfMemory(env, "H5Pget_filter: namelen malloc failed");
} /* end if */
else {
- ENVPTR->ReleaseIntArrayElements(ENVPAR cd_values, cd_valuesArray, 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");
+ flagsArray = (jint *)ENVPTR->GetIntArrayElements(ENVPAR flags, &isCopy);
+ if (flagsArray == NULL) {
+ h5JNIFatalError(env, "H5Pget_filter: flags array not pinned");
} /* end if */
else {
- /* SetObjectArrayElement may throw exceptiosn */
- ENVPTR->SetObjectArrayElement(ENVPAR name, 0, (jobject)str);
- } /* end else */
- } /* end 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;
@@ -1007,15 +996,12 @@ Java_hdf_hdf5lib_H5_H5Pget_1cache
{
herr_t status = -1;
jint mode;
- jdouble *w0Array;
- jlong *rdcc_nelmtsArray;
- jlong *nbytesArray;
+ jdouble *w0Array = (jdouble *)NULL;
+ jlong *rdcc_nelmtsArray = (jlong *)NULL;
+ jlong *nbytesArray = (jlong *)NULL;
jboolean isCopy;
- if (rdcc_w0 == NULL) {
- w0Array = (jdouble *)NULL;
- } /* end if */
- else {
+ if (rdcc_w0 != NULL) {
w0Array = (jdouble *)ENVPTR->GetDoubleArrayElements(ENVPAR rdcc_w0, &isCopy);
if (w0Array == NULL) {
h5JNIFatalError(env, "H5Pget_cache: w0_array array not pinned");
@@ -1023,10 +1009,7 @@ Java_hdf_hdf5lib_H5_H5Pget_1cache
} /* end if */
} /* end else */
- if (rdcc_nelmts == NULL) {
- rdcc_nelmtsArray = (jlong *) NULL;
- } /* end if */
- else {
+ if (rdcc_nelmts != NULL) {
rdcc_nelmtsArray = (jlong *)ENVPTR->GetLongArrayElements(ENVPAR rdcc_nelmts, &isCopy);
if (rdcc_nelmtsArray == NULL) {
/* exception -- out of memory */
@@ -1038,10 +1021,7 @@ Java_hdf_hdf5lib_H5_H5Pget_1cache
} /* end if */
} /* end else */
- if (rdcc_nbytes == NULL) {
- nbytesArray = (jlong *) NULL;
- } /* end if */
- else {
+ if (rdcc_nbytes != NULL) {
nbytesArray = (jlong *)ENVPTR->GetLongArrayElements(ENVPAR rdcc_nbytes, &isCopy);
if (nbytesArray == NULL) {
if (w0Array != NULL) {
@@ -1148,7 +1128,7 @@ Java_hdf_hdf5lib_H5_H5Pset_1buffer
if (bkg != NULL)
ENVPTR->ReleaseByteArrayElements(ENVPAR bkg, bkgP, 0);
- return status;
+ return (jint)status;
#endif
} /* end Java_hdf_hdf5lib_H5_H5Pset_1buffer */
@@ -1200,7 +1180,7 @@ Java_hdf_hdf5lib_H5_H5Pget_1buffer
ENVPTR->ReleaseByteArrayElements(ENVPAR tconv, tconvP, 0);
ENVPTR->ReleaseByteArrayElements(ENVPAR bkg, bkgP, 0);
- return status;
+ return (jint)status;
#endif
} /* end Java_hdf_hdf5lib_H5_H5Pget_1buffer */
@@ -1998,6 +1978,7 @@ Java_hdf_hdf5lib_H5_H5Pget_1fapl_1family
herr_t status = -1;
jlong *sizeArray;
jlong *plistArray;
+ jint mode = JNI_ABORT;
jboolean isCopy;
hsize_t *sa;
size_t i;
@@ -2013,39 +1994,36 @@ Java_hdf_hdf5lib_H5_H5Pget_1fapl_1family
sizeArray = (jlong *)ENVPTR->GetLongArrayElements(ENVPAR memb_size, &isCopy);
if (sizeArray == NULL) {
h5JNIFatalError(env, "H5Pget_family: sizeArray not pinned");
- return -1;
- } /* end if */
- rank = (size_t)ENVPTR->GetArrayLength(ENVPAR memb_size);
- sa = (hsize_t *)HDmalloc(rank * sizeof(hsize_t));
- if (sa == NULL) {
- ENVPTR->ReleaseLongArrayElements(ENVPAR memb_size, sizeArray, JNI_ABORT);
- h5JNIFatalError(env, "H5Screate-simple: dims not converted to hsize_t");
- return -1;
- } /* end if */
- plistArray = (jlong *)ENVPTR->GetLongArrayElements(ENVPAR memb_plist, &isCopy);
- if (plistArray == NULL) {
- HDfree(sa);
- ENVPTR->ReleaseLongArrayElements(ENVPAR memb_size, sizeArray, JNI_ABORT);
- h5JNIFatalError(env, "H5Pget_family: plistArray not pinned");
- return -1;
- } /* end if */
-
- status = H5Pget_fapl_family ((hid_t)tid, sa, (hid_t *)plistArray);
-
- if (status < 0) {
- HDfree(sa);
- ENVPTR->ReleaseLongArrayElements(ENVPAR memb_size, sizeArray, JNI_ABORT);
- ENVPTR->ReleaseLongArrayElements(ENVPAR memb_plist, plistArray, JNI_ABORT);
- h5libraryError(env);
} /* end if */
else {
- for (i = 0; i < rank; i++) {
- sizeArray[i] = (jlong)sa[i];
- } /* end for */
- HDfree(sa);
- ENVPTR->ReleaseLongArrayElements(ENVPAR memb_size, sizeArray, 0);
- ENVPTR->ReleaseLongArrayElements(ENVPAR memb_plist, plistArray, 0);
- } /* end else */
+ rank = (size_t)ENVPTR->GetArrayLength(ENVPAR memb_size);
+ sa = (hsize_t *)HDmalloc(rank * sizeof(hsize_t));
+ if (sa == NULL) {
+ h5JNIFatalError(env, "H5Screate-simple: dims not converted to hsize_t");
+ } /* end if */
+ else {
+ plistArray = (jlong *)ENVPTR->GetLongArrayElements(ENVPAR memb_plist, &isCopy);
+ if (plistArray == NULL) {
+ h5JNIFatalError(env, "H5Pget_family: plistArray not pinned");
+ } /* end if */
+ else {
+ status = H5Pget_fapl_family ((hid_t)tid, sa, (hid_t *)plistArray);
+
+ if (status < 0) {
+ h5libraryError(env);
+ } /* end if */
+ else {
+ for (i = 0; i < rank; i++) {
+ sizeArray[i] = (jlong)sa[i];
+ } /* end for */
+ mode = 0;
+ } /* end else */
+ ENVPTR->ReleaseLongArrayElements(ENVPAR memb_plist, plistArray, mode);
+ }
+ HDfree(sa);
+ }
+ ENVPTR->ReleaseLongArrayElements(ENVPAR memb_size, sizeArray, mode);
+ }
} /* end else */
return (jint)status;
@@ -2079,6 +2057,7 @@ Java_hdf_hdf5lib_H5_H5Pget_1fapl_1core
(JNIEnv *env, jclass clss, jlong fapl_id, jlongArray increment, jbooleanArray backing_store)
{
herr_t status = -1;
+ jint mode = JNI_ABORT;
jlong *incArray;
jboolean *backArray;
jboolean isCopy;
@@ -2093,34 +2072,32 @@ Java_hdf_hdf5lib_H5_H5Pget_1fapl_1core
incArray = (jlong *)ENVPTR->GetLongArrayElements(ENVPAR increment, &isCopy);
if (incArray == NULL) {
h5JNIFatalError(env, "H5Pget_fapl_core: incArray not pinned");
- return -1;
- } /* end if */
-
- backArray = (jboolean *)ENVPTR->GetBooleanArrayElements(ENVPAR backing_store, &isCopy);
- if (backArray == NULL) {
- ENVPTR->ReleaseLongArrayElements(ENVPAR increment, incArray, JNI_ABORT);
- h5JNIFatalError(env, "H5Pget_fapl_core: backArray not pinned");
- return -1;
} /* 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;
- { /* 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);
+ status = H5Pget_fapl_core((hid_t)fapl_id, &inc_t, (hbool_t *)backArray);
- *incArray = (jlong)inc_t;
- } /* end direct cast special */
+ *incArray = (jlong)inc_t;
+ /* end direct cast special */
- if (status < 0) {
- ENVPTR->ReleaseLongArrayElements(ENVPAR increment, incArray, JNI_ABORT);
- ENVPTR->ReleaseBooleanArrayElements(ENVPAR backing_store, backArray, JNI_ABORT);
- h5libraryError(env);
- } /* end if */
- else {
- ENVPTR->ReleaseLongArrayElements(ENVPAR increment, incArray, 0);
- ENVPTR->ReleaseBooleanArrayElements(ENVPAR backing_store, backArray, 0);
- } /* end else */
+ 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 */
return (jint)status;
@@ -2175,14 +2152,15 @@ Java_hdf_hdf5lib_H5_H5Pset_1fapl_1log
herr_t retVal = -1;
const char *pLogfile;
- PIN_JAVA_STRING0(logfile, pLogfile);
-
- retVal = H5Pset_fapl_log( (hid_t)fapl_id, pLogfile, (unsigned long long)flags, (size_t)buf_size );
+ 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 );
- UNPIN_JAVA_STRING(logfile, pLogfile);
+ UNPIN_JAVA_STRING(logfile, pLogfile);
- if (retVal < 0)
- h5libraryError(env);
+ if (retVal < 0)
+ h5libraryError(env);
+ }
} /* end Java_hdf_hdf5lib_H5_H5Pset_1fapl_1log */
/*
@@ -2200,7 +2178,7 @@ Java_hdf_hdf5lib_H5_H5P1remove_1filter
if (status < 0)
h5libraryError(env);
- return status;
+ return (jint)status;
} /* end Java_hdf_hdf5lib_H5_H5P1remove_1filter */
@@ -2216,14 +2194,15 @@ Java_hdf_hdf5lib_H5_H5Pset
hid_t retVal = -1;
const char *cstr;
- PIN_JAVA_STRING(name, cstr, -1);
+ PIN_JAVA_STRING(name, cstr);
+ if (cstr != NULL) {
+ retVal = H5Pset((hid_t)plid, cstr, &val);
- retVal = H5Pset((hid_t)plid, cstr, &val);
-
- UNPIN_JAVA_STRING(name, cstr);
+ UNPIN_JAVA_STRING(name, cstr);
- if (retVal < 0)
- h5libraryError(env);
+ if (retVal < 0)
+ h5libraryError(env);
+ }
return (jlong)retVal;
} /* end Java_hdf_hdf5lib_H5_H5Pset */
@@ -2240,16 +2219,17 @@ Java_hdf_hdf5lib_H5_H5Pexist
htri_t bval = JNI_FALSE;
const char *cstr;
- PIN_JAVA_STRING(name, cstr, JNI_FALSE);
+ PIN_JAVA_STRING(name, cstr);
+ if (cstr != NULL) {
+ bval = H5Pexist((hid_t)plid, cstr);
- bval = H5Pexist((hid_t)plid, cstr);
-
- UNPIN_JAVA_STRING(name, cstr);
+ UNPIN_JAVA_STRING(name, cstr);
- if (bval > 0)
- bval = JNI_TRUE;
- else if (bval < 0)
- h5libraryError(env);
+ if (bval > 0)
+ bval = JNI_TRUE;
+ else if (bval < 0)
+ h5libraryError(env);
+ }
return (jboolean)bval;
} /* end Java_hdf_hdf5lib_H5_H5Pexist */
@@ -2265,16 +2245,17 @@ Java_hdf_hdf5lib_H5_H5Pget_1size
{
hid_t retVal = -1;
const char *cstr;
- size_t size;
+ size_t size = 0;
- PIN_JAVA_STRING(name, cstr, -1);
+ PIN_JAVA_STRING(name, cstr);
+ if (cstr != NULL) {
+ retVal = H5Pget_size((hid_t)plid, cstr, &size);
- retVal = H5Pget_size((hid_t)plid, cstr, &size);
-
- UNPIN_JAVA_STRING(name, cstr);
+ UNPIN_JAVA_STRING(name, cstr);
- if (retVal < 0)
- h5libraryError(env);
+ if (retVal < 0)
+ h5libraryError(env);
+ }
return (jlong) size;
} /* end Java_hdf_hdf5lib_H5_H5Pget_1size */
@@ -2306,7 +2287,7 @@ Java_hdf_hdf5lib_H5_H5Pget_1class_1name
(JNIEnv *env, jclass clss, jlong plid)
{
char *c_str;
- jstring j_str;
+ jstring j_str = NULL;
c_str = H5Pget_class_name((hid_t)plid);
if (c_str == NULL) {
@@ -2371,14 +2352,15 @@ Java_hdf_hdf5lib_H5_H5Pget
const char *cstr;
jint val;
- PIN_JAVA_STRING(name, cstr, -1);
+ PIN_JAVA_STRING(name, cstr);
+ if (cstr != NULL) {
+ retVal = H5Pget((hid_t)plid, cstr, &val);
- retVal = H5Pget((hid_t)plid, cstr, &val);
-
- UNPIN_JAVA_STRING(name, cstr);
+ UNPIN_JAVA_STRING(name, cstr);
- if (retVal < 0)
- h5libraryError(env);
+ if (retVal < 0)
+ h5libraryError(env);
+ }
return (jint)val;
} /* end Java_hdf_hdf5lib_H5_H5Pget */
@@ -2413,14 +2395,15 @@ Java_hdf_hdf5lib_H5_H5Pcopy_1prop
herr_t retVal = -1;
const char *cstr;
- PIN_JAVA_STRING(name, cstr, -1);
+ PIN_JAVA_STRING(name, cstr);
+ if (cstr != NULL) {
+ retVal = H5Pcopy_prop((hid_t)dst_plid, (hid_t)src_plid, cstr);
- retVal = H5Pcopy_prop((hid_t)dst_plid, (hid_t)src_plid, cstr);
-
- UNPIN_JAVA_STRING(name, cstr);
+ UNPIN_JAVA_STRING(name, cstr);
- if (retVal < 0)
- h5libraryError(env);
+ if (retVal < 0)
+ h5libraryError(env);
+ }
return (jint)retVal;
} /* end Java_hdf_hdf5lib_H5_H5Pcopy_1prop */
@@ -2437,14 +2420,15 @@ Java_hdf_hdf5lib_H5_H5Premove
herr_t retVal = -1;
const char *cstr;
- PIN_JAVA_STRING(name, cstr, -1);
+ PIN_JAVA_STRING(name, cstr);
+ if (cstr != NULL) {
+ retVal = H5Premove((hid_t)plid, cstr);
- retVal = H5Premove((hid_t)plid, cstr);
-
- UNPIN_JAVA_STRING(name, cstr);
+ UNPIN_JAVA_STRING(name, cstr);
- if (retVal < 0)
- h5libraryError(env);
+ if (retVal < 0)
+ h5libraryError(env);
+ }
return (jint)retVal;
} /* end Java_hdf_hdf5lib_H5_H5Premove */
@@ -2461,14 +2445,15 @@ Java_hdf_hdf5lib_H5_H5Punregister
herr_t retVal = -1;
const char *cstr;
- PIN_JAVA_STRING(name, cstr, -1);
-
- retVal = H5Punregister((hid_t)plid, cstr);
+ PIN_JAVA_STRING(name, cstr);
+ if (cstr != NULL) {
+ retVal = H5Punregister((hid_t)plid, cstr);
- UNPIN_JAVA_STRING(name, cstr);
+ UNPIN_JAVA_STRING(name, cstr);
- if (retVal < 0)
- h5libraryError(env);
+ if (retVal < 0)
+ h5libraryError(env);
+ }
return (jint)retVal;
} /* end Java_hdf_hdf5lib_H5_H5Punregister */
@@ -2976,14 +2961,15 @@ Java_hdf_hdf5lib_H5_H5Pset_1data_1transform
herr_t retVal = -1;
const char *express;
- PIN_JAVA_STRING(expression, express, -1);
-
- retVal = H5Pset_data_transform((hid_t)plist_id, express);
+ PIN_JAVA_STRING(expression, express);
+ if (express != NULL) {
+ retVal = H5Pset_data_transform((hid_t)plist_id, express);
- UNPIN_JAVA_STRING(expression, express);
+ UNPIN_JAVA_STRING(expression, express);
- if (retVal < 0)
- h5libraryError(env);
+ if (retVal < 0)
+ h5libraryError(env);
+ }
return (jint)retVal;
} /* end Java_hdf_hdf5lib_H5_H5Pset_1data_1transform */
@@ -3566,14 +3552,15 @@ Java_hdf_hdf5lib_H5_H5Pset_1elink_1prefix
herr_t retVal = -1;
const char *aName;
- PIN_JAVA_STRING(prefix, aName, -1);
+ PIN_JAVA_STRING(prefix, aName);
+ if (aName != NULL) {
+ retVal = H5Pset_elink_prefix((hid_t)lapl_id, aName);
- retVal = H5Pset_elink_prefix((hid_t)lapl_id, aName);
+ UNPIN_JAVA_STRING(prefix, aName);
- UNPIN_JAVA_STRING(prefix, aName);
-
- if(retVal < 0)
- h5libraryError(env);
+ if(retVal < 0)
+ h5libraryError(env);
+ }
return (jint)retVal;
} /* end Java_hdf_hdf5lib_H5_H5Pset_1elink_1prefix */
@@ -3589,7 +3576,7 @@ Java_hdf_hdf5lib_H5_H5Pget_1elink_1prefix
{
size_t size = 0;
char *pre;
- jlong prefix_size;
+ jlong prefix_size = -1;
jstring str = NULL;
if (prefix == NULL) {
@@ -3966,14 +3953,15 @@ Java_hdf_hdf5lib_H5_H5Pset_1fapl_1split
const char *mstr;
const char *rstr;
- PIN_JAVA_STRING_TWO0(metaext, mstr, rawext, 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);
- 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);
- UNPIN_JAVA_STRING_TWO(metaext, mstr, rawext, rstr);
-
- if (retVal < 0)
- h5libraryError(env);
+ if (retVal < 0)
+ h5libraryError(env);
+ }
} /* end Java_hdf_hdf5lib_H5_H5Pset_1fapl_1split */
/*
@@ -4034,7 +4022,7 @@ Java_hdf_hdf5lib_H5_H5Pget_1sieve_1buf_1size
{
size_t s;
- if ( H5Pget_sieve_buf_size((hid_t)plist, &s) < 0)
+ if (H5Pget_sieve_buf_size((hid_t)plist, &s) < 0)
h5libraryError(env);
return (jlong)s;
@@ -4486,13 +4474,13 @@ Java_hdf_hdf5lib_H5_H5Pset_1mdc_1config
cacheinfo.metadata_write_strategy = ENVPTR->GetIntField(ENVPAR cache_config, fid);
if(ENVPTR->ExceptionOccurred(ENVONLY)) {
h5JNIFatalError(env, "H5Pset_mdc_config: loading metadata_write_strategy failed");
- return;
} /* end if */
+ else {
+ status = H5Pset_mdc_config((hid_t)plist, &cacheinfo);
- status = H5Pset_mdc_config((hid_t)plist, &cacheinfo);
-
- if (status < 0)
- h5libraryError(env);
+ if (status < 0)
+ h5libraryError(env);
+ }
} /* end Java_hdf_hdf5lib_H5_H5Pset_1mdc_1config */
/*
@@ -4521,15 +4509,12 @@ Java_hdf_hdf5lib_H5_H5Pget_1chunk_1cache
{
herr_t status = -1;
jint mode;
- jdouble *w0Array;
- jlong *rdcc_nslotsArray;
- jlong *nbytesArray;
+ jdouble *w0Array = (jdouble *)NULL;
+ jlong *rdcc_nslotsArray = (jlong *)NULL;
+ jlong *nbytesArray = (jlong *)NULL;
jboolean isCopy;
- if (rdcc_w0 == NULL) {
- w0Array = (jdouble *)NULL;
- } /* end if */
- else {
+ 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");
@@ -4537,10 +4522,7 @@ Java_hdf_hdf5lib_H5_H5Pget_1chunk_1cache
} /* end if */
} /* end else */
- if (rdcc_nslots == NULL) {
- rdcc_nslotsArray = (jlong *)NULL;
- } /* end if */
- else {
+ if (rdcc_nslots != NULL) {
rdcc_nslotsArray = (jlong *)ENVPTR->GetLongArrayElements(ENVPAR rdcc_nslots, &isCopy);
if (rdcc_nslotsArray == NULL) {
/* exception -- out of memory */
@@ -4552,10 +4534,7 @@ Java_hdf_hdf5lib_H5_H5Pget_1chunk_1cache
} /* end if */
} /* end else */
- if (rdcc_nbytes == NULL) {
- nbytesArray = (jlong *)NULL;
- } /* end if */
- else {
+ if (rdcc_nbytes != NULL) {
nbytesArray = (jlong *)ENVPTR->GetLongArrayElements(ENVPAR rdcc_nbytes, &isCopy);
if (nbytesArray == NULL) {
if (w0Array != NULL) {
@@ -4691,14 +4670,15 @@ Java_hdf_hdf5lib_H5_H5Pset_1virtual
const char *fstr;
const char *dstr;
- PIN_JAVA_STRING_TWO0(src_file_name, fstr, src_dset_name, dstr);
-
- retVal = H5Pset_virtual((hid_t)dcpl_id, (hid_t)vspace_id, fstr, dstr, (hid_t)src_space_id);
+ 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);
+ UNPIN_JAVA_STRING_TWO(src_file_name, fstr, src_dset_name, dstr);
- if (retVal < 0)
- h5libraryError(env);
+ if (retVal < 0)
+ h5libraryError(env);
+ }
} /* end Java_hdf_hdf5lib_H5_H5Pset_1virtual */
/*
@@ -4981,7 +4961,7 @@ H5P_cls_create_cb
} /* end if */
} /* end if */
JVMPTR->DetachCurrentThread(JVMPAR);
- return status;
+ return (herr_t)status;
} /* end H5P_cls_create_cb */
static herr_t
@@ -4989,7 +4969,7 @@ H5P_cls_copy_cb
(hid_t new_prop_id, hid_t old_prop_id, void *copy_data)
{
JNIEnv *cbenv;
- jint status;
+ jint status = -1;
jclass cls;
jmethodID mid;
jmethodID constructor;
@@ -5004,7 +4984,7 @@ H5P_cls_copy_cb
} /* end if */
} /* end if */
JVMPTR->DetachCurrentThread(JVMPAR);
- return status;
+ return (herr_t)status;
} /* end H5P_cls_ccopy_cb */
static herr_t
@@ -5012,7 +4992,7 @@ H5P_cls_close_cb
(hid_t prop_id, void *close_data)
{
JNIEnv *cbenv;
- jint status;
+ jint status = -1;
jclass cls;
jmethodID mid;
jmethodID constructor;
@@ -5027,7 +5007,7 @@ H5P_cls_close_cb
} /* end if */
} /* end if */
JVMPTR->DetachCurrentThread(JVMPAR);
- return status;
+ return (herr_t)status;
} /* end H5P_cls_close_cb */
static herr_t
@@ -5035,7 +5015,7 @@ H5D_append_cb
(hid_t dataset_id, hsize_t *cur_dims, void *op_data)
{
JNIEnv *cbenv;
- jint status;
+ jint status = -1;
jclass cls;
jmethodID mid;
jlongArray cur_dimsArray;
@@ -5046,33 +5026,22 @@ H5D_append_cb
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", "(J[JLhdf/hdf5lib/callbacks/H5D_append_t;)I");
- if (mid == 0) {
- JVMPTR->DetachCurrentThread(JVMPAR);
- return -1;
- } /* end if */
-
- if (cur_dims == NULL) {
- JVMPTR->DetachCurrentThread(JVMPAR);
- return -1;
- } /* end if */
-
- cur_dimsArray = CBENVPTR->NewLongArray(CBENVPAR 2);
- if (cur_dimsArray == NULL) {
- JVMPTR->DetachCurrentThread(JVMPAR);
- return -1;
+ 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 */
- CBENVPTR->SetLongArrayRegion(CBENVPAR cur_dimsArray, 0, 2, (const jlong *)cur_dims);
-
- status = CBENVPTR->CallIntMethod(CBENVPAR visit_callback, mid, dataset_id, cur_dims, op_data);
-
JVMPTR->DetachCurrentThread(JVMPAR);
- return status;
+ return (herr_t)status;
} /* end H5D_append_cb */
/*
@@ -5115,14 +5084,15 @@ Java_hdf_hdf5lib_H5__1H5Pcreate_1class_1nocb
hid_t class_id = -1;
const char *cstr;
- PIN_JAVA_STRING(name, cstr, -1);
-
- class_id = H5Pcreate_class((hid_t)parent_class, cstr, NULL, NULL, NULL, NULL, NULL, NULL);
+ 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);
+ UNPIN_JAVA_STRING(name, cstr);
- if (class_id < 0)
- h5libraryError(env);
+ if (class_id < 0)
+ h5libraryError(env);
+ }
return (jlong)class_id;
} /* end Java_hdf_hdf5lib_H5__1H5Pcreate_1class_1nocb */
@@ -5143,15 +5113,16 @@ Java_hdf_hdf5lib_H5__1H5Pcreate_1class
close_callback = close_op;
create_callback = create_op;
- PIN_JAVA_STRING(name, cstr, -1);
-
- 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);
+ 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);
- UNPIN_JAVA_STRING(name, cstr);
+ UNPIN_JAVA_STRING(name, cstr);
- if (class_id < 0)
- h5libraryError(env);
+ if (class_id < 0)
+ h5libraryError(env);
+ }
return (jlong)class_id;
} /* end Java_hdf_hdf5lib_H5__1H5Pcreate_1class */
@@ -5161,7 +5132,7 @@ H5P_prp_create_cb
(const char *name, size_t size, void *value)
{
JNIEnv *cbenv;
- jint status;
+ jint status = -1;
jclass cls;
jmethodID mid;
jmethodID constructor;
@@ -5178,7 +5149,7 @@ H5P_prp_create_cb
} /* end if */
} /* end if */
JVMPTR->DetachCurrentThread(JVMPAR);
- return status;
+ return (herr_t)status;
} /* end H5P_prp_create_cb */
static herr_t
@@ -5186,7 +5157,7 @@ H5P_prp_copy_cb
(const char *name, size_t size, void *value)
{
JNIEnv *cbenv;
- jint status;
+ jint status = -1;
jclass cls;
jmethodID mid;
jmethodID constructor;
@@ -5203,7 +5174,7 @@ H5P_prp_copy_cb
} /* end if */
} /* end if */
JVMPTR->DetachCurrentThread(JVMPAR);
- return status;
+ return (herr_t)status;
} /* end H5P_prp_copy_cb */
static herr_t
@@ -5211,7 +5182,7 @@ H5P_prp_close_cb
(const char *name, size_t size, void *value)
{
JNIEnv *cbenv;
- jint status;
+ jint status = -1;
jclass cls;
jmethodID mid;
jmethodID constructor;
@@ -5228,7 +5199,7 @@ H5P_prp_close_cb
} /* end if */
} /* end if */
JVMPTR->DetachCurrentThread(JVMPAR);
- return status;
+ return (herr_t)status;
} /* end H5P_prp_close_cb */
static int
@@ -5236,7 +5207,7 @@ H5P_prp_compare_cb
(void *value1, void *value2, size_t size)
{
JNIEnv *cbenv;
- jint status;
+ jint status = -1;
jclass cls;
jmethodID mid;
jmethodID constructor;
@@ -5251,7 +5222,7 @@ H5P_prp_compare_cb
} /* end if */
} /* end if */
JVMPTR->DetachCurrentThread(JVMPAR);
- return status;
+ return (herr_t)status;
} /* end H5P_prp_compare_cb */
static herr_t
@@ -5259,7 +5230,7 @@ H5P_prp_get_cb
(hid_t prop_id, const char *name, size_t size, void *value)
{
JNIEnv *cbenv;
- jint status;
+ jint status = -1;
jclass cls;
jmethodID mid;
jmethodID constructor;
@@ -5276,7 +5247,7 @@ H5P_prp_get_cb
} /* end if */
} /* end if */
JVMPTR->DetachCurrentThread(JVMPAR);
- return status;
+ return (herr_t)status;
} /* end H5P_prp_get_cb */
static herr_t
@@ -5284,7 +5255,7 @@ H5P_prp_set_cb
(hid_t prop_id, const char *name, size_t size, void *value)
{
JNIEnv *cbenv;
- jint status;
+ jint status = -1;
jclass cls;
jmethodID mid;
jmethodID constructor;
@@ -5301,7 +5272,7 @@ H5P_prp_set_cb
} /* end if */
} /* end if */
JVMPTR->DetachCurrentThread(JVMPAR);
- return status;
+ return (herr_t)status;
} /* end H5P_prp_set_cb */
static herr_t
@@ -5309,7 +5280,7 @@ H5P_prp_delete_cb
(hid_t prop_id, const char *name, size_t size, void *value)
{
JNIEnv *cbenv;
- jint status;
+ jint status = -1;
jclass cls;
jmethodID mid;
jmethodID constructor;
@@ -5326,7 +5297,7 @@ H5P_prp_delete_cb
} /* end if */
} /* end if */
JVMPTR->DetachCurrentThread(JVMPAR);
- return status;
+ return (herr_t)status;
} /* end H5P_prp_delete_cb */
/*
@@ -5343,24 +5314,25 @@ Java_hdf_hdf5lib_H5_H5Pregister2_1nocb
jboolean isCopy2;
const char *cstr;
- PIN_JAVA_STRING0(name, cstr);
- buffP = ENVPTR->GetByteArrayElements(ENVPAR def_value, &isCopy2);
- if (buffP == NULL) {
- UNPIN_JAVA_STRING(name, cstr);
- 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);
-
- UNPIN_JAVA_STRING(name, cstr);
- if (status < 0) {
- ENVPTR->ReleaseByteArrayElements(ENVPAR def_value, buffP, JNI_ABORT);
- h5libraryError(env);
+ 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 {
- ENVPTR->ReleaseByteArrayElements(ENVPAR def_value, buffP, 0);
+ 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 */
- } /* end else */
+ UNPIN_JAVA_STRING(name, cstr);
+ }
} /* end Java_hdf_hdf5lib_H5_H5Pregister2_1nocb */
/*
@@ -5386,26 +5358,27 @@ Java_hdf_hdf5lib_H5_H5Pregister2
get_callback = prp_get;
delete_callback = prp_delete;
- PIN_JAVA_STRING0(name, cstr);
- buffP = ENVPTR->GetByteArrayElements(ENVPAR def_value, &isCopy2);
- if (buffP == NULL) {
- UNPIN_JAVA_STRING(name, cstr);
- 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);
-
- UNPIN_JAVA_STRING(name, cstr);
- if (status < 0) {
- ENVPTR->ReleaseByteArrayElements(ENVPAR def_value, buffP, JNI_ABORT);
- h5libraryError(env);
+ 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 {
- ENVPTR->ReleaseByteArrayElements(ENVPAR def_value, buffP, 0);
+ 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 */
- } /* end else */
+ UNPIN_JAVA_STRING(name, cstr);
+ }
} /* end Java_hdf_hdf5lib_H5_H5Pregister2 */
/*
@@ -5422,24 +5395,25 @@ Java_hdf_hdf5lib_H5_H5Pinsert2_1nocb
jboolean isCopy2;
const char *cstr;
- PIN_JAVA_STRING0(name, cstr);
- 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, NULL, NULL, NULL, NULL, NULL, NULL);
-
- UNPIN_JAVA_STRING(name, cstr);
- if (status < 0) {
- ENVPTR->ReleaseByteArrayElements(ENVPAR def_value, buffP, JNI_ABORT);
- h5libraryError(env);
+ 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 {
- ENVPTR->ReleaseByteArrayElements(ENVPAR def_value, buffP, 0);
+ 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 */
- } /* end else */
+ UNPIN_JAVA_STRING(name, cstr);
+ }
} /* end Java_hdf_hdf5lib_H5_H5Pinsert2 */
@@ -5465,26 +5439,28 @@ Java_hdf_hdf5lib_H5_H5Pinsert2
get_callback = prp_get;
delete_callback = prp_delete;
- PIN_JAVA_STRING0(name, cstr);
- 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);
-
- UNPIN_JAVA_STRING(name, cstr);
- if (status < 0) {
- ENVPTR->ReleaseByteArrayElements(ENVPAR def_value, buffP, JNI_ABORT);
- h5libraryError(env);
+ 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 {
- ENVPTR->ReleaseByteArrayElements(ENVPAR def_value, buffP, 0);
+ 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 */
- } /* end else */
+ UNPIN_JAVA_STRING(name, cstr);
+ }
} /* end Java_hdf_hdf5lib_H5_H5Pinsert2 */
static herr_t
@@ -5561,9 +5537,9 @@ Java_hdf_hdf5lib_H5_H5Piterate
theArray = (jint *)ENVPTR->GetIntArrayElements(ENVPAR idx, &isCopy);
if (theArray == NULL) {
h5JNIFatalError(env, "H5Piterate: idx not pinned");
- return -1;
} /* end if */
- status = H5Piterate((hid_t)prop_id, (int*)&theArray[0], (H5P_iterate_t)H5P_iterate_cb, (void*)op_data);
+ else
+ status = H5Piterate((hid_t)prop_id, (int*)&theArray[0], (H5P_iterate_t)H5P_iterate_cb, (void*)op_data);
} /* end else */
if (status < 0) {
@@ -5575,7 +5551,7 @@ Java_hdf_hdf5lib_H5_H5Piterate
ENVPTR->ReleaseIntArrayElements(ENVPAR idx, theArray, 0);
} /* end else */
- return status;
+ return (jint)status;
} /* end Java_hdf_hdf5lib_H5_H5Piterate */
#ifdef __cplusplus
diff --git a/java/src/jni/h5rImp.c b/java/src/jni/h5rImp.c
index df0ea3c..647f973 100644
--- a/java/src/jni/h5rImp.c
+++ b/java/src/jni/h5rImp.c
@@ -46,45 +46,41 @@ Java_hdf_hdf5lib_H5_H5Rcreate
jbyte *refP;
jboolean isCopy2;
- PIN_JAVA_STRING(name, rName, -1);
-
- if (ref == NULL) {
- UNPIN_JAVA_STRING(name, rName);
- h5nullArgument( env, "H5Rcreate: ref is NULL");
- } /* end if */
- else {
- if ((ref_type == H5R_OBJECT) && ENVPTR->GetArrayLength(ENVPAR ref) != H5R_OBJ_REF_BUF_SIZE) {
- UNPIN_JAVA_STRING(name, rName);
- h5badArgument( env, "H5Rcreate: ref input array != H5R_OBJ_REF_BUF_SIZE");
+ PIN_JAVA_STRING(name, rName);
+ if (rName != NULL) {
+ if (ref == NULL) {
+ h5nullArgument( env, "H5Rcreate: ref is NULL");
} /* end if */
- else if ((ref_type == H5R_DATASET_REGION) && ENVPTR->GetArrayLength(ENVPAR ref) != H5R_DSET_REG_REF_BUF_SIZE) {
- UNPIN_JAVA_STRING(name, rName);
- 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)) {
- UNPIN_JAVA_STRING(name, rName);
- h5badArgument( env, "H5Rcreate: ref_type unknown type ");
- } /* end else if */
else {
- refP = (jbyte*)ENVPTR->GetByteArrayElements(ENVPAR ref, &isCopy2);
- if (refP == NULL) {
- UNPIN_JAVA_STRING(name, rName);
- h5JNIFatalError(env, "H5Rcreate: ref not pinned");
+ 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 {
- status = H5Rcreate(refP, (hid_t)loc_id, rName, (H5R_type_t)ref_type, (hid_t)space_id);
-
- UNPIN_JAVA_STRING(name, rName);
- if (status < 0) {
- ENVPTR->ReleaseByteArrayElements(ENVPAR ref, refP, JNI_ABORT);
- h5libraryError(env);
+ refP = (jbyte*)ENVPTR->GetByteArrayElements(ENVPAR ref, &isCopy2);
+ if (refP == NULL) {
+ h5JNIFatalError(env, "H5Rcreate: ref not pinned");
} /* end if */
else {
- ENVPTR->ReleaseByteArrayElements(ENVPAR ref, refP, 0);
+ 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 */
- } /* end else */
+ UNPIN_JAVA_STRING(name, rName);
+ }
return (jint)status;
} /* end Java_hdf_hdf5lib_H5_H5Rcreate */
diff --git a/java/src/jni/h5tImp.c b/java/src/jni/h5tImp.c
index 55e16f8..1467b41 100644
--- a/java/src/jni/h5tImp.c
+++ b/java/src/jni/h5tImp.c
@@ -43,17 +43,18 @@ JNIEXPORT jlong JNICALL
Java_hdf_hdf5lib_H5__1H5Topen2
(JNIEnv *env, jclass clss, jlong loc_id, jstring name, jlong access_plist)
{
- hid_t status;
+ hid_t status = -1;
const char *tName;
- PIN_JAVA_STRING(name, tName, -1);
+ PIN_JAVA_STRING(name, tName);
+ if (tName != NULL) {
+ status = H5Topen2((hid_t)loc_id, tName, (hid_t)access_plist);
- status = H5Topen2((hid_t)loc_id, tName, (hid_t)access_plist);
+ UNPIN_JAVA_STRING(name, tName);
- UNPIN_JAVA_STRING(name, tName);
-
- if (status < 0)
- h5libraryError(env);
+ if (status < 0)
+ h5libraryError(env);
+ }
return (jlong)status;
} /* end Java_hdf_hdf5lib_H5__1H5Topen2 */
@@ -789,14 +790,15 @@ Java_hdf_hdf5lib_H5_H5Tget_1member_1index
const char *tName;
int index = -1;
- PIN_JAVA_STRING(field_name, tName, -1);
+ PIN_JAVA_STRING(field_name, tName);
+ if (tName != NULL) {
+ index = H5Tget_member_index((hid_t)type_id, tName);
- index = H5Tget_member_index((hid_t)type_id, tName);
+ UNPIN_JAVA_STRING(field_name, tName);
- UNPIN_JAVA_STRING(field_name, tName);
-
- if (index < 0)
- h5libraryError(env);
+ if (index < 0)
+ h5libraryError(env);
+ }
return (jint)index;
} /* end Java_hdf_hdf5lib_H5_H5Tget_1member_1index */
@@ -858,17 +860,18 @@ 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;
+ herr_t status = -1;
const char *tName;
long off = (long)offset;
- PIN_JAVA_STRING(name, tName, -1);
+ PIN_JAVA_STRING(name, tName);
+ if (tName != NULL) {
+ status = H5Tinsert((hid_t)type_id, tName, (size_t)off, field_id);
- status = H5Tinsert((hid_t)type_id, tName, (size_t)off, field_id);
-
- UNPIN_JAVA_STRING(name,tName);
- if (status < 0)
- h5libraryError(env);
+ UNPIN_JAVA_STRING(name,tName);
+ if (status < 0)
+ h5libraryError(env);
+ }
return (jint)status;
} /* end Java_hdf_hdf5lib_H5_H5Tinsert */
@@ -939,14 +942,15 @@ Java_hdf_hdf5lib_H5_H5Tset_1tag
herr_t status = -1;
const char *tagP;
- PIN_JAVA_STRING(tag, tagP, -1);
+ PIN_JAVA_STRING(tag, tagP);
+ if (tagP != NULL) {
+ status = H5Tset_tag((hid_t)type, tagP);
- status = H5Tset_tag((hid_t)type, tagP);
+ UNPIN_JAVA_STRING(tag,tagP);
- UNPIN_JAVA_STRING(tag,tagP);
-
- if (status < 0)
- h5libraryError(env);
+ if (status < 0)
+ h5libraryError(env);
+ }
return (jint)status;
} /* end Java_hdf_hdf5lib_H5_H5Tset_1tag */
@@ -1029,21 +1033,22 @@ Java_hdf_hdf5lib_H5_H5Tenum_1insert_1int
h5nullArgument(env, "H5Tenum_insert: value is NULL");
} /* end if */
else {
- PIN_JAVA_STRING(name, nameP, -1);
-
- 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);
+ 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);
+ ENVPTR->ReleaseIntArrayElements(ENVPAR value, intP, JNI_ABORT);
- if (status < 0)
- h5libraryError(env);
- } /* end else */
- UNPIN_JAVA_STRING(name, nameP);
+ if (status < 0)
+ h5libraryError(env);
+ } /* end else */
+ UNPIN_JAVA_STRING(name, nameP);
+ }
} /* end else */
return (jint)status;
@@ -1067,21 +1072,22 @@ Java_hdf_hdf5lib_H5_H5Tenum_1insert
h5nullArgument(env, "H5Tenum_insert: value is NULL");
} /* end if */
else {
- PIN_JAVA_STRING0(name, nameP);
-
- 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);
+ 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);
+ ENVPTR->ReleaseByteArrayElements(ENVPAR value, byteP, JNI_ABORT);
- if (status < 0)
- h5libraryError(env);
- } /* end else */
- UNPIN_JAVA_STRING(name, nameP);
+ if (status < 0)
+ h5libraryError(env);
+ } /* end else */
+ UNPIN_JAVA_STRING(name, nameP);
+ }
} /* end else */
} /* end Java_hdf_hdf5lib_H5_H5Tenum_1insert */
@@ -1218,23 +1224,24 @@ Java_hdf_hdf5lib_H5_H5Tenum_1valueof_1int
h5nullArgument(env, "H5Tenum_valueof: value is NULL");
} /* end if */
else {
- PIN_JAVA_STRING(name, nameP, -1);
-
- 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);
+ 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
- ENVPTR->ReleaseIntArrayElements(ENVPAR value, intP, 0);
- } /* end else */
- UNPIN_JAVA_STRING(name, nameP);
+ 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 */
return (jint)status;
@@ -1258,23 +1265,24 @@ Java_hdf_hdf5lib_H5_H5Tenum_1valueof
h5nullArgument(env, "H5Tenum_valueof: value is NULL");
} /* end if */
else {
- PIN_JAVA_STRING0(name, nameP);
-
- 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);
+ 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
- ENVPTR->ReleaseByteArrayElements(ENVPAR value, byteP, 0);
- } /* end else */
- UNPIN_JAVA_STRING(name, nameP);
+ 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 */
} /* end Java_hdf_hdf5lib_H5_H5Tenum_1valueof */
@@ -1487,14 +1495,15 @@ Java_hdf_hdf5lib_H5_H5Tcommit
herr_t status = -1;
const char *tName;
- PIN_JAVA_STRING0(name, tName);
+ 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);
- 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);
+ UNPIN_JAVA_STRING(name, tName);
- UNPIN_JAVA_STRING(name, tName);
-
- if (status < 0)
- h5libraryError(env);
+ if (status < 0)
+ h5libraryError(env);
+ }
} /* end Java_hdf_hdf5lib_H5_H5Tcommit */
/*
diff --git a/java/src/jni/h5util.c b/java/src/jni/h5util.c
index e39b342..acf57c8 100644
--- a/java/src/jni/h5util.c
+++ b/java/src/jni/h5util.c
@@ -2009,6 +2009,60 @@ Java_hdf_hdf5lib_H5_H5AreadVL
} /* end Java_hdf_hdf5lib_H5_H5AreadVL */
/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5AreadComplex
+ * Signature: (JJ[Ljava/lang/String;)I
+ */
+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;
+
+ 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 *)malloc((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);
+ 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 */
+ return status;
+}
+
+/*
* Copies the content of one dataset to another dataset
* Class: hdf_hdf5lib_H5
* Method: H5Acopy
@@ -2580,49 +2634,50 @@ Java_hdf_hdf5lib_H5_H5export_1dataset
h5nullArgument(env, "HDF5Library_export_data: object_path is NULL");
} /* end else if */
else {
- PIN_JAVA_STRING0(file_name, fileName);
+ PIN_JAVA_STRING(file_name, fileName);
+ if (fileName != NULL) {
+ file_id = H5Fopen(fileName, (unsigned)H5F_ACC_RDWR, (hid_t)H5P_DEFAULT);
- file_id = H5Fopen(fileName, (unsigned)H5F_ACC_RDWR, (hid_t)H5P_DEFAULT);
+ UNPIN_JAVA_STRING(file_name, fileName);
- 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");
+ if (file_id < 0) {
+ /* throw exception */
+ h5libraryError(env);
} /* end if */
else {
- dataset_id = H5Dopen2(file_id, object_name, H5P_DEFAULT);
-
- ENVPTR->ReleaseStringUTFChars(ENVPAR object_path, object_name);
-
- if (dataset_id < 0) {
- H5Fclose(file_id);
- h5libraryError(env);
+ object_name = ENVPTR->GetStringUTFChars(ENVPAR object_path, &isCopy2);
+ if (object_name == NULL) {
+ h5JNIFatalError( env, "H5Dopen: object name not pinned");
} /* 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);
+ dataset_id = H5Dopen2(file_id, object_name, H5P_DEFAULT);
- ret_val = h5str_dump_simple_dset(stream, dataset_id, binary_order);
+ ENVPTR->ReleaseStringUTFChars(ENVPAR object_path, object_name);
- if (stream)
- HDfclose(stream);
+ 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);
- H5Dclose(dataset_id);
+ ret_val = h5str_dump_simple_dset(stream, dataset_id, binary_order);
- H5Fclose(file_id);
+ if (stream)
+ HDfclose(stream);
- if (ret_val < 0)
- h5libraryError(env);
+ H5Dclose(dataset_id);
+
+ H5Fclose(file_id);
+
+ if (ret_val < 0)
+ h5libraryError(env);
+ } /* end else */
} /* end else */
} /* end else */
- } /* end else */
+ }
} /* end else */
} /* end Java_hdf_hdf5lib_H5_H5export_1dataset */
diff --git a/java/src/jni/h5util.h b/java/src/jni/h5util.h
index ab8da98..f690e8b 100644
--- a/java/src/jni/h5util.h
+++ b/java/src/jni/h5util.h
@@ -66,6 +66,15 @@ Java_hdf_hdf5lib_H5_H5AreadVL
(JNIEnv *, jclass, jlong, jlong, jobjectArray);
/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5AreadComplex
+ * Signature: (JJ[Ljava/lang/String;)I
+ */
+JNIEXPORT jint JNICALL
+Java_hdf_hdf5lib_H5_H5AreadComplex
+ (JNIEnv *, jclass, jlong, jlong, jobjectArray);
+
+/*
* Copies the content of one dataset to another dataset
* Class: hdf_hdf5lib_H5
* Method: H5Acopy
diff --git a/java/test/CMakeLists.txt b/java/test/CMakeLists.txt
index 9038800..8cb41f7 100644
--- a/java/test/CMakeLists.txt
+++ b/java/test/CMakeLists.txt
@@ -68,22 +68,11 @@ set (HDF_JAVA_TEST_FILES
)
foreach (h5_file ${HDF_JAVA_TEST_FILES})
- set (dest "${PROJECT_BINARY_DIR}/${h5_file}")
- #message (STATUS " Copying ${h5_file}")
- add_custom_command (
- TARGET ${HDF5_JAVA_TEST_LIB_TARGET}
- POST_BUILD
- COMMAND ${CMAKE_COMMAND}
- ARGS -E copy_if_different ${PROJECT_SOURCE_DIR}/${h5_file} ${dest}
- )
+ HDFTEST_COPY_FILE("${PROJECT_SOURCE_DIR}/${h5_file}" "${PROJECT_BINARY_DIR}/${h5_file}" "${HDF5_JAVA_TEST_LIB_TARGET}_files")
endforeach (h5_file ${HDF_JAVA_TEST_FILES})
-add_custom_command (
- TARGET ${HDF5_JAVA_TEST_LIB_TARGET}
- POST_BUILD
- COMMAND ${CMAKE_COMMAND}
- ARGS -E copy_if_different ${PROJECT_SOURCE_DIR}/h5ex_g_iterate.orig ${PROJECT_BINARY_DIR}/h5ex_g_iterate.hdf
-)
+HDFTEST_COPY_FILE("${PROJECT_SOURCE_DIR}/h5ex_g_iterate.orig" "${PROJECT_BINARY_DIR}/h5ex_g_iterate.hdf" "${HDF5_JAVA_TEST_LIB_TARGET}_files")
+add_custom_target(${HDF5_JAVA_TEST_LIB_TARGET}_files ALL COMMENT "Copying files needed by ${HDF5_JAVA_TEST_LIB_TARGET} tests" DEPENDS ${${HDF5_JAVA_TEST_LIB_TARGET}_files_list})
if (WIN32)
set (CMAKE_JAVA_INCLUDE_FLAG_SEP ";")
@@ -99,7 +88,11 @@ set (CMAKE_JAVA_CLASSPATH "${CMAKE_JAVA_CLASSPATH}${CMAKE_JAVA_INCLUDE_FLAG_SEP}
set (testfilter "OK (598 tests)")
if (CMAKE_BUILD_TYPE MATCHES Debug)
- set (CMD_ARGS "-Dhdf.hdf5lib.H5.loadLibraryName=hdf5_java_debug;")
+ if (WIN32)
+ set (CMD_ARGS "-Dhdf.hdf5lib.H5.loadLibraryName=hdf5_java_D;")
+ else()
+ set (CMD_ARGS "-Dhdf.hdf5lib.H5.loadLibraryName=hdf5_java_debug;")
+ endif()
endif(CMAKE_BUILD_TYPE MATCHES Debug)
add_test (
@@ -128,4 +121,7 @@ add_test (
-D "TEST_REFERENCE=JUnit-interface.txt"
-P "${HDF_RESOURCES_DIR}/jrunTest.cmake"
)
-set_tests_properties (JUnit-interface PROPERTIES DEPENDS "JUnit-interface-clearall-objects")
+set_tests_properties (JUnit-interface PROPERTIES
+ ENVIRONMENT "HDF5_PLUGIN_PATH=${CMAKE_BINARY_DIR}/testdir2"
+ DEPENDS "JUnit-interface-clearall-objects"
+)
diff --git a/java/test/TestH5PL.java b/java/test/TestH5PL.java
index afcb88a..9f1876c 100644
--- a/java/test/TestH5PL.java
+++ b/java/test/TestH5PL.java
@@ -23,12 +23,22 @@ import hdf.hdf5lib.exceptions.HDF5LibraryException;
import org.junit.After;
import org.junit.Before;
+import org.junit.Ignore;
import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.TestName;
public class TestH5PL {
@Rule public TestName testname = new TestName();
+ private static String FILENAME = "h5_dlopenChunk.h5";
+ private static String DATASETNAME = "DS1";
+ private static final int DIM_X = 6;
+ private static final int DIM_Y = 8;
+ private static final int CHUNK_X = 4;
+ private static final int CHUNK_Y = 4;
+ private static final int RANK = 2;
+ private static final int NDIMS = 2;
+ private static final int H5Z_FILTER_DYNLIB4 = 260;
@Before
public void checkOpenIDs() {
@@ -58,4 +68,117 @@ public class TestH5PL {
fail("TestH5PLplugins " + err);
}
}
+
+ @Ignore
+ public void TestH5PLdlopen() {
+ long file_id = -1;
+ long filespace_id = -1;
+ long dataset_id = -1;
+ long fapl_id = -1;
+ long dcpl_id = -1;
+ try {
+ int[] cd_values = {9, 0, 0, 0};
+ int[] libversion = {0, 0, 0};
+ long[] dims = { DIM_X, DIM_Y };
+ long[] chunk_dims = { CHUNK_X, CHUNK_Y };
+ int[][] dset_data = new int[DIM_X][DIM_Y];
+ int[] mdc_nelmts = {0};
+ long[] rdcc_nelmts = {0};
+ long[] rdcc_nbytes = {0};
+ double[] rdcc_w0 = {0};
+
+ // Initialize data to "1", to make it easier to see the selections.
+ for (int indx = 0; indx < DIM_X; indx++)
+ for (int jndx = 0; jndx < DIM_Y; jndx++)
+ dset_data[indx][jndx] = 1;
+
+ // Create a new file using default properties.
+ try {
+ file_id = H5.H5Fcreate(FILENAME, HDF5Constants.H5F_ACC_TRUNC, HDF5Constants.H5P_DEFAULT,
+ HDF5Constants.H5P_DEFAULT);
+ }
+ catch (Exception e) {
+ e.printStackTrace();
+ fail("TestH5PLdlopen H5Fcreate:" + e);
+ }
+
+ // Create dataspace. Setting maximum size to NULL sets the maximum
+ // size to be the current size.
+ try {
+ filespace_id = H5.H5Screate_simple(RANK, dims, null);
+ }
+ catch (Exception e) {
+ e.printStackTrace();
+ fail("TestH5PLdlopen H5Screate_simple:" + e);
+ }
+
+ // Create the dataset creation property list.
+ try {
+ dcpl_id = H5.H5Pcreate(HDF5Constants.H5P_DATASET_CREATE);
+ }
+ catch (Exception e) {
+ e.printStackTrace();
+ fail("TestH5PLdlopen H5Pcreate:" + e);
+ }
+
+ // Set the chunk size.
+ try {
+ if (dcpl_id >= 0)
+ H5.H5Pset_chunk(dcpl_id, NDIMS, chunk_dims);
+ }
+ catch (Exception e) {
+ e.printStackTrace();
+ fail("TestH5PLdlopen H5Pset_chunk:" + e);
+ }
+
+ try {
+ H5.H5get_libversion(libversion);
+ cd_values[1] = libversion[0];
+ cd_values[2] = libversion[1];
+ cd_values[3] = libversion[2];
+ if (dcpl_id >= 0)
+ H5.H5Pset_filter(dcpl_id, H5Z_FILTER_DYNLIB4, HDF5Constants.H5Z_FLAG_MANDATORY, 4, cd_values);
+ }
+ catch (Exception e) {
+ e.printStackTrace();
+ fail("TestH5PLdlopen H5Pset_filter:" + e);
+ }
+
+ // Create the chunked dataset.
+ try {
+ if ((file_id >= 0) && (filespace_id >= 0) && (dcpl_id >= 0))
+ dataset_id = H5.H5Dcreate(file_id, DATASETNAME, HDF5Constants.H5T_NATIVE_INT, filespace_id,
+ HDF5Constants.H5P_DEFAULT, dcpl_id, HDF5Constants.H5P_DEFAULT);
+ }
+ catch (Exception e) {
+ e.printStackTrace();
+ fail("TestH5PLdlopen H5Dcreate:" + e);
+ }
+
+ try {
+ if (dataset_id >= 0)
+ H5.H5Dwrite(dataset_id, HDF5Constants.H5T_NATIVE_INT, HDF5Constants.H5S_ALL, HDF5Constants.H5S_ALL,
+ HDF5Constants.H5S_ALL, dset_data);
+ }
+ catch (Exception e) {
+ e.printStackTrace();
+ fail("TestH5PLdlopen H5Dwrite:" + e);
+ }
+ }
+ catch (Throwable err) {
+ err.printStackTrace();
+ fail("TestH5PLdlopen " + err);
+ }
+ finally {
+ // End access to the dataset and release resources used by it.
+ if (dcpl_id >= 0)
+ try {H5.H5Pclose_class(dcpl_id);} catch (Throwable err) {}
+ if (dataset_id >= 0)
+ try {H5.H5Dclose(dataset_id);} catch (Throwable err) {}
+ if (filespace_id >= 0)
+ try {H5.H5Sclose(filespace_id);} catch (Throwable err) {}
+ if (file_id >= 0)
+ try {H5.H5Fclose(file_id);} catch (Throwable err) {}
+ }
+ }
}
diff --git a/java/test/junit.sh.in b/java/test/junit.sh.in
index f37703a..5001c32 100644
--- a/java/test/junit.sh.in
+++ b/java/test/junit.sh.in
@@ -111,7 +111,7 @@ CLEAN_LIBFILES_AND_BLDLIBDIR()
# skip rm if srcdir is same as destdir
# this occurs when build/test performed in source dir and
# make cp fail
- SDIR=`$DIRNAME $HDFLIB_HOME/junit.jar`
+ SDIR=$HDFLIB_HOME
INODE_SDIR=`$LS -i -d $SDIR | $AWK -F' ' '{print $1}'`
INODE_DDIR=`$LS -i -d $BLDLIBDIR | $AWK -F' ' '{print $1}'`
if [ "$INODE_SDIR" != "$INODE_DDIR" ]; then
diff --git a/m4/aclocal_cxx.m4 b/m4/aclocal_cxx.m4
index b44ae82..9d47193 100644
--- a/m4/aclocal_cxx.m4
+++ b/m4/aclocal_cxx.m4
@@ -26,14 +26,11 @@ dnl we need as part of the C++ support. To distinquish these, they
dnl have a [PAC] prefix.
dnl Checking if C++ needs old style header files in includes
-
AC_DEFUN([PAC_PROG_CXX_HEADERS],[
AC_MSG_CHECKING([if $CXX needs old style header files in includes])
- AC_LINK_IFELSE([AC_LANG_SOURCE([
-#include <iostream>
+ TEST_SRC="`(echo \"#define OLD_HEADER_FILENAME 1\"; cat $srcdir/config/cmake_ext_mod/HDFCXXTests.cpp)`"
-int main(void) { return 0; }
- ])],
+ AC_LINK_IFELSE([AC_LANG_SOURCE([$TEST_SRC])],
[AC_MSG_RESULT([no])],
[AC_MSG_RESULT([yes])
CXXFLAGS="${CXXFLAGS} -DOLD_HEADER_FILENAME"
@@ -41,80 +38,43 @@ int main(void) { return 0; }
])
dnl Checking if ++ can handle namespaces
-
AC_DEFUN([PAC_PROG_CXX_NAMESPACE],[
AC_MSG_CHECKING([if $CXX can handle namespaces])
- AC_LINK_IFELSE([AC_LANG_SOURCE([
-namespace H5 {
-int fnord;
-}
+ TEST_SRC="`(echo \"#define HDF_NO_NAMESPACE 1\"; cat $srcdir/config/cmake_ext_mod/HDFCXXTests.cpp)`"
-int main(void) {
- using namespace H5;
- fnord = 37;
- return 0;
-}
- ])], [AC_MSG_RESULT([yes])],
+ AC_LINK_IFELSE([AC_LANG_SOURCE([$TEST_SRC])], [AC_MSG_RESULT([yes])],
[AC_MSG_RESULT([no])
- CXXFLAGS="${CXXFLAGS} -DH5_NO_NAMESPACE"
- AM_CXXFLAGS="${AM_CXXFLAGS} -DH5_NO_NAMESPACE"])
+ CXXFLAGS="${CXXFLAGS} -DHDF_NO_NAMESPACE"
+ AM_CXXFLAGS="${AM_CXXFLAGS} -DHDF_NO_NAMESPACE"])
])
dnl Checking if C++ supports std
-
AC_DEFUN([PAC_PROG_CXX_STD],[
AC_MSG_CHECKING([if $CXX supports std])
- AC_LINK_IFELSE([AC_LANG_SOURCE([
-#include <string>
-
-using namespace std;
+ TEST_SRC="`(echo \"#define HDF_NO_STD 1\"; cat $srcdir/config/cmake_ext_mod/HDFCXXTests.cpp)`"
-int main(void) {
- string myString("testing namespace std");
- return 0;
-}
- ])], [AC_MSG_RESULT([yes])],
+ AC_LINK_IFELSE([AC_LANG_SOURCE([$TEST_SRC])], [AC_MSG_RESULT([yes])],
[AC_MSG_RESULT([no])
CXXFLAGS="${CXXFLAGS} -DH5_NO_STD"
AM_CXXFLAGS="${AM_CXXFLAGS} -DH5_NO_STD"])
])
dnl Checking if C++ has offsetof extension
-
AC_DEFUN([PAC_PROG_CXX_OFFSETOF],[
AC_MSG_CHECKING([if $CXX has offsetof extension])
- AC_LINK_IFELSE([AC_LANG_PROGRAM([
- #include <stdio.h>
- #include <stddef.h>
- ],[
- struct index_st
- {
- unsigned char type;
- unsigned char num;
- unsigned int len;
- };
- typedef struct index_st index_t;
- int x,y;
- x = offsetof(struct index_st, len);
- y = offsetof(index_t, num)
- ])],[AC_MSG_RESULT([yes])
+ TEST_SRC="`(echo \"#define CXX_HAVE_OFFSETOF 1\"; cat $srcdir/config/cmake_ext_mod/HDFCXXTests.cpp)`"
+
+ AC_LINK_IFELSE([AC_LANG_SOURCE([$TEST_SRC])],[AC_MSG_RESULT([yes])
AC_DEFINE([CXX_HAVE_OFFSETOF], [1], [Define if C++ compiler recognizes offsetof])],
AC_MSG_RESULT([no]))
])
dnl Checking if C++ can handle static cast
-
AC_DEFUN([PAC_PROG_CXX_STATIC_CAST],[
AC_MSG_CHECKING([if $CXX can handle static cast])
- AC_LINK_IFELSE([AC_LANG_SOURCE([
-int main(void) {
- float test_float;
- int test_int;
- test_float = 37.0;
- test_int = static_cast <int> (test_float);
- return 0;
-}
- ])], [AC_MSG_RESULT([yes])],
+ TEST_SRC="`(echo \"#define NO_STATIC_CAST 1\"; cat $srcdir/config/cmake_ext_mod/HDFCXXTests.cpp)`"
+
+ AC_LINK_IFELSE([AC_LANG_SOURCE([$TEST_SRC])], [AC_MSG_RESULT([yes])],
[AC_MSG_RESULT([no])
CXXFLAGS="${CXXFLAGS} -DNO_STATIC_CAST"
AM_CXXFLAGS="${AM_CXXFLAGS} -DNO_STATIC_CAST"])
diff --git a/m4/aclocal_fc.f90 b/m4/aclocal_fc.f90
new file mode 100644
index 0000000..ddbe9c7
--- /dev/null
+++ b/m4/aclocal_fc.f90
@@ -0,0 +1,136 @@
+! This file contains all the configure test programs
+! used by autotools and cmake. This avoids having to
+! duplicate code for both cmake and autotool tests.
+! For autotools, a program below is chosen via a
+! sed command in aclocal_fc.m4. For cmake, a program
+! below is chosen via the macro READ_SOURCE in
+! HDF5UseFortran.cmake
+!
+
+PROGRAM PROG_FC_ISO_FORTRAN_ENV
+ USE, INTRINSIC :: ISO_FORTRAN_ENV
+END PROGRAM PROG_FC_ISO_FORTRAN_ENV
+
+PROGRAM PROG_FC_SIZEOF
+ i = sizeof(x)
+END PROGRAM PROG_FC_SIZEOF
+
+PROGRAM PROG_FC_C_SIZEOF
+ USE ISO_C_BINDING
+ INTEGER(C_INT) :: a
+ INTEGER(C_SIZE_T) :: RESULT
+ RESULT = C_SIZEOF(a)
+END PROGRAM PROG_FC_C_SIZEOF
+
+PROGRAM PROG_FC_STORAGE_SIZE
+ INTEGER :: a
+ INTEGER :: RESULT
+ RESULT = STORAGE_SIZE(a)
+END PROGRAM PROG_FC_STORAGE_SIZE
+
+PROGRAM PROG_FC_HAVE_C_LONG_DOUBLE
+ USE ISO_C_BINDING
+ REAL(KIND=C_LONG_DOUBLE) :: d
+END PROGRAM PROG_FC_HAVE_C_LONG_DOUBLE
+
+PROGRAM PROG_FC_HAVE_F2003_REQUIREMENTS
+ USE iso_c_binding
+ IMPLICIT NONE
+ TYPE(C_PTR) :: ptr
+ TYPE(C_FUNPTR) :: funptr
+ CHARACTER(LEN=80, KIND=c_char), TARGET :: ichr
+ ptr = C_LOC(ichr(1:1))
+END PROGRAM PROG_FC_HAVE_F2003_REQUIREMENTS
+
+!---- START ----- Check to see C_LONG_DOUBLE is different from C_DOUBLE
+MODULE type_mod
+ USE ISO_C_BINDING
+ INTERFACE h5t
+ MODULE PROCEDURE h5t_c_double
+ MODULE PROCEDURE h5t_c_long_double
+ END INTERFACE
+CONTAINS
+ SUBROUTINE h5t_c_double(r)
+ REAL(KIND=C_DOUBLE) :: r
+ END SUBROUTINE h5t_c_double
+ SUBROUTINE h5t_c_long_double(d)
+ REAL(KIND=C_LONG_DOUBLE) :: d
+ END SUBROUTINE h5t_c_long_double
+END MODULE type_mod
+PROGRAM PROG_FC_C_LONG_DOUBLE_EQ_C_DOUBLE
+ USE ISO_C_BINDING
+ USE type_mod
+ REAL(KIND=C_DOUBLE) :: r
+ REAL(KIND=C_LONG_DOUBLE) :: d
+ CALL h5t(r)
+ CALL h5t(d)
+END PROGRAM PROG_FC_C_LONG_DOUBLE_EQ_C_DOUBLE
+!---- END ------- Check to see C_LONG_DOUBLE is different from C_DOUBLE
+
+!---- START ----- Determine the available KINDs for REALs and INTEGERs
+PROGRAM FC_AVAIL_KINDS
+ IMPLICIT NONE
+ INTEGER :: ik, jk, k, max_decimal_prec
+ INTEGER :: num_rkinds = 1, num_ikinds = 1
+ INTEGER, DIMENSION(1:10) :: list_ikinds = -1
+ INTEGER, DIMENSION(1:10) :: list_rkinds = -1
+
+ OPEN(8, FILE='pac_fconftest.out', FORM='formatted')
+
+ ! Find integer KINDs
+ list_ikinds(num_ikinds)=SELECTED_INT_KIND(1)
+ DO ik = 2, 36
+ k = SELECTED_INT_KIND(ik)
+ IF(k.LT.0) EXIT
+ IF(k.GT.list_ikinds(num_ikinds))THEN
+ num_ikinds = num_ikinds + 1
+ list_ikinds(num_ikinds) = k
+ ENDIF
+ ENDDO
+
+ DO k = 1, num_ikinds
+ WRITE(8,'(I0)', ADVANCE='NO') list_ikinds(k)
+ IF(k.NE.num_ikinds)THEN
+ WRITE(8,'(A)',ADVANCE='NO') ','
+ ELSE
+ WRITE(8,'()')
+ ENDIF
+ ENDDO
+
+ ! Find real KINDs
+ list_rkinds(num_rkinds)=SELECTED_REAL_KIND(1)
+ max_decimal_prec = 1
+
+ prec: DO ik = 2, 36
+ exp: DO jk = 1, 17000
+ k = SELECTED_REAL_KIND(ik,jk)
+ IF(k.LT.0) EXIT exp
+ IF(k.GT.list_rkinds(num_rkinds))THEN
+ num_rkinds = num_rkinds + 1
+ list_rkinds(num_rkinds) = k
+ ENDIF
+ max_decimal_prec = ik
+ ENDDO exp
+ ENDDO prec
+
+ DO k = 1, num_rkinds
+ WRITE(8,'(I0)', ADVANCE='NO') list_rkinds(k)
+ IF(k.NE.num_rkinds)THEN
+ WRITE(8,'(A)',ADVANCE='NO') ','
+ ELSE
+ WRITE(8,'()')
+ ENDIF
+ ENDDO
+
+ WRITE(8,'(I0)') max_decimal_prec
+ WRITE(8,'(I0)') num_ikinds
+ WRITE(8,'(I0)') num_rkinds
+END PROGRAM FC_AVAIL_KINDS
+!---- END ----- Determine the available KINDs for REALs and INTEGERs
+
+PROGRAM FC_MPI_CHECK
+ INCLUDE 'mpif.h'
+ INTEGER :: comm, amode, info, fh, ierror
+ CHARACTER(LEN=1) :: filename
+ CALL MPI_File_open( comm, filename, amode, info, fh, ierror)
+END PROGRAM FC_MPI_CHECK
diff --git a/m4/aclocal_fc.m4 b/m4/aclocal_fc.m4
index 0b46505..763ab77 100644
--- a/m4/aclocal_fc.m4
+++ b/m4/aclocal_fc.m4
@@ -68,11 +68,8 @@ dnl See if the fortran compiler supports the intrinsic module "ISO_FORTRAN_ENV"
AC_DEFUN([PAC_PROG_FC_ISO_FORTRAN_ENV],[
HAVE_ISO_FORTRAN_ENV="no"
AC_MSG_CHECKING([if Fortran compiler supports intrinsic module ISO_FORTRAN_ENV])
- AC_LINK_IFELSE([AC_LANG_SOURCE([
- PROGRAM main
- USE, INTRINSIC :: ISO_FORTRAN_ENV
- END PROGRAM
- ])],[AC_MSG_RESULT([yes])
+ TEST_SRC="`sed -n '/PROGRAM PROG_FC_ISO_FORTRAN_ENV/,/END PROGRAM PROG_FC_ISO_FORTRAN_ENV/p' $srcdir/m4/aclocal_fc.f90`"
+ AC_LINK_IFELSE([$TEST_SRC],[AC_MSG_RESULT([yes])
HAVE_ISO_FORTRAN_ENV="yes"],
[AC_MSG_RESULT([no])])
])
@@ -82,11 +79,8 @@ dnl See if the fortran compiler supports the intrinsic function "SIZEOF"
AC_DEFUN([PAC_PROG_FC_SIZEOF],[
HAVE_SIZEOF_FORTRAN="no"
AC_MSG_CHECKING([if Fortran compiler supports intrinsic SIZEOF])
- AC_LINK_IFELSE([AC_LANG_SOURCE([
- PROGRAM main
- i = sizeof(x)
- END PROGRAM
- ])],[AC_MSG_RESULT([yes])
+ TEST_SRC="`sed -n '/PROGRAM PROG_FC_SIZEOF/,/END PROGRAM PROG_FC_SIZEOF/p' $srcdir/m4/aclocal_fc.f90`"
+ AC_LINK_IFELSE([$TEST_SRC],[AC_MSG_RESULT([yes])
HAVE_SIZEOF_FORTRAN="yes"],
[AC_MSG_RESULT([no])])
])
@@ -96,14 +90,8 @@ dnl See if the fortran compiler supports the intrinsic function "C_SIZEOF"
AC_DEFUN([PAC_PROG_FC_C_SIZEOF],[
HAVE_C_SIZEOF_FORTRAN="no"
AC_MSG_CHECKING([if Fortran compiler supports intrinsic C_SIZEOF])
- AC_LINK_IFELSE([AC_LANG_SOURCE([
- PROGRAM main
- USE ISO_C_BINDING
- INTEGER(C_INT) :: a
- INTEGER(C_SIZE_T) :: result
- result = C_SIZEOF(a)
- END PROGRAM
- ])], [AC_MSG_RESULT([yes])
+ TEST_SRC="`sed -n '/PROGRAM PROG_FC_C_SIZEOF/,/END PROGRAM PROG_FC_C_SIZEOF/p' $srcdir/m4/aclocal_fc.f90`"
+ AC_LINK_IFELSE([$TEST_SRC], [AC_MSG_RESULT([yes])
HAVE_C_SIZEOF_FORTRAN="yes"],
[AC_MSG_RESULT([no])])
])
@@ -113,13 +101,8 @@ dnl See if the fortran compiler supports the intrinsic function "STORAGE_SIZE"
AC_DEFUN([PAC_PROG_FC_STORAGE_SIZE],[
HAVE_STORAGE_SIZE_FORTRAN="no"
AC_MSG_CHECKING([if Fortran compiler supports intrinsic STORAGE_SIZE])
- AC_LINK_IFELSE([AC_LANG_SOURCE([
- PROGRAM main
- INTEGER :: a
- INTEGER :: result
- result = STORAGE_SIZE(a)
- END PROGRAM
- ])], [AC_MSG_RESULT([yes])
+ TEST_SRC="`sed -ne '/PROGRAM PROG_FC_STORAGE_SIZE/,/END PROGRAM PROG_FC_STORAGE_SIZE/p' $srcdir/m4/aclocal_fc.f90`"
+ AC_LINK_IFELSE([$TEST_SRC], [AC_MSG_RESULT([yes])
HAVE_STORAGE_SIZE_FORTRAN="yes"],
[AC_MSG_RESULT([no])])
@@ -130,12 +113,9 @@ dnl Check to see C_LONG_DOUBLE is available
AC_DEFUN([PAC_PROG_FC_HAVE_C_LONG_DOUBLE],[
HAVE_C_LONG_DOUBLE_FORTRAN="no"
AC_MSG_CHECKING([if Fortran compiler supports intrinsic C_LONG_DOUBLE])
- AC_LINK_IFELSE([AC_LANG_SOURCE([
- PROGRAM main
- USE ISO_C_BINDING
- REAL(KIND=C_LONG_DOUBLE) :: d
- END PROGRAM
- ])], [AC_MSG_RESULT([yes])
+ TEST_SRC=""
+ TEST_SRC="`sed -n '/PROGRAM PROG_FC_HAVE_C_LONG_DOUBLE/,/END PROGRAM PROG_FC_HAVE_C_LONG_DOUBLE/p' $srcdir/m4/aclocal_fc.f90`"
+ AC_LINK_IFELSE([$TEST_SRC], [AC_MSG_RESULT([yes])
HAVE_C_LONG_DOUBLE_FORTRAN="yes"],
[AC_MSG_RESULT([no])])
])
@@ -146,31 +126,8 @@ if test "X$FORTRAN_HAVE_C_LONG_DOUBLE" = "Xyes"; then
AC_DEFUN([PAC_PROG_FC_C_LONG_DOUBLE_EQ_C_DOUBLE],[
C_LONG_DOUBLE_IS_UNIQUE_FORTRAN="no"
AC_MSG_CHECKING([if Fortran C_LONG_DOUBLE is different from C_DOUBLE])
-
- AC_COMPILE_IFELSE([AC_LANG_SOURCE([
- MODULE type_mod
- USE ISO_C_BINDING
- INTERFACE h5t
- MODULE PROCEDURE h5t_c_double
- MODULE PROCEDURE h5t_c_long_double
- END INTERFACE
- CONTAINS
- SUBROUTINE h5t_c_double(r)
- REAL(KIND=C_DOUBLE) :: r
- END SUBROUTINE h5t_c_double
- SUBROUTINE h5t_c_long_double(d)
- REAL(KIND=C_LONG_DOUBLE) :: d
- END SUBROUTINE h5t_c_long_double
- END MODULE type_mod
- PROGRAM main
- USE ISO_C_BINDING
- USE type_mod
- REAL(KIND=C_DOUBLE) :: r
- REAL(KIND=C_LONG_DOUBLE) :: d
- CALL h5t(r)
- CALL h5t(d)
- END PROGRAM main
- ])], [AC_MSG_RESULT([yes])
+ TEST_SRC="`sed -n '/MODULE type_mod/,/END PROGRAM PROG_FC_C_LONG_DOUBLE_EQ_C_DOUBLE/p' $srcdir/m4/aclocal_fc.f90`"
+ AC_COMPILE_IFELSE([$TEST_SRC], [AC_MSG_RESULT([yes])
C_LONG_DOUBLE_IS_UNIQUE_FORTRAN="yes"],
[AC_MSG_RESULT([no])])
])
@@ -180,24 +137,12 @@ dnl Checking if the compiler supports the required Fortran 2003 features and
dnl disable Fortran 2003 if it does not.
AC_DEFUN([PAC_PROG_FC_HAVE_F2003_REQUIREMENTS],[
+ HAVE_F2003_REQUIREMENTS="no"
AC_MSG_CHECKING([if Fortran compiler version compatible with Fortran 2003 HDF])
-dnl --------------------------------------------------------------------
-dnl Default for FORTRAN 2003 compliant compilers
-dnl
- HAVE_F2003_REQUIREMENTS="no"
- AC_LINK_IFELSE([AC_LANG_PROGRAM([],[
-
- USE iso_c_binding
- IMPLICIT NONE
- TYPE(C_PTR) :: ptr
- TYPE(C_FUNPTR) :: funptr
- CHARACTER(LEN=80, KIND=c_char), TARGET :: ichr
-
- ptr = C_LOC(ichr(1:1))
-
- ])],[AC_MSG_RESULT([yes])
- HAVE_F2003_REQUIREMENTS=[yes]],
- [AC_MSG_RESULT([no])])
+ TEST_SRC="`sed -n '/PROG_FC_HAVE_F2003_REQUIREMENTS/,/END PROGRAM PROG_FC_HAVE_F2003_REQUIREMENTS/p' $srcdir/m4/aclocal_fc.f90`"
+ AC_COMPILE_IFELSE([$TEST_SRC], [AC_MSG_RESULT([yes])
+ HAVE_F2003_REQUIREMENTS="yes"],
+ [AC_MSG_RESULT([no])])
])
dnl -------------------------------------------------------------------------
@@ -294,16 +239,10 @@ AC_DEFUN([PAC_PROG_FC_MPI_CHECK],[
dnl Change to the Fortran 90 language
AC_LANG_PUSH(Fortran)
-
+ TEST_SRC="`sed -n '/PROGRAM FC_MPI_CHECK/,/END PROGRAM FC_MPI_CHECK/p' $srcdir/m4/aclocal_fc.f90`"
dnl Try link a simple MPI program.
AC_MSG_CHECKING([whether a simple MPI-IO Fortran program can be linked])
- AC_LINK_IFELSE([
- PROGRAM main
- INCLUDE 'mpif.h'
- INTEGER :: comm, amode, info, fh, ierror
- CHARACTER(LEN=1) :: filename
- CALL MPI_File_open( comm, filename, amode, info, fh, ierror)
- END],
+ AC_LINK_IFELSE([$TEST_SRC],
[AC_MSG_RESULT([yes])],
[AC_MSG_RESULT([no])
AC_MSG_ERROR([unable to link a simple MPI-IO Fortran program])])
@@ -321,69 +260,9 @@ dnl
AC_DEFUN([PAC_FC_AVAIL_KINDS],[
AC_LANG_PUSH([Fortran])
rm -f pac_fconftest.out
-
-AC_RUN_IFELSE([
- AC_LANG_SOURCE([
- PROGRAM main
- IMPLICIT NONE
- INTEGER :: ik, jk, k, max_decimal_prec
- INTEGER :: num_rkinds = 1, num_ikinds = 1
- INTEGER, DIMENSION(1:10) :: list_ikinds = -1
- INTEGER, DIMENSION(1:10) :: list_rkinds = -1
-
- OPEN(8, FILE='pac_fconftest.out', FORM='formatted')
-
- ! Find integer KINDs
- list_ikinds(num_ikinds)=SELECTED_INT_KIND(1)
- DO ik = 2, 36
- k = SELECTED_INT_KIND(ik)
- IF(k.LT.0) EXIT
- IF(k.GT.list_ikinds(num_ikinds))THEN
- num_ikinds = num_ikinds + 1
- list_ikinds(num_ikinds) = k
- ENDIF
- ENDDO
-
- DO k = 1, num_ikinds
- WRITE(8,'(I0)', ADVANCE='NO') list_ikinds(k)
- IF(k.NE.num_ikinds)THEN
- WRITE(8,'(A)',ADVANCE='NO') ','
- ELSE
- WRITE(8,'()')
- ENDIF
- ENDDO
-
- ! Find real KINDs
- list_rkinds(num_rkinds)=SELECTED_REAL_KIND(1)
- max_decimal_prec = 1
-
- prec: DO ik = 2, 36
- exp: DO jk = 1, 17000
- k = SELECTED_REAL_KIND(ik,jk)
- IF(k.LT.0) EXIT exp
- IF(k.GT.list_rkinds(num_rkinds))THEN
- num_rkinds = num_rkinds + 1
- list_rkinds(num_rkinds) = k
- ENDIF
- max_decimal_prec = ik
- ENDDO exp
- ENDDO prec
-
- DO k = 1, num_rkinds
- WRITE(8,'(I0)', ADVANCE='NO') list_rkinds(k)
- IF(k.NE.num_rkinds)THEN
- WRITE(8,'(A)',ADVANCE='NO') ','
- ELSE
- WRITE(8,'()')
- ENDIF
- ENDDO
-
- WRITE(8,'(I0)') max_decimal_prec
- WRITE(8,'(I0)') num_ikinds
- WRITE(8,'(I0)') num_rkinds
- END PROGRAM main
- ])
-],[
+TEST_SRC="`sed -n '/PROGRAM FC_AVAIL_KINDS/,/END PROGRAM FC_AVAIL_KINDS/p' $srcdir/m4/aclocal_fc.f90`"
+AC_RUN_IFELSE([$TEST_SRC],
+ [
if test -s pac_fconftest.out ; then
dnl The output from the above program will be:
@@ -522,23 +401,23 @@ rm -f pac_fconftest.out
DOUBLE PRECISION c
OPEN(8, FILE='pac_fconftest.out', FORM='formatted')
WRITE(8,*) $FC_SIZEOF_A
- WRITE(8,*) kind(a)
+ WRITE(8,*) KIND(a)
WRITE(8,*) $FC_SIZEOF_B
- WRITE(8,*) kind(b)
+ WRITE(8,*) KIND(b)
WRITE(8,*) $FC_SIZEOF_C
- WRITE(8,*) kind(c)
+ WRITE(8,*) KIND(c)
CLOSE(8)
END
])
])
AC_RUN_IFELSE([],[
if test -s pac_fconftest.out ; then
- PAC_FORTRAN_NATIVE_INTEGER_KIND="`sed -n '1p' pac_fconftest.out`"
- PAC_FORTRAN_NATIVE_INTEGER_SIZEOF="`sed -n '2p' pac_fconftest.out`"
- PAC_FORTRAN_NATIVE_REAL_KIND="`sed -n '3p' pac_fconftest.out`"
- PAC_FORTRAN_NATIVE_REAL_SIZEOF="`sed -n '4p' pac_fconftest.out`"
- PAC_FORTRAN_NATIVE_DOUBLE_KIND="`sed -n '5p' pac_fconftest.out`"
- PAC_FORTRAN_NATIVE_DOUBLE_SIZEOF="`sed -n '6p' pac_fconftest.out`"
+ PAC_FORTRAN_NATIVE_INTEGER_SIZEOF="`sed -n '1p' pac_fconftest.out`"
+ PAC_FORTRAN_NATIVE_INTEGER_KIND="`sed -n '2p' pac_fconftest.out`"
+ PAC_FORTRAN_NATIVE_REAL_SIZEOF="`sed -n '3p' pac_fconftest.out`"
+ PAC_FORTRAN_NATIVE_REAL_KIND="`sed -n '4p' pac_fconftest.out`"
+ PAC_FORTRAN_NATIVE_DOUBLE_SIZEOF="`sed -n '5p' pac_fconftest.out`"
+ PAC_FORTRAN_NATIVE_DOUBLE_KIND="`sed -n '6p' pac_fconftest.out`"
else
AC_MSG_ERROR([No output from Fortran test program!])
fi
@@ -588,7 +467,7 @@ rm -f pac_Cconftest.out
LDBL_DIG="`sed -n '1p' pac_Cconftest.out`"
FLT128_DIG="`sed -n '2p' pac_Cconftest.out`"
else
- AC_MSG_ERROR([No output from Fortran decimal precision program!])
+ AC_MSG_ERROR([No output from C decimal precision program!])
fi
rm -f pac_Cconftest.out
],[
diff --git a/release_docs/INSTALL_CMake.txt b/release_docs/INSTALL_CMake.txt
index b49b3a6..ee331a8 100644
--- a/release_docs/INSTALL_CMake.txt
+++ b/release_docs/INSTALL_CMake.txt
@@ -106,7 +106,7 @@ To build HDF5 with the SZIP and ZLIB external libraries you will need to:
The -S option uses the script version of ctest.
The value for the -C option (as shown above, "-C Release") must
- match the setting for CTEST_BUILD_CONFIGURATION in the platform
+ match the setting for CTEST_CONFIGURATION_TYPE in the platform
configuration file.
The -VV option is for most verbose; use -V for less verbose.
@@ -675,7 +675,7 @@ cmake_minimum_required(VERSION 3.1.0 FATAL_ERROR)
# VS201264 * Visual Studio 11 2012 Win64
#
# INSTALLDIR - root folder where hdf5 is installed
-# CTEST_BUILD_CONFIGURATION - Release, Debug, etc
+# CTEST_CONFIGURATION_TYPE - Release, Debug, etc
# CTEST_SOURCE_NAME - source folder
# STATIC_LIBRARIES - Build/use static libraries
# FORTRAN_LIBRARIES - Build/use fortran libraries
@@ -690,7 +690,7 @@ set(CTEST_SOURCE_VERSEXT "-pre1")
# handle input parameters to script.
#BUILD_GENERATOR - which CMake generator to use, required
#INSTALLDIR - HDF5-1.10.0 root folder
-#CTEST_BUILD_CONFIGURATION - Release, Debug, RelWithDebInfo
+#CTEST_CONFIGURATION_TYPE - Release, Debug, RelWithDebInfo
#CTEST_SOURCE_NAME - name of source folder; HDF5-1.10.0
#STATIC_LIBRARIES - Default is YES
#FORTRAN_LIBRARIES - Default is NO
@@ -738,8 +738,8 @@ if(NOT DEFINED INSTALLDIR)
set(INSTALLDIR "/usr/local/myhdf5")
endif()
endif()
-if(NOT DEFINED CTEST_BUILD_CONFIGURATION)
- set(CTEST_BUILD_CONFIGURATION "Release")
+if(NOT DEFINED CTEST_CONFIGURATION_TYPE)
+ set(CTEST_CONFIGURATION_TYPE "Release")
endif()
if(NOT DEFINED CTEST_SOURCE_NAME)
set(CTEST_SOURCE_NAME "hdf5-${CTEST_SOURCE_VERSION}${CTEST_SOURCE_VERSEXT}")
diff --git a/release_docs/RELEASE.txt b/release_docs/RELEASE.txt
index bf2504b..4d9b832 100644
--- a/release_docs/RELEASE.txt
+++ b/release_docs/RELEASE.txt
@@ -41,9 +41,12 @@ New Features
Configuration:
-------------
+ - CMake: change CTEST_BUILD_CONFIGURATION to CTEST_CONFIGURATION_TYPE, which is
+ recommended by CMake documentation.
+ HDFFV-9971 (ADB 2016/8/22)
- Java JNI library API wrappers and supporting files added as HDF_JAVA language
option. Both configure and CMake disable this option by default.
- HDFFV-9552 (ADB 2016/02.28)
+ HDFFV-9552 (ADB 2016/02/28)
- CMake minimum is now 3.1.0. (ADB 2015/11/14)
- cmakehdf5: configure options added to enable or disable the building of
different API's and testings. See "cmakehdf5 --help" for details.
@@ -121,6 +124,14 @@ New Features
Library:
--------
+ - Java API added new H5Iget_name that returns a string.
+ The old function, now deprecated, would cause a memory leak and
+ not return a proper String value.
+ HDFFV-9972 (ADB 2016/8/22)
+ - Add support to expand the plugin path value on Windows when the path
+ includes an environment variable.
+ HDFFV-9706 (ADB 2016/8/22)
+
- H5F_ACC_DEBUG labeled "deprecated"
The symbol was originally used to emit some extra debugging
@@ -418,7 +429,7 @@ New Features
---------------
C Packet Table API
- ------------------
+ ------------------
- Replacement of a public function
The existing function H5PTcreate_fl limits applications to deflate
@@ -426,18 +437,18 @@ New Features
H5PTcreate_fl. H5PTcreate takes a property list ID to provide
flexibility on creation properties.
- hid_t H5PTcreate(hid_t loc_id, const char *dset_name,
+ hid_t H5PTcreate(hid_t loc_id, const char *dset_name,
hid_t dtype_id, hsize_t chunk_size, hid_t plist_id);
(BMR, 2016/03/04, HDFFV-8623)
- New public functions
Two accessor functions were added per HDFFV-8623/patch 003.
- /* Returns the ID of the dataset associated with the packet table */
- hid_t H5PTget_dataset(hid_t table_id);
+ /* Returns the ID of the dataset associated with the packet table */
+ hid_t H5PTget_dataset(hid_t table_id);
- /* Returns the ID of the datatype the packet table uses */
- hid_t H5PTget_type(hid_t table_id);
+ /* Returns the ID of the datatype the packet table uses */
+ hid_t H5PTget_type(hid_t table_id);
(BMR, 2016/03/04, HDFFV-8623)
- Regarding #ifdef VLPT_REMOVED
@@ -449,23 +460,23 @@ New Features
(BMR, 2016/03/04, HDFFV-442)
C++ Packet Table API
- --------------------
+ --------------------
- New constructor
An overloaded constructor is added to FL_PacketTable and takes a property
list ID to provide flexibility on creation properties.
- FL_PacketTable(hid_t fileID, hid_t plist_id, const char* name, hid_t dtypeID, hsize_t chunkSize);
+ FL_PacketTable(hid_t fileID, hid_t plist_id, const char* name, hid_t dtypeID, hsize_t chunkSize);
(BMR, 2016/03/08, HDFFV-8623)
- New public functions
Two accessor wrappers to class PacketTable, per HDFFV-8623/patch 004.
- /* Returns the ID of the dataset associated with the packet table */
- hid_t PacketTable::GetDataset()
+ /* Returns the ID of the dataset associated with the packet table */
+ hid_t PacketTable::GetDataset()
- /* Returns the ID of the datatype the packet table uses */
- hid_t PacketTable::GetDataset()
+ /* Returns the ID of the datatype the packet table uses */
+ hid_t PacketTable::GetDataset()
(BMR, 2016/03/04, HDFFV-8623)
- Member functions having "char*" as an argument
@@ -478,14 +489,14 @@ New Features
The #ifdef VLPT_REMOVED blocks are removed from the PT library source
except the following cases:
- + VL_PacketTable::IsVariableLength() is moved to PacketTable
- + VL_PacketTable::FreeReadBuff() now became PacketTable::FreeBuff()
+ + VL_PacketTable::IsVariableLength() is moved to PacketTable
+ + VL_PacketTable::FreeReadBuff() now became PacketTable::FreeBuff()
(BMR, 2016/03/04, HDFFV-442)
Internal header file
- --------------------
+ --------------------
- A new API function H5DOwrite_chunk. It writes a data chunk directly
into a file bypassing hyperslab selection, data conversion, and
filter pipeline. The user must be careful with the function and
@@ -526,6 +537,11 @@ Bug Fixes since HDF5-1.8.0 release
Library
-------
+ - Fixed a memory bug that could occur when a message was improperly marked
+ as sharable on disk.
+
+ (NAF, 2016/07/01, HDFFV-9950)
+
- Incorrect usage of list in CMake COMPILE_DEFINITIONS set_property
The CMake command, set_property with COMPILE_DEFINITIONS property
diff --git a/release_docs/USING_CMake_Examples.txt b/release_docs/USING_CMake_Examples.txt
index d8940a5..d3618e9 100644
--- a/release_docs/USING_CMake_Examples.txt
+++ b/release_docs/USING_CMake_Examples.txt
@@ -49,7 +49,7 @@ Default installation process:
The default installation folder is defined as "@CMAKE_INSTALL_PREFIX@".
It can be changed with the INSTALLDIR script option.
The default ctest configuration is defined as "Release". It can be changed
- with the CTEST_BUILD_CONFIGURATION script option. Note that this must
+ 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_LIBRARIES script option set to "NO".
diff --git a/release_docs/USING_HDF5_CMake.txt b/release_docs/USING_HDF5_CMake.txt
index 64d1a2a..e89f1eb 100644
--- a/release_docs/USING_HDF5_CMake.txt
+++ b/release_docs/USING_HDF5_CMake.txt
@@ -235,7 +235,7 @@ set(CTEST_DASHBOARD_ROOT ${CTEST_SCRIPT_DIRECTORY})
# handle input parameters to script.
#INSTALLDIR - HDF5 root folder
-#CTEST_BUILD_CONFIGURATION - Release, Debug, RelWithDebInfo
+#CTEST_CONFIGURATION_TYPE - Release, Debug, RelWithDebInfo
#CTEST_SOURCE_NAME - name of source folder; HDF4Examples
#STATIC_LIBRARIES - Default is YES
#FORTRAN_LIBRARIES - Default is NO
@@ -255,8 +255,8 @@ endif()
if(NOT DEFINED INSTALLDIR)
set(INSTALLDIR "@CMAKE_INSTALL_PREFIX@")
endif()
-if(NOT DEFINED CTEST_BUILD_CONFIGURATION)
- set(CTEST_BUILD_CONFIGURATION "Release")
+if(NOT DEFINED CTEST_CONFIGURATION_TYPE)
+ set(CTEST_CONFIGURATION_TYPE "Release")
endif()
if(NOT DEFINED CTEST_SOURCE_NAME)
set(CTEST_SOURCE_NAME "HDF5Examples")
@@ -379,7 +379,7 @@ if(NOT N EQUAL 0)
set(ctest_test_args ${ctest_test_args} PARALLEL_LEVEL ${N})
endif()
set (CTEST_CONFIGURE_COMMAND
- "${CTEST_CMAKE_COMMAND} -C \"${CTEST_SOURCE_DIRECTORY}/config/cmake/cacheinit.cmake\" -DCMAKE_BUILD_TYPE:STRING=${CTEST_BUILD_CONFIGURATION} ${BUILD_OPTIONS} \"-G${CTEST_CMAKE_GENERATOR}\" \"${CTEST_SOURCE_DIRECTORY}\""
+ "${CTEST_CMAKE_COMMAND} -C \"${CTEST_SOURCE_DIRECTORY}/config/cmake/cacheinit.cmake\" -DCMAKE_BUILD_TYPE:STRING=${CTEST_CONFIGURATION_TYPE} ${BUILD_OPTIONS} \"-G${CTEST_CMAKE_GENERATOR}\" \"${CTEST_SOURCE_DIRECTORY}\""
)
#-----------------------------------------------------------------------------
diff --git a/src/H5AC.c b/src/H5AC.c
index 3021a6d..4dac680 100644
--- a/src/H5AC.c
+++ b/src/H5AC.c
@@ -183,8 +183,10 @@ done:
herr_t
H5AC__init_package(void)
{
-#ifdef H5_DEBUG_BUILD
+#if defined H5_DEBUG_BUILD | defined H5_HAVE_PARALLEL
H5P_genplist_t *xfer_plist; /* Dataset transfer property list object */
+#endif /* defined H5_DEBUG_BUILD | defined H5_HAVE_PARALLEL */
+#ifdef H5_DEBUG_BUILD
H5FD_dxpl_type_t dxpl_type; /* Property indicating the type of the internal dxpl */
#endif /* H5_DEBUG_BUILD */
#ifdef H5_HAVE_PARALLEL
diff --git a/src/H5Aint.c b/src/H5Aint.c
index ffb8667..ea90118 100644
--- a/src/H5Aint.c
+++ b/src/H5Aint.c
@@ -202,6 +202,11 @@ H5A_create(const H5G_loc_t *loc, const char *name, const H5T_t *type,
if(NULL == (attr->shared->dt = H5T_copy(type, H5T_COPY_ALL)))
HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, NULL, "can't get shared datatype info")
+ /* Convert a datatype (if committed) to a transient type if the committed datatype's file
+ location is different from the file location where the attribute will be created */
+ if(H5T_convert_committed_datatype(attr->shared->dt, loc->oloc->file) < 0)
+ HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, NULL, "can't get shared datatype info")
+
/* Mark datatype as being on disk now */
if(H5T_set_loc(attr->shared->dt, loc->oloc->file, H5T_LOC_DISK) < 0)
HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, NULL, "invalid datatype location")
@@ -1915,15 +1920,17 @@ H5A_t *
H5A_attr_copy_file(const H5A_t *attr_src, H5F_t *file_dst, hbool_t *recompute_size,
H5O_copy_t *cpy_info, hid_t dxpl_id)
{
- H5A_t *attr_dst = NULL;
-
- /* for dataype conversion */
+ H5A_t *attr_dst = NULL; /* Destination attribute */
hid_t tid_src = -1; /* Datatype ID for source datatype */
hid_t tid_dst = -1; /* Datatype ID for destination datatype */
hid_t tid_mem = -1; /* Datatype ID for memory datatype */
void *buf = NULL; /* Buffer for copying data */
void *reclaim_buf = NULL; /* Buffer for reclaiming data */
+ void *bkg_buf = NULL; /* Background buffer */
hid_t buf_sid = -1; /* ID for buffer dataspace */
+ hssize_t sdst_nelmts; /* # of elements in destination attribute (signed) */
+ size_t dst_nelmts; /* # of elements in destination attribute */
+ size_t dst_dt_size; /* Size of destination attribute datatype */
H5A_t *ret_value = NULL; /* Return value */
FUNC_ENTER_NOAPI_NOINIT
@@ -2009,12 +2016,17 @@ H5A_attr_copy_file(const H5A_t *attr_src, H5F_t *file_dst, hbool_t *recompute_si
if(attr_dst->shared->dt_size != attr_src->shared->dt_size || attr_dst->shared->ds_size != attr_src->shared->ds_size)
*recompute_size = TRUE;
+ /* Get # of elements for destination attribute's dataspace */
+ if((sdst_nelmts = H5S_GET_EXTENT_NPOINTS(attr_dst->shared->ds)) < 0)
+ HGOTO_ERROR(H5E_ATTR, H5E_CANTCOUNT, NULL, "dataspace is invalid")
+ H5_CHECKED_ASSIGN(dst_nelmts, size_t, sdst_nelmts, hssize_t);
+
+ /* Get size of destination attribute's datatype */
+ if(0 == (dst_dt_size = H5T_get_size(attr_dst->shared->dt)))
+ HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, NULL, "unable to determine datatype size")
+
/* Compute the size of the data */
- /* NOTE: This raises warnings. If we are going to be serious about
- * expecting overflow here, we should implement testing similar to
- * that described in CERT bulletins INT30-C and INT32-C.
- */
- H5_CHECKED_ASSIGN(attr_dst->shared->data_size, size_t, H5S_GET_EXTENT_NPOINTS(attr_dst->shared->ds) * H5T_get_size(attr_dst->shared->dt), hssize_t);
+ attr_dst->shared->data_size = dst_nelmts * dst_dt_size;
/* Copy (& convert) the data, if necessary */
if(attr_src->shared->data) {
@@ -2093,14 +2105,24 @@ H5A_attr_copy_file(const H5A_t *attr_src, H5F_t *file_dst, hbool_t *recompute_si
HDmemcpy(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)) {
+ if(NULL == (bkg_buf = H5FL_BLK_CALLOC(attr_buf, buf_size)))
+ HGOTO_ERROR(H5E_ATTR, H5E_CANTALLOC, FAIL, "memory allocation failed")
+ }
+
/* Convert from source file to memory */
- if(H5T_convert(tpath_src_mem, tid_src, tid_mem, nelmts, (size_t)0, (size_t)0, buf, NULL, dxpl_id) < 0)
+ if(H5T_convert(tpath_src_mem, tid_src, tid_mem, nelmts, (size_t)0, (size_t)0, buf, bkg_buf, dxpl_id) < 0)
HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, NULL, "datatype conversion NULLed")
HDmemcpy(reclaim_buf, buf, buf_size);
+ /* Set background buffer to all zeros */
+ if(bkg_buf)
+ HDmemset(bkg_buf, 0, buf_size);
+
/* Convert from memory to destination file */
- if(H5T_convert(tpath_mem_dst, tid_mem, tid_dst, nelmts, (size_t)0, (size_t)0, buf, NULL, dxpl_id) < 0)
+ if(H5T_convert(tpath_mem_dst, tid_mem, tid_dst, nelmts, (size_t)0, (size_t)0, buf, bkg_buf, dxpl_id) < 0)
HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, NULL, "datatype conversion NULLed")
HDmemcpy(attr_dst->shared->data, buf, attr_dst->shared->data_size);
@@ -2147,6 +2169,8 @@ done:
buf = H5FL_BLK_FREE(attr_buf, buf);
if(reclaim_buf)
reclaim_buf = H5FL_BLK_FREE(attr_buf, reclaim_buf);
+ if(bkg_buf)
+ bkg_buf = H5FL_BLK_FREE(attr_buf, bkg_buf);
/* Release destination attribute information on failure */
if(!ret_value && attr_dst && H5A_close(attr_dst) < 0)
diff --git a/src/H5Dchunk.c b/src/H5Dchunk.c
index 8cf86ac..dde83fe 100644
--- a/src/H5Dchunk.c
+++ b/src/H5Dchunk.c
@@ -364,6 +364,9 @@ H5FL_DEFINE(H5D_chunk_info_t);
/* Declare a free list to manage the chunk sequence information */
H5FL_BLK_DEFINE_STATIC(chunk);
+/* Declare extern free list to manage the H5S_sel_iter_t struct */
+H5FL_EXTERN(H5S_sel_iter_t);
+
/*-------------------------------------------------------------------------
* Function: H5D__chunk_direct_write
@@ -4557,14 +4560,14 @@ H5D__chunk_prune_fill(H5D_chunk_it_ud1_t *udata, hbool_t new_unfilt_chunk)
const H5O_layout_t *layout = &(dset->shared->layout); /* Dataset's layout */
unsigned rank = udata->common.layout->ndims - 1; /* Dataset rank */
const hsize_t *scaled = udata->common.scaled; /* Scaled chunk offset */
- H5S_sel_iter_t chunk_iter; /* Memory selection iteration info */
+ H5S_sel_iter_t *chunk_iter = NULL; /* Memory selection iteration info */
+ hbool_t chunk_iter_init = FALSE; /* Whether the chunk iterator has been initialized */
hssize_t sel_nelmts; /* Number of elements in selection */
hsize_t count[H5O_LAYOUT_NDIMS]; /* Element count of hyperslab */
size_t chunk_size; /*size of a chunk */
void *chunk; /* The file chunk */
H5D_chunk_ud_t chk_udata; /* User data for locking chunk */
uint32_t bytes_accessed; /* Bytes accessed in chunk */
- hbool_t chunk_iter_init = FALSE; /* Whether the chunk iterator has been initialized */
unsigned u; /* Local index variable */
herr_t ret_value = SUCCEED; /* Return value */
@@ -4629,13 +4632,17 @@ H5D__chunk_prune_fill(H5D_chunk_it_ud1_t *udata, hbool_t new_unfilt_chunk)
if(H5D__fill_refill_vl(&udata->fb_info, (size_t)sel_nelmts, io_info->md_dxpl_id) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTCONVERT, FAIL, "can't refill fill value buffer")
+ /* Allocate the chunk selection iterator */
+ if(NULL == (chunk_iter = H5FL_MALLOC(H5S_sel_iter_t)))
+ 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)
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, io_info->dxpl_cache, chunk/*out*/) < 0)
+ if(H5D__scatter_mem(udata->fb_info.fill_buf, udata->chunk_space, chunk_iter, (size_t)sel_nelmts, io_info->dxpl_cache, chunk/*out*/) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_WRITEERROR, FAIL, "scatter failed")
@@ -4650,8 +4657,10 @@ H5D__chunk_prune_fill(H5D_chunk_it_ud1_t *udata, hbool_t new_unfilt_chunk)
done:
/* Release the selection iterator */
- if(chunk_iter_init && H5S_SELECT_ITER_RELEASE(&chunk_iter) < 0)
+ if(chunk_iter_init && H5S_SELECT_ITER_RELEASE(chunk_iter) < 0)
HDONE_ERROR(H5E_DATASET, H5E_CANTFREE, FAIL, "Can't release selection iterator")
+ if(chunk_iter)
+ chunk_iter = H5FL_FREE(H5S_sel_iter_t, chunk_iter);
FUNC_LEAVE_NOAPI(ret_value)
} /* H5D__chunk_prune_fill */
diff --git a/src/H5Defl.c b/src/H5Defl.c
index cf1b36c..387cbe3 100644
--- a/src/H5Defl.c
+++ b/src/H5Defl.c
@@ -286,13 +286,13 @@ H5D__efl_read(const H5O_efl_t *efl, const H5D_t *dset, haddr_t addr, size_t size
HDassert(buf);
if(u >= efl->nused)
HGOTO_ERROR(H5E_EFL, H5E_OVERFLOW, FAIL, "read past logical end of file")
- if(H5F_OVERFLOW_HSIZET2OFFT(efl->slot[u].offset + skip))
+ if(H5F_OVERFLOW_HSIZET2OFFT((hsize_t)efl->slot[u].offset + skip))
HGOTO_ERROR(H5E_EFL, H5E_OVERFLOW, FAIL, "external file address overflowed")
if(H5_combine_path(dset->shared->extfile_prefix, efl->slot[u].name, &full_name) < 0)
HGOTO_ERROR(H5E_EFL, H5E_NOSPACE, FAIL, "can't build external file name")
if((fd = HDopen(full_name, O_RDONLY, 0)) < 0)
HGOTO_ERROR(H5E_EFL, H5E_CANTOPENFILE, FAIL, "unable to open external raw data file")
- if(HDlseek(fd, (HDoff_t)(efl->slot[u].offset + skip), SEEK_SET) < 0)
+ if(HDlseek(fd, (HDoff_t)(efl->slot[u].offset + (HDoff_t)skip), SEEK_SET) < 0)
HGOTO_ERROR(H5E_EFL, H5E_SEEKERROR, FAIL, "unable to seek in external raw data file")
#ifndef NDEBUG
tempto_read = MIN((size_t)(efl->slot[u].size-skip), (hsize_t)size);
@@ -378,7 +378,7 @@ H5D__efl_write(const H5O_efl_t *efl, const H5D_t *dset, haddr_t addr, size_t siz
HDassert(buf);
if(u >= efl->nused)
HGOTO_ERROR(H5E_EFL, H5E_OVERFLOW, FAIL, "write past logical end of file")
- if(H5F_OVERFLOW_HSIZET2OFFT(efl->slot[u].offset + skip))
+ if(H5F_OVERFLOW_HSIZET2OFFT((hsize_t)efl->slot[u].offset + skip))
HGOTO_ERROR(H5E_EFL, H5E_OVERFLOW, FAIL, "external file address overflowed")
if(H5_combine_path(dset->shared->extfile_prefix, efl->slot[u].name, &full_name) < 0)
HGOTO_ERROR(H5E_EFL, H5E_NOSPACE, FAIL, "can't build external file name")
@@ -388,7 +388,7 @@ H5D__efl_write(const H5O_efl_t *efl, const H5D_t *dset, haddr_t addr, size_t siz
else
HGOTO_ERROR(H5E_EFL, H5E_CANTOPENFILE, FAIL, "unable to open external raw data file")
} /* end if */
- if(HDlseek(fd, (HDoff_t)(efl->slot[u].offset + skip), SEEK_SET) < 0)
+ if(HDlseek(fd, (HDoff_t)(efl->slot[u].offset + (HDoff_t)skip), SEEK_SET) < 0)
HGOTO_ERROR(H5E_EFL, H5E_SEEKERROR, FAIL, "unable to seek in external raw data file")
#ifndef NDEBUG
tempto_write = MIN(efl->slot[u].size - skip, (hsize_t)size);
diff --git a/src/H5Dfill.c b/src/H5Dfill.c
index e5b2161..50c964b 100644
--- a/src/H5Dfill.c
+++ b/src/H5Dfill.c
@@ -88,6 +88,9 @@ H5FL_BLK_DEFINE_STATIC(non_zero_fill);
/* Declare the free list to manage blocks of zero fill-value data */
H5FL_BLK_DEFINE_STATIC(zero_fill);
+/* Declare extern free list to manage the H5S_sel_iter_t struct */
+H5FL_EXTERN(H5S_sel_iter_t);
+
/*--------------------------------------------------------------------------
NAME
@@ -174,6 +177,8 @@ herr_t
H5D__fill(const void *fill, const H5T_t *fill_type, void *buf,
const H5T_t *buf_type, const H5S_t *space, hid_t dxpl_id)
{
+ H5S_sel_iter_t *mem_iter = NULL; /* Memory selection iteration info */
+ hbool_t mem_iter_init = FALSE; /* Whether the memory selection iterator has been initialized */
H5WB_t *elem_wb = NULL; /* Wrapped buffer for element data */
uint8_t elem_buf[H5T_ELEM_BUF_SIZE]; /* Buffer for element data */
H5WB_t *bkg_elem_wb = NULL; /* Wrapped buffer for background data */
@@ -246,7 +251,6 @@ H5D__fill(const void *fill, const H5T_t *fill_type, void *buf,
if(TRUE == H5T_detect_class(fill_type, H5T_VLEN, FALSE)) {
H5D_dxpl_cache_t _dxpl_cache; /* Data transfer property cache buffer */
H5D_dxpl_cache_t *dxpl_cache = &_dxpl_cache; /* Data transfer property cache */
- H5S_sel_iter_t mem_iter; /* Memory selection iteration info */
hssize_t nelmts; /* Number of data elements */
/* Get the number of elements in the selection */
@@ -273,19 +277,18 @@ H5D__fill(const void *fill, const H5T_t *fill_type, void *buf,
if(H5D__get_dxpl_cache(dxpl_id, &dxpl_cache) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't fill dxpl cache")
+ /* Allocate the chunk selection iterator */
+ if(NULL == (mem_iter = H5FL_MALLOC(H5S_sel_iter_t)))
+ 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)
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, dxpl_cache, buf/*out*/) < 0) {
- H5S_SELECT_ITER_RELEASE(&mem_iter);
+ if(H5D__scatter_mem(tmp_buf, space, mem_iter, (size_t)nelmts, dxpl_cache, buf/*out*/) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_READERROR, FAIL, "scatter failed")
- } /* end if */
-
- /* Release the selection iterator */
- if(H5S_SELECT_ITER_RELEASE(&mem_iter) < 0)
- HGOTO_ERROR(H5E_DATASET, H5E_CANTFREE, FAIL, "Can't release selection iterator")
} /* end if */
else {
const uint8_t *fill_buf; /* Buffer to use for writing fill values */
@@ -335,6 +338,10 @@ H5D__fill(const void *fill, const H5T_t *fill_type, void *buf,
} /* end else */
done:
+ if(mem_iter_init && H5S_SELECT_ITER_RELEASE(mem_iter) < 0)
+ HDONE_ERROR(H5E_DATASET, H5E_CANTFREE, FAIL, "Can't release selection iterator")
+ if(mem_iter)
+ mem_iter = H5FL_FREE(H5S_sel_iter_t, mem_iter);
if(src_id != (-1) && H5I_dec_ref(src_id) < 0)
HDONE_ERROR(H5E_DATASET, H5E_CANTFREE, FAIL, "Can't decrement temporary datatype ID")
if(dst_id != (-1) && H5I_dec_ref(dst_id) < 0)
diff --git a/src/H5Dint.c b/src/H5Dint.c
index bbe16cf..5ae3bd3 100644
--- a/src/H5Dint.c
+++ b/src/H5Dint.c
@@ -683,6 +683,11 @@ H5D__init_type(H5F_t *file, const H5D_t *dset, hid_t type_id, const H5T_t *type)
if((dset->shared->type = H5T_copy(type, H5T_COPY_ALL)) == NULL)
HGOTO_ERROR(H5E_DATASET, H5E_CANTCOPY, FAIL, "can't copy datatype")
+ /* Convert a datatype (if committed) to a transient type if the committed datatype's file
+ location is different from the file location where the dataset will be created */
+ if(H5T_convert_committed_datatype(dset->shared->type, file) < 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "can't get shared datatype info")
+
/* Mark any datatypes as being on disk now */
if(H5T_set_loc(dset->shared->type, file, H5T_LOC_DISK) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "can't set datatype location")
diff --git a/src/H5Dio.c b/src/H5Dio.c
index 5004132..f5087da 100644
--- a/src/H5Dio.c
+++ b/src/H5Dio.c
@@ -87,6 +87,9 @@ static herr_t H5D__typeinfo_term(const H5D_type_info_t *type_info);
/* Declare a free list to manage blocks of type conversion data */
H5FL_BLK_DEFINE(type_conv);
+/* Declare a free list to manage the H5D_chunk_map_t struct */
+H5FL_DEFINE(H5D_chunk_map_t);
+
/*-------------------------------------------------------------------------
@@ -366,7 +369,7 @@ herr_t
H5D__read(H5D_t *dataset, hid_t mem_type_id, const H5S_t *mem_space,
const H5S_t *file_space, hid_t dxpl_id, void *buf/*out*/)
{
- H5D_chunk_map_t fm; /* Chunk file<->memory mapping */
+ H5D_chunk_map_t *fm = NULL; /* Chunk file<->memory mapping */
H5D_io_info_t io_info; /* Dataset I/O info */
H5D_type_info_t type_info; /* Datatype info for operation */
hbool_t type_info_init = FALSE; /* Whether the datatype info has been initialized */
@@ -523,26 +526,31 @@ H5D__read(H5D_t *dataset, hid_t mem_type_id, const H5S_t *mem_space,
|| dataset->shared->dcpl_cache.efl.nused > 0
|| dataset->shared->layout.type == H5D_COMPACT);
+ /* Allocate the chunk map */
+ if(NULL == (fm = H5FL_CALLOC(H5D_chunk_map_t)))
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTALLOC, FAIL, "can't allocate chunk map")
+
/* Call storage method's I/O initialization routine */
- HDmemset(&fm, 0, sizeof(H5D_chunk_map_t));
- if(io_info.layout_ops.io_init && (*io_info.layout_ops.io_init)(&io_info, &type_info, nelmts, file_space, mem_space, &fm) < 0)
+ if(io_info.layout_ops.io_init && (*io_info.layout_ops.io_init)(&io_info, &type_info, nelmts, file_space, mem_space, fm) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "can't initialize I/O info")
io_op_init = TRUE;
#ifdef H5_HAVE_PARALLEL
/* Adjust I/O info for any parallel I/O */
- if(H5D__ioinfo_adjust(&io_info, dataset, dxpl_id, file_space, mem_space, &type_info, &fm) < 0)
+ if(H5D__ioinfo_adjust(&io_info, dataset, dxpl_id, file_space, mem_space, &type_info, fm) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to adjust I/O info for parallel I/O")
#endif /*H5_HAVE_PARALLEL*/
/* Invoke correct "high level" I/O routine */
- if((*io_info.io_ops.multi_read)(&io_info, &type_info, nelmts, file_space, mem_space, &fm) < 0)
+ if((*io_info.io_ops.multi_read)(&io_info, &type_info, nelmts, file_space, mem_space, fm) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_READERROR, FAIL, "can't read data")
done:
/* Shut down the I/O op information */
- if(io_op_init && io_info.layout_ops.io_term && (*io_info.layout_ops.io_term)(&fm) < 0)
+ if(io_op_init && io_info.layout_ops.io_term && (*io_info.layout_ops.io_term)(fm) < 0)
HDONE_ERROR(H5E_DATASET, H5E_CANTCLOSEOBJ, FAIL, "unable to shut down I/O op info")
+ if(fm)
+ fm = H5FL_FREE(H5D_chunk_map_t, fm);
if(io_info_init) {
#ifdef H5_DEBUG_BUILD
@@ -587,7 +595,7 @@ herr_t
H5D__write(H5D_t *dataset, hid_t mem_type_id, const H5S_t *mem_space,
const H5S_t *file_space, hid_t dxpl_id, const void *buf)
{
- H5D_chunk_map_t fm; /* Chunk file<->memory mapping */
+ H5D_chunk_map_t *fm = NULL; /* Chunk file<->memory mapping */
H5D_io_info_t io_info; /* Dataset I/O info */
H5D_type_info_t type_info; /* Datatype info for operation */
hbool_t type_info_init = FALSE; /* Whether the datatype info has been initialized */
@@ -765,20 +773,23 @@ H5D__write(H5D_t *dataset, hid_t mem_type_id, const H5S_t *mem_space,
HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to initialize storage")
} /* end if */
+ /* Allocate the chunk map */
+ if(NULL == (fm = H5FL_CALLOC(H5D_chunk_map_t)))
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTALLOC, FAIL, "can't allocate chunk map")
+
/* Call storage method's I/O initialization routine */
- HDmemset(&fm, 0, sizeof(H5D_chunk_map_t));
- if(io_info.layout_ops.io_init && (*io_info.layout_ops.io_init)(&io_info, &type_info, nelmts, file_space, mem_space, &fm) < 0)
+ if(io_info.layout_ops.io_init && (*io_info.layout_ops.io_init)(&io_info, &type_info, nelmts, file_space, mem_space, fm) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "can't initialize I/O info")
io_op_init = TRUE;
#ifdef H5_HAVE_PARALLEL
/* Adjust I/O info for any parallel I/O */
- if(H5D__ioinfo_adjust(&io_info, dataset, dxpl_id, file_space, mem_space, &type_info, &fm) < 0)
+ if(H5D__ioinfo_adjust(&io_info, dataset, dxpl_id, file_space, mem_space, &type_info, fm) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to adjust I/O info for parallel I/O")
#endif /*H5_HAVE_PARALLEL*/
/* Invoke correct "high level" I/O routine */
- if((*io_info.io_ops.multi_write)(&io_info, &type_info, nelmts, file_space, mem_space, &fm) < 0)
+ if((*io_info.io_ops.multi_write)(&io_info, &type_info, nelmts, file_space, mem_space, fm) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_WRITEERROR, FAIL, "can't write data")
#ifdef OLD_WAY
@@ -801,8 +812,10 @@ H5D__write(H5D_t *dataset, hid_t mem_type_id, const H5S_t *mem_space,
done:
/* Shut down the I/O op information */
- if(io_op_init && io_info.layout_ops.io_term && (*io_info.layout_ops.io_term)(&fm) < 0)
+ if(io_op_init && io_info.layout_ops.io_term && (*io_info.layout_ops.io_term)(fm) < 0)
HDONE_ERROR(H5E_DATASET, H5E_CANTCLOSEOBJ, FAIL, "unable to shut down I/O op info")
+ if(fm)
+ fm = H5FL_FREE(H5D_chunk_map_t, fm);
if(io_info_init) {
#ifdef H5_DEBUG_BUILD
diff --git a/src/H5Dscatgath.c b/src/H5Dscatgath.c
index 7c1abca..55111f0 100644
--- a/src/H5Dscatgath.c
+++ b/src/H5Dscatgath.c
@@ -67,10 +67,13 @@ static herr_t H5D__compound_opt_write(size_t nelmts, const H5D_type_info_t *type
/* Local Variables */
/*******************/
-/* Declare a free list to manage sequences of size_t */
+/* Declare extern free list to manage the H5S_sel_iter_t struct */
+H5FL_EXTERN(H5S_sel_iter_t);
+
+/* Declare extern free list to manage sequences of size_t */
H5FL_SEQ_EXTERN(size_t);
-/* Declare a free list to manage sequences of hsize_t */
+/* Declare extern free list to manage sequences of hsize_t */
H5FL_SEQ_EXTERN(hsize_t);
@@ -97,17 +100,16 @@ H5D__scatter_file(const H5D_io_info_t *_io_info,
const void *_buf)
{
H5D_io_info_t tmp_io_info; /* Temporary I/O info object */
- hsize_t _off[H5D_IO_VECTOR_SIZE]; /* Array to store sequence offsets */
hsize_t *off = NULL; /* Pointer to sequence offsets */
hsize_t mem_off; /* Offset in memory */
size_t mem_curr_seq; /* "Current sequence" in memory */
size_t dset_curr_seq; /* "Current sequence" in dataset */
- size_t _len[H5D_IO_VECTOR_SIZE]; /* Array to store sequence lengths */
size_t *len = NULL; /* Array to store sequence lengths */
size_t orig_mem_len, mem_len; /* Length of sequence in memory */
- size_t nseq; /* Number of sequences generated */
- size_t nelem; /* Number of elements used in sequences */
- herr_t ret_value = SUCCEED; /* Return value */
+ size_t nseq; /* Number of sequences generated */
+ size_t nelem; /* Number of elements used in sequences */
+ size_t vec_size; /* Vector length */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_STATIC
@@ -124,21 +126,19 @@ H5D__scatter_file(const H5D_io_info_t *_io_info,
tmp_io_info.u.wbuf = _buf;
/* Allocate the vector I/O arrays */
- if(tmp_io_info.dxpl_cache->vec_size > H5D_IO_VECTOR_SIZE) {
- if(NULL == (len = H5FL_SEQ_MALLOC(size_t, tmp_io_info.dxpl_cache->vec_size)))
- HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "can't allocate I/O length vector array")
- if(NULL == (off = H5FL_SEQ_MALLOC(hsize_t, tmp_io_info.dxpl_cache->vec_size)))
- HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "can't allocate I/O offset vector array")
- } /* end if */
- else {
- len = _len;
- off = _off;
- } /* end else */
+ if(tmp_io_info.dxpl_cache->vec_size > H5D_IO_VECTOR_SIZE)
+ vec_size = tmp_io_info.dxpl_cache->vec_size;
+ else
+ vec_size = H5D_IO_VECTOR_SIZE;
+ if(NULL == (len = H5FL_SEQ_MALLOC(size_t, vec_size)))
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTALLOC, FAIL, "can't allocate I/O length vector array")
+ if(NULL == (off = H5FL_SEQ_MALLOC(hsize_t, vec_size)))
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTALLOC, FAIL, "can't allocate I/O offset vector array")
/* 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, tmp_io_info.dxpl_cache->vec_size, nelmts, &nseq, &nelem, off, len) < 0)
+ if(H5S_SELECT_GET_SEQ_LIST(space, H5S_GET_SEQ_LIST_SORTED, 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 */
@@ -160,9 +160,9 @@ H5D__scatter_file(const H5D_io_info_t *_io_info,
done:
/* Release resources, if allocated */
- if(len && len != _len)
+ if(len)
len = H5FL_SEQ_FREE(size_t, len);
- if(off && off != _off)
+ if(off)
off = H5FL_SEQ_FREE(hsize_t, off);
FUNC_LEAVE_NOAPI(ret_value)
@@ -196,16 +196,15 @@ H5D__gather_file(const H5D_io_info_t *_io_info,
void *_buf/*out*/)
{
H5D_io_info_t tmp_io_info; /* Temporary I/O info object */
- hsize_t _off[H5D_IO_VECTOR_SIZE]; /* Array to store sequence offsets */
hsize_t *off = NULL; /* Pointer to sequence offsets */
hsize_t mem_off; /* Offset in memory */
size_t mem_curr_seq; /* "Current sequence" in memory */
size_t dset_curr_seq; /* "Current sequence" in dataset */
- size_t _len[H5D_IO_VECTOR_SIZE]; /* Array to store sequence lengths */
size_t *len = NULL; /* Pointer to sequence lengths */
size_t orig_mem_len, mem_len; /* Length of sequence in memory */
size_t nseq; /* Number of sequences generated */
size_t nelem; /* Number of elements used in sequences */
+ size_t vec_size; /* Vector length */
size_t ret_value = nelmts; /* Return value */
FUNC_ENTER_STATIC
@@ -225,21 +224,19 @@ H5D__gather_file(const H5D_io_info_t *_io_info,
tmp_io_info.u.rbuf = _buf;
/* Allocate the vector I/O arrays */
- if(tmp_io_info.dxpl_cache->vec_size > H5D_IO_VECTOR_SIZE) {
- if(NULL == (len = H5FL_SEQ_MALLOC(size_t, tmp_io_info.dxpl_cache->vec_size)))
- HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, 0, "can't allocate I/O length vector array")
- if(NULL == (off = H5FL_SEQ_MALLOC(hsize_t, tmp_io_info.dxpl_cache->vec_size)))
- HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, 0, "can't allocate I/O offset vector array")
- } /* end if */
- else {
- len = _len;
- off = _off;
- } /* end else */
+ if(tmp_io_info.dxpl_cache->vec_size > H5D_IO_VECTOR_SIZE)
+ vec_size = tmp_io_info.dxpl_cache->vec_size;
+ else
+ vec_size = H5D_IO_VECTOR_SIZE;
+ if(NULL == (len = H5FL_SEQ_MALLOC(size_t, vec_size)))
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTALLOC, 0, "can't allocate I/O length vector array")
+ if(NULL == (off = H5FL_SEQ_MALLOC(hsize_t, vec_size)))
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTALLOC, 0, "can't allocate I/O offset vector array")
/* 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, tmp_io_info.dxpl_cache->vec_size, nelmts, &nseq, &nelem, off, len) < 0)
+ if(H5S_SELECT_GET_SEQ_LIST(space, H5S_GET_SEQ_LIST_SORTED, 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 */
@@ -261,9 +258,9 @@ H5D__gather_file(const H5D_io_info_t *_io_info,
done:
/* Release resources, if allocated */
- if(len && len != _len)
+ if(len)
len = H5FL_SEQ_FREE(size_t, len);
- if(off && off != _off)
+ if(off)
off = H5FL_SEQ_FREE(hsize_t, off);
FUNC_LEAVE_NOAPI(ret_value)
@@ -292,15 +289,14 @@ H5D__scatter_mem (const void *_tscat_buf, const H5S_t *space,
{
uint8_t *buf = (uint8_t *)_buf; /* Get local copies for address arithmetic */
const uint8_t *tscat_buf = (const uint8_t *)_tscat_buf;
- hsize_t _off[H5D_IO_VECTOR_SIZE]; /* Array to store sequence offsets */
- hsize_t *off = NULL; /* Pointer to sequence offsets */
- size_t _len[H5D_IO_VECTOR_SIZE]; /* Array to store sequence lengths */
- size_t *len = NULL; /* Pointer to sequence lengths */
+ hsize_t *off = NULL; /* Pointer to sequence offsets */
+ size_t *len = NULL; /* Pointer to sequence lengths */
size_t curr_len; /* Length of bytes left to process in sequence */
size_t nseq; /* Number of sequences generated */
size_t curr_seq; /* Current sequence being processed */
size_t nelem; /* Number of elements used in sequences */
- herr_t ret_value = SUCCEED; /* Number of elements scattered */
+ size_t vec_size; /* Vector length */
+ herr_t ret_value = SUCCEED; /* Number of elements scattered */
FUNC_ENTER_PACKAGE
@@ -312,21 +308,19 @@ H5D__scatter_mem (const void *_tscat_buf, const H5S_t *space,
HDassert(buf);
/* Allocate the vector I/O arrays */
- if(dxpl_cache->vec_size > H5D_IO_VECTOR_SIZE) {
- if(NULL == (len = H5FL_SEQ_MALLOC(size_t, dxpl_cache->vec_size)))
- HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "can't allocate I/O length vector array")
- if(NULL == (off = H5FL_SEQ_MALLOC(hsize_t, dxpl_cache->vec_size)))
- HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "can't allocate I/O offset vector array")
- } /* end if */
- else {
- len = _len;
- off = _off;
- } /* end else */
+ if(dxpl_cache->vec_size > H5D_IO_VECTOR_SIZE)
+ vec_size = dxpl_cache->vec_size;
+ else
+ vec_size = H5D_IO_VECTOR_SIZE;
+ if(NULL == (len = H5FL_SEQ_MALLOC(size_t, vec_size)))
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTALLOC, FAIL, "can't allocate I/O length vector array")
+ if(NULL == (off = H5FL_SEQ_MALLOC(hsize_t, vec_size)))
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTALLOC, FAIL, "can't allocate I/O offset vector array")
/* 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, dxpl_cache->vec_size, nelmts, &nseq, &nelem, off, len) < 0)
+ if(H5S_SELECT_GET_SEQ_LIST(space, 0, 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 */
@@ -346,9 +340,9 @@ H5D__scatter_mem (const void *_tscat_buf, const H5S_t *space,
done:
/* Release resources, if allocated */
- if(len && len != _len)
+ if(len)
len = H5FL_SEQ_FREE(size_t, len);
- if(off && off != _off)
+ if(off)
off = H5FL_SEQ_FREE(hsize_t, off);
FUNC_LEAVE_NOAPI(ret_value)
@@ -379,15 +373,14 @@ H5D__gather_mem(const void *_buf, const H5S_t *space,
{
const uint8_t *buf = (const uint8_t *)_buf; /* Get local copies for address arithmetic */
uint8_t *tgath_buf = (uint8_t *)_tgath_buf;
- hsize_t _off[H5D_IO_VECTOR_SIZE]; /* Array to store sequence offsets */
hsize_t *off = NULL; /* Pointer to sequence offsets */
- size_t _len[H5D_IO_VECTOR_SIZE]; /* Array to store sequence lengths */
- size_t *len = NULL; /* Pointer to sequence lengths */
+ size_t *len = NULL; /* Pointer to sequence lengths */
size_t curr_len; /* Length of bytes left to process in sequence */
size_t nseq; /* Number of sequences generated */
size_t curr_seq; /* Current sequence being processed */
size_t nelem; /* Number of elements used in sequences */
- size_t ret_value = nelmts; /* Number of elements gathered */
+ size_t vec_size; /* Vector length */
+ size_t ret_value = nelmts; /* Number of elements gathered */
FUNC_ENTER_STATIC
@@ -399,21 +392,19 @@ H5D__gather_mem(const void *_buf, const H5S_t *space,
HDassert(tgath_buf);
/* Allocate the vector I/O arrays */
- if(dxpl_cache->vec_size > H5D_IO_VECTOR_SIZE) {
- if(NULL == (len = H5FL_SEQ_MALLOC(size_t, dxpl_cache->vec_size)))
- HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, 0, "can't allocate I/O length vector array")
- if(NULL == (off = H5FL_SEQ_MALLOC(hsize_t, dxpl_cache->vec_size)))
- HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, 0, "can't allocate I/O offset vector array")
- } /* end if */
- else {
- len = _len;
- off = _off;
- } /* end else */
+ if(dxpl_cache->vec_size > H5D_IO_VECTOR_SIZE)
+ vec_size = dxpl_cache->vec_size;
+ else
+ vec_size = H5D_IO_VECTOR_SIZE;
+ if(NULL == (len = H5FL_SEQ_MALLOC(size_t, vec_size)))
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTALLOC, 0, "can't allocate I/O length vector array")
+ if(NULL == (off = H5FL_SEQ_MALLOC(hsize_t, vec_size)))
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTALLOC, 0, "can't allocate I/O offset vector array")
/* 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, dxpl_cache->vec_size, nelmts, &nseq, &nelem, off, len) < 0)
+ if(H5S_SELECT_GET_SEQ_LIST(space, 0, 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 */
@@ -433,9 +424,9 @@ H5D__gather_mem(const void *_buf, const H5S_t *space,
done:
/* Release resources, if allocated */
- if(len && len != _len)
+ if(len)
len = H5FL_SEQ_FREE(size_t, len);
- if(off && off != _off)
+ if(off)
off = H5FL_SEQ_FREE(hsize_t, off);
FUNC_LEAVE_NOAPI(ret_value)
@@ -460,15 +451,15 @@ H5D__scatgath_read(const H5D_io_info_t *io_info, const H5D_type_info_t *type_inf
{
const H5D_dxpl_cache_t *dxpl_cache = io_info->dxpl_cache; /* Local pointer to dataset transfer info */
void *buf = io_info->u.rbuf; /* Local pointer to application buffer */
- H5S_sel_iter_t mem_iter; /*memory selection iteration info*/
- hbool_t mem_iter_init = FALSE; /*memory selection iteration info has been initialized */
- H5S_sel_iter_t bkg_iter; /*background iteration info*/
- hbool_t bkg_iter_init = FALSE; /*background iteration info has been initialized */
- H5S_sel_iter_t file_iter; /*file selection iteration info*/
- hbool_t file_iter_init = FALSE; /*file selection iteration info has been initialized */
- hsize_t smine_start; /*strip mine start loc */
- size_t smine_nelmts; /*elements per strip */
- herr_t ret_value = SUCCEED; /*return value */
+ H5S_sel_iter_t *mem_iter = NULL; /* Memory selection iteration info*/
+ hbool_t mem_iter_init = FALSE; /* Memory selection iteration info has been initialized */
+ H5S_sel_iter_t *bkg_iter = NULL; /* Background iteration info*/
+ hbool_t bkg_iter_init = FALSE; /* Background iteration info has been initialized */
+ H5S_sel_iter_t *file_iter = NULL; /* File selection iteration info*/
+ hbool_t file_iter_init = FALSE; /* File selection iteration info has been initialized */
+ hsize_t smine_start; /* Strip mine start loc */
+ size_t smine_nelmts; /* Elements per strip */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_PACKAGE
@@ -483,14 +474,22 @@ H5D__scatgath_read(const H5D_io_info_t *io_info, const H5D_type_info_t *type_inf
if(nelmts == 0)
HGOTO_DONE(SUCCEED)
+ /* Allocate the iterators */
+ if(NULL == (mem_iter = H5FL_MALLOC(H5S_sel_iter_t)))
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTALLOC, FAIL, "can't allocate memory iterator")
+ if(NULL == (bkg_iter = H5FL_MALLOC(H5S_sel_iter_t)))
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTALLOC, FAIL, "can't allocate background iterator")
+ if(NULL == (file_iter = H5FL_MALLOC(H5S_sel_iter_t)))
+ 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) < 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)
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)
HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to initialize background selection information")
bkg_iter_init = TRUE; /*file selection iteration info has been initialized */
@@ -499,7 +498,7 @@ H5D__scatgath_read(const H5D_io_info_t *io_info, const H5D_type_info_t *type_inf
size_t n; /* Elements operated on */
/* Go figure out how many elements to read from the file */
- HDassert(H5S_SELECT_ITER_NELMTS(&file_iter) == (nelmts - smine_start));
+ HDassert(H5S_SELECT_ITER_NELMTS(file_iter) == (nelmts - smine_start));
smine_nelmts = (size_t)MIN(type_info->request_nelmts, (nelmts - smine_start));
/*
@@ -511,8 +510,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_space, file_iter, smine_nelmts, type_info->tconv_buf/*out*/);
if(n != smine_nelmts)
HGOTO_ERROR(H5E_IO, H5E_READERROR, FAIL, "file gather failed")
@@ -521,14 +519,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, dxpl_cache,
- type_info, buf /*out*/) < 0)
+ if(H5D__compound_opt_read(smine_nelmts, mem_space, mem_iter, dxpl_cache, 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,
- dxpl_cache, type_info->bkg_buf/*out*/);
+ n = H5D__gather_mem(buf, mem_space, bkg_iter, smine_nelmts, dxpl_cache, type_info->bkg_buf/*out*/);
if(n != smine_nelmts)
HGOTO_ERROR(H5E_IO, H5E_READERROR, FAIL, "mem gather failed")
} /* end if */
@@ -549,26 +545,25 @@ 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, dxpl_cache, buf/*out*/) < 0)
+ if(H5D__scatter_mem(type_info->tconv_buf, mem_space, mem_iter, smine_nelmts, dxpl_cache, buf/*out*/) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_READERROR, FAIL, "scatter failed")
} /* end else */
} /* end for */
done:
/* Release selection iterators */
- if(file_iter_init) {
- if(H5S_SELECT_ITER_RELEASE(&file_iter) < 0)
- HDONE_ERROR(H5E_DATASET, H5E_CANTFREE, FAIL, "Can't release selection iterator")
- } /* end if */
- if(mem_iter_init) {
- if(H5S_SELECT_ITER_RELEASE(&mem_iter) < 0)
- HDONE_ERROR(H5E_DATASET, H5E_CANTFREE, FAIL, "Can't release selection iterator")
- } /* end if */
- if(bkg_iter_init) {
- if(H5S_SELECT_ITER_RELEASE(&bkg_iter) < 0)
- HDONE_ERROR(H5E_DATASET, H5E_CANTFREE, FAIL, "Can't release selection iterator")
- } /* end if */
+ if(file_iter_init && H5S_SELECT_ITER_RELEASE(file_iter) < 0)
+ HDONE_ERROR(H5E_DATASET, H5E_CANTFREE, FAIL, "Can't release selection iterator")
+ if(file_iter)
+ file_iter = H5FL_FREE(H5S_sel_iter_t, file_iter);
+ if(mem_iter_init && H5S_SELECT_ITER_RELEASE(mem_iter) < 0)
+ HDONE_ERROR(H5E_DATASET, H5E_CANTFREE, FAIL, "Can't release selection iterator")
+ if(mem_iter)
+ mem_iter = H5FL_FREE(H5S_sel_iter_t, mem_iter);
+ if(bkg_iter_init && H5S_SELECT_ITER_RELEASE(bkg_iter) < 0)
+ HDONE_ERROR(H5E_DATASET, H5E_CANTFREE, FAIL, "Can't release selection iterator")
+ if(bkg_iter)
+ bkg_iter = H5FL_FREE(H5S_sel_iter_t, bkg_iter);
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5D__scatgath_read() */
@@ -592,15 +587,15 @@ H5D__scatgath_write(const H5D_io_info_t *io_info, const H5D_type_info_t *type_in
{
const H5D_dxpl_cache_t *dxpl_cache = io_info->dxpl_cache; /* Local pointer to dataset transfer info */
const void *buf = io_info->u.wbuf; /* Local pointer to application buffer */
- H5S_sel_iter_t mem_iter; /*memory selection iteration info*/
- hbool_t mem_iter_init = FALSE; /*memory selection iteration info has been initialized */
- H5S_sel_iter_t bkg_iter; /*background iteration info*/
- hbool_t bkg_iter_init = FALSE; /*background iteration info has been initialized */
- H5S_sel_iter_t file_iter; /*file selection iteration info*/
- hbool_t file_iter_init = FALSE; /*file selection iteration info has been initialized */
- hsize_t smine_start; /*strip mine start loc */
- size_t smine_nelmts; /*elements per strip */
- herr_t ret_value = SUCCEED; /*return value */
+ H5S_sel_iter_t *mem_iter = NULL; /* Memory selection iteration info*/
+ hbool_t mem_iter_init = FALSE; /* Memory selection iteration info has been initialized */
+ H5S_sel_iter_t *bkg_iter = NULL; /* Background iteration info*/
+ hbool_t bkg_iter_init = FALSE; /* Background iteration info has been initialized */
+ H5S_sel_iter_t *file_iter = NULL; /* File selection iteration info*/
+ hbool_t file_iter_init = FALSE; /* File selection iteration info has been initialized */
+ hsize_t smine_start; /* Strip mine start loc */
+ size_t smine_nelmts; /* Elements per strip */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_PACKAGE
@@ -615,14 +610,22 @@ H5D__scatgath_write(const H5D_io_info_t *io_info, const H5D_type_info_t *type_in
if(nelmts == 0)
HGOTO_DONE(SUCCEED)
+ /* Allocate the iterators */
+ if(NULL == (mem_iter = H5FL_MALLOC(H5S_sel_iter_t)))
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTALLOC, FAIL, "can't allocate memory iterator")
+ if(NULL == (bkg_iter = H5FL_MALLOC(H5S_sel_iter_t)))
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTALLOC, FAIL, "can't allocate background iterator")
+ if(NULL == (file_iter = H5FL_MALLOC(H5S_sel_iter_t)))
+ 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) < 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)
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) < 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 */
@@ -631,7 +634,7 @@ H5D__scatgath_write(const H5D_io_info_t *io_info, const H5D_type_info_t *type_in
size_t n; /* Elements operated on */
/* Go figure out how many elements to read from the file */
- HDassert(H5S_SELECT_ITER_NELMTS(&file_iter) == (nelmts - smine_start));
+ HDassert(H5S_SELECT_ITER_NELMTS(file_iter) == (nelmts - smine_start));
smine_nelmts = (size_t)MIN(type_info->request_nelmts, (nelmts - smine_start));
/*
@@ -639,8 +642,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,
- dxpl_cache, type_info->tconv_buf/*out*/);
+ n = H5D__gather_mem(buf, mem_space, mem_iter, smine_nelmts, dxpl_cache, type_info->tconv_buf/*out*/);
if(n != smine_nelmts)
HGOTO_ERROR(H5E_IO, H5E_WRITEERROR, FAIL, "mem gather failed")
@@ -657,8 +659,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, file_space, 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 */
@@ -681,25 +682,24 @@ 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_space, file_iter, smine_nelmts, type_info->tconv_buf) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_WRITEERROR, FAIL, "scatter failed")
} /* end for */
done:
/* Release selection iterators */
- if(file_iter_init) {
- if(H5S_SELECT_ITER_RELEASE(&file_iter) < 0)
- HDONE_ERROR(H5E_DATASET, H5E_CANTFREE, FAIL, "Can't release selection iterator")
- } /* end if */
- if(mem_iter_init) {
- if(H5S_SELECT_ITER_RELEASE(&mem_iter) < 0)
- HDONE_ERROR(H5E_DATASET, H5E_CANTFREE, FAIL, "Can't release selection iterator")
- } /* end if */
- if(bkg_iter_init) {
- if(H5S_SELECT_ITER_RELEASE(&bkg_iter) < 0)
- HDONE_ERROR(H5E_DATASET, H5E_CANTFREE, FAIL, "Can't release selection iterator")
- } /* end if */
+ if(file_iter_init && H5S_SELECT_ITER_RELEASE(file_iter) < 0)
+ HDONE_ERROR(H5E_DATASET, H5E_CANTFREE, FAIL, "Can't release selection iterator")
+ if(file_iter)
+ file_iter = H5FL_FREE(H5S_sel_iter_t, file_iter);
+ if(mem_iter_init && H5S_SELECT_ITER_RELEASE(mem_iter) < 0)
+ HDONE_ERROR(H5E_DATASET, H5E_CANTFREE, FAIL, "Can't release selection iterator")
+ if(mem_iter)
+ mem_iter = H5FL_FREE(H5S_sel_iter_t, mem_iter);
+ if(bkg_iter_init && H5S_SELECT_ITER_RELEASE(bkg_iter) < 0)
+ HDONE_ERROR(H5E_DATASET, H5E_CANTFREE, FAIL, "Can't release selection iterator")
+ if(bkg_iter)
+ bkg_iter = H5FL_FREE(H5S_sel_iter_t, bkg_iter);
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5D__scatgath_write() */
@@ -744,12 +744,11 @@ H5D__compound_opt_read(size_t nelmts, const H5S_t *space,
{
uint8_t *ubuf = (uint8_t *)user_buf; /* Cast for pointer arithmetic */
uint8_t *xdbuf; /* Pointer into dataset buffer */
- hsize_t _off[H5D_IO_VECTOR_SIZE]; /* Array to store sequence offsets */
hsize_t *off = NULL; /* Pointer to sequence offsets */
- size_t _len[H5D_IO_VECTOR_SIZE]; /* Array to store sequence lengths */
size_t *len = NULL; /* Pointer to sequence lengths */
size_t src_stride, dst_stride, copy_size;
- herr_t ret_value = SUCCEED; /*return value */
+ size_t vec_size; /* Vector length */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_STATIC
@@ -765,16 +764,14 @@ H5D__compound_opt_read(size_t nelmts, const H5S_t *space,
HDassert(user_buf);
/* Allocate the vector I/O arrays */
- if(dxpl_cache->vec_size > H5D_IO_VECTOR_SIZE) {
- if(NULL == (len = H5FL_SEQ_MALLOC(size_t, dxpl_cache->vec_size)))
- HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "can't allocate I/O length vector array")
- if(NULL == (off = H5FL_SEQ_MALLOC(hsize_t, dxpl_cache->vec_size)))
- HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "can't allocate I/O offset vector array")
- } /* end if */
- else {
- len = _len;
- off = _off;
- } /* end else */
+ if(dxpl_cache->vec_size > H5D_IO_VECTOR_SIZE)
+ vec_size = dxpl_cache->vec_size;
+ else
+ vec_size = H5D_IO_VECTOR_SIZE;
+ if(NULL == (len = H5FL_SEQ_MALLOC(size_t, vec_size)))
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTALLOC, FAIL, "can't allocate I/O length vector array")
+ if(NULL == (off = H5FL_SEQ_MALLOC(hsize_t, vec_size)))
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTALLOC, FAIL, "can't allocate I/O offset vector array")
/* Get source & destination strides */
src_stride = type_info->src_type_size;
@@ -791,7 +788,7 @@ H5D__compound_opt_read(size_t nelmts, const H5S_t *space,
size_t elmtno; /* Element counter */
/* Get list of sequences for selection to write */
- if(H5S_SELECT_GET_SEQ_LIST(space, 0, iter, dxpl_cache->vec_size, nelmts, &nseq, &elmtno, off, len) < 0)
+ if(H5S_SELECT_GET_SEQ_LIST(space, 0, 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 */
@@ -827,9 +824,9 @@ H5D__compound_opt_read(size_t nelmts, const H5S_t *space,
done:
/* Release resources, if allocated */
- if(len && len != _len)
+ if(len)
len = H5FL_SEQ_FREE(size_t, len);
- if(off && off != _off)
+ if(off)
off = H5FL_SEQ_FREE(hsize_t, off);
FUNC_LEAVE_NOAPI(ret_value)
@@ -923,7 +920,7 @@ H5Dscatter(H5D_scatter_func_t op, void *op_data, hid_t type_id,
{
H5T_t *type; /* Datatype */
H5S_t *dst_space; /* Dataspace */
- H5S_sel_iter_t iter; /* Selection iteration info*/
+ H5S_sel_iter_t *iter = NULL; /* Selection iteration info*/
hbool_t iter_init = FALSE; /* Selection iteration info has been initialized */
const void *src_buf = NULL; /* Source (contiguous) data buffer */
size_t src_buf_nbytes = 0; /* Size of src_buf */
@@ -959,8 +956,12 @@ H5Dscatter(H5D_scatter_func_t op, void *op_data, hid_t type_id,
if((nelmts = (hssize_t)H5S_GET_SELECT_NPOINTS(dst_space)) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTCOUNT, FAIL, "unable to get number of elements in selection")
+ /* Allocate the selection iterator */
+ if(NULL == (iter = H5FL_MALLOC(H5S_sel_iter_t)))
+ 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)
HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to initialize selection iterator information")
iter_init = TRUE;
@@ -984,7 +985,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, dxpl_cache, dst_buf) < 0)
+ if(H5D__scatter_mem(src_buf, dst_space, iter, nelmts_scatter, dxpl_cache, dst_buf) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTCOPY, FAIL, "scatter failed")
nelmts -= (hssize_t)nelmts_scatter;
@@ -992,10 +993,10 @@ H5Dscatter(H5D_scatter_func_t op, void *op_data, hid_t type_id,
done:
/* Release selection iterator */
- if(iter_init) {
- if(H5S_SELECT_ITER_RELEASE(&iter) < 0)
- HDONE_ERROR(H5E_DATASET, H5E_CANTFREE, FAIL, "Can't release selection iterator")
- } /* end if */
+ if(iter_init && H5S_SELECT_ITER_RELEASE(iter) < 0)
+ HDONE_ERROR(H5E_DATASET, H5E_CANTFREE, FAIL, "Can't release selection iterator")
+ if(iter)
+ iter = H5FL_FREE(H5S_sel_iter_t, iter);
FUNC_LEAVE_API(ret_value)
} /* H5Dscatter() */
@@ -1023,7 +1024,7 @@ H5Dgather(hid_t src_space_id, const void *src_buf, hid_t type_id,
{
H5T_t *type; /* Datatype */
H5S_t *src_space; /* Dataspace */
- H5S_sel_iter_t iter; /* Selection iteration info*/
+ H5S_sel_iter_t *iter = NULL; /* Selection iteration info*/
hbool_t iter_init = FALSE; /* Selection iteration info has been initialized */
size_t type_size; /* Datatype element size */
hssize_t nelmts; /* Number of remaining elements in selection */
@@ -1071,15 +1072,19 @@ H5Dgather(hid_t src_space_id, const void *src_buf, hid_t type_id,
if(((size_t)nelmts > dst_buf_nelmts) && (op == NULL))
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no callback supplied and destination buffer too small")
+ /* Allocate the selection iterator */
+ if(NULL == (iter = H5FL_MALLOC(H5S_sel_iter_t)))
+ 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)
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), dxpl_cache, dst_buf)))
+ if(0 == (nelmts_gathered = H5D__gather_mem(src_buf, src_space, iter, MIN(dst_buf_nelmts, (size_t)nelmts), dxpl_cache, dst_buf)))
HGOTO_ERROR(H5E_IO, H5E_CANTCOPY, FAIL, "gather failed")
HDassert(nelmts_gathered == MIN(dst_buf_nelmts, (size_t)nelmts));
@@ -1093,10 +1098,10 @@ H5Dgather(hid_t src_space_id, const void *src_buf, hid_t type_id,
done:
/* Release selection iterator */
- if(iter_init) {
- if(H5S_SELECT_ITER_RELEASE(&iter) < 0)
- HDONE_ERROR(H5E_DATASET, H5E_CANTFREE, FAIL, "Can't release selection iterator")
- } /* end if */
+ if(iter_init && H5S_SELECT_ITER_RELEASE(iter) < 0)
+ HDONE_ERROR(H5E_DATASET, H5E_CANTFREE, FAIL, "Can't release selection iterator")
+ if(iter)
+ iter = H5FL_FREE(H5S_sel_iter_t, iter);
FUNC_LEAVE_API(ret_value)
} /* H5Dgather() */
diff --git a/src/H5Dselect.c b/src/H5Dselect.c
index 312beba..53829e5 100644
--- a/src/H5Dselect.c
+++ b/src/H5Dselect.c
@@ -68,6 +68,9 @@ H5FL_SEQ_DEFINE(size_t);
/* Declare a free list to manage sequences of hsize_t */
H5FL_SEQ_DEFINE(hsize_t);
+/* Declare extern free list to manage the H5S_sel_iter_t struct */
+H5FL_EXTERN(H5S_sel_iter_t);
+
/*-------------------------------------------------------------------------
@@ -86,22 +89,19 @@ static herr_t
H5D__select_io(const H5D_io_info_t *io_info, size_t elmt_size,
size_t nelmts, const H5S_t *file_space, const H5S_t *mem_space)
{
- H5S_sel_iter_t mem_iter; /* Memory selection iteration info */
- hbool_t mem_iter_init = 0; /* Memory selection iteration info has been initialized */
- H5S_sel_iter_t file_iter; /* File selection iteration info */
- hbool_t file_iter_init = 0; /* File selection iteration info has been initialized */
- hsize_t _mem_off[H5D_IO_VECTOR_SIZE]; /* Array to store sequence offsets in memory */
+ H5S_sel_iter_t *mem_iter = NULL; /* Memory selection iteration info */
+ hbool_t mem_iter_init = FALSE; /* Memory selection iteration info has been initialized */
+ H5S_sel_iter_t *file_iter = NULL; /* File selection iteration info */
+ hbool_t file_iter_init = FALSE; /* File selection iteration info has been initialized */
hsize_t *mem_off = NULL; /* Pointer to sequence offsets in memory */
- hsize_t _file_off[H5D_IO_VECTOR_SIZE]; /* Array to store sequence offsets in the file */
hsize_t *file_off = NULL; /* Pointer to sequence offsets in the file */
- size_t _mem_len[H5D_IO_VECTOR_SIZE]; /* Array to store sequence lengths in memory */
size_t *mem_len = NULL; /* Pointer to sequence lengths in memory */
- size_t _file_len[H5D_IO_VECTOR_SIZE]; /* Array to store sequence lengths in the file */
size_t *file_len = NULL; /* Pointer to sequence lengths in the file */
size_t curr_mem_seq; /* Current memory sequence to operate on */
size_t curr_file_seq; /* Current file sequence to operate on */
size_t mem_nseq; /* Number of sequences generated in the file */
size_t file_nseq; /* Number of sequences generated in memory */
+ size_t vec_size; /* Vector length */
ssize_t tmp_file_len; /* Temporary number of bytes in file sequence */
herr_t ret_value = SUCCEED; /* Return value */
@@ -115,22 +115,18 @@ H5D__select_io(const H5D_io_info_t *io_info, size_t elmt_size,
HDassert(io_info->u.rbuf);
/* Allocate the vector I/O arrays */
- if(io_info->dxpl_cache->vec_size > H5D_IO_VECTOR_SIZE) {
- if(NULL == (mem_len = H5FL_SEQ_MALLOC(size_t,io_info->dxpl_cache->vec_size)))
- HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "can't allocate I/O length vector array")
- if(NULL == (mem_off = H5FL_SEQ_MALLOC(hsize_t,io_info->dxpl_cache->vec_size)))
- HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "can't allocate I/O offset vector array")
- if(NULL == (file_len = H5FL_SEQ_MALLOC(size_t,io_info->dxpl_cache->vec_size)))
- HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "can't allocate I/O length vector array")
- if(NULL == (file_off = H5FL_SEQ_MALLOC(hsize_t,io_info->dxpl_cache->vec_size)))
- HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "can't allocate I/O offset vector array")
- } /* end if */
- else {
- mem_len = _mem_len;
- mem_off = _mem_off;
- file_len = _file_len;
- file_off = _file_off;
- } /* end else */
+ if(io_info->dxpl_cache->vec_size > H5D_IO_VECTOR_SIZE)
+ vec_size = io_info->dxpl_cache->vec_size;
+ else
+ vec_size = H5D_IO_VECTOR_SIZE;
+ if(NULL == (mem_len = H5FL_SEQ_MALLOC(size_t, vec_size)))
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTALLOC, FAIL, "can't allocate I/O length vector array")
+ if(NULL == (mem_off = H5FL_SEQ_MALLOC(hsize_t, vec_size)))
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTALLOC, FAIL, "can't allocate I/O offset vector array")
+ if(NULL == (file_len = H5FL_SEQ_MALLOC(size_t, vec_size)))
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTALLOC, FAIL, "can't allocate I/O length vector array")
+ if(NULL == (file_off = H5FL_SEQ_MALLOC(hsize_t, vec_size)))
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTALLOC, FAIL, "can't allocate I/O offset vector array")
/* Check for only one element in selection */
if(nelmts == 1) {
@@ -169,13 +165,19 @@ H5D__select_io(const H5D_io_info_t *io_info, size_t elmt_size,
size_t mem_nelem; /* Number of elements used in memory sequences */
size_t file_nelem; /* Number of elements used in file sequences */
+ /* Allocate the iterators */
+ if(NULL == (mem_iter = H5FL_MALLOC(H5S_sel_iter_t)))
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTALLOC, FAIL, "can't allocate memory iterator")
+ if(NULL == (file_iter = H5FL_MALLOC(H5S_sel_iter_t)))
+ 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) < 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)
HGOTO_ERROR(H5E_DATASPACE, H5E_CANTINIT, FAIL, "unable to initialize selection iterator")
mem_iter_init = 1; /* Memory selection iteration info has been initialized */
@@ -188,7 +190,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, io_info->dxpl_cache->vec_size, nelmts, &file_nseq, &file_nelem, file_off, file_len) < 0)
+ 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)
HGOTO_ERROR(H5E_INTERNAL, H5E_UNSUPPORTED, FAIL, "sequence length generation failed")
/* Start at the beginning of the sequences again */
@@ -198,7 +200,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, io_info->dxpl_cache->vec_size, nelmts, &mem_nseq, &mem_nelem, mem_off, mem_len) < 0)
+ if(H5S_SELECT_GET_SEQ_LIST(mem_space, 0, 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,24 +229,24 @@ H5D__select_io(const H5D_io_info_t *io_info, size_t elmt_size,
} /* end else */
done:
- /* Release file selection iterator */
- if(file_iter_init)
- if(H5S_SELECT_ITER_RELEASE(&file_iter) < 0)
- HDONE_ERROR(H5E_DATASPACE, H5E_CANTRELEASE, FAIL, "unable to release selection iterator")
-
- /* Release memory selection iterator */
- if(mem_iter_init)
- if(H5S_SELECT_ITER_RELEASE(&mem_iter) < 0)
- HDONE_ERROR(H5E_DATASPACE, H5E_CANTRELEASE, FAIL, "unable to release selection iterator")
+ /* Release selection iterators */
+ if(file_iter_init && H5S_SELECT_ITER_RELEASE(file_iter) < 0)
+ HDONE_ERROR(H5E_DATASET, H5E_CANTRELEASE, FAIL, "unable to release selection iterator")
+ if(file_iter)
+ file_iter = H5FL_FREE(H5S_sel_iter_t, file_iter);
+ if(mem_iter_init && H5S_SELECT_ITER_RELEASE(mem_iter) < 0)
+ HDONE_ERROR(H5E_DATASET, H5E_CANTRELEASE, FAIL, "unable to release selection iterator")
+ if(mem_iter)
+ mem_iter = H5FL_FREE(H5S_sel_iter_t, mem_iter);
/* Release vector arrays, if allocated */
- if(file_len && file_len != _file_len)
+ if(file_len)
file_len = H5FL_SEQ_FREE(size_t, file_len);
- if(file_off && file_off != _file_off)
+ if(file_off)
file_off = H5FL_SEQ_FREE(hsize_t, file_off);
- if(mem_len && mem_len != _mem_len)
+ if(mem_len)
mem_len = H5FL_SEQ_FREE(size_t, mem_len);
- if(mem_off && mem_off != _mem_off)
+ if(mem_off)
mem_off = H5FL_SEQ_FREE(hsize_t, mem_off);
FUNC_LEAVE_NOAPI(ret_value)
diff --git a/src/H5FDcore.c b/src/H5FDcore.c
index 5ce6560..f29e231 100644
--- a/src/H5FDcore.c
+++ b/src/H5FDcore.c
@@ -203,9 +203,6 @@ H5FD__core_add_dirty_region(H5FD_core_t *file, haddr_t start, haddr_t end)
haddr_t a_addr = 0;
hbool_t create_new_node = TRUE;
herr_t ret_value = SUCCEED;
-#ifdef DER
- hbool_t was_adjusted = FALSE;
-#endif
FUNC_ENTER_STATIC
@@ -213,34 +210,15 @@ H5FD__core_add_dirty_region(H5FD_core_t *file, haddr_t start, haddr_t end)
HDassert(file->dirty_list);
HDassert(start <= end);
-#ifdef DER
-fprintf(stderr, "Add region: (%llu, %llu)\n", start, end);
-#endif
-
/* Adjust the dirty region to the nearest block boundaries */
- if(start % file->bstore_page_size != 0) {
+ if(start % file->bstore_page_size != 0)
start = (start / file->bstore_page_size) * file->bstore_page_size;
-#ifdef DER
- was_adjusted = TRUE;
-#endif
- }
+
if(end % file->bstore_page_size != (file->bstore_page_size - 1)) {
end = (((end / file->bstore_page_size) + 1) * file->bstore_page_size) - 1;
- if(end > file->eof){
-#ifdef DER
-fprintf(stderr, "Adjusted to EOF\n");
-#endif
+ if(end > file->eof)
end = file->eof - 1;
- }
-#ifdef DER
- was_adjusted = TRUE;
-#endif
- }
-
-#ifdef DER
-if(was_adjusted)
- fprintf(stderr, "Adjusted region: (%llu, %llu)\n", start, end);
-#endif
+ } /* end if */
/* Get the regions before and after the intended insertion point */
b_addr = start +1;
@@ -249,15 +227,13 @@ if(was_adjusted)
a_item = (H5FD_core_region_t *)H5SL_less(file->dirty_list, &a_addr);
/* Check to see if we need to extend the upper end of the NEW region */
- if(a_item) {
+ if(a_item)
if(start < a_item->start && end < a_item->end) {
-
/* Extend the end of the NEW region to match the existing AFTER region */
end = a_item->end;
- }
- }
+ } /* end if */
/* Attempt to extend the PREV region */
- if(b_item) {
+ if(b_item)
if(start <= b_item->end + 1) {
/* Need to set this for the delete algorithm */
@@ -267,8 +243,7 @@ if(was_adjusted)
* just update an existing one instead.
*/
create_new_node = FALSE;
- }
- }
+ } /* end if */
/* Remove any old nodes that are no longer needed */
while(a_item && a_item->start > start) {
@@ -286,7 +261,7 @@ if(was_adjusted)
/* Set up to check the next node */
if(less)
a_item = less;
- }
+ } /* end while */
/* Insert the new node */
if(create_new_node) {
@@ -297,17 +272,17 @@ if(was_adjusted)
item->end = end;
if(H5SL_insert(file->dirty_list, item, &item->start) < 0)
HGOTO_ERROR(H5E_SLIST, H5E_CANTINSERT, FAIL, "can't insert new dirty region: (%llu, %llu)\n", (unsigned long long)start, (unsigned long long)end)
- }
+ } /* end if */
else {
/* Store the new item endpoint if it's bigger */
item->end = (item->end < end) ? end : item->end;
- }
- }
+ } /* end else */
+ } /* end if */
else {
/* Update the size of the before region */
if(b_item->end < end)
b_item->end = end;
- }
+ } /* end else */
done:
FUNC_LEAVE_NOAPI(ret_value)
@@ -336,20 +311,13 @@ H5FD__core_destroy_dirty_list(H5FD_core_t *file)
if(file->dirty_list) {
H5FD_core_region_t *region = NULL;
-#ifdef DER
-{
-size_t count = H5SL_count(file->dirty_list);
-if(count != 0)
- fprintf(stderr, "LIST NOT EMPTY AT DESTROY\n");
-}
-#endif
while(NULL != (region = (H5FD_core_region_t *)H5SL_remove_first(file->dirty_list)))
region = H5FL_FREE(H5FD_core_region_t, region);
if(H5SL_close(file->dirty_list) < 0)
HGOTO_ERROR(H5E_SLIST, H5E_CLOSEERROR, FAIL, "can't close core vfd dirty list")
file->dirty_list = NULL;
- }
+ } /* end if */
done:
FUNC_LEAVE_NOAPI(ret_value)
@@ -394,14 +362,8 @@ H5FD__core_write_to_bstore(H5FD_core_t *file, haddr_t addr, size_t size)
else
bytes_in = (h5_posix_io_t)size;
-#ifdef DER
-fprintf(stderr, "\nNEW\n");
-#endif
do {
bytes_wrote = HDwrite(file->fd, ptr, bytes_in);
-#ifdef DER
-fprintf(stderr, "bytes wrote: %lu\n", bytes_wrote);
-#endif
} while(-1 == bytes_wrote && EINTR == errno);
if(-1 == bytes_wrote) { /* error */
@@ -844,9 +806,6 @@ H5FD__core_open(const char *name, unsigned flags, hid_t fapl_id, haddr_t maxaddr
if(use_write_tracking) {
if(NULL == (file->dirty_list = H5SL_create(H5SL_TYPE_HADDR, NULL)))
HGOTO_ERROR(H5E_SLIST, H5E_CANTCREATE, NULL, "can't create core vfd dirty region list");
-#ifdef DER
-fprintf(stderr, "\n");
-#endif
} /* end if */
} /* end if */
@@ -1350,9 +1309,6 @@ H5FD__core_flush(H5FD_t *_file, hid_t H5_ATTR_UNUSED dxpl_id, hbool_t H5_ATTR_UN
H5FD_core_region_t *item = NULL;
size_t size;
-#ifdef DER
- fprintf(stderr, "FLUSHING. DIRTY LIST:\n");
-#endif
while(NULL != (item = (H5FD_core_region_t *)H5SL_remove_first(file->dirty_list))) {
/* The file may have been truncated, so check for that
@@ -1362,11 +1318,8 @@ H5FD__core_flush(H5FD_t *_file, hid_t H5_ATTR_UNUSED dxpl_id, hbool_t H5_ATTR_UN
if(item->end >= file->eof)
item->end = file->eof - 1;
-
size = (size_t)((item->end - item->start) + 1);
-#ifdef DER
-fprintf(stderr, "(%llu, %llu : %lu)\n", item->start, item->end, size);
-#endif
+
if(H5FD__core_write_to_bstore(file, item->start, size) != SUCCEED)
HGOTO_ERROR(H5E_VFL, H5E_WRITEERROR, FAIL, "unable to write to backing store")
} /* end if */
@@ -1374,13 +1327,6 @@ fprintf(stderr, "(%llu, %llu : %lu)\n", item->start, item->end, size);
item = H5FL_FREE(H5FD_core_region_t, item);
} /* end while */
-#ifdef DER
-fprintf(stderr, "EOF: %llu\n", file->eof);
-fprintf(stderr, "EOA: %llu\n", file->eoa);
-if(file->eoa > file->eof)
- fprintf(stderr, "*** EOA BADNESS ***\n");
-fprintf(stderr, "\n");
-#endif
} /* end if */
/* Otherwise, write the entire file out at once */
else {
@@ -1504,9 +1450,6 @@ H5FD__core_truncate(H5FD_t *_file, hid_t H5_ATTR_UNUSED dxpl_id, hbool_t closing
HSYS_GOTO_ERROR(H5E_IO, H5E_SEEKERROR, FAIL, "unable to extend file properly")
#endif /* H5_HAVE_WIN32_API */
-#ifdef DER
-fprintf(stderr, "OLD: Truncated to: %llu\n", file->eoa);
-#endif
} /* end if */
/* Update the eof value */
diff --git a/src/H5FDfamily.c b/src/H5FDfamily.c
index 3b38836..7ec8751 100644
--- a/src/H5FDfamily.c
+++ b/src/H5FDfamily.c
@@ -46,10 +46,8 @@
#include "H5MMprivate.h" /* Memory management */
#include "H5Pprivate.h" /* Property lists */
-#undef MAX
-#define MAX(X,Y) ((X)>(Y)?(X):(Y))
-#undef MIN
-#define MIN(X,Y) ((X)<(Y)?(X):(Y))
+/* The size of the member name buffers */
+#define H5FD_FAM_MEMB_NAME_BUF_SIZE 4096
/* The driver identification number, initialized at runtime */
static hid_t H5FD_FAMILY_g = 0;
@@ -623,11 +621,11 @@ static H5FD_t *
H5FD_family_open(const char *name, unsigned flags, hid_t fapl_id,
haddr_t maxaddr)
{
- H5FD_family_t *file=NULL;
- H5FD_t *ret_value=NULL;
- char memb_name[4096], temp[4096];
- hsize_t eof=HADDR_UNDEF;
+ H5FD_family_t *file = NULL;
+ char *memb_name = NULL, *temp = NULL;
+ hsize_t eof = HADDR_UNDEF;
unsigned t_flags = flags & ~H5F_ACC_CREAT;
+ H5FD_t *ret_value = NULL;
FUNC_ENTER_NOAPI_NOINIT
@@ -683,15 +681,21 @@ H5FD_family_open(const char *name, unsigned flags, hid_t fapl_id,
file->name = H5MM_strdup(name);
file->flags = flags;
+ /* Allocate space for the string buffers */
+ if(NULL == (memb_name = (char *)H5MM_malloc(H5FD_FAM_MEMB_NAME_BUF_SIZE)))
+ HGOTO_ERROR(H5E_FILE, H5E_CANTALLOC, NULL, "unable to allocate member name")
+ if(NULL == (temp = (char *)H5MM_malloc(H5FD_FAM_MEMB_NAME_BUF_SIZE)))
+ HGOTO_ERROR(H5E_FILE, H5E_CANTALLOC, NULL, "unable to allocate temporary member name")
+
/* Check that names are unique */
- HDsnprintf(memb_name, sizeof(memb_name), name, 0);
- HDsnprintf(temp, sizeof(temp), name, 1);
+ HDsnprintf(memb_name, H5FD_FAM_MEMB_NAME_BUF_SIZE, name, 0);
+ HDsnprintf(temp, H5FD_FAM_MEMB_NAME_BUF_SIZE, name, 1);
if(!HDstrcmp(memb_name, temp))
HGOTO_ERROR(H5E_FILE, H5E_FILEEXISTS, NULL, "file names not unique")
/* Open all the family members */
while(1) {
- HDsnprintf(memb_name, sizeof(memb_name), name, file->nmembs);
+ HDsnprintf(memb_name, H5FD_FAM_MEMB_NAME_BUF_SIZE, name, file->nmembs);
/* Enlarge member array */
if(file->nmembs >= file->amembs) {
@@ -732,6 +736,12 @@ H5FD_family_open(const char *name, unsigned flags, hid_t fapl_id,
ret_value=(H5FD_t *)file;
done:
+ /* Release resources */
+ if(memb_name)
+ H5MM_xfree(memb_name);
+ if(temp)
+ H5MM_xfree(temp);
+
/* Cleanup and fail */
if(ret_value == NULL && file != NULL) {
unsigned nerrors = 0; /* Number of errors closing member files */
@@ -941,12 +951,16 @@ H5FD_family_set_eoa(H5FD_t *_file, H5FD_mem_t type, haddr_t abs_eoa)
{
H5FD_family_t *file = (H5FD_family_t*)_file;
haddr_t addr = abs_eoa;
- char memb_name[4096];
+ char *memb_name = NULL;
unsigned u; /* Local index variable */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI_NOINIT
+ /* Allocate space for the member name buffer */
+ if(NULL == (memb_name = (char *)H5MM_malloc(H5FD_FAM_MEMB_NAME_BUF_SIZE)))
+ HGOTO_ERROR(H5E_FILE, H5E_CANTALLOC, FAIL, "unable to allocate member name")
+
for(u = 0; addr || u < file->nmembs; u++) {
/* Enlarge member array */
@@ -964,7 +978,7 @@ H5FD_family_set_eoa(H5FD_t *_file, H5FD_mem_t type, haddr_t abs_eoa)
/* Create another file if necessary */
if(u >= file->nmembs || !file->memb[u]) {
file->nmembs = MAX(file->nmembs, u+1);
- HDsnprintf(memb_name, sizeof(memb_name), file->name, u);
+ HDsnprintf(memb_name, H5FD_FAM_MEMB_NAME_BUF_SIZE, file->name, u);
H5E_BEGIN_TRY {
H5_CHECK_OVERFLOW(file->memb_size, hsize_t, haddr_t);
file->memb[u] = H5FDopen(memb_name, file->flags | H5F_ACC_CREAT,
@@ -992,6 +1006,10 @@ H5FD_family_set_eoa(H5FD_t *_file, H5FD_mem_t type, haddr_t abs_eoa)
file->eoa = abs_eoa;
done:
+ /* Release resources */
+ if(memb_name)
+ H5MM_xfree(memb_name);
+
FUNC_LEAVE_NOAPI(ret_value)
}
diff --git a/src/H5FDmulti.c b/src/H5FDmulti.c
index 0e49813..d0dfab3 100644
--- a/src/H5FDmulti.c
+++ b/src/H5FDmulti.c
@@ -44,16 +44,22 @@
#endif
/* Loop through all mapped files */
-#define UNIQUE_MEMBERS(MAP,LOOPVAR) { \
- H5FD_mem_t _unmapped, LOOPVAR; \
- unsigned _seen[H5FD_MEM_NTYPES]; \
+#define UNIQUE_MEMBERS_CORE(MAP, ITER, SEEN, LOOPVAR) { \
+ H5FD_mem_t ITER, LOOPVAR; \
+ unsigned SEEN[H5FD_MEM_NTYPES]; \
\
- memset(_seen, 0, sizeof _seen); \
- for (_unmapped=H5FD_MEM_SUPER; _unmapped<H5FD_MEM_NTYPES; _unmapped=(H5FD_mem_t)(_unmapped+1)) { \
- LOOPVAR = MAP[_unmapped]; \
- if (H5FD_MEM_DEFAULT==LOOPVAR) LOOPVAR=_unmapped; \
+ memset(SEEN, 0, sizeof SEEN); \
+ for (ITER=H5FD_MEM_SUPER; ITER<H5FD_MEM_NTYPES; ITER=(H5FD_mem_t)(ITER+1)) { \
+ LOOPVAR = MAP[ITER]; \
+ if (H5FD_MEM_DEFAULT==LOOPVAR) LOOPVAR=ITER; \
assert(LOOPVAR>0 && LOOPVAR<H5FD_MEM_NTYPES); \
- if (_seen[LOOPVAR]++) continue; \
+ if (SEEN[LOOPVAR]++) continue; \
+
+/* Need two front-ends, since they are nested sometimes */
+#define UNIQUE_MEMBERS(MAP, LOOPVAR) \
+ UNIQUE_MEMBERS_CORE(MAP, _unmapped, _seen, LOOPVAR)
+#define UNIQUE_MEMBERS2(MAP, LOOPVAR) \
+ UNIQUE_MEMBERS_CORE(MAP, _unmapped2, _seen2, LOOPVAR)
#define ALL_MEMBERS(LOOPVAR) { \
H5FD_mem_t LOOPVAR; \
@@ -1904,7 +1910,7 @@ compute_next(H5FD_multi_t *file)
} END_MEMBERS;
UNIQUE_MEMBERS(file->fa.memb_map, mt1) {
- UNIQUE_MEMBERS(file->fa.memb_map, mt2) {
+ UNIQUE_MEMBERS2(file->fa.memb_map, mt2) {
if (file->fa.memb_addr[mt1]<file->fa.memb_addr[mt2] &&
(HADDR_UNDEF==file->memb_next[mt1] ||
file->memb_next[mt1]>file->fa.memb_addr[mt2])) {
diff --git a/src/H5FL.c b/src/H5FL.c
index 00cbf0c..db51809 100644
--- a/src/H5FL.c
+++ b/src/H5FL.c
@@ -293,7 +293,7 @@ H5FL_reg_init(H5FL_reg_head_t *head)
H5FL_reg_gc_head.first=new_node;
/* Indicate that the free list is initialized */
- head->init=1;
+ head->init = TRUE;
/* Make certain that the space allocated is large enough to store a free list pointer (eventually) */
if(head->size<sizeof(H5FL_reg_node_t))
@@ -655,7 +655,7 @@ printf("%s: head->name = %s, head->allocated = %d\n", FUNC, H5FL_reg_gc_head.fir
/* No allocations left open for list, get rid of it */
else {
/* Reset the "initialized" flag, in case we restart this list somehow (I don't know how..) */
- H5FL_reg_gc_head.first->list->init = 0;
+ H5FL_reg_gc_head.first->list->init = FALSE;
/* Free the node from the garbage collection list */
H5MM_xfree(H5FL_reg_gc_head.first);
@@ -822,7 +822,7 @@ H5FL_blk_init(H5FL_blk_head_t *head)
H5FL_blk_gc_head.first=new_node;
/* Indicate that the PQ is initialized */
- head->init=1;
+ head->init = TRUE;
done:
FUNC_LEAVE_NOAPI(ret_value)
@@ -1326,7 +1326,7 @@ printf("%s: head->name = %s, head->allocated = %d\n", FUNC, H5FL_blk_gc_head.fir
/* No allocations left open for list, get rid of it */
else {
/* Reset the "initialized" flag, in case we restart this list somehow (I don't know how..) */
- H5FL_blk_gc_head.first->pq->init = 0;
+ H5FL_blk_gc_head.first->pq->init = FALSE;
/* Free the node from the garbage collection list */
H5MM_free(H5FL_blk_gc_head.first);
@@ -1379,7 +1379,7 @@ H5FL_arr_init(H5FL_arr_head_t *head)
H5FL_arr_gc_head.first=new_node;
/* Allocate room for the free lists */
- if(NULL == (head->list_arr = (H5FL_arr_node_t *)H5MM_calloc((size_t)head->maxelem*sizeof(H5FL_arr_node_t))))
+ if(NULL == (head->list_arr = (H5FL_arr_node_t *)H5MM_calloc((size_t)head->maxelem * sizeof(H5FL_arr_node_t))))
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed")
/* Initialize the size of each array */
@@ -1387,7 +1387,7 @@ H5FL_arr_init(H5FL_arr_head_t *head)
head->list_arr[u].size = head->base_size + (head->elem_size * u);
/* Indicate that the free list is initialized */
- head->init = 1;
+ head->init = TRUE;
done:
FUNC_LEAVE_NOAPI(ret_value)
@@ -1795,7 +1795,7 @@ printf("%s: head->name = %s, head->allocated = %d\n", FUNC, H5FL_arr_gc_head.fir
H5MM_xfree(H5FL_arr_gc_head.first->list->list_arr);
/* Reset the "initialized" flag, in case we restart this list somehow (I don't know how..) */
- H5FL_arr_gc_head.first->list->init = 0;
+ H5FL_arr_gc_head.first->list->init = FALSE;
/* Free the node from the garbage collection list */
H5MM_free(H5FL_arr_gc_head.first);
@@ -2007,7 +2007,7 @@ H5FL_fac_init(size_t size)
#endif /* H5FL_TRACK */
/* Indicate that the free list is initialized */
- factory->init = 1;
+ factory->init = TRUE;
/* Set return value */
ret_value = factory;
@@ -2417,7 +2417,7 @@ printf("%s: head->size = %d, head->allocated = %d\n", FUNC, (int)H5FL_fac_gc_hea
HDassert(H5FL_fac_gc_head.first->list->allocated == 0);
/* Reset the "initialized" flag, in case we restart this list somehow (I don't know how..) */
- H5FL_fac_gc_head.first->list->init = 0;
+ H5FL_fac_gc_head.first->list->init = FALSE;
/* Free the node from the garbage collection list */
H5FL_fac_gc_head.first = H5FL_FREE(H5FL_fac_gc_node_t, H5FL_fac_gc_head.first);
diff --git a/src/H5FLprivate.h b/src/H5FLprivate.h
index 3cd30a6..f44d359 100644
--- a/src/H5FLprivate.h
+++ b/src/H5FLprivate.h
@@ -97,7 +97,7 @@ typedef struct H5FL_reg_node_t {
/* Data structure for free list of blocks */
typedef struct H5FL_reg_head_t {
- unsigned init; /* Whether the free list has been initialized */
+ hbool_t init; /* Whether the free list has been initialized */
unsigned allocated; /* Number of blocks allocated */
unsigned onlist; /* Number of blocks on free list */
const char *name; /* Name of the type */
@@ -166,9 +166,9 @@ typedef struct H5FL_blk_node_t {
/* Data structure for priority queue of native block free lists */
typedef struct H5FL_blk_head_t {
- unsigned init; /* Whether the free list has been initialized */
- unsigned allocated; /* Number of blocks allocated */
- unsigned onlist; /* Number of blocks on free list */
+ hbool_t init; /* Whether the free list has been initialized */
+ unsigned allocated; /* Number of blocks allocated */
+ unsigned onlist; /* Number of blocks on free list */
size_t list_mem; /* Amount of memory in block on free list */
const char *name; /* Name of the type */
H5FL_blk_node_t *head; /* Pointer to first free list in queue */
@@ -237,7 +237,7 @@ typedef struct H5FL_arr_node_t {
/* Data structure for free list of array blocks */
typedef struct H5FL_arr_head_t {
- unsigned init; /* Whether the free list has been initialized */
+ hbool_t init; /* Whether the free list has been initialized */
unsigned allocated; /* Number of blocks allocated */
size_t list_mem; /* Amount of memory in block on free list */
const char *name; /* Name of the type */
@@ -354,7 +354,7 @@ typedef struct H5FL_fac_node_t H5FL_fac_node_t;
/* Data structure for free list block factory */
typedef struct H5FL_fac_head_t {
- unsigned init; /* Whether the free list has been initialized */
+ hbool_t init; /* Whether the free list has been initialized */
unsigned allocated; /* Number of blocks allocated */
unsigned onlist; /* Number of blocks on free list */
size_t size; /* Size of the blocks in the list */
diff --git a/src/H5FS.c b/src/H5FS.c
index 19ff8e4..c3b45d2 100644
--- a/src/H5FS.c
+++ b/src/H5FS.c
@@ -606,7 +606,7 @@ H5FS__new(const H5F_t *f, uint16_t nclasses, const H5FS_section_class_t *classes
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed for free space free list")
/* Set immutable free list parameters */
- H5_CHECKED_ASSIGN(fspace->nclasses, unsigned, nclasses, size_t);
+ H5_CHECKED_ASSIGN(fspace->nclasses, uint16_t, nclasses, size_t);
if(nclasses > 0) {
if(NULL == (fspace->sect_cls = H5FL_SEQ_MALLOC(H5FS_section_class_t, nclasses)))
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed for free space section class array")
diff --git a/src/H5FSpkg.h b/src/H5FSpkg.h
index eafe3c2..7e52b5f 100644
--- a/src/H5FSpkg.h
+++ b/src/H5FSpkg.h
@@ -65,18 +65,18 @@
\
/* Free space header specific fields */ \
+ 1 /* Client ID */ \
- + H5F_SIZEOF_SIZE(f) /* Total free space tracked */ \
- + H5F_SIZEOF_SIZE(f) /* Total # of sections tracked */ \
- + H5F_SIZEOF_SIZE(f) /* # of serializable sections tracked */ \
- + H5F_SIZEOF_SIZE(f) /* # of ghost sections tracked */ \
+ + (unsigned)H5F_SIZEOF_SIZE(f) /* Total free space tracked */ \
+ + (unsigned)H5F_SIZEOF_SIZE(f) /* Total # of sections tracked */ \
+ + (unsigned)H5F_SIZEOF_SIZE(f) /* # of serializable sections tracked */ \
+ + (unsigned)H5F_SIZEOF_SIZE(f) /* # of ghost sections tracked */ \
+ 2 /* Number of section classes */ \
+ 2 /* Shrink percent */ \
+ 2 /* Expand percent */ \
+ 2 /* Size of address space for sections (log2 of value) */ \
- + H5F_SIZEOF_SIZE(f) /* Max. size of section to track */ \
- + H5F_SIZEOF_ADDR(f) /* Address of serialized free space sections */ \
- + H5F_SIZEOF_SIZE(f) /* Size of serialized free space sections used */ \
- + H5F_SIZEOF_SIZE(f) /* Allocated size of serialized free space sections */ \
+ + (unsigned)H5F_SIZEOF_SIZE(f) /* Max. size of section to track */ \
+ + (unsigned)H5F_SIZEOF_ADDR(f) /* Address of serialized free space sections */ \
+ + (unsigned)H5F_SIZEOF_SIZE(f) /* Size of serialized free space sections used */ \
+ + (unsigned)H5F_SIZEOF_SIZE(f) /* Allocated size of serialized free space sections */ \
)
/* Size of the free space serialized sections on disk */
@@ -85,7 +85,7 @@
H5FS_METADATA_PREFIX_SIZE \
\
/* Free space serialized sections specific fields */ \
- + H5F_SIZEOF_ADDR(f) /* Address of free space header for these sections */ \
+ + (unsigned)H5F_SIZEOF_ADDR(f) /* Address of free space header for these sections */ \
)
diff --git a/src/H5FSsection.c b/src/H5FSsection.c
index 5638f4f..4697bd50 100644
--- a/src/H5FSsection.c
+++ b/src/H5FSsection.c
@@ -144,7 +144,7 @@ HDfprintf(stderr, "%s: fspace->addr = %a\n", FUNC, fspace->addr);
/* Set non-zero values */
sinfo->nbins = H5VM_log2_gen(fspace->max_sect_size);
- sinfo->sect_prefix_size = (size_t)H5FS_SINFO_PREFIX_SIZE(f);
+ sinfo->sect_prefix_size = H5FS_SINFO_PREFIX_SIZE(f);
sinfo->sect_off_size = (fspace->max_sect_addr + 7) / 8;
sinfo->sect_len_size = H5VM_limit_enc_size((uint64_t)fspace->max_sect_size);
#ifdef H5FS_SINFO_DEBUG
diff --git a/src/H5FSstat.c b/src/H5FSstat.c
index d2c0177..3200849 100644
--- a/src/H5FSstat.c
+++ b/src/H5FSstat.c
@@ -96,7 +96,7 @@ H5FS_stat_info(const H5F_t *f, const H5FS_t *frsp, H5FS_stat_t *stats)
stats->serial_sect_count = frsp->serial_sect_count;
stats->ghost_sect_count = frsp->ghost_sect_count;
stats->addr = frsp->addr;
- stats->hdr_size = (size_t)H5FS_HEADER_SIZE(f);
+ stats->hdr_size = (hsize_t)H5FS_HEADER_SIZE(f);
stats->sect_addr = frsp->sect_addr;
stats->alloc_sect_size = frsp->alloc_sect_size;
stats->sect_size = frsp->sect_size;
diff --git a/src/H5Fprivate.h b/src/H5Fprivate.h
index e3b5547..40e5ff2 100644
--- a/src/H5Fprivate.h
+++ b/src/H5Fprivate.h
@@ -411,7 +411,7 @@
#endif
#if (H5_SIZEOF_HSIZE_T >= H5_SIZEOF_OFF_T)
# define H5F_OVERFLOW_HSIZET2OFFT(X) \
- ((hsize_t)(X)>=(hsize_t)((hsize_t)1<<(8*sizeof(HDoff_t)-1)))
+ ((hsize_t)(X) >= (hsize_t)((hsize_t)1 << (8 * sizeof(HDoff_t) - 1)))
#else
# define H5F_OVERFLOW_HSIZET2OFFT(X) 0
#endif
diff --git a/src/H5G.c b/src/H5G.c
index 1955c33..1a18dc0 100644
--- a/src/H5G.c
+++ b/src/H5G.c
@@ -735,3 +735,71 @@ done:
FUNC_LEAVE_API(ret_value)
} /* end H5Gclose() */
+
+/*-------------------------------------------------------------------------
+ * Function: H5Gflush
+ *
+ * Purpose: Flushes all buffers associated with a group to disk.
+ *
+ * Return: Non-negative on success, negative on failure
+ *
+ * Programmer: Mike McGreevy
+ * May 19, 2010
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5Gflush(hid_t group_id)
+{
+ H5G_t *grp; /* Dataset for this operation */
+ herr_t ret_value = SUCCEED; /* return value */
+
+ FUNC_ENTER_API(FAIL)
+ H5TRACE1("e", "i", group_id);
+
+ /* Check args */
+ if(NULL == (grp = (H5G_t *)H5I_object_verify(group_id, H5I_GROUP)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a group")
+
+ /* Flush object's metadata to file */
+ if(H5O_flush_common(&grp->oloc, group_id, H5AC_ind_read_dxpl_id) < 0)
+ HGOTO_ERROR(H5E_SYM, H5E_CANTFLUSH, FAIL, "unable to flush group and object flush callback")
+
+done:
+ FUNC_LEAVE_API(ret_value)
+} /* H5Gflush */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5Grefresh
+ *
+ * Purpose: Refreshes all buffers associated with a dataset.
+ *
+ * Return: Non-negative on success, negative on failure
+ *
+ * Programmer: Mike McGreevy
+ * July 21, 2010
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5Grefresh(hid_t group_id)
+{
+ H5G_t * grp = NULL;
+ herr_t ret_value = SUCCEED; /* return value */
+
+ FUNC_ENTER_API(FAIL)
+ H5TRACE1("e", "i", group_id);
+
+ /* Check args */
+ if(NULL == (grp = (H5G_t *)H5I_object_verify(group_id, H5I_GROUP)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a group")
+
+ /* Call private function to refresh group object */
+ if ((H5O_refresh_metadata(group_id, grp->oloc, H5AC_ind_read_dxpl_id)) < 0)
+ HGOTO_ERROR(H5E_SYM, H5E_CANTLOAD, FAIL, "unable to refresh group")
+
+done:
+ FUNC_LEAVE_API(ret_value)
+} /* H5Grefresh */
+
diff --git a/src/H5Gnode.c b/src/H5Gnode.c
index 4d299dc..89d1df8 100644
--- a/src/H5Gnode.c
+++ b/src/H5Gnode.c
@@ -715,7 +715,7 @@ H5G_node_insert(H5F_t *f, hid_t dxpl_id, haddr_t addr,
md_key->offset = ent.name_off;
} /* end if */
else {
- idx -= H5F_SYM_LEAF_K(f);
+ idx -= (int)H5F_SYM_LEAF_K(f);
insert_into = snrt;
if(idx == (int)H5F_SYM_LEAF_K(f)) {
rt_key->offset = ent.name_off;
diff --git a/src/H5Gpkg.h b/src/H5Gpkg.h
index 4cb6f9b..c994da3 100644
--- a/src/H5Gpkg.h
+++ b/src/H5Gpkg.h
@@ -55,7 +55,7 @@
+ 2 /* Number of symbols */ \
\
/* Entries */ \
- + ((2 * H5F_SYM_LEAF_K(f)) * H5G_SIZEOF_ENTRY_FILE(f)) \
+ + ((2 * H5F_SYM_LEAF_K(f)) * (unsigned)H5G_SIZEOF_ENTRY_FILE(f)) \
)
diff --git a/src/H5Gpublic.h b/src/H5Gpublic.h
index 5b8b054..9d8ade5 100644
--- a/src/H5Gpublic.h
+++ b/src/H5Gpublic.h
@@ -84,6 +84,8 @@ H5_DLL herr_t H5Gget_info_by_idx(hid_t loc_id, const char *group_name,
H5_index_t idx_type, H5_iter_order_t order, hsize_t n, H5G_info_t *ginfo,
hid_t lapl_id);
H5_DLL herr_t H5Gclose(hid_t group_id);
+H5_DLL herr_t H5Gflush(hid_t group_id);
+H5_DLL herr_t H5Grefresh(hid_t group_id);
/* Symbols defined for compatibility with previous versions of the HDF5 API.
*
diff --git a/src/H5HFcache.c b/src/H5HFcache.c
index 759fff0..31ecc62 100644
--- a/src/H5HFcache.c
+++ b/src/H5HFcache.c
@@ -618,8 +618,8 @@ H5HF__cache_hdr_image_len(const void *_thing, size_t *image_len,
*-------------------------------------------------------------------------
*/
static herr_t
-H5HF__cache_hdr_pre_serialize(const H5F_t *f, hid_t dxpl_id, void *_thing,
- haddr_t addr, size_t len, size_t H5_ATTR_UNUSED compressed_len,
+H5HF__cache_hdr_pre_serialize(const H5F_t *f, hid_t H5_ATTR_UNUSED dxpl_id,
+ void *_thing, haddr_t addr, size_t len, size_t H5_ATTR_UNUSED compressed_len,
haddr_t H5_ATTR_UNUSED *new_addr, size_t H5_ATTR_UNUSED *new_len,
size_t H5_ATTR_UNUSED *new_compressed_len, unsigned *flags)
{
diff --git a/src/H5MFaggr.c b/src/H5MFaggr.c
index f2c5936..c45b473 100644
--- a/src/H5MFaggr.c
+++ b/src/H5MFaggr.c
@@ -201,7 +201,7 @@ HDfprintf(stderr, "%s: aggr = {%a, %Hu, %Hu}\n", FUNC, aggr->addr, aggr->tot_siz
alignment = 0; /* no alignment */
/* Generate fragment if aggregator is mis-aligned */
- if(alignment && aggr->addr > 0 && aggr->size > 0 && (aggr_mis_align = (aggr->addr + H5FD_get_base_addr(f->shared->lf)) % alignment)) {
+ if(alignment && aggr->addr > 0 && (aggr_mis_align = (aggr->addr + H5FD_get_base_addr(f->shared->lf)) % alignment)) {
aggr_frag_addr = aggr->addr;
aggr_frag_size = alignment - aggr_mis_align;
} /* end if */
@@ -295,10 +295,26 @@ HDfprintf(stderr, "%s: Allocating block\n", FUNC);
if(H5MF_xfree(f, alloc_type, dxpl_id, aggr->addr, aggr->size) < 0)
HGOTO_ERROR(H5E_RESOURCE, H5E_CANTFREE, HADDR_UNDEF, "can't free aggregation block")
- /* Point the aggregator at the newly allocated block */
- aggr->addr = new_space;
- aggr->size = aggr->alloc_size;
- aggr->tot_size = aggr->alloc_size;
+ /* If the block is not to be aligned, fold the eoa fragment
+ * into the newly allocated aggregator, as it could have
+ * been allocated in an aligned manner if the aggregator
+ * block is larger than the threshold */
+ if(eoa_frag_size && !alignment) {
+ HDassert(eoa_frag_addr + eoa_frag_size == new_space);
+ aggr->addr = eoa_frag_addr;
+ aggr->size = aggr->alloc_size + eoa_frag_size;
+ aggr->tot_size = aggr->size;
+
+ /* Reset EOA fragment */
+ eoa_frag_addr = HADDR_UNDEF;
+ eoa_frag_size = 0;
+ } /* end if */
+ else {
+ /* Point the aggregator at the newly allocated block */
+ aggr->addr = new_space;
+ aggr->size = aggr->alloc_size;
+ aggr->tot_size = aggr->alloc_size;
+ }
} /* end else */
/* Allocate space out of the metadata block */
diff --git a/src/H5Oalloc.c b/src/H5Oalloc.c
index 99f1322..69b4b11 100644
--- a/src/H5Oalloc.c
+++ b/src/H5Oalloc.c
@@ -763,7 +763,7 @@ H5O_alloc_new_chunk(H5F_t *f, hid_t dxpl_id, H5O_t *oh, size_t size, size_t *new
size_t idx; /* Message number */
uint8_t *p = NULL; /*ptr into new chunk */
H5O_cont_t *cont = NULL; /*native continuation message */
- size_t chunkno; /* Chunk allocated */
+ unsigned chunkno; /* Chunk allocated */
haddr_t new_chunk_addr;
unsigned u; /* Local index variable */
herr_t ret_value = SUCCEED; /* Return value */
@@ -921,7 +921,8 @@ H5O_alloc_new_chunk(H5F_t *f, hid_t dxpl_id, H5O_t *oh, size_t size, size_t *new
oh->chunk = x;
} /* end if */
- chunkno = (unsigned)oh->nchunks++;
+ H5_CHECKED_ASSIGN(chunkno, unsigned, oh->nchunks, size_t);
+ oh->nchunks++;
oh->chunk[chunkno].addr = new_chunk_addr;
oh->chunk[chunkno].size = size;
oh->chunk[chunkno].gap = 0;
diff --git a/src/H5Oattr.c b/src/H5Oattr.c
index 9cbcdc4..064c4cb 100644
--- a/src/H5Oattr.c
+++ b/src/H5Oattr.c
@@ -128,6 +128,9 @@ H5O_attr_decode(H5F_t *f, hid_t dxpl_id, H5O_t *open_oh, unsigned H5_ATTR_UNUSED
H5A_t *attr = NULL;
H5S_extent_t *extent; /*extent dimensionality information */
size_t name_len; /*attribute name length */
+ size_t dt_size; /* Datatype size */
+ hssize_t sds_size; /* Signed Dataspace size */
+ hsize_t ds_size; /* Dataspace size */
unsigned flags = 0; /* Attribute flags */
H5A_t *ret_value = NULL; /* Return value */
@@ -199,7 +202,7 @@ H5O_attr_decode(H5F_t *f, hid_t dxpl_id, H5O_t *open_oh, unsigned H5_ATTR_UNUSED
/* Decode attribute's dataspace extent */
if((extent = (H5S_extent_t *)(H5O_MSG_SDSPACE->decode)(f, dxpl_id, open_oh,
- ((flags & H5O_ATTR_FLAG_SPACE_SHARED) ? H5O_MSG_FLAG_SHARED : 0), ioflags, p)) == NULL)
+ ((flags & H5O_ATTR_FLAG_SPACE_SHARED) ? H5O_MSG_FLAG_SHARED : 0), ioflags, p)) == NULL)
HGOTO_ERROR(H5E_ATTR, H5E_CANTDECODE, NULL, "can't decode attribute dataspace")
/* Copy the extent information to the dataspace */
@@ -217,8 +220,19 @@ H5O_attr_decode(H5F_t *f, hid_t dxpl_id, H5O_t *open_oh, unsigned H5_ATTR_UNUSED
else
p += attr->shared->ds_size;
+ /* Get the datatype's size */
+ if(0 == (dt_size = H5T_get_size(attr->shared->dt)))
+ HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, NULL, "unable to get datatype size")
+
+ /* Get the datatype & dataspace sizes */
+ if(0 == (dt_size = H5T_get_size(attr->shared->dt)))
+ HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, NULL, "unable to get datatype size")
+ if((sds_size = H5S_GET_EXTENT_NPOINTS(attr->shared->ds)) < 0)
+ HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, NULL, "unable to get dataspace size")
+ ds_size = (hsize_t)sds_size;
+
/* Compute the size of the data */
- H5_CHECKED_ASSIGN(attr->shared->data_size, size_t, H5S_GET_EXTENT_NPOINTS(attr->shared->ds) * H5T_get_size(attr->shared->dt), hsize_t);
+ H5_CHECKED_ASSIGN(attr->shared->data_size, size_t, ds_size * (hsize_t)dt_size, hsize_t);
/* Go get the data */
if(attr->shared->data_size) {
diff --git a/src/H5Ocache.c b/src/H5Ocache.c
index e085242..3803978 100644
--- a/src/H5Ocache.c
+++ b/src/H5Ocache.c
@@ -770,7 +770,7 @@ H5O__cache_chk_deserialize(const void *image, size_t len, void *_udata,
/* Set the fields for the chunk proxy */
chk_proxy->oh = udata->oh;
- chk_proxy->chunkno = udata->oh->nchunks - 1;
+ H5_CHECKED_ASSIGN(chk_proxy->chunkno, unsigned, udata->oh->nchunks - 1, size_t);
} /* end if */
else {
/* Sanity check */
@@ -1162,6 +1162,10 @@ H5O__chunk_deserialize(H5O_t *oh, haddr_t addr, size_t len, const uint8_t *image
HGOTO_ERROR(H5E_OHDR, H5E_CANTLOAD, FAIL, "bad flag combination for message")
if((flags & H5O_MSG_FLAG_WAS_UNKNOWN) && !(flags & H5O_MSG_FLAG_MARK_IF_UNKNOWN))
HGOTO_ERROR(H5E_OHDR, H5E_CANTLOAD, FAIL, "bad flag combination for message")
+ if((flags & H5O_MSG_FLAG_SHAREABLE)
+ && H5O_msg_class_g[id]
+ && !(H5O_msg_class_g[id]->share_flags & H5O_SHARE_IS_SHARABLE))
+ HGOTO_ERROR(H5E_OHDR, H5E_CANTLOAD, FAIL, "message of unsharable class flagged as sharable")
/* Reserved bytes/creation index */
if(oh->version == H5O_VERSION_1)
@@ -1320,7 +1324,7 @@ H5O__chunk_deserialize(H5O_t *oh, haddr_t addr, size_t len, const uint8_t *image
/* Decode continuation message */
cont = (H5O_cont_t *)(H5O_MSG_CONT->decode)(udata->f, udata->dxpl_id, NULL, 0, &ioflags, oh->mesg[curmesg].raw);
- cont->chunkno = udata->cont_msg_info->nmsgs + 1; /*the next continuation message/chunk */
+ H5_CHECKED_ASSIGN(cont->chunkno, unsigned, udata->cont_msg_info->nmsgs + 1, size_t); /* the next continuation message/chunk */
/* Save 'native' form of continuation message */
oh->mesg[curmesg].native = cont;
diff --git a/src/H5Oflush.c b/src/H5Oflush.c
index 6484dfd..4fc9c8e 100644
--- a/src/H5Oflush.c
+++ b/src/H5Oflush.c
@@ -177,6 +177,39 @@ done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5O_oh_tag() */
+
+/*-------------------------------------------------------------------------
+ * Function: H5Orefresh
+ *
+ * Purpose: Refreshes all buffers associated with an object.
+ *
+ * Return: Non-negative on success, negative on failure
+ *
+ * Programmer: Mike McGreevy
+ * July 28, 2010
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5Orefresh(hid_t oid)
+{
+ H5O_loc_t *oloc; /* object location */
+ herr_t ret_value = SUCCEED; /* return value */
+
+ FUNC_ENTER_API(FAIL)
+ H5TRACE1("e", "i", oid);
+
+ /* Check args */
+ if(NULL == (oloc = H5O_get_loc(oid)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not an object")
+
+ /* Private function */
+ if(H5O_refresh_metadata(oid, *oloc, H5AC_ind_read_dxpl_id) < 0)
+ HGOTO_ERROR(H5E_OHDR, H5E_CANTLOAD, FAIL, "unable to refresh object")
+
+done:
+ FUNC_LEAVE_API(ret_value)
+} /* end H5Orefresh() */
/*-------------------------------------------------------------------------
diff --git a/src/H5Opkg.h b/src/H5Opkg.h
index 14bb342..e40d28a 100644
--- a/src/H5Opkg.h
+++ b/src/H5Opkg.h
@@ -201,6 +201,7 @@
\
/* Set the message's "shared info", if it's shareable */ \
if((MSG)->flags & H5O_MSG_FLAG_SHAREABLE) { \
+ HDassert(msg_type->share_flags & H5O_SHARE_IS_SHARABLE); \
H5O_UPDATE_SHARED((H5O_shared_t *)(MSG)->native, H5O_SHARE_TYPE_HERE, (F), msg_type->id, (MSG)->crt_idx, (OH)->chunk[0].addr) \
} /* end if */ \
\
diff --git a/src/H5Oprivate.h b/src/H5Oprivate.h
index 44b4998..0acac8c 100644
--- a/src/H5Oprivate.h
+++ b/src/H5Oprivate.h
@@ -349,7 +349,7 @@ typedef struct H5O_link_t {
typedef struct H5O_efl_entry_t {
size_t name_offset; /*offset of name within heap */
char *name; /*malloc'd name */
- off_t offset; /*offset of data within file */
+ HDoff_t offset; /*offset of data within file */
hsize_t size; /*size allocated within file */
} H5O_efl_entry_t;
diff --git a/src/H5Opublic.h b/src/H5Opublic.h
index 1d2ab7b..dec7b5b 100644
--- a/src/H5Opublic.h
+++ b/src/H5Opublic.h
@@ -183,6 +183,7 @@ H5_DLL herr_t H5Ovisit_by_name(hid_t loc_id, const char *obj_name,
void *op_data, hid_t lapl_id);
H5_DLL herr_t H5Oclose(hid_t object_id);
H5_DLL herr_t H5Oflush(hid_t obj_id);
+H5_DLL herr_t H5Orefresh(hid_t oid);
H5_DLL herr_t H5Odisable_mdc_flushes(hid_t object_id);
H5_DLL herr_t H5Oenable_mdc_flushes(hid_t object_id);
H5_DLL herr_t H5Oare_mdc_flushes_disabled(hid_t object_id, hbool_t *are_disabled);
diff --git a/src/H5PL.c b/src/H5PL.c
index f482fef..d715079 100644
--- a/src/H5PL.c
+++ b/src/H5PL.c
@@ -36,7 +36,7 @@
#define H5PL_MAX_PATH_NUM 16
/****************************/
-/* Macros for supporting
+/* Macros for supporting
* both Windows and Unix */
/****************************/
/* Windows support
@@ -70,6 +70,9 @@
/* Clear error - nothing to do */
#define H5PL_CLR_ERROR
+/* maximum size for expanding env vars */
+#define H5PL_EXPAND_BUFFER_SIZE 32767
+
typedef const void *(__cdecl *H5PL_get_plugin_info_t)(void);
/* Unix support */
@@ -207,7 +210,7 @@ int
H5PL_term_package(void)
{
int n = 0;
-
+
FUNC_ENTER_NOAPI_NOINIT_NOERR
if(H5_PKG_INIT_VAR) {
@@ -363,12 +366,12 @@ H5PL_load(H5PL_type_t type, int id)
/* If not found, iterate through the path table to find the right dynamic library */
if(!found) {
- size_t i; /* Local index variable */
+ size_t i; /* Local index variable */
for(i = 0; i < H5PL_num_paths_g; i++) {
if((found = H5PL__find(type, id, H5PL_path_table_g[i], &plugin_info)) < 0)
HGOTO_ERROR(H5E_PLUGIN, H5E_CANTGET, NULL, "search in paths failed")
-
+
/* Break out if found */
if(found) {
HDassert(plugin_info);
@@ -419,6 +422,26 @@ H5PL__init_path_table(void)
if(NULL == dl_path)
HGOTO_ERROR(H5E_PLUGIN, H5E_CANTALLOC, FAIL, "can't allocate memory for path")
+#ifdef H5_HAVE_WIN32_API
+ else { /* Expand windows env var*/
+ long bufCharCount;
+ char *tempbuf;
+ if(NULL == (tempbuf = (char *)H5MM_malloc(H5PL_EXPAND_BUFFER_SIZE)))
+ HGOTO_ERROR(H5E_PLUGIN, H5E_CANTALLOC, FAIL, "can't allocate memory for expanded path")
+ if((bufCharCount = ExpandEnvironmentStrings(dl_path, tempbuf, H5PL_EXPAND_BUFFER_SIZE)) > H5PL_EXPAND_BUFFER_SIZE) {
+ tempbuf = (char *)H5MM_xfree(tempbuf);
+ HGOTO_ERROR(H5E_PLUGIN, H5E_NOSPACE, FAIL, "expanded path is too long")
+ }
+ if(bufCharCount == 0) {
+ tempbuf = (char *)H5MM_xfree(tempbuf);
+ HGOTO_ERROR(H5E_PLUGIN, H5E_CANTGET, FAIL, "failed to expand path")
+ }
+ dl_path = (char *)H5MM_xfree(dl_path);
+ dl_path = H5MM_strdup(tempbuf);
+ tempbuf = (char *)H5MM_xfree(tempbuf);
+ }
+#endif /* H5_HAVE_WIN32_API */
+
/* Put paths in the path table. They are separated by ":" */
dir = HDstrtok(dl_path, H5PL_PATH_SEPARATOR);
while(dir) {
@@ -445,11 +468,11 @@ done:
* Function: H5PL__find
*
* Purpose: Given a path, this function opens the directory and envokes
- * another function to go through all files to find the right
- * plugin library. Two function definitions are for Unix and
+ * another function to go through all files to find the right
+ * plugin library. Two function definitions are for Unix and
* Windows.
*
- * Return: TRUE on success,
+ * Return: TRUE on success,
* FALSE on not found,
* negative on failure
*
@@ -469,17 +492,17 @@ H5PL__find(H5PL_type_t plugin_type, int type_id, char *dir, const void **info)
FUNC_ENTER_STATIC
- /* Open the directory */
+ /* Open the directory */
if(!(dirp = HDopendir(dir)))
- HGOTO_ERROR(H5E_PLUGIN, H5E_OPENERROR, FAIL, "can't open directory")
+ HGOTO_ERROR(H5E_PLUGIN, H5E_OPENERROR, FAIL, "can't open directory: %s", dir)
/* Iterates through all entries in the directory to find the right plugin library */
while(NULL != (dp = HDreaddir(dirp))) {
- /* The library we are looking for should be called libxxx.so... on Unix
+ /* The library we are looking for should be called libxxx.so... on Unix
* or libxxx.xxx.dylib on Mac.
- */
+ */
#ifndef __CYGWIN__
- if(!HDstrncmp(dp->d_name, "lib", (size_t)3) &&
+ if(!HDstrncmp(dp->d_name, "lib", (size_t)3) &&
(HDstrstr(dp->d_name, ".so") || HDstrstr(dp->d_name, ".dylib"))) {
#else
if(!HDstrncmp(dp->d_name, "cyg", (size_t)3) &&
@@ -500,29 +523,24 @@ H5PL__find(H5PL_type_t plugin_type, int type_id, char *dir, const void **info)
if(HDstat(pathname, &my_stat) == -1)
HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "can't stat file: %s", HDstrerror(errno))
- /* If it is a directory, skip it */
+ /* If it is a directory, skip it */
if(S_ISDIR(my_stat.st_mode))
continue;
/* Attempt to open the dynamic library as a filter library */
if((found_in_dir = H5PL__open(plugin_type, pathname, type_id, info)) < 0)
HGOTO_ERROR(H5E_PLUGIN, H5E_CANTGET, FAIL, "search in directory failed")
- if(found_in_dir) {
- /* Indicate success */
- HGOTO_DONE(TRUE)
- } /* end if */
- else
- HDassert(pathname);
- pathname = (char *)H5MM_xfree(pathname);
+ if(found_in_dir)
+ HGOTO_DONE(TRUE) /* Indicate success */
+ pathname = (char *)H5MM_xfree(pathname);
} /* end if */
} /* end while */
done:
- if(dirp)
+ if(dirp)
if(HDclosedir(dirp) < 0)
HDONE_ERROR(H5E_FILE, H5E_CLOSEERROR, FAIL, "can't close directory: %s", HDstrerror(errno))
- if(pathname)
- pathname = (char *)H5MM_xfree(pathname);
+ pathname = (char *)H5MM_xfree(pathname);
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5PL__find() */
@@ -563,20 +581,16 @@ H5PL__find(H5PL_type_t plugin_type, int type_id, char *dir, const void **info)
if((found_in_dir = H5PL__open(plugin_type, pathname, type_id, info)) < 0)
HGOTO_ERROR(H5E_PLUGIN, H5E_CANTGET, FAIL, "search in directory failed")
- if(found_in_dir) {
- /* Indicate success */
- HGOTO_DONE(TRUE)
- } /* end if */
- else
- HDassert(pathname);
- pathname = (char *)H5MM_xfree(pathname);
+ if(found_in_dir)
+ HGOTO_DONE(TRUE) /* Indicate success */
+ pathname = (char *)H5MM_xfree(pathname);
} /* end if */
} while(FindNextFileA(hFind, &fdFile)); /* Find the next file. */
done:
- if(hFind)
+ if(hFind)
FindClose(hFind);
- if(pathname)
+ if(pathname)
pathname = (char *)H5MM_xfree(pathname);
FUNC_LEAVE_NOAPI(ret_value)
@@ -588,10 +602,10 @@ done:
* Function: H5PL__open
*
* Purpose: Iterates through all files to find the right plugin library.
- * It loads the dynamic plugin library and keeps it on the list
+ * It loads the dynamic plugin library and keeps it on the list
* of loaded libraries.
*
- * Return: TRUE on success,
+ * Return: TRUE on success,
* FALSE on not found,
* negative on failure
*
@@ -657,7 +671,7 @@ H5PL__open(H5PL_type_t pl_type, char *libname, int pl_id, const void **pl_info)
/* Set the plugin info to return */
*pl_info = (const void *)plugin_info;
-
+
/* Indicate success */
ret_value = TRUE;
} /* end if */
@@ -678,7 +692,7 @@ done:
* Purpose: Search in the list of already opened dynamic libraries
* to see if the one we are looking for is already opened.
*
- * Return: TRUE on success,
+ * Return: TRUE on success,
* FALSE on not found,
* Negative on failure
*
@@ -723,7 +737,7 @@ done:
/*-------------------------------------------------------------------------
* Function: H5PL__close
*
- * Purpose: Closes the handle for dynamic library
+ * Purpose: Closes the handle for dynamic library
*
* Return: Non-negative on success/Negative on failure
*
@@ -738,7 +752,7 @@ H5PL__close(H5PL_HANDLE handle)
FUNC_ENTER_STATIC_NOERR
H5PL_CLOSE_LIB(handle);
-
+
FUNC_LEAVE_NOAPI(SUCCEED)
} /* end H5PL__close() */
diff --git a/src/H5Pfapl.c b/src/H5Pfapl.c
index 62d674c..d96bd54 100644
--- a/src/H5Pfapl.c
+++ b/src/H5Pfapl.c
@@ -790,7 +790,7 @@ done:
const void *
H5P_peek_driver_info(H5P_genplist_t *plist)
{
- void *ret_value = NULL; /* Return value */
+ const void *ret_value = NULL; /* Return value */
FUNC_ENTER_NOAPI(NULL)
diff --git a/src/H5Shyper.c b/src/H5Shyper.c
index fe013a7..5231c6e 100644
--- a/src/H5Shyper.c
+++ b/src/H5Shyper.c
@@ -145,6 +145,9 @@ 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 extern free list to manage the H5S_sel_iter_t struct */
+H5FL_EXTERN(H5S_sel_iter_t);
+
/* #define H5S_HYPER_DEBUG */
#ifdef H5S_HYPER_DEBUG
static herr_t
@@ -9288,7 +9291,7 @@ H5S__hyper_project_intersection(const H5S_t *src_space, const H5S_t *dst_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; /* Selection iterator for src_space */
+ 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 */
@@ -9296,7 +9299,7 @@ H5S__hyper_project_intersection(const H5S_t *src_space, const H5S_t *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; /* Selection iterator 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 */
@@ -9305,7 +9308,7 @@ H5S__hyper_project_intersection(const H5S_t *src_space, const H5S_t *dst_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; /* Selection iterator for src_intersect_space */
+ 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 */
@@ -9384,35 +9387,47 @@ H5S__hyper_project_intersection(const H5S_t *src_space, const H5S_t *dst_space,
/* Set unlim_dim */
proj_space->select.sel_info.hslab->unlim_dim = -1;
+ /* Allocate the source space iterator */
+ if(NULL == (ss_iter = H5FL_MALLOC(H5S_sel_iter_t)))
+ HGOTO_ERROR(H5E_DATASPACE, H5E_CANTALLOC, FAIL, "can't allocate source space iterator")
+
/* Initialize source space iterator */
- if(H5S_select_iter_init(&ss_iter, src_space, (size_t)1) < 0)
+ 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)
+ 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 space iterator */
+ if(NULL == (ds_iter = H5FL_MALLOC(H5S_sel_iter_t)))
+ HGOTO_ERROR(H5E_DATASPACE, H5E_CANTALLOC, FAIL, "can't allocate destination space iterator")
+
/* Initialize destination space iterator */
- if(H5S_select_iter_init(&ds_iter, dst_space, (size_t)1) < 0)
+ 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)
+ 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)
+ 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)
+ 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);
@@ -9427,7 +9442,7 @@ H5S__hyper_project_intersection(const H5S_t *src_space, const H5S_t *dst_space,
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)
+ 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);
@@ -9459,7 +9474,7 @@ H5S__hyper_project_intersection(const H5S_t *src_space, const H5S_t *dst_space,
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)
+ 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);
@@ -9511,7 +9526,7 @@ H5S__hyper_project_intersection(const H5S_t *src_space, const H5S_t *dst_space,
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)
+ 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);
@@ -9625,19 +9640,22 @@ loop_end:
done:
/* Release source selection iterator */
- if(ss_iter_init)
- if(H5S_SELECT_ITER_RELEASE(&ss_iter) < 0)
- HDONE_ERROR(H5E_DATASPACE, H5E_CANTRELEASE, FAIL, "unable to release 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)
- if(H5S_SELECT_ITER_RELEASE(&ds_iter) < 0)
- HDONE_ERROR(H5E_DATASPACE, H5E_CANTRELEASE, FAIL, "unable to release 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)
- if(H5S_SELECT_ITER_RELEASE(&sis_iter) < 0)
- HDONE_ERROR(H5E_DATASPACE, H5E_CANTRELEASE, FAIL, "unable to release 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);
/* Cleanup on error */
if(ret_value < 0) {
diff --git a/src/H5Spoint.c b/src/H5Spoint.c
index 0f85110..1531bac 100644
--- a/src/H5Spoint.c
+++ b/src/H5Spoint.c
@@ -1125,10 +1125,10 @@ H5S_point_bounds(const H5S_t *space, hsize_t *start, hsize_t *end)
if(((hssize_t)node->pnt[u] + space->select.offset[u]) < 0)
HGOTO_ERROR(H5E_DATASPACE, H5E_BADRANGE, FAIL, "offset moves selection out of bounds")
- if(start[u] > (node->pnt[u] + space->select.offset[u]))
- start[u] = node->pnt[u] + space->select.offset[u];
- if(end[u] < (node->pnt[u] + space->select.offset[u]))
- end[u] = node->pnt[u] + space->select.offset[u];
+ 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 */
@@ -1703,7 +1703,7 @@ H5S_point_get_seq_list(const H5S_t *space, unsigned flags, H5S_sel_iter_t *iter,
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 += (node->pnt[i] + space->select.offset[i]) * acc;
+ loc += (hsize_t)((hssize_t)node->pnt[i] + space->select.offset[i]) * acc;
acc *= dims[i];
} /* end for */
diff --git a/src/H5Sselect.c b/src/H5Sselect.c
index d4a4d69..2968bed 100644
--- a/src/H5Sselect.c
+++ b/src/H5Sselect.c
@@ -39,6 +39,15 @@ 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 */
+/* Declare a free list to manage the H5S_sel_iter_t struct */
+H5FL_DEFINE(H5S_sel_iter_t);
+
+/* Declare extern free list to manage sequences of size_t */
+H5FL_SEQ_EXTERN(size_t);
+
+/* Declare extern free list to manage sequences of hsize_t */
+H5FL_SEQ_EXTERN(hsize_t);
+
/*--------------------------------------------------------------------------
@@ -1364,8 +1373,10 @@ herr_t
H5S_select_iterate(void *buf, const H5T_t *type, const H5S_t *space,
const H5S_sel_iter_op_t *op, void *op_data)
{
- H5S_sel_iter_t iter; /* Selection iteration info */
+ H5S_sel_iter_t *iter = NULL; /* Selection iteration info */
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 */
hsize_t space_size[H5O_LAYOUT_NDIMS]; /* Dataspace size */
size_t max_elem; /* Maximum number of elements allowed in sequences */
@@ -1386,8 +1397,12 @@ H5S_select_iterate(void *buf, const H5T_t *type, const H5S_t *space,
if(0 == (elmt_size = H5T_get_size(type)))
HGOTO_ERROR(H5E_DATATYPE, H5E_BADSIZE, FAIL, "datatype size invalid")
+ /* Allocate the selection iterator */
+ if(NULL == (iter = H5FL_MALLOC(H5S_sel_iter_t)))
+ 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)
HGOTO_ERROR(H5E_DATASPACE, H5E_CANTINIT, FAIL, "unable to initialize selection iterator")
iter_init = TRUE; /* Selection iteration info has been initialized */
@@ -1408,16 +1423,20 @@ H5S_select_iterate(void *buf, const H5T_t *type, const H5S_t *space,
/* Compute the maximum number of bytes required */
H5_CHECKED_ASSIGN(max_elem, size_t, nelmts, hssize_t);
+ /* Allocate the offset & length arrays */
+ if(NULL == (len = H5FL_SEQ_MALLOC(size_t, H5D_IO_VECTOR_SIZE)))
+ HGOTO_ERROR(H5E_DATASPACE, H5E_CANTALLOC, FAIL, "can't allocate length vector array")
+ if(NULL == (off = H5FL_SEQ_MALLOC(hsize_t, H5D_IO_VECTOR_SIZE)))
+ HGOTO_ERROR(H5E_DATASPACE, H5E_CANTALLOC, FAIL, "can't allocate offset vector array")
+
/* Loop, while elements left in selection */
while(max_elem > 0 && user_ret == 0) {
- hsize_t off[H5D_IO_VECTOR_SIZE]; /* Array to store sequence offsets */
- size_t len[H5D_IO_VECTOR_SIZE]; /* Array to store sequence lengths */
size_t nelem; /* Number of elements used in sequences */
size_t nseq; /* Number of sequences generated */
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_GET_SEQ_LIST(space, 0, 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 */
@@ -1477,9 +1496,17 @@ H5S_select_iterate(void *buf, const H5T_t *type, const H5S_t *space,
ret_value = user_ret;
done:
+ /* Release resources, if allocated */
+ if(len)
+ len = H5FL_SEQ_FREE(size_t, len);
+ if(off)
+ off = H5FL_SEQ_FREE(hsize_t, off);
+
/* Release selection iterator */
- if(iter_init && H5S_SELECT_ITER_RELEASE(&iter) < 0)
+ if(iter_init && H5S_SELECT_ITER_RELEASE(iter) < 0)
HDONE_ERROR(H5E_DATASPACE, H5E_CANTRELEASE, FAIL, "unable to release selection iterator")
+ if(iter)
+ iter = H5FL_FREE(H5S_sel_iter_t, iter);
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5S_select_iterate() */
@@ -1583,8 +1610,8 @@ H5S_get_select_type(const H5S_t *space)
htri_t
H5S_select_shape_same(const H5S_t *space1, const H5S_t *space2)
{
- H5S_sel_iter_t iter_a; /* Selection a iteration info */
- H5S_sel_iter_t iter_b; /* Selection b iteration info */
+ 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 = 0; /* Selection a iteration info has been initialized */
hbool_t iter_b_init = 0; /* Selection b iteration info has been initialized */
htri_t ret_value = TRUE; /* Return value */
@@ -1729,15 +1756,21 @@ H5S_select_shape_same(const H5S_t *space1, const H5S_t *space2)
hsize_t off_b[H5O_LAYOUT_NDIMS]; /* Offset of selection b blocks */
hbool_t first_block = TRUE; /* Flag to indicate the first block */
+ /* Allocate the selection iterators */
+ if(NULL == (iter_a = H5FL_MALLOC(H5S_sel_iter_t)))
+ HGOTO_ERROR(H5E_DATASPACE, H5E_CANTALLOC, FAIL, "can't allocate selection iterator")
+ if(NULL == (iter_b = H5FL_MALLOC(H5S_sel_iter_t)))
+ HGOTO_ERROR(H5E_DATASPACE, H5E_CANTALLOC, FAIL, "can't allocate selection iterator")
+
/* Initialize iterator for each dataspace selection
* Use '0' for element size instead of actual element size to indicate
* 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)
HGOTO_ERROR(H5E_DATASPACE, H5E_CANTINIT, FAIL, "unable to initialize selection iterator a")
iter_a_init = 1;
- 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)
HGOTO_ERROR(H5E_DATASPACE, H5E_CANTINIT, FAIL, "unable to initialize selection iterator b")
iter_b_init = 1;
@@ -1748,9 +1781,9 @@ H5S_select_shape_same(const H5S_t *space1, const H5S_t *space2)
htri_t status_a, status_b; /* Status from next block checks */
/* Get the current block for each selection iterator */
- if(H5S_SELECT_ITER_BLOCK(&iter_a, start_a, end_a) < 0)
+ if(H5S_SELECT_ITER_BLOCK(iter_a, start_a, end_a) < 0)
HGOTO_ERROR(H5E_DATASPACE, H5E_CANTGET, FAIL, "unable to get iterator block a")
- if(H5S_SELECT_ITER_BLOCK(&iter_b, start_b, end_b) < 0)
+ if(H5S_SELECT_ITER_BLOCK(iter_b, start_b, end_b) < 0)
HGOTO_ERROR(H5E_DATASPACE, H5E_CANTGET, FAIL, "unable to get iterator block b")
space_a_dim = (int)space_a_rank - 1;
@@ -1821,10 +1854,10 @@ H5S_select_shape_same(const H5S_t *space1, const H5S_t *space2)
} /* end else */
/* Check if we are able to advance to the next selection block */
- if((status_a = H5S_SELECT_ITER_HAS_NEXT_BLOCK(&iter_a)) < 0)
+ if((status_a = H5S_SELECT_ITER_HAS_NEXT_BLOCK(iter_a)) < 0)
HGOTO_ERROR(H5E_DATASPACE, H5E_CANTNEXT, FAIL, "unable to check iterator block a")
- if((status_b = H5S_SELECT_ITER_HAS_NEXT_BLOCK(&iter_b)) < 0)
+ if((status_b = H5S_SELECT_ITER_HAS_NEXT_BLOCK(iter_b)) < 0)
HGOTO_ERROR(H5E_DATASPACE, H5E_CANTNEXT, FAIL, "unable to check iterator block b")
/* Did we run out of blocks at the same time? */
@@ -1834,10 +1867,10 @@ H5S_select_shape_same(const H5S_t *space1, const H5S_t *space2)
HGOTO_DONE(FALSE)
else {
/* Advance to next block in selection iterators */
- if(H5S_SELECT_ITER_NEXT_BLOCK(&iter_a) < 0)
+ if(H5S_SELECT_ITER_NEXT_BLOCK(iter_a) < 0)
HGOTO_ERROR(H5E_DATASPACE, H5E_CANTNEXT, FAIL, "unable to advance to next iterator block a")
- if(H5S_SELECT_ITER_NEXT_BLOCK(&iter_b) < 0)
+ if(H5S_SELECT_ITER_NEXT_BLOCK(iter_b) < 0)
HGOTO_ERROR(H5E_DATASPACE, H5E_CANTNEXT, FAIL, "unable to advance to next iterator block b")
} /* end else */
} /* end while */
@@ -1845,12 +1878,14 @@ H5S_select_shape_same(const H5S_t *space1, const H5S_t *space2)
} /* end else */
done:
- if(iter_a_init)
- if(H5S_SELECT_ITER_RELEASE(&iter_a) < 0)
- HDONE_ERROR(H5E_DATASPACE, H5E_CANTRELEASE, FAIL, "unable to release selection iterator a")
- if(iter_b_init)
- if(H5S_SELECT_ITER_RELEASE(&iter_b) < 0)
- HDONE_ERROR(H5E_DATASPACE, H5E_CANTRELEASE, FAIL, "unable to release selection iterator b")
+ if(iter_a_init && H5S_SELECT_ITER_RELEASE(iter_a) < 0)
+ HDONE_ERROR(H5E_DATASPACE, H5E_CANTRELEASE, FAIL, "unable to release selection iterator a")
+ if(iter_a)
+ iter_a = H5FL_FREE(H5S_sel_iter_t, iter_a);
+ if(iter_b_init && H5S_SELECT_ITER_RELEASE(iter_b) < 0)
+ HDONE_ERROR(H5E_DATASPACE, H5E_CANTRELEASE, FAIL, "unable to release selection iterator b")
+ if(iter_b)
+ iter_b = H5FL_FREE(H5S_sel_iter_t, iter_b);
FUNC_LEAVE_NOAPI(ret_value)
} /* H5S_select_shape_same() */
@@ -2152,8 +2187,10 @@ done:
herr_t
H5S_select_fill(const void *fill, size_t fill_size, const H5S_t *space, void *_buf)
{
- H5S_sel_iter_t iter; /* Selection iteration info */
+ H5S_sel_iter_t *iter = NULL; /* Selection iteration info */
hbool_t iter_init = 0; /* 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 */
size_t max_elem; /* Total number of elements in selection */
herr_t ret_value = SUCCEED; /* Return value */
@@ -2166,8 +2203,12 @@ H5S_select_fill(const void *fill, size_t fill_size, const H5S_t *space, void *_b
HDassert(space);
HDassert(_buf);
+ /* Allocate the selection iterator */
+ if(NULL == (iter = H5FL_MALLOC(H5S_sel_iter_t)))
+ 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)
HGOTO_ERROR(H5E_DATASPACE, H5E_CANTINIT, FAIL, "unable to initialize selection iterator")
iter_init = 1; /* Selection iteration info has been initialized */
@@ -2178,16 +2219,20 @@ H5S_select_fill(const void *fill, size_t fill_size, const H5S_t *space, void *_b
/* Compute the number of bytes to process */
H5_CHECKED_ASSIGN(max_elem, size_t, nelmts, hssize_t);
+ /* Allocate the offset & length arrays */
+ if(NULL == (len = H5FL_SEQ_MALLOC(size_t, H5D_IO_VECTOR_SIZE)))
+ HGOTO_ERROR(H5E_DATASPACE, H5E_CANTALLOC, FAIL, "can't allocate length vector array")
+ if(NULL == (off = H5FL_SEQ_MALLOC(hsize_t, H5D_IO_VECTOR_SIZE)))
+ HGOTO_ERROR(H5E_DATASPACE, H5E_CANTALLOC, FAIL, "can't allocate offset vector array")
+
/* Loop, while elements left in selection */
while(max_elem > 0) {
- hsize_t off[H5D_IO_VECTOR_SIZE]; /* Array to store sequence offsets */
- size_t len[H5D_IO_VECTOR_SIZE]; /* Array to store sequence lengths */
size_t nseq; /* Number of sequences generated */
size_t curr_seq; /* Current sequnce being worked on */
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_GET_SEQ_LIST(space, 0, 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 */
@@ -2207,9 +2252,17 @@ H5S_select_fill(const void *fill, size_t fill_size, const H5S_t *space, void *_b
} /* end while */
done:
- /* Release resouces */
- if(iter_init && H5S_SELECT_ITER_RELEASE(&iter) < 0)
+ /* Release resources, if allocated */
+ if(len)
+ len = H5FL_SEQ_FREE(size_t, len);
+ if(off)
+ off = H5FL_SEQ_FREE(hsize_t, off);
+
+ /* Release selection iterator */
+ if(iter_init && H5S_SELECT_ITER_RELEASE(iter) < 0)
HDONE_ERROR(H5E_DATASPACE, H5E_CANTRELEASE, FAIL, "unable to release selection iterator")
+ if(iter)
+ iter = H5FL_FREE(H5S_sel_iter_t, iter);
FUNC_LEAVE_NOAPI(ret_value)
} /* H5S_select_fill() */
diff --git a/src/H5T.c b/src/H5T.c
index fd73f09..cc0e782 100644
--- a/src/H5T.c
+++ b/src/H5T.c
@@ -5057,6 +5057,49 @@ done:
FUNC_LEAVE_NOAPI(ret_value)
}
+/*-------------------------------------------------------------------------
+ * Function: H5T_convert_committed_datatype
+ *
+ * Purpose: To convert the committed datatype "dt" to a transient embedded
+ * type if the file location associated with the committed datatype is
+ * different from the parameter "f".
+ * "f" is the file location where the dataset or attribute will be created.
+ *
+ * Notes: See HDFFV-9940
+ *
+ * Return: Success: non-negative
+ * Failure: negative
+ *
+ * Programmer: Vailin Choi; June 2016
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5T_convert_committed_datatype(H5T_t *dt, H5F_t *f)
+{
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_NOAPI(FAIL)
+
+ HDassert(dt);
+ HDassert(f);
+
+ if(H5T_is_named(dt) && (dt->sh_loc.file != f)) {
+ HDassert(dt->sh_loc.type == H5O_SHARE_TYPE_COMMITTED);
+
+ H5O_msg_reset_share(H5O_DTYPE_ID, dt);
+ if(H5O_loc_free(&dt->oloc) < 0)
+ HGOTO_ERROR(H5E_DATATYPE, H5E_CANTRESET, FAIL, "unable to initialize location")
+ if(H5G_name_free(&dt->path) < 0)
+ HGOTO_ERROR(H5E_DATATYPE, H5E_CANTOPENOBJ, FAIL, "unable to reset path")
+
+ dt->shared->state = H5T_STATE_TRANSIENT;
+ }
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5T_convert_committed_datatype() */
+
/*--------------------------------------------------------------------------
NAME
@@ -5549,3 +5592,75 @@ H5T_patch_vlen_file(H5T_t *dt, H5F_t *f)
FUNC_LEAVE_NOAPI(SUCCEED)
} /* end H5T_patch_vlen_file() */
+
+/*-------------------------------------------------------------------------
+ * Function: H5Tflush
+ *
+ * Purpose: Flushes all buffers associated with a named datatype to disk.
+ *
+ * Return: Non-negative on success, negative on failure
+ *
+ * Programmer: Mike McGreevy
+ * May 19, 2010
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5Tflush(hid_t type_id)
+{
+ H5T_t *dt; /* Datatype for this operation */
+ herr_t ret_value = SUCCEED; /* return value */
+
+ FUNC_ENTER_API(FAIL)
+ H5TRACE1("e", "i", type_id);
+
+ /* Check args */
+ if(NULL == (dt = (H5T_t *)H5I_object_verify(type_id, H5I_DATATYPE)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a datatype")
+ if(!H5T_is_named(dt))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a committed datatype")
+
+ /* To flush metadata and invoke flush callback if there is */
+ if(H5O_flush_common(&dt->oloc, type_id, H5AC_ind_read_dxpl_id) < 0)
+ HGOTO_ERROR(H5E_DATATYPE, H5E_CANTFLUSH, FAIL, "unable to flush datatype and object flush callback")
+
+done:
+ FUNC_LEAVE_API(ret_value)
+} /* H5Tflush */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5Trefresh
+ *
+ * Purpose: Refreshes all buffers associated with a named datatype.
+ *
+ * Return: Non-negative on success, negative on failure
+ *
+ * Programmer: Mike McGreevy
+ * July 21, 2010
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5Trefresh(hid_t type_id)
+{
+ H5T_t * dt = NULL;
+ herr_t ret_value = SUCCEED; /* return value */
+
+ FUNC_ENTER_API(FAIL)
+ H5TRACE1("e", "i", type_id);
+
+ /* Check args */
+ if(NULL == (dt = (H5T_t *)H5I_object_verify(type_id, H5I_DATATYPE)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a datatype")
+ if(!H5T_is_named(dt))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a committed datatype")
+
+ /* Call private function to refresh datatype object */
+ if ((H5O_refresh_metadata(type_id, dt->oloc, H5AC_ind_read_dxpl_id)) < 0)
+ HGOTO_ERROR(H5E_DATATYPE, H5E_CANTLOAD, FAIL, "unable to refresh datatype")
+
+done:
+ FUNC_LEAVE_API(ret_value)
+} /* H5Trefresh */
+
diff --git a/src/H5Tprivate.h b/src/H5Tprivate.h
index 45d8d76..5fd0cf3 100644
--- a/src/H5Tprivate.h
+++ b/src/H5Tprivate.h
@@ -121,6 +121,7 @@ H5_DLL struct H5O_loc_t *H5T_oloc(H5T_t *dt);
H5_DLL H5G_name_t *H5T_nameof(H5T_t *dt);
H5_DLL htri_t H5T_is_immutable(const H5T_t *dt);
H5_DLL htri_t H5T_is_named(const H5T_t *dt);
+H5_DLL herr_t H5T_convert_committed_datatype(H5T_t *dt, H5F_t *f);
H5_DLL htri_t H5T_is_relocatable(const H5T_t *dt);
H5_DLL H5T_path_t *H5T_path_find(const H5T_t *src, const H5T_t *dst,
const char *name, H5T_conv_t func, hid_t dxpl_id, hbool_t is_api);
diff --git a/src/H5Tpublic.h b/src/H5Tpublic.h
index d646ef1..df7ad41 100644
--- a/src/H5Tpublic.h
+++ b/src/H5Tpublic.h
@@ -511,6 +511,8 @@ H5_DLL hid_t H5Tget_create_plist(hid_t type_id);
H5_DLL htri_t H5Tcommitted(hid_t type_id);
H5_DLL herr_t H5Tencode(hid_t obj_id, void *buf, size_t *nalloc);
H5_DLL hid_t H5Tdecode(const void *buf);
+H5_DLL herr_t H5Tflush(hid_t type_id);
+H5_DLL herr_t H5Trefresh(hid_t type_id);
/* Operations defined on compound datatypes */
H5_DLL herr_t H5Tinsert(hid_t parent_id, const char *name, size_t offset,
diff --git a/src/H5Tvlen.c b/src/H5Tvlen.c
index 0ed8209..d198d50 100644
--- a/src/H5Tvlen.c
+++ b/src/H5Tvlen.c
@@ -243,7 +243,7 @@ H5T__vlen_set_loc(const H5T_t *dt, H5F_t *f, H5T_loc_t loc)
* of an address in this file, plus 4 bytes for the size of a heap
* ID. Memory size is different
*/
- dt->shared->size = 4 + H5F_SIZEOF_ADDR(f) + 4;
+ dt->shared->size = 4 + (size_t)H5F_SIZEOF_ADDR(f) + 4;
/* Set up the function pointers to access the VL information on disk */
/* VL sequences and VL strings are stored identically on disk, so use the same functions */
@@ -801,7 +801,7 @@ H5T_vlen_disk_getptr(void H5_ATTR_UNUSED *vl)
static htri_t
H5T_vlen_disk_isnull(const H5F_t *f, void *_vl)
{
- uint8_t *vl=(uint8_t *)_vl; /* Pointer to the disk VL information */
+ uint8_t *vl = (uint8_t *)_vl; /* Pointer to the disk VL information */
haddr_t addr; /* Sequence's heap address */
FUNC_ENTER_NOAPI_NOINIT_NOERR
@@ -810,12 +810,12 @@ H5T_vlen_disk_isnull(const H5F_t *f, void *_vl)
HDassert(vl);
/* Skip the sequence's length */
- vl+=4;
+ vl += 4;
/* Get the heap address */
- H5F_addr_decode(f,(const uint8_t **)&vl,&addr);
+ H5F_addr_decode(f, (const uint8_t **)&vl, &addr);
- FUNC_LEAVE_NOAPI(addr==0 ? TRUE : FALSE)
+ FUNC_LEAVE_NOAPI(addr == 0 ? TRUE : FALSE)
} /* end H5T_vlen_disk_isnull() */
diff --git a/src/H5Zscaleoffset.c b/src/H5Zscaleoffset.c
index 1cca9b1..91a6c00 100644
--- a/src/H5Zscaleoffset.c
+++ b/src/H5Zscaleoffset.c
@@ -667,6 +667,58 @@ H5Z_class2_t H5Z_SCALEOFFSET[1] = {{
H5Z_scaleoffset_modify_4(i, type, pow_fun, buf, d_nelmts, min, D_val) \
}
+/* Include our own rounding routine and alias it to the stdc macros, if they
+ * aren't available.
+ */
+#if !(defined(H5_HAVE_LLROUND) && defined(H5_HAVE_LLROUNDF) && defined(H5_HAVE_LROUND) && defined(H5_HAVE_LROUNDF) && defined(H5_HAVE_ROUND) && defined(H5_HAVE_ROUNDF))
+/* Round a floating-point value to the nearest integer value 4/19/05 */
+/* rounding to the bigger absolute value if val is in the middle,
+ 0.5 -> 1, -0.5 ->-1
+5/9/05, KY */
+static double
+H5Z__scaleoffset_rnd(double val)
+{
+ double u_val, l_val;
+
+ u_val = HDceil(val);
+ l_val = HDfloor(val);
+
+ if(val > 0) {
+ if((u_val - val) <= (val - l_val))
+ return u_val;
+ else
+ return l_val;
+ } /* end if */
+ else {
+ if((val - l_val) <= (u_val - val))
+ return l_val;
+ else
+ return u_val;
+ }
+} /* H5Z__scaleoffset_rnd() */
+
+/* Alias rounding macros to routine above, if not defined */
+#if !defined(H5_HAVE_LLROUND)
+#define llround(x) H5Z__scaleoffset_rnd(x)
+#endif /* !defined(H5_HAVE_LLROUND) */
+#if !defined(H5_HAVE_LLROUNDF)
+#define llroundf(x) H5Z__scaleoffset_rnd(x)
+#endif /* !defined(H5_HAVE_LLROUNDF) */
+#if !defined(H5_HAVE_LROUND)
+#define lround(x) H5Z__scaleoffset_rnd(x)
+#endif /* !defined(H5_HAVE_LROUND) */
+#if !defined(H5_HAVE_LROUNDF)
+#define lroundf(x) H5Z__scaleoffset_rnd(x)
+#endif /* !defined(H5_HAVE_LROUNDF) */
+#if !defined(H5_HAVE_ROUND)
+#define round(x) H5Z__scaleoffset_rnd(x)
+#endif /* !defined(H5_HAVE_ROUND) */
+#if !defined(H5_HAVE_ROUNDF)
+#define roundf(x) H5Z__scaleoffset_rnd(x)
+#endif /* !defined(H5_HAVE_ROUNDF) */
+
+#endif /* !(defined(H5_HAVE_LLROUND) && defined(H5_HAVE_LLROUNDF) && defined(H5_HAVE_LROUND) && defined(H5_HAVE_LROUNDF) && defined(H5_HAVE_ROUND) && defined(H5_HAVE_ROUNDF)) */
+
/*-------------------------------------------------------------------------
* Function: H5Z_can_apply_scaleoffset
diff --git a/src/H5private.h b/src/H5private.h
index 6a677bb..4c40965 100644
--- a/src/H5private.h
+++ b/src/H5private.h
@@ -1142,7 +1142,9 @@ typedef off_t h5_stat_size_t;
#ifndef HDpowf
#define HDpowf(X,Y) powf(X,Y)
#endif /* HDpowf */
-/* printf() variable arguments */
+#ifndef HDprintf
+ #define HDprintf(...) HDfprintf(stdout, __VA_ARGS__)
+#endif /* HDprintf */
#ifndef HDputc
#define HDputc(C,F) putc(C,F)
#endif /* HDputc*/
diff --git a/src/H5system.c b/src/H5system.c
index e6ca5d4..e17373c 100644
--- a/src/H5system.c
+++ b/src/H5system.c
@@ -172,7 +172,7 @@ HDfprintf(FILE *stream, const char *fmt, ...)
s = rest;
} /* end if */
else if ('*'==*s) {
- fwidth = va_arg (ap, int);
+ fwidth = va_arg(ap, int);
if(fwidth < 0) {
leftjust = 1;
fwidth = -fwidth;
@@ -269,23 +269,22 @@ HDfprintf(FILE *stream, const char *fmt, ...)
len += HDsnprintf(format_templ + len, (sizeof(format_templ) - (size_t)(len + 1)), "%s", modifier);
HDsnprintf(format_templ + len, (sizeof(format_templ) - (size_t)(len + 1)), "%c", conv);
-
/* Conversion */
switch (conv) {
case 'd':
case 'i':
if(!HDstrcmp(modifier, "h")) {
- short x = (short)va_arg (ap, int);
- n = fprintf (stream, format_templ, x);
+ short x = (short)va_arg(ap, int);
+ n = fprintf(stream, format_templ, x);
} else if(!*modifier) {
- int x = va_arg (ap, int);
- n = fprintf (stream, format_templ, x);
- } else if(!HDstrcmp (modifier, "l")) {
- long x = va_arg (ap, long);
- n = fprintf (stream, format_templ, x);
+ int x = va_arg(ap, int);
+ n = fprintf(stream, format_templ, x);
+ } else if(!HDstrcmp(modifier, "l")) {
+ long x = va_arg(ap, long);
+ n = fprintf(stream, format_templ, x);
} else {
int64_t x = va_arg(ap, int64_t);
- n = fprintf (stream, format_templ, x);
+ n = fprintf(stream, format_templ, x);
}
break;
@@ -294,13 +293,13 @@ HDfprintf(FILE *stream, const char *fmt, ...)
case 'x':
case 'X':
if(!HDstrcmp(modifier, "h")) {
- unsigned short x = (unsigned short)va_arg (ap, unsigned int);
+ unsigned short x = (unsigned short)va_arg(ap, unsigned int);
n = fprintf(stream, format_templ, x);
} else if(!*modifier) {
- unsigned int x = va_arg (ap, unsigned int); /*lint !e732 Loss of sign not really occuring */
+ unsigned int x = va_arg(ap, unsigned int); /*lint !e732 Loss of sign not really occuring */
n = fprintf(stream, format_templ, x);
} else if(!HDstrcmp(modifier, "l")) {
- unsigned long x = va_arg (ap, unsigned long); /*lint !e732 Loss of sign not really occuring */
+ unsigned long x = va_arg(ap, unsigned long); /*lint !e732 Loss of sign not really occuring */
n = fprintf(stream, format_templ, x);
} else {
uint64_t x = va_arg(ap, uint64_t); /*lint !e732 Loss of sign not really occuring */
@@ -336,7 +335,7 @@ HDfprintf(FILE *stream, const char *fmt, ...)
case 'a':
{
- haddr_t x = va_arg (ap, haddr_t); /*lint !e732 Loss of sign not really occuring */
+ haddr_t x = va_arg(ap, haddr_t); /*lint !e732 Loss of sign not really occuring */
if(H5F_addr_defined(x)) {
len = 0;
@@ -405,7 +404,7 @@ HDfprintf(FILE *stream, const char *fmt, ...)
htri_t tri_var = va_arg(ap, htri_t);
if(tri_var > 0)
- fprintf (stream, "TRUE");
+ fprintf(stream, "TRUE");
else if(!tri_var)
fprintf(stream, "FALSE");
else
diff --git a/src/H5timer.c b/src/H5timer.c
index d9be6bb..f36681e 100644
--- a/src/H5timer.c
+++ b/src/H5timer.c
@@ -127,16 +127,16 @@ H5_timer_begin (H5_timer_t *timer)
#ifdef H5_HAVE_GETRUSAGE
HDgetrusage (RUSAGE_SELF, &rusage);
timer->utime = (double)rusage.ru_utime.tv_sec +
- ((double)rusage.ru_utime.tv_usec / 1e6F);
+ ((double)rusage.ru_utime.tv_usec / (double)1e6F);
timer->stime = (double)rusage.ru_stime.tv_sec +
- ((double)rusage.ru_stime.tv_usec / 1e6F);
+ ((double)rusage.ru_stime.tv_usec / (double)1e6F);
#else
timer->utime = 0.0F;
timer->stime = 0.0F;
#endif
#ifdef H5_HAVE_GETTIMEOFDAY
HDgettimeofday (&etime, NULL);
- timer->etime = (double)etime.tv_sec + ((double)etime.tv_usec / 1e6F);
+ timer->etime = (double)etime.tv_sec + ((double)etime.tv_usec / (double)1e6F);
#else
timer->etime = 0.0F;
#endif
@@ -166,9 +166,9 @@ H5_timer_end (H5_timer_t *sum/*in,out*/, H5_timer_t *timer/*in,out*/)
HDassert(timer);
H5_timer_begin(&now);
- timer->utime = MAX(0.0F, now.utime - timer->utime);
- timer->stime = MAX(0.0F, now.stime - timer->stime);
- timer->etime = MAX(0.0F, now.etime - timer->etime);
+ timer->utime = MAX((double)0.0F, now.utime - timer->utime);
+ timer->stime = MAX((double)0.0F, now.stime - timer->stime);
+ timer->etime = MAX((double)0.0F, now.etime - timer->etime);
if (sum) {
sum->utime += timer->utime;
@@ -208,28 +208,28 @@ H5_bandwidth(char *buf/*out*/, double nbytes, double nseconds)
{
double bw;
- if(nseconds <= 0.0F)
+ if(nseconds <= (double)0.0F)
HDstrcpy(buf, " NaN");
else {
bw = nbytes/nseconds;
- if(H5_DBL_ABS_EQUAL(bw, 0.0F))
- HDstrcpy(buf, "0.000 B/s");
- else if(bw < 1.0F)
+ 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);
- else if(bw < H5_KB) {
+ else if(bw < (double)H5_KB) {
sprintf(buf, "%05.4f", bw);
HDstrcpy(buf+5, " B/s");
- } else if(bw < H5_MB) {
- sprintf(buf, "%05.4f", bw / H5_KB);
+ } else if(bw < (double)H5_MB) {
+ sprintf(buf, "%05.4f", bw / (double)H5_KB);
HDstrcpy(buf+5, " kB/s");
- } else if(bw < H5_GB) {
- sprintf(buf, "%05.4f", bw / H5_MB);
+ } else if(bw < (double)H5_GB) {
+ sprintf(buf, "%05.4f", bw / (double)H5_MB);
HDstrcpy(buf+5, " MB/s");
- } else if(bw < H5_TB) {
- sprintf(buf, "%05.4f", bw / H5_GB);
+ } else if(bw < (double)H5_TB) {
+ sprintf(buf, "%05.4f", bw / (double)H5_GB);
HDstrcpy(buf+5, " GB/s");
- } else if(bw < H5_PB) {
- sprintf(buf, "%05.4f", bw / H5_TB);
+ } else if(bw < (double)H5_PB) {
+ sprintf(buf, "%05.4f", bw / (double)H5_TB);
HDstrcpy(buf+5, " TB/s");
} else {
sprintf(buf, "%10.4e", bw);
diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt
index 19603ca..6e6a0b9 100644
--- a/test/CMakeLists.txt
+++ b/test/CMakeLists.txt
@@ -83,6 +83,7 @@ endif (BUILD_SHARED_LIBS)
)
set (TEST2_PLUGIN_LIBS
dynlib2
+ dynlib4
)
foreach (test_lib ${TEST_PLUGIN_LIBS})
diff --git a/test/CMakeTests.cmake b/test/CMakeTests.cmake
index dacf4ba..1e7940a 100644
--- a/test/CMakeTests.cmake
+++ b/test/CMakeTests.cmake
@@ -44,41 +44,17 @@ set (HDF5_TEST_FILES
)
foreach (h5_tfile ${HDF5_TEST_FILES})
- set (dest "${PROJECT_BINARY_DIR}/H5TEST/${h5_tfile}")
- add_custom_command (
- TARGET ${HDF5_TEST_LIB_TARGET}
- POST_BUILD
- COMMAND ${CMAKE_COMMAND}
- ARGS -E copy_if_different ${HDF5_TOOLS_DIR}/testfiles/${h5_tfile} ${dest}
- )
+ HDFTEST_COPY_FILE("${HDF5_TOOLS_DIR}/testfiles/${h5_tfile}" "${PROJECT_BINARY_DIR}/H5TEST/${h5_tfile}" "HDF5_TEST_LIB_files")
if (BUILD_SHARED_LIBS)
- set (dest "${PROJECT_BINARY_DIR}/H5TEST-shared/${h5_tfile}")
- add_custom_command (
- TARGET ${HDF5_TEST_LIBSH_TARGET}
- POST_BUILD
- COMMAND ${CMAKE_COMMAND}
- ARGS -E copy_if_different ${HDF5_TOOLS_DIR}/testfiles/${h5_tfile} ${dest}
- )
+ HDFTEST_COPY_FILE("${HDF5_TOOLS_DIR}/testfiles/${h5_tfile}" "${PROJECT_BINARY_DIR}/H5TEST-shared/${h5_tfile}" "HDF5_TEST_LIBSH_files")
endif (BUILD_SHARED_LIBS)
endforeach (h5_tfile ${HDF5_TEST_FILES})
if (HDF5_TEST_VFD)
foreach (vfdtest ${VFD_LIST})
foreach (h5_tfile ${HDF5_TEST_FILES})
- set (dest "${PROJECT_BINARY_DIR}/${vfdtest}/${h5_tfile}")
- add_custom_command (
- TARGET ${HDF5_TEST_LIB_TARGET}
- POST_BUILD
- COMMAND ${CMAKE_COMMAND}
- ARGS -E copy_if_different ${HDF5_TOOLS_DIR}/testfiles/${h5_tfile} ${dest}
- )
+ HDFTEST_COPY_FILE("${HDF5_TOOLS_DIR}/testfiles/${h5_tfile}" "${PROJECT_BINARY_DIR}/${vfdtest}/${h5_tfile}" "HDF5_TEST_LIB_files")
if (BUILD_SHARED_LIBS)
- set (dest "${PROJECT_BINARY_DIR}/${vfdtest}-shared/${h5_tfile}")
- add_custom_command (
- TARGET ${HDF5_TEST_LIBSH_TARGET}
- POST_BUILD
- COMMAND ${CMAKE_COMMAND}
- ARGS -E copy_if_different ${HDF5_TOOLS_DIR}/testfiles/${h5_tfile} ${dest}
- )
+ HDFTEST_COPY_FILE("${HDF5_TOOLS_DIR}/testfiles/${h5_tfile}" "${PROJECT_BINARY_DIR}/${vfdtest}-shared/${h5_tfile}" "HDF5_TEST_LIBSH_files")
endif (BUILD_SHARED_LIBS)
endforeach (h5_tfile ${HDF5_TEST_FILES})
endforeach (vfdtest ${VFD_LIST})
@@ -96,41 +72,17 @@ set (HDF5_REFERENCE_FILES
)
foreach (ref_file ${HDF5_REFERENCE_FILES})
- set (dest "${PROJECT_BINARY_DIR}/H5TEST/${ref_file}")
- add_custom_command (
- TARGET ${HDF5_TEST_LIB_TARGET}
- POST_BUILD
- COMMAND ${CMAKE_COMMAND}
- ARGS -E copy_if_different ${HDF5_TEST_SOURCE_DIR}/testfiles/${ref_file} ${dest}
- )
+ HDFTEST_COPY_FILE("${HDF5_TEST_SOURCE_DIR}/testfiles/${ref_file}" "${PROJECT_BINARY_DIR}/H5TEST/${ref_file}" "HDF5_TEST_LIB_files")
if (BUILD_SHARED_LIBS)
- set (dest "${PROJECT_BINARY_DIR}/H5TEST-shared/${ref_file}")
- add_custom_command (
- TARGET ${HDF5_TEST_LIBSH_TARGET}
- POST_BUILD
- COMMAND ${CMAKE_COMMAND}
- ARGS -E copy_if_different ${HDF5_TEST_SOURCE_DIR}/testfiles/${ref_file} ${dest}
- )
+ HDFTEST_COPY_FILE("${HDF5_TEST_SOURCE_DIR}/testfiles/${ref_file}" "${PROJECT_BINARY_DIR}/H5TEST-shared/${ref_file}" "HDF5_TEST_LIBSH_files")
endif (BUILD_SHARED_LIBS)
endforeach (ref_file ${HDF5_REFERENCE_FILES})
if (HDF5_TEST_VFD)
foreach (vfdtest ${VFD_LIST})
foreach (ref_file ${HDF5_REFERENCE_FILES})
- set (dest "${PROJECT_BINARY_DIR}/${vfdtest}/${ref_file}")
- add_custom_command (
- TARGET ${HDF5_TEST_LIB_TARGET}
- POST_BUILD
- COMMAND ${CMAKE_COMMAND}
- ARGS -E copy_if_different ${HDF5_TEST_SOURCE_DIR}/testfiles/${ref_file} ${dest}
- )
+ HDFTEST_COPY_FILE("${HDF5_TEST_SOURCE_DIR}/testfiles/${ref_file}" "${PROJECT_BINARY_DIR}/${vfdtest}/${ref_file}" "HDF5_TEST_LIB_files")
if (BUILD_SHARED_LIBS)
- set (dest "${PROJECT_BINARY_DIR}/${vfdtest}-shared/${ref_file}")
- add_custom_command (
- TARGET ${HDF5_TEST_LIB_TARGET}
- POST_BUILD
- COMMAND ${CMAKE_COMMAND}
- ARGS -E copy_if_different ${HDF5_TEST_SOURCE_DIR}/testfiles/${ref_file} ${dest}
- )
+ HDFTEST_COPY_FILE("${HDF5_TEST_SOURCE_DIR}/testfiles/${ref_file}" "${PROJECT_BINARY_DIR}/${vfdtest}-shared/${ref_file}" "HDF5_TEST_LIBSH_files")
endif (BUILD_SHARED_LIBS)
endforeach (ref_file ${HDF5_REFERENCE_FILES})
endforeach (vfdtest ${VFD_LIST})
@@ -191,33 +143,11 @@ set (HDF5_REFERENCE_PLIST_FILES
)
foreach (plistfile ${HDF5_REFERENCE_PLIST_FILES})
- set (dest "${PROJECT_BINARY_DIR}/H5TEST/testfiles/plist_files")
- add_custom_command (
- TARGET ${HDF5_TEST_LIB_TARGET}
- POST_BUILD
- COMMAND ${CMAKE_COMMAND}
- ARGS -E copy_if_different ${HDF5_TEST_SOURCE_DIR}/testfiles/plist_files/${plistfile} ${dest}/${plistfile}
- )
- add_custom_command (
- TARGET ${HDF5_TEST_LIB_TARGET}
- POST_BUILD
- COMMAND ${CMAKE_COMMAND}
- ARGS -E copy_if_different ${HDF5_TEST_SOURCE_DIR}/testfiles/plist_files/def_${plistfile} ${dest}/def_${plistfile}
- )
+ 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)
- set (dest "${PROJECT_BINARY_DIR}/H5TEST-shared/testfiles/plist_files")
- add_custom_command (
- TARGET ${HDF5_TEST_LIBSH_TARGET}
- POST_BUILD
- COMMAND ${CMAKE_COMMAND}
- ARGS -E copy_if_different ${HDF5_TEST_SOURCE_DIR}/testfiles/plist_files/${plistfile} ${dest}/${plistfile}
- )
- add_custom_command (
- TARGET ${HDF5_TEST_LIBSH_TARGET}
- POST_BUILD
- COMMAND ${CMAKE_COMMAND}
- ARGS -E copy_if_different ${HDF5_TEST_SOURCE_DIR}/testfiles/plist_files/def_${plistfile} ${dest}/def_${plistfile}
- )
+ 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 (BUILD_SHARED_LIBS)
endforeach (plistfile ${HDF5_REFERENCE_PLIST_FILES})
@@ -264,45 +194,25 @@ set (HDF5_REFERENCE_TEST_FILES
)
foreach (h5_file ${HDF5_REFERENCE_TEST_FILES})
- set (dest "${HDF5_TEST_BINARY_DIR}/H5TEST/${h5_file}")
- add_custom_command (
- TARGET ${HDF5_TEST_LIB_TARGET}
- POST_BUILD
- COMMAND ${CMAKE_COMMAND}
- ARGS -E copy_if_different ${HDF5_TEST_SOURCE_DIR}/${h5_file} ${dest}
- )
+ HDFTEST_COPY_FILE("${HDF5_TEST_SOURCE_DIR}/${h5_file}" "${HDF5_TEST_BINARY_DIR}/H5TEST/${h5_file}" "HDF5_TEST_LIB_files")
if (BUILD_SHARED_LIBS)
- set (dest "${HDF5_TEST_BINARY_DIR}/H5TEST-shared/${h5_file}")
- add_custom_command (
- TARGET ${HDF5_TEST_LIBSH_TARGET}
- POST_BUILD
- COMMAND ${CMAKE_COMMAND}
- ARGS -E copy_if_different ${HDF5_TEST_SOURCE_DIR}/${h5_file} ${dest}
- )
+ HDFTEST_COPY_FILE("${HDF5_TEST_SOURCE_DIR}/${h5_file}" "${HDF5_TEST_BINARY_DIR}/H5TEST-shared/${h5_file}" "HDF5_TEST_LIBSH_files")
endif (BUILD_SHARED_LIBS)
endforeach (h5_file ${HDF5_REFERENCE_TEST_FILES})
if (HDF5_TEST_VFD)
foreach (vfdtest ${VFD_LIST})
foreach (h5_file ${HDF5_REFERENCE_TEST_FILES})
- set (dest "${HDF5_TEST_BINARY_DIR}/${vfdtest}/${h5_file}")
- add_custom_command (
- TARGET ${HDF5_TEST_LIB_TARGET}
- POST_BUILD
- COMMAND ${CMAKE_COMMAND}
- ARGS -E copy_if_different ${HDF5_TEST_SOURCE_DIR}/${h5_file} ${dest}
- )
+ HDFTEST_COPY_FILE("${HDF5_TEST_SOURCE_DIR}/${h5_file}" "${HDF5_TEST_BINARY_DIR}/${vfdtest}/${h5_file}" "HDF5_TEST_LIB_files")
if (BUILD_SHARED_LIBS)
- set (dest "${HDF5_TEST_BINARY_DIR}/${vfdtest}-shared/${h5_file}")
- add_custom_command (
- TARGET ${HDF5_TEST_LIB_TARGET}
- POST_BUILD
- COMMAND ${CMAKE_COMMAND}
- ARGS -E copy_if_different ${HDF5_TEST_SOURCE_DIR}/${h5_file} ${dest}
- )
+ HDFTEST_COPY_FILE("${HDF5_TEST_SOURCE_DIR}/${h5_file}" "${HDF5_TEST_BINARY_DIR}/${vfdtest}-shared/${h5_file}" "HDF5_TEST_LIBSH_files")
endif (BUILD_SHARED_LIBS)
endforeach (h5_file ${HDF5_REFERENCE_TEST_FILES})
endforeach (vfdtest ${VFD_LIST})
endif (HDF5_TEST_VFD)
+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()
# Remove any output file left over from previous test run
add_test (NAME H5TEST-clear-testhdf5-objects
@@ -1158,17 +1068,17 @@ if (HDF5_TEST_VFD)
set_tests_properties (VFD-${vfdname}-flush1 PROPERTIES TIMEOUT 10)
set_tests_properties (VFD-${vfdname}-flush2 PROPERTIES TIMEOUT 10)
set_tests_properties (VFD-${vfdname}-istore PROPERTIES TIMEOUT 1800)
-# if (NOT CYGWIN)
-# set_tests_properties (VFD-${vfdname}-cache PROPERTIES TIMEOUT 1800)
-# endif (NOT CYGWIN)
+ if (NOT CYGWIN)
+ set_tests_properties (VFD-${vfdname}-cache PROPERTIES TIMEOUT 1800)
+ endif (NOT CYGWIN)
if (BUILD_SHARED_LIBS)
set_tests_properties (VFD-${vfdname}-flush2-shared PROPERTIES DEPENDS VFD-${vfdname}-flush1-shared)
set_tests_properties (VFD-${vfdname}-flush1-shared PROPERTIES TIMEOUT 10)
set_tests_properties (VFD-${vfdname}-flush2-shared PROPERTIES TIMEOUT 10)
set_tests_properties (VFD-${vfdname}-istore-shared PROPERTIES TIMEOUT 1800)
-# if (NOT CYGWIN)
-# set_tests_properties (VFD-${vfdname}-cache-shared PROPERTIES TIMEOUT 1800)
-# endif (NOT CYGWIN)
+ if (NOT CYGWIN)
+ set_tests_properties (VFD-${vfdname}-cache-shared PROPERTIES TIMEOUT 1800)
+ endif (NOT CYGWIN)
endif (BUILD_SHARED_LIBS)
if (HDF5_TEST_FHEAP_VFD)
add_test (NAME VFD-${vfdname}-fheap
diff --git a/test/H5srcdir.h b/test/H5srcdir.h
index 81624d8..2f04295 100644
--- a/test/H5srcdir.h
+++ b/test/H5srcdir.h
@@ -31,26 +31,9 @@ static char srcdir_path[1024] = "";
/* Buffer to construct file in and return pointer to */
static char srcdir_testpath[1024] = "";
-/* Append the test file name to the srcdir path and return the whole string */
-static const char *H5_get_srcdir_filename(const char *filename)
-{
- const char *srcdir = HDgetenv("srcdir");
-
- /* Check for using the srcdir from configure time */
- if(NULL == srcdir)
- srcdir = config_srcdir;
-
- /* Build path to test file */
- if((HDstrlen(srcdir) + HDstrlen(filename) + 2) < sizeof(srcdir_testpath)) {
- HDsnprintf(srcdir_testpath, sizeof(srcdir_testpath), "%s/%s", srcdir, filename);
- return(srcdir_testpath);
- } /* end if */
- else
- return(NULL);
-}
-
/* Just return the srcdir path */
-static const char *H5_get_srcdir(void)
+static const char *
+H5_get_srcdir(void)
{
const char *srcdir = HDgetenv("srcdir");
@@ -65,6 +48,25 @@ static const char *H5_get_srcdir(void)
} /* end if */
else
return(NULL);
-}
+} /* end H5_get_srcdir() */
+
+/* Append the test file name to the srcdir path and return the whole string */
+static const char *H5_get_srcdir_filename(const char *filename)
+{
+ const char *srcdir = H5_get_srcdir();
+
+ /* Check for error */
+ if(NULL == srcdir)
+ return(NULL);
+ else {
+ /* Build path to test file */
+ if((HDstrlen(srcdir) + HDstrlen(filename) + 1) < sizeof(srcdir_testpath)) {
+ HDsnprintf(srcdir_testpath, sizeof(srcdir_testpath), "%s%s", srcdir, filename);
+ return(srcdir_testpath);
+ } /* end if */
+ else
+ return(NULL);
+ } /* end else */
+} /* end H5_get_srcdir_filename() */
#endif /* _H5SRCDIR_H */
diff --git a/test/Makefile.am b/test/Makefile.am
index a7c39f3..7d062f4 100644
--- a/test/Makefile.am
+++ b/test/Makefile.am
@@ -84,12 +84,13 @@ if HAVE_SHARED_CONDITIONAL
# The libh5test library provides common support code for the tests.
noinst_LTLIBRARIES=libh5test.la
- # The libdynlib1 and libdynlib2 library for testing plugin module plugin.c.
+ # The libdynlib1, libdynlib2, libdynlib3, and libdynlib4 library for testing plugin module plugin.c.
# Build it as shared library if configure is enabled for shared library.
- lib_LTLIBRARIES=libdynlib1.la libdynlib2.la libdynlib3.la
+ lib_LTLIBRARIES=libdynlib1.la libdynlib2.la libdynlib3.la libdynlib4.la
libdynlib1_la_SOURCES=dynlib1.c
libdynlib2_la_SOURCES=dynlib2.c
libdynlib3_la_SOURCES=dynlib3.c
+ libdynlib4_la_SOURCES=dynlib4.c
install-exec-hook:
$(RM) $(DESTDIR)$(libdir)/*dynlib*
diff --git a/test/big.c b/test/big.c
index 7a3fd21..0505e54 100644
--- a/test/big.c
+++ b/test/big.c
@@ -129,8 +129,8 @@ randll(hsize_t limit, int current_index)
/* does not overlap with any previous writes */
while(overlap != 0 && tries < MAX_TRIES)
{
- acc = HDrandom();
- acc *= HDrandom();
+ acc = (hsize_t)HDrandom();
+ acc *= (hsize_t)HDrandom();
acc = acc % limit;
overlap = 0;
@@ -508,7 +508,7 @@ reader(char *filename, hid_t fapl)
if('#' != ln[0])
break;
i = (int)HDstrtol(ln + 1, &s, 10);
- hs_offset[0] = HDstrtoll(s, NULL, 0);
+ hs_offset[0] = HDstrtoull(s, NULL, 0);
HDfprintf(stdout, "#%03d 0x%016Hx%47s", i, hs_offset[0], "");
HDfflush(stdout);
@@ -801,7 +801,7 @@ main (int ac, char **av)
/* seed = (unsigned long)1155438845; */
HDfprintf(stderr, "Random # seed was: %lu\n", seed);
#endif /* QAK */
- HDsrandom(seed);
+ HDsrandom((unsigned)seed);
/* run VFD-specific test */
if(H5FD_SEC2 == driver) {
diff --git a/test/bittests.c b/test/bittests.c
index c4dfe4c..38e419d 100644
--- a/test/bittests.c
+++ b/test/bittests.c
@@ -88,7 +88,7 @@ test_find (void)
/* Try all combinations of one byte */
for(i = 0; i < 8 * (int)sizeof(v1); i++) {
HDmemset(v1, 0, sizeof v1);
- v1[i / 8] = 1 << (i % 8);
+ v1[i / 8] = (uint8_t)(1 << (i % 8));
n = H5T__bit_find(v1, (size_t)0, 8 * sizeof(v1), H5T_BIT_LSB, TRUE);
if((ssize_t)i != n) {
H5_FAILED();
@@ -120,8 +120,8 @@ test_find (void)
/* Try all combinations of one byte */
for (i=0; i<8*(int)sizeof(v1); i++) {
- memset (v1, 0xff, sizeof v1);
- v1[i/8] &= ~(1<<(i%8));
+ HDmemset(v1, 0xff, sizeof v1);
+ v1[i / 8] &= (uint8_t)~(1 << (i % 8));
n = H5T__bit_find (v1, (size_t)0, 8*sizeof(v1), H5T_BIT_LSB, FALSE);
if ((ssize_t)i!=n) {
H5_FAILED();
@@ -175,12 +175,12 @@ test_copy (void)
TESTING("bit copy operations");
for (i=0; i<NTESTS; i++) {
- s_offset = HDrand() % (8*sizeof v1);
- d_offset = HDrand() % (8*sizeof v2);
+ s_offset = (size_t)HDrand() % (8 * sizeof v1);
+ d_offset = (size_t)HDrand() % (8 * sizeof v2);
size = (unsigned)HDrand() % MIN (8*sizeof(v1), 8*sizeof(v2));
size = MIN3 (size, 8*sizeof(v1)-s_offset, 8*sizeof(v2)-d_offset);
- memset (v1, 0xff, sizeof v1);
- memset (v2, 0x00, sizeof v2);
+ HDmemset(v1, 0xff, sizeof v1);
+ HDmemset(v2, 0x00, sizeof v2);
/* Copy some bits to v2 and make sure something was copied */
H5T__bit_copy (v2, d_offset, v1, s_offset, size);
@@ -297,21 +297,21 @@ test_shift (void)
TESTING("bit shift operations");
for (i=0; i<NTESTS; i++) {
- offset = HDrand() % (8*sizeof vector);
- size = (unsigned)HDrand() % (8*sizeof(vector)-offset);
+ offset = (size_t)HDrand() % (8 * sizeof vector);
+ size = (size_t)HDrand() % (8 * sizeof(vector) - offset);
/* Don't want size to be 0 */
if(size == 0) continue;
- shift_dist = HDrand() % size;
+ shift_dist = (ssize_t)((size_t)HDrand() % size);
/*-------- LEFT-shift some bits and make sure something was shifted --------*/
- memset (vector, 0x00, sizeof vector);
+ HDmemset(vector, 0x00, sizeof vector);
H5T__bit_set (vector, offset, size, 1);
H5T__bit_shift (vector, shift_dist, offset, size);
/* Look for the ones */
n = H5T__bit_find (vector, (size_t)0, 8*sizeof(vector), H5T_BIT_LSB, 1);
- if ((size_t)n!=offset+shift_dist) {
+ if(n != (ssize_t)offset + shift_dist) {
H5_FAILED();
printf (" Unable to find first bit in destination "
"(n=%d)\n", (int)n);
@@ -331,7 +331,7 @@ test_shift (void)
}
/*-------- RIGHT-shift some bits and make sure something was shifted --------*/
- memset (vector, 0x00, sizeof vector);
+ HDmemset(vector, 0x00, sizeof vector);
H5T__bit_set (vector, offset, size, 1);
H5T__bit_shift (vector, -shift_dist, offset, size);
@@ -350,7 +350,7 @@ test_shift (void)
* that reverse searches work as expected.
*/
n = H5T__bit_find (vector, (size_t)0, 8*sizeof(vector), H5T_BIT_MSB, 1);
- if (n!=(ssize_t)(offset+size-shift_dist-1)) {
+ if(n != (ssize_t)(offset + size) - shift_dist - 1) {
H5_FAILED();
printf (" Unable to find last bit in destination "
"(reverse, n=%d)\n", (int)n);
@@ -362,11 +362,11 @@ test_shift (void)
/* Randomly decide shift direction */
if(size % 2 == 0)
- shift_dist = size;
+ shift_dist = (ssize_t)size;
else
shift_dist = -((ssize_t)size);
- memset (vector, 0x00, sizeof vector);
+ HDmemset(vector, 0x00, sizeof vector);
H5T__bit_set (vector, offset, size, 1);
H5T__bit_shift (vector, shift_dist, offset, size);
@@ -430,12 +430,12 @@ test_increment (void)
TESTING("bit increment operations");
for (i=0; i<NTESTS; i++) {
- offset = HDrand() % (8*sizeof vector);
- size = (unsigned)HDrand() % (8*sizeof(vector)-offset);
+ offset = (size_t)HDrand() % (8 * sizeof vector);
+ size = (size_t)HDrand() % (8 * sizeof(vector) - offset);
/* Don't want size to be 0 */
if(size == 0) continue;
- memset (vector, 0x00, sizeof vector);
+ HDmemset(vector, 0x00, sizeof vector);
if(size>1) /* if size=6, make a sequence like 011111 */
H5T__bit_set (vector, offset, size-1, 1);
else /* if size=1, just set this one bit to 1 */
@@ -517,13 +517,13 @@ test_decrement (void)
TESTING("bit decrement operations");
for (i=0; i<NTESTS; i++) {
- offset = HDrand() % (8*sizeof vector);
- size = (unsigned)HDrand() % (8*sizeof(vector)-offset);
+ offset = (size_t)HDrand() % (8 * sizeof vector);
+ size = (size_t)HDrand() % (8 * sizeof(vector) - offset);
/* Don't want size to be 0 */
if(size == 0) continue;
/* All-zero sequence will become 111111(size=6) after decrement */
- memset (vector, 0x00, sizeof vector);
+ HDmemset(vector, 0x00, sizeof vector);
/* decrement the sequence by one */
H5T__bit_dec (vector, offset, size);
@@ -589,13 +589,13 @@ test_negate (void)
TESTING("bit negate operations");
for (i=0; i<NTESTS; i++) {
- offset = HDrand() % (8*sizeof vector);
- size = (unsigned)HDrand() % (8*sizeof(vector)-offset);
+ offset = (size_t)HDrand() % (8 * sizeof vector);
+ size = (size_t)HDrand() % (8 * sizeof(vector) - offset);
/* Don't want size to be 0 */
if(size == 0) continue;
/* All-zero sequence will become 111111(size=6) after negating */
- memset (vector, 0x00, sizeof vector);
+ HDmemset(vector, 0x00, sizeof vector);
/* negate the sequence */
H5T__bit_neg (vector, offset, size);
@@ -622,7 +622,7 @@ test_negate (void)
}
/* All-one sequence will become 000000(size=6) after negating */
- memset (vector, 0x00, sizeof vector);
+ HDmemset(vector, 0x00, sizeof vector);
H5T__bit_set (vector, offset, size, 1);
/* negate the sequence */
@@ -689,10 +689,10 @@ test_set (void)
TESTING("bit set operations");
for (i=0; i<NTESTS; i++) {
- d_offset = HDrand() % (8*sizeof v2);
- size = (unsigned)HDrand() % (8*sizeof(v2));
+ d_offset = (size_t)HDrand() % (8 * sizeof v2);
+ size = (size_t)HDrand() % (8 * sizeof(v2));
size = MIN (size, 8*sizeof(v2)-d_offset);
- memset (v2, 0x00, sizeof v2);
+ HDmemset(v2, 0x00, sizeof v2);
/* Set some bits in v2 */
H5T__bit_set (v2, d_offset, size, TRUE);
@@ -806,10 +806,10 @@ test_clear (void)
TESTING("bit clear operations");
for (i=0; i<NTESTS; i++) {
- d_offset = HDrand() % (8*sizeof v2);
- size = (unsigned)HDrand() % (8*sizeof(v2));
+ d_offset = (size_t)HDrand() % (8 * sizeof v2);
+ size = (size_t)HDrand() % (8 * sizeof(v2));
size = MIN (size, 8*sizeof(v2)-d_offset);
- memset (v2, 0xff, sizeof v2);
+ HDmemset(v2, 0xff, sizeof v2);
/* Clear some bits in v2 */
H5T__bit_set (v2, d_offset, size, FALSE);
diff --git a/test/cmpd_dset.c b/test/cmpd_dset.c
index 22bf3a2..311b9bb 100644
--- a/test/cmpd_dset.c
+++ b/test/cmpd_dset.c
@@ -102,15 +102,18 @@ typedef struct {
float f, g, h[16], i, j;
double k, l, m, n;
} stype1;
+
typedef struct {
int a, b, c[8], d, e;
float f, g, h[16], i, j;
double k, l, m, n;
long o, p, q;
} stype2;
+
typedef struct {
int a, b, c[8], d, e;
} stype3;
+
typedef struct {
int a, b, c[8], d, e;
float f, g, h[16], i, j;
@@ -147,7 +150,7 @@ typedef struct {
* Moved this part of code from MAIN to TEST_COMPOUND function.
*-------------------------------------------------------------------------
*/
-static int
+static unsigned
test_compound (char *filename, hid_t fapl)
{
/* First dataset */
@@ -868,31 +871,31 @@ error:
*-------------------------------------------------------------------------
*/
static void
-initialize_stype1(unsigned char *buf, const size_t num)
+initialize_stype1(unsigned char *buf, size_t num)
{
int i, j;
stype1 *s_ptr;
- for (i=0; i<(int)num; i++) {
- s_ptr = (stype1*)buf + i;
- s_ptr->a = i*8+0;
- s_ptr->b = i*8+1;
- for(j=0; j<8; j++)
- s_ptr->c[j] = i*8+j;
- s_ptr->d = i*8+6;
- s_ptr->e = i*8+7;
-
- s_ptr->f = i*2/3;
- s_ptr->g = i*2/3+1;
- for(j=0; j<16; j++)
- s_ptr->h[j] = i*j/5+j;
- s_ptr->i = i*2/3+2;
- s_ptr->j = i*2/3+3;
-
- s_ptr->k = i/7+1;
- s_ptr->l = i/7+2;
- s_ptr->m = i/7+3;
- s_ptr->n = i/7+4;
+ for(i = 0; i < (int)num; i++) {
+ s_ptr = (stype1 *)buf + i;
+ s_ptr->a = i * 8 + 0;
+ s_ptr->b = i * 8 + 1;
+ for(j = 0; j < 8; j++)
+ s_ptr->c[j] = i * 8 + j;
+ s_ptr->d = i * 8 + 6;
+ s_ptr->e = i * 8 + 7;
+
+ s_ptr->f = (float)(i * 2 / 3);
+ s_ptr->g = (float)(i * 2 / 3 + 1);
+ for(j = 0; j < 16; j++)
+ s_ptr->h[j] = (float)(i * j / 5 + j);
+ s_ptr->i = (float)(i * 2 / 3 + 2);
+ s_ptr->j = (float)(i * 2 / 3 + 3);
+
+ s_ptr->k = i / 7 + 1;
+ s_ptr->l = i / 7 + 2;
+ s_ptr->m = i / 7 + 3;
+ s_ptr->n = i / 7 + 4;
}
}
@@ -911,35 +914,35 @@ initialize_stype1(unsigned char *buf, const size_t num)
*-------------------------------------------------------------------------
*/
static void
-initialize_stype2(unsigned char *buf, const size_t num)
+initialize_stype2(unsigned char *buf, size_t num)
{
size_t i, j;
stype2 *s_ptr;
- for (i=0; i<num; i++) {
- s_ptr = (stype2*)buf + i;
- s_ptr->a = i*8+0;
- s_ptr->b = i*8+1;
- for(j=0; j<8; j++)
- s_ptr->c[j] = i*8+j;
- s_ptr->d = i*8+6;
- s_ptr->e = i*8+7;
-
- s_ptr->f = i*2/3;
- s_ptr->g = i*2/3+1;
- for(j=0; j<16; j++)
- s_ptr->h[j] = i*j/5+j;
- s_ptr->i = i*2/3+2;
- s_ptr->j = i*2/3+3;
-
- s_ptr->k = i/7+1;
- s_ptr->l = i/7+2;
- s_ptr->m = i/7+3;
- s_ptr->n = i/7+4;
-
- s_ptr->o = i*3+0;
- s_ptr->p = i*3+1;
- s_ptr->q = i*3+2;
+ for(i = 0; i < num; i++) {
+ s_ptr = (stype2 *)buf + i;
+ s_ptr->a = (int)(i * 8 + 0);
+ s_ptr->b = (int)(i * 8 + 1);
+ for(j = 0; j < 8; j++)
+ s_ptr->c[j] = (int)(i * 8 + j);
+ s_ptr->d = (int)(i * 8 + 6);
+ s_ptr->e = (int)(i * 8 + 7);
+
+ s_ptr->f = (float)(i * 2 / 3);
+ s_ptr->g = (float)(i * 2 / 3 + 1);
+ for(j = 0; j < 16; j++)
+ s_ptr->h[j] = (float)(i * j / 5 + j);
+ s_ptr->i = (float)(i * 2 / 3 + 2);
+ s_ptr->j = (float)(i * 2 / 3 + 3);
+
+ s_ptr->k = (double)(i / 7 + 1);
+ s_ptr->l = (double)(i / 7 + 2);
+ s_ptr->m = (double)(i / 7 + 3);
+ s_ptr->n = (double)(i / 7 + 4);
+
+ s_ptr->o = (long)(i * 3 + 0);
+ s_ptr->p = (long)(i * 3 + 1);
+ s_ptr->q = (long)(i * 3 + 2);
}
}
@@ -958,19 +961,19 @@ initialize_stype2(unsigned char *buf, const size_t num)
*-------------------------------------------------------------------------
*/
static void
-initialize_stype3(unsigned char *buf, const size_t num)
+initialize_stype3(unsigned char *buf, size_t num)
{
int i, j;
stype3 *s_ptr;
- for (i=0; i<(int)num; i++) {
- s_ptr = (stype3*)buf + i;
- s_ptr->a = i*8+0;
- s_ptr->b = i*8+1;
- for(j=0; j<8; j++)
- s_ptr->c[j] = i*8+j;
- s_ptr->d = i*8+6;
- s_ptr->e = i*8+7;
+ for(i = 0; i < (int)num; i++) {
+ s_ptr = (stype3 *)buf + i;
+ s_ptr->a = i * 8 + 0;
+ s_ptr->b = i * 8 + 1;
+ for(j = 0; j < 8; j++)
+ s_ptr->c[j] = i * 8 + j;
+ s_ptr->d = i * 8 + 6;
+ s_ptr->e = i * 8 + 7;
}
}
@@ -989,39 +992,39 @@ initialize_stype3(unsigned char *buf, const size_t num)
*-------------------------------------------------------------------------
*/
static void
-initialize_stype4(unsigned char *buf, const size_t num)
+initialize_stype4(unsigned char *buf, size_t num)
{
size_t i, j;
stype4 *s_ptr;
- for (i=0; i<num; i++) {
- s_ptr = (stype4*)buf + i;
- s_ptr->a = i*8+0;
- s_ptr->b = i*8+1;
- for(j=0; j<8; j++)
- s_ptr->c[j] = i*8+j;
- s_ptr->d = i*8+6;
- s_ptr->e = i*8+7;
-
- s_ptr->f = i*2/3;
- s_ptr->g = i*2/3+1;
- for(j=0; j<16; j++)
- s_ptr->h[j] = i*j/5+j;
- s_ptr->i = i*2/3+2;
- s_ptr->j = i*2/3+3;
-
- s_ptr->k = i/7+1;
- s_ptr->l = i/7+2;
- s_ptr->m = i/7+3;
- s_ptr->n = i/7+4;
-
- s_ptr->o = i*3+0;
- s_ptr->p = i*3+1;
- s_ptr->q = i*3+2;
-
- s_ptr->r = i*5+1;
- s_ptr->s = i*5+2;
- s_ptr->t = i*5+3;
+ for(i = 0; i < num; i++) {
+ s_ptr = (stype4 *)buf + i;
+ s_ptr->a = (int)(i * 8 + 0);
+ s_ptr->b = (int)(i * 8 + 1);
+ for(j = 0; j < 8; j++)
+ s_ptr->c[j] = (int)(i * 8 + j);
+ s_ptr->d = (int)(i * 8 + 6);
+ s_ptr->e = (int)(i * 8 + 7);
+
+ s_ptr->f = (float)(i * 2 / 3);
+ s_ptr->g = (float)(i * 2 / 3 + 1);
+ for(j = 0; j < 16; j++)
+ s_ptr->h[j] = (float)(i * j / 5 + j);
+ s_ptr->i = (float)(i * 2 / 3 + 2);
+ s_ptr->j = (float)(i * 2 / 3 + 3);
+
+ s_ptr->k = (double)(i / 7 + 1);
+ s_ptr->l = (double)(i / 7 + 2);
+ s_ptr->m = (double)(i / 7 + 3);
+ s_ptr->n = (double)(i / 7 + 4);
+
+ s_ptr->o = (long)(i * 3 + 0);
+ s_ptr->p = (long)(i * 3 + 1);
+ s_ptr->q = (long)(i * 3 + 2);
+
+ s_ptr->r = (long long)(i * 5 + 1);
+ s_ptr->s = (long long)(i * 5 + 2);
+ s_ptr->t = (long long)(i * 5 + 3);
}
}
@@ -1349,7 +1352,7 @@ error:
* Modifications:
*-------------------------------------------------------------------------
*/
-static int
+static unsigned
test_hdf5_src_subset(char *filename, hid_t fapl)
{
hid_t file;
@@ -1554,7 +1557,7 @@ error:
* Modifications:
*-------------------------------------------------------------------------
*/
-static int
+static unsigned
test_hdf5_dst_subset(char *filename, hid_t fapl)
{
hid_t file;
@@ -1763,7 +1766,7 @@ error:
* Modifications:
*-------------------------------------------------------------------------
*/
-static int
+static unsigned
test_pack_ooo(void)
{
hid_t cmpd, sub_cmpd; /* Datatype IDs */
@@ -1788,7 +1791,7 @@ test_pack_ooo(void)
for(i=0; i<PACK_NMEMBS; i++) {
/* Generate index into free_order array */
num_free = PACK_NMEMBS - i;
- j = HDrand() % num_free;
+ j = (unsigned)HDrandom() % num_free;
/* Update order array at the randomly generated (but guaranteed to be
* free) location */
@@ -1800,7 +1803,7 @@ test_pack_ooo(void)
} /* end for */
/* Generate order to insert inner compound type */
- sub_cmpd_order = HDrand() % PACK_NMEMBS;
+ sub_cmpd_order = (unsigned)HDrandom() % PACK_NMEMBS;
for(extra_space=0; extra_space<2; extra_space ++) {
if(extra_space)
@@ -1995,7 +1998,7 @@ error:
* Modifications:
*-------------------------------------------------------------------------
*/
-static int
+static unsigned
test_ooo_order(char *filename)
{
hid_t file = -1; /* File ID */
diff --git a/test/dsets.c b/test/dsets.c
index bca57e5..fe6a0c0 100644
--- a/test/dsets.c
+++ b/test/dsets.c
@@ -2952,25 +2952,34 @@ test_nbit_float(hid_t file)
/* Define user-defined single-precision floating-point type for dataset */
datatype = H5Tcopy(H5T_IEEE_F32BE);
- if(H5Tset_fields(datatype, (size_t)26, (size_t)20, (size_t)6, (size_t)7, (size_t)13) < 0) goto error;
+ if(H5Tset_fields(datatype, (size_t)26, (size_t)20, (size_t)6, (size_t)7, (size_t)13) < 0)
+ FAIL_STACK_ERROR
offset = 7;
- if(H5Tset_offset(datatype,offset) < 0) goto error;
+ if(H5Tset_offset(datatype,offset) < 0)
+ FAIL_STACK_ERROR
precision = 20;
- if(H5Tset_precision(datatype,precision) < 0) goto error;
- if(H5Tset_size(datatype, (size_t)4) < 0) goto error;
- if(H5Tset_ebias(datatype, (size_t)31) < 0) goto error;
+ if(H5Tset_precision(datatype,precision) < 0)
+ FAIL_STACK_ERROR
+ if(H5Tset_size(datatype, (size_t)4) < 0)
+ FAIL_STACK_ERROR
+ if(H5Tset_ebias(datatype, (size_t)31) < 0)
+ FAIL_STACK_ERROR
/* Create the data space */
- if((space = H5Screate_simple(2, size, NULL)) < 0) goto error;
+ if((space = H5Screate_simple(2, size, NULL)) < 0)
+ FAIL_STACK_ERROR
/* Use nbit filter */
- if((dc = H5Pcreate(H5P_DATASET_CREATE)) < 0) goto error;
- if(H5Pset_chunk(dc, 2, chunk_size) < 0) goto error;
- if(H5Pset_nbit(dc) < 0) goto error;
+ if((dc = H5Pcreate(H5P_DATASET_CREATE)) < 0)
+ FAIL_STACK_ERROR
+ if(H5Pset_chunk(dc, 2, chunk_size) < 0)
+ FAIL_STACK_ERROR
+ if(H5Pset_nbit(dc) < 0)
+ FAIL_STACK_ERROR
/* Create the dataset */
- if((dataset = H5Dcreate2(file, DSET_NBIT_FLOAT_NAME, datatype,
- space, H5P_DEFAULT, dc, H5P_DEFAULT)) < 0) goto error;
+ if((dataset = H5Dcreate2(file, DSET_NBIT_FLOAT_NAME, datatype, space, H5P_DEFAULT, dc, H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
PASSED();
/*----------------------------------------------------------------------
@@ -2980,9 +2989,8 @@ test_nbit_float(hid_t file)
*/
TESTING(" nbit float (write)");
- if(H5Dwrite(dataset, H5T_NATIVE_FLOAT, H5S_ALL, H5S_ALL, H5P_DEFAULT,
- orig_data) < 0)
- goto error;
+ if(H5Dwrite(dataset, H5T_NATIVE_FLOAT, H5S_ALL, H5S_ALL, H5P_DEFAULT, orig_data) < 0)
+ FAIL_STACK_ERROR
PASSED();
@@ -2993,17 +3001,17 @@ test_nbit_float(hid_t file)
TESTING(" nbit float (read)");
/* Read the dataset back */
- if(H5Dread(dataset, H5T_NATIVE_FLOAT, H5S_ALL, H5S_ALL, H5P_DEFAULT,
- new_data) < 0)
- goto error;
+ if(H5Dread(dataset, H5T_NATIVE_FLOAT, H5S_ALL, H5S_ALL, H5P_DEFAULT, new_data) < 0)
+ FAIL_STACK_ERROR
/* Check that the values read are the same as the values written
* Assume size of int = size of float
*/
- for(i=0; i<(size_t)size[0]; i++) {
- for(j=0; j<(size_t)size[1]; j++) {
- if(!(orig_data[i][j]==orig_data[i][j])) continue; /* skip if value is NaN */
- if(new_data[i][j] != orig_data[i][j]) {
+ for(i = 0; i < (size_t)size[0]; i++) {
+ for(j = 0; j < (size_t)size[1]; j++) {
+ if(!(orig_data[i][j] == orig_data[i][j]))
+ continue; /* skip if value is NaN */
+ if(!H5_FLT_ABS_EQUAL(new_data[i][j], orig_data[i][j])) {
H5_FAILED();
printf(" Read different values than written.\n");
printf(" At index %lu,%lu\n", (unsigned long)i, (unsigned long)j);
@@ -3016,10 +3024,14 @@ test_nbit_float(hid_t file)
* Cleanup
*----------------------------------------------------------------------
*/
- if(H5Tclose(datatype) < 0) goto error;
- if(H5Pclose(dc) < 0) goto error;
- if(H5Sclose(space) < 0) goto error;
- if(H5Dclose(dataset) < 0) goto error;
+ if(H5Tclose(datatype) < 0)
+ FAIL_STACK_ERROR
+ if(H5Pclose(dc) < 0)
+ FAIL_STACK_ERROR
+ if(H5Sclose(space) < 0)
+ FAIL_STACK_ERROR
+ if(H5Dclose(dataset) < 0)
+ FAIL_STACK_ERROR
PASSED();
@@ -3077,25 +3089,34 @@ test_nbit_double(hid_t file)
/* Define user-defined doule-precision floating-point type for dataset */
datatype = H5Tcopy(H5T_IEEE_F64BE);
- if(H5Tset_fields(datatype, (size_t)55, (size_t)46, (size_t)9, (size_t)5, (size_t)41) < 0) goto error;
+ if(H5Tset_fields(datatype, (size_t)55, (size_t)46, (size_t)9, (size_t)5, (size_t)41) < 0)
+ FAIL_STACK_ERROR
offset = 5;
- if(H5Tset_offset(datatype,offset) < 0) goto error;
+ if(H5Tset_offset(datatype,offset) < 0)
+ FAIL_STACK_ERROR
precision = 51;
- if(H5Tset_precision(datatype,precision) < 0) goto error;
- if(H5Tset_size(datatype, (size_t)8) < 0) goto error;
- if(H5Tset_ebias(datatype, (size_t)255) < 0) goto error;
+ if(H5Tset_precision(datatype,precision) < 0)
+ FAIL_STACK_ERROR
+ if(H5Tset_size(datatype, (size_t)8) < 0)
+ FAIL_STACK_ERROR
+ if(H5Tset_ebias(datatype, (size_t)255) < 0)
+ FAIL_STACK_ERROR
/* Create the data space */
- if((space = H5Screate_simple(2, size, NULL)) < 0) goto error;
+ if((space = H5Screate_simple(2, size, NULL)) < 0)
+ FAIL_STACK_ERROR
/* Use nbit filter */
- if((dc = H5Pcreate(H5P_DATASET_CREATE)) < 0) goto error;
- if(H5Pset_chunk(dc, 2, chunk_size) < 0) goto error;
- if(H5Pset_nbit(dc) < 0) goto error;
+ if((dc = H5Pcreate(H5P_DATASET_CREATE)) < 0)
+ FAIL_STACK_ERROR
+ if(H5Pset_chunk(dc, 2, chunk_size) < 0)
+ FAIL_STACK_ERROR
+ if(H5Pset_nbit(dc) < 0)
+ FAIL_STACK_ERROR
/* Create the dataset */
- if((dataset = H5Dcreate2(file, DSET_NBIT_DOUBLE_NAME, datatype,
- space, H5P_DEFAULT, dc, H5P_DEFAULT)) < 0) goto error;
+ if((dataset = H5Dcreate2(file, DSET_NBIT_DOUBLE_NAME, datatype, space, H5P_DEFAULT, dc, H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
PASSED();
@@ -3106,9 +3127,8 @@ test_nbit_double(hid_t file)
*/
TESTING(" nbit double (write)");
- if(H5Dwrite(dataset, H5T_NATIVE_DOUBLE, H5S_ALL, H5S_ALL, H5P_DEFAULT,
- orig_data) < 0)
- goto error;
+ if(H5Dwrite(dataset, H5T_NATIVE_DOUBLE, H5S_ALL, H5S_ALL, H5P_DEFAULT, orig_data) < 0)
+ FAIL_STACK_ERROR
PASSED();
/*----------------------------------------------------------------------
@@ -3118,17 +3138,17 @@ test_nbit_double(hid_t file)
TESTING(" nbit double (read)");
/* Read the dataset back */
- if(H5Dread(dataset, H5T_NATIVE_DOUBLE, H5S_ALL, H5S_ALL, H5P_DEFAULT,
- new_data) < 0)
- goto error;
+ if(H5Dread(dataset, H5T_NATIVE_DOUBLE, H5S_ALL, H5S_ALL, H5P_DEFAULT, new_data) < 0)
+ FAIL_STACK_ERROR
/* Check that the values read are the same as the values written
* Assume size of long long = size of double
*/
- for(i=0; i<(size_t)size[0]; i++) {
- for(j=0; j<(size_t)size[1]; j++) {
- if(!(orig_data[i][j]==orig_data[i][j])) continue; /* skip if value is NaN */
- if(new_data[i][j] != orig_data[i][j]) {
+ for(i = 0; i < (size_t)size[0]; i++) {
+ for(j = 0; j < (size_t)size[1]; j++) {
+ if(!(orig_data[i][j] == orig_data[i][j]))
+ continue; /* skip if value is NaN */
+ if(!H5_DBL_ABS_EQUAL(new_data[i][j], orig_data[i][j])) {
H5_FAILED();
printf(" Read different values than written.\n");
printf(" At index %lu,%lu\n", (unsigned long)i, (unsigned long)j);
@@ -3141,10 +3161,14 @@ test_nbit_double(hid_t file)
* Cleanup
*----------------------------------------------------------------------
*/
- if(H5Tclose(datatype) < 0) goto error;
- if(H5Pclose(dc) < 0) goto error;
- if(H5Sclose(space) < 0) goto error;
- if(H5Dclose(dataset) < 0) goto error;
+ if(H5Tclose(datatype) < 0)
+ FAIL_STACK_ERROR
+ if(H5Pclose(dc) < 0)
+ FAIL_STACK_ERROR
+ if(H5Sclose(space) < 0)
+ FAIL_STACK_ERROR
+ if(H5Dclose(dataset) < 0)
+ FAIL_STACK_ERROR
PASSED();
@@ -3330,73 +3354,103 @@ test_nbit_compound(hid_t file)
TESTING(" nbit compound (setup)");
/* Define datatypes of members of compound datatype */
- i_tid=H5Tcopy(H5T_NATIVE_INT);
- c_tid=H5Tcopy(H5T_NATIVE_CHAR);
- s_tid=H5Tcopy(H5T_NATIVE_SHORT);
- f_tid=H5Tcopy(H5T_IEEE_F32BE);
+ if((i_tid = H5Tcopy(H5T_NATIVE_INT)) < 0)
+ FAIL_STACK_ERROR
+ if((c_tid = H5Tcopy(H5T_NATIVE_CHAR)) < 0)
+ FAIL_STACK_ERROR
+ if((s_tid = H5Tcopy(H5T_NATIVE_SHORT)) < 0)
+ FAIL_STACK_ERROR
+ if((f_tid = H5Tcopy(H5T_IEEE_F32BE)) < 0)
+ FAIL_STACK_ERROR
/* Set precision and offset etc. */
- if(H5Tset_precision(i_tid,precision[0]) < 0) goto error;
- if(H5Tset_offset(i_tid,offset[0]) < 0) goto error;
+ if(H5Tset_precision(i_tid,precision[0]) < 0)
+ FAIL_STACK_ERROR
+ if(H5Tset_offset(i_tid,offset[0]) < 0)
+ FAIL_STACK_ERROR
- if(H5Tset_precision(c_tid,precision[1]) < 0) goto error;
- if(H5Tset_offset(c_tid,offset[1]) < 0) goto error;
+ if(H5Tset_precision(c_tid,precision[1]) < 0)
+ FAIL_STACK_ERROR
+ if(H5Tset_offset(c_tid,offset[1]) < 0)
+ FAIL_STACK_ERROR
- if(H5Tset_precision(s_tid,precision[2]) < 0) goto error;
- if(H5Tset_offset(s_tid,offset[2]) < 0) goto error;
+ if(H5Tset_precision(s_tid,precision[2]) < 0)
+ FAIL_STACK_ERROR
+ if(H5Tset_offset(s_tid,offset[2]) < 0)
+ FAIL_STACK_ERROR
- if(H5Tset_fields(f_tid, (size_t)26, (size_t)20, (size_t)6, (size_t)7, (size_t)13) < 0) goto error;
- if(H5Tset_offset(f_tid, (size_t)7) < 0) goto error;
- if(H5Tset_precision(f_tid, (size_t)20) < 0) goto error;
- if(H5Tset_size(f_tid, (size_t)4) < 0) goto error;
- if(H5Tset_ebias(f_tid, (size_t)31) < 0) goto error;
+ if(H5Tset_fields(f_tid, (size_t)26, (size_t)20, (size_t)6, (size_t)7, (size_t)13) < 0)
+ FAIL_STACK_ERROR
+ if(H5Tset_offset(f_tid, (size_t)7) < 0)
+ FAIL_STACK_ERROR
+ if(H5Tset_precision(f_tid, (size_t)20) < 0)
+ FAIL_STACK_ERROR
+ if(H5Tset_size(f_tid, (size_t)4) < 0)
+ FAIL_STACK_ERROR
+ if(H5Tset_ebias(f_tid, (size_t)31) < 0)
+ FAIL_STACK_ERROR
/* Create a memory compound datatype before setting the order */
- mem_cmpd_tid = H5Tcreate(H5T_COMPOUND, sizeof(atomic));
- if(H5Tinsert(mem_cmpd_tid, "i", HOFFSET(atomic, i), i_tid) < 0) goto error;
- if(H5Tinsert(mem_cmpd_tid, "c", HOFFSET(atomic, c), c_tid) < 0) goto error;
- if(H5Tinsert(mem_cmpd_tid, "s", HOFFSET(atomic, s), s_tid) < 0) goto error;
- if(H5Tinsert(mem_cmpd_tid, "f", HOFFSET(atomic, f), H5T_NATIVE_FLOAT) < 0) goto error;
+ if((mem_cmpd_tid = H5Tcreate(H5T_COMPOUND, sizeof(atomic))) < 0)
+ FAIL_STACK_ERROR
+ if(H5Tinsert(mem_cmpd_tid, "i", HOFFSET(atomic, i), i_tid) < 0)
+ FAIL_STACK_ERROR
+ if(H5Tinsert(mem_cmpd_tid, "c", HOFFSET(atomic, c), c_tid) < 0)
+ FAIL_STACK_ERROR
+ if(H5Tinsert(mem_cmpd_tid, "s", HOFFSET(atomic, s), s_tid) < 0)
+ FAIL_STACK_ERROR
+ if(H5Tinsert(mem_cmpd_tid, "f", HOFFSET(atomic, f), H5T_NATIVE_FLOAT) < 0)
+ FAIL_STACK_ERROR
/* Create a dataset compound datatype and insert some atomic types */
- cmpd_tid = H5Tcreate(H5T_COMPOUND, sizeof(atomic));
- if(H5Tinsert(cmpd_tid, "i", HOFFSET(atomic, i), i_tid) < 0) goto error;
- if(H5Tinsert(cmpd_tid, "c", HOFFSET(atomic, c), c_tid) < 0) goto error;
- if(H5Tinsert(cmpd_tid, "s", HOFFSET(atomic, s), s_tid) < 0) goto error;
- if(H5Tinsert(cmpd_tid, "f", HOFFSET(atomic, f), f_tid) < 0) goto error;
+ if((cmpd_tid = H5Tcreate(H5T_COMPOUND, sizeof(atomic))) < 0)
+ FAIL_STACK_ERROR
+ if(H5Tinsert(cmpd_tid, "i", HOFFSET(atomic, i), i_tid) < 0)
+ FAIL_STACK_ERROR
+ if(H5Tinsert(cmpd_tid, "c", HOFFSET(atomic, c), c_tid) < 0)
+ FAIL_STACK_ERROR
+ if(H5Tinsert(cmpd_tid, "s", HOFFSET(atomic, s), s_tid) < 0)
+ FAIL_STACK_ERROR
+ if(H5Tinsert(cmpd_tid, "f", HOFFSET(atomic, f), f_tid) < 0)
+ FAIL_STACK_ERROR
/* Set order of dataset compound datatype */
- if(H5Tset_order(cmpd_tid, H5T_ORDER_BE) < 0) goto error;
+ if(H5Tset_order(cmpd_tid, H5T_ORDER_BE) < 0)
+ FAIL_STACK_ERROR
/* Create the data space */
- if((space = H5Screate_simple(2, size, NULL)) < 0) goto error;
+ if((space = H5Screate_simple(2, size, NULL)) < 0)
+ FAIL_STACK_ERROR
/* Use nbit filter */
- if((dc = H5Pcreate(H5P_DATASET_CREATE)) < 0) goto error;
- if(H5Pset_chunk(dc, 2, chunk_size) < 0) goto error;
- if(H5Pset_nbit(dc) < 0) goto error;
+ if((dc = H5Pcreate(H5P_DATASET_CREATE)) < 0)
+ FAIL_STACK_ERROR
+ if(H5Pset_chunk(dc, 2, chunk_size) < 0)
+ FAIL_STACK_ERROR
+ if(H5Pset_nbit(dc) < 0)
+ FAIL_STACK_ERROR
/* Create the dataset */
- if((dataset = H5Dcreate2(file, DSET_NBIT_COMPOUND_NAME, cmpd_tid,
- space, H5P_DEFAULT, dc, H5P_DEFAULT)) < 0) goto error;
+ if((dataset = H5Dcreate2(file, DSET_NBIT_COMPOUND_NAME, cmpd_tid, space, H5P_DEFAULT, dc, H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
/* Initialize data, assuming size of long long >= size of member datatypes */
- for(i= 0;i< (size_t)size[0]; i++)
- for(j = 0; j < (size_t)size[1]; j++) {
- power = HDpow(2.0F, (double)(precision[0]-1));
- orig_data[i][j].i = (int)(((long long)HDrandom() % (long long)power) << offset[0]);
- power = HDpow(2.0F, (double)(precision[1]-1));
- orig_data[i][j].c = (char)(((long long)HDrandom() % (long long)power) << offset[1]);
- power = HDpow(2.0F, (double)(precision[2]-1));
- orig_data[i][j].s = (short)(((long long)HDrandom() % (long long)power) << offset[2]);
- orig_data[i][j].f = float_val[i][j];
-
- /* some even-numbered integer values are negtive */
- if((i*size[1]+j+1)%2 == 0) {
- orig_data[i][j].i = -orig_data[i][j].i;
- orig_data[i][j].s = (short)-orig_data[i][j].s;
+ for(i = 0; i < (size_t)size[0]; i++)
+ for(j = 0; j < (size_t)size[1]; j++) {
+ power = HDpow(2.0F, (double)(precision[0]-1));
+ orig_data[i][j].i = (int)(((long long)HDrandom() % (long long)power) << offset[0]);
+ power = HDpow(2.0F, (double)(precision[1]-1));
+ orig_data[i][j].c = (char)(((long long)HDrandom() % (long long)power) << offset[1]);
+ power = HDpow(2.0F, (double)(precision[2]-1));
+ orig_data[i][j].s = (short)(((long long)HDrandom() % (long long)power) << offset[2]);
+ orig_data[i][j].f = float_val[i][j];
+
+ /* some even-numbered integer values are negtive */
+ if((i * size[1] + j + 1) % 2 == 0) {
+ orig_data[i][j].i = -orig_data[i][j].i;
+ orig_data[i][j].s = (short)-orig_data[i][j].s;
+ }
}
- }
PASSED();
@@ -3407,9 +3461,8 @@ test_nbit_compound(hid_t file)
*/
TESTING(" nbit compound (write)");
- if(H5Dwrite(dataset, mem_cmpd_tid, H5S_ALL, H5S_ALL, H5P_DEFAULT,
- orig_data) < 0)
- goto error;
+ if(H5Dwrite(dataset, mem_cmpd_tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, orig_data) < 0)
+ FAIL_STACK_ERROR
PASSED();
/*----------------------------------------------------------------------
@@ -3419,9 +3472,8 @@ test_nbit_compound(hid_t file)
TESTING(" nbit compound (read)");
/* Read the dataset back */
- if(H5Dread(dataset, mem_cmpd_tid, H5S_ALL, H5S_ALL, H5P_DEFAULT,
- new_data) < 0)
- goto error;
+ if(H5Dread(dataset, mem_cmpd_tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, new_data) < 0)
+ FAIL_STACK_ERROR
/* Check that the values read are the same as the values written
* Use mask for checking the significant bits, ignoring the padding bits
@@ -3429,12 +3481,12 @@ test_nbit_compound(hid_t file)
i_mask = ~((unsigned)~0 << (precision[0] + offset[0])) & ((unsigned)~0 << offset[0]);
c_mask = ~((unsigned)~0 << (precision[1] + offset[1])) & ((unsigned)~0 << offset[1]);
s_mask = ~((unsigned)~0 << (precision[2] + offset[2])) & ((unsigned)~0 << offset[2]);
- for(i=0; i<size[0]; i++) {
- for(j=0; j<size[1]; j++) {
+ for(i = 0; i < size[0]; i++) {
+ for(j = 0; j < size[1]; j++) {
if(((unsigned)new_data[i][j].i & i_mask) != ((unsigned)orig_data[i][j].i & i_mask) ||
((unsigned)new_data[i][j].c & c_mask) != ((unsigned)orig_data[i][j].c & c_mask) ||
((unsigned)new_data[i][j].s & s_mask) != ((unsigned)orig_data[i][j].s & s_mask) ||
- (orig_data[i][j].f==orig_data[i][j].f && new_data[i][j].f != orig_data[i][j].f))
+ (orig_data[i][j].f == orig_data[i][j].f && !H5_FLT_ABS_EQUAL(new_data[i][j].f, orig_data[i][j].f)))
{
H5_FAILED();
printf(" Read different values than written.\n");
@@ -3448,15 +3500,24 @@ test_nbit_compound(hid_t file)
* Cleanup
*----------------------------------------------------------------------
*/
- if(H5Tclose(i_tid) < 0) goto error;
- if(H5Tclose(c_tid) < 0) goto error;
- if(H5Tclose(s_tid) < 0) goto error;
- if(H5Tclose(f_tid) < 0) goto error;
- if(H5Tclose(cmpd_tid) < 0) goto error;
- if(H5Tclose(mem_cmpd_tid) < 0) goto error;
- if(H5Pclose(dc) < 0) goto error;
- if(H5Sclose(space) < 0) goto error;
- if(H5Dclose(dataset) < 0) goto error;
+ if(H5Tclose(i_tid) < 0)
+ FAIL_STACK_ERROR
+ if(H5Tclose(c_tid) < 0)
+ FAIL_STACK_ERROR
+ if(H5Tclose(s_tid) < 0)
+ FAIL_STACK_ERROR
+ if(H5Tclose(f_tid) < 0)
+ FAIL_STACK_ERROR
+ if(H5Tclose(cmpd_tid) < 0)
+ FAIL_STACK_ERROR
+ if(H5Tclose(mem_cmpd_tid) < 0)
+ FAIL_STACK_ERROR
+ if(H5Pclose(dc) < 0)
+ FAIL_STACK_ERROR
+ if(H5Sclose(space) < 0)
+ FAIL_STACK_ERROR
+ if(H5Dclose(dataset) < 0)
+ FAIL_STACK_ERROR
PASSED();
@@ -3525,119 +3586,169 @@ test_nbit_compound_2(hid_t file)
TESTING(" nbit compound complex (setup)");
/* Define datatypes of members of compound datatype */
- i_tid=H5Tcopy(H5T_NATIVE_INT);
- c_tid=H5Tcopy(H5T_NATIVE_CHAR);
- s_tid=H5Tcopy(H5T_NATIVE_SHORT);
- v_tid=H5Tcopy(H5T_NATIVE_UINT);
- f_tid=H5Tcopy(H5T_IEEE_F32BE);
+ if((i_tid = H5Tcopy(H5T_NATIVE_INT)) < 0)
+ FAIL_STACK_ERROR
+ if((c_tid = H5Tcopy(H5T_NATIVE_CHAR)) < 0)
+ FAIL_STACK_ERROR
+ if((s_tid = H5Tcopy(H5T_NATIVE_SHORT)) < 0)
+ FAIL_STACK_ERROR
+ if((v_tid = H5Tcopy(H5T_NATIVE_UINT)) < 0)
+ FAIL_STACK_ERROR
+ if((f_tid = H5Tcopy(H5T_IEEE_F32BE)) < 0)
+ FAIL_STACK_ERROR
/* Set precision and offset etc. of atomic compound datatype members */
- if(H5Tset_precision(i_tid,precision[0]) < 0) goto error;
- if(H5Tset_offset(i_tid,offset[0]) < 0) goto error;
+ if(H5Tset_precision(i_tid,precision[0]) < 0)
+ FAIL_STACK_ERROR
+ if(H5Tset_offset(i_tid,offset[0]) < 0)
+ FAIL_STACK_ERROR
- if(H5Tset_precision(c_tid,precision[1]) < 0) goto error;
- if(H5Tset_offset(c_tid,offset[1]) < 0) goto error;
+ if(H5Tset_precision(c_tid,precision[1]) < 0)
+ FAIL_STACK_ERROR
+ if(H5Tset_offset(c_tid,offset[1]) < 0)
+ FAIL_STACK_ERROR
- if(H5Tset_precision(s_tid,precision[2]) < 0) goto error;
- if(H5Tset_offset(s_tid,offset[2]) < 0) goto error;
+ if(H5Tset_precision(s_tid,precision[2]) < 0)
+ FAIL_STACK_ERROR
+ if(H5Tset_offset(s_tid,offset[2]) < 0)
+ FAIL_STACK_ERROR
- if(H5Tset_fields(f_tid, (size_t)26, (size_t)20, (size_t)6, (size_t)7, (size_t)13) < 0) goto error;
- if(H5Tset_offset(f_tid, (size_t)7) < 0) goto error;
- if(H5Tset_precision(f_tid, (size_t)20) < 0) goto error;
- if(H5Tset_size(f_tid, (size_t)4) < 0) goto error;
- if(H5Tset_ebias(f_tid, (size_t)31) < 0) goto error;
+ if(H5Tset_fields(f_tid, (size_t)26, (size_t)20, (size_t)6, (size_t)7, (size_t)13) < 0)
+ FAIL_STACK_ERROR
+ if(H5Tset_offset(f_tid, (size_t)7) < 0)
+ FAIL_STACK_ERROR
+ if(H5Tset_precision(f_tid, (size_t)20) < 0)
+ FAIL_STACK_ERROR
+ if(H5Tset_size(f_tid, (size_t)4) < 0)
+ FAIL_STACK_ERROR
+ if(H5Tset_ebias(f_tid, (size_t)31) < 0)
+ FAIL_STACK_ERROR
/* Create a memory atomic compound datatype before setting the order */
- mem_cmpd_tid1 = H5Tcreate(H5T_COMPOUND, sizeof(atomic));
- if(H5Tinsert(mem_cmpd_tid1, "i", HOFFSET(atomic, i), i_tid) < 0) goto error;
- if(H5Tinsert(mem_cmpd_tid1, "c", HOFFSET(atomic, c), c_tid) < 0) goto error;
- if(H5Tinsert(mem_cmpd_tid1, "s", HOFFSET(atomic, s), s_tid) < 0) goto error;
- if(H5Tinsert(mem_cmpd_tid1, "f", HOFFSET(atomic, f), H5T_NATIVE_FLOAT) < 0) goto error;
+ if((mem_cmpd_tid1 = H5Tcreate(H5T_COMPOUND, sizeof(atomic))) < 0)
+ FAIL_STACK_ERROR
+ if(H5Tinsert(mem_cmpd_tid1, "i", HOFFSET(atomic, i), i_tid) < 0)
+ FAIL_STACK_ERROR
+ if(H5Tinsert(mem_cmpd_tid1, "c", HOFFSET(atomic, c), c_tid) < 0)
+ FAIL_STACK_ERROR
+ if(H5Tinsert(mem_cmpd_tid1, "s", HOFFSET(atomic, s), s_tid) < 0)
+ FAIL_STACK_ERROR
+ if(H5Tinsert(mem_cmpd_tid1, "f", HOFFSET(atomic, f), H5T_NATIVE_FLOAT) < 0)
+ FAIL_STACK_ERROR
/* Create a dataset atomic compound datatype and insert some atomic types */
- cmpd_tid1 = H5Tcreate(H5T_COMPOUND, sizeof(atomic));
- if(H5Tinsert(cmpd_tid1, "i", HOFFSET(atomic, i), i_tid) < 0) goto error;
- if(H5Tinsert(cmpd_tid1, "c", HOFFSET(atomic, c), c_tid) < 0) goto error;
- if(H5Tinsert(cmpd_tid1, "s", HOFFSET(atomic, s), s_tid) < 0) goto error;
- if(H5Tinsert(cmpd_tid1, "f", HOFFSET(atomic, f), f_tid) < 0) goto error;
+ if((cmpd_tid1 = H5Tcreate(H5T_COMPOUND, sizeof(atomic))) < 0)
+ FAIL_STACK_ERROR
+ if(H5Tinsert(cmpd_tid1, "i", HOFFSET(atomic, i), i_tid) < 0)
+ FAIL_STACK_ERROR
+ if(H5Tinsert(cmpd_tid1, "c", HOFFSET(atomic, c), c_tid) < 0)
+ FAIL_STACK_ERROR
+ if(H5Tinsert(cmpd_tid1, "s", HOFFSET(atomic, s), s_tid) < 0)
+ FAIL_STACK_ERROR
+ if(H5Tinsert(cmpd_tid1, "f", HOFFSET(atomic, f), f_tid) < 0)
+ FAIL_STACK_ERROR
/* Set order of dataset compound datatype */
- if(H5Tset_order(cmpd_tid1, H5T_ORDER_BE) < 0) goto error;
+ if(H5Tset_order(cmpd_tid1, H5T_ORDER_BE) < 0)
+ FAIL_STACK_ERROR
/* Set precision and offset of the other data member */
- if(H5Tset_precision(v_tid,precision[3]) < 0) goto error;
- if(H5Tset_offset(v_tid,offset[3]) < 0) goto error;
+ if(H5Tset_precision(v_tid,precision[3]) < 0)
+ FAIL_STACK_ERROR
+ if(H5Tset_offset(v_tid,offset[3]) < 0)
+ FAIL_STACK_ERROR
/* Create the simple array datatype */
- base_tid = H5Tcopy(H5T_NATIVE_CHAR);
- if(H5Tset_precision(base_tid,precision[4]) < 0) goto error;
- if(H5Tset_offset(base_tid,offset[4]) < 0) goto error;
- array_tid = H5Tarray_create2(base_tid, 2, array_dims);
+ if((base_tid = H5Tcopy(H5T_NATIVE_CHAR)) < 0)
+ FAIL_STACK_ERROR
+ if(H5Tset_precision(base_tid,precision[4]) < 0)
+ FAIL_STACK_ERROR
+ if(H5Tset_offset(base_tid,offset[4]) < 0)
+ FAIL_STACK_ERROR
+ if((array_tid = H5Tarray_create2(base_tid, 2, array_dims)) < 0)
+ FAIL_STACK_ERROR
/* Create the complex memory and dataset array datatype */
- array_cmplx_tid = H5Tarray_create2(cmpd_tid1, 2, array_dims);
- mem_array_cmplx_tid = H5Tarray_create2(mem_cmpd_tid1, 2, array_dims);
+ if((array_cmplx_tid = H5Tarray_create2(cmpd_tid1, 2, array_dims)) < 0)
+ FAIL_STACK_ERROR
+ if((mem_array_cmplx_tid = H5Tarray_create2(mem_cmpd_tid1, 2, array_dims)) < 0)
+ FAIL_STACK_ERROR
/* Create a memory complex compound datatype before setting the order */
- mem_cmpd_tid2 = H5Tcreate(H5T_COMPOUND, sizeof(complex));
- if(H5Tinsert(mem_cmpd_tid2, "a", HOFFSET(complex, a), mem_cmpd_tid1) < 0) goto error;
- if(H5Tinsert(mem_cmpd_tid2, "v", HOFFSET(complex, v), v_tid) < 0) goto error;
- if(H5Tinsert(mem_cmpd_tid2, "b", HOFFSET(complex, b), array_tid) < 0) goto error;
- if(H5Tinsert(mem_cmpd_tid2, "d", HOFFSET(complex, d), mem_array_cmplx_tid) < 0) goto error;
+ if((mem_cmpd_tid2 = H5Tcreate(H5T_COMPOUND, sizeof(complex))) < 0)
+ FAIL_STACK_ERROR
+ if(H5Tinsert(mem_cmpd_tid2, "a", HOFFSET(complex, a), mem_cmpd_tid1) < 0)
+ FAIL_STACK_ERROR
+ if(H5Tinsert(mem_cmpd_tid2, "v", HOFFSET(complex, v), v_tid) < 0)
+ FAIL_STACK_ERROR
+ if(H5Tinsert(mem_cmpd_tid2, "b", HOFFSET(complex, b), array_tid) < 0)
+ FAIL_STACK_ERROR
+ if(H5Tinsert(mem_cmpd_tid2, "d", HOFFSET(complex, d), mem_array_cmplx_tid) < 0)
+ FAIL_STACK_ERROR
/* Set order of dataset other complex compound member datatype */
- if(H5Tset_order(v_tid, H5T_ORDER_BE) < 0) goto error;
+ if(H5Tset_order(v_tid, H5T_ORDER_BE) < 0)
+ FAIL_STACK_ERROR
/* Create a dataset complex compound datatype and insert members */
- cmpd_tid2 = H5Tcreate(H5T_COMPOUND, sizeof(complex));
- if(H5Tinsert(cmpd_tid2, "a", HOFFSET(complex, a), cmpd_tid1) < 0) goto error;
- if(H5Tinsert(cmpd_tid2, "v", HOFFSET(complex, v), v_tid) < 0) goto error;
- if(H5Tinsert(cmpd_tid2, "b", HOFFSET(complex, b), array_tid) < 0) goto error;
- if(H5Tinsert(cmpd_tid2, "d", HOFFSET(complex, d), array_cmplx_tid) < 0) goto error;
+ if((cmpd_tid2 = H5Tcreate(H5T_COMPOUND, sizeof(complex))) < 0)
+ FAIL_STACK_ERROR
+ if(H5Tinsert(cmpd_tid2, "a", HOFFSET(complex, a), cmpd_tid1) < 0)
+ FAIL_STACK_ERROR
+ if(H5Tinsert(cmpd_tid2, "v", HOFFSET(complex, v), v_tid) < 0)
+ FAIL_STACK_ERROR
+ if(H5Tinsert(cmpd_tid2, "b", HOFFSET(complex, b), array_tid) < 0)
+ FAIL_STACK_ERROR
+ if(H5Tinsert(cmpd_tid2, "d", HOFFSET(complex, d), array_cmplx_tid) < 0)
+ FAIL_STACK_ERROR
/* Create the data space */
- if((space = H5Screate_simple(2, size, NULL)) < 0) goto error;
+ if((space = H5Screate_simple(2, size, NULL)) < 0)
+ FAIL_STACK_ERROR
/* Use nbit filter */
- if((dc = H5Pcreate(H5P_DATASET_CREATE)) < 0) goto error;
- if(H5Pset_chunk(dc, 2, chunk_size) < 0) goto error;
- if(H5Pset_nbit(dc) < 0) goto error;
+ if((dc = H5Pcreate(H5P_DATASET_CREATE)) < 0)
+ FAIL_STACK_ERROR
+ if(H5Pset_chunk(dc, 2, chunk_size) < 0)
+ FAIL_STACK_ERROR
+ if(H5Pset_nbit(dc) < 0)
+ FAIL_STACK_ERROR
/* Create the dataset */
- if((dataset = H5Dcreate2(file, DSET_NBIT_COMPOUND_NAME_2, cmpd_tid2,
- space, H5P_DEFAULT, dc, H5P_DEFAULT)) < 0) goto error;
+ if((dataset = H5Dcreate2(file, DSET_NBIT_COMPOUND_NAME_2, cmpd_tid2, space, H5P_DEFAULT, dc, H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
/* Initialize data, assuming size of long long >= size of member datatypes */
for(i= 0;i< (size_t)size[0]; i++)
- for(j = 0; j < (size_t)size[1]; j++) {
- power = HDpow(2.0F, (double)(precision[0]-1));
- orig_data[i][j].a.i = (int)(((long long)HDrandom() % (long long)power) << offset[0]);
- power = HDpow(2.0F, (double)(precision[1]-1));
- orig_data[i][j].a.c = (char)(((long long)HDrandom() % (long long)power) << offset[1]);
- power = HDpow(2.0F, (double)(precision[2]-1));
- orig_data[i][j].a.s = (short)(-((long long)HDrandom() % (long long)power) << offset[2]);
- orig_data[i][j].a.f = float_val[i][j];
-
- power = HDpow(2.0F, (double)precision[3]);
- orig_data[i][j].v = (unsigned int)(((long long)HDrandom() % (long long)power) << offset[3]);
-
- for(m = 0; m < (size_t)array_dims[0]; m++)
- for(n = 0; n < (size_t)array_dims[1]; n++) {
- power = HDpow(2.0F, (double)(precision[4]-1));
- orig_data[i][j].b[m][n] = (char)(((long long)HDrandom() % (long long)power) << offset[4]);
- } /* end for */
-
- for(m = 0; m < (size_t)array_dims[0]; m++)
- for(n = 0; n < (size_t)array_dims[1]; n++) {
+ for(j = 0; j < (size_t)size[1]; j++) {
power = HDpow(2.0F, (double)(precision[0]-1));
- orig_data[i][j].d[m][n].i = (int)(-((long long)HDrandom() % (long long)power) << offset[0]);
+ orig_data[i][j].a.i = (int)(((long long)HDrandom() % (long long)power) << offset[0]);
power = HDpow(2.0F, (double)(precision[1]-1));
- orig_data[i][j].d[m][n].c = (char)(((long long)HDrandom() % (long long)power) << offset[1]);
+ orig_data[i][j].a.c = (char)(((long long)HDrandom() % (long long)power) << offset[1]);
power = HDpow(2.0F, (double)(precision[2]-1));
- orig_data[i][j].d[m][n].s = (short)(((long long)HDrandom() % (long long)power) << offset[2]);
- orig_data[i][j].d[m][n].f = float_val[i][j];
- } /* end for */
- } /* end for */
+ orig_data[i][j].a.s = (short)(-((long long)HDrandom() % (long long)power) << offset[2]);
+ orig_data[i][j].a.f = float_val[i][j];
+
+ power = HDpow(2.0F, (double)precision[3]);
+ orig_data[i][j].v = (unsigned int)(((long long)HDrandom() % (long long)power) << offset[3]);
+
+ for(m = 0; m < (size_t)array_dims[0]; m++)
+ for(n = 0; n < (size_t)array_dims[1]; n++) {
+ power = HDpow(2.0F, (double)(precision[4]-1));
+ orig_data[i][j].b[m][n] = (char)(((long long)HDrandom() % (long long)power) << offset[4]);
+ } /* end for */
+
+ for(m = 0; m < (size_t)array_dims[0]; m++)
+ for(n = 0; n < (size_t)array_dims[1]; n++) {
+ power = HDpow(2.0F, (double)(precision[0]-1));
+ orig_data[i][j].d[m][n].i = (int)(-((long long)HDrandom() % (long long)power) << offset[0]);
+ power = HDpow(2.0F, (double)(precision[1]-1));
+ orig_data[i][j].d[m][n].c = (char)(((long long)HDrandom() % (long long)power) << offset[1]);
+ power = HDpow(2.0F, (double)(precision[2]-1));
+ orig_data[i][j].d[m][n].s = (short)(((long long)HDrandom() % (long long)power) << offset[2]);
+ orig_data[i][j].d[m][n].f = float_val[i][j];
+ } /* end for */
+ } /* end for */
PASSED();
@@ -3648,9 +3759,8 @@ test_nbit_compound_2(hid_t file)
*/
TESTING(" nbit compound complex (write)");
- if(H5Dwrite(dataset, mem_cmpd_tid2, H5S_ALL, H5S_ALL, H5P_DEFAULT,
- orig_data) < 0)
- goto error;
+ if(H5Dwrite(dataset, mem_cmpd_tid2, H5S_ALL, H5S_ALL, H5P_DEFAULT, orig_data) < 0)
+ FAIL_STACK_ERROR
PASSED();
/*----------------------------------------------------------------------
@@ -3660,9 +3770,8 @@ test_nbit_compound_2(hid_t file)
TESTING(" nbit compound complex (read)");
/* Read the dataset back */
- if(H5Dread(dataset, mem_cmpd_tid2, H5S_ALL, H5S_ALL, H5P_DEFAULT,
- new_data) < 0)
- goto error;
+ if(H5Dread(dataset, mem_cmpd_tid2, H5S_ALL, H5S_ALL, H5P_DEFAULT, new_data) < 0)
+ FAIL_STACK_ERROR
/* Check that the values read are the same as the values written
* Use mask for checking the significant bits, ignoring the padding bits
@@ -3683,63 +3792,77 @@ test_nbit_compound_2(hid_t file)
s_mask = ~((unsigned)~0 << (precision[2] + offset[2])) & ((unsigned)~0 << offset[2]);
b_mask = ~((unsigned)~0 << (precision[4] + offset[4])) & ((unsigned)~0 << offset[4]);
for(i=0; i<(size_t)size[0]; i++) {
- for(j=0; j<(size_t)size[1]; j++) {
- b_failed = 0;
- d_failed = 0;
+ for(j=0; j<(size_t)size[1]; j++) {
+ b_failed = 0;
+ d_failed = 0;
- for(m = 0; m < (size_t)array_dims[0]; m++)
- for(n = 0; n < (size_t)array_dims[1]; n++)
- if(((unsigned)new_data[i][j].b[m][n] & b_mask)!=((unsigned)orig_data[i][j].b[m][n] & b_mask)) {
+ for(m = 0; m < (size_t)array_dims[0]; m++)
+ for(n = 0; n < (size_t)array_dims[1]; n++)
+ if(((unsigned)new_data[i][j].b[m][n] & b_mask)!=((unsigned)orig_data[i][j].b[m][n] & b_mask)) {
b_failed = 1;
goto out;
- }
-
- for(m = 0; m < (size_t)array_dims[0]; m++)
- for(n = 0; n < (size_t)array_dims[1]; n++)
- if(((unsigned)new_data[i][j].d[m][n].i & i_mask) != ((unsigned)orig_data[i][j].d[m][n].i & i_mask)||
- ((unsigned)new_data[i][j].d[m][n].c & c_mask) != ((unsigned)orig_data[i][j].d[m][n].c & c_mask)||
- ((unsigned)new_data[i][j].d[m][n].s & s_mask) != ((unsigned)orig_data[i][j].d[m][n].s & s_mask)||
- (new_data[i][j].d[m][n].f==new_data[i][j].d[m][n].f &&
- new_data[i][j].d[m][n].f != new_data[i][j].d[m][n].f)) {
- d_failed = 1;
- goto out;
- }
-
- out:
- if(((unsigned)new_data[i][j].a.i & i_mask) != ((unsigned)orig_data[i][j].a.i & i_mask)||
- ((unsigned)new_data[i][j].a.c & c_mask) != ((unsigned)orig_data[i][j].a.c & c_mask)||
- ((unsigned)new_data[i][j].a.s & s_mask) != ((unsigned)orig_data[i][j].a.s & s_mask)||
- (new_data[i][j].a.f==new_data[i][j].a.f &&
- new_data[i][j].a.f != new_data[i][j].a.f)||
- new_data[i][j].v != orig_data[i][j].v || b_failed || d_failed) {
- H5_FAILED();
- printf(" Read different values than written.\n");
- printf(" At index %lu,%lu\n", (unsigned long)i, (unsigned long)j);
- goto error;
+ }
+
+ for(m = 0; m < (size_t)array_dims[0]; m++)
+ for(n = 0; n < (size_t)array_dims[1]; n++)
+ if(((unsigned)new_data[i][j].d[m][n].i & i_mask) != ((unsigned)orig_data[i][j].d[m][n].i & i_mask)||
+ ((unsigned)new_data[i][j].d[m][n].c & c_mask) != ((unsigned)orig_data[i][j].d[m][n].c & c_mask)||
+ ((unsigned)new_data[i][j].d[m][n].s & s_mask) != ((unsigned)orig_data[i][j].d[m][n].s & s_mask)||
+ (new_data[i][j].d[m][n].f == new_data[i][j].d[m][n].f && !H5_FLT_ABS_EQUAL(new_data[i][j].d[m][n].f, new_data[i][j].d[m][n].f))) {
+ d_failed = 1;
+ goto out;
+ }
+
+out:
+ if(((unsigned)new_data[i][j].a.i & i_mask) != ((unsigned)orig_data[i][j].a.i & i_mask)||
+ ((unsigned)new_data[i][j].a.c & c_mask) != ((unsigned)orig_data[i][j].a.c & c_mask)||
+ ((unsigned)new_data[i][j].a.s & s_mask) != ((unsigned)orig_data[i][j].a.s & s_mask)||
+ (new_data[i][j].a.f == new_data[i][j].a.f && !H5_FLT_ABS_EQUAL(new_data[i][j].a.f, new_data[i][j].a.f)) ||
+ new_data[i][j].v != orig_data[i][j].v || b_failed || d_failed) {
+ H5_FAILED();
+ printf(" Read different values than written.\n");
+ printf(" At index %lu,%lu\n", (unsigned long)i, (unsigned long)j);
+ goto error;
+ }
}
- }
}
/*----------------------------------------------------------------------
* Cleanup
*----------------------------------------------------------------------
*/
- if(H5Tclose(i_tid) < 0) goto error;
- if(H5Tclose(c_tid) < 0) goto error;
- if(H5Tclose(s_tid) < 0) goto error;
- if(H5Tclose(f_tid) < 0) goto error;
- if(H5Tclose(v_tid) < 0) goto error;
- if(H5Tclose(cmpd_tid2) < 0) goto error;
- if(H5Tclose(cmpd_tid1) < 0) goto error;
- if(H5Tclose(mem_cmpd_tid2) < 0) goto error;
- if(H5Tclose(mem_cmpd_tid1) < 0) goto error;
- if(H5Tclose(array_tid) < 0) goto error;
- if(H5Tclose(base_tid) < 0) goto error;
- if(H5Tclose(array_cmplx_tid) < 0) goto error;
- if(H5Tclose(mem_array_cmplx_tid) < 0) goto error;
- if(H5Pclose(dc) < 0) goto error;
- if(H5Sclose(space) < 0) goto error;
- if(H5Dclose(dataset) < 0) goto error;
+ if(H5Tclose(i_tid) < 0)
+ FAIL_STACK_ERROR
+ if(H5Tclose(c_tid) < 0)
+ FAIL_STACK_ERROR
+ if(H5Tclose(s_tid) < 0)
+ FAIL_STACK_ERROR
+ if(H5Tclose(f_tid) < 0)
+ FAIL_STACK_ERROR
+ if(H5Tclose(v_tid) < 0)
+ FAIL_STACK_ERROR
+ if(H5Tclose(cmpd_tid2) < 0)
+ FAIL_STACK_ERROR
+ if(H5Tclose(cmpd_tid1) < 0)
+ FAIL_STACK_ERROR
+ if(H5Tclose(mem_cmpd_tid2) < 0)
+ FAIL_STACK_ERROR
+ if(H5Tclose(mem_cmpd_tid1) < 0)
+ FAIL_STACK_ERROR
+ if(H5Tclose(array_tid) < 0)
+ FAIL_STACK_ERROR
+ if(H5Tclose(base_tid) < 0)
+ FAIL_STACK_ERROR
+ if(H5Tclose(array_cmplx_tid) < 0)
+ FAIL_STACK_ERROR
+ if(H5Tclose(mem_array_cmplx_tid) < 0)
+ FAIL_STACK_ERROR
+ if(H5Pclose(dc) < 0)
+ FAIL_STACK_ERROR
+ if(H5Sclose(space) < 0)
+ FAIL_STACK_ERROR
+ if(H5Dclose(dataset) < 0)
+ FAIL_STACK_ERROR
PASSED();
@@ -3832,7 +3955,7 @@ test_nbit_compound_3(hid_t file)
for(i = 0; i < (size_t)size[0]; i++) {
power = HDpow(2.0F, 17.0F - 1.0F);
HDmemset(&orig_data[i], 0, sizeof(orig_data[i]));
- orig_data[i].i = HDrandom() % (long)power;
+ orig_data[i].i = (int)(HDrandom() % (long)power);
HDstrcpy(orig_data[i].str, "fixed-length C string");
orig_data[i].vl_str = HDstrdup("variable-length C string");
@@ -4203,7 +4326,7 @@ test_nbit_flt_size(hid_t file)
*/
for (i=0; i < DSET_DIM1; i++)
for (j=0; j < DSET_DIM2; j++)
- orig_data[i][j] = (rand() % 1234567) / 2;
+ orig_data[i][j] = (float)(HDrandom() % 1234567) / 2;
/* Describe the dataspace. */
@@ -4587,7 +4710,7 @@ test_scaleoffset_float(hid_t file)
/* Initialize data */
for(i= 0;i< (size_t)size[0]; i++)
for(j = 0; j < (size_t)size[1]; j++) {
- orig_data[i][j] = (float)((HDrandom() % 100000) / 1000.0F);
+ orig_data[i][j] = (float)(HDrandom() % 100000) / 1000.0F;
/* even-numbered values are negtive */
if((i*size[1]+j+1)%2 == 0)
@@ -4718,10 +4841,10 @@ test_scaleoffset_float_2(hid_t file)
/* Initialize data of hyperslab */
for(j = 0; j < (size_t)size[1]; j++) {
- orig_data[0][j] = (float)((HDrandom() % 100000) / 1000.0F);
+ orig_data[0][j] = (float)(HDrandom() % 100000) / 1000.0F;
/* even-numbered values are negtive */
- if((j+1)%2 == 0)
+ if((j + 1) % 2 == 0)
orig_data[0][j] = -orig_data[0][j];
}
@@ -4829,10 +4952,10 @@ test_scaleoffset_double(hid_t file)
/* Initialize data */
for(i= 0;i< (size_t)size[0]; i++)
for(j = 0; j < (size_t)size[1]; j++) {
- orig_data[i][j] = (HDrandom() % 10000000) / 10000000.0F;
+ orig_data[i][j] = (float)(HDrandom() % 10000000) / 10000000.0F;
/* even-numbered values are negtive */
- if((i*size[1]+j+1)%2 == 0)
+ if((i* size[1] + j + 1) % 2 == 0)
orig_data[i][j] = -orig_data[i][j];
}
@@ -4960,10 +5083,10 @@ test_scaleoffset_double_2(hid_t file)
/* Initialize data of hyperslab */
for(j = 0; j < (size_t)size[1]; j++) {
- orig_data[0][j] = (HDrandom() % 10000000) / 10000000.0F;
+ orig_data[0][j] = (float)(HDrandom() % 10000000) / 10000000.0F;
/* even-numbered values are negtive */
- if((j+1)%2 == 0)
+ if((j + 1) % 2 == 0)
orig_data[0][j] = -orig_data[0][j];
}
@@ -5958,7 +6081,7 @@ test_set_local(hid_t fapl)
for(j=0; j<dims[1]; j++) {
/* If the difference between two values is greater than 0.001%, they're
* considered not equal. */
- if(!H5_DBL_REL_EQUAL(points_dbl[i][j],check_dbl[i][j],0.00001F)) {
+ if(!H5_DBL_REL_EQUAL(points_dbl[i][j], check_dbl[i][j], (double)0.00001F)) {
H5_FAILED();
printf(" Line %d: Read different values than written.\n",__LINE__);
printf(" At index %lu,%lu\n", (unsigned long)(i), (unsigned long)(j));
@@ -6717,7 +6840,7 @@ test_missing_chunk(hid_t file)
/* Initialize data for 2-D dataset */
for(i = 0; i < MISSING_CHUNK_DIM; i++) {
for(j = 0; j < MISSING_CHUNK_DIM; j++) {
- wdata2[i][j] = (int)j + (i * MISSING_CHUNK_DIM);
+ wdata2[i][j] = (int)(j + (i * MISSING_CHUNK_DIM));
rdata2[i][j] = 911;
}
} /* end for */
@@ -7635,7 +7758,7 @@ test_chunk_cache(hid_t fapl)
/* Set new rdcc settings on fapl */
nslots_2 = nslots_1 * 2;
nbytes_2 = nbytes_1 * 2;
- w0_2 = w0_1 / 2.0F;
+ w0_2 = w0_1 / (double)2.0F;
if (H5Pset_cache(fapl_local, 0, nslots_2, nbytes_2, w0_2) < 0) FAIL_STACK_ERROR
h5_fixname(FILENAME[8], fapl, filename, sizeof filename);
@@ -8074,7 +8197,7 @@ error:
*-------------------------------------------------------------------------
*/
static herr_t
-test_chunk_fast(const char *env_h5_driver, hid_t fapl)
+test_chunk_fast(hid_t fapl)
{
char filename[FILENAME_BUF_SIZE];
hid_t fid = -1; /* File ID */
@@ -8135,7 +8258,7 @@ test_chunk_fast(const char *env_h5_driver, hid_t fapl)
H5D_alloc_time_t alloc_time; /* Storage allocation time */
/* Loop over storage allocation time */
- for(alloc_time = H5D_ALLOC_TIME_EARLY; alloc_time <= H5D_ALLOC_TIME_INCR; alloc_time++) {
+ for(alloc_time = H5D_ALLOC_TIME_EARLY; alloc_time <= H5D_ALLOC_TIME_INCR; H5_INC_ENUM(H5D_alloc_time_t, alloc_time)) {
unsigned ndims; /* Current # of dims to test */
/* Loop over dataspace ranks to test */
@@ -8435,7 +8558,7 @@ test_reopen_chunk_fast(hid_t fapl)
h5_fixname(FILENAME[10], fapl, filename, sizeof filename);
/* Loop over storage allocation time */
- for(alloc_time = H5D_ALLOC_TIME_EARLY; alloc_time <= H5D_ALLOC_TIME_INCR; alloc_time++) {
+ for(alloc_time = H5D_ALLOC_TIME_EARLY; alloc_time <= H5D_ALLOC_TIME_INCR; H5_INC_ENUM(H5D_alloc_time_t, alloc_time)) {
/* Create file */
if((fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) FAIL_STACK_ERROR
@@ -8566,7 +8689,7 @@ test_chunk_fast_bug1(hid_t fapl)
if((sid = H5Screate_simple(2, dim, max_dim)) < 0) FAIL_STACK_ERROR
/* Loop over storage allocation time */
- for(alloc_time = H5D_ALLOC_TIME_EARLY; alloc_time <= H5D_ALLOC_TIME_INCR; alloc_time++) {
+ for(alloc_time = H5D_ALLOC_TIME_EARLY; alloc_time <= H5D_ALLOC_TIME_INCR; H5_INC_ENUM(H5D_alloc_time_t, alloc_time)) {
/* Create file */
if((fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) FAIL_STACK_ERROR
@@ -9192,7 +9315,7 @@ test_fixed_array(hid_t fapl)
#endif /* H5_HAVE_FILTER_DEFLATE */
/* Loop over storage allocation time */
- for(alloc_time = H5D_ALLOC_TIME_EARLY; alloc_time <= H5D_ALLOC_TIME_INCR; alloc_time++) {
+ for(alloc_time = H5D_ALLOC_TIME_EARLY; alloc_time <= H5D_ALLOC_TIME_INCR; H5_INC_ENUM(H5D_alloc_time_t, alloc_time)) {
/* Create file */
if((fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) FAIL_STACK_ERROR
@@ -9564,10 +9687,10 @@ test_single_chunk(hid_t fapl)
TEST_ERROR
for(i = n = 0; i < (DSET_DIM1 * DSET_DIM2); i++)
- wbuf[i] = n++;
+ wbuf[i] = (int)n++;
for(i = n = 0; i < (50* 100); i++)
- t_wbuf[i] = n++;
+ t_wbuf[i] = (int)n++;
#ifdef H5_HAVE_FILTER_DEFLATE
/* Loop over compressing chunks */
@@ -9575,7 +9698,7 @@ test_single_chunk(hid_t fapl)
#endif /* H5_HAVE_FILTER_DEFLATE */
/* Loop over storage allocation time */
- for(alloc_time = H5D_ALLOC_TIME_EARLY; alloc_time <= H5D_ALLOC_TIME_INCR; alloc_time++) {
+ for(alloc_time = H5D_ALLOC_TIME_EARLY; alloc_time <= H5D_ALLOC_TIME_INCR; H5_INC_ENUM(H5D_alloc_time_t, alloc_time)) {
/* Create file */
if((fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) FAIL_STACK_ERROR
@@ -9866,7 +9989,7 @@ test_unfiltered_edge_chunks(hid_t fapl)
/* Initialize write buffer */
for(i=0; i<dim[0]; i++)
for(j=0; j<dim[1]; j++)
- wbuf[i][j] = (char)(2 * i) - (char)j;
+ wbuf[i][j] = (char)((2 * i) - j);
/* Reset byte counts */
count_nbytes_read = (size_t)0;
@@ -11944,7 +12067,7 @@ main(void)
nerrors += (test_huge_chunks(my_fapl) < 0 ? 1 : 0);
nerrors += (test_chunk_cache(my_fapl) < 0 ? 1 : 0);
nerrors += (test_big_chunks_bypass_cache(my_fapl) < 0 ? 1 : 0);
- nerrors += (test_chunk_fast(envval, my_fapl) < 0 ? 1 : 0);
+ nerrors += (test_chunk_fast(my_fapl) < 0 ? 1 : 0);
nerrors += (test_reopen_chunk_fast(my_fapl) < 0 ? 1 : 0);
nerrors += (test_chunk_fast_bug1(my_fapl) < 0 ? 1 : 0);
nerrors += (test_chunk_expand(my_fapl) < 0 ? 1 : 0);
diff --git a/test/dt_arith.c b/test/dt_arith.c
index 639ad52..064ee69 100644
--- a/test/dt_arith.c
+++ b/test/dt_arith.c
@@ -20,8 +20,6 @@
* Purpose: Tests the data type interface (H5T)
*/
-#include <math.h>
-#include <time.h>
#include "h5test.h"
/* Number of elements in each random test */
@@ -3094,8 +3092,8 @@ test_conv_flt_1 (const char *name, int run_test, hid_t src, hid_t dst)
if (FLT_FLOAT==dst_type) {
hw_f = (float)(*((double*)aligned));
hw = (unsigned char*)&hw_f;
- underflow = HDfabs(*((double*)aligned)) < FLT_MIN;
- overflow = HDfabs(*((double*)aligned)) > FLT_MAX;
+ underflow = HDfabs(*((double*)aligned)) < (double)FLT_MIN;
+ overflow = HDfabs(*((double*)aligned)) > (double)FLT_MAX;
} else if (FLT_DOUBLE==dst_type) {
hw_d = *((double*)aligned);
hw = (unsigned char*)&hw_d;
@@ -3109,12 +3107,12 @@ test_conv_flt_1 (const char *name, int run_test, hid_t src, hid_t dst)
} else {
HDmemcpy(aligned, saved+j*sizeof(long double), sizeof(long double));
if (FLT_FLOAT==dst_type) {
- hw_f = *((long double*)aligned);
+ hw_f = (float)*((long double*)aligned);
hw = (unsigned char*)&hw_f;
underflow = HDfabsl(*((long double*)aligned)) < FLT_MIN;
overflow = HDfabsl(*((long double*)aligned)) > FLT_MAX;
} else if (FLT_DOUBLE==dst_type) {
- hw_d = *((long double*)aligned);
+ hw_d = (double)*((long double*)aligned);
hw = (unsigned char*)&hw_d;
underflow = HDfabsl(*((long double*)aligned)) < DBL_MIN;
overflow = HDfabsl(*((long double*)aligned)) > DBL_MAX;
@@ -3227,15 +3225,15 @@ test_conv_flt_1 (const char *name, int run_test, hid_t src, hid_t dst)
long double x;
HDmemcpy(&x, &buf[j*dst_size], sizeof(long double));
/* dst is largest float, no need to check underflow. */
- check_mant[0] = HDfrexpl(x, check_expo+0);
- check_mant[1] = HDfrexpl(hw_ld, check_expo+1);
+ check_mant[0] = (double)HDfrexpl(x, check_expo+0);
+ check_mant[1] = (double)HDfrexpl(hw_ld, check_expo+1);
#endif
}
/* Special check for denormalized values */
if(check_expo[0]<(-(int)dst_ebias) || check_expo[1]<(-(int)dst_ebias)) {
- int expo_diff=check_expo[0]-check_expo[1];
- int valid_bits=(int)((dst_ebias+dst_msize)+MIN(check_expo[0],check_expo[1]))-1;
- double epsilon=1.0F;
+ int expo_diff = check_expo[0] - check_expo[1];
+ int valid_bits = (int)((dst_ebias + dst_msize) + (size_t)MIN(check_expo[0], check_expo[1])) - 1;
+ double epsilon = 1.0F;
/* Re-scale the mantissas based on any exponent difference */
if(expo_diff!=0)
@@ -3249,8 +3247,8 @@ test_conv_flt_1 (const char *name, int run_test, hid_t src, hid_t dst)
continue;
} /* end if */
else {
- if (check_expo[0]==check_expo[1] &&
- HDfabs(check_mant[0]-check_mant[1])<FP_EPSILON)
+ if(check_expo[0] == check_expo[1] &&
+ HDfabs(check_mant[0] - check_mant[1]) < (double)FP_EPSILON)
continue;
} /* end else */
}
@@ -4217,10 +4215,10 @@ test_conv_int_fp(const char *name, int run_test, hid_t src, hid_t dst)
*/
#if H5_SIZEOF_LONG_DOUBLE !=0
if(dendian==H5T_ORDER_LE && dst_type==FLT_LDOUBLE) {
- unsigned int q;
- for(q=dst_nbits/8; q<dst_size; q++) {
- buf[j*dst_size+q] = 0x00;
- }
+ size_t q;
+
+ for(q = dst_nbits / 8; q < dst_size; q++)
+ buf[j * dst_size + q] = 0x00;
}
#endif
diff --git a/test/dtypes.c b/test/dtypes.c
index 984b6c6..f247bd9 100644
--- a/test/dtypes.c
+++ b/test/dtypes.c
@@ -20,8 +20,6 @@
* Purpose: Tests the datatype interface (H5T)
*/
-#include <math.h>
-#include <time.h>
#include "h5test.h"
#include "H5srcdir.h"
#include "H5Iprivate.h" /* For checking that datatype id's don't leak */
@@ -1927,12 +1925,12 @@ test_compound_10(void)
for(i=0; i<ARRAY_DIM; i++) {
wdata[i].i1 = i*10+i;
wdata[i].str = HDstrdup("C string A");
- wdata[i].str[9] += (char)i;
+ wdata[i].str[9] = (char)(wdata[i].str[9] + i);
wdata[i].i2 = i*1000+i*10;
wdata[i].text.p = (void*)HDstrdup("variable-length text A\0");
len = wdata[i].text.len = HDstrlen((char*)wdata[i].text.p)+1;
- ((char*)(wdata[i].text.p))[len-2] += (char)i;
+ ((char *)(wdata[i].text.p))[len - 2] = (char)(((char *)(wdata[i].text.p))[len - 2] + i);
((char*)(wdata[i].text.p))[len-1] = '\0';
}
@@ -2185,7 +2183,7 @@ test_compound_11(void)
/* Verify converted buffer is correct */
for(u=0; u<NTESTELEM; u++) {
- if(((big_t *)buf_orig)[u].d1!=((little_t *)buf)[u].d1) {
+ if(!H5_DBL_ABS_EQUAL(((big_t *)buf_orig)[u].d1, ((little_t *)buf)[u].d1)) {
printf("Error, line #%d: buf_orig[%u].d1=%f, buf[%u].d1=%f\n",__LINE__,
(unsigned)u,((big_t *)buf_orig)[u].d1,(unsigned)u,((little_t *)buf)[u].d1);
TEST_ERROR
@@ -2229,7 +2227,7 @@ test_compound_11(void)
/* Verify converted buffer is correct */
for(u=0; u<NTESTELEM; u++) {
- if(((big_t *)buf_orig)[u].d1!=((little_t *)buf)[u].d1) {
+ if(!H5_DBL_ABS_EQUAL(((big_t *)buf_orig)[u].d1, ((little_t *)buf)[u].d1)) {
printf("Error, line #%d: buf_orig[%u].d1=%f, buf[%u].d1=%f\n",__LINE__,
(unsigned)u,((big_t *)buf_orig)[u].d1,(unsigned)u,((little_t *)buf)[u].d1);
TEST_ERROR
@@ -2267,7 +2265,7 @@ test_compound_11(void)
/* Verify converted buffer is correct */
for(u=0; u<NTESTELEM; u++) {
- if(((big_t *)buf_orig)[u].d1!=((little_t *)buf)[u].d1) {
+ if(!H5_DBL_ABS_EQUAL(((big_t *)buf_orig)[u].d1, ((little_t *)buf)[u].d1)) {
printf("Error, line #%d: buf_orig[%u].d1=%f, buf[%u].d1=%f\n",__LINE__,
(unsigned)u,((big_t *)buf_orig)[u].d1,(unsigned)u,((little_t *)buf)[u].d1);
TEST_ERROR
@@ -2489,7 +2487,7 @@ test_compound_13(void)
/* Check the data. */
for (u = 0; u < COMPOUND13_ARRAY_SIZE + 1; u++)
if(data_out.x[u] != data_in.x[u]) TEST_ERROR
- if(data_out.y != data_in.y) TEST_ERROR
+ if(!H5_FLT_ABS_EQUAL(data_out.y, data_in.y)) TEST_ERROR
/* Release all resources. */
if(H5Aclose(attid) < 0) FAIL_STACK_ERROR
@@ -6115,7 +6113,7 @@ test_int_float_except(void)
/* Check the buffer after conversion, as floats */
for(u = 0; u < CONVERT_SIZE; u++) {
floatp = (float *)&buf[u];
- if(*floatp != buf_float[u]) TEST_ERROR
+ if(!H5_FLT_ABS_EQUAL(*floatp, buf_float[u])) TEST_ERROR
} /* end for */
/* Check for proper exceptions */
@@ -6136,7 +6134,7 @@ test_int_float_except(void)
/* Check the buffer after conversion, as floats */
for(u = 0; u < CONVERT_SIZE; u++) {
floatp = (float *)&buf2[u];
- if(*floatp != buf2_float[u]) TEST_ERROR
+ if(!H5_FLT_ABS_EQUAL(*floatp, buf2_float[u])) TEST_ERROR
} /* end for */
/* Check for proper exceptions */
diff --git a/test/dynlib4.c b/test/dynlib4.c
new file mode 100644
index 0000000..8da0270
--- /dev/null
+++ b/test/dynlib4.c
@@ -0,0 +1,104 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * 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 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. *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+/*
+ * Purpose: Tests the plugin module (H5PL)
+ */
+
+#include <stdlib.h>
+#include <stdio.h>
+#include "H5PLextern.h"
+
+#define H5Z_FILTER_DYNLIB4 260
+
+#define PUSH_ERR(func, minor, str) H5Epush2(H5E_DEFAULT, __FILE__, func, __LINE__, H5E_ERR_CLS, H5E_PLUGIN, minor, str)
+
+static size_t H5Z_filter_dynlib4(unsigned int flags, size_t cd_nelmts,
+ const unsigned int *cd_values, size_t nbytes, size_t *buf_size, void **buf);
+
+/* This message derives from H5Z */
+const H5Z_class2_t H5Z_DYNLIB4[1] = {{
+ H5Z_CLASS_T_VERS, /* H5Z_class_t version */
+ H5Z_FILTER_DYNLIB4, /* Filter id number */
+ 1, 1, /* Encoding and decoding enabled */
+ "dynlib4", /* Filter name for debugging */
+ NULL, /* The "can apply" callback */
+ NULL, /* The "set local" callback */
+ (H5Z_func_t)H5Z_filter_dynlib4, /* The actual filter function */
+}};
+
+H5PL_type_t H5PLget_plugin_type(void) {return H5PL_TYPE_FILTER;}
+const void *H5PLget_plugin_info(void) {return H5Z_DYNLIB4;}
+
+/*-------------------------------------------------------------------------
+ * Function: H5Z_filter_dynlib4
+ *
+ * Purpose: A dynlib4 filter method that adds on and subtract from
+ * the original value with another value. It will be built
+ * as a shared library. plugin.c test will load and use
+ * this filter library. Designed to call a HDF function.
+ *
+ * Return: Success: Data chunk size
+ *
+ * Failure: 0
+ *
+ *-------------------------------------------------------------------------
+ */
+static size_t
+H5Z_filter_dynlib4(unsigned int flags, size_t cd_nelmts,
+ const unsigned int *cd_values, size_t nbytes,
+ size_t *buf_size, void **buf)
+{
+ int *int_ptr = (int *)*buf; /* Pointer to the data values */
+ size_t buf_left = *buf_size; /* Amount of data buffer left to process */
+ int add_on = 0;
+ unsigned ver_info[3];
+
+ /* Check for the library version */
+ if(H5get_libversion(&ver_info[0], &ver_info[1], &ver_info[2]) < 0) {
+ PUSH_ERR("dynlib4", H5E_CALLBACK, "H5get_libversion");
+ return(0);
+ }
+ /* Check for the correct number of parameters */
+ if(cd_nelmts == 0)
+ return(0);
+
+ /* Check that permanent parameters are set correctly */
+ if(cd_values[0] > 9)
+ return(0);
+
+ if(ver_info[0] != cd_values[1] || ver_info[1] != cd_values[2]) {
+ PUSH_ERR("dynlib4", H5E_CALLBACK, "H5get_libversion does not match");
+ return(0);
+ }
+
+ add_on = (int)cd_values[0];
+
+ if(flags & H5Z_FLAG_REVERSE) { /*read*/
+ /* Substract the "add on" value to all the data values */
+ while(buf_left > 0) {
+ *int_ptr++ -= add_on;
+ buf_left -= sizeof(int);
+ } /* end while */
+ } /* end if */
+ else { /*write*/
+ /* Add the "add on" value to all the data values */
+ while(buf_left > 0) {
+ *int_ptr++ += add_on;
+ buf_left -= sizeof(int);
+ } /* end while */
+ } /* end else */
+
+ return nbytes;
+} /* end H5Z_filter_dynlib4() */
+
diff --git a/test/error_test.c b/test/error_test.c
index ee181b1..b150656 100644
--- a/test/error_test.c
+++ b/test/error_test.c
@@ -270,7 +270,7 @@ error:
static herr_t
error_stack(void)
{
- int err_num;
+ ssize_t err_num;
const char *FUNC_error_stack = "error_stack";
if((err_num = H5Eget_num(H5E_DEFAULT)) < 0)
@@ -284,7 +284,7 @@ error_stack(void)
/* Make it push error, force this function to fail */
if((err_num = H5Eget_num(ERR_STACK)) == 0) {
H5Epush(ERR_STACK, __FILE__, FUNC_error_stack, __LINE__, ERR_CLS, ERR_MAJ_API, ERR_MIN_GETNUM,
- "Get number test failed, returned %d", err_num);
+ "Get number test failed, returned %d", (int)err_num);
goto error;
} /* end if */
@@ -354,7 +354,7 @@ test_long_desc(void)
/* Create the long part of the error description */
for(u = 0; u < LONG_DESC_SIZE; u++)
- long_desc[u] = 'A' + (u % 26);
+ long_desc[u] = (char)('A' + (u % 26));
long_desc[LONG_DESC_SIZE - 1] = '\0';
/* Clear the default error stack */
@@ -487,7 +487,7 @@ test_create(void)
{
const char *err_func = "test_create"; /* Function name for pushing error */
const char *err_msg = "Error message"; /* Error message for pushing error */
- int err_num; /* Number of errors on stack */
+ ssize_t err_num; /* Number of errors on stack */
hid_t estack_id; /* Error stack ID */
/* Create an empty error stack */
@@ -538,7 +538,7 @@ test_copy(void)
{
const char *err_func = "test_copy"; /* Function name for pushing error */
const char *err_msg = "Error message"; /* Error message for pushing error */
- int err_num; /* Number of errors on stack */
+ ssize_t err_num; /* Number of errors on stack */
hid_t estack_id; /* Error stack ID */
herr_t ret; /* Generic return value */
diff --git a/test/fheap.c b/test/fheap.c
index a59c27f..8e364de 100644
--- a/test/fheap.c
+++ b/test/fheap.c
@@ -13758,7 +13758,7 @@ test_filtered_huge(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t *tparam
unsigned char obj_type; /* Type of storage for object */
fheap_heap_state_t state; /* State of fractal heap */
unsigned deflate_level; /* Deflation level */
- unsigned old_actual_id_len = 0; /* Old actual ID length */
+ size_t old_actual_id_len =0 ; /* Old actual ID length */
hbool_t huge_ids_direct; /* Are 'huge' objects directly acccessed? */
const char *base_desc = "insert 'huge' object into heap with I/O filters, then remove %s"; /* Test description */
@@ -15741,7 +15741,7 @@ HDfprintf(stderr, "Random # seed was: %lu\n", seed);
/* Loop over adding objects to the heap, until the size limit is reached */
total_obj_added = 0;
while(total_obj_added < size_limit) {
- unsigned size_range = (tmp_cparam.managed.start_block_size / 8); /* Object size range */
+ size_t size_range = (tmp_cparam.managed.start_block_size / 8); /* Object size range */
/* Determine the size of the range for this object */
/* (50% of the objects inserted will use the initial size range,
@@ -16061,9 +16061,9 @@ test_write(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t *tparam)
/* Change size of data to write */
if(u < 20)
- obj_size = (size_t)(obj_size * 1.3F);
+ obj_size = (size_t)((float)obj_size * 1.3F);
else
- obj_size = (size_t)(obj_size / 1.3F);
+ obj_size = (size_t)((float)obj_size / 1.3F);
} /* end for */
/* Close the fractal heap */
@@ -16110,9 +16110,9 @@ test_write(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t *tparam)
/* Change size of data to write */
if(u < 20)
- obj_size = (size_t)(obj_size * 1.3F);
+ obj_size = (size_t)((float)obj_size * 1.3F);
else
- obj_size = (size_t)(obj_size / 1.3F);
+ obj_size = (size_t)((float)obj_size / 1.3F);
} /* end for */
/* Close the fractal heap */
diff --git a/test/file_image.c b/test/file_image.c
index 6d1845f..dd0a483 100644
--- a/test/file_image.c
+++ b/test/file_image.c
@@ -22,7 +22,6 @@
*************************************************************/
#include "h5test.h"
-#include "H5srcdir.h"
#include "H5Fprivate.h" /* required to test property removals */
#define VERIFY(condition, string) do { if (!(condition)) FAIL_PUTS_ERROR(string) } while(0)
@@ -633,7 +632,8 @@ test_core(void)
VERIFY(ret == 0, "fstat failed");
size = (size_t)sb.st_size;
file_image = (unsigned char *)HDmalloc(size);
- HDread(fd, file_image, size);
+ if(HDread(fd, file_image, size) < 0)
+ FAIL_PUTS_ERROR("unable to read from file descriptor");
ret = HDclose(fd);
VERIFY(ret == 0, "close failed");
@@ -868,9 +868,11 @@ test_get_file_image(const char * test_banner,
VERIFY(fd >= 0, "HDopen() failed.");
if(user) {
+ HDoff_t off;
+
/* Position at userblock */
- ret = HDlseek(fd, (off_t)USERBLOCK_SIZE, SEEK_SET);
- VERIFY(ret >= 0, "HDlseek() failed.");
+ off = HDlseek(fd, (off_t)USERBLOCK_SIZE, SEEK_SET);
+ VERIFY(off >= 0, "HDlseek() failed.");
}
/* read the test file from disk into the buffer */
@@ -1317,7 +1319,7 @@ main(void)
h5_reset();
- printf("Testing File Image Functionality.\n");
+ HDprintf("Testing File Image Functionality.\n");
errors += test_properties();
errors += test_callbacks();
@@ -1378,12 +1380,12 @@ main(void)
h5_restore_err();
if(errors) {
- printf("***** %d File Image TEST%s FAILED! *****\n",
+ HDprintf("***** %d File Image TEST%s FAILED! *****\n",
errors, errors > 1 ? "S" : "");
return 1;
}
- printf("All File Image tests passed.\n");
+ HDprintf("All File Image tests passed.\n");
return 0;
}
diff --git a/test/fillval.c b/test/fillval.c
index 1ea2ae6..3f713e9 100644
--- a/test/fillval.c
+++ b/test/fillval.c
@@ -623,7 +623,7 @@ test_create(hid_t fapl, const char *base_name, H5D_layout_t layout)
if((dset9 = H5Dopen2(file, "dset9", H5P_DEFAULT)) < 0) goto error;
if((dcpl = H5Dget_create_plist(dset9)) < 0) goto error;
if(H5Pget_fill_value(dcpl, comp_type_id, &rd_c) < 0) goto error;
- if( rd_c.a!=0 || rd_c.y != fill_ctype.y || rd_c.x != 0 || rd_c.z != '\0') {
+ if(!H5_FLT_ABS_EQUAL(rd_c.a, 0) || !H5_DBL_ABS_EQUAL(rd_c.y, fill_ctype.y) || rd_c.x != 0 || rd_c.z != '\0') {
H5_FAILED();
puts(" Got wrong fill value");
printf(" Got rd_c.a=%f, rd_c.y=%f and rd_c.x=%d, rd_c.z=%c\n",
@@ -696,7 +696,7 @@ test_create(hid_t fapl, const char *base_name, H5D_layout_t layout)
if((dset8 = H5Dopen2(file, "dset8", H5P_DEFAULT)) < 0) goto error;
if((dcpl = H5Dget_create_plist(dset8)) < 0) goto error;
if(H5Pget_fill_value(dcpl, comp_type_id, &rd_c) < 0) goto error;
- if(rd_c.a != 0 || rd_c.y != fill_ctype.y || rd_c.x != 0 || rd_c.z!='\0') {
+ if(!H5_FLT_ABS_EQUAL(rd_c.a, 0) || !H5_DBL_ABS_EQUAL(rd_c.y, fill_ctype.y) || rd_c.x != 0 || rd_c.z != '\0') {
H5_FAILED();
puts(" Got wrong fill value");
printf(" Got rd_c.a=%f, rd_c.y=%f and rd_c.x=%d, rd_c.z=%c\n",
@@ -789,7 +789,7 @@ test_rdwr_cases(hid_t file, hid_t dcpl, const char *dname, void *_fillval,
goto error;
for (i=0; i<1000; i++) {
for (j=0; j<5; j++)
- hs_offset[j] = rand() % cur_size[j];
+ hs_offset[j] = (hsize_t)HDrand() % cur_size[j];
if(H5Sselect_hyperslab(fspace, H5S_SELECT_SET, hs_offset, NULL,
one, NULL) < 0) goto error;
@@ -811,9 +811,9 @@ test_rdwr_cases(hid_t file, hid_t dcpl, const char *dname, void *_fillval,
} else if(datatype==H5T_COMPOUND) {
if(H5Dread(dset2, ctype_id, mspace, fspace, H5P_DEFAULT,
&rd_c) < 0) goto error;
- if(fill_time!=H5D_FILL_TIME_NEVER && (rd_c.a!=fill_c.a ||
- rd_c.x!=fill_c.x || rd_c.y!=fill_c.y ||
- rd_c.z!=fill_c.z)) {
+ if(fill_time != H5D_FILL_TIME_NEVER && (!H5_FLT_ABS_EQUAL(rd_c.a, fill_c.a) ||
+ rd_c.x != fill_c.x || !H5_DBL_ABS_EQUAL(rd_c.y, fill_c.y) ||
+ rd_c.z != fill_c.z)) {
H5_FAILED();
HDfprintf(stdout, "%u: Value read was not a fill value.\n", (unsigned)__LINE__);
HDfprintf(stdout," Elmt={%Hu,%Hu,%Hu,%Hu,%Hu}, read: %f, %d, %f, %c"
@@ -879,8 +879,8 @@ test_rdwr_cases(hid_t file, hid_t dcpl, const char *dname, void *_fillval,
/* Verify values, except if no fill value written */
if(fill_time != H5D_FILL_TIME_NEVER) {
for(u = 0; u < nelmts; u++) {
- if(buf_c[u].a != fill_c.a || buf_c[u].x != fill_c.x ||
- buf_c[u].y != fill_c.y || buf_c[u].z != fill_c.z) {
+ if(!H5_FLT_ABS_EQUAL(buf_c[u].a, fill_c.a) || buf_c[u].x != fill_c.x ||
+ !H5_DBL_ABS_EQUAL(buf_c[u].y, fill_c.y) || buf_c[u].z != fill_c.z) {
H5_FAILED();
HDfprintf(stdout, "%u: Value read was not a fill value.\n", (unsigned)__LINE__);
HDfprintf(stdout," Elmt={%Hu, %Hu, %Hu, %Hu, %Hu}, read: %f, %d, %f, %c"
@@ -938,7 +938,7 @@ test_rdwr_cases(hid_t file, hid_t dcpl, const char *dname, void *_fillval,
goto error;
for(i = 0; i < 1000; i++) {
for(j = 0, odd = 0; j < 5; j++) {
- hs_offset[j] = rand() % cur_size[j];
+ hs_offset[j] = (hsize_t)HDrand() % cur_size[j];
odd += (int)(hs_offset[j]%2);
} /* end for */
if(H5Sselect_hyperslab(fspace, H5S_SELECT_SET, hs_offset, NULL, one, NULL) < 0)
@@ -993,8 +993,8 @@ test_rdwr_cases(hid_t file, hid_t dcpl, const char *dname, void *_fillval,
should_be_c.y=buf_c[0].y;
should_be_c.z=buf_c[0].z;
}
- if( rd_c.a!=should_be_c.a || rd_c.x!=should_be_c.x ||
- rd_c.y!=should_be_c.y || rd_c.z!=should_be_c.z) {
+ if(!H5_FLT_ABS_EQUAL(rd_c.a, should_be_c.a) || rd_c.x != should_be_c.x ||
+ !H5_DBL_ABS_EQUAL(rd_c.y, should_be_c.y) || rd_c.z != should_be_c.z) {
H5_FAILED();
HDfprintf(stdout, "%u: Value read was not correct.\n", (unsigned)__LINE__);
printf(" Elmt={%ld,%ld,%ld,%ld,%ld}, read: %f,%d,%f,%c "
@@ -1012,8 +1012,8 @@ test_rdwr_cases(hid_t file, hid_t dcpl, const char *dname, void *_fillval,
should_be_c.x=buf_c[0].x;
should_be_c.y=buf_c[0].y;
should_be_c.z=buf_c[0].z;
- if( rd_c.a!=should_be_c.a || rd_c.x!=should_be_c.x ||
- rd_c.y!=should_be_c.y || rd_c.z!=should_be_c.z) {
+ if(!H5_FLT_ABS_EQUAL(rd_c.a, should_be_c.a) || rd_c.x != should_be_c.x ||
+ !H5_DBL_ABS_EQUAL(rd_c.y, should_be_c.y) || rd_c.z != should_be_c.z) {
H5_FAILED();
HDfprintf(stdout, "%u: Value read was not correct.\n", (unsigned)__LINE__);
printf(" Elmt={%ld,%ld,%ld,%ld,%ld}, read: %f,%d,%f,%c "
@@ -1438,9 +1438,11 @@ test_extend_cases(hid_t file, hid_t _dcpl, const char *dset_name,
int (*verify_rtn)(unsigned, const hsize_t *, const void *, const void *);
int (*release_rtn)(void *);
size_t val_size; /* Size of element */
- void *val_rd, *should_be, *init_val, *odd_val, *even_val;
+ void *val_rd, *odd_val;
+ const void *init_val, *should_be, *even_val;
int val_rd_i, init_val_i = 9999;
- comp_vl_datatype val_rd_c, init_val_c = {87, "baz", "mumble", 129};
+ comp_vl_datatype init_val_c = {87, "baz", "mumble", 129};
+ comp_vl_datatype val_rd_c;
void *buf = NULL;
unsigned odd; /* Whether an odd or even coord. was read */
unsigned i, j; /* Local index variables */
@@ -1495,7 +1497,7 @@ test_extend_cases(hid_t file, hid_t _dcpl, const char *dset_name,
for(i = 0; i < 1000; i++) {
/* Set offset for random element */
for(j = 0; j < 5; j++)
- hs_offset[j] = rand() % start_size[j];
+ hs_offset[j] = (hsize_t)HDrand() % start_size[j];
/* Select the random element */
if(H5Sselect_hyperslab(fspace, H5S_SELECT_SET, hs_offset, NULL, one, NULL) < 0) TEST_ERROR
@@ -1548,7 +1550,7 @@ test_extend_cases(hid_t file, hid_t _dcpl, const char *dset_name,
for(i = 0; i < 1000; i++) {
/* Set offset for random element */
for(j = 0, odd = 0; j < 5; j++) {
- hs_offset[j] = rand() % start_size[j];
+ hs_offset[j] = (hsize_t)HDrand() % start_size[j];
odd += (unsigned)(hs_offset[j] % 2);
} /* end for */
@@ -1586,7 +1588,7 @@ test_extend_cases(hid_t file, hid_t _dcpl, const char *dset_name,
for(i = 0; i < 1000; i++) {
/* Set offset for random element */
for(j = 0, odd = 0; j < 5; j++) {
- hs_offset[j] = rand() % extend_size[j];
+ hs_offset[j] = (hsize_t)HDrand() % extend_size[j];
if(hs_offset[j] >= start_size[j])
odd = 1;
else
@@ -1625,7 +1627,7 @@ test_extend_cases(hid_t file, hid_t _dcpl, const char *dset_name,
for(i = 0; i < 1000; i++) {
/* Set offset for random element */
for(j = 0, odd = 0; j < 5; j++) {
- hs_offset[j] = rand() % max_size[j];
+ hs_offset[j] = (hsize_t)HDrand() % max_size[j];
if(hs_offset[j] >= start_size[j])
odd = 1;
else
@@ -1666,7 +1668,7 @@ test_extend_cases(hid_t file, hid_t _dcpl, const char *dset_name,
for(i = 0; i < 1000; i++) {
/* Set offset for random element */
for(j = 0, odd = 0; j < 5; j++) {
- hs_offset[j] = rand() % extend_size[j];
+ hs_offset[j] = (hsize_t)HDrand() % extend_size[j];
if(hs_offset[j] >= start_size[j])
odd = 1;
else
@@ -1759,7 +1761,7 @@ test_extend_cases(hid_t file, hid_t _dcpl, const char *dset_name,
for(i = 0; i < 1000; i++) {
/* Set offset for random element */
for(j = 0, odd = 0; j < 5; j++) {
- hs_offset[j] = rand() % extend_size[j];
+ hs_offset[j] = (hsize_t)HDrand() % extend_size[j];
if(hs_offset[j] >= start_size[j])
odd = 1;
else
diff --git a/test/filter_fail.c b/test/filter_fail.c
index 0b92abb..c7248cc 100644
--- a/test/filter_fail.c
+++ b/test/filter_fail.c
@@ -22,7 +22,6 @@
*/
#include "h5test.h"
-#include "H5srcdir.h"
#define DSET_NAME "dset_fail"
#define H5Z_FILTER_FAIL_TEST 312
diff --git a/test/flush1.c b/test/flush1.c
index f15a05a..f1169ea 100644
--- a/test/flush1.c
+++ b/test/flush1.c
@@ -68,13 +68,8 @@ create_file(char* name, hid_t fapl)
/* Write some data */
for(i = 0; i < ds_size[0]; i++)
- /*
- * The extra cast in the following statement is a bug workaround
- * for the Win32 version 5.0 compiler.
- * 1998-11-06 ptl
- */
for(j = 0; j < (size_t)ds_size[1]; j++)
- the_data[i][j] = (double)(hssize_t)i/(hssize_t)(j+1);
+ the_data[i][j] = (double)i / (double)(j + 1);
if(H5Dwrite(dset, H5T_NATIVE_DOUBLE, space, space, H5P_DEFAULT, the_data) < 0) FAIL_STACK_ERROR
/* Create some groups */
@@ -124,25 +119,15 @@ extend_file(hid_t file)
goto error;
/* Write some data */
- for (i=0; i<ds_size[0]; i++) {
- /*
- * The extra cast in the following statement is a bug workaround
- * for the Win32 version 5.0 compiler.
- * 1998-11-06 ptl
- */
- for (j=0; j<(size_t)ds_size[1]; j++) {
- the_data[i][j] = (double)(hssize_t)i/(hssize_t)(j+1);
- }
- }
- if (H5Dwrite(dset, H5T_NATIVE_DOUBLE, space, space, H5P_DEFAULT,
- the_data) < 0) goto error;
-
+ for(i = 0; i < ds_size[0]; i++)
+ for(j = 0; j < (size_t)ds_size[1]; j++)
+ the_data[i][j] = (double)i / (double)(j + 1);
+ if(H5Dwrite(dset, H5T_NATIVE_DOUBLE, space, space, H5P_DEFAULT, the_data) < 0) goto error;
return file;
error:
- HD_exit(1);
-
+ HD_exit(1);
}
/*-------------------------------------------------------------------------
@@ -206,3 +191,4 @@ error:
HD_exit(1);
return 1;
}
+
diff --git a/test/flush2.c b/test/flush2.c
index e86d646..7dc45be 100644
--- a/test/flush2.c
+++ b/test/flush2.c
@@ -63,22 +63,15 @@ check_dset(hid_t file, const char* name)
assert(100 == ds_size[0] && 100 == ds_size[1]);
/* Read some data */
- if(H5Dread(dset, H5T_NATIVE_DOUBLE, space, space, H5P_DEFAULT,
- the_data) < 0) goto error;
+ if(H5Dread(dset, H5T_NATIVE_DOUBLE, space, space, H5P_DEFAULT, the_data) < 0) goto error;
for(i = 0; i < (size_t)ds_size[0]; i++)
for(j = 0; j < (size_t)ds_size[1]; j++) {
- /*
- * The extra cast in the following statement is a bug workaround
- * for the Win32 version 5.0 compiler.
- * 1998-11-06 ptl
- */
- error = fabs(the_data[i][j] - (double)(hssize_t)i / ((hssize_t)j + 1));
- if(error > 0.0001F) {
+ error = HDfabs(the_data[i][j] - (double)i / (double)(j + 1));
+ if(error > (double)0.0001F) {
H5_FAILED();
printf(" dset[%lu][%lu] = %g\n",
(unsigned long)i, (unsigned long)j, the_data[i][j]);
- printf(" should be %g\n",
- (double)(hssize_t)i/(hssize_t)(j+1));
+ printf(" should be %g\n", (double)i / (double)(j + 1));
goto error;
}
}
diff --git a/test/freespace.c b/test/freespace.c
index 6e680c3..1c28bc2 100644
--- a/test/freespace.c
+++ b/test/freespace.c
@@ -455,7 +455,7 @@ test_fs_create(hid_t fapl)
h5_stat_size_t file_size, empty_size; /* File size */
frspace_state_t state; /* State of free space*/
H5FS_create_t cparam, test_cparam; /* creation parameters */
- size_t nclasses;
+ uint16_t nclasses;
unsigned init_flags=0;
TESTING("the creation/close/reopen/deletion of the free-space manager");
@@ -589,7 +589,7 @@ test_fs_sect_add(hid_t fapl)
H5F_t *f = NULL; /* Internal file object pointer */
H5FS_t *frsp = NULL; /* pointer to free space structure */
haddr_t fs_addr=HADDR_UNDEF; /* address of free space */
- size_t nclasses;
+ uint16_t nclasses;
H5FS_create_t cparam; /* creation parameters */
frspace_state_t state; /* State of free space*/
@@ -921,7 +921,7 @@ test_fs_sect_find(hid_t fapl)
H5F_t *f = NULL; /* Internal file object pointer */
H5FS_t *frsp = NULL; /* pointer to free space structure */
haddr_t fs_addr=HADDR_UNDEF; /* address of free space */
- size_t nclasses;
+ uint16_t nclasses;
H5FS_create_t cparam; /* creation parameters */
frspace_state_t state; /* State of free space*/
@@ -1302,7 +1302,7 @@ test_fs_sect_merge(hid_t fapl)
H5F_t *f = NULL; /* Internal file object pointer */
H5FS_t *frsp = NULL; /* pointer to free space structure */
haddr_t fs_addr=HADDR_UNDEF; /* address of free space */
- size_t nclasses;
+ uint16_t nclasses;
H5FS_create_t cparam; /* creation parameters */
frspace_state_t state; /* State of free space*/
@@ -1768,7 +1768,7 @@ test_fs_sect_shrink(hid_t fapl)
H5F_t *f = NULL; /* Internal file object pointer */
H5FS_t *frsp = NULL; /* pointer to free space structure */
haddr_t fs_addr=HADDR_UNDEF; /* address of free space */
- size_t nclasses;
+ uint16_t nclasses;
H5FS_create_t cparam; /* creation parameters */
frspace_state_t state; /* State of free space*/
@@ -2106,7 +2106,7 @@ test_fs_sect_change_class(hid_t fapl)
H5F_t *f = NULL; /* Internal file object pointer */
H5FS_t *frsp = NULL; /* pointer to free space structure */
haddr_t fs_addr=HADDR_UNDEF; /* address of free space */
- size_t nclasses;
+ uint16_t nclasses;
H5FS_create_t cparam; /* creation parameters */
frspace_state_t state; /* State of free space*/
@@ -2396,7 +2396,7 @@ test_fs_sect_extend(hid_t fapl)
H5F_t *f = NULL; /* Internal file object pointer */
H5FS_t *frsp = NULL; /* pointer to free space structure */
haddr_t fs_addr=HADDR_UNDEF; /* address of free space */
- size_t nclasses;
+ uint16_t nclasses;
H5FS_create_t cparam; /* creation parameters */
frspace_state_t state; /* State of free space*/
TEST_free_section_t *sect_node1=NULL, *sect_node2=NULL;
@@ -2744,7 +2744,7 @@ test_fs_sect_iterate(hid_t fapl)
H5F_t *f = NULL; /* Internal file object pointer */
H5FS_t *frsp = NULL; /* pointer to free space structure */
haddr_t fs_addr=HADDR_UNDEF; /* address of free space */
- size_t nclasses;
+ uint16_t nclasses;
H5FS_create_t cparam; /* creation parameters */
TEST_free_section_t *sect_node=NULL;
diff --git a/test/gen_plist.c b/test/gen_plist.c
index b45eeeb..c617ad0 100644
--- a/test/gen_plist.c
+++ b/test/gen_plist.c
@@ -17,11 +17,6 @@
* generate plist file
*/
-#include <assert.h>
-#include <fcntl.h>
-#include <stdlib.h>
-#include <stdio.h>
-#include <unistd.h>
#include "H5private.h"
#include "hdf5.h"
diff --git a/test/getname.c b/test/getname.c
index 2700b49..e6d26ce 100644
--- a/test/getname.c
+++ b/test/getname.c
@@ -2433,6 +2433,7 @@ test_obj_ref(hid_t fapl)
hsize_t dims1[] = {SPACE1_DIM1};
hobj_ref_t wbuf[SPACE1_DIM1]; /* Buffer to write to disk */
int tu32[SPACE1_DIM1]; /* Int data */
+ ssize_t namelen; /* Length of the name */
int i; /* counting variables */
char buf[100];
@@ -2575,104 +2576,104 @@ test_obj_ref(hid_t fapl)
TESTING("getting path to normal dataset in root group");
if((dataset2 = H5Rdereference2(dataset, H5P_DEFAULT, H5R_OBJECT, &wbuf[0])) < 0) FAIL_STACK_ERROR
*buf = '\0';
- i = H5Iget_name(dataset2, (char*)buf, sizeof(buf));
+ namelen = H5Iget_name(dataset2, (char*)buf, sizeof(buf));
if(H5Dclose(dataset2) < 0) FAIL_STACK_ERROR
- if(!((HDstrcmp(buf, "/Dataset3") == 0) &&(i == 9))) TEST_ERROR
+ if(!((HDstrcmp(buf, "/Dataset3") == 0) &&(namelen == 9))) TEST_ERROR
*buf = '\0';
/* Check H5Rget_name returns the correct length of the name when name is NULL */
- i = H5Rget_name(dataset, H5R_OBJECT, &wbuf[0], NULL, 0);
- if(i != 9) TEST_ERROR
+ namelen = H5Rget_name(dataset, H5R_OBJECT, &wbuf[0], NULL, 0);
+ if(namelen != 9) TEST_ERROR
/* Make sure size parameter is ignored */
- i = H5Rget_name(dataset, H5R_OBJECT, &wbuf[0], NULL, 200);
- if(i != 9) TEST_ERROR
+ namelen = H5Rget_name(dataset, H5R_OBJECT, &wbuf[0], NULL, 200);
+ if(namelen != 9) TEST_ERROR
- i = H5Rget_name(dataset, H5R_OBJECT, &wbuf[0], (char*)buf, sizeof(buf));
- if(!((HDstrcmp(buf, "/Dataset3") == 0) &&(i == 9))) TEST_ERROR
+ namelen = H5Rget_name(dataset, H5R_OBJECT, &wbuf[0], (char*)buf, sizeof(buf));
+ if(!((HDstrcmp(buf, "/Dataset3") == 0) &&(namelen == 9))) TEST_ERROR
PASSED()
HDmemset(buf, 0, sizeof(buf));
TESTING("getting path to dataset in /Group1");
if((dataset2 = H5Rdereference2(dataset, H5P_DEFAULT, H5R_OBJECT, &wbuf[1])) < 0) FAIL_STACK_ERROR
*buf = '\0';
- i = H5Iget_name(dataset2, (char*)buf, sizeof(buf));
+ namelen = H5Iget_name(dataset2, (char*)buf, sizeof(buf));
if(H5Dclose(dataset2) < 0) FAIL_STACK_ERROR
- if(!((HDstrcmp(buf, "/Group1/Dataset2") == 0) &&(i == 16))) TEST_ERROR
+ if(!((HDstrcmp(buf, "/Group1/Dataset2") == 0) &&(namelen == 16))) TEST_ERROR
*buf = '\0';
- i = H5Rget_name(dataset, H5R_OBJECT, &wbuf[1], (char*)buf, sizeof(buf));
- if(!((HDstrcmp(buf, "/Group1/Dataset2") == 0) &&(i == 16))) TEST_ERROR
+ namelen = H5Rget_name(dataset, H5R_OBJECT, &wbuf[1], (char*)buf, sizeof(buf));
+ if(!((HDstrcmp(buf, "/Group1/Dataset2") == 0) &&(namelen == 16))) TEST_ERROR
PASSED()
HDmemset(buf, 0, sizeof(buf));
TESTING("getting path to /Group1");
if((group = H5Rdereference2(dataset, H5P_DEFAULT, H5R_OBJECT, &wbuf[2])) < 0) FAIL_STACK_ERROR
*buf = '\0';
- i = H5Iget_name(group, (char*)buf, sizeof(buf));
+ namelen = H5Iget_name(group, (char*)buf, sizeof(buf));
if(H5Gclose(group) < 0) FAIL_STACK_ERROR
- if(!((HDstrcmp(buf, "/Group1") == 0) &&(i == 7))) TEST_ERROR
+ if(!((HDstrcmp(buf, "/Group1") == 0) &&(namelen == 7))) TEST_ERROR
*buf = '\0';
- i = H5Rget_name(dataset, H5R_OBJECT, &wbuf[2], (char*)buf, sizeof(buf));
- if(!((HDstrcmp(buf, "/Group1") == 0) &&(i == 7))) TEST_ERROR
+ namelen = H5Rget_name(dataset, H5R_OBJECT, &wbuf[2], (char*)buf, sizeof(buf));
+ if(!((HDstrcmp(buf, "/Group1") == 0) &&(namelen == 7))) TEST_ERROR
PASSED()
HDmemset(buf, 0, sizeof(buf));
TESTING("getting path to datatype in /Group1");
if((tid1 = H5Rdereference2(dataset, H5P_DEFAULT, H5R_OBJECT, &wbuf[3])) < 0) FAIL_STACK_ERROR
*buf = '\0';
- i = H5Iget_name(tid1, (char*)buf, sizeof(buf));
+ namelen = H5Iget_name(tid1, (char*)buf, sizeof(buf));
if(H5Tclose(tid1) < 0) FAIL_STACK_ERROR
- if(!((HDstrcmp(buf, "/Group1/Datatype1") == 0) &&(i == 17))) TEST_ERROR
+ if(!((HDstrcmp(buf, "/Group1/Datatype1") == 0) &&(namelen == 17))) TEST_ERROR
*buf = '\0';
- i = H5Rget_name(dataset, H5R_OBJECT, &wbuf[3], (char*)buf, sizeof(buf));
- if(!((HDstrcmp(buf, "/Group1/Datatype1") == 0) &&(i == 17))) TEST_ERROR
+ namelen = H5Rget_name(dataset, H5R_OBJECT, &wbuf[3], (char*)buf, sizeof(buf));
+ if(!((HDstrcmp(buf, "/Group1/Datatype1") == 0) &&(namelen == 17))) TEST_ERROR
PASSED()
HDmemset(buf, 0, sizeof(buf));
TESTING("getting path to dataset in nested group");
if((dataset2 = H5Rdereference2(dataset, H5P_DEFAULT, H5R_OBJECT, &wbuf[4])) < 0) FAIL_STACK_ERROR
*buf = '\0';
- i = H5Iget_name(dataset2, (char*)buf, sizeof(buf));
+ namelen = H5Iget_name(dataset2, (char*)buf, sizeof(buf));
if(H5Dclose(dataset2) < 0) FAIL_STACK_ERROR
- if(!((HDstrcmp(buf, "/Group1/Group2/Dataset4") == 0) &&(i == 23))) TEST_ERROR
+ if(!((HDstrcmp(buf, "/Group1/Group2/Dataset4") == 0) &&(namelen == 23))) TEST_ERROR
*buf = '\0';
- i = H5Rget_name(dataset, H5R_OBJECT, &wbuf[4], (char*)buf, sizeof(buf));
- if(!((HDstrcmp(buf, "/Group1/Group2/Dataset4") == 0) &&(i == 23))) TEST_ERROR
+ namelen = H5Rget_name(dataset, H5R_OBJECT, &wbuf[4], (char*)buf, sizeof(buf));
+ if(!((HDstrcmp(buf, "/Group1/Group2/Dataset4") == 0) &&(namelen == 23))) TEST_ERROR
PASSED()
HDmemset(buf, 0, sizeof(buf));
TESTING("getting path to nested group");
if((group = H5Rdereference2(dataset, H5P_DEFAULT, H5R_OBJECT, &wbuf[5])) < 0) FAIL_STACK_ERROR
*buf = '\0';
- i = H5Iget_name(group, (char*)buf, sizeof(buf));
+ namelen = H5Iget_name(group, (char*)buf, sizeof(buf));
if(H5Gclose(group) < 0) FAIL_STACK_ERROR
- if(!((HDstrcmp(buf, "/Group1/Group2") == 0) &&(i == 14))) TEST_ERROR
+ if(!((HDstrcmp(buf, "/Group1/Group2") == 0) &&(namelen == 14))) TEST_ERROR
*buf = '\0';
- i = H5Rget_name(dataset, H5R_OBJECT, &wbuf[5], (char*)buf, sizeof(buf));
- if(!((HDstrcmp(buf, "/Group1/Group2") == 0) &&(i == 14))) TEST_ERROR
+ namelen = H5Rget_name(dataset, H5R_OBJECT, &wbuf[5], (char*)buf, sizeof(buf));
+ if(!((HDstrcmp(buf, "/Group1/Group2") == 0) &&(namelen == 14))) TEST_ERROR
PASSED()
HDmemset(buf, 0, sizeof(buf));
TESTING("getting path to dataset created via hard link");
if((dataset2 = H5Rdereference2(dataset, H5P_DEFAULT, H5R_OBJECT, &wbuf[6])) < 0) FAIL_STACK_ERROR
*buf = '\0';
- i = H5Iget_name(dataset2, (char*)buf, sizeof(buf));
+ namelen = H5Iget_name(dataset2, (char*)buf, sizeof(buf));
if(H5Dclose(dataset2) < 0) FAIL_STACK_ERROR
- if(!((HDstrcmp(buf, "/Group1/Dataset5") == 0) &&(i == 16))) TEST_ERROR
+ if(!((HDstrcmp(buf, "/Group1/Dataset5") == 0) &&(namelen == 16))) TEST_ERROR
*buf = '\0';
- i = H5Rget_name(dataset, H5R_OBJECT, &wbuf[6], (char*)buf, sizeof(buf));
- if(!((HDstrcmp(buf, "/Group1/Dataset5") == 0) &&(i == 16))) TEST_ERROR
+ namelen = H5Rget_name(dataset, H5R_OBJECT, &wbuf[6], (char*)buf, sizeof(buf));
+ if(!((HDstrcmp(buf, "/Group1/Dataset5") == 0) &&(namelen == 16))) TEST_ERROR
PASSED()
HDmemset(buf, 0, sizeof(buf));
TESTING("getting path to root group");
if((group = H5Rdereference2(dataset, H5P_DEFAULT, H5R_OBJECT, &wbuf[7])) < 0) FAIL_STACK_ERROR
*buf = '\0';
- i = H5Iget_name(group, (char*)buf, sizeof(buf));
+ namelen = H5Iget_name(group, (char*)buf, sizeof(buf));
if(H5Gclose(group) < 0) FAIL_STACK_ERROR
- if(!((HDstrcmp(buf, "/") == 0) &&(i == 1))) TEST_ERROR
+ if(!((HDstrcmp(buf, "/") == 0) &&(namelen == 1))) TEST_ERROR
*buf = '\0';
- i = H5Rget_name(dataset, H5R_OBJECT, &wbuf[7], (char*)buf, sizeof(buf));
- if(!((HDstrcmp(buf, "/") == 0) &&(i == 1))) TEST_ERROR
+ namelen = H5Rget_name(dataset, H5R_OBJECT, &wbuf[7], (char*)buf, sizeof(buf));
+ if(!((HDstrcmp(buf, "/") == 0) &&(namelen == 1))) TEST_ERROR
PASSED()
/* Now we mount fid2 at /Group2 and look for dataset4. It shouldn't be found */
@@ -2682,12 +2683,12 @@ test_obj_ref(hid_t fapl)
TESTING("getting path to dataset hidden by a mounted file");
if((dataset2 = H5Rdereference2(dataset, H5P_DEFAULT, H5R_OBJECT, &wbuf[4])) < 0) FAIL_STACK_ERROR
*buf = '\0';
- i = H5Iget_name(dataset2, (char*)buf, sizeof(buf));
+ namelen = H5Iget_name(dataset2, (char*)buf, sizeof(buf));
if(H5Dclose(dataset2) < 0) FAIL_STACK_ERROR
- if(i != 0) TEST_ERROR
+ if(namelen != 0) TEST_ERROR
*buf = '\0';
- i = H5Rget_name(dataset, H5R_OBJECT, &wbuf[4], (char*)buf, sizeof(buf));
- if(i != 0) TEST_ERROR
+ namelen = H5Rget_name(dataset, H5R_OBJECT, &wbuf[4], (char*)buf, sizeof(buf));
+ if(namelen != 0) TEST_ERROR
PASSED()
/* Now we try unlinking dataset2 from the file and searching for it. It shouldn't be found */
@@ -2698,12 +2699,12 @@ test_obj_ref(hid_t fapl)
TESTING("getting path to dataset that has been unlinked");
*buf = '\0';
- i = H5Iget_name(dataset2, (char*)buf, sizeof(buf));
+ namelen = H5Iget_name(dataset2, (char*)buf, sizeof(buf));
if(H5Dclose(dataset2) < 0) FAIL_STACK_ERROR
- if(i != 0) TEST_ERROR
+ if(namelen != 0) TEST_ERROR
*buf = '\0';
- i = H5Rget_name(dataset, H5R_OBJECT, &wbuf[1], (char*)buf, sizeof(buf));
- if(i != 0) TEST_ERROR
+ namelen = H5Rget_name(dataset, H5R_OBJECT, &wbuf[1], (char*)buf, sizeof(buf));
+ if(namelen != 0) TEST_ERROR
PASSED()
/* Close disk dataspace */
diff --git a/test/gheap.c b/test/gheap.c
index 3f66d35..317e306 100644
--- a/test/gheap.c
+++ b/test/gheap.c
@@ -81,7 +81,7 @@ test_1 (hid_t fapl)
H5HG_t obj[1024];
uint8_t out[1024];
uint8_t in[1024];
- int i;
+ size_t u;
size_t size;
herr_t status;
int nerrors = 0;
@@ -104,16 +104,16 @@ test_1 (hid_t fapl)
* a clean file, the addresses allocated for the collections should also
* be monotonically increasing.
*/
- for(i = 0; i < 1024; i++) {
- size = i + 1;
- HDmemset(out, 'A' + i % 26, size);
+ for(u = 0; u < 1024; u++) {
+ size = u + 1;
+ HDmemset(out, (int)('A' + u % 26), size);
H5Eclear2(H5E_DEFAULT);
- status = H5HG_insert(f, H5AC_ind_read_dxpl_id, size, out, obj + i);
+ status = H5HG_insert(f, H5AC_ind_read_dxpl_id, size, out, obj + u);
if(status < 0) {
H5_FAILED();
puts(" Unable to insert object into global heap");
nerrors++;
- } else if(i && H5F_addr_gt(obj[i - 1].addr, obj[i].addr)) {
+ } else if(u && H5F_addr_gt(obj[u - 1].addr, obj[u].addr)) {
H5_FAILED();
puts(" Collection addresses are not monotonically increasing");
nerrors++;
@@ -123,11 +123,11 @@ test_1 (hid_t fapl)
/*
* Now try to read each object back.
*/
- for(i = 0; i < 1024; i++) {
- size = i + 1;
- HDmemset(out, 'A' + i % 26, size);
+ for(u = 0; u < 1024; u++) {
+ size = u + 1;
+ HDmemset(out, (int)('A' + u % 26), size);
H5Eclear2(H5E_DEFAULT);
- if(NULL == H5HG_read(f, H5AC_ind_read_dxpl_id, obj + i, in, NULL)) {
+ if(NULL == H5HG_read(f, H5AC_ind_read_dxpl_id, obj + u, in, NULL)) {
H5_FAILED();
puts(" Unable to read object");
nerrors++;
@@ -177,7 +177,7 @@ test_2 (hid_t fapl)
H5HG_t obj[1024];
uint8_t out[1024];
uint8_t in[1024];
- int i;
+ size_t u;
size_t size;
int nerrors = 0;
char filename[1024];
@@ -197,11 +197,11 @@ test_2 (hid_t fapl)
/*
* Write the objects, monotonically decreasing in length.
*/
- for (i=0; i<1024; i++) {
- size = 1024-i;
- memset (out, 'A'+i%26, size);
+ for(u = 0; u < 1024; u++) {
+ size = 1024 - u;
+ HDmemset(out, (int)('A' + u % 26), size);
H5Eclear2(H5E_DEFAULT);
- if (H5HG_insert (f, H5AC_ind_read_dxpl_id, size, out, obj+i)<0) {
+ if (H5HG_insert (f, H5AC_ind_read_dxpl_id, size, out, obj + u) < 0) {
H5_FAILED();
puts(" Unable to insert object into global heap");
nerrors++;
@@ -211,11 +211,11 @@ test_2 (hid_t fapl)
/*
* Now try to read each object back.
*/
- for (i=0; i<1024; i++) {
- size = 1024-i;
- memset (out, 'A'+i%26, size);
+ for(u = 0; u < 1024; u++) {
+ size = 1024 - u;
+ HDmemset(out, (int)('A' + u % 26), size);
H5Eclear2(H5E_DEFAULT);
- if (NULL==H5HG_read (f, H5AC_ind_read_dxpl_id, obj+i, in, NULL)) {
+ if (NULL==H5HG_read (f, H5AC_ind_read_dxpl_id, obj + u, in, NULL)) {
H5_FAILED();
puts(" Unable to read object");
nerrors++;
@@ -263,7 +263,7 @@ test_3 (hid_t fapl)
H5F_t *f = NULL;
H5HG_t obj[1024];
uint8_t out[1024];
- int i;
+ size_t u;
size_t size;
herr_t status;
int nerrors = 0;
@@ -282,11 +282,11 @@ test_3 (hid_t fapl)
}
/* Create some stuff */
- for (i=0; i<1024; i++) {
- size = i%30+100;
- memset (out, 'A'+i%26, size);
+ for(u = 0; u < 1024; u++) {
+ size = u % 30 + 100;
+ HDmemset(out, (int)('A' + u % 26), size);
H5Eclear2(H5E_DEFAULT);
- status = H5HG_insert (f, H5AC_ind_read_dxpl_id, size, out, obj+i);
+ status = H5HG_insert (f, H5AC_ind_read_dxpl_id, size, out, obj + u);
if (status<0) {
H5_FAILED();
puts(" Unable to insert object into global heap");
@@ -295,8 +295,8 @@ test_3 (hid_t fapl)
}
/* Remove everything */
- for (i=0; i<1024; i++) {
- status = H5HG_remove (f, H5AC_ind_read_dxpl_id, obj+i);
+ for(u = 0; u < 1024; u++) {
+ status = H5HG_remove (f, H5AC_ind_read_dxpl_id, obj + u);
if (status<0) {
H5_FAILED();
puts(" Unable to remove object");
@@ -342,7 +342,7 @@ test_4 (hid_t fapl)
H5F_t *f = NULL;
H5HG_t obj[1024];
uint8_t out[1024];
- int i;
+ size_t u;
size_t size;
herr_t status;
int nerrors = 0;
@@ -360,12 +360,12 @@ test_4 (hid_t fapl)
goto error;
}
- for (i=0; i<1024; i++) {
+ for(u = 0; u < 1024; u++) {
/* Insert */
- size = i%30+100;
- memset (out, 'A'+i%26, size);
+ size = u % 30 + 100;
+ HDmemset(out, (int)('A' + u % 26), size);
H5Eclear2(H5E_DEFAULT);
- status = H5HG_insert (f, H5AC_ind_read_dxpl_id, size, out, obj+i);
+ status = H5HG_insert (f, H5AC_ind_read_dxpl_id, size, out, obj + u);
if (status<0) {
H5_FAILED();
puts(" Unable to insert object into global heap");
@@ -377,15 +377,15 @@ test_4 (hid_t fapl)
* next one has already been inserted. That is, insert A, B, C;
* remove B, insert D, E, F; remove E; etc.
*/
- if (1==i%3) {
+ if(1 == (u % 3)) {
H5Eclear2(H5E_DEFAULT);
- status = H5HG_remove (f, H5AC_ind_read_dxpl_id, obj+i-1);
+ status = H5HG_remove (f, H5AC_ind_read_dxpl_id, obj + u - 1);
if (status<0) {
H5_FAILED();
puts(" Unable to remove object");
nerrors++;
}
- memset (obj+i-1, 0, sizeof *obj);
+ HDmemset(obj + u - 1, 0, sizeof *obj);
}
}
diff --git a/test/h5test.c b/test/h5test.c
index 6267137..aea5dc7 100644
--- a/test/h5test.c
+++ b/test/h5test.c
@@ -782,21 +782,18 @@ h5_rmprefix(const char *filename)
/*-------------------------------------------------------------------------
- * Function: h5_fileaccess
+ * Function: h5_fileaccess
*
- * Purpose: Returns a file access template which is the default template
- * but with a file driver set according to the constant or
- * environment variable HDF5_DRIVER
+ * Purpose: Returns a file access template which is the default template
+ * but with a file driver set according to the constant or
+ * environment variable HDF5_DRIVER
*
- * Return: Success: A file access property list
- *
- * Failure: -1
+ * Return: Success: A file access property list
+ * Failure: -1
*
* Programmer: Robb Matzke
* Thursday, November 19, 1998
*
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
hid_t
@@ -804,45 +801,56 @@ h5_fileaccess(void)
{
const char *val = NULL;
const char *name;
- char s[1024];
- hid_t fapl = -1;
+ char s[1024];
+ hid_t fapl = -1;
/* First use the environment variable, then the constant */
val = HDgetenv("HDF5_DRIVER");
#ifdef HDF5_DRIVER
- if (!val)
+ if(!val)
val = HDF5_DRIVER;
#endif
- if ((fapl=H5Pcreate(H5P_FILE_ACCESS))<0)
+ if((fapl = H5Pcreate(H5P_FILE_ACCESS)) < 0)
return -1;
- if (!val || !*val)
- return fapl; /*use default*/
+ if(!val || !*val)
+ return fapl; /* use default */
HDstrncpy(s, val, sizeof s);
s[sizeof(s)-1] = '\0';
- if (NULL==(name=HDstrtok(s, " \t\n\r"))) return fapl;
+ if(NULL == (name = HDstrtok(s, " \t\n\r")))
+ return fapl;
- if (!HDstrcmp(name, "sec2")) {
+ if(!HDstrcmp(name, "sec2")) {
/* Unix read() and write() system calls */
- if (H5Pset_fapl_sec2(fapl)<0) return -1;
- } else if (!HDstrcmp(name, "stdio")) {
+ if (H5Pset_fapl_sec2(fapl) < 0)
+ return -1;
+ }
+ else if(!HDstrcmp(name, "stdio")) {
/* Standard C fread() and fwrite() system calls */
- if (H5Pset_fapl_stdio(fapl)<0) return -1;
- } else if (!HDstrcmp(name, "core")) {
+ if (H5Pset_fapl_stdio(fapl) < 0)
+ return -1;
+ }
+ else if(!HDstrcmp(name, "core")) {
/* In-memory driver settings (backing store on, 1 MB increment) */
- if (H5Pset_fapl_core(fapl, (size_t)1, TRUE)<0) return -1;
- } else if (!HDstrcmp(name, "core_paged")) {
+ if(H5Pset_fapl_core(fapl, (size_t)1, TRUE) < 0)
+ return -1;
+ }
+ else if(!HDstrcmp(name, "core_paged")) {
/* In-memory driver with write tracking and paging on */
- if (H5Pset_fapl_core(fapl, (size_t)1, TRUE)<0) return -1;
- if (H5Pset_core_write_tracking(fapl, TRUE, (size_t)4096)<0) return -1;
- } else if (!HDstrcmp(name, "split")) {
+ if(H5Pset_fapl_core(fapl, (size_t)1, TRUE) < 0)
+ return -1;
+ if(H5Pset_core_write_tracking(fapl, TRUE, (size_t)4096) < 0)
+ return -1;
+ }
+ else if(!HDstrcmp(name, "split")) {
/* Split meta data and raw data each using default driver */
- if (H5Pset_fapl_split(fapl,
+ if(H5Pset_fapl_split(fapl,
"-m.h5", H5P_DEFAULT,
- "-r.h5", H5P_DEFAULT)<0)
+ "-r.h5", H5P_DEFAULT) < 0)
return -1;
- } else if (!HDstrcmp(name, "multi")) {
+ }
+ else if(!HDstrcmp(name, "multi")) {
/* Multi-file driver, general case of the split driver */
H5FD_mem_t memb_map[H5FD_MEM_NTYPES];
hid_t memb_fapl[H5FD_MEM_NTYPES];
@@ -858,45 +866,47 @@ h5_fileaccess(void)
HDassert(HDstrlen(multi_letters)==H5FD_MEM_NTYPES);
for(mt = H5FD_MEM_DEFAULT; mt < H5FD_MEM_NTYPES; H5_INC_ENUM(H5FD_mem_t, mt)) {
- memb_fapl[mt] = H5P_DEFAULT;
- sprintf(sv[mt], "%%s-%c.h5", multi_letters[mt]);
+ memb_fapl[mt] = H5P_DEFAULT;
+ HDsprintf(sv[mt], "%%s-%c.h5", multi_letters[mt]);
memb_name[mt] = sv[mt];
memb_addr[mt] = (haddr_t)MAX(mt - 1, 0) * (HADDR_MAX / 10);
} /* end for */
- if (H5Pset_fapl_multi(fapl, memb_map, memb_fapl, memb_name,
- memb_addr, FALSE)<0) {
+ if(H5Pset_fapl_multi(fapl, memb_map, memb_fapl, memb_name, memb_addr, FALSE) < 0)
return -1;
- }
- } else if (!HDstrcmp(name, "family")) {
+ }
+ else if(!HDstrcmp(name, "family")) {
hsize_t fam_size = 100*1024*1024; /*100 MB*/
/* Family of files, each 1MB and using the default driver */
- if ((val=HDstrtok(NULL, " \t\n\r")))
+ if((val = HDstrtok(NULL, " \t\n\r")))
fam_size = (hsize_t)(HDstrtod(val, NULL) * 1024*1024);
- if (H5Pset_fapl_family(fapl, fam_size, H5P_DEFAULT)<0)
+ if(H5Pset_fapl_family(fapl, fam_size, H5P_DEFAULT)<0)
return -1;
- } else if (!HDstrcmp(name, "log")) {
+ }
+ else if(!HDstrcmp(name, "log")) {
unsigned log_flags = H5FD_LOG_LOC_IO | H5FD_LOG_ALLOC;
/* Log file access */
- if ((val = HDstrtok(NULL, " \t\n\r")))
+ if((val = HDstrtok(NULL, " \t\n\r")))
log_flags = (unsigned)HDstrtol(val, NULL, 0);
-
- if (H5Pset_fapl_log(fapl, NULL, log_flags, (size_t)0) < 0)
+ if(H5Pset_fapl_log(fapl, NULL, log_flags, (size_t)0) < 0)
return -1;
- } else if (!HDstrcmp(name, "direct")) {
+ }
+ else if(!HDstrcmp(name, "direct")) {
#ifdef H5_HAVE_DIRECT
/* Linux direct read() and write() system calls. Set memory boundary, file block size,
* and copy buffer size to the default values. */
- if (H5Pset_fapl_direct(fapl, 1024, 4096, 8*4096)<0)
+ if(H5Pset_fapl_direct(fapl, 1024, 4096, 8 * 4096) < 0)
return -1;
#endif
- } else if(!HDstrcmp(name, "latest")) {
+ }
+ else if(!HDstrcmp(name, "latest")) {
/* use the latest format */
if(H5Pset_libver_bounds(fapl, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST) < 0)
return -1;
- } else {
+ }
+ else {
/* Unknown driver */
return -1;
}
diff --git a/test/h5test.h b/test/h5test.h
index 575497b..6806e8f 100644
--- a/test/h5test.h
+++ b/test/h5test.h
@@ -166,6 +166,7 @@ H5TEST_DLL void TestParseCmdLine(int argc, char *argv[]);
H5TEST_DLL void PerformTests(void);
H5TEST_DLL void TestSummary(void);
H5TEST_DLL void TestCleanup(void);
+H5TEST_DLL void TestShutdown(void);
H5TEST_DLL void TestInit(const char *ProgName, void (*private_usage)(void), int (*private_parser)(int ac, char *av[]));
H5TEST_DLL int GetTestVerbosity(void);
H5TEST_DLL int SetTestVerbosity(int newval);
diff --git a/test/hyperslab.c b/test/hyperslab.c
index 2cf47b1..9ba5731 100644
--- a/test/hyperslab.c
+++ b/test/hyperslab.c
@@ -223,7 +223,7 @@ test_fill(size_t nx, size_t ny, size_t nz,
for(v = (size_t)dst_offset[1]; v < dst_offset[1] + dy; v++)
for(w = (size_t)dst_offset[2]; w < dst_offset[2] + dz; w++)
ref_value -= dst[u * ny * nz + v * nz + w];
- ref_value += fill_value * dx * dy * dz;
+ ref_value += fill_value * (unsigned)dx * (unsigned)dy * (unsigned)dz;
/* Fill the hyperslab with some value */
H5VM_hyper_fill(ndims, hs_size, dst_size, dst_offset, dst, fill_value);
@@ -819,8 +819,8 @@ test_transpose(size_t nx, size_t ny)
size[1] = ny;
src_stride[0] = 0;
src_stride[1] = sizeof(*src);
- dst_stride[0] = (ssize_t)((1 - nx * ny) * sizeof(*src));
- dst_stride[1] = (ssize_t)(nx * sizeof(*src));
+ dst_stride[0] = (hsize_t)((1 - nx * ny) * sizeof(*src));
+ dst_stride[1] = (hsize_t)(nx * sizeof(*src));
/* Copy and transpose */
if(nx == ny)
@@ -923,7 +923,7 @@ test_sub_super(size_t nx, size_t ny)
/* Setup */
size[0] = nx;
size[1] = ny;
- src_stride[0] = (ssize_t)(2 * ny);
+ src_stride[0] = (hsize_t)(2 * ny);
src_stride[1] = 2;
dst_stride[0] = 0;
dst_stride[1] = 1;
@@ -972,9 +972,9 @@ test_sub_super(size_t nx, size_t ny)
src_stride[1] = 1;
src_stride[2] = 0;
src_stride[3] = 0;
- dst_stride[0] = (ssize_t)(2 * ny);
- dst_stride[1] = (ssize_t)(2 * sizeof(uint8_t) - 4 * ny);
- dst_stride[2] = (ssize_t)(2 * ny - 2 * sizeof(uint8_t));
+ dst_stride[0] = (hsize_t)(2 * ny);
+ dst_stride[1] = (hsize_t)(2 * sizeof(uint8_t) - 4 * ny);
+ dst_stride[2] = (hsize_t)(2 * ny - 2 * sizeof(uint8_t));
dst_stride[3] = sizeof(uint8_t);
/* Copy */
@@ -1144,9 +1144,9 @@ test_array_offset_n_calc(size_t n, size_t x, size_t y, size_t z)
/* Check offsets */
for(u = 0; u < n; u++) {
/* Get random coordinate */
- coords[0] = (hssize_t)(HDrandom() % z);
- coords[1] = (hssize_t)(HDrandom() % y);
- coords[2] = (hssize_t)(HDrandom() % x);
+ coords[0] = (hsize_t)((size_t)HDrandom() % z);
+ coords[1] = (hsize_t)((size_t)HDrandom() % y);
+ coords[2] = (hsize_t)((size_t)HDrandom() % x);
/* Get offset of coordinate */
off = H5VM_array_offset(ARRAY_OFFSET_NDIMS, dims, coords);
diff --git a/test/lheap.c b/test/lheap.c
index 2f3359f..61323a9 100644
--- a/test/lheap.c
+++ b/test/lheap.c
@@ -158,9 +158,9 @@ main(void)
if (strcmp(s, buf)) {
H5_FAILED();
- printf(" i=%d, heap offset=%lu\n", i, (unsigned long)(obj[i]));
- printf(" got: \"%s\"\n", s);
- printf(" ans: \"%s\"\n", buf);
+ HDprintf(" i=%d, heap offset=%lu\n", i, (unsigned long)(obj[i]));
+ HDprintf(" got: \"%s\"\n", s);
+ HDprintf(" ans: \"%s\"\n", buf);
goto error;
}
@@ -191,7 +191,7 @@ main(void)
}
else {
H5_FAILED();
- printf("***cannot open the pre-created non-default sizes test file (%s)\n",
+ HDprintf("***cannot open the pre-created non-default sizes test file (%s)\n",
testfile);
goto error;
} /* end else */
@@ -201,13 +201,13 @@ main(void)
/* Verify symbol table messages are cached */
if(h5_verify_cached_stabs(FILENAME, fapl) < 0) TEST_ERROR
- puts("All local heap tests passed.");
+ HDputs("All local heap tests passed.");
h5_cleanup(FILENAME, fapl);
return 0;
error:
- puts("*** TESTS FAILED ***");
+ HDputs("*** TESTS FAILED ***");
H5E_BEGIN_TRY {
H5Fclose(file);
} H5E_END_TRY;
diff --git a/test/links.c b/test/links.c
index 639a2d8..f60a88a 100644
--- a/test/links.c
+++ b/test/links.c
@@ -7303,6 +7303,281 @@ error:
/*-------------------------------------------------------------------------
+ * Function: external_link_with_committed_datatype
+ *
+ * Purpose: Test to verify the problem described in HDFFV-9940 is resolved.
+ * (A) Attach an attribute to an externally linked group in the target file.
+ * The attribute's datatype is a committed datatype to the root group
+ * in the main file.
+ * (B) Create a dataset to an externally group in the target file.
+ * The dataset's datatype is a committed datatype to the root group
+ * in the main file.
+ *
+ * Return: Success: 0
+ * Failure: -1
+ *
+ * Programmer: This is copied and modified from the customer's test program that
+ * exposed the problem.
+ *
+ *-------------------------------------------------------------------------
+ */
+static int
+external_link_with_committed_datatype(hid_t fapl, hbool_t new_format)
+{
+ hid_t fid1 = -1, fid2 = -1; /* File IDs */
+ hid_t gid1 = -1, gid2 = -1; /* Group IDs */
+ hid_t tid = -1; /* Datatype ID */
+ hid_t sid = -1; /* Dataspace ID */
+ hid_t sid2 = -1; /* Dataspace ID */
+ hid_t aid = -1; /* Attribute ID */
+ hid_t atid = -1; /* Attribute's datatype ID */
+ hid_t did = -1; /* Dataset ID */
+ hid_t dtid = -1; /* Dataset's datatype ID */
+ hid_t dcpl = -1; /* Dataset creation property list */
+ int wdata = 99; /* Attribute data written */
+ int wbuf[60]; /* Data buffer for writing */
+ int rbuf[60]; /* Data buffer for reading */
+ int i; /* Local index variable */
+ char filename1[NAME_BUF_SIZE]; /* File name for main file */
+ char filename2[NAME_BUF_SIZE]; /* File name for target file */
+ hsize_t dims[2] = {5, 12}; /* Dimension sizes */
+ hsize_t chunks[2] = {3, 7}; /* Chunk sizes */
+
+ if(new_format)
+ TESTING("attach committed datatype to external group's attribute/dataset(w/new group format)")
+ else
+ TESTING("attach committed datatype to external group's attribute/dataset")
+
+ /* Set up filenames */
+ h5_fixname(FILENAME[0], fapl, filename1, sizeof filename1);
+ h5_fixname(FILENAME[1], fapl, filename2, sizeof filename2);
+
+
+ /* Main file */
+ if((fid1 = H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
+ FAIL_STACK_ERROR
+
+ /* Create external link from main file to target file */
+ if(H5Lcreate_external(filename2, "target_group", fid1, "link_to_2", H5P_DEFAULT, H5P_DEFAULT) < 0)
+ FAIL_STACK_ERROR
+
+
+ /* Create target file */
+ if((fid2 = H5Fcreate(filename2, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
+ FAIL_STACK_ERROR
+ /* Create group in target file */
+ if((gid2 = H5Gcreate2(fid2, "target_group", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
+
+ /* Close the group */
+ if(H5Gclose(gid2) < 0)
+ FAIL_STACK_ERROR
+ /* Close the file */
+ if(H5Fclose(fid2) < 0)
+ FAIL_STACK_ERROR
+
+ /* Open the group which is externally linked to target file */
+ if((gid1 = H5Gopen2(fid1, "link_to_2", H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
+
+ /* Create a copy of integer datatype */
+ if((tid = H5Tcopy(H5T_NATIVE_INT)) < 0)
+ FAIL_STACK_ERROR
+
+ /* Commit the datatype to the main file root group */
+ if(H5Tcommit2(fid1, "myDatatype", tid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT) < 0)
+ FAIL_STACK_ERROR
+
+ /* Create dataspace */
+ if((sid = H5Screate(H5S_SCALAR)) < 0)
+ FAIL_STACK_ERROR
+
+ /* Attach an attribute with the committed datatype to the group */
+ if((aid = H5Acreate2(gid1, "myAttribute", tid, sid, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
+
+ /* Write data to the attribute */
+ if(H5Awrite(aid, tid, &wdata) < 0)
+ FAIL_STACK_ERROR
+
+ /* Get the attribute's datatype */
+ if((atid = H5Aget_type(aid)) < 0)
+ FAIL_STACK_ERROR
+
+ /* Verify the datatype is not committed */
+ if(H5Tcommitted(atid) == TRUE)
+ FAIL_STACK_ERROR
+
+ /* Close the attribute */
+ if(H5Aclose(aid) < 0)
+ FAIL_STACK_ERROR
+
+ /* Create a chunked dataset */
+ if((sid2 = H5Screate_simple(2, dims, NULL)) < 0)
+ FAIL_STACK_ERROR
+
+ if((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0)
+ FAIL_STACK_ERROR
+ if(H5Pset_chunk(dcpl, 2, chunks) < 0)
+ FAIL_STACK_ERROR
+
+ /* Initialize data buffers */
+ for(i = 0; i < 60; i++) {
+ wbuf[i] = i;
+ rbuf[i] = 0;
+ }
+
+ /* Create a dataset with the committed datatype in the group */
+ if((did = H5Dcreate2(gid1, "myDataset", tid, sid2, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
+
+ /* Write to the dataset */
+ if(H5Dwrite(did, tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, wbuf) < 0)
+ FAIL_STACK_ERROR
+
+ /* Get the dataset's datatype */
+ if((dtid = H5Dget_type(did)) < 0)
+ FAIL_STACK_ERROR
+
+ /* Verify the datatype is not committed */
+ if(H5Tcommitted(dtid) == TRUE)
+ FAIL_STACK_ERROR
+
+ /* Close the dataset */
+ if(H5Dclose(did) < 0)
+ FAIL_STACK_ERROR
+
+ /* Close the dataset creation property list */
+ if(H5Pclose(dcpl) < 0)
+ FAIL_STACK_ERROR
+
+ /* Close the dataspaces */
+ if(H5Sclose(sid) < 0)
+ FAIL_STACK_ERROR
+ if(H5Sclose(sid2) < 0)
+ FAIL_STACK_ERROR
+
+ /* Close the datatypes */
+ if(H5Tclose(tid) < 0)
+ FAIL_STACK_ERROR
+ if(H5Tclose(atid) < 0)
+ FAIL_STACK_ERROR
+ if(H5Tclose(dtid) < 0)
+ FAIL_STACK_ERROR
+
+ /* Close the group */
+ if(H5Gclose(gid1) < 0)
+ FAIL_STACK_ERROR
+
+ /* Close the file */
+ if(H5Fclose(fid1) < 0)
+ FAIL_STACK_ERROR
+
+
+ /* Open the mainfile */
+ if((fid1 = H5Fopen(filename1, H5F_ACC_RDWR, fapl)) < 0)
+ FAIL_STACK_ERROR
+
+ /* Open the committed datatype in the mainfile */
+ if((tid = H5Topen2(fid1, "myDatatype", H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
+
+ /* Verify the datatype is committed */
+ if(H5Tcommitted(tid) == FALSE)
+ FAIL_STACK_ERROR
+
+ /* Open the group which is externally linked to target file */
+ if((gid1 = H5Gopen2(fid1, "link_to_2", H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
+
+ /* Open the attribute attached to the group */
+ if((aid = H5Aopen(gid1, "myAttribute", H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
+
+ /* Get the attribute's datatype */
+ if((atid = H5Aget_type(aid)) < 0)
+ FAIL_STACK_ERROR
+
+ /* Verify the attribute's datatype is not committed */
+ if(H5Tcommitted(atid) == TRUE)
+ FAIL_STACK_ERROR
+
+ /* Close the attribute */
+ if(H5Aclose(aid) < 0)
+ FAIL_STACK_ERROR
+
+ /* Delete the attribute */
+ if(H5Adelete(gid1, "myAttribute") < 0)
+ FAIL_STACK_ERROR
+
+ /* Open the dataset in the group */
+ if((did = H5Dopen2(gid1, "myDataset", H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
+
+ /* Get the dataset's datatype */
+ if((dtid = H5Dget_type(did)) < 0)
+ FAIL_STACK_ERROR
+
+ /* Verify the dataset's datatype is not committed */
+ if(H5Tcommitted(dtid) == TRUE)
+ FAIL_STACK_ERROR
+
+ /* Read the dataset */
+ if(H5Dread(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, rbuf) < 0)
+ FAIL_STACK_ERROR
+
+ /* Compare the data read should be the same as wbuf */
+ if(HDmemcmp(wbuf, rbuf, sizeof(wbuf)) != 0)
+ FAIL_STACK_ERROR
+
+ /* Close the dataset */
+ if(H5Dclose(did) < 0)
+ FAIL_STACK_ERROR
+
+ /* Close the group */
+ if(H5Gclose(gid1) < 0)
+ FAIL_STACK_ERROR
+
+ /* Close the datatypes */
+ if(H5Tclose(tid) < 0)
+ FAIL_STACK_ERROR
+ if(H5Tclose(atid) < 0)
+ FAIL_STACK_ERROR
+ if(H5Tclose(dtid) < 0)
+ FAIL_STACK_ERROR
+
+ /* Close the file */
+ if(H5Fclose(fid1) < 0)
+ FAIL_STACK_ERROR
+
+ PASSED();
+ return 0;
+
+error:
+ H5E_BEGIN_TRY {
+ H5Fclose(fid2);
+ H5Fclose(fid1);
+ H5Gclose(gid1);
+ H5Gclose(gid2);
+
+ H5Aclose(aid);
+ H5Dclose(did);
+
+ H5Sclose(sid);
+ H5Sclose(sid2);
+
+ H5Tclose(tid);
+ H5Aclose(atid);
+ H5Aclose(dtid);
+
+ H5Pclose(dcpl);
+ } H5E_END_TRY
+
+ return -1;
+} /* end external_link_with_committed_datatype() */
+
+
+/*-------------------------------------------------------------------------
* Function: ud_hard_links
*
* Purpose: Check that the functionality of hard links can be duplicated
@@ -14624,6 +14899,7 @@ main(void)
nerrors += external_copy_invalid_object(my_fapl, new_format) < 0 ? 1 : 0;
nerrors += external_dont_fail_to_source(my_fapl, new_format) < 0 ? 1 : 0;
nerrors += external_open_twice(my_fapl, new_format) < 0 ? 1 : 0;
+ nerrors += external_link_with_committed_datatype(my_fapl, new_format) < 0 ? 1 : 0;
} /* end for */
/* These tests assume that external links are a form of UD links,
diff --git a/test/links_env.c b/test/links_env.c
index b3fec38..b9ecafa 100644
--- a/test/links_env.c
+++ b/test/links_env.c
@@ -173,11 +173,11 @@ main(void)
/* Results */
if(nerrors) {
- printf("***** %d External Link (HDF5_EXT_PREFIX) test%s FAILED! *****\n",
+ HDprintf("***** %d External Link (HDF5_EXT_PREFIX) test%s FAILED! *****\n",
nerrors, 1 == nerrors ? "" : "s");
- exit(1);
+ HDexit(1);
}
- printf("All external Link (HDF5_EXT_PREFIX) tests passed.\n");
+ HDprintf("All external Link (HDF5_EXT_PREFIX) tests passed.\n");
/* clean up tmp directory created by external link tests */
HDrmdir(TMPDIR);
@@ -185,6 +185,6 @@ main(void)
return 0;
error:
- puts("*** TESTS FAILED ***");
+ HDputs("*** TESTS FAILED ***");
return 1;
}
diff --git a/test/mf.c b/test/mf.c
index a36b1ec..e3d1845 100644
--- a/test/mf.c
+++ b/test/mf.c
@@ -5995,6 +5995,169 @@ error:
/*
+ * Test a bug that occurs when an allocator with zero size left and an unaligned
+ * endpoint is extended to allocate an aligned object
+ */
+static unsigned
+test_mf_bug1(const char *env_h5_drvr, hid_t fapl)
+{
+ hid_t file = -1; /* File ID */
+ hid_t copied_fapl = -1; /* FAPL to use for this test */
+ char filename[FILENAME_LEN]; /* Filename to use */
+ H5F_t *f = NULL; /* Internal file object pointer */
+ H5FD_mem_t type;
+ haddr_t addr1, addr2;
+ hsize_t block_size;
+ hsize_t align;
+ hbool_t split = FALSE, multi = FALSE;
+
+ TESTING("H5MF_alloc() bug 1");
+
+ /* Set the filename to use for this test (dependent on fapl) */
+ h5_fixname(FILENAME[0], fapl, filename, sizeof(filename));
+
+ /* Copy fapl */
+ if((copied_fapl = H5Pcopy(fapl)) < 0)
+ TEST_ERROR
+
+ /* Get metadata block size */
+ if(H5Pget_meta_block_size(copied_fapl, &block_size) < 0)
+ TEST_ERROR
+
+ /* Set alignment to equal block size / 2 */
+ align = block_size / 2;
+ if(H5Pset_alignment(copied_fapl, 0, align) < 0)
+ TEST_ERROR
+
+ /* Check for split or multi driver */
+ if(!HDstrcmp(env_h5_drvr, "split"))
+ split = TRUE;
+ else if(!HDstrcmp(env_h5_drvr, "multi"))
+ multi = TRUE;
+
+ /* Add alignment to member files for split/multi driver */
+ if(split || multi) {
+ hid_t memb_fapl;
+
+ /* Creat fapl */
+ if((memb_fapl = H5Pcreate(H5P_FILE_ACCESS)) < 0)
+ TEST_ERROR
+
+ /* Set alignment. Note that it is the block size of the parent FAPL that
+ * is important here. */
+ if(H5Pset_alignment(memb_fapl, 0, align) < 0)
+ TEST_ERROR
+
+ if(split) {
+ /* Set split driver with new FAPLs */
+ if(H5Pset_fapl_split(copied_fapl, "-m.h5", memb_fapl, "-r.h5", memb_fapl) < 0)
+ TEST_ERROR
+ } /* end if */
+ else {
+ H5FD_mem_t memb_map[H5FD_MEM_NTYPES];
+ hid_t memb_fapl_arr[H5FD_MEM_NTYPES];
+ char *memb_name[H5FD_MEM_NTYPES];
+ haddr_t memb_addr[H5FD_MEM_NTYPES];
+ hbool_t relax;
+ H5FD_mem_t mt;
+
+ /* Get current multi settings */
+ HDmemset(memb_name, 0, sizeof memb_name);
+ if(H5Pget_fapl_multi(copied_fapl, memb_map, NULL, memb_name, memb_addr, &relax) < 0)
+ TEST_ERROR
+
+ /* Populate memb_fapl_arr, patch memb_addr so member file addresses
+ * are aligned */
+ for(mt = H5FD_MEM_DEFAULT; mt < H5FD_MEM_NTYPES; H5_INC_ENUM(H5FD_mem_t, mt)) {
+ memb_fapl_arr[mt] = memb_fapl;
+ memb_addr[mt] = ((memb_addr[mt] + align - 1) / align) * align;
+ } /* end for */
+
+ /* Set multi driver with new FAPLs */
+ if(H5Pset_fapl_multi(copied_fapl, memb_map, memb_fapl_arr, (const char * const *)memb_name, memb_addr, relax) < 0)
+ TEST_ERROR
+
+ /* Free memb_name */
+ for(mt = H5FD_MEM_DEFAULT; mt < H5FD_MEM_NTYPES; H5_INC_ENUM(H5FD_mem_t, mt))
+ free(memb_name[mt]);
+ } /* end else */
+
+ /* Close memb_fapl */
+ if(H5Pclose(memb_fapl) < 0)
+ TEST_ERROR
+ } /* end if */
+
+ /* Reopen the file with alignment */
+ if((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, copied_fapl)) < 0)
+ TEST_ERROR
+
+ /* Get a pointer to the internal file object */
+ if(NULL == (f = (H5F_t *)H5I_object(file)))
+ TEST_ERROR
+
+ /* Allocate a block of size align from meta_aggr. This should create an
+ * aggregator that extends to the end of the file, with
+ * block_size / 2 bytes remaining, and the end of the file aligned */
+ type = H5FD_MEM_SUPER;
+ addr1 = H5MF_alloc(f, type, H5AC_ind_read_dxpl_id, align);
+
+ /* Verify that the allocated block is aligned */
+ if(addr1 % align) TEST_ERROR
+
+ /* Allocate a block of size align from meta_aggr. This should force the
+ * aggregator to extend to the end of the file, with 0 bytes remaining, and
+ * the end of the file aligned */
+ type = H5FD_MEM_SUPER;
+ addr2 = H5MF_alloc(f, type, H5AC_ind_read_dxpl_id, align);
+
+ /* Verify that the allocated block is aligned */
+ if(addr2 % align) TEST_ERROR
+
+ /* Verify that the allocated block is placed align after the previous */
+ if((addr2 - addr1) != align) TEST_ERROR
+
+ /* Allocate a block of size block_size + 1 from meta_aggr. This should
+ * force the aggregator to extend to the end of the file, with 0 bytes
+ * remaining, and the end of the file unaligned */
+ type = H5FD_MEM_SUPER;
+ addr1 = H5MF_alloc(f, type, H5AC_ind_read_dxpl_id, block_size + (hsize_t)1);
+
+ /* Verify that the allocated block is aligned */
+ if(addr1 % align) TEST_ERROR
+
+ /* Verify that the allocated block is placed block_size / 2 after the
+ * previous */
+ if((addr1 - addr2) != align) TEST_ERROR
+
+ /* Allocate a block of size 1. This should extend the aggregator from
+ * the previous allocation, and align the new block */
+ type = H5FD_MEM_SUPER;
+ addr2 = H5MF_alloc(f, type, H5AC_ind_read_dxpl_id, (hsize_t)1);
+
+ /* Verify that the allocated block is aligned */
+ if(addr2 % align) TEST_ERROR
+
+ /* Verify that the allocated block is placed 3 * (block_size / 2) after
+ * the previous */
+ if((addr2 - addr1) != (3 * align)) TEST_ERROR
+
+ PASSED()
+
+ /* Close file */
+ if(H5Fclose(file) < 0)
+ TEST_ERROR
+
+ return(0);
+
+error:
+ H5E_BEGIN_TRY {
+ H5Fclose(file);
+ } H5E_END_TRY;
+ return(1);
+} /* test_mf_bug1() */
+
+
+/*
* Verify that the file's free-space manager persists where there are free sections in the manager
*/
static unsigned
@@ -7502,32 +7665,32 @@ main(void)
/* Tests for alignment */
for(curr_test = TEST_NORMAL; curr_test < TEST_NTESTS; H5_INC_ENUM(test_type_t, curr_test)) {
- switch(curr_test) {
+ switch(curr_test) {
case TEST_NORMAL: /* set alignment = 1024 */
- if(H5Pset_alignment(new_fapl, (hsize_t)0, (hsize_t)TEST_ALIGN1024) < 0)
- TEST_ERROR
+ if(H5Pset_alignment(new_fapl, (hsize_t)0, (hsize_t)TEST_ALIGN1024) < 0)
+ TEST_ERROR
break;
case TEST_AGGR_SMALL: /* set alignment = 4096 */
- if(H5Pset_alignment(new_fapl, (hsize_t)0, (hsize_t)TEST_ALIGN4096) < 0)
- TEST_ERROR
+ if(H5Pset_alignment(new_fapl, (hsize_t)0, (hsize_t)TEST_ALIGN4096) < 0)
+ TEST_ERROR
break;
case TEST_NTESTS:
default:
TEST_ERROR;
- break;
- } /* end switch */
-
- nerrors += test_mf_align_eoa(env_h5_drvr, fapl, new_fapl);
- nerrors += test_mf_align_fs(env_h5_drvr, fapl, new_fapl);
- nerrors += test_mf_align_alloc1(env_h5_drvr, fapl, new_fapl);
- nerrors += test_mf_align_alloc2(env_h5_drvr, fapl, new_fapl);
- nerrors += test_mf_align_alloc3(env_h5_drvr, fapl, new_fapl);
- nerrors += test_mf_align_alloc4(env_h5_drvr, fapl, new_fapl);
- nerrors += test_mf_align_alloc5(env_h5_drvr, fapl, new_fapl);
- nerrors += test_mf_align_alloc6(env_h5_drvr, fapl, new_fapl);
- } /* end if */
+ break;
+ } /* end switch */
+
+ nerrors += test_mf_align_eoa(env_h5_drvr, fapl, new_fapl);
+ nerrors += test_mf_align_fs(env_h5_drvr, fapl, new_fapl);
+ nerrors += test_mf_align_alloc1(env_h5_drvr, fapl, new_fapl);
+ nerrors += test_mf_align_alloc2(env_h5_drvr, fapl, new_fapl);
+ nerrors += test_mf_align_alloc3(env_h5_drvr, fapl, new_fapl);
+ nerrors += test_mf_align_alloc4(env_h5_drvr, fapl, new_fapl);
+ nerrors += test_mf_align_alloc5(env_h5_drvr, fapl, new_fapl);
+ nerrors += test_mf_align_alloc6(env_h5_drvr, fapl, new_fapl);
+ } /* end for */
/* tests to verify that file's free-space managers are persistent */
nerrors += test_mf_fs_drivers(fapl);
@@ -7535,6 +7698,9 @@ main(void)
/* tests for file space management */
nerrors += test_filespace_drivers(fapl);
+ /* tests for specific bugs */
+ nerrors += test_mf_bug1(env_h5_drvr, fapl);
+
if(H5Pclose(new_fapl) < 0)
FAIL_STACK_ERROR
h5_cleanup(FILENAME, fapl);
diff --git a/test/mtime.c b/test/mtime.c
index 0c0c923..88ed31c 100644
--- a/test/mtime.c
+++ b/test/mtime.c
@@ -114,7 +114,7 @@ main(void)
puts(" Modification times will be mantained in the file but");
puts(" cannot be queried on this system. See H5O_mtime_decode().");
return 0;
- } else if(HDfabs(HDdifftime(now, oi1.ctime)) > 60.0F) {
+ } else if(HDfabs(HDdifftime(now, oi1.ctime)) > (double)60.0F) {
H5_FAILED();
tm = HDlocaltime(&(oi1.ctime));
HDstrftime((char*)buf1, sizeof buf1, "%Y-%m-%d %H:%M:%S", tm);
diff --git a/test/objcopy.c b/test/objcopy.c
index 1c95dc7..f4b1561 100644
--- a/test/objcopy.c
+++ b/test/objcopy.c
@@ -20,8 +20,7 @@
* Purpose: Test H5Ocopy().
*/
-#include <time.h>
-#include "h5test.h"
+#include "testhdf5.h"
#include "H5srcdir.h"
/*
@@ -166,6 +165,13 @@ compare_groups(hid_t gid, hid_t gid2, hid_t pid, int depth, unsigned copy_flags)
static int
compare_idx_type(hid_t fapl, hid_t did, H5D_chunk_index_t new_type, H5D_chunk_index_t old_type);
+static int
+test_copy_attribute_compound_vlstr(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, hid_t dst_fapl);
+static int
+attach_attribute_compound_vlstr(hid_t loc_id);
+static int
+compare_attribute_compound_vlstr(hid_t loc, hid_t loc2);
+
/*-------------------------------------------------------------------------
* Function: addr_insert
@@ -545,6 +551,7 @@ done:
return ret_value;
} /* end of attach_attribute_vl */
+
/*-------------------------------------------------------------------------
* Function: test_copy_attach_attributes
@@ -5528,6 +5535,312 @@ error:
return 1;
} /* end test_copy_dataset_simple_empty */
+/*-------------------------------------------------------------------------
+ * Function: attach_attribute_compound_vlstr
+ *
+ * Purpose: Attach a compound datatype with a variable length string to the object
+ *
+ * Return: Non-negative on success/Negative on failure
+ *
+ * Programmer: Vailin Choi; Aug 2016
+ *
+ *-------------------------------------------------------------------------
+ */
+static int
+attach_attribute_compound_vlstr(hid_t loc_id)
+{
+ hid_t aid = -1; /* Attribute ID */
+ hid_t sid = -1; /* Dataspace ID */
+ hid_t tid = -1; /* Datatype ID */
+ hid_t vl_str_tid = -1; /* Variable length string datatype ID */
+ hid_t cmpd_tid = -1; /* Compound datatype ID */
+ hsize_t dim1 = 1; /* Dimension size */
+ typedef struct { /* Compound structure for the attribute */
+ int i;
+ char *v;
+ } s1;
+ s1 buf; /* Buffer */
+ int ret_value = -1; /* Return value */
+
+ /* Create dataspace */
+ if((sid = H5Screate_simple(1, &dim1, NULL)) < 0 )
+ goto done;
+
+ /* Create an integer datatype */
+ if((tid = H5Tcopy(H5T_NATIVE_INT)) < 0)
+ goto done;
+
+ /* Create a variable length string */
+ if((vl_str_tid = H5Tcopy(H5T_C_S1)) < 0)
+ goto done;
+ if(H5Tset_size(vl_str_tid, H5T_VARIABLE) < 0)
+ goto done;
+
+ /* Create a compound datatype with a variable length string and an integer */
+ if((cmpd_tid = H5Tcreate(H5T_COMPOUND, sizeof(s1))) < 0)
+ goto done;
+ if(H5Tinsert(cmpd_tid, "i", HOFFSET(s1, i), tid) < 0)
+ goto done;
+ if(H5Tinsert(cmpd_tid, "v", HOFFSET(s1, v), vl_str_tid) < 0)
+ goto done;
+
+ /* Attach an attribute to the object */
+ if((aid = H5Acreate2(loc_id, "attr_cmpd_vlstr", cmpd_tid, sid, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ goto done;
+
+ /* Write to the attribute */
+ buf.i = 9;
+ buf.v = "ThisIsAString";
+ if(H5Awrite(aid, cmpd_tid, &buf) < 0)
+ goto done;
+
+ ret_value = 0;
+
+done:
+ if(sid > 0)
+ H5Sclose(sid);
+ if(tid > 0)
+ H5Tclose(tid);
+ if(vl_str_tid > 0)
+ H5Tclose(vl_str_tid);
+ if(cmpd_tid > 0)
+ H5Tclose(cmpd_tid);
+ if(aid > 0)
+ H5Aclose(aid);
+ return ret_value;
+} /* attach_attribute_compound_vlstr */
+
+/*-------------------------------------------------------------------------
+ * Function: compare_attribute_compound_vlstr
+ *
+ * Purpose: Compare data of the attributes attached to the two objects.
+ * The attribute is a compound datatype with a variable length string.
+ *
+ * Return: Non-negative on success/Negative on failure
+ *
+ * Programmer: Vailin Choi; Aug 2016
+ *
+ *-------------------------------------------------------------------------
+ */
+static int
+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 */
+ typedef struct { /* Compound structure for the attribute */
+ int i;
+ char *v;
+ } s1;
+ s1 rbuf; /* 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)
+ FAIL_STACK_ERROR
+ if((aid2 = H5Aopen_by_idx(loc2, ".", H5_INDEX_CRT_ORDER, H5_ITER_INC, (hsize_t)0, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
+
+ /* Get the attributes' datatypes */
+ if((tid = H5Aget_type(aid)) < 0)
+ FAIL_STACK_ERROR
+ if((tid2 = H5Aget_type(aid2)) < 0)
+ FAIL_STACK_ERROR
+
+ /* Read the attributes */
+ if(H5Aread(aid, tid, &rbuf) < 0)
+ FAIL_STACK_ERROR
+ if(H5Aread(aid2, tid2, &rbuf2) < 0)
+ FAIL_STACK_ERROR
+
+ /* Compare the attributes' data */
+ if(rbuf.i != rbuf2.i)
+ FAIL_STACK_ERROR
+ if(HDstrlen(rbuf.v) != HDstrlen(rbuf2.v))
+ FAIL_STACK_ERROR
+ if(HDmemcmp(rbuf.v, rbuf2.v, HDstrlen(rbuf.v)))
+ FAIL_STACK_ERROR
+
+ /* Close the attributes */
+ if(H5Aclose(aid) < 0)
+ FAIL_STACK_ERROR
+ if(H5Aclose(aid2) < 0)
+ FAIL_STACK_ERROR
+ return TRUE;
+
+error:
+ H5E_BEGIN_TRY {
+ H5Aclose(aid);
+ H5Aclose(aid2);
+ H5Tclose(tid);
+ H5Tclose(tid2);
+ } H5E_END_TRY;
+ return FALSE;
+
+} /* compare_attribute_compound_vlstr() */
+
+/*-------------------------------------------------------------------------
+ * Function: test_copy_attribute_compound_vlstr
+ *
+ * Purpose: Create a simple dataset and a group in SRC file.
+ * Both has an attribute with a compound datatype consisting
+ * of a variable length string
+ * Copy the dataset and the group to DST file
+ * This is for HDFFV-7991
+ *
+ * Return: Success: 0
+ * Failure: number of errors
+ *
+ * Programmer:
+ *
+ *-------------------------------------------------------------------------
+ */
+static int
+test_copy_attribute_compound_vlstr(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, hid_t dst_fapl)
+{
+ hid_t fid_src = -1, fid_dst = -1; /* File IDs */
+ hid_t sid = -1; /* Dataspace ID */
+ hid_t did = -1, did2 = -1; /* Dataset IDs */
+ hid_t aid = -1, aid2 = -1; /* Attribute IDs */
+ hid_t gid = -1, gid2 = -1; /* Group IDs */
+ hsize_t dim2d[2]; /* Dataset dimensions */
+ char src_filename[NAME_BUF_SIZE]; /* Source file name */
+ char dst_filename[NAME_BUF_SIZE]; /* Destination file name */
+
+ TESTING("H5Ocopy(): attribute with compound datatype consisting of variable length string");
+
+ /* Initialize the filenames */
+ h5_fixname(FILENAME[0], src_fapl, src_filename, sizeof src_filename);
+ h5_fixname(FILENAME[1], dst_fapl, dst_filename, sizeof dst_filename);
+
+ /* Reset file address checking info */
+ addr_reset();
+
+ /* create source file */
+ if((fid_src = H5Fcreate(src_filename, H5F_ACC_TRUNC, fcpl_src, src_fapl)) < 0)
+ FAIL_STACK_ERROR
+
+ /* set dataspace dimensions */
+ dim2d[0] = DIM_SIZE_1;
+ dim2d[1] = DIM_SIZE_2;
+
+ /* create 2D dataspace */
+ if((sid = H5Screate_simple(2, dim2d, NULL)) < 0)
+ FAIL_STACK_ERROR
+
+ /* create 2D int dataset at SRC file */
+ if((did = H5Dcreate2(fid_src, NAME_DATASET_SIMPLE, H5T_NATIVE_INT, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
+
+ /* close dataspace */
+ if(H5Sclose(sid) < 0)
+ FAIL_STACK_ERROR
+
+ /* attach an attribute to the dataset */
+ if(attach_attribute_compound_vlstr(did) < 0)
+ FAIL_STACK_ERROR
+
+ /* close the dataset */
+ if(H5Dclose(did) < 0)
+ FAIL_STACK_ERROR
+
+ /* create a group */
+ if((gid = H5Gcreate2(fid_src, NAME_GROUP_EMPTY, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
+
+ /* attach attribute to the group */
+ if(attach_attribute_compound_vlstr(gid) < 0)
+ FAIL_STACK_ERROR
+
+ /* close the group */
+ if(H5Gclose(gid) < 0)
+ FAIL_STACK_ERROR
+
+ /* close the SRC file */
+ if(H5Fclose(fid_src) < 0)
+ FAIL_STACK_ERROR
+
+
+ /* open the source file with read-only */
+ if((fid_src = H5Fopen(src_filename, H5F_ACC_RDONLY, src_fapl)) < 0)
+ FAIL_STACK_ERROR
+
+ /* create destination file */
+ if((fid_dst = H5Fcreate(dst_filename, H5F_ACC_TRUNC, fcpl_dst, dst_fapl)) < 0)
+ FAIL_STACK_ERROR
+
+ /* Create an uncopied object in destination file so that addresses in source and destination files aren't the same */
+ if(H5Gclose(H5Gcreate2(fid_dst, NAME_GROUP_UNCOPIED, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
+
+ /* copy the dataset from SRC to DST */
+ if(H5Ocopy(fid_src, NAME_DATASET_SIMPLE, fid_dst, NAME_DATASET_SIMPLE, H5P_DEFAULT, H5P_DEFAULT) < 0)
+ FAIL_STACK_ERROR
+
+ /* open the src dataset */
+ if((did = H5Dopen2(fid_src, NAME_DATASET_SIMPLE, H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
+
+ /* open the destination dataset */
+ if((did2 = H5Dopen2(fid_dst, NAME_DATASET_SIMPLE, H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
+
+ /* compare the data of the attributes attached to the two datasets */
+ if(compare_attribute_compound_vlstr(did, did2) < 0)
+ FAIL_STACK_ERROR
+
+ /* close the datasets */
+ if(H5Dclose(did2) < 0)
+ FAIL_STACK_ERROR
+ if(H5Dclose(did) < 0)
+ FAIL_STACK_ERROR
+
+ /* Copy the group */
+ if(H5Ocopy(fid_src, NAME_GROUP_EMPTY, fid_dst, NAME_GROUP_EMPTY, H5P_DEFAULT, H5P_DEFAULT) < 0)
+ FAIL_STACK_ERROR
+
+ /* Open the src group */
+ if((gid = H5Gopen2(fid_src, NAME_GROUP_EMPTY, H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
+ /* Open the destination group */
+ if((gid2 = H5Gopen2(fid_dst, NAME_GROUP_EMPTY, H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
+
+ /* compare the data of the attributes attached to the two groups */
+ if(compare_attribute_compound_vlstr(gid, gid2) < 0)
+ FAIL_STACK_ERROR
+
+ /* close the groups */
+ if(H5Gclose(gid) < 0)
+ FAIL_STACK_ERROR
+ if(H5Gclose(gid2) < 0)
+ FAIL_STACK_ERROR
+
+ /* close the SRC file */
+ if(H5Fclose(fid_src) < 0)
+ FAIL_STACK_ERROR
+
+ /* close the DST file */
+ if(H5Fclose(fid_dst) < 0)
+ FAIL_STACK_ERROR
+
+ PASSED();
+ return 0;
+
+error:
+ H5E_BEGIN_TRY {
+ H5Aclose(aid2);
+ H5Aclose(aid);
+ H5Dclose(did2);
+ H5Dclose(did);
+ H5Gclose(gid);
+ H5Gclose(gid2);
+ H5Sclose(sid);
+ H5Fclose(fid_dst);
+ H5Fclose(fid_src);
+ } H5E_END_TRY;
+ return 1;
+} /* end test_copy_attribute_compound_vlstr() */
+
/*-------------------------------------------------------------------------
* Function: test_copy_dataset_compressed_vl
@@ -10234,7 +10547,7 @@ test_copy_committed_dt_merge_attr(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl
if((aid = H5Acreate2(gid, "attr", tid, sid, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
/* write data into file */
- if(H5Awrite(aid, tid, buf) < 0) TEST_ERROR
+ //if(H5Awrite(aid, tid, buf) < 0) TEST_ERROR
/* close the datatype */
if(H5Tclose(tid) < 0) TEST_ERROR
@@ -13480,6 +13793,7 @@ main(void)
nerrors += test_copy_dataset_compact_vl(fcpl_src, fcpl_dst, src_fapl, dst_fapl);
nerrors += test_copy_dataset_compressed_vl(fcpl_src, fcpl_dst, src_fapl, dst_fapl);
nerrors += test_copy_attribute_vl(fcpl_src, fcpl_dst, src_fapl, dst_fapl);
+ nerrors += test_copy_attribute_compound_vlstr(fcpl_src, fcpl_dst, src_fapl, dst_fapl);
nerrors += test_copy_dataset_compact_named_vl(fcpl_src, fcpl_dst, src_fapl, dst_fapl);
nerrors += test_copy_dataset_contig_named_vl(fcpl_src, fcpl_dst, src_fapl, dst_fapl);
nerrors += test_copy_dataset_chunked_named_vl(fcpl_src, fcpl_dst, src_fapl, dst_fapl);
diff --git a/test/ohdr.c b/test/ohdr.c
index aa1ac85..5642c41 100644
--- a/test/ohdr.c
+++ b/test/ohdr.c
@@ -17,7 +17,6 @@
* Tuesday, November 24, 1998
*/
#include "h5test.h"
-#include "H5srcdir.h"
#include "H5Iprivate.h"
/*
diff --git a/test/plugin.c b/test/plugin.c
index a3082d2..3086e90 100644
--- a/test/plugin.c
+++ b/test/plugin.c
@@ -17,8 +17,6 @@
*
* Purpose: Tests the plugin module (H5PL)
*/
-#include <stdlib.h>
-#include <time.h>
#include "h5test.h"
#include "H5srcdir.h"
@@ -33,6 +31,7 @@
#define H5Z_FILTER_DYNLIB1 257
#define H5Z_FILTER_DYNLIB2 258
#define H5Z_FILTER_DYNLIB3 259
+#define H5Z_FILTER_DYNLIB4 260
const char *FILENAME[] = {
"plugin",
@@ -44,6 +43,7 @@ const char *FILENAME[] = {
#define DSET_DEFLATE_NAME "deflate"
#define DSET_DYNLIB1_NAME "dynlib1"
#define DSET_DYNLIB2_NAME "dynlib2"
+#define DSET_DYNLIB4_NAME "dynlib4"
/* Parameters for internal filter test */
#define FILTER_CHUNK_DIM1 2
@@ -65,6 +65,7 @@ const char *FILENAME[] = {
int points_deflate[DSET_DIM1][DSET_DIM2],
points_dynlib1[DSET_DIM1][DSET_DIM2],
points_dynlib2[DSET_DIM1][DSET_DIM2],
+ points_dynlib4[DSET_DIM1][DSET_DIM2],
points_bzip2[DSET_DIM1][DSET_DIM2];
@@ -306,6 +307,8 @@ test_filter_internal(hid_t fid, const char *name, hid_t dcpl)
points_dynlib1[i][j] = points[i][j];
} else if(!HDstrcmp(name, DSET_DYNLIB2_NAME)) {
points_dynlib2[i][j] = points[i][j];
+ } else if(!HDstrcmp(name, DSET_DYNLIB4_NAME)) {
+ points_dynlib4[i][j] = points[i][j];
}
}
}
@@ -344,6 +347,7 @@ test_filters_for_datasets(hid_t file)
hid_t dc; /* Dataset creation property list ID */
const hsize_t chunk_size[2] = {FILTER_CHUNK_DIM1, FILTER_CHUNK_DIM2}; /* Chunk dimensions */
unsigned int compress_level = 9;
+ unsigned int dynlib4_values[4];
/*----------------------------------------------------------
* STEP 1: Test deflation by itself.
@@ -402,6 +406,27 @@ test_filters_for_datasets(hid_t file)
* for this filter. */
if(H5Zunregister(H5Z_FILTER_DYNLIB2) < 0) goto error;
+ /*----------------------------------------------------------
+ * STEP 4: Test DYNLIB4 by itself.
+ *----------------------------------------------------------
+ */
+ puts("Testing DYNLIB4 filter");
+ if((dc = H5Pcreate(H5P_DATASET_CREATE)) < 0) goto error;
+ if(H5Pset_chunk (dc, 2, chunk_size) < 0) goto error;
+ dynlib4_values[0] = 9;
+ if(H5get_libversion(&dynlib4_values[1], &dynlib4_values[2], &dynlib4_values[3]) < 0) goto error;
+ if(H5Pset_filter (dc, H5Z_FILTER_DYNLIB4, H5Z_FLAG_MANDATORY, (size_t)4, dynlib4_values) < 0) goto error;
+
+ if(test_filter_internal(file,DSET_DYNLIB4_NAME,dc) < 0) goto error;
+
+ /* Clean up objects used for this test */
+ if(H5Pclose (dc) < 0) goto error;
+
+ /* Unregister the dynamic filter DYNLIB4 for testing purpose. The next time when this test is run for
+ * the new file format, the library's H5PL code has to search in the table of loaded plugin libraries
+ * for this filter. */
+ if(H5Zunregister(H5Z_FILTER_DYNLIB4) < 0) goto error;
+
return 0;
error:
@@ -519,6 +544,18 @@ test_read_with_filters(hid_t file)
if(H5Dclose(dset) < 0) TEST_ERROR
+ /*----------------------------------------------------------
+ * STEP 4: Test DYNLIB4 by itself.
+ *----------------------------------------------------------
+ */
+ TESTING("Testing DYNLIB4 filter");
+
+ if((dset = H5Dopen2(file,DSET_DYNLIB4_NAME,H5P_DEFAULT)) < 0) TEST_ERROR
+
+ if(test_read_data(dset, (int *)points_dynlib4) < 0) TEST_ERROR
+
+ if(H5Dclose(dset) < 0) TEST_ERROR
+
return 0;
error:
diff --git a/test/set_extent.c b/test/set_extent.c
index fd3270b..a992419 100644
--- a/test/set_extent.c
+++ b/test/set_extent.c
@@ -348,11 +348,9 @@ static int do_ranks( hid_t fapl, hbool_t new_format )
/* Iterate over different index types, but only if using the new format
*/
- for(index_type = RANK4_INDEX_BTREE; index_type < RANK4_NINDICES;
- index_type++) {
+ for(index_type = RANK4_INDEX_BTREE; index_type < RANK4_NINDICES; H5_INC_ENUM(rank4_index_t, index_type)) {
/* Standard test */
- if(test_random_rank4(fapl, dcpl, do_fillvalue, disable_edge_filters,
- FALSE, index_type) < 0) {
+ if(test_random_rank4(fapl, dcpl, do_fillvalue, disable_edge_filters, FALSE, index_type) < 0) {
DO_RANKS_PRINT_CONFIG("Randomized rank 4")
printf(" Index: %s\n", index_type == RANK4_INDEX_BTREE
? "btree" : (index_type == RANK4_INDEX_FARRAY ? "farray"
diff --git a/test/tchecksum.c b/test/tchecksum.c
index cb7c023..ca6c227 100644
--- a/test/tchecksum.c
+++ b/test/tchecksum.c
@@ -189,7 +189,7 @@ test_chksum_large(void)
/* Initialize buffer w/known data */
for(u = 0; u < BUF_LEN; u++)
- large_buf[u] = u * 3;
+ large_buf[u] = (uint8_t)(u * 3);
/* Buffer w/real data */
chksum = H5_checksum_fletcher32(large_buf, sizeof(large_buf));
@@ -247,7 +247,7 @@ test_checksum(void)
*
*-------------------------------------------------------------------------
*/
-H5_ATTR_PURE void
+H5_ATTR_PURE H5_ATTR_CONST void
cleanup_checksum(void)
{
/* no file to clean */
diff --git a/test/test_plugin.sh.in b/test/test_plugin.sh.in
index 43e76c4..1cd87e3 100644
--- a/test/test_plugin.sh.in
+++ b/test/test_plugin.sh.in
@@ -31,11 +31,11 @@ FROM_DIR=`pwd`/.libs
case $(uname) in
CYGWIN* )
PLUGIN_LIB1="$FROM_DIR/cygdynlib1* $FROM_DIR/cygdynlib3*"
- PLUGIN_LIB2="$FROM_DIR/cygdynlib2*"
+ PLUGIN_LIB2="$FROM_DIR/cygdynlib2* $FROM_DIR/cygdynlib4*"
;;
*)
PLUGIN_LIB1="$FROM_DIR/libdynlib1.* $FROM_DIR/libdynlib3.*"
- PLUGIN_LIB2="$FROM_DIR/libdynlib2.*"
+ PLUGIN_LIB2="$FROM_DIR/libdynlib2.* $FROM_DIR/libdynlib4.*"
;;
esac
PLUGIN_LIBDIR1=testdir1
diff --git a/test/testframe.c b/test/testframe.c
index 1c56f88..c2db235 100644
--- a/test/testframe.c
+++ b/test/testframe.c
@@ -26,7 +26,6 @@
/*
* Definitions for the testing structure.
*/
-#define MAXNUMOFTESTS 60
#define MAXTESTNAME 16
#define MAXTESTDESC 64
@@ -49,8 +48,9 @@ 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 TestStruct Test[MAXNUMOFTESTS];
-static int Index = 0;
+static TestStruct *Test = NULL; /* Array of tests */
+static unsigned TestAlloc = 0; /* Size of the Test array */
+static unsigned Index = 0;
static const void *Test_parameters = NULL;
static const char *TestProgName = NULL;
static void (*TestPrivateUsage)(void) = NULL;
@@ -74,14 +74,9 @@ void
AddTest(const char *TheName, void (*TheCall) (void), void (*Cleanup) (void), const char *TheDescr, const void *Parameters)
{
/* Sanity checking */
- if (Index >= MAXNUMOFTESTS) {
- printf("Too many tests added, increase MAXNUMOFTESTS(%d).\n",
- MAXNUMOFTESTS);
- exit(EXIT_FAILURE);
- } /* end if */
if (HDstrlen(TheDescr) >= MAXTESTDESC) {
- printf("Test description too long, increase MAXTESTDESC(%d).\n",
- MAXTESTDESC);
+ printf("Test description ('%s') too long, increase MAXTESTDESC(%d).\n",
+ TheDescr, MAXTESTDESC);
exit(EXIT_FAILURE);
} /* end if */
if (HDstrlen(TheName) >= MAXTESTNAME) {
@@ -90,9 +85,25 @@ AddTest(const char *TheName, void (*TheCall) (void), void (*Cleanup) (void), con
exit(EXIT_FAILURE);
} /* end if */
+ /* Check for increasing the Test array size */
+ if(Index >= TestAlloc) {
+ TestStruct *newTest = Test; /* New array of tests */
+ unsigned newAlloc = MAX(1, TestAlloc * 2); /* New array size */
+
+ /* Reallocate array */
+ if(NULL == (newTest = (TestStruct *)HDrealloc(Test, newAlloc * sizeof(TestStruct)))) {
+ printf("Out of memory for tests, Index = %u, TestAlloc = %u, newAlloc = %u\n", Index, TestAlloc, newAlloc);
+ exit(EXIT_FAILURE);
+ } /* end if */
+
+ /* Update info */
+ Test = newTest;
+ TestAlloc = newAlloc;
+ } /* end if */
+
/* Set up test function */
HDstrcpy(Test[Index].Description, TheDescr);
- if (*TheName != '-'){
+ if(*TheName != '-') {
HDstrcpy(Test[Index].Name, TheName);
Test[Index].SkipFlag = 0;
}
@@ -153,7 +164,7 @@ void TestInit(const char *ProgName, void (*private_usage)(void), int (*private_p
*/
void TestUsage(void)
{
- int i;
+ unsigned i;
print_func("Usage: %s [-v[erbose] (l[ow]|m[edium]|h[igh]|0-9)] %s\n",
TestProgName, (TestPrivateUsage ? "<extra options>" : ""));
@@ -250,7 +261,7 @@ void TestParseCmdLine(int argc, char *argv[])
else if (((HDstrcmp(*argv, "-only") == 0) ||
(HDstrcmp(*argv, "-o") == 0))) {
if(argc > 0) {
- int Loop;
+ unsigned Loop;
--argc; ++argv;
@@ -296,7 +307,7 @@ void TestParseCmdLine(int argc, char *argv[])
*/
void PerformTests(void)
{
- int Loop;
+ unsigned Loop;
for (Loop = 0; Loop < Index; Loop++)
if (Test[Loop].SkipFlag) {
@@ -329,7 +340,7 @@ void PerformTests(void)
*/
void TestSummary(void)
{
- int Loop;
+ unsigned Loop;
print_func("Summary of Test Results:\n");
print_func("Name of Test Errors Description of Test\n");
@@ -351,7 +362,7 @@ void TestSummary(void)
*/
void TestCleanup(void)
{
- int Loop;
+ unsigned Loop;
MESSAGE(2, ("\nCleaning Up temp files...\n\n"));
@@ -363,6 +374,16 @@ void TestCleanup(void)
/*
+ * Shutdown the test infrastructure
+ */
+void TestShutdown(void)
+{
+ if(Test)
+ HDfree(Test);
+}
+
+
+/*
* Retrieve the verbosity level for the testing framework
*/
H5_ATTR_PURE int GetTestVerbosity(void)
@@ -554,7 +575,7 @@ TestErrPrintf(const char *format, ...)
*/
void SetTest(const char *testname, int action)
{
- int Loop;
+ unsigned Loop;
switch (action){
case SKIPTEST:
diff --git a/test/testhdf5.c b/test/testhdf5.c
index eade815..0e7303e 100644
--- a/test/testhdf5.c
+++ b/test/testhdf5.c
@@ -86,6 +86,9 @@ main(int argc, char *argv[])
if (GetTestCleanup() && !getenv("HDF5_NOCLEANUP"))
TestCleanup();
+ /* Release test infrastructure */
+ TestShutdown();
+
/* Exit failure if errors encountered; else exit success. */
/* No need to print anything since PerformTests() already does. */
if (GetTestNumErrs() > 0)
diff --git a/test/tfile.c b/test/tfile.c
index 74f3b86..833d2d9 100644
--- a/test/tfile.c
+++ b/test/tfile.c
@@ -1858,7 +1858,7 @@ test_file_open_overlap(void)
hid_t did1, did2;
hid_t gid;
hid_t sid;
- int nobjs; /* # of open objects */
+ ssize_t nobjs; /* # of open objects */
unsigned intent;
herr_t ret; /* Generic return value */
@@ -2197,8 +2197,9 @@ test_file_double_file_dataset_open(hbool_t new_format)
hsize_t max_dims1[1] = {H5S_UNLIMITED}; /* Maximum dimesion sizes for extensible array index */
hsize_t max_dims2[2] = {H5S_UNLIMITED, H5S_UNLIMITED}; /* Maximum dimension sizes for v2 B-tree index */
hsize_t chunks[1] = {2}, chunks2[2] = {4, 5}; /* Chunk dimension sizes */
- char* data[] = {"String 1", "String 2", "String 3", "String 4", "String 5"}; /* Input Data */
- char* e_data[] = {"String 1", "String 2", "String 3", "String 4", "String 5", "String 6", "String 7"}; /* Input Data */
+ hsize_t size; /* File size */
+ const char* data[] = {"String 1", "String 2", "String 3", "String 4", "String 5"}; /* Input Data */
+ const char* e_data[] = {"String 1", "String 2", "String 3", "String 4", "String 5", "String 6", "String 7"}; /* Input Data */
char* buffer[5]; /* Output buffer */
int wbuf[4] = {1, 2, 3, 4}; /* Input data */
herr_t ret; /* Generic return value */
@@ -2432,8 +2433,8 @@ test_file_double_file_dataset_open(hbool_t new_format)
CHECK(did1, FAIL, "H5Dopen2");
/* First file's get storage size */
- ret = H5Dget_storage_size(did1);
- CHECK(ret, FAIL, "H5Dget_storage_size");
+ size = H5Dget_storage_size(did1);
+ CHECK(size, 0, "H5Dget_storage_size");
/* Second file open */
fid2 = H5Fopen(FILE1, H5F_ACC_RDONLY, H5P_DEFAULT);
@@ -2452,8 +2453,8 @@ test_file_double_file_dataset_open(hbool_t new_format)
CHECK(ret, FAIL, "H5Fclose");
/* Second file's get storage size */
- ret = H5Dget_storage_size(did2);
- CHECK(ret, FAIL, "H5Dget_storage_size");
+ size = H5Dget_storage_size(did2);
+ CHECK(size, 0, "H5Dget_storage_size");
/* Second file's dataset close */
ret = H5Dclose(did2);
@@ -2775,7 +2776,7 @@ test_rw_noupdate(void)
diff = HDdifftime(sb2.st_mtime, sb1.st_mtime);
/* Check That Timestamps Are Equal */
- if(diff > 0.0F) {
+ if(diff > (double)0.0F) {
/* Output message about test being performed */
MESSAGE(1, ("Testing to verify that nothing is written if nothing is changed: This test is skipped on this system because the modification time from stat is the same as the last access time.\n"));
} /* end if */
@@ -2808,7 +2809,7 @@ test_rw_noupdate(void)
/* Ensure That Timestamps Are Equal */
diff = HDdifftime(sb2.st_mtime, sb1.st_mtime);
- ret = (diff > 0.0F);
+ ret = (diff > (double)0.0F);
VERIFY(ret, 0, "Timestamp");
} /* end else */
} /* end test_rw_noupdate() */
diff --git a/test/tgenprop.c b/test/tgenprop.c
index b670c0d..e6f9692 100644
--- a/test/tgenprop.c
+++ b/test/tgenprop.c
@@ -784,7 +784,7 @@ test_genprop_basic_list_prop(void)
ret = H5Pget(lid1, PROP4_NAME,&prop4_value);
CHECK_I(ret, "H5Pget");
/* Verify the floating-poing value in this way to avoid compiler warning. */
- if(!H5_FLT_ABS_EQUAL(prop4_value,(double)*PROP4_DEF_VALUE))
+ if(!H5_DBL_ABS_EQUAL(prop4_value, *PROP4_DEF_VALUE))
printf("*** UNEXPECTED VALUE from %s should be %f, but is %f at line %4d in %s\n",
"H5Pget", *PROP4_DEF_VALUE, prop4_value, (int)__LINE__, __FILE__);
@@ -821,7 +821,7 @@ test_genprop_basic_list_prop(void)
ret = H5Pget(lid1, PROP4_NAME,&prop4_value);
CHECK_I(ret, "H5Pget");
/* Verify the floating-poing value in this way to avoid compiler warning. */
- if(!H5_FLT_ABS_EQUAL(prop4_value,*PROP4_DEF_VALUE))
+ if(!H5_DBL_ABS_EQUAL(prop4_value, *PROP4_DEF_VALUE))
printf("*** UNEXPECTED VALUE from %s should be %f, but is %f at line %4d in %s\n",
"H5Pget", *PROP4_DEF_VALUE, prop4_value, (int)__LINE__, __FILE__);
@@ -1241,7 +1241,7 @@ test_genprop_list_callback(void)
ret = H5Pget(lid1, PROP4_NAME,&prop4_value);
CHECK_I(ret, "H5Pget");
/* Verify the floating-poing value in this way to avoid compiler warning. */
- if(!H5_FLT_ABS_EQUAL(prop4_value,(double)*PROP4_DEF_VALUE))
+ if(!H5_DBL_ABS_EQUAL(prop4_value, *PROP4_DEF_VALUE))
printf("*** UNEXPECTED VALUE from %s should be %f, but is %f at line %4d in %s\n",
"H5Pget", *PROP4_DEF_VALUE, prop4_value, (int)__LINE__, __FILE__);
diff --git a/test/th5o.c b/test/th5o.c
index 3be5d12..125e11b 100644
--- a/test/th5o.c
+++ b/test/th5o.c
@@ -920,6 +920,7 @@ test_h5o_comment(void)
const char *dtype_comment = "datatype comment";
char check_comment[64];
ssize_t comment_len = 0;
+ ssize_t len;
herr_t ret; /* Value returned from API calls */
int ret_value;
@@ -1008,8 +1009,8 @@ test_h5o_comment(void)
comment_len = H5Oget_comment(fid, NULL, (size_t)0);
CHECK(comment_len, FAIL, "H5Oget_comment");
- ret = H5Oget_comment(fid, check_comment, (size_t)comment_len+1);
- CHECK(ret, FAIL, "H5Oget_comment");
+ len = H5Oget_comment(fid, check_comment, (size_t)comment_len+1);
+ CHECK(len, FAIL, "H5Oget_comment");
ret_value = HDstrcmp(file_comment, check_comment);
VERIFY(ret_value, 0, "H5Oget_comment");
@@ -1022,8 +1023,8 @@ test_h5o_comment(void)
comment_len = H5Oget_comment(grp, NULL, (size_t)0);
CHECK(comment_len, FAIL, "H5Oget_comment");
- ret = H5Oget_comment(grp, check_comment, (size_t)comment_len+1);
- CHECK(ret, FAIL, "H5Oget_comment");
+ len = H5Oget_comment(grp, check_comment, (size_t)comment_len+1);
+ CHECK(len, FAIL, "H5Oget_comment");
ret_value = HDstrcmp(grp_comment, check_comment);
VERIFY(ret_value, 0, "H5Oget_comment");
@@ -1036,8 +1037,8 @@ test_h5o_comment(void)
comment_len = H5Oget_comment(dtype, NULL, (size_t)0);
CHECK(comment_len, FAIL, "H5Oget_comment");
- ret = H5Oget_comment(dtype, check_comment, (size_t)comment_len+1);
- CHECK(ret, FAIL, "H5Oget_comment");
+ len = H5Oget_comment(dtype, check_comment, (size_t)comment_len+1);
+ CHECK(len, FAIL, "H5Oget_comment");
ret_value = HDstrcmp(dtype_comment, check_comment);
VERIFY(ret_value, 0, "H5Oget_comment");
@@ -1050,8 +1051,8 @@ test_h5o_comment(void)
comment_len = H5Oget_comment(dset, NULL, (size_t)0);
CHECK(comment_len, FAIL, "H5Oget_comment");
- ret = H5Oget_comment(dset, check_comment, (size_t)comment_len+1);
- CHECK(ret, FAIL, "H5Oget_comment");
+ len = H5Oget_comment(dset, check_comment, (size_t)comment_len+1);
+ CHECK(ret, len, "H5Oget_comment");
ret_value = HDstrcmp(dset_comment, check_comment);
VERIFY(ret_value, 0, "H5Oget_comment");
@@ -1092,6 +1093,7 @@ test_h5o_comment_by_name(void)
const char *dtype_comment = "datatype comment by name";
char check_comment[64];
ssize_t comment_len = 0;
+ ssize_t len;
herr_t ret; /* Value returned from API calls */
int ret_value;
@@ -1179,8 +1181,8 @@ test_h5o_comment_by_name(void)
comment_len = H5Oget_comment_by_name(fid, ".", NULL, (size_t)0, H5P_DEFAULT);
CHECK(comment_len, FAIL, "H5Oget_comment_by_name");
- ret = H5Oget_comment_by_name(fid, ".", check_comment, (size_t)comment_len+1, H5P_DEFAULT);
- CHECK(ret, FAIL, "H5Oget_comment_by_name");
+ len = H5Oget_comment_by_name(fid, ".", check_comment, (size_t)comment_len+1, H5P_DEFAULT);
+ CHECK(len, FAIL, "H5Oget_comment_by_name");
ret_value = HDstrcmp(file_comment, check_comment);
VERIFY(ret_value, 0, "H5Oget_comment_by_name");
@@ -1193,8 +1195,8 @@ test_h5o_comment_by_name(void)
comment_len = H5Oget_comment_by_name(fid, "group", NULL, (size_t)0, H5P_DEFAULT);
CHECK(comment_len, FAIL, "H5Oget_comment_by_name");
- ret = H5Oget_comment_by_name(fid, "group", check_comment, (size_t)comment_len+1, H5P_DEFAULT);
- CHECK(ret, FAIL, "H5Oget_comment_by_name");
+ len = H5Oget_comment_by_name(fid, "group", check_comment, (size_t)comment_len+1, H5P_DEFAULT);
+ CHECK(len, FAIL, "H5Oget_comment_by_name");
ret_value = HDstrcmp(grp_comment, check_comment);
VERIFY(ret_value, 0, "H5Oget_comment_by_name");
@@ -1203,8 +1205,8 @@ test_h5o_comment_by_name(void)
comment_len = H5Oget_comment_by_name(grp, "datatype", NULL, (size_t)0, H5P_DEFAULT);
CHECK(comment_len, FAIL, "H5Oget_comment_by_name");
- ret = H5Oget_comment_by_name(grp, "datatype", check_comment, (size_t)comment_len+1, H5P_DEFAULT);
- CHECK(ret, FAIL, "H5Oget_comment");
+ len = H5Oget_comment_by_name(grp, "datatype", check_comment, (size_t)comment_len+1, H5P_DEFAULT);
+ CHECK(len, FAIL, "H5Oget_comment");
ret_value = HDstrcmp(dtype_comment, check_comment);
VERIFY(ret_value, 0, "H5Oget_comment_by_name");
@@ -1213,8 +1215,8 @@ test_h5o_comment_by_name(void)
comment_len = H5Oget_comment_by_name(fid, "dataset", NULL, (size_t)0, H5P_DEFAULT);
CHECK(comment_len, FAIL, "H5Oget_comment_by_name");
- ret = H5Oget_comment_by_name(fid, "dataset", check_comment, (size_t)comment_len+1, H5P_DEFAULT);
- CHECK(ret, FAIL, "H5Oget_comment_by_name");
+ len = H5Oget_comment_by_name(fid, "dataset", check_comment, (size_t)comment_len+1, H5P_DEFAULT);
+ CHECK(len, FAIL, "H5Oget_comment_by_name");
ret_value = HDstrcmp(dset_comment, check_comment);
VERIFY(ret_value, 0, "H5Oget_comment_by_name");
diff --git a/test/th5s.c b/test/th5s.c
index a478803..664c23a 100644
--- a/test/th5s.c
+++ b/test/th5s.c
@@ -551,18 +551,18 @@ test_h5s_zero_dim(void)
MESSAGE(5, ("Testing Dataspace with zero dimension size\n"));
/* Initialize the data */
- for(i=0; i<SPACE1_DIM2; i++)
- for(j=0; j<SPACE1_DIM3; j++) {
- wdata[i][j] = i + j;
+ for(i = 0; i < SPACE1_DIM2; i++)
+ for(j = 0; j < SPACE1_DIM3; j++) {
+ wdata[i][j] = (int)(i + j);
rdata[i][j] = 7;
- wdata_short[i][j] = i + j;
+ wdata_short[i][j] = (short)(i + j);
rdata_short[i][j] = 7;
}
- for(i=0; i<SPACE1_DIM1; i++)
- for(j=0; j<SPACE1_DIM2; j++)
- for(k=0; k<SPACE1_DIM3; k++)
- wdata_real[i][j][k] = i + j + k;
+ for(i = 0; i < SPACE1_DIM1; i++)
+ for(j = 0; j < SPACE1_DIM2; j++)
+ for(k = 0; k < SPACE1_DIM3; k++)
+ wdata_real[i][j][k] = (int)(i + j + k);
/* Test with different space allocation times */
for(alloc_time = H5D_ALLOC_TIME_EARLY; alloc_time <= H5D_ALLOC_TIME_INCR; H5_INC_ENUM(H5D_alloc_time_t, alloc_time)) {
@@ -1647,7 +1647,7 @@ test_h5s_chunk(void)
/* Initialize float array */
for(i = 0; i < 50000; i++)
for(j = 0; j < 3; j++)
- chunk_data_flt[i][j] = (float)((i + 1) * 2.5F - j * 100.3F);
+ chunk_data_flt[i][j] = (float)(i + 1) * 2.5F - (float)j * 100.3F;
status = H5Dwrite(dsetID, H5T_NATIVE_FLOAT, H5S_ALL, H5S_ALL, H5P_DEFAULT, chunk_data_flt);
CHECK(status, FAIL, "H5Dwrite");
@@ -1683,7 +1683,7 @@ test_h5s_chunk(void)
for(i=0; i<50000; i++) {
for(j=0; j<3; j++) {
/* Check if the two values are within 0.001% range. */
- if(!H5_DBL_REL_EQUAL(chunk_data_dbl[i][j], chunk_data_flt[i][j], 0.00001F))
+ if(!H5_DBL_REL_EQUAL(chunk_data_dbl[i][j], (double)chunk_data_flt[i][j], (double)0.00001F))
TestErrPrintf("%u: chunk_data_dbl[%d][%d]=%e, chunk_data_flt[%d][%d]=%e\n", (unsigned)__LINE__, i, j, chunk_data_dbl[i][j], i, j, (double)chunk_data_flt[i][j]);
} /* end for */
} /* end for */
diff --git a/test/theap.c b/test/theap.c
index 230ec4d..2d509bf 100644
--- a/test/theap.c
+++ b/test/theap.c
@@ -31,9 +31,6 @@
2/18/03 - Started coding
*/
-#include <time.h>
-#include <stdlib.h>
-
#include "testhdf5.h"
#include "H5HPprivate.h"
diff --git a/test/titerate.c b/test/titerate.c
index f61842a..9f0b900 100644
--- a/test/titerate.c
+++ b/test/titerate.c
@@ -283,7 +283,8 @@ test_iter_group(hid_t fapl, hbool_t new_format)
/* Test all objects in group, when callback always returns 1 */
/* This also tests the "restarting" ability, because the index changes */
info.command = RET_TWO;
- idx = i = 0;
+ i = 0;
+ idx = 0;
while((ret = H5Literate(file, H5_INDEX_NAME, H5_ITER_INC, &idx, liter_cb, &info)) > 0) {
/* Verify return value from iterator gets propagated correctly */
VERIFY(ret, 2, "H5Literate");
@@ -308,7 +309,8 @@ test_iter_group(hid_t fapl, hbool_t new_format)
/* Test all objects in group, when callback changes return value */
/* This also tests the "restarting" ability, because the index changes */
info.command = new_format ? RET_CHANGE2 : RET_CHANGE;
- idx = i = 0;
+ i = 0;
+ idx = 0;
while((ret = H5Literate(file, H5_INDEX_NAME, H5_ITER_INC, &idx, liter_cb, &info)) >= 0) {
/* Verify return value from iterator gets propagated correctly */
VERIFY(ret, 1, "H5Literate");
@@ -462,7 +464,8 @@ static void test_iter_attr(hid_t fapl, hbool_t new_format)
/* Test all attributes on dataset, when callback always returns 1 */
/* This also tests the "restarting" ability, because the index changes */
info.command = RET_TWO;
- idx = i = 0;
+ i = 0;
+ idx = 0;
while((ret = H5Aiterate2(dataset, H5_INDEX_NAME, H5_ITER_INC, &idx, aiter_cb, &info)) > 0) {
/* Verify return value from iterator gets propagated correctly */
VERIFY(ret, 2, "H5Aiterate2");
@@ -488,7 +491,8 @@ static void test_iter_attr(hid_t fapl, hbool_t new_format)
/* Test all attributes on dataset, when callback changes return value */
/* This also tests the "restarting" ability, because the index changes */
info.command = new_format ? RET_CHANGE2 : RET_CHANGE;
- idx = i = 0;
+ i = 0;
+ idx = 0;
while((ret = H5Aiterate2(dataset, H5_INDEX_NAME, H5_ITER_INC, &idx, aiter_cb, &info)) > 0) {
/* Verify return value from iterator gets propagated correctly */
VERIFY(ret, 1, "H5Aiterate2");
@@ -672,7 +676,7 @@ test_iter_group_large(hid_t fapl)
ret = H5Literate(file, H5_INDEX_NAME, H5_ITER_INC, NULL, liter_cb2, curr_name);
CHECK(ret, FAIL, "H5Literate");
for(i = 1; i < 100; i++) {
- hsize_t idx = i;
+ hsize_t idx = (hsize_t)i;
curr_name = &names[i];
ret = H5Literate(file, H5_INDEX_NAME, H5_ITER_INC, &idx, liter_cb2, curr_name);
diff --git a/test/tmeta.c b/test/tmeta.c
index e69c057..43fdeac 100644
--- a/test/tmeta.c
+++ b/test/tmeta.c
@@ -123,7 +123,7 @@ test_metadata(void)
*
*-------------------------------------------------------------------------
*/
-H5_ATTR_PURE void
+H5_ATTR_PURE H5_ATTR_CONST void
cleanup_metadata(void)
{
/* no file to clean */
diff --git a/test/trefer.c b/test/trefer.c
index cb0f44e..433239a 100644
--- a/test/trefer.c
+++ b/test/trefer.c
@@ -84,8 +84,8 @@ test_reference_params(void)
int i; /* counting variables */
const char *write_comment = "Foo!"; /* Comments for group */
hid_t ret_id; /* Generic hid_t return value */
+ ssize_t name_size; /* Size of reference name */
herr_t ret; /* Generic return value */
- size_t name_size; /* Size of reference name */
/* Output message about test being performed */
MESSAGE(5, ("Testing Reference Parameters\n"));
@@ -120,7 +120,7 @@ test_reference_params(void)
CHECK(dataset, FAIL, "H5Dcreate2");
for(tu32 = (unsigned *)wbuf, i = 0; i < SPACE1_DIM1; i++)
- *tu32++=i*3;
+ *tu32++ = (unsigned)i * 3;
/* Write selection to disk */
ret = H5Dwrite(dataset, H5T_NATIVE_UINT, H5S_ALL, H5S_ALL, H5P_DEFAULT, wbuf);
@@ -266,6 +266,7 @@ test_reference_obj(void)
const char *write_comment="Foo!"; /* Comments for group */
char read_comment[10];
H5O_type_t obj_type; /* Object type */
+ ssize_t size; /* Comment length */
herr_t ret; /* Generic return value */
/* Output message about test being performed */
@@ -301,7 +302,7 @@ test_reference_obj(void)
CHECK(dataset, FAIL, "H5Dcreate2");
for(tu32 = (unsigned *)wbuf, i = 0; i < SPACE1_DIM1; i++)
- *tu32++=i*3;
+ *tu32++ = (unsigned)i * 3;
/* Write selection to disk */
ret = H5Dwrite(dataset, H5T_NATIVE_UINT, H5S_ALL, H5S_ALL, H5P_DEFAULT, wbuf);
@@ -432,8 +433,8 @@ test_reference_obj(void)
CHECK(group, FAIL, "H5Rdereference2");
/* Get group's comment */
- ret = H5Oget_comment(group, read_comment, (size_t)10);
- CHECK(ret, FAIL, "H5Oget_comment");
+ size = H5Oget_comment(group, read_comment, (size_t)10);
+ CHECK(size, FAIL, "H5Oget_comment");
/* Check for correct comment value */
if(HDstrcmp(write_comment, read_comment) != 0)
@@ -557,7 +558,7 @@ test_reference_region(void)
CHECK(dset2, FAIL, "H5Dcreate2");
for(tu8 = dwbuf, i = 0; i < (SPACE2_DIM1 * SPACE2_DIM2); i++)
- *tu8++ = i * 3;
+ *tu8++ = (uint8_t)(i * 3);
/* Write selection to disk */
ret = H5Dwrite(dset2, H5T_STD_U8LE, H5S_ALL, H5S_ALL, H5P_DEFAULT, dwbuf);
@@ -762,7 +763,7 @@ test_reference_region(void)
VERIFY(ret, 36, "H5Sget_select_npoints");
ret = (int)H5Sget_select_hyper_nblocks(sid2);
VERIFY(ret, 1, "H5Sget_select_hyper_nblocks");
- coords = (hsize_t *)HDmalloc(ret * SPACE2_RANK * sizeof(hsize_t) * 2); /* allocate space for the hyperslab blocks */
+ coords = (hsize_t *)HDmalloc((size_t)ret * SPACE2_RANK * sizeof(hsize_t) * 2); /* allocate space for the hyperslab blocks */
ret = H5Sget_select_hyper_blocklist(sid2, (hsize_t)0, (hsize_t)ret, coords);
CHECK(ret, FAIL, "H5Sget_select_hyper_blocklist");
VERIFY(coords[0], 2, "Hyperslab Coordinates");
@@ -790,7 +791,7 @@ test_reference_region(void)
VERIFY(ret, 10, "H5Sget_select_npoints");
ret = (int)H5Sget_select_elem_npoints(sid2);
VERIFY(ret, 10, "H5Sget_select_elem_npoints");
- coords = (hsize_t *)HDmalloc(ret * SPACE2_RANK * sizeof(hsize_t)); /* allocate space for the element points */
+ coords = (hsize_t *)HDmalloc((size_t)ret * SPACE2_RANK * sizeof(hsize_t)); /* allocate space for the element points */
ret = H5Sget_select_elem_pointlist(sid2, (hsize_t)0, (hsize_t)ret, coords);
CHECK(ret, FAIL, "H5Sget_select_elem_pointlist");
VERIFY(coords[0], coord1[0][0], "Element Coordinates");
@@ -945,7 +946,7 @@ test_reference_region_1D(void)
CHECK(dset3, FAIL, "H5Dcreate2");
for(tu8 = dwbuf, i = 0; i < SPACE3_DIM1; i++)
- *tu8++ = i * 3;
+ *tu8++ = (uint8_t)(i * 3);
/* Write selection to disk */
ret = H5Dwrite(dset3, H5T_STD_U8LE, H5S_ALL, H5S_ALL, H5P_DEFAULT, dwbuf);
@@ -1068,7 +1069,7 @@ test_reference_region_1D(void)
VERIFY(ret, 30, "H5Sget_select_npoints");
ret = (int)H5Sget_select_hyper_nblocks(sid3);
VERIFY(ret, 15, "H5Sget_select_hyper_nblocks");
- coords = (hsize_t *)HDmalloc(ret * SPACE3_RANK * sizeof(hsize_t) * 2); /* allocate space for the hyperslab blocks */
+ coords = (hsize_t *)HDmalloc((size_t)ret * SPACE3_RANK * sizeof(hsize_t) * 2); /* allocate space for the hyperslab blocks */
ret = H5Sget_select_hyper_blocklist(sid3, (hsize_t)0, (hsize_t)ret, coords);
CHECK(ret, FAIL, "H5Sget_select_hyper_blocklist");
VERIFY(coords[0], 2, "Hyperslab Coordinates");
@@ -1120,7 +1121,7 @@ test_reference_region_1D(void)
VERIFY(ret, 10, "H5Sget_select_npoints");
ret = (int)H5Sget_select_elem_npoints(sid3);
VERIFY(ret, 10, "H5Sget_select_elem_npoints");
- coords = (hsize_t *)HDmalloc(ret * SPACE3_RANK * sizeof(hsize_t)); /* allocate space for the element points */
+ coords = (hsize_t *)HDmalloc((size_t)ret * SPACE3_RANK * sizeof(hsize_t)); /* allocate space for the element points */
ret = H5Sget_select_elem_pointlist(sid3, (hsize_t)0, (hsize_t)ret, coords);
CHECK(ret, FAIL, "H5Sget_select_elem_pointlist");
VERIFY(coords[0], coord1[0][0], "Element Coordinates");
@@ -1329,6 +1330,7 @@ test_reference_group(void)
char objname[NAME_SIZE]; /* Buffer to store name */
H5O_info_t oinfo; /* Object info struct */
int count = 0; /* Count within iterated group */
+ ssize_t size; /* Name length */
herr_t ret;
/* Create file with a group and a dataset containing an object reference to the group */
@@ -1409,8 +1411,8 @@ test_reference_group(void)
CHECK(ret, FAIL, "H5Gget_info");
VERIFY(ginfo.nlinks, 3, "H5Gget_info");
- ret = H5Lget_name_by_idx(gid, ".", H5_INDEX_NAME, H5_ITER_INC, (hsize_t)0, objname, (size_t)NAME_SIZE, H5P_DEFAULT);
- CHECK(ret, FAIL, "H5Lget_name_by_idx");
+ size = H5Lget_name_by_idx(gid, ".", H5_INDEX_NAME, H5_ITER_INC, (hsize_t)0, objname, (size_t)NAME_SIZE, H5P_DEFAULT);
+ CHECK(size, FAIL, "H5Lget_name_by_idx");
VERIFY_STR(objname, DSETNAME2, "H5Lget_name_by_idx");
ret = H5Oget_info_by_idx(gid, ".", H5_INDEX_NAME, H5_ITER_INC, (hsize_t)0, &oinfo, H5P_DEFAULT);
diff --git a/test/tselect.c b/test/tselect.c
index 73b8015..9230d8b 100644
--- a/test/tselect.c
+++ b/test/tselect.c
@@ -720,7 +720,7 @@ test_select_all(hid_t xfer_plist)
for(i=0, tbuf=wbuf; i<SPACE4_DIM1; i++)
for(j=0; j<SPACE4_DIM2; j++)
for(k=0; k<SPACE4_DIM3; k++)
- *tbuf++ = (uint8_t)(((i * SPACE4_DIM2) + j) * SPACE4_DIM3) + k;
+ *tbuf++ = (uint8_t)((((i * SPACE4_DIM2) + j) * SPACE4_DIM3) + k);
/* Create file */
fid1 = H5Fcreate(FILENAME, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
@@ -7188,8 +7188,8 @@ test_select_fill_point(hssize_t *offset)
/* Add in the offset */
for(u = 0; u < (unsigned)num_points; u++) {
- points[u][0] = (hsize_t)(points[u][0] + real_offset[0]);
- points[u][1] = (hsize_t)(points[u][1] + real_offset[1]);
+ points[u][0] = (hsize_t)((hssize_t)points[u][0] + real_offset[0]);
+ points[u][1] = (hsize_t)((hssize_t)points[u][1] + real_offset[1]);
} /* end for */
/* Iterate through selection, verifying correct data */
@@ -7269,8 +7269,8 @@ test_select_fill_hyper_simple(hssize_t *offset)
/* Verify memory buffer the hard way... */
for(u = 0, tbuf = wbuf; u < SPACE7_DIM1; u++)
for(v = 0; v < SPACE7_DIM2; v++, tbuf++) {
- if((u >= (unsigned)(start[0] + real_offset[0]) && u < (unsigned)(start[0] + count[0] + real_offset[0]))
- && (v >= (unsigned)(start[1] + real_offset[1]) && v < (unsigned)(start[1] + count[1] + real_offset[1]))) {
+ if((u >= (unsigned)((hssize_t)start[0] + real_offset[0]) && u < (unsigned)((hssize_t)(start[0] + count[0]) + real_offset[0]))
+ && (v >= (unsigned)((hssize_t)start[1] + real_offset[1]) && v < (unsigned)((hssize_t)(start[1] + count[1]) + real_offset[1]))) {
if(*tbuf != (unsigned)fill_value)
TestErrPrintf("Error! v=%u, u=%u, *tbuf=%u, fill_value=%u\n", v, u, *tbuf, (unsigned)fill_value);
} /* end if */
@@ -7288,8 +7288,8 @@ test_select_fill_hyper_simple(hssize_t *offset)
/* Set the coordinates of the selection (with the offset) */
for(u = 0, num_points = 0; u < (unsigned)count[0]; u++)
for(v = 0; v < (unsigned)count[1]; v++, num_points++) {
- points[num_points][0] = (hsize_t)(u + start[0] + real_offset[0]);
- points[num_points][1] = (hsize_t)(v + start[1] + real_offset[1]);
+ points[num_points][0] = (hsize_t)((hssize_t)(u + start[0]) + real_offset[0]);
+ points[num_points][1] = (hsize_t)((hssize_t)(v + start[1]) + real_offset[1]);
} /* end for */
/* Iterate through selection, verifying correct data */
@@ -7379,7 +7379,7 @@ test_select_fill_hyper_regular(hssize_t *offset)
for(u = 0, tbuf = wbuf; u < SPACE7_DIM1; u++)
for(v = 0; v < SPACE7_DIM2; v++, tbuf++) {
for(w = 0; w < (unsigned)num_points; w++) {
- if(u == (unsigned)(points[w][0] + real_offset[0]) && v == (unsigned)(points[w][1] + real_offset[1])) {
+ if(u == (unsigned)((hssize_t)points[w][0] + real_offset[0]) && v == (unsigned)((hssize_t)points[w][1] + real_offset[1])) {
if(*tbuf != (unsigned)fill_value)
TestErrPrintf("Error! v=%u, u=%u, *tbuf=%u, fill_value=%u\n", v, u, *tbuf, (unsigned)fill_value);
break;
@@ -7396,8 +7396,8 @@ test_select_fill_hyper_regular(hssize_t *offset)
/* Add in the offset */
for(u = 0; u < (unsigned)num_points; u++) {
- points[u][0] = (hsize_t)(points[u][0] + real_offset[0]);
- points[u][1] = (hsize_t)(points[u][1] + real_offset[1]);
+ points[u][0] = (hsize_t)((hssize_t)points[u][0] + real_offset[0]);
+ points[u][1] = (hsize_t)((hssize_t)points[u][1] + real_offset[1]);
} /* end for */
/* Iterate through selection, verifying correct data */
@@ -7502,7 +7502,7 @@ test_select_fill_hyper_irregular(hssize_t *offset)
for(u = 0, tbuf = wbuf; u < SPACE7_DIM1; u++)
for(v = 0; v < SPACE7_DIM2; v++, tbuf++) {
for(w = 0; w < (unsigned)num_points; w++) {
- if(u == (unsigned)(points[w][0] + real_offset[0]) && v == (unsigned)(points[w][1] + real_offset[1])) {
+ if(u == (unsigned)((hssize_t)points[w][0] + real_offset[0]) && v == (unsigned)((hssize_t)points[w][1] + real_offset[1])) {
if(*tbuf != (unsigned)fill_value)
TestErrPrintf("Error! v=%u, u=%u, *tbuf=%u, fill_value=%u\n", v, u, *tbuf, (unsigned)fill_value);
break;
@@ -7519,8 +7519,8 @@ test_select_fill_hyper_irregular(hssize_t *offset)
/* Add in the offset */
for(u = 0; u < (unsigned)num_iter_points; u++) {
- iter_points[u][0] = (hsize_t)(iter_points[u][0] + real_offset[0]);
- iter_points[u][1] = (hsize_t)(iter_points[u][1] + real_offset[1]);
+ iter_points[u][0] = (hsize_t)((hssize_t)iter_points[u][0] + real_offset[0]);
+ iter_points[u][1] = (hsize_t)((hssize_t)iter_points[u][1] + real_offset[1]);
} /* end for */
/* Iterate through selection, verifying correct data */
@@ -13652,9 +13652,9 @@ test_hyper_unlim(void)
VERIFY(start2[0], start[0], "H5Sget_select_bounds");
VERIFY(start2[1], start[1], "H5Sget_select_bounds");
VERIFY(start2[2], start[2], "H5Sget_select_bounds");
- VERIFY(count2[0], start[0] + (stride[0] * (count[0] - (hsize_t)1)) + block[0] - (hsize_t)1, "H5Sget_select_bounds");
+ VERIFY(count2[0], (long)(start[0] + (stride[0] * (count[0] - 1)) + block[0] - 1), "H5Sget_select_bounds");
VERIFY(count2[1], H5S_UNLIMITED, "H5Sget_select_bounds");
- VERIFY(count2[2], start[2] + (stride[2] * (count[2] - (hsize_t)1)) + block[2] - (hsize_t)1, "H5Sget_select_bounds");
+ VERIFY(count2[2], (long)(start[2] + (stride[2] * (count[2] - 1)) + block[2] - 1), "H5Sget_select_bounds");
/* Close the dataspace */
ret = H5Sclose(sid);
diff --git a/test/tskiplist.c b/test/tskiplist.c
index 62c5f8e..f413674 100644
--- a/test/tskiplist.c
+++ b/test/tskiplist.c
@@ -31,9 +31,6 @@
11/15/04 - Started coding
*/
-#include <time.h>
-#include <stdlib.h>
-
#include "testhdf5.h"
#include "H5SLprivate.h"
diff --git a/test/tsohm.c b/test/tsohm.c
index b3ffac7..9d56fcc 100644
--- a/test/tsohm.c
+++ b/test/tsohm.c
@@ -1681,8 +1681,8 @@ size2_helper(hid_t fcpl_id, int test_file_closing, size2_helper_struct *ret_size
for(x = 0; x < NUM_ATTRIBUTES; ++x) {
/* Create a unique name and value for each attribute */
- attr_string1[0] = attr_name[0] = (x / 10) + '0';
- attr_string1[1] = attr_name[1] = (x % 10) + '0';
+ attr_string1[0] = attr_name[0] = (char)((x / 10) + '0');
+ attr_string1[1] = attr_name[1] = (char)((x % 10) + '0');
/* Create an attribute on the group */
attr_id = H5Acreate2(group_id, attr_name, attr_type_id, attr_space_id, H5P_DEFAULT, H5P_DEFAULT);
@@ -1721,8 +1721,8 @@ size2_helper(hid_t fcpl_id, int test_file_closing, size2_helper_struct *ret_size
for(x=0; x<NUM_ATTRIBUTES; ++x)
{
/* Create the same name and value for each attribute as before */
- attr_string1[0] = attr_name[0] = (x / 10) + '0';
- attr_string1[1] = attr_name[1] = (x % 10) + '0';
+ attr_string1[0] = attr_name[0] = (char)((x / 10) + '0');
+ attr_string1[1] = attr_name[1] = (char)((x % 10) + '0');
/* Create an attribute on the group */
attr_id = H5Acreate2(group_id, attr_name, attr_type_id, attr_space_id, H5P_DEFAULT, H5P_DEFAULT);
@@ -1940,8 +1940,8 @@ static void size2_verify(void)
for(x = 0; x < NUM_ATTRIBUTES; ++x) {
/* Create the name and correct value for each attribute */
- attr_correct_string[0] = attr_name[0] = (x / 10) + '0';
- attr_correct_string[1] = attr_name[1] = (x % 10) + '0';
+ attr_correct_string[0] = attr_name[0] = (char)((x / 10) + '0');
+ attr_correct_string[1] = attr_name[1] = (char)((x % 10) + '0');
attr1_id = H5Aopen(group1_id, attr_name, H5P_DEFAULT);
CHECK_I(attr1_id, "H5Aopen");
@@ -2197,7 +2197,7 @@ static void test_sohm_size2(int close_reopen)
/* The files with indexes shouldn't be that much bigger than an
* empty file.
*/
- if(list_index_med.empty_size > norm_sizes.empty_size * OVERHEAD_ALLOWED)
+ if(list_index_med.empty_size > (h5_stat_size_t)((float)norm_sizes.empty_size * OVERHEAD_ALLOWED))
VERIFY(0, 1, "h5_get_file_size");
@@ -2258,7 +2258,7 @@ static void test_sohm_size2(int close_reopen)
*/
if(list_index_med.dsets2 >= btree_index.dsets2)
VERIFY(list_index_med.dsets2, 1, "h5_get_file_size");
- if(btree_index.dsets2 > list_index_small.dsets2 * OVERHEAD_ALLOWED)
+ if(btree_index.dsets2 > (h5_stat_size_t)((float)list_index_small.dsets2 * OVERHEAD_ALLOWED))
VERIFY(btree_index.dsets2, list_index_small.dsets2, "h5_get_file_size");
if(list_index_small.dsets2 >= norm_sizes.dsets2)
VERIFY(btree_index.dsets2, 1, "h5_get_file_size");
@@ -2267,7 +2267,7 @@ static void test_sohm_size2(int close_reopen)
* It seems that the small lists tends to be pretty big anyway. Allow
* for it to have twice as much overhead.
*/
- if(list_index_small.dsets2 > btree_index.dsets2 * OVERHEAD_ALLOWED * OVERHEAD_ALLOWED)
+ if(list_index_small.dsets2 > (h5_stat_size_t)((float)btree_index.dsets2 * OVERHEAD_ALLOWED * OVERHEAD_ALLOWED))
VERIFY(0, 1, "h5_get_file_size");
/* The lists should have grown the least since they share messages and
* have no extra overhead. The normal file should have grown more than
@@ -2291,7 +2291,7 @@ static void test_sohm_size2(int close_reopen)
*/
if(list_index_med.interleaved >= btree_index.interleaved)
VERIFY(0, 1, "h5_get_file_size");
- if(btree_index.interleaved > list_index_small.interleaved * OVERHEAD_ALLOWED)
+ if(btree_index.interleaved > (h5_stat_size_t)((float)list_index_small.interleaved * OVERHEAD_ALLOWED))
VERIFY(btree_index.interleaved, list_index_small.interleaved, "h5_get_file_size");
if(list_index_small.interleaved >= norm_sizes.interleaved)
VERIFY(0, 1, "h5_get_file_size");
@@ -2318,22 +2318,21 @@ static void test_sohm_size2(int close_reopen)
* that started as a B-tree.
* Add in OVERHEAD_ALLOWED as a fudge factor here, since the allocation
* of file space can be hard to predict.
-
*/
- if(btree_index.attrs1 > list_index_small.attrs1 * OVERHEAD_ALLOWED)
+ if(btree_index.attrs1 > (h5_stat_size_t)((float)list_index_small.attrs1 * OVERHEAD_ALLOWED))
VERIFY(btree_index.attrs1, list_index_small.attrs1, "h5_get_file_size");
- if(btree_index.attrs1 > list_index_med.attrs1 * OVERHEAD_ALLOWED)
+ if(btree_index.attrs1 > (h5_stat_size_t)((float)list_index_med.attrs1 * OVERHEAD_ALLOWED))
VERIFY(0, 1, "h5_get_file_size");
- if(list_index_med.attrs1 > btree_index.attrs1 * OVERHEAD_ALLOWED)
+ if(list_index_med.attrs1 > (h5_stat_size_t)((float)btree_index.attrs1 * OVERHEAD_ALLOWED))
VERIFY(0, 1, "h5_get_file_size");
- if(list_index_small.attrs1 > btree_index.attrs1 * OVERHEAD_ALLOWED)
+ if(list_index_small.attrs1 > (h5_stat_size_t)((float)btree_index.attrs1 * OVERHEAD_ALLOWED))
VERIFY(0, 1, "h5_get_file_size");
/* Neither of the converted lists should be too much bigger than
* the index that was originally a B-tree.
*/
- if(list_index_small.attrs1 > btree_index.attrs1 * OVERHEAD_ALLOWED)
+ if(list_index_small.attrs1 > (h5_stat_size_t)((float)btree_index.attrs1 * OVERHEAD_ALLOWED))
VERIFY(0, 1, "h5_get_file_size");
- if(list_index_med.attrs1 > btree_index.attrs1 * OVERHEAD_ALLOWED)
+ if(list_index_med.attrs1 > (h5_stat_size_t)((float)btree_index.attrs1 * OVERHEAD_ALLOWED))
VERIFY(0, 1, "h5_get_file_size");
/* The "normal" file should have had less overhead, so should gain less
* size than any of the other indexes since none of these attribute
@@ -2349,7 +2348,7 @@ static void test_sohm_size2(int close_reopen)
/* Give it some overhead (for checkin to move messages into continuation message) */
if((list_index_small.attrs1 - list_index_small.interleaved) >
- ((btree_index.attrs1 - btree_index.interleaved) * OVERHEAD_ALLOWED))
+ (h5_stat_size_t)((float)(btree_index.attrs1 - btree_index.interleaved) * OVERHEAD_ALLOWED))
VERIFY(0, 1, "h5_get_file_size");
@@ -2357,13 +2356,13 @@ static void test_sohm_size2(int close_reopen)
* of sizes. The big list index is still too big to be smaller than a
* normal file. The B-tree indexes should all be about the same size.
*/
- if(btree_index.attrs2 > list_index_small.attrs2 * OVERHEAD_ALLOWED)
+ if(btree_index.attrs2 > (h5_stat_size_t)((float)list_index_small.attrs2 * OVERHEAD_ALLOWED))
VERIFY(btree_index.attrs2, list_index_small.attrs2, "h5_get_file_size");
- if(list_index_small.attrs2 > btree_index.attrs2 * OVERHEAD_ALLOWED)
+ if(list_index_small.attrs2 > (h5_stat_size_t)((float)btree_index.attrs2 * OVERHEAD_ALLOWED))
VERIFY(0, 1, "h5_get_file_size");
- if(btree_index.attrs2 > list_index_med.attrs2 * OVERHEAD_ALLOWED)
+ if(btree_index.attrs2 > (h5_stat_size_t)((float)list_index_med.attrs2 * OVERHEAD_ALLOWED))
VERIFY(0, 1, "h5_get_file_size");
- if(list_index_med.attrs2 > btree_index.attrs2 * OVERHEAD_ALLOWED)
+ if(list_index_med.attrs2 > (h5_stat_size_t)((float)btree_index.attrs2 * OVERHEAD_ALLOWED))
VERIFY(0, 1, "h5_get_file_size");
if(list_index_med.attrs2 >= norm_sizes.attrs2)
VERIFY(0, 1, "h5_get_file_size");
@@ -2451,17 +2450,17 @@ static void test_sohm_size2(int close_reopen)
VERIFY((mult_index_btree.dsets1 - mult_index_btree.second_dset), (btree_index.dsets1 - btree_index.second_dset), "h5_get_file_size");
if((mult_index_med.dsets2 - mult_index_med.dsets1) >
- (list_index_med.dsets2 - list_index_med.dsets1) * OVERHEAD_ALLOWED)
+ (h5_stat_size_t)((float)(list_index_med.dsets2 - list_index_med.dsets1) * OVERHEAD_ALLOWED))
VERIFY(0, 1, "h5_get_file_size");
if((mult_index_btree.dsets2 - mult_index_btree.dsets1) >
- (btree_index.dsets2 - btree_index.dsets1) * OVERHEAD_ALLOWED)
+ (h5_stat_size_t)((float)(btree_index.dsets2 - btree_index.dsets1) * OVERHEAD_ALLOWED))
VERIFY(0, 1, "h5_get_file_size");
if((mult_index_med.interleaved - mult_index_med.dsets2) >
- (list_index_med.interleaved - list_index_med.dsets2) * OVERHEAD_ALLOWED)
+ (h5_stat_size_t)((float)(list_index_med.interleaved - list_index_med.dsets2) * OVERHEAD_ALLOWED))
VERIFY(0, 1, "h5_get_file_size");
if((mult_index_btree.interleaved - mult_index_btree.dsets2) >
- (btree_index.interleaved - btree_index.dsets2) * OVERHEAD_ALLOWED)
+ (h5_stat_size_t)((float)(btree_index.interleaved - btree_index.dsets2) * OVERHEAD_ALLOWED))
VERIFY(0, 1, "h5_get_file_size");
/* When all the attributes are added, only the index holding attributes
@@ -2470,10 +2469,10 @@ static void test_sohm_size2(int close_reopen)
* will take.
*/
if((mult_index_med.attrs2 - mult_index_med.attrs1) >
- (list_index_med.attrs2 - list_index_med.attrs1) * OVERHEAD_ALLOWED)
+ (h5_stat_size_t)((float)(list_index_med.attrs2 - list_index_med.attrs1) * OVERHEAD_ALLOWED))
VERIFY(0, 1, "h5_get_file_size");
if((mult_index_btree.attrs2 - mult_index_btree.attrs1) >
- (btree_index.attrs2 - btree_index.attrs1) * OVERHEAD_ALLOWED)
+ (h5_stat_size_t)((float)(btree_index.attrs2 - btree_index.attrs1) * OVERHEAD_ALLOWED))
VERIFY(0, 1, "h5_get_file_size");
/* The final file size for both of the multiple index files should be
@@ -2483,9 +2482,9 @@ static void test_sohm_size2(int close_reopen)
VERIFY(0, 1, "h5_get_file_size");
if(mult_index_btree.attrs2 >= norm_sizes.attrs2)
VERIFY(0, 1, "h5_get_file_size");
- if(mult_index_med.attrs2 * OVERHEAD_ALLOWED < btree_index.attrs2)
+ if((h5_stat_size_t)((float)mult_index_med.attrs2 * OVERHEAD_ALLOWED) < btree_index.attrs2)
VERIFY(0, 1, "h5_get_file_size");
- if(mult_index_btree.attrs2 * OVERHEAD_ALLOWED < btree_index.attrs2)
+ if((h5_stat_size_t)((float)mult_index_btree.attrs2 * OVERHEAD_ALLOWED) < btree_index.attrs2)
VERIFY(0, 1, "h5_get_file_size");
@@ -2554,39 +2553,39 @@ static void test_sohm_size2(int close_reopen)
if(share_tiny_index.empty_size != type_space_index.empty_size)
VERIFY(share_tiny_index.empty_size, type_space_index.empty_size, "h5_get_file_size");
- if(share_tiny_index.first_dset >= type_space_index.first_dset * OVERHEAD_ALLOWED)
+ if(share_tiny_index.first_dset >= (h5_stat_size_t)((float)type_space_index.first_dset * OVERHEAD_ALLOWED))
VERIFY(share_tiny_index.first_dset, type_space_index.first_dset, "h5_get_file_size");
if(share_tiny_index.first_dset < type_space_index.first_dset)
VERIFY(0, 1, "h5_get_file_size");
if(share_tiny_index.second_dset >= type_space_index.second_dset)
VERIFY(share_tiny_index.second_dset, type_space_index.second_dset, "h5_get_file_size");
- if(share_tiny_index.second_dset * OVERHEAD_ALLOWED < type_space_index.second_dset)
+ if((h5_stat_size_t)((float)share_tiny_index.second_dset * OVERHEAD_ALLOWED) < type_space_index.second_dset)
VERIFY(0, 1, "h5_get_file_size");
if(share_tiny_index.dsets1 >= type_space_index.dsets1)
VERIFY(0, 1, "h5_get_file_size");
- if(share_tiny_index.dsets1 * OVERHEAD_ALLOWED < type_space_index.dsets1)
+ if((h5_stat_size_t)((float)share_tiny_index.dsets1 * OVERHEAD_ALLOWED) < type_space_index.dsets1)
VERIFY(0, 1, "h5_get_file_size");
if(share_tiny_index.dsets2 >= type_space_index.dsets2)
VERIFY(0, 1, "h5_get_file_size");
- if(share_tiny_index.dsets2 * OVERHEAD_ALLOWED < type_space_index.dsets2)
+ if((h5_stat_size_t)((float)share_tiny_index.dsets2 * OVERHEAD_ALLOWED) < type_space_index.dsets2)
VERIFY(0, 1, "h5_get_file_size");
if(share_tiny_index.interleaved >= type_space_index.interleaved)
VERIFY(0, 1, "h5_get_file_size");
- if(share_tiny_index.interleaved * OVERHEAD_ALLOWED < type_space_index.interleaved)
+ if((h5_stat_size_t)((float)share_tiny_index.interleaved * OVERHEAD_ALLOWED) < type_space_index.interleaved)
VERIFY(0, 1, "h5_get_file_size");
if(share_tiny_index.attrs1 >= type_space_index.attrs1)
VERIFY(0, 1, "h5_get_file_size");
- if(share_tiny_index.attrs1 * OVERHEAD_ALLOWED < type_space_index.attrs1)
+ if((h5_stat_size_t)((float)share_tiny_index.attrs1 * OVERHEAD_ALLOWED) < type_space_index.attrs1)
VERIFY(0, 1, "h5_get_file_size");
if(share_tiny_index.attrs2 >= type_space_index.attrs2)
VERIFY(0, 1, "h5_get_file_size");
- if(share_tiny_index.attrs2 * OVERHEAD_ALLOWED < type_space_index.attrs2)
+ if((h5_stat_size_t)((float)share_tiny_index.attrs2 * OVERHEAD_ALLOWED) < type_space_index.attrs2)
VERIFY(0, 1, "h5_get_file_size");
} /* end test_sohm_size2() */
@@ -2616,7 +2615,7 @@ static void delete_helper_write(hid_t file_id, hid_t *dspace_id, hid_t *dcpl_id,
CHECK_I(dset_id, "H5Dcreate2");
/* Write data to dataset */
- wdata = x + 'a';
+ wdata = (char)(x + 'a');
ret = H5Dwrite(dset_id, H5T_NATIVE_CHAR, dspace_id[x], dspace_id[x], H5P_DEFAULT, &wdata);
CHECK_I(ret, "H5Dwrite");
@@ -2764,9 +2763,9 @@ static void delete_helper(hid_t fcpl_id, hid_t *dspace_id, hid_t *dcpl_id)
deleted_filesize = h5_get_file_size(FILENAME, H5P_DEFAULT);
/* The two filesizes should be almost the same */
- if(norm_filesize > deleted_filesize * OVERHEAD_ALLOWED)
+ if(norm_filesize > (h5_stat_size_t)((float)deleted_filesize * OVERHEAD_ALLOWED))
VERIFY(norm_filesize, deleted_filesize, "h5_get_file_size");
- if(deleted_filesize > norm_filesize * OVERHEAD_ALLOWED)
+ if(deleted_filesize > (h5_stat_size_t)((float)norm_filesize * OVERHEAD_ALLOWED))
VERIFY(deleted_filesize, norm_filesize, "h5_get_file_size");
}
@@ -3887,8 +3886,8 @@ test_sohm_external_dtype(void)
orig = (s1_t*)HDmalloc(NX * NY * sizeof(s1_t));
for(i=0; i<NX*NY; i++) {
s_ptr = (s1_t*)orig + i;
- s_ptr->a = i*3 + 1;
- s_ptr->b = i*3 + 2;
+ s_ptr->a = (int)(i * 3 + 1);
+ s_ptr->b = (int)(i * 3 + 2);
}
/* Write the data to the dataset1 */
diff --git a/test/ttsafe.c b/test/ttsafe.c
index 1fb9446..bfd24ba 100644
--- a/test/ttsafe.c
+++ b/test/ttsafe.c
@@ -143,6 +143,9 @@ int main(int argc, char *argv[])
if (GetTestCleanup() && !getenv("HDF5_NOCLEANUP"))
TestCleanup();
+ /* Release test infrastructure */
+ TestShutdown();
+
return GetTestNumErrs();
} /* end main() */
diff --git a/test/ttst.c b/test/ttst.c
index b869b63..a7c43a2 100644
--- a/test/ttst.c
+++ b/test/ttst.c
@@ -33,9 +33,6 @@
12/9/02 - Started coding
*/
-#include <time.h>
-#include <stdlib.h>
-
#include "testhdf5.h"
#include "H5STprivate.h"
@@ -126,7 +123,7 @@ test_tst_init(void)
curr_time=HDtime(NULL);
HDsrandom((unsigned)curr_time);
for(u=0; u<num_uniq_words; u++) {
- v=u+(HDrandom()%(num_uniq_words-u));
+ v = u + ((size_t)HDrandom() % (num_uniq_words - u));
if(u!=v) {
tmp_word=rand_uniq_words[u];
rand_uniq_words[u]=rand_uniq_words[v];
diff --git a/test/tunicode.c b/test/tunicode.c
index 93c00c5..2bba9ae 100644
--- a/test/tunicode.c
+++ b/test/tunicode.c
@@ -14,10 +14,6 @@
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/* Unicode test */
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <time.h>
#include "testhdf5.h"
#define NUM_CHARS 16
@@ -388,6 +384,7 @@ void test_objnames(hid_t fid, const char* string)
char path_buf[MAX_PATH_LENGTH];
hsize_t dims=1;
hobj_ref_t obj_ref;
+ ssize_t size;
herr_t ret;
/* Create a group with a UTF-8 name */
@@ -399,8 +396,8 @@ void test_objnames(hid_t fid, const char* string)
*/
ret = H5Oset_comment_by_name(fid, string, string, H5P_DEFAULT);
CHECK(ret, FAIL, "H5Oset_comment_by_name");
- ret = H5Oget_comment_by_name(fid, string, read_buf, (size_t)MAX_STRING_LENGTH, H5P_DEFAULT);
- CHECK(ret, FAIL, "H5Oget_comment_by_name");
+ size = H5Oget_comment_by_name(fid, string, read_buf, (size_t)MAX_STRING_LENGTH, H5P_DEFAULT);
+ CHECK(size, FAIL, "H5Oget_comment_by_name");
ret = H5Gclose(grp_id);
CHECK(ret, FAIL, "H5Gclose");
@@ -514,6 +511,7 @@ void test_attrname(hid_t fid, const char * string)
hid_t dtype_id, space_id;
hsize_t dims=1;
char read_buf[MAX_STRING_LENGTH];
+ ssize_t size;
herr_t ret;
/* Create a new group and give it an attribute whose
@@ -532,8 +530,8 @@ void test_attrname(hid_t fid, const char * string)
/* Create the attribute and check that its name is correct */
attr_id = H5Acreate2(group_id, string, dtype_id, space_id, H5P_DEFAULT, H5P_DEFAULT);
CHECK(attr_id, FAIL, "H5Acreate2");
- ret = H5Aget_name(attr_id, (size_t)MAX_STRING_LENGTH, read_buf);
- CHECK(ret, FAIL, "H5Aget_name");
+ size = H5Aget_name(attr_id, (size_t)MAX_STRING_LENGTH, read_buf);
+ CHECK(size, FAIL, "H5Aget_name");
ret = strcmp(read_buf, string);
VERIFY(ret, 0, "strcmp");
read_buf[0] = '\0';
@@ -744,25 +742,25 @@ static hid_t mkstr(size_t len, H5T_str_t strpad)
unsigned int write_char(unsigned int c, char * test_string, unsigned int cur_pos)
{
if (c < 0x80) {
- test_string[cur_pos] = c;
+ test_string[cur_pos] = (char)c;
cur_pos++;
}
else if (c < 0x800) {
- test_string[cur_pos] = (0xC0 | c>>6);
- test_string[cur_pos+1] = (0x80 | (c & 0x3F));
+ test_string[cur_pos] = (char)(0xC0 | c >> 6);
+ test_string[cur_pos + 1] = (char)(0x80 | (c & 0x3F));
cur_pos += 2;
}
else if (c < 0x10000) {
- test_string[cur_pos] = (0xE0 | c>>12);
- test_string[cur_pos+1] = (0x80 | (c>>6 & 0x3F));
- test_string[cur_pos+2] = (0x80 | (c & 0x3F));
+ test_string[cur_pos] = (char)(0xE0 | c >> 12);
+ test_string[cur_pos + 1] = (char)(0x80 | (c >> 6 & 0x3F));
+ test_string[cur_pos + 2] = (char)(0x80 | (c & 0x3F));
cur_pos += 3;
}
else if (c < 0x200000) {
- test_string[cur_pos] = (0xF0 | c>>18);
- test_string[cur_pos+1] = (0x80 | (c>>12 & 0x3F));
- test_string[cur_pos+2] = (0x80 | (c>>6 & 0x3F));
- test_string[cur_pos+3] = (0x80 | (c & 0x3F));
+ test_string[cur_pos] = (char)(0xF0 | c >> 18);
+ test_string[cur_pos + 1] = (char)(0x80 | (c >> 12 & 0x3F));
+ test_string[cur_pos + 2] = (char)(0x80 | (c >> 6 & 0x3F));
+ test_string[cur_pos + 3] = (char)(0x80 | (c & 0x3F));
cur_pos += 4;
}
@@ -775,13 +773,13 @@ unsigned int write_char(unsigned int c, char * test_string, unsigned int cur_pos
* could confuse printf (e.g., '\n'). */
void dump_string(const char * string)
{
- unsigned int length;
- unsigned int x;
+ size_t length;
+ size_t x;
printf("The string was:\n %s", string);
printf("Or in hex:\n");
- length = strlen(string);
+ length = HDstrlen(string);
for(x=0; x<length; x++)
printf("%x ", string[x] & (0x000000FF));
@@ -814,7 +812,7 @@ void test_unicode(void)
/* We need to avoid unprintable characters (codes 0-31) and the
* . and / characters, since they aren't allowed in path names.
*/
- unicode_point = (HDrandom() % (MAX_CODE_POINT-32)) + 32;
+ unicode_point = (unsigned)(HDrandom() % (MAX_CODE_POINT-32)) + 32;
if(unicode_point != 46 && unicode_point != 47)
cur_pos = write_char(unicode_point, test_string, cur_pos);
}
diff --git a/test/tvltypes.c b/test/tvltypes.c
index b7bbaee..f8a6a91 100644
--- a/test/tvltypes.c
+++ b/test/tvltypes.c
@@ -169,7 +169,7 @@ static void
test_vltypes_funcs(void)
{
hid_t type; /* Datatype ID */
- int size;
+ size_t size;
H5T_pad_t inpad;
H5T_norm_t norm;
H5T_cset_t cset;
@@ -183,16 +183,16 @@ test_vltypes_funcs(void)
type = H5Tvlen_create (H5T_IEEE_F32BE);
CHECK(type, FAIL, "H5Tvlen_create");
- size=H5Tget_precision(type);
- CHECK(size, FAIL, "H5Tget_precision");
+ size = H5Tget_precision(type);
+ CHECK(size, 0, "H5Tget_precision");
- size=H5Tget_size(type);
- CHECK(size, FAIL, "H5Tget_size");
+ size = H5Tget_size(type);
+ CHECK(size, 0, "H5Tget_size");
- size=H5Tget_ebias(type);
- CHECK(size, FAIL, "H5Tget_ebias");
+ size = H5Tget_ebias(type);
+ CHECK(size, 0, "H5Tget_ebias");
- ret=H5Tset_pad(type, H5T_PAD_ZERO, H5T_PAD_ONE);
+ ret = H5Tset_pad(type, H5T_PAD_ZERO, H5T_PAD_ONE);
CHECK(ret, FAIL, "H5Tset_pad");
inpad = H5Tget_inpad(type);
@@ -558,7 +558,7 @@ rewrite_vltypes_vlen_atomic(void)
hsize_t size; /* Number of bytes which will be used */
unsigned i,j; /* counting variables */
size_t mem_used=0; /* Memory used during allocation */
- int increment=4;
+ unsigned increment=4;
herr_t ret; /* Generic return value */
/* Output message about test being performed */
@@ -730,8 +730,8 @@ test_vltypes_vlen_compound(void)
wdata[i].p=HDmalloc((i+1)*sizeof(s1));
wdata[i].len=i+1;
for(j=0; j<(i+1); j++) {
- ((s1 *)wdata[i].p)[j].i=i*10+j;
- ((s1 *)wdata[i].p)[j].f=(float)((i*20+j)/3.0F);
+ ((s1 *)wdata[i].p)[j].i = (int)(i * 10 + j);
+ ((s1 *)wdata[i].p)[j].f = (float)(i * 20 + j) / 3.0F;
} /* end for */
} /* end for */
@@ -865,7 +865,7 @@ rewrite_vltypes_vlen_compound(void)
hsize_t size; /* Number of bytes which will be used */
unsigned i,j; /* counting variables */
size_t mem_used=0; /* Memory used during allocation */
- int increment=4;
+ unsigned increment=4;
herr_t ret; /* Generic return value */
/* Output message about test being performed */
@@ -876,8 +876,8 @@ rewrite_vltypes_vlen_compound(void)
wdata[i].p = HDmalloc((i + increment) * sizeof(s1));
wdata[i].len = i + increment;
for(j = 0; j < (i + increment); j++) {
- ((s1 *)wdata[i].p)[j].i = i * 40 + j;
- ((s1 *)wdata[i].p)[j].f = (float)((i * 60 + j) / 3.0F);
+ ((s1 *)wdata[i].p)[j].i = (int)(i * 40 + j);
+ ((s1 *)wdata[i].p)[j].f = (float)(i * 60 + j) / 3.0F;
} /* end for */
} /* end for */
@@ -1016,17 +1016,17 @@ test_vltypes_compound_vlen_vlen(void)
MESSAGE(5, ("Testing Compound Datatypes with VL Atomic Datatype Component Functionality\n"));
/* Allocate and initialize VL data to write */
- for(i=0; i<SPACE3_DIM1; i++) {
- wdata[i].i=i*10;
- wdata[i].f=(float)((i*20)/3.0F);
- wdata[i].v.p=HDmalloc((i+L1_INCM)*sizeof(hvl_t));
- wdata[i].v.len=i+L1_INCM;
- for(t1=(hvl_t *)((wdata[i].v).p),j=0; j<(i+L1_INCM); j++, t1++) {
- t1->p=HDmalloc((j+L2_INCM)*sizeof(unsigned int));
- t1->len=j+L2_INCM;
- for(k=0; k<j+L2_INCM; k++)
- ((unsigned int*)t1->p)[k] = i*100 + j*10 + k;
- }
+ for(i = 0; i < SPACE3_DIM1; i++) {
+ wdata[i].i = (int)(i * 10);
+ wdata[i].f = (float)(i * 20) / 3.0F;
+ wdata[i].v.p = HDmalloc((i + L1_INCM) * sizeof(hvl_t));
+ wdata[i].v.len = i + L1_INCM;
+ for(t1 = (hvl_t *)((wdata[i].v).p), j = 0; j < (i + L1_INCM); j++, t1++) {
+ t1->p = HDmalloc((j + L2_INCM) * sizeof(unsigned int));
+ t1->len = j + L2_INCM;
+ for(k = 0; k < j + L2_INCM; k++)
+ ((unsigned int*)t1->p)[k] = i * 100 + j * 10 + k;
+ } /* end for */
} /* end for */
/* Create file */
@@ -1477,13 +1477,13 @@ test_vltypes_compound_vlen_atomic(void)
MESSAGE(5, ("Testing Compound Datatypes with VL Atomic Datatype Component Functionality\n"));
/* Allocate and initialize VL data to write */
- for(i=0; i<SPACE1_DIM1; i++) {
- wdata[i].i=i*10;
- wdata[i].f=(float)((i*20)/3.0F);
- wdata[i].v.p=HDmalloc((i+1)*sizeof(unsigned int));
- wdata[i].v.len=i+1;
- for(j=0; j<(i+1); j++)
- ((unsigned int *)wdata[i].v.p)[j]=i*10+j;
+ for(i = 0; i < SPACE1_DIM1; i++) {
+ wdata[i].i = (int)(i * 10);
+ wdata[i].f = (float)(i * 20) / 3.0F;
+ wdata[i].v.p = HDmalloc((i + 1)*sizeof(unsigned int));
+ wdata[i].v.len = i + 1;
+ for(j = 0; j < (i + 1); j++)
+ ((unsigned int *)wdata[i].v.p)[j] = i * 10 + j;
} /* end for */
/* Create file */
@@ -1688,7 +1688,7 @@ rewrite_vltypes_compound_vlen_atomic(void)
hsize_t size; /* Number of bytes which will be used */
unsigned i,j; /* counting variables */
size_t mem_used=0; /* Memory used during allocation */
- int increment=4;
+ unsigned increment=4;
herr_t ret; /* Generic return value */
/* Output message about test being performed */
@@ -1696,8 +1696,8 @@ rewrite_vltypes_compound_vlen_atomic(void)
/* Allocate and initialize VL data to write */
for(i = 0; i < SPACE1_DIM1; i++) {
- wdata[i].i = i * 40;
- wdata[i].f = (float)((i * 50) / 3.0F);
+ wdata[i].i = (int)(i * 40);
+ wdata[i].f = (float)(i * 50) / 3.0F;
wdata[i].v.p = HDmalloc((i + increment) * sizeof(unsigned int));
wdata[i].v.len = i + increment;
for(j = 0; j < (i + increment); j++)
@@ -1960,7 +1960,7 @@ test_vltypes_vlen_vlen_atomic(void)
/* 10 hvl_t elements allocated = 1 + 2 + 3 + 4 elements for each array position */
/* 20 unsigned int elements allocated = 1 + 3 + 6 + 10 elements */
- VERIFY(size, ((SPACE1_DIM1 * (SPACE1_DIM1 + 1)) / 2) * sizeof(hvl_t) + vlen_size_func((unsigned long)SPACE1_DIM1) * sizeof(unsigned int), "H5Dvlen_get_buf_size");
+ VERIFY(size, (hsize_t)(((SPACE1_DIM1 * (SPACE1_DIM1 + 1)) / 2) * sizeof(hvl_t) + vlen_size_func((unsigned long)SPACE1_DIM1) * sizeof(unsigned int)), "H5Dvlen_get_buf_size");
/* Read dataset from disk */
ret = H5Dread(dataset, tid2, H5S_ALL, H5S_ALL, xfer_pid, rdata);
@@ -1969,7 +1969,7 @@ test_vltypes_vlen_vlen_atomic(void)
/* Make certain the correct amount of memory has been used */
/* 10 hvl_t elements allocated = 1 + 2 + 3 + 4 elements for each array position */
/* 20 unsigned int elements allocated = 1 + 3 + 6 + 10 elements */
- VERIFY(mem_used, ((SPACE1_DIM1 * (SPACE1_DIM1 + 1)) / 2) * sizeof(hvl_t) + vlen_size_func((unsigned long)SPACE1_DIM1) * sizeof(unsigned int), "H5Dread");
+ VERIFY(mem_used, (size_t)(((SPACE1_DIM1 * (SPACE1_DIM1 + 1)) / 2) * sizeof(hvl_t) + vlen_size_func((unsigned long)SPACE1_DIM1) * sizeof(unsigned int)), "H5Dread");
/* Compare data read in */
for(i=0; i<SPACE1_DIM1; i++) {
@@ -2048,7 +2048,7 @@ rewrite_longer_vltypes_vlen_vlen_atomic(void)
hsize_t size; /* Number of bytes which will be used */
unsigned i,j,k; /* counting variables */
size_t mem_used=0; /* Memory used during allocation */
- int increment=1;
+ unsigned increment=1;
herr_t ret; /* Generic return value */
/* Output message about test being performed */
@@ -2224,7 +2224,7 @@ rewrite_shorter_vltypes_vlen_vlen_atomic(void)
hsize_t size; /* Number of bytes which will be used */
unsigned i,j,k; /* counting variables */
size_t mem_used=0; /* Memory used during allocation */
- int increment=1;
+ unsigned increment=1;
herr_t ret; /* Generic return value */
/* Output message about test being performed */
@@ -2316,7 +2316,7 @@ rewrite_shorter_vltypes_vlen_vlen_atomic(void)
/* 10 hvl_t elements allocated = 1 + 2 + 3 + 4 elements for each array position */
/* 20 unsigned int elements allocated = 1 + 3 + 6 + 10 elements */
- VERIFY(size, ((SPACE1_DIM1*(SPACE1_DIM1 + 1)) / 2) * sizeof(hvl_t) + vlen_size_func((unsigned long)SPACE1_DIM1) * sizeof(unsigned int), "H5Dvlen_get_buf_size");
+ VERIFY(size, (hsize_t)(((SPACE1_DIM1*(SPACE1_DIM1 + 1)) / 2) * sizeof(hvl_t) + vlen_size_func((unsigned long)SPACE1_DIM1) * sizeof(unsigned int)), "H5Dvlen_get_buf_size");
/* Read dataset from disk */
ret=H5Dread(dataset,tid2,H5S_ALL,H5S_ALL,xfer_pid,rdata);
@@ -2325,7 +2325,7 @@ rewrite_shorter_vltypes_vlen_vlen_atomic(void)
/* Make certain the correct amount of memory has been used */
/* 10 hvl_t elements allocated = 1 + 2 + 3 + 4 elements for each array position */
/* 20 unsigned int elements allocated = 1 + 3 + 6 + 10 elements */
- VERIFY(mem_used,((SPACE1_DIM1*(SPACE1_DIM1+1))/2)*sizeof(hvl_t)+vlen_size_func((unsigned long)SPACE1_DIM1)*sizeof(unsigned int),"H5Dread");
+ VERIFY(mem_used, (size_t)(((SPACE1_DIM1*(SPACE1_DIM1+1))/2)*sizeof(hvl_t)+vlen_size_func((unsigned long)SPACE1_DIM1)*sizeof(unsigned int)),"H5Dread");
/* Compare data read in */
for(i=0; i<SPACE1_DIM1; i++) {
@@ -2597,6 +2597,10 @@ test_vltypes_fill_value(void)
}
break;
+ case H5D_VIRTUAL:
+ assert(0 && "Invalid layout type!");
+ break;
+
case H5D_LAYOUT_ERROR:
case H5D_NLAYOUTS:
default:
@@ -2700,6 +2704,10 @@ test_vltypes_fill_value(void)
dset_elmts = SPACE4_DIM_LARGE;
break;
+ case H5D_VIRTUAL:
+ assert(0 && "Invalid layout type!");
+ break;
+
case H5D_LAYOUT_ERROR:
case H5D_NLAYOUTS:
default:
@@ -2897,6 +2905,10 @@ test_vltypes_fill_value(void)
dset_elmts = SPACE4_DIM_LARGE;
break;
+ case H5D_VIRTUAL:
+ assert(0 && "Invalid layout type!");
+ break;
+
case H5D_LAYOUT_ERROR:
case H5D_NLAYOUTS:
default:
diff --git a/test/unlink.c b/test/unlink.c
index 7169365..9222596 100644
--- a/test/unlink.c
+++ b/test/unlink.c
@@ -25,7 +25,6 @@
/* Define this macro to indicate that the testing APIs should be available */
#define H5G_TESTING
-#include <time.h>
#include "h5test.h"
#include "H5Gpkg.h" /* Groups */
diff --git a/test/vds.c b/test/vds.c
index 50523f0..2fd492a 100644
--- a/test/vds.c
+++ b/test/vds.c
@@ -19,7 +19,6 @@
* Purpose: Tests datasets with virtual layout.
*/
#include "h5test.h"
-#include "H5srcdir.h"
#include "H5Dprivate.h" /* For H5D_VIRTUAL_DEF_LIST_SIZE */
typedef enum {
diff --git a/test/vfd.c b/test/vfd.c
index 708474c..c19e0d0 100644
--- a/test/vfd.c
+++ b/test/vfd.c
@@ -27,8 +27,13 @@
#define FAMILY_SIZE (1*KB)
#define FAMILY_SIZE2 (5*KB)
#define MULTI_SIZE 128
+
#define CORE_INCREMENT (4*KB)
-#define CORE_PAGE_SIZE (1024 * 1024)
+#define CORE_PAGE_SIZE (1024*KB)
+#define CORE_DSET_NAME "core dset"
+#define CORE_DSET_DIM1 1024
+#define CORE_DSET_DIM2 32
+
#define DSET1_NAME "dset1"
#define DSET1_DIM1 1024
#define DSET1_DIM2 32
@@ -80,68 +85,76 @@ const char *FILENAME[] = {
static herr_t
test_sec2(void)
{
- hid_t file = -1;
- hid_t fapl = -1;
- hid_t access_fapl = -1;
- char filename[1024];
- int *fhandle = NULL;
- hsize_t file_size = 0;
+ hid_t fid = -1; /* file ID */
+ hid_t fapl_id = -1; /* file access property list ID */
+ hid_t fapl_id_out = -1; /* from H5Fget_access_plist */
+ char filename[1024]; /* filename */
+ void *os_file_handle = NULL; /* OS file handle */
+ hsize_t file_size; /* file size */
TESTING("SEC2 file driver");
- h5_reset();
-
/* Set property list and file name for SEC2 driver. */
- fapl = h5_fileaccess();
- if(H5Pset_fapl_sec2(fapl) < 0)
+ if((fapl_id = H5Pcreate(H5P_FILE_ACCESS)) < 0)
TEST_ERROR;
- h5_fixname(FILENAME[0], fapl, filename, sizeof filename);
+ if(H5Pset_fapl_sec2(fapl_id) < 0)
+ TEST_ERROR;
+ h5_fixname(FILENAME[0], fapl_id, filename, sizeof(filename));
- if((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
+ if((fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl_id)) < 0)
TEST_ERROR;
/* Retrieve the access property list... */
- if((access_fapl = H5Fget_access_plist(file)) < 0)
+ if((fapl_id_out = H5Fget_access_plist(fid)) < 0)
TEST_ERROR;
/* Check that the driver is correct */
- if(H5FD_SEC2 != H5Pget_driver(access_fapl))
+ if(H5FD_SEC2 != H5Pget_driver(fapl_id_out))
TEST_ERROR;
/* ...and close the property list */
- if(H5Pclose(access_fapl) < 0)
+ if(H5Pclose(fapl_id_out) < 0)
TEST_ERROR;
- /* Check file handle API */
- if(H5Fget_vfd_handle(file, H5P_DEFAULT, (void **)&fhandle) < 0)
- TEST_ERROR;
- if(*fhandle < 0)
+ /* Check that we can get an operating-system-specific handle from
+ * the library.
+ */
+ if(H5Fget_vfd_handle(fid, H5P_DEFAULT, &os_file_handle) < 0)
TEST_ERROR;
+ if(os_file_handle == NULL)
+ FAIL_PUTS_ERROR("NULL os-specific vfd/file handle was returned from H5Fget_vfd_handle");
- /* Check file size API */
- if(H5Fget_filesize(file, &file_size) < 0)
- TEST_ERROR;
- /* There is no guarantee the size of metadata in file is constant.
- * Just try to check if it's reasonable. It's 2KB right now.
+ /* There is no garantee the size of metadata in file is constant.
+ * Just try to check if it's reasonable.
+ *
+ * Currently it should be around 2 KB.
*/
+ if(H5Fget_filesize(fid, &file_size) < 0)
+ TEST_ERROR;
if(file_size < 1 * KB || file_size > 4 * KB)
+ FAIL_PUTS_ERROR("suspicious file size obtained from H5Fget_filesize");
+
+ /* Close and delete the file */
+ if(H5Fclose(fid) < 0)
TEST_ERROR;
+ h5_delete_test_file(FILENAME[0], fapl_id);
- if(H5Fclose(file) < 0)
+ /* Close the fapl */
+ if(H5Pclose(fapl_id) < 0)
TEST_ERROR;
- h5_cleanup(FILENAME, fapl);
PASSED();
return 0;
error:
H5E_BEGIN_TRY {
- H5Pclose(fapl);
- H5Fclose(file);
+ H5Pclose(fapl_id);
+ H5Pclose(fapl_id_out);
+ H5Fclose(fid);
} H5E_END_TRY;
return -1;
-}
+} /* end test_sec2() */
/*-------------------------------------------------------------------------
@@ -160,218 +173,318 @@ error:
static herr_t
test_core(void)
{
- hid_t file=(-1), fapl, access_fapl = -1;
- char filename[1024];
- void *fhandle=NULL;
- hsize_t file_size;
- hbool_t use_write_tracking;
- size_t write_tracking_page_size;
- int *points = NULL, *check = NULL, *p1, *p2;
- hid_t dset1=-1, space1=-1;
- hsize_t dims1[2];
- int i, j, n;
+ hid_t fid = -1; /* file ID */
+ hid_t fapl_id = -1; /* file access property list ID */
+ hid_t fapl_id_out = -1; /* from H5Fget_access_plist */
+ hid_t did = -1; /* dataset ID */
+ hid_t sid = -1; /* dataspace ID */
+ char filename[1024]; /* filename */
+ void *os_file_handle = NULL; /* OS file handle */
+ hsize_t file_size; /* file size */
+ size_t increment; /* core VFD increment */
+ hbool_t backing_store; /* use backing store? */
+ hbool_t use_write_tracking; /* write tracking flag */
+ size_t write_tracking_page_size; /* write tracking page size */
+ int *data_w = NULL; /* data written to the dataset */
+ int *data_r = NULL; /* data read from the dataset */
+ int val; /* data value */
+ int *pw = NULL, *pr = NULL; /* pointers for iterating over
+ data arrays (write & read) */
+ hsize_t dims[2]; /* dataspace dimensions */
+ int i, j; /* iterators */
+ htri_t status; /* return value from H5Lexists */
TESTING("CORE file driver");
- h5_reset();
+ /* Get a file access property list and fix up the file name */
+ if((fapl_id = H5Pcreate(H5P_FILE_ACCESS)) < 0)
+ TEST_ERROR;
+ h5_fixname(FILENAME[1], fapl_id, filename, sizeof(filename));
- /* Set property list and file name for CORE driver */
- fapl = h5_fileaccess();
- if(H5Pset_fapl_core(fapl, (size_t)CORE_INCREMENT, TRUE) < 0)
+ /************************************************************************
+ * Check that the backing store flag works by creating a file, close
+ * it, and ensure that the file does not exist.
+ ************************************************************************/
+
+ /* Make sure it's not present at the start of the test */
+ if(HDaccess(filename, F_OK) != -1)
+ if(HDremove(filename) < 0)
+ FAIL_PUTS_ERROR("unable to remove backing store file");
+ /* Create and close file w/ backing store off */
+ if(H5Pset_fapl_core(fapl_id, (size_t)CORE_INCREMENT, FALSE) < 0)
+ TEST_ERROR;
+ if((fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl_id)) < 0)
TEST_ERROR;
- if(H5Pset_core_write_tracking(fapl, TRUE, CORE_PAGE_SIZE) < 0)
+ if(H5Fclose(fid) < 0)
TEST_ERROR;
- h5_fixname(FILENAME[1], fapl, filename, sizeof filename);
+ /* Check for the backing store file */
+ if(HDaccess(filename, F_OK) != -1)
+ FAIL_PUTS_ERROR("file created when backing store set to FALSE");
- if((file=H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
+
+ /************************************************************************
+ * Check basic core VFD operation and properties. This is done with the
+ * backing store on so a file will be created for later use.
+ ************************************************************************/
+
+ /* Turn the backing store on */
+ if(H5Pset_fapl_core(fapl_id, (size_t)CORE_INCREMENT, TRUE) < 0)
+ TEST_ERROR;
+
+ /* Check that write tracking is off by default and that the default
+ * page size is non-zero.
+ */
+ if(H5Pget_core_write_tracking(fapl_id, &use_write_tracking, &write_tracking_page_size) < 0)
+ TEST_ERROR;
+ if(FALSE != use_write_tracking)
+ FAIL_PUTS_ERROR("write tracking should be off by default");
+ if(0 == write_tracking_page_size)
+ FAIL_PUTS_ERROR("write tracking page size should never be zero");
+
+ /* Set core VFD properties */
+ if(H5Pset_core_write_tracking(fapl_id, TRUE, CORE_PAGE_SIZE) < 0)
+ TEST_ERROR;
+
+ /* Create the file */
+ if((fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl_id)) < 0)
TEST_ERROR;
/* Retrieve the access property list... */
- if ((access_fapl = H5Fget_access_plist(file)) < 0)
+ if((fapl_id_out = H5Fget_access_plist(fid)) < 0)
TEST_ERROR;
/* Check that the driver is correct */
- if(H5FD_CORE != H5Pget_driver(access_fapl))
+ if(H5FD_CORE != H5Pget_driver(fapl_id_out))
TEST_ERROR;
+ /* Get the basic VFD properties from the fapl and ensure that
+ * they are correct.
+ */
+ if(H5Pget_fapl_core(fapl_id_out, &increment, &backing_store) < 0)
+ TEST_ERROR
+ if(increment != (size_t)CORE_INCREMENT)
+ FAIL_PUTS_ERROR("incorrect increment from file fapl");
+ if(backing_store != TRUE)
+ FAIL_PUTS_ERROR("incorrect backing store flag from file fapl");
+
/* Check that the backing store write tracking info was saved */
- if(H5Pget_core_write_tracking(fapl, &use_write_tracking, &write_tracking_page_size) < 0)
+ /* TODO: There is a bug where H5Fget_access_plist() does not return
+ * the write tracking properties. Until this bug is fixed, just
+ * test the main fapl_id.
+ */
+ if(H5Pget_core_write_tracking(fapl_id, &use_write_tracking, &write_tracking_page_size) < 0)
TEST_ERROR;
if(TRUE != use_write_tracking)
- TEST_ERROR;
+ FAIL_PUTS_ERROR("write tracking flag incorrect in fapl obtained from H5Fget_access_plist");
if(CORE_PAGE_SIZE != write_tracking_page_size)
- TEST_ERROR;
+ FAIL_PUTS_ERROR("write tracking page size incorrect in fapl obtained from H5Fget_access_plist");
- /* ...and close the property list */
- if (H5Pclose(access_fapl) < 0)
+ /* Close the property list */
+ if(H5Pclose(fapl_id_out) < 0)
TEST_ERROR;
- if(H5Fget_vfd_handle(file, H5P_DEFAULT, &fhandle) < 0)
- TEST_ERROR;
- if(fhandle==NULL)
- {
- printf("fhandle==NULL\n");
- TEST_ERROR;
- }
-
- /* Check file size API */
- if(H5Fget_filesize(file, &file_size) < 0)
+ /* Check that we can get an operating-system-specific handle from
+ * the library.
+ */
+ if(H5Fget_vfd_handle(fid, H5P_DEFAULT, &os_file_handle) < 0)
TEST_ERROR;
+ if(os_file_handle == NULL)
+ FAIL_PUTS_ERROR("NULL os-specific vfd/file handle was returned from H5Fget_vfd_handle");
/* There is no garantee the size of metadata in file is constant.
- * Just try to check if it's reasonable. Why is this 4KB?
+ * Just try to check if it's reasonable.
+ *
+ * TODO: Needs justification of why is this is a reasonable size.
*/
- if(file_size<2*KB || file_size>6*KB)
+ if(H5Fget_filesize(fid, &file_size) < 0)
TEST_ERROR;
+ if(file_size < 2 * KB || file_size > 6 * KB)
+ FAIL_PUTS_ERROR("suspicious file size obtained from H5Fget_filesize");
- if(H5Fclose(file) < 0)
+ /* Close the file */
+ if(H5Fclose(fid) < 0)
TEST_ERROR;
+ /************************************************************************
+ * Make changes to the file with the backing store flag OFF to ensure
+ * that they ARE NOT propagated.
+ ************************************************************************/
+
/* Open the file with backing store off for read and write.
- * Changes won't be saved in file. */
- if(H5Pset_fapl_core(fapl, (size_t)CORE_INCREMENT, FALSE) < 0)
+ * Changes won't be saved in file.
+ */
+ if(H5Pset_fapl_core(fapl_id, (size_t)CORE_INCREMENT, FALSE) < 0)
TEST_ERROR;
-
- if((file=H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0)
+ if((fid = H5Fopen(filename, H5F_ACC_RDWR, fapl_id)) < 0)
TEST_ERROR;
/* Allocate memory for data set. */
- if(NULL == (points = (int *)HDmalloc(DSET1_DIM1 * DSET1_DIM2 * sizeof(int))))
- TEST_ERROR;
- if(NULL == (check = (int *)HDmalloc(DSET1_DIM1 * DSET1_DIM2 * sizeof(int))))
- TEST_ERROR;
+ if(NULL == (data_w = (int *)HDmalloc(DSET1_DIM1 * DSET1_DIM2 * sizeof(int))))
+ FAIL_PUTS_ERROR("unable to allocate memory for input array");
+ if(NULL == (data_r = (int *)HDmalloc(DSET1_DIM1 * DSET1_DIM2 * sizeof(int))))
+ FAIL_PUTS_ERROR("unable to allocate memory for output array");
- /* Initialize the dset1 */
- p1 = points;
- for(i = n = 0; i < DSET1_DIM1; i++)
- for(j = 0; j < DSET1_DIM2; j++)
- *p1++ = n++;
+ /* Initialize the buffers */
+ val = 0;
+ pw = data_w;
+ for(i = 0; i < CORE_DSET_DIM1; i++)
+ for(j = 0; j < CORE_DSET_DIM2; j++)
+ *pw++ = val++;
+ HDmemset(data_r, 0, DSET1_DIM1 * DSET1_DIM2 * sizeof(int));
- /* Create the data space1 */
- dims1[0] = DSET1_DIM1;
- dims1[1] = DSET1_DIM2;
- if((space1 = H5Screate_simple(2, dims1, NULL)) < 0)
+ /* Create the dataspace */
+ dims[0] = CORE_DSET_DIM1;
+ dims[1] = CORE_DSET_DIM2;
+ if((sid = H5Screate_simple(2, dims, NULL)) < 0)
TEST_ERROR;
- /* Create the dset1 */
- if((dset1 = H5Dcreate2(file, DSET1_NAME, H5T_NATIVE_INT, space1, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ /* Create the dataset */
+ if((did = H5Dcreate2(fid, CORE_DSET_NAME, H5T_NATIVE_INT, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
TEST_ERROR;
- /* Write the data to the dset1 */
- if(H5Dwrite(dset1, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, points) < 0)
+ /* Write the data to the dataset */
+ if(H5Dwrite(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, data_w) < 0)
TEST_ERROR;
- if(H5Dclose(dset1) < 0)
+ /* Close and reopen the dataset */
+ if(H5Dclose(did) < 0)
TEST_ERROR;
-
- if((dset1 = H5Dopen2(file, DSET1_NAME, H5P_DEFAULT)) < 0)
+ if((did = H5Dopen2(fid, CORE_DSET_NAME, H5P_DEFAULT)) < 0)
TEST_ERROR;
/* Read the data back from dset1 */
- if(H5Dread(dset1, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, check) < 0)
+ if(H5Dread(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, data_r) < 0)
TEST_ERROR;
/* Check that the values read are the same as the values written */
- p1 = points;
- p2 = check;
- for(i = 0; i < DSET1_DIM1; i++)
- for(j = 0; j < DSET1_DIM2; j++)
- if(*p1++ != *p2++) {
+ pw = data_w;
+ pr = data_r;
+ for(i = 0; i < CORE_DSET_DIM1; i++)
+ for(j = 0; j < CORE_DSET_DIM2; j++)
+ if(*pr++ != *pw++) {
H5_FAILED();
- printf(" Read different values than written in data set 1.\n");
+ printf(" Read different values than written in data set.\n");
printf(" At index %d,%d\n", i, j);
TEST_ERROR;
} /* end if */
- if(H5Dclose(dset1) < 0)
+ /* Close everything except the dataspace ID (needed below)*/
+ if(H5Dclose(did) < 0)
TEST_ERROR;
-
- if(H5Fclose(file) < 0)
+ if(H5Fclose(fid) < 0)
TEST_ERROR;
- /* Open the file with backing store on for read and write.
- * Changes will be saved in file. */
- if(H5Pset_fapl_core(fapl, (size_t)CORE_INCREMENT, TRUE) < 0)
+ /* Reopen the file and ensure that the dataset does not exist */
+ if((fid = H5Fopen(filename, H5F_ACC_RDWR, fapl_id)) < 0)
TEST_ERROR;
-
- if((file = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0)
+ status = H5Lexists(fid, CORE_DSET_NAME, H5P_DEFAULT);
+ if(status < 0)
TEST_ERROR;
+ if(status > 0)
+ FAIL_PUTS_ERROR("core VFD dataset created in file when backing store disabled");
- /* Create the dset1 */
- if((dset1 = H5Dcreate2(file, DSET1_NAME, H5T_NATIVE_INT, space1, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ /* Close the file */
+ if(H5Fclose(fid) < 0)
TEST_ERROR;
- /* Write the data to the dset1 */
- if(H5Dwrite(dset1, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, points) < 0)
+
+ /************************************************************************
+ * Make changes to the file with the backing store flag ON to ensure
+ * that they ARE propagated.
+ ************************************************************************/
+
+ /* Open the file with backing store on for read and write.
+ * Changes will be saved in file.
+ */
+ if(H5Pset_fapl_core(fapl_id, (size_t)CORE_INCREMENT, TRUE) < 0)
+ TEST_ERROR;
+ if((fid = H5Fopen(filename, H5F_ACC_RDWR, fapl_id)) < 0)
TEST_ERROR;
- if(H5Dclose(dset1) < 0)
+ /* Create the dataset */
+ if((did = H5Dcreate2(fid, CORE_DSET_NAME, H5T_NATIVE_INT, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
TEST_ERROR;
- if((dset1 = H5Dopen2(file, DSET1_NAME, H5P_DEFAULT)) < 0)
+ /* Write the data to the dataset */
+ if(H5Dwrite(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, data_w) < 0)
TEST_ERROR;
- /* Reallocate memory for reading buffer. */
- HDassert(check);
- HDfree(check);
- if(NULL == (check = (int *)HDmalloc(DSET1_DIM1 * DSET1_DIM2 * sizeof(int))))
+ /* Close everything and reopen */
+ if(H5Dclose(did) < 0)
+ TEST_ERROR;
+ if(H5Fclose(fid) < 0)
+ TEST_ERROR;
+ if((fid = H5Fopen(filename, H5F_ACC_RDWR, fapl_id)) < 0)
+ TEST_ERROR;
+ if((did = H5Dopen2(fid, CORE_DSET_NAME, H5P_DEFAULT)) < 0)
TEST_ERROR;
- /* Read the data back from dset1 */
- if(H5Dread(dset1, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, check) < 0)
+ /* Read the data back from the dataset */
+ HDmemset(data_r, 0, DSET1_DIM1 * DSET1_DIM2 * sizeof(int));
+ if(H5Dread(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, data_r) < 0)
TEST_ERROR;
/* Check that the values read are the same as the values written */
- p1 = points;
- p2 = check;
- for(i = 0; i < DSET1_DIM1; i++)
- for(j = 0; j < DSET1_DIM2; j++)
- if(*p1++ != *p2++) {
+ pw = data_w;
+ pr = data_r;
+ for(i = 0; i < CORE_DSET_DIM1; i++)
+ for(j = 0; j < CORE_DSET_DIM2; j++)
+ if(*pw++ != *pr++) {
H5_FAILED();
- printf(" Read different values than written in data set 1.\n");
+ printf(" Read different values than written in data set.\n");
printf(" At index %d,%d\n", i, j);
TEST_ERROR;
} /* end if */
- /* Check file size API */
- if(H5Fget_filesize(file, &file_size) < 0)
+ /* Check file size API.
+ * There is no garantee the size of metadata in file is constant.
+ * Just try to check if it's reasonable.
+ *
+ * TODO: Needs justification of why is this is a reasonable size.
+ */
+ if(H5Fget_filesize(fid, &file_size) < 0)
TEST_ERROR;
+ if(file_size < 64 * KB || file_size > 256 * KB)
+ FAIL_PUTS_ERROR("suspicious file size obtained from H5Fget_filesize");
- /* There is no garantee the size of metadata in file is constant.
- * Just try to check if it's reasonable. */
- if(file_size<64*KB || file_size>256*KB)
+ /* Close everything */
+ if(H5Sclose(sid) < 0)
TEST_ERROR;
-
- if(H5Sclose(space1) < 0)
+ if(H5Dclose(did) < 0)
TEST_ERROR;
- if(H5Dclose(dset1) < 0)
- TEST_ERROR;
- if(H5Fclose(file) < 0)
+
+ HDfree(data_w);
+ HDfree(data_r);
+
+ /* Close and delete the file */
+ if(H5Fclose(fid) < 0)
TEST_ERROR;
- HDassert(points);
- HDfree(points);
- HDassert(check);
- HDfree(check);
+ h5_delete_test_file(FILENAME[1], fapl_id);
- h5_cleanup(FILENAME, fapl);
+ /* Close the fapl */
+ if(H5Pclose(fapl_id) < 0)
+ TEST_ERROR;
PASSED();
return 0;
error:
H5E_BEGIN_TRY {
- H5Pclose(fapl);
- H5Fclose(file);
+ H5Sclose(sid);
+ H5Dclose(did);
+ H5Pclose(fapl_id_out);
+ H5Pclose(fapl_id);
+ H5Fclose(fid);
} H5E_END_TRY;
- if(points)
- HDfree(points);
- if(check)
- HDfree(check);
+ if(data_w)
+ HDfree(data_w);
+ if(data_r)
+ HDfree(data_r);
return -1;
-}
+} /* end test_core() */
/*-------------------------------------------------------------------------
@@ -391,7 +504,7 @@ static herr_t
test_direct(void)
{
#ifdef H5_HAVE_DIRECT
- hid_t file=(-1), fapl, access_fapl = -1;
+ hid_t file=-1, fapl=-1, access_fapl = -1;
hid_t dset1=-1, dset2=-1, space1=-1, space2=-1;
char filename[1024];
int *fhandle=NULL;
@@ -400,7 +513,7 @@ test_direct(void)
size_t mbound;
size_t fbsize;
size_t cbsize;
- int *points = NULL, *check = NULL, *p1, *p2;
+ int *points = NULL, *check = NULL, *p1 = NULL, *p2 = NULL;
int wdata2[DSET2_DIM] = {11,12,13,14};
int rdata2[DSET2_DIM];
int i, j, n;
@@ -413,11 +526,10 @@ test_direct(void)
return 0;
#else /*H5_HAVE_DIRECT*/
- h5_reset();
-
/* Set property list and file name for Direct driver. Set memory alignment boundary
* and file block size to 512 which is the minimum for Linux 2.6. */
- fapl = h5_fileaccess();
+ if((fapl = H5Pcreate(H5P_FILE_ACCESS)) < 0)
+ TEST_ERROR;
if(H5Pset_fapl_direct(fapl, MBOUNDARY, FBSIZE, CBSIZE) < 0)
TEST_ERROR;
h5_fixname(FILENAME[5], fapl, filename, sizeof filename);
@@ -559,14 +671,19 @@ test_direct(void)
TEST_ERROR;
if(H5Dclose(dset2) < 0)
TEST_ERROR;
- if(H5Fclose(file) < 0)
- TEST_ERROR;
- HDassert(points);
+
HDfree(points);
- HDassert(check);
HDfree(check);
- h5_cleanup(FILENAME, fapl);
+ /* Close and delete the file */
+ if(H5Fclose(file) < 0)
+ TEST_ERROR;
+ h5_delete_test_file(FILENAME[5], fapl);
+
+ /* Close the fapl */
+ if(H5Pclose(fapl) < 0)
+ TEST_ERROR;
+
PASSED();
return 0;
@@ -607,7 +724,7 @@ error:
static herr_t
test_family_opens(char *fname, hid_t fa_pl)
{
- hid_t file;
+ hid_t file=-1;
char first_name[1024];
char wrong_name[1024];
int i;
@@ -678,7 +795,7 @@ error:
static herr_t
test_family(void)
{
- hid_t file=(-1), fapl, fapl2=(-1), space=(-1), dset=(-1);
+ hid_t file=-1, fapl=-1, fapl2=-1, space=-1, dset=-1;
hid_t access_fapl = -1;
char filename[1024];
char dname[]="dataset";
@@ -690,14 +807,12 @@ test_family(void)
TESTING("FAMILY file driver");
- h5_reset();
-
/* Set property list and file name for FAMILY driver */
- fapl = h5_fileaccess();
-
+ if((fapl = H5Pcreate(H5P_FILE_ACCESS)) < 0)
+ TEST_ERROR;
if(H5Pset_fapl_family(fapl, (hsize_t)FAMILY_SIZE, H5P_DEFAULT) < 0)
TEST_ERROR;
- h5_fixname(FILENAME[2], fapl, filename, sizeof filename);
+ h5_fixname(FILENAME[2], fapl, filename, sizeof(filename));
if((file=H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
TEST_ERROR;
@@ -804,10 +919,15 @@ test_family(void)
if((file = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0)
TEST_ERROR;
+ /* Close and delete the file */
if(H5Fclose(file) < 0)
TEST_ERROR;
+ h5_delete_test_file(FILENAME[2], fapl);
+
+ /* Close the fapl */
+ if(H5Pclose(fapl) < 0)
+ TEST_ERROR;
- h5_cleanup(FILENAME, fapl);
PASSED();
return 0;
@@ -815,7 +935,8 @@ error:
H5E_BEGIN_TRY {
H5Sclose(space);
H5Dclose(dset);
- H5Pclose (fapl2);
+ H5Pclose(fapl);
+ H5Pclose(fapl2);
H5Fclose(file);
} H5E_END_TRY;
return -1;
@@ -843,8 +964,8 @@ error:
static herr_t
test_family_compat(void)
{
- hid_t file = (-1), fapl;
- hid_t dset;
+ hid_t file = -1, fapl = -1;
+ hid_t dset = -1;
char dname[]="dataset";
char filename[1024];
char pathname[1024], pathname_individual[1024];
@@ -853,16 +974,14 @@ test_family_compat(void)
TESTING("FAMILY file driver backward compatibility");
- h5_reset();
-
/* Set property list and file name for FAMILY driver */
- fapl = h5_fileaccess();
-
+ if((fapl = H5Pcreate(H5P_FILE_ACCESS)) < 0)
+ TEST_ERROR;
if(H5Pset_fapl_family(fapl, (hsize_t)FAMILY_SIZE2, H5P_DEFAULT) < 0)
TEST_ERROR;
- h5_fixname(COMPAT_BASENAME, fapl, filename, sizeof filename);
- h5_fixname(FILENAME[3], fapl, newname, sizeof newname);
+ h5_fixname(COMPAT_BASENAME, fapl, filename, sizeof(filename));
+ h5_fixname(FILENAME[3], fapl, newname, sizeof(newname));
pathname[0] = '\0';
HDstrcat(pathname, filename);
@@ -904,10 +1023,14 @@ test_family_compat(void)
if(H5Dclose(dset) < 0)
TEST_ERROR;
+ /* Close and delete the file */
if(H5Fclose(file) < 0)
TEST_ERROR;
+ h5_delete_test_file(FILENAME[3], fapl);
- h5_cleanup(FILENAME, fapl);
+ /* Close the fapl */
+ if(H5Pclose(fapl) < 0)
+ TEST_ERROR;
PASSED();
@@ -940,7 +1063,7 @@ error:
static herr_t
test_multi_opens(char *fname)
{
- hid_t file;
+ hid_t file=-1;
char super_name[1024]; /*name string "%%s-s.h5"*/
char sf_name[1024]; /*name string "multi_file-s.h5"*/
@@ -972,8 +1095,8 @@ test_multi_opens(char *fname)
static herr_t
test_multi(void)
{
- hid_t file=(-1), fapl, fapl2=(-1), dset=(-1), space=(-1);
- hid_t root, attr, aspace, atype;
+ hid_t file=-1, fapl=-1, fapl2=-1, dset=-1, space=-1;
+ hid_t root=-1, attr=-1, aspace=-1, atype=-1;
hid_t access_fapl = -1;
char filename[1024];
int *fhandle2=NULL, *fhandle=NULL;
@@ -992,16 +1115,15 @@ test_multi(void)
TESTING("MULTI file driver");
- h5_reset();
-
/* Set file access property list for MULTI driver */
- fapl = h5_fileaccess();
+ if((fapl = H5Pcreate(H5P_FILE_ACCESS)) < 0)
+ TEST_ERROR;
- HDmemset(memb_map, 0, sizeof memb_map);
- HDmemset(memb_fapl, 0, sizeof memb_fapl);
- HDmemset(memb_name, 0, sizeof memb_name);
- HDmemset(memb_addr, 0, sizeof memb_addr);
- HDmemset(sv, 0, sizeof sv);
+ HDmemset(memb_map, 0, sizeof(memb_map));
+ HDmemset(memb_fapl, 0, sizeof(memb_fapl));
+ HDmemset(memb_name, 0, sizeof(memb_name));
+ HDmemset(memb_addr, 0, sizeof(memb_addr));
+ HDmemset(sv, 0, sizeof(sv));
for(mt=H5FD_MEM_DEFAULT; mt<H5FD_MEM_NTYPES; H5_INC_ENUM(H5FD_mem_t,mt)) {
memb_fapl[mt] = H5P_DEFAULT;
@@ -1118,7 +1240,7 @@ test_multi(void)
/* Create and write attribute for the root group. */
if((root = H5Gopen2(file, "/", H5P_DEFAULT)) < 0)
- FAIL_STACK_ERROR
+ TEST_ERROR
/* Attribute string. */
if((atype = H5Tcopy(H5T_C_S1)) < 0)
@@ -1148,10 +1270,15 @@ test_multi(void)
if(H5Aclose(attr) < 0)
TEST_ERROR;
+ /* Close and delete the file */
if(H5Fclose(file) < 0)
TEST_ERROR;
+ h5_delete_test_file(FILENAME[4], fapl);
+
+ /* Close the fapl */
+ if(H5Pclose(fapl) < 0)
+ TEST_ERROR;
- h5_cleanup(FILENAME, fapl);
PASSED();
return 0;
@@ -1191,7 +1318,7 @@ error:
static herr_t
test_multi_compat(void)
{
- hid_t file=(-1), fapl, dset=(-1), space=(-1);
+ hid_t file=-1, fapl=-1, dset=-1, space=-1;
char newname[1024];
char filename_s[1024], newname_s[1024];
char filename_r[1024], newname_r[1024];
@@ -1206,10 +1333,9 @@ test_multi_compat(void)
TESTING("MULTI file driver backward compatibility");
- h5_reset();
-
/* Set file access property list for MULTI driver */
- fapl = h5_fileaccess();
+ if((fapl = H5Pcreate(H5P_FILE_ACCESS)) < 0)
+ TEST_ERROR;
HDmemset(memb_map, 0, sizeof memb_map);
HDmemset(memb_fapl, 0, sizeof memb_fapl);
@@ -1317,10 +1443,15 @@ test_multi_compat(void)
if(H5Dclose(dset) < 0)
TEST_ERROR;
+ /* Close and delete the file */
if(H5Fclose(file) < 0)
TEST_ERROR;
+ h5_delete_test_file(FILENAME[9], fapl);
+
+ /* Close the fapl */
+ if(H5Pclose(fapl) < 0)
+ TEST_ERROR;
- h5_cleanup(FILENAME, fapl);
PASSED();
return 0;
@@ -1363,10 +1494,9 @@ test_log(void)
TESTING("LOG file driver");
- h5_reset();
-
/* Set property list and file name for log driver. */
- fapl = h5_fileaccess();
+ if((fapl = H5Pcreate(H5P_FILE_ACCESS)) < 0)
+ TEST_ERROR;
if(H5Pset_fapl_log(fapl, LOG_FILENAME, flags, buf_size) < 0)
TEST_ERROR;
h5_fixname(FILENAME[6], fapl, filename, sizeof filename);
@@ -1403,10 +1533,15 @@ test_log(void)
if(file_size < 1 * KB || file_size > 4 * KB)
TEST_ERROR;
+ /* Close and delete the file */
if(H5Fclose(file) < 0)
TEST_ERROR;
+ h5_delete_test_file(FILENAME[6], fapl);
+
+ /* Close the fapl */
+ if(H5Pclose(fapl) < 0)
+ TEST_ERROR;
- h5_cleanup(FILENAME, fapl);
PASSED();
return 0;
@@ -1444,10 +1579,9 @@ test_stdio(void)
TESTING("STDIO file driver");
- h5_reset();
-
/* Set property list and file name for STDIO driver. */
- fapl = h5_fileaccess();
+ if((fapl = H5Pcreate(H5P_FILE_ACCESS)) < 0)
+ TEST_ERROR;
if(H5Pset_fapl_stdio(fapl) < 0)
TEST_ERROR;
h5_fixname(FILENAME[7], fapl, filename, sizeof filename);
@@ -1483,10 +1617,15 @@ test_stdio(void)
if(file_size < 1 * KB || file_size > 4 * KB)
TEST_ERROR;
+ /* Close and delete the file */
if(H5Fclose(file) < 0)
TEST_ERROR;
+ h5_delete_test_file(FILENAME[7], fapl);
+
+ /* Close the fapl */
+ if(H5Pclose(fapl) < 0)
+ TEST_ERROR;
- h5_cleanup(FILENAME, fapl);
PASSED();
return 0;
@@ -1536,10 +1675,9 @@ test_windows(void)
#else /* H5_HAVE_WINDOWS */
- h5_reset();
-
/* Set property list and file name for WINDOWS driver. */
- fapl = h5_fileaccess();
+ if((fapl = H5Pcreate(H5P_FILE_ACCESS)) < 0)
+ TEST_ERROR;
if(H5Pset_fapl_windows(fapl) < 0)
TEST_ERROR;
h5_fixname(FILENAME[8], fapl, filename, sizeof filename);
@@ -1575,10 +1713,15 @@ test_windows(void)
if(file_size < 1 * KB || file_size > 4 * KB)
TEST_ERROR;
+ /* Close and delete the file */
if(H5Fclose(file) < 0)
TEST_ERROR;
+ h5_delete_test_file(FILENAME[8], fapl);
+
+ /* Close the fapl */
+ if(H5Pclose(fapl) < 0)
+ TEST_ERROR;
- h5_cleanup(FILENAME, fapl);
PASSED();
return 0;
@@ -1590,7 +1733,7 @@ error:
return -1;
#endif /* H5_HAVE_WINDOWS */
-}
+} /* end test_windows() */
@@ -1612,7 +1755,9 @@ main(void)
{
int nerrors = 0;
- printf("Testing basic Virtual File Driver functionality.\n");
+ h5_reset();
+
+ HDprintf("Testing basic Virtual File Driver functionality.\n");
nerrors += test_sec2() < 0 ? 1 : 0;
nerrors += test_core() < 0 ? 1 : 0;
@@ -1626,12 +1771,13 @@ main(void)
nerrors += test_windows() < 0 ? 1 : 0;
if(nerrors) {
- printf("***** %d Virtual File Driver TEST%s FAILED! *****\n",
+ HDprintf("***** %d Virtual File Driver TEST%s FAILED! *****\n",
nerrors, nerrors > 1 ? "S" : "");
return 1;
- }
+ } /* end if */
+
+ HDprintf("All Virtual File Driver tests passed.\n");
- printf("All Virtual File Driver tests passed.\n");
return 0;
-}
+} /* end main() */
diff --git a/testpar/t_mdset.c b/testpar/t_mdset.c
index c88cb86..7077081 100644
--- a/testpar/t_mdset.c
+++ b/testpar/t_mdset.c
@@ -2610,6 +2610,92 @@ void rr_obj_hdr_flush_confusion_reader(MPI_Comm comm)
#undef Writer_Root
#undef Reader_Root
+
+/*
+ * Test creating a chunked dataset in parallel in a file with an alignment set
+ * and an alignment threshold large enough to avoid aligning the chunks but
+ * small enough that the raw data aggregator will be aligned if it is treated as
+ * an object that must be aligned by the library
+ */
+#define CHUNK_SIZE 72
+#define NCHUNKS 32
+#define AGGR_SIZE 2048
+#define EXTRA_ALIGN 100
+
+ void chunk_align_bug_1(void)
+ {
+ int mpi_rank;
+ hid_t file_id, dset_id, fapl_id, dcpl_id, space_id;
+ hsize_t dims = CHUNK_SIZE * NCHUNKS, cdims = CHUNK_SIZE;
+ h5_stat_size_t file_size;
+ hsize_t align;
+ herr_t ret;
+ const char *filename;
+
+ MPI_Comm_rank(MPI_COMM_WORLD, &mpi_rank);
+
+ filename = (const char *)GetTestParameters();
+
+ /* Create file without alignment */
+ fapl_id = create_faccess_plist(MPI_COMM_WORLD, MPI_INFO_NULL, facc_type);
+ VRFY((fapl_id >= 0), "create_faccess_plist succeeded");
+ file_id = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl_id);
+ VRFY((file_id >= 0), "H5Fcreate succeeded");
+
+ /* Close file */
+ ret = H5Fclose(file_id);
+ VRFY((ret >= 0), "H5Fclose succeeded");
+
+ /* Get file size */
+ file_size = h5_get_file_size(filename, fapl_id);
+ VRFY((file_size >= 0), "h5_get_file_size succeeded");
+
+ /* Calculate alignment value, set to allow a chunk to squeak in between the
+ * original EOF and the aligned location of the aggregator. Add some space
+ * for the dataset metadata */
+ align = (hsize_t)file_size + CHUNK_SIZE + EXTRA_ALIGN;
+
+ /* Set aggregator size and alignment, disable metadata aggregator */
+ HDassert(AGGR_SIZE > CHUNK_SIZE);
+ ret = H5Pset_small_data_block_size(fapl_id, AGGR_SIZE);
+ VRFY((ret >= 0), "H5Pset_small_data_block_size succeeded");
+ ret = H5Pset_meta_block_size(fapl_id, 0);
+ VRFY((ret >= 0), "H5Pset_meta_block_size succeeded");
+ ret = H5Pset_alignment(fapl_id, CHUNK_SIZE + 1, align);
+ VRFY((ret >= 0), "H5Pset_small_data_block_size succeeded");
+
+ /* Reopen file with new settings */
+ file_id = H5Fopen(filename, H5F_ACC_RDWR, fapl_id);
+ VRFY((file_id >= 0), "H5Fopen succeeded");
+
+ /* Create dataset */
+ space_id = H5Screate_simple(1, &dims, NULL);
+ VRFY((space_id >= 0), "H5Screate_simple succeeded");
+ dcpl_id = H5Pcreate(H5P_DATASET_CREATE);
+ VRFY((dcpl_id >= 0), "H5Pcreate succeeded");
+ ret = H5Pset_chunk(dcpl_id, 1, &cdims);
+ VRFY((ret >= 0), "H5Pset_chunk succeeded");
+ dset_id = H5Dcreate2(file_id, "dset", H5T_NATIVE_CHAR, space_id, H5P_DEFAULT, dcpl_id, H5P_DEFAULT);
+ VRFY((dset_id >= 0), "H5Dcreate2 succeeded");
+
+ /* Close ids */
+ ret = H5Dclose(dset_id);
+ VRFY((dset_id >= 0), "H5Dclose succeeded");
+ ret = H5Sclose(space_id);
+ VRFY((space_id >= 0), "H5Sclose succeeded");
+ ret = H5Pclose(dcpl_id);
+ VRFY((dcpl_id >= 0), "H5Pclose succeeded");
+ ret = H5Pclose(fapl_id);
+ VRFY((fapl_id >= 0), "H5Pclose succeeded");
+
+ /* Close file */
+ ret = H5Fclose(file_id);
+ VRFY((ret >= 0), "H5Fclose succeeded");
+
+ return;
+} /* end chunk_align_bug_1() */
+
+
/*=============================================================================
* End of t_mdset.c
*===========================================================================*/
diff --git a/testpar/t_shapesame.c b/testpar/t_shapesame.c
index e66eaa7..3675824 100644
--- a/testpar/t_shapesame.c
+++ b/testpar/t_shapesame.c
@@ -5078,24 +5078,24 @@ int main(int argc, char **argv)
/* Shape Same tests using contigous hyperslab */
#if 1
AddTest("sscontig1", sscontig1, NULL,
- "Shape Same, contigous hyperslab, ind IO, contig datasets", PARATESTFILE);
+ "Cntg hslab, ind IO, cntg dsets", PARATESTFILE);
AddTest("sscontig2", sscontig2, NULL,
- "Shape Same, contigous hyperslab, col IO, contig datasets", PARATESTFILE);
+ "Cntg hslab, col IO, cntg dsets", PARATESTFILE);
AddTest("sscontig3", sscontig3, NULL,
- "Shape Same, contigous hyperslab, ind IO, chunked datasets", PARATESTFILE);
+ "Cntg hslab, ind IO, chnk dsets", PARATESTFILE);
AddTest("sscontig4", sscontig4, NULL,
- "Shape Same, contigous hyperslab, col IO, chunked datasets", PARATESTFILE);
+ "Cntg hslab, col IO, chnk dsets", PARATESTFILE);
#endif
/* Shape Same tests using checker board hyperslab */
AddTest("sschecker1", sschecker1, NULL,
- "Shape Same, checker hyperslab, ind IO, contig datasets", PARATESTFILE);
+ "Check hslab, ind IO, cntg dsets", PARATESTFILE);
AddTest("sschecker2", sschecker2, NULL,
- "Shape Same, checker hyperslab, col IO, contig datasets", PARATESTFILE);
+ "Check hslab, col IO, cntg dsets", PARATESTFILE);
AddTest("sschecker3", sschecker3, NULL,
- "Shape Same, checker hyperslab, ind IO, chunked datasets", PARATESTFILE);
+ "Check hslab, ind IO, chnk dsets", PARATESTFILE);
AddTest("sschecker4", sschecker4, NULL,
- "Shape Same, checker hyperslab, col IO, chunked datasets", PARATESTFILE);
+ "Check hslab, col IO, chnk dsets", PARATESTFILE);
/* Display testing information */
TestInfo(argv[0]);
@@ -5147,6 +5147,12 @@ int main(int argc, char **argv)
printf("===================================\n");
}
+ /* close HDF5 library */
+ H5close();
+
+ /* Release test infrastructure */
+ TestShutdown();
+
MPI_Finalize();
/* cannot just return (nerrors) because exit code is limited to 1byte */
diff --git a/testpar/testphdf5.c b/testpar/testphdf5.c
index aaf18de..c54cb5e 100644
--- a/testpar/testphdf5.c
+++ b/testpar/testphdf5.c
@@ -496,6 +496,11 @@ int main(int argc, char **argv)
&rr_obj_flush_confusion_params);
}
+ AddTest("alnbg1",
+ chunk_align_bug_1, NULL,
+ "Chunk allocation with alignment bug.",
+ PARATESTFILE);
+
AddTest("tldsc",
lower_dim_size_comp_test, NULL,
"test lower dim size comp in span tree to mpi derived type",
@@ -589,9 +594,13 @@ int main(int argc, char **argv)
printf("PHDF5 tests finished with no errors\n");
printf("===================================\n");
}
+
/* close HDF5 library */
H5close();
+ /* Release test infrastructure */
+ TestShutdown();
+
/* MPI_Finalize must be called AFTER H5close which may use MPI calls */
MPI_Finalize();
diff --git a/testpar/testphdf5.h b/testpar/testphdf5.h
index 7d6ff22..9838673 100644
--- a/testpar/testphdf5.h
+++ b/testpar/testphdf5.h
@@ -285,6 +285,7 @@ void io_mode_confusion(void);
void rr_obj_hdr_flush_confusion(void);
void rr_obj_hdr_flush_confusion_reader(MPI_Comm comm);
void rr_obj_hdr_flush_confusion_writer(MPI_Comm comm);
+void chunk_align_bug_1(void);
void lower_dim_size_comp_test(void);
void link_chunk_collective_io_test(void);
void contig_hyperslab_dr_pio_test(ShapeSameTestMethods sstest_type);
diff --git a/tools/h5copy/CMakeLists.txt b/tools/h5copy/CMakeLists.txt
index 4c44ac2..219106f 100644
--- a/tools/h5copy/CMakeLists.txt
+++ b/tools/h5copy/CMakeLists.txt
@@ -42,7 +42,7 @@ endif (BUILD_TESTING)
#-----------------------------------------------------------------------------
#INSTALL_PROGRAM_PDB (h5copy ${HDF5_INSTALL_BIN_DIR} toolsapplications)
-
+
install (
TARGETS
h5copy
diff --git a/tools/h5copy/CMakeTests.cmake b/tools/h5copy/CMakeTests.cmake
index 275461f..96dc92b 100644
--- a/tools/h5copy/CMakeTests.cmake
+++ b/tools/h5copy/CMakeTests.cmake
@@ -23,15 +23,9 @@
foreach (listfiles ${LIST_HDF5_TEST_FILES} ${LIST_OTHER_TEST_FILES})
get_filename_component(fname "${listfiles}" NAME)
- set (dest "${PROJECT_BINARY_DIR}/testfiles/${fname}")
- #message (STATUS " Copying ${listfiles}")
- add_custom_command (
- TARGET h5copy
- POST_BUILD
- COMMAND ${CMAKE_COMMAND}
- ARGS -E copy_if_different ${listfiles} ${dest}
- )
+ HDFTEST_COPY_FILE("${listfiles}" "${PROJECT_BINARY_DIR}/testfiles/${fname}" "h5copy_files")
endforeach (listfiles ${LIST_HDF5_TEST_FILES} ${LIST_OTHER_TEST_FILES})
+ add_custom_target(h5copy_files ALL COMMENT "Copying files needed by h5copy tests" DEPENDS ${h5copy_files_list})
##############################################################################
##############################################################################
diff --git a/tools/h5copy/h5copy.c b/tools/h5copy/h5copy.c
index f3a0d7a..5371a21 100644
--- a/tools/h5copy/h5copy.c
+++ b/tools/h5copy/h5copy.c
@@ -417,19 +417,19 @@ main (int argc, const char *argv[])
/* create property to pass copy options */
if ( (ocpl_id = H5Pcreate(H5P_OBJECT_COPY)) < 0)
- HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pcreate failed");
+ HGOTO_ERROR(EXIT_FAILURE, H5E_tools_min_id_g, "H5Pcreate failed");
/* set options for object copy */
if (flag)
{
if ( H5Pset_copy_object(ocpl_id, flag) < 0)
- HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pset_copy_object failed");
+ HGOTO_ERROR(EXIT_FAILURE, H5E_tools_min_id_g, "H5Pset_copy_object failed");
}
/* Create link creation property list */
if((lcpl_id = H5Pcreate(H5P_LINK_CREATE)) < 0) {
error_msg("Could not create link creation property list\n");
- HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pcreate failed");
+ HGOTO_ERROR(EXIT_FAILURE, H5E_tools_min_id_g, "H5Pcreate failed");
} /* end if */
/* Check for creating intermediate groups */
@@ -437,7 +437,7 @@ main (int argc, const char *argv[])
/* Set the intermediate group creation property */
if(H5Pset_create_intermediate_group(lcpl_id, 1) < 0) {
error_msg("Could not set property for creating parent groups\n");
- HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pset_create_intermediate_group failed");
+ HGOTO_ERROR(EXIT_FAILURE, H5E_tools_min_id_g, "H5Pset_create_intermediate_group failed");
} /* end if */
/* Display some output if requested */
@@ -464,7 +464,7 @@ main (int argc, const char *argv[])
{
error_msg("group <%s> doesn't exist. Use -p to create parent groups.\n", str_ptr);
HDfree(str_ptr);
- HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Lexists failed");
+ HGOTO_ERROR(EXIT_FAILURE, H5E_tools_min_id_g, "H5Lexists failed");
}
HDfree(str_ptr);
}
@@ -484,7 +484,7 @@ main (int argc, const char *argv[])
if(H5Lcopy(fid_src, oname_src,
fid_dst, oname_dst,
H5P_DEFAULT, H5P_DEFAULT) < 0)
- HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Lcopy failed");
+ HGOTO_ERROR(EXIT_FAILURE, H5E_tools_min_id_g, "H5Lcopy failed");
}
else /* valid link */
{
@@ -494,7 +494,7 @@ main (int argc, const char *argv[])
oname_dst, /* Name of the destination object */
ocpl_id, /* Object copy property list */
lcpl_id)<0) /* Link creation property list */
- HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Ocopy failed");
+ HGOTO_ERROR(EXIT_FAILURE, H5E_tools_min_id_g, "H5Ocopy failed");
}
/* free link info path */
@@ -503,15 +503,15 @@ main (int argc, const char *argv[])
/* close propertis */
if(H5Pclose(ocpl_id)<0)
- HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pclose failed");
+ HGOTO_ERROR(EXIT_FAILURE, H5E_tools_min_id_g, "H5Pclose failed");
if(H5Pclose(lcpl_id)<0)
- HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pclose failed");
+ HGOTO_ERROR(EXIT_FAILURE, H5E_tools_min_id_g, "H5Pclose failed");
/* close files */
if (H5Fclose(fid_src)<0)
- HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Fclose failed");
+ HGOTO_ERROR(EXIT_FAILURE, H5E_tools_min_id_g, "H5Fclose failed");
if (H5Fclose(fid_dst)<0)
- HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Fclose failed");
+ HGOTO_ERROR(EXIT_FAILURE, H5E_tools_min_id_g, "H5Fclose failed");
leave(EXIT_SUCCESS);
@@ -529,6 +529,6 @@ done:
H5Fclose(fid_dst);
} H5E_END_TRY;
- leave(EXIT_FAILURE);
+ leave(ret_value);
}
diff --git a/tools/h5copy/h5copygentest.c b/tools/h5copy/h5copygentest.c
index 93203c6..7669702 100644
--- a/tools/h5copy/h5copygentest.c
+++ b/tools/h5copy/h5copygentest.c
@@ -35,9 +35,12 @@
#define DATASET_COMPRESSED "compressed"
#define DATASET_NAMED_VL "named_vl"
#define DATASET_NESTED_VL "nested_vl"
+#define DATASET_ATTR "dset_attr"
+#define ATTR "attr"
#define GROUP_EMPTY "grp_empty"
#define GROUP_DATASETS "grp_dsets"
#define GROUP_NESTED "grp_nested"
+#define GROUP_ATTR "grp_attr"
/* Obj reference */
#define OBJ_REF_DS "Dset1"
@@ -323,6 +326,86 @@ static void gent_nested_vl(hid_t loc_id)
/*-------------------------------------------------------------------------
+ * Function: gent_att_compound_vlstr
+ *
+ * Purpose: Generate a dataset and a group.
+ * Both has an attribute with a compound datatype consisting
+ * of a variable length string
+ *
+ *-------------------------------------------------------------------------
+ */
+static void gent_att_compound_vlstr(hid_t loc_id)
+{
+ typedef struct { /* Compound structure for the attribute */
+ int i;
+ char *v;
+ } s1;
+ hsize_t dim[1] = {1}; /* Dimension size */
+ hid_t sid = -1; /* Dataspace ID */
+ hid_t tid = -1; /* Datatype ID */
+ hid_t aid = -1; /* Attribute ID */
+ hid_t did = -1; /* Dataset ID */
+ hid_t gid = -1; /* Group ID */
+ hid_t vl_str_tid = -1; /* Variable length datatype ID */
+ hid_t cmpd_tid = -1; /* Compound datatype ID */
+ hid_t null_sid = -1; /* Null dataspace ID */
+ s1 buf; /* Buffer */
+
+ buf.i = 9;
+ buf.v = "ThisIsAString";
+
+ /* Create an integer datatype */
+ tid = H5Tcopy(H5T_NATIVE_INT);
+
+ /* Create a variable length string */
+ vl_str_tid = H5Tcopy(H5T_C_S1);
+ H5Tset_size(vl_str_tid, H5T_VARIABLE);
+
+ /* Create a compound datatype with a variable length string and an integer */
+ cmpd_tid = H5Tcreate(H5T_COMPOUND, sizeof(s1));
+ H5Tinsert(cmpd_tid, "i", HOFFSET(s1, i), tid);
+ H5Tinsert(cmpd_tid, "v", HOFFSET(s1, v), vl_str_tid);
+
+ /* Create a dataset */
+ null_sid = H5Screate(H5S_NULL);
+ did = H5Dcreate2(loc_id, DATASET_ATTR, H5T_NATIVE_INT, null_sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+
+ /* Attach an attribute with the compound datatype to the dataset */
+ sid = H5Screate_simple(1, dim, dim);
+ aid = H5Acreate2(did, ATTR, cmpd_tid, sid, H5P_DEFAULT, H5P_DEFAULT);
+
+ /* Write the attribute */
+ buf.i = 9;
+ buf.v = "ThisIsAString";
+ H5Awrite(aid, cmpd_tid, &buf);
+
+ /* Close the dataset and its attribute */
+ H5Dclose(did);
+ H5Aclose(aid);
+
+ /* Create a group */
+ gid = H5Gcreate2(loc_id, GROUP_ATTR, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+
+ /* Attach an attribute with the compound datatype to the group */
+ aid = H5Acreate2(gid, ATTR, cmpd_tid, sid, H5P_DEFAULT, H5P_DEFAULT);
+ H5Awrite(aid, cmpd_tid, &buf);
+
+ /* Close the group and its attribute */
+ H5Aclose(aid);
+ H5Gclose(gid);
+
+ /* Close dataspaces */
+ H5Sclose(sid);
+ H5Sclose(null_sid);
+
+ /* Close datatypes */
+ H5Tclose(tid);
+ H5Tclose(vl_str_tid);
+ H5Tclose(cmpd_tid);
+
+} /* gen_att_compound_vlstr() */
+
+/*-------------------------------------------------------------------------
* Function: gent_datasets
*
* Purpose: Generate all datasets in a particular location
@@ -676,6 +759,7 @@ static void Test_Obj_Copy(void)
gent_empty_group(fid);
gent_nested_datasets(fid);
gent_nested_group(fid);
+ gent_att_compound_vlstr(fid);
H5Fclose(fid);
fid = (-1);
diff --git a/tools/h5copy/testfiles/h5copytst.h5 b/tools/h5copy/testfiles/h5copytst.h5
index f407f82..1d1cbf1 100644
--- a/tools/h5copy/testfiles/h5copytst.h5
+++ b/tools/h5copy/testfiles/h5copytst.h5
Binary files differ
diff --git a/tools/h5copy/testfiles/h5copytst_new.h5 b/tools/h5copy/testfiles/h5copytst_new.h5
index 222c511..fd820ca 100644
--- a/tools/h5copy/testfiles/h5copytst_new.h5
+++ b/tools/h5copy/testfiles/h5copytst_new.h5
Binary files differ
diff --git a/tools/h5copy/testh5copy.sh.in b/tools/h5copy/testh5copy.sh.in
index 77c64c4..859d7c8 100644
--- a/tools/h5copy/testh5copy.sh.in
+++ b/tools/h5copy/testh5copy.sh.in
@@ -128,7 +128,7 @@ CLEAN_TESTFILES_AND_TESTDIR()
# skip rm if srcdir is same as destdir
# this occurs when build/test performed in source dir and
# make cp fail
- SDIR=`$DIRNAME $tstfile`
+ SDIR=$SRC_H5COPY_TESTFILES
INODE_SDIR=`$LS -i -d $SDIR | $AWK -F' ' '{print $1}'`
INODE_DDIR=`$LS -i -d $TESTDIR | $AWK -F' ' '{print $1}'`
if [ "$INODE_SDIR" != "$INODE_DDIR" ]; then
@@ -490,6 +490,7 @@ COPY_OBJECTS()
TOOLTEST -i $TESTFILE -o $TESTDIR/compressed.out.h5 -v -s compressed -d compressed
TOOLTEST -i $TESTFILE -o $TESTDIR/named_vl.out.h5 -v -s named_vl -d named_vl
TOOLTEST -i $TESTFILE -o $TESTDIR/nested_vl.out.h5 -v -s nested_vl -d nested_vl
+ TOOLTEST -i $TESTFILE -o $TESTDIR/dset_attr.out.h5 -v -s /dset_attr -d /dset_attr
echo "Test copying dataset within group in source file to root of destination"
TOOLTEST -i $TESTFILE -o $TESTDIR/simple_top.out.h5 -v -s grp_dsets/simple -d simple_top
@@ -501,6 +502,7 @@ COPY_OBJECTS()
TOOLTEST -i $TESTFILE -o $TESTDIR/grp_empty.out.h5 -v -s grp_empty -d grp_empty
TOOLTEST -i $TESTFILE -o $TESTDIR/grp_dsets.out.h5 -v -s grp_dsets -d grp_dsets
TOOLTEST -i $TESTFILE -o $TESTDIR/grp_nested.out.h5 -v -s grp_nested -d grp_nested
+ TOOLTEST -i $TESTFILE -o $TESTDIR/grp_attr.out.h5 -v -s grp_attr -d grp_attr
echo "Test copying dataset within group in source file to group in destination"
TOOLTEST_PREFILL -i $TESTFILE -o $TESTDIR/simple_group.out.h5 grp_dsets grp_dsets /grp_dsets/simple /grp_dsets/simple_group
diff --git a/tools/h5diff/CMakeTests.cmake b/tools/h5diff/CMakeTests.cmake
index 7698cc1..a649b78 100644
--- a/tools/h5diff/CMakeTests.cmake
+++ b/tools/h5diff/CMakeTests.cmake
@@ -79,10 +79,6 @@
set (LIST_OTHER_TEST_FILES
${HDF5_TOOLS_H5DIFF_SOURCE_DIR}/testfiles/h5diff_10.txt
${HDF5_TOOLS_H5DIFF_SOURCE_DIR}/testfiles/h5diff_100.txt
- ${HDF5_TOOLS_H5DIFF_SOURCE_DIR}/testfiles/h5diff_101.txt
- ${HDF5_TOOLS_H5DIFF_SOURCE_DIR}/testfiles/h5diff_102.txt
- ${HDF5_TOOLS_H5DIFF_SOURCE_DIR}/testfiles/h5diff_103.txt
- ${HDF5_TOOLS_H5DIFF_SOURCE_DIR}/testfiles/h5diff_104.txt
${HDF5_TOOLS_H5DIFF_SOURCE_DIR}/testfiles/h5diff_11.txt
${HDF5_TOOLS_H5DIFF_SOURCE_DIR}/testfiles/h5diff_12.txt
${HDF5_TOOLS_H5DIFF_SOURCE_DIR}/testfiles/h5diff_13.txt
@@ -260,6 +256,13 @@
${HDF5_TOOLS_H5DIFF_SOURCE_DIR}/testfiles/h5diff_v3.txt
)
+ set (LIST_WIN_TEST_FILES
+ h5diff_101
+ h5diff_102
+ h5diff_103
+ h5diff_104
+ )
+
# Make testfiles dir under build dir
file (MAKE_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles")
@@ -268,48 +271,25 @@
#
foreach (h5_tstfiles ${LIST_HDF5_TEST_FILES} ${LIST_OTHER_TEST_FILES})
get_filename_component(fname "${h5_tstfiles}" NAME)
- set (dest "${PROJECT_BINARY_DIR}/testfiles/${fname}")
- #message (STATUS " Copying ${fname}")
- add_custom_command (
- TARGET h5diff
- POST_BUILD
- COMMAND ${CMAKE_COMMAND}
- ARGS -E copy_if_different ${h5_tstfiles} ${dest}
- )
- endforeach (h5_tstfiles ${LIST_HDF5_TEST_FILES} ${LIST_OTHER_TEST_FILES})
+ HDFTEST_COPY_FILE("${h5_tstfiles}" "${PROJECT_BINARY_DIR}/testfiles/${fname}" "h5diff_files")
+ endforeach ()
#
# Overwrite system dependent files (Windows) and not VS2015
#
if (WIN32 AND MSVC_VERSION LESS 1900)
- add_custom_command (
- TARGET h5diff
- POST_BUILD
- COMMAND ${CMAKE_COMMAND}
- ARGS -E copy_if_different ${HDF5_TOOLS_H5DIFF_SOURCE_DIR}/testfiles/h5diff_101w.txt ${PROJECT_BINARY_DIR}/testfiles/h5diff_101.txt
- )
-
- add_custom_command (
- TARGET h5diff
- POST_BUILD
- COMMAND ${CMAKE_COMMAND}
- ARGS -E copy_if_different ${HDF5_TOOLS_H5DIFF_SOURCE_DIR}/testfiles/h5diff_102w.txt ${PROJECT_BINARY_DIR}/testfiles/h5diff_102.txt
- )
- add_custom_command (
- TARGET h5diff
- POST_BUILD
- COMMAND ${CMAKE_COMMAND}
- ARGS -E copy_if_different ${HDF5_TOOLS_H5DIFF_SOURCE_DIR}/testfiles/h5diff_103w.txt ${PROJECT_BINARY_DIR}/testfiles/h5diff_103.txt
- )
-
- add_custom_command (
- TARGET h5diff
- POST_BUILD
- COMMAND ${CMAKE_COMMAND}
- ARGS -E copy_if_different ${HDF5_TOOLS_H5DIFF_SOURCE_DIR}/testfiles/h5diff_104w.txt ${PROJECT_BINARY_DIR}/testfiles/h5diff_104.txt
- )
- endif (WIN32 AND MSVC_VERSION LESS 1900)
+ foreach (h5_tstfiles ${LIST_WIN_TEST_FILES})
+ get_filename_component(fname "${h5_tstfiles}" NAME)
+ HDFTEST_COPY_FILE("${HDF5_TOOLS_H5DIFF_SOURCE_DIR}/testfiles/${h5_tstfiles}w.txt" "${PROJECT_BINARY_DIR}/testfiles/${fname}.txt" "h5diff_files")
+ endforeach ()
+ else ()
+ foreach (h5_tstfiles ${LIST_WIN_TEST_FILES})
+ get_filename_component(fname "${h5_tstfiles}" NAME)
+ HDFTEST_COPY_FILE("${HDF5_TOOLS_H5DIFF_SOURCE_DIR}/testfiles/${h5_tstfiles}.txt" "${PROJECT_BINARY_DIR}/testfiles/${fname}.txt" "h5diff_files")
+ endforeach ()
+ endif ()
+ add_custom_target(h5diff_files ALL COMMENT "Copying files needed by h5diff tests" DEPENDS ${h5diff_files_list})
##############################################################################
##############################################################################
@@ -324,10 +304,10 @@
set_tests_properties (H5DIFF-${resultfile} PROPERTIES WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles")
if (NOT ${resultcode} STREQUAL "0")
set_tests_properties (H5DIFF-${resultfile} PROPERTIES WILL_FAIL "true")
- endif (NOT ${resultcode} STREQUAL "0")
+ endif ()
if (NOT "${last_test}" STREQUAL "")
set_tests_properties (H5DIFF-${resultfile} PROPERTIES DEPENDS ${last_test})
- endif (NOT "${last_test}" STREQUAL "")
+ endif ()
else (HDF5_ENABLE_USING_MEMCHECKER)
add_test (
NAME H5DIFF-${resultfile}-clear-objects
@@ -350,7 +330,7 @@
endif (HDF5_ENABLE_USING_MEMCHECKER)
if (H5_HAVE_PARALLEL)
ADD_PH5_TEST (${resultfile} ${resultcode} ${ARGN})
- endif (H5_HAVE_PARALLEL)
+ endif ()
ENDMACRO (ADD_H5_TEST file)
MACRO (ADD_PH5_TEST resultfile resultcode)
@@ -360,10 +340,10 @@
set_tests_properties (PH5DIFF-${resultfile} PROPERTIES WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles")
if (NOT ${resultcode} STREQUAL "0")
set_tests_properties (PH5DIFF-${resultfile} PROPERTIES WILL_FAIL "true")
- endif (NOT ${resultcode} STREQUAL "0")
+ endif ()
if (NOT "${last_test}" STREQUAL "")
set_tests_properties (PH5DIFF-${resultfile} PROPERTIES DEPENDS ${last_test})
- endif (NOT "${last_test}" STREQUAL "")
+ endif ()
else (HDF5_ENABLE_USING_MEMCHECKER)
add_test (
NAME PH5DIFF-${resultfile}-clear-objects
@@ -402,18 +382,18 @@
# if there was a previous test
if (NOT "${last_test}" STREQUAL "")
set_tests_properties (H5DIFF-${testname}-clear-objects PROPERTIES DEPENDS ${last_test})
- endif (NOT "${last_test}" STREQUAL "")
+ endif ()
endif (NOT HDF5_ENABLE_USING_MEMCHECKER)
add_test (NAME H5DIFF-${testname} COMMAND $<TARGET_FILE:h5diff> ${ARGN})
if (NOT ${resultcode} STREQUAL "0")
set_tests_properties (H5DIFF-${testname} PROPERTIES WILL_FAIL "true")
- endif (NOT ${resultcode} STREQUAL "0")
+ endif ()
if (HDF5_ENABLE_USING_MEMCHECKER)
if (NOT "${last_test}" STREQUAL "")
set_tests_properties (H5DIFF-${testname} PROPERTIES DEPENDS ${last_test})
- endif (NOT "${last_test}" STREQUAL "")
+ endif ()
else (HDF5_ENABLE_USING_MEMCHECKER)
set_tests_properties (H5DIFF-${testname} PROPERTIES DEPENDS H5DIFF-${testname}-clear-objects)
endif (HDF5_ENABLE_USING_MEMCHECKER)
diff --git a/tools/h5diff/h5diff_common.c b/tools/h5diff/h5diff_common.c
index 8a996d9..2453ffc 100644
--- a/tools/h5diff/h5diff_common.c
+++ b/tools/h5diff/h5diff_common.c
@@ -218,7 +218,7 @@ void parse_command_line(int argc,
options->delta = atof( opt_arg );
/* -d 0 is the same as default */
- if (options->delta == 0)
+ if (H5_DBL_ABS_EQUAL(options->delta, (double)0.0F))
options->d=0;
break;
@@ -235,7 +235,7 @@ void parse_command_line(int argc,
options->percent = atof( opt_arg );
/* -p 0 is the same as default */
- if (options->percent == 0)
+ if (H5_DBL_ABS_EQUAL(options->percent, (double)0.0F))
options->p = 0;
break;
@@ -249,16 +249,17 @@ void parse_command_line(int argc,
usage();
h5diff_exit(EXIT_FAILURE);
}
- options->count = atol( opt_arg );
-
+ options->count = HDstrtoull(opt_arg, NULL, 0);
break;
case 'N':
options->do_nans = 0;
break;
+
case 'c':
options->m_list_not_cmp = 1;
break;
+
case 'e':
options->use_system_epsilon = 1;
break;
diff --git a/tools/h5diff/h5diff_main.c b/tools/h5diff/h5diff_main.c
index 7b4bc39..cdaca29 100644
--- a/tools/h5diff/h5diff_main.c
+++ b/tools/h5diff/h5diff_main.c
@@ -16,6 +16,7 @@
#include <stdlib.h>
#include <assert.h>
#include <memory.h>
+#include "H5private.h"
#include "h5diff.h"
#include "h5diff_common.h"
#include "h5tools.h"
@@ -136,9 +137,9 @@ int main(int argc, const char *argv[])
*
*-------------------------------------------------------------------------
*/
-void
+H5_ATTR_NORETURN void
h5diff_exit(int status)
{
- exit(status);
+ HDexit(status);
}
diff --git a/tools/h5diff/h5diffgentest.c b/tools/h5diff/h5diffgentest.c
index 937bd32..339ff6c 100644
--- a/tools/h5diff/h5diffgentest.c
+++ b/tools/h5diff/h5diffgentest.c
@@ -28,7 +28,7 @@
* NOTE: this value should stay in sync with the value defined in the tools
* library file: h5tools_utils.h
*/
-hsize_t H5TOOLS_MALLOCSIZE = (128 * 1024 * 1024);
+size_t H5TOOLS_MALLOCSIZE = (128 * 1024 * 1024);
/*-------------------------------------------------------------------------
* Program: h5diffgentest
@@ -3745,7 +3745,7 @@ static int test_comp_vlen_strings(const char *fname1, const char *grp_name, int
/* vlen string */
hid_t sid_vlen_str=0; /* dataspace ID */
hid_t tid_vlen_str=0; /* datatype ID */
- const char vlen_str_buf[]= {
+ char vlen_str_buf[]= {
"Variable length string"
};
hsize_t dims_vlen_str[] = {VLEN_STR_DIM};
@@ -3762,7 +3762,7 @@ static int test_comp_vlen_strings(const char *fname1, const char *grp_name, int
hid_t sid_vlen_str_array=0; /* dataspace ID */
hid_t tid_vlen_str_array_pre=0; /* datatype ID */
hid_t tid_vlen_str_array=0; /* datatype ID */
- const char *vlen_str_array_buf[VLEN_STR_ARRY_DIM]= {
+ char *vlen_str_array_buf[VLEN_STR_ARRY_DIM]= {
"1 - Variable length string Array",
"2 - Testing variable length string array in compound type",
"3 - Four score and seven\n years ago our forefathers brought forth on this continent a new nation,"
@@ -4478,8 +4478,8 @@ static void test_comps_array (const char *fname, const char *dset, const char *a
wdata[i].i1 = i;
for(j=0; j < SDIM_CMPD_ARRAY; j++)
{
- wdata[i].cmpd2[j].i2 = i*10 + diff;
- wdata[i].cmpd2[j].f2 = (float)(i*10.5F) + diff;
+ wdata[i].cmpd2[j].i2 = i * 10 + diff;
+ wdata[i].cmpd2[j].f2 = (float)i * 10.5F + (float)diff;
} /* end for */
}
@@ -4588,15 +4588,13 @@ static void test_comps_vlen (const char * fname, const char *dset, const char *a
herr_t ret; /* Generic return value */
/* Allocate and initialize VL data to write */
- for(i=0; i<SDIM_DSET; i++)
- {
- wdata[i].i1 = i;
- wdata[i].vl.p = HDmalloc((i+1)*sizeof(cmpd2_t));
- wdata[i].vl.len = i+1;
- for(j=0; j<(i+1); j++)
- {
- ((cmpd2_t *)wdata[i].vl.p)[j].i2 = i*10 + diff;
- ((cmpd2_t *)wdata[i].vl.p)[j].f2 = (float)(i*10.5F) + diff;
+ for(i = 0; i < SDIM_DSET; i++) {
+ wdata[i].i1 = (int)i;
+ wdata[i].vl.p = HDmalloc((i + 1) * sizeof(cmpd2_t));
+ wdata[i].vl.len = i + 1;
+ for(j = 0; j < (i + 1); j++) {
+ ((cmpd2_t *)wdata[i].vl.p)[j].i2 = (int)(i * 10 + (unsigned)diff);
+ ((cmpd2_t *)wdata[i].vl.p)[j].f2 = (float)i * 10.5F + (float)diff;
} /* end for */
} /* end for */
@@ -4703,26 +4701,24 @@ static void test_comps_array_vlen (const char * fname, const char *dset,const ch
hid_t tid_cmpd3; /* Compound3 Datatype ID */
hsize_t sdims_dset[] = {SDIM_DSET};
hsize_t sdims_arry[] = {SDIM_CMPD_ARRAY};
- int i,j,k; /* counting variables */
- herr_t ret; /* Generic return value */
+ unsigned i, j, k; /* counting variables */
+ herr_t ret; /* Generic return value */
/* Initialize array data to write in compound1 */
- for(i=0; i < SDIM_DSET; i++)
- {
- wdata[i].i1 = i;
+ for(i = 0; i < SDIM_DSET; i++) {
+ wdata[i].i1 = (int)i;
+
/* Allocate and initialize VL data to write in compound2 */
- for(j=0; j < SDIM_CMPD_ARRAY; j++)
- {
- wdata[i].cmpd2[j].i2 = j*10;
- wdata[i].cmpd2[j].vl.p = HDmalloc((j+1)*sizeof(cmpd3_t));
- wdata[i].cmpd2[j].vl.len = j+1;
- for(k=0; k<(j+1); k++)
- {
+ for(j = 0; j < SDIM_CMPD_ARRAY; j++) {
+ wdata[i].cmpd2[j].i2 = (int)(j * 10);
+ wdata[i].cmpd2[j].vl.p = HDmalloc((j + 1) * sizeof(cmpd3_t));
+ wdata[i].cmpd2[j].vl.len = j + 1;
+ for(k = 0; k < (j + 1); k++) {
/* Initialize data of compound3 */
- ((cmpd3_t *)wdata[i].cmpd2[j].vl.p)[k].i3 = j*10 + diff;
- ((cmpd3_t *)wdata[i].cmpd2[j].vl.p)[k].f3 = (float)(j*10.5F) + diff;
+ ((cmpd3_t *)wdata[i].cmpd2[j].vl.p)[k].i3 = (int)j * 10 + diff;
+ ((cmpd3_t *)wdata[i].cmpd2[j].vl.p)[k].f3 = (float)j * 10.5F + (float)diff;
} /* end for */
} /* end for */
}
@@ -4856,22 +4852,19 @@ static void test_comps_vlen_arry (const char * fname, const char *dset, const ch
herr_t ret; /* Generic return value */
/* Allocate and initialize VL data to write */
- for(i=0; i<SDIM_DSET; i++)
- {
+ for(i = 0; i < SDIM_DSET; i++) {
/* compound 1 data */
- wdata[i].i1 = i;
- wdata[i].vl.p = HDmalloc((i+1)*sizeof(cmpd2_t));
- wdata[i].vl.len = i+1;
- for(j=0; j<(i+1); j++)
- {
+ wdata[i].i1 = (int)i;
+ wdata[i].vl.p = HDmalloc((i + 1) * sizeof(cmpd2_t));
+ wdata[i].vl.len = i + 1;
+ for(j = 0; j < (i + 1); j++) {
/* compound2 data */
- ((cmpd2_t *)wdata[i].vl.p)[j].i2 = i*10 + diff;
- for (k=0; k < SDIM_CMPD_ARRAY; k++)
- {
+ ((cmpd2_t *)wdata[i].vl.p)[j].i2 = (int)i * 10 + diff;
+ for(k = 0; k < SDIM_CMPD_ARRAY; k++) {
/* compound 3 data */
- ((cmpd2_t *)(wdata[i].vl.p))[j].cmpd3[k].i3 = k*10.5F + diff;
- ((cmpd2_t *)(wdata[i].vl.p))[j].cmpd3[k].f3 = (float)(k*10.5F) + diff;
- }
+ ((cmpd2_t *)(wdata[i].vl.p))[j].cmpd3[k].i3 = (int)((float)k * 10.5F) + diff;
+ ((cmpd2_t *)(wdata[i].vl.p))[j].cmpd3[k].f3 = (float)k * 10.5F + (float)diff;
+ } /* end for */
} /* end for */
} /* end for */
@@ -5857,13 +5850,15 @@ void write_attr_in(hid_t loc_id,
/* Allocate and initialize VL dataset to write */
n=0;
- for (i = 0; i < 3; i++) {
- for (j = 0; j < 2; j++) {
- buf52[i][j].p = HDmalloc((i + 1) * sizeof(int));
- buf52[i][j].len = i + 1;
- for (l = 0; l < i + 1; l++)
- if (make_diffs)((int *)buf52[i][j].p)[l] = 0;
- else ((int *)buf52[i][j].p)[l] = n++;
+ for(i = 0; i < 3; i++) {
+ for(j = 0; j < 2; j++) {
+ buf52[i][j].p = HDmalloc((size_t)(i + 1) * sizeof(int));
+ buf52[i][j].len = (size_t)(i + 1);
+ for(l = 0; l < i + 1; l++)
+ if(make_diffs)
+ ((int *)buf52[i][j].p)[l] = 0;
+ else
+ ((int *)buf52[i][j].p)[l] = n++;
}
}
@@ -6074,8 +6069,10 @@ void write_attr_in(hid_t loc_id,
for (i = 0; i < 4; i++) {
for (j = 0; j < 3; j++) {
for (k = 0; k < 2; k++) {
- if (make_diffs) buf23[i][j][k]=0;
- else buf23[i][j][k]=n++;
+ if(make_diffs)
+ buf23[i][j][k] = 0;
+ else
+ buf23[i][j][k] = (char)n++;
}
}
}
@@ -6132,12 +6129,12 @@ void write_attr_in(hid_t loc_id,
for (j = 0; j < 3; j++) {
for (k = 0; k < 2; k++) {
if (make_diffs) {
- buf33[i][j][k].a=0;
- buf33[i][j][k].b=0.0F;
+ buf33[i][j][k].a = 0;
+ buf33[i][j][k].b = 0.0F;
}
else {
- buf33[i][j][k].a=n++;
- buf33[i][j][k].b=n++;
+ buf33[i][j][k].a = (char)n++;
+ buf33[i][j][k].b = n++;
}
}
}
@@ -6275,11 +6272,13 @@ void write_attr_in(hid_t loc_id,
for (i = 0; i < 4; i++) {
for (j = 0; j < 3; j++) {
for (k = 0; k < 2; k++) {
- buf53[i][j][k].p = HDmalloc((i + 1) * sizeof(int));
- buf53[i][j][k].len = i + 1;
+ buf53[i][j][k].p = HDmalloc((size_t)(i + 1) * sizeof(int));
+ buf53[i][j][k].len = (size_t)(i + 1);
for (l = 0; l < i + 1; l++)
- if (make_diffs)((int *)buf53[i][j][k].p)[l] = 0;
- else ((int *)buf53[i][j][k].p)[l] = n++;
+ if(make_diffs)
+ ((int *)buf53[i][j][k].p)[l] = 0;
+ else
+ ((int *)buf53[i][j][k].p)[l] = n++;
}
}
}
@@ -6649,22 +6648,21 @@ void write_dset_in(hid_t loc_id,
status = H5Tclose(tid);
{
-
double *dbuf; /* information to write */
- hid_t did; /* dataset ID */
- hid_t sid; /* dataspace ID */
- hid_t tid; /* datatype ID */
+ hid_t ldid; /* dataset ID */
+ hid_t lsid; /* dataspace ID */
+ hid_t ltid; /* datatype ID */
size_t size;
hsize_t sdims[] = {1};
hsize_t tdims[] = {H5TOOLS_MALLOCSIZE / sizeof(double) + 1};
- int j;
+ size_t jj;
/* allocate and initialize array data to write */
size = ( H5TOOLS_MALLOCSIZE / sizeof(double) + 1 ) * sizeof(double);
- dbuf = (double *)HDmalloc( size );
+ dbuf = (double *)HDmalloc(size);
- for( j = 0; j < H5TOOLS_MALLOCSIZE / sizeof(double) + 1; j++)
- dbuf[j] = j;
+ for(jj = 0; jj < (H5TOOLS_MALLOCSIZE / sizeof(double) + 1); jj++)
+ dbuf[jj] = (double)jj;
if (make_diffs)
{
@@ -6673,19 +6671,19 @@ void write_dset_in(hid_t loc_id,
}
/* create a type larger than H5TOOLS_MALLOCSIZE */
- tid = H5Tarray_create2(H5T_NATIVE_DOUBLE, 1, tdims);
- size = H5Tget_size(tid);
- sid = H5Screate_simple(1, sdims, NULL);
- did = H5Dcreate2(loc_id, "arrayd", tid, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ ltid = H5Tarray_create2(H5T_NATIVE_DOUBLE, 1, tdims);
+ size = H5Tget_size(ltid);
+ lsid = H5Screate_simple(1, sdims, NULL);
+ ldid = H5Dcreate2(loc_id, "arrayd", ltid, lsid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
#if defined(WRITE_ARRAY)
- H5Dwrite(did, tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, dbuf);
+ H5Dwrite(ldid, ltid, H5S_ALL, H5S_ALL, H5P_DEFAULT, dbuf);
#endif
/* close */
- H5Dclose(did);
- H5Tclose(tid);
- H5Sclose(sid);
- HDfree( dbuf );
+ H5Dclose(ldid);
+ H5Tclose(ltid);
+ H5Sclose(lsid);
+ HDfree(dbuf);
}
/*-------------------------------------------------------------------------
@@ -6815,15 +6813,12 @@ void write_dset_in(hid_t loc_id,
/* Allocate and initialize VL dataset to write */
n = 0;
- for(i = 0; i < 3; i++)
- {
- for(j = 0; j < 2; j++)
- {
- buf52[i][j].p = HDmalloc((i + 1) * sizeof(int));
- buf52[i][j].len = i + 1;
- for(l = 0; l < i + 1; l++)
- {
- if (make_diffs)
+ for(i = 0; i < 3; i++) {
+ for(j = 0; j < 2; j++) {
+ buf52[i][j].p = HDmalloc((size_t)(i + 1) * sizeof(int));
+ buf52[i][j].len = (size_t)(i + 1);
+ for(l = 0; l < i + 1; l++) {
+ if(make_diffs)
((int *)buf52[i][j].p)[l] = 0;
else
((int *)buf52[i][j].p)[l] = n++;
@@ -6933,15 +6928,13 @@ void write_dset_in(hid_t loc_id,
n=1;
- for (i = 0; i < 4; i++)
- {
- for (j = 0; j < 3; j++)
- {
- for (k = 0; k < 2; k++)
- {
- if (make_diffs)
- buf23[i][j][k]=0;
- else buf23[i][j][k]=n++;
+ for (i = 0; i < 4; i++) {
+ for (j = 0; j < 3; j++) {
+ for (k = 0; k < 2; k++) {
+ if(make_diffs)
+ buf23[i][j][k] = 0;
+ else
+ buf23[i][j][k] = (char)n++;
}
}
}
@@ -6966,20 +6959,16 @@ void write_dset_in(hid_t loc_id,
*/
n=1;
- for (i = 0; i < 4; i++)
- {
- for (j = 0; j < 3; j++)
- {
- for (k = 0; k < 2; k++)
- {
- if (make_diffs)
- {
- buf33[i][j][k].a=0;
- buf33[i][j][k].b=0.0F;
+ for (i = 0; i < 4; i++) {
+ for (j = 0; j < 3; j++) {
+ for (k = 0; k < 2; k++) {
+ if (make_diffs) {
+ buf33[i][j][k].a = 0;
+ buf33[i][j][k].b = 0.0F;
}
else {
- buf33[i][j][k].a=n++;
- buf33[i][j][k].b=n++;
+ buf33[i][j][k].a = (char)n++;
+ buf33[i][j][k].b = n++;
}
}
}
@@ -7026,16 +7015,12 @@ void write_dset_in(hid_t loc_id,
/* Allocate and initialize VL dataset to write */
n=0;
- for(i = 0; i < 4; i++)
- {
- for(j = 0; j < 3; j++)
- {
- for(k = 0; k < 2; k++)
- {
- buf53[i][j][k].p = HDmalloc((i + 1) * sizeof(int));
- buf53[i][j][k].len = i + 1;
- for(l = 0; l < i + 1; l++)
- {
+ for(i = 0; i < 4; i++) {
+ for(j = 0; j < 3; j++) {
+ for(k = 0; k < 2; k++) {
+ buf53[i][j][k].p = HDmalloc((size_t)(i + 1) * sizeof(int));
+ buf53[i][j][k].len = (size_t)(i + 1);
+ for(l = 0; l < i + 1; l++) {
if(make_diffs)
((int *)buf53[i][j][k].p)[l] = 0;
else
@@ -7265,7 +7250,7 @@ int test_hyperslab(const char *fname,
if(make_diffs && i == 512 * 512)
HDmemset(buf, 0, nelmts);
- hs_start[0] = i * GBLL/(1024*1024);
+ hs_start[0] = (unsigned long long)i * GBLL / (1024 * 1024);
if (H5Sselect_hyperslab (f_sid,H5S_SELECT_SET,hs_start,NULL,hs_size, NULL) < 0)
goto out;
diff --git a/tools/h5diff/testh5diff.sh.in b/tools/h5diff/testh5diff.sh.in
index 0dfdaa2..0df9cb8 100644
--- a/tools/h5diff/testh5diff.sh.in
+++ b/tools/h5diff/testh5diff.sh.in
@@ -374,7 +374,7 @@ CLEAN_TESTFILES_AND_TESTDIR()
# skip rm if srcdir is same as destdir
# this occurs when build/test performed in source dir and
# make cp fail
- SDIR=`$DIRNAME $tstfile`
+ SDIR=$SRC_H5DIFF_TESTFILES
INODE_SDIR=`$LS -i -d $SDIR | $AWK -F' ' '{print $1}'`
INODE_DDIR=`$LS -i -d $TESTDIR | $AWK -F' ' '{print $1}'`
if [ "$INODE_SDIR" != "$INODE_DDIR" ]; then
diff --git a/tools/h5dump/CMakeTests.cmake b/tools/h5dump/CMakeTests.cmake
index 346ab60..e376b50 100644
--- a/tools/h5dump/CMakeTests.cmake
+++ b/tools/h5dump/CMakeTests.cmake
@@ -62,6 +62,7 @@
${HDF5_TOOLS_DIR}/testfiles/tcmpdintarray.ddl
${HDF5_TOOLS_DIR}/testfiles/tcmpdints.ddl
${HDF5_TOOLS_DIR}/testfiles/tcmpdintsize.ddl
+ ${HDF5_TOOLS_DIR}/testfiles/tcompound_complex2.ddl
${HDF5_TOOLS_DIR}/testfiles/tcomp-1.ddl
${HDF5_TOOLS_DIR}/testfiles/tcomp-2.ddl
${HDF5_TOOLS_DIR}/testfiles/tcomp-3.ddl
@@ -173,6 +174,7 @@
${HDF5_TOOLS_DIR}/testfiles/tvldtypes3.ddl
${HDF5_TOOLS_DIR}/testfiles/tvldtypes4.ddl
${HDF5_TOOLS_DIR}/testfiles/tvldtypes5.ddl
+ ${HDF5_TOOLS_DIR}/testfiles/tvlenstr_array.ddl
${HDF5_TOOLS_DIR}/testfiles/tvlstr.ddl
${HDF5_TOOLS_DIR}/testfiles/tvms.ddl
${HDF5_TOOLS_DIR}/testfiles/twidedisplay.ddl
@@ -222,6 +224,7 @@
${HDF5_TOOLS_DIR}/testfiles/tcmpdintsize.h5
${HDF5_TOOLS_DIR}/testfiles/tcompound.h5
${HDF5_TOOLS_DIR}/testfiles/tcompound_complex.h5
+ ${HDF5_TOOLS_DIR}/testfiles/tcompound_complex2.h5
${HDF5_TOOLS_DIR}/testfiles/tdatareg.h5
${HDF5_TOOLS_DIR}/testfiles/tdset.h5
${HDF5_TOOLS_DIR}/testfiles/tempty.h5
@@ -286,6 +289,7 @@
${HDF5_TOOLS_DIR}/testfiles/tvldtypes3.h5
${HDF5_TOOLS_DIR}/testfiles/tvldtypes4.h5
${HDF5_TOOLS_DIR}/testfiles/tvldtypes5.h5
+ ${HDF5_TOOLS_DIR}/testfiles/tvlenstr_array.h5
${HDF5_TOOLS_DIR}/testfiles/tvlstr.h5
${HDF5_TOOLS_DIR}/testfiles/tvms.h5
${HDF5_TOOLS_DIR}/testfiles/zerodim.h5
@@ -325,14 +329,7 @@
#
foreach (tst_h5_file ${HDF5_REFERENCE_TEST_FILES})
get_filename_component (fname "${tst_h5_file}" NAME)
- set (dest "${PROJECT_BINARY_DIR}/testfiles/std/${fname}")
- #message (STATUS " Copying ${tst_h5_file}")
- add_custom_command (
- TARGET h5dump
- POST_BUILD
- COMMAND ${CMAKE_COMMAND}
- ARGS -E copy_if_different ${tst_h5_file} ${dest}
- )
+ HDFTEST_COPY_FILE("${tst_h5_file}" "${PROJECT_BINARY_DIR}/testfiles/std/${fname}" "h5dump_std_files")
endforeach (tst_h5_file ${HDF5_REFERENCE_TEST_FILES})
foreach (tst_exp_file ${HDF5_REFERENCE_EXP_FILES})
@@ -340,60 +337,32 @@
file (READ ${HDF5_TOOLS_SRC_DIR}/testfiles/${tst_exp_file} TEST_STREAM)
file (WRITE ${PROJECT_BINARY_DIR}/testfiles/std/${tst_exp_file} "${TEST_STREAM}")
else (WIN32)
- add_custom_command (
- TARGET h5dump
- POST_BUILD
- COMMAND ${CMAKE_COMMAND}
- ARGS -E copy_if_different ${HDF5_TOOLS_SRC_DIR}/testfiles/${tst_exp_file} ${PROJECT_BINARY_DIR}/testfiles/std/${tst_exp_file}
- )
+ HDFTEST_COPY_FILE("${HDF5_TOOLS_SRC_DIR}/testfiles/${tst_exp_file}" "${PROJECT_BINARY_DIR}/testfiles/std/${tst_exp_file}" "h5dump_std_files")
endif (WIN32)
endforeach (tst_exp_file ${HDF5_REFERENCE_EXP_FILES})
foreach (tst_other_file ${HDF5_REFERENCE_FILES})
get_filename_component (fname "${tst_other_file}" NAME)
- set (dest "${PROJECT_BINARY_DIR}/testfiles/std/${fname}")
- #message (STATUS " Copying ${tst_other_file}")
- add_custom_command (
- TARGET h5dump
- POST_BUILD
- COMMAND ${CMAKE_COMMAND}
- ARGS -E copy_if_different ${tst_other_file} ${dest}
- )
+ HDFTEST_COPY_FILE("${tst_other_file}" "${PROJECT_BINARY_DIR}/testfiles/std/${fname}" "h5dump_std_files")
endforeach (tst_other_file ${HDF5_REFERENCE_FILES})
foreach (tst_error_file ${HDF5_ERROR_REFERENCE_TEST_FILES})
get_filename_component (fname "${tst_error_file}" NAME)
- set (dest "${PROJECT_BINARY_DIR}/testfiles/std/${fname}")
- #message (STATUS " Copying ${tst_error_file}")
- add_custom_command (
- TARGET h5dump
- POST_BUILD
- COMMAND ${CMAKE_COMMAND}
- ARGS -E copy_if_different ${tst_error_file} ${dest}
- )
+ HDFTEST_COPY_FILE("${tst_error_file}" "${PROJECT_BINARY_DIR}/testfiles/std/${fname}" "h5dump_std_files")
endforeach (tst_error_file ${HDF5_ERROR_REFERENCE_TEST_FILES})
# --------------------------------------------------------------------
# Special file handling
# --------------------------------------------------------------------
- add_custom_command (
- TARGET h5dump
- POST_BUILD
- COMMAND ${CMAKE_COMMAND}
- ARGS -E copy_if_different ${HDF5_TOOLS_SOURCE_DIR}/testfiles/tbin1.ddl ${PROJECT_BINARY_DIR}/testfiles/std/tbin1LE.ddl
- )
+ HDFTEST_COPY_FILE("${HDF5_TOOLS_SOURCE_DIR}/testfiles/tbin1.ddl" "${PROJECT_BINARY_DIR}/testfiles/std/tbin1LE.ddl" "h5dump_std_files")
if (WIN32)
file (READ ${HDF5_TOOLS_SRC_DIR}/testfiles/tbinregR.exp TEST_STREAM)
file (WRITE ${PROJECT_BINARY_DIR}/testfiles/std/tbinregR.exp "${TEST_STREAM}")
else (WIN32)
- add_custom_command (
- TARGET h5dump
- POST_BUILD
- COMMAND ${CMAKE_COMMAND}
- ARGS -E copy_if_different ${HDF5_TOOLS_SRC_DIR}/testfiles/tbinregR.exp ${PROJECT_BINARY_DIR}/testfiles/std/tbinregR.exp
- )
+ HDFTEST_COPY_FILE("${HDF5_TOOLS_SRC_DIR}/testfiles/tbinregR.exp" "${PROJECT_BINARY_DIR}/testfiles/std/tbinregR.exp" "h5dump_std_files")
endif (WIN32)
+ add_custom_target(h5dump_std_files ALL COMMENT "Copying files needed by h5dump_std tests" DEPENDS ${h5dump_std_files_list})
##############################################################################
##############################################################################
@@ -850,6 +819,8 @@
tcomp-4.out.err
tcompact.out
tcompact.out.err
+ tcompound_complex.out
+ tcompound_complex.out.err
tcontents.out
tcontents.out.err
tcontiguos.out
@@ -1066,6 +1037,8 @@
tvldtypes4.out.err
tvldtypes5.out
tvldtypes5.out.err
+ tvlenstr_array.out
+ tvlenstr_array.out.err
tvlstr.out
tvlstr.out.err
tvms.out
@@ -1174,6 +1147,7 @@
ADD_H5ERR_MASK_TEST (tcomp-3 0 "--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)
# tests for bitfields and opaque data types
ADD_H5_TEST (tbitnopaque 0 --enable-error-stack tbitnopaque.h5)
@@ -1208,6 +1182,7 @@
#test for file with variable length string data
ADD_H5_TEST (tvlstr 0 --enable-error-stack tvlstr.h5)
+ ADD_H5_TEST (tvlenstr_array 0 --enable-error-stack tvlenstr_array.h5)
# test for files with array data
ADD_H5_TEST (tarray1 0 --enable-error-stack tarray1.h5)
diff --git a/tools/h5dump/CMakeTestsPBITS.cmake b/tools/h5dump/CMakeTestsPBITS.cmake
index 14f282a..28514fb 100644
--- a/tools/h5dump/CMakeTestsPBITS.cmake
+++ b/tools/h5dump/CMakeTestsPBITS.cmake
@@ -87,40 +87,20 @@
foreach (pbits_h5_file ${HDF5_REFERENCE_TEST_PBITS})
get_filename_component(fname "${pbits_h5_file}" NAME)
- set (dest "${PROJECT_BINARY_DIR}/testfiles/pbits/${fname}")
- #message (STATUS " Copying ${pbits_h5_file}")
- add_custom_command (
- TARGET h5dump
- POST_BUILD
- COMMAND ${CMAKE_COMMAND}
- ARGS -E copy_if_different ${pbits_h5_file} ${dest}
- )
+ HDFTEST_COPY_FILE("${pbits_h5_file}" "${PROJECT_BINARY_DIR}/testfiles/pbits/${fname}" "h5dump_pbits_files")
endforeach (pbits_h5_file ${HDF5_REFERENCE_TEST_PBITS})
foreach (ddl_pbits ${HDF5_REFERENCE_PBITS})
get_filename_component(fname "${ddl_pbits}" NAME)
- set (ddldest "${PROJECT_BINARY_DIR}/testfiles/pbits/${fname}")
- #message (STATUS " Copying ${ddl_pbits}")
- add_custom_command (
- TARGET h5dump
- POST_BUILD
- COMMAND ${CMAKE_COMMAND}
- ARGS -E copy_if_different ${HDF5_TOOLS_SRC_DIR}/testfiles/pbits/${ddl_pbits} ${ddldest}
- )
+ HDFTEST_COPY_FILE("${HDF5_TOOLS_SRC_DIR}/testfiles/pbits/${ddl_pbits}" "${PROJECT_BINARY_DIR}/testfiles/pbits/${fname}" "h5dump_pbits_files")
endforeach (ddl_pbits ${HDF5_REFERENCE_PBITS})
foreach (ddl_pbits ${HDF5_ERROR_REFERENCE_PBITS})
get_filename_component(fname "${ddl_pbits}" NAME)
- set (ddldest "${PROJECT_BINARY_DIR}/testfiles/pbits/${fname}")
- #message (STATUS " Copying ${ddl_pbits}")
- add_custom_command (
- TARGET h5dump
- POST_BUILD
- COMMAND ${CMAKE_COMMAND}
- ARGS -E copy_if_different ${PROJECT_SOURCE_DIR}/errfiles/${ddl_pbits} ${ddldest}
- )
+ HDFTEST_COPY_FILE("${PROJECT_SOURCE_DIR}/errfiles/${ddl_pbits}" "${PROJECT_BINARY_DIR}/testfiles/pbits/${fname}" "h5dump_pbits_files")
endforeach (ddl_pbits ${HDF5_ERROR_REFERENCE_PBITS})
+ add_custom_target(h5dump_pbits_files ALL COMMENT "Copying files needed by h5dump_pbits tests" DEPENDS ${h5dump_pbits_files_list})
##############################################################################
##############################################################################
@@ -135,10 +115,10 @@
set_tests_properties (H5DUMP-${resultfile} PROPERTIES WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles/pbits")
if (NOT ${resultcode} STREQUAL "0")
set_tests_properties (H5DUMP-${resultfile} PROPERTIES WILL_FAIL "true")
- endif (NOT ${resultcode} STREQUAL "0")
+ endif ()
if (NOT "${last_pbits_test}" STREQUAL "")
set_tests_properties (H5DUMP-${resultfile} PROPERTIES DEPENDS ${last_pbits_test})
- endif (NOT "${last_pbits_test}" STREQUAL "")
+ endif ()
else (HDF5_ENABLE_USING_MEMCHECKER)
add_test (
NAME H5DUMP-${resultfile}-clear-objects
diff --git a/tools/h5dump/CMakeTestsVDS.cmake b/tools/h5dump/CMakeTestsVDS.cmake
index dcb90e0..68a62e8 100644
--- a/tools/h5dump/CMakeTestsVDS.cmake
+++ b/tools/h5dump/CMakeTestsVDS.cmake
@@ -66,40 +66,20 @@
foreach (vds_h5_file ${HDF5_REFERENCE_TEST_VDS})
get_filename_component(fname "${vds_h5_file}" NAME)
- set (dest "${PROJECT_BINARY_DIR}/testfiles/vds/${fname}")
- #message (STATUS " Copying ${vds_h5_file}")
- add_custom_command (
- TARGET h5dump
- POST_BUILD
- COMMAND ${CMAKE_COMMAND}
- ARGS -E copy_if_different ${HDF5_TOOLS_SRC_DIR}/testfiles/vds/${vds_h5_file} ${dest}
- )
+ HDFTEST_COPY_FILE("${HDF5_TOOLS_SRC_DIR}/testfiles/vds/${vds_h5_file}" "${PROJECT_BINARY_DIR}/testfiles/vds/${fname}" "h5dump_vds_files")
endforeach (vds_h5_file ${HDF5_REFERENCE_TEST_VDS})
foreach (ddl_vds ${HDF5_REFERENCE_VDS})
get_filename_component(fname "${ddl_vds}" NAME)
- set (ddldest "${PROJECT_BINARY_DIR}/testfiles/vds/${fname}")
- #message (STATUS " Copying ${ddl_vds}")
- add_custom_command (
- TARGET h5dump
- POST_BUILD
- COMMAND ${CMAKE_COMMAND}
- ARGS -E copy_if_different ${HDF5_TOOLS_SRC_DIR}/testfiles/vds/${ddl_vds} ${ddldest}
- )
+ HDFTEST_COPY_FILE("${HDF5_TOOLS_SRC_DIR}/testfiles/vds/${ddl_vds}" "${PROJECT_BINARY_DIR}/testfiles/vds/${fname}" "h5dump_vds_files")
endforeach (ddl_vds ${HDF5_REFERENCE_VDS})
foreach (ddl_vds ${HDF5_ERROR_REFERENCE_VDS})
get_filename_component(fname "${ddl_vds}" NAME)
- set (ddldest "${PROJECT_BINARY_DIR}/testfiles/vds/${fname}")
- #message (STATUS " Copying ${ddl_vds}")
- add_custom_command (
- TARGET h5dump
- POST_BUILD
- COMMAND ${CMAKE_COMMAND}
- ARGS -E copy_if_different ${PROJECT_SOURCE_DIR}/errfiles/${ddl_vds} ${ddldest}
- )
+ HDFTEST_COPY_FILE("${PROJECT_SOURCE_DIR}/errfiles/${ddl_vds}" "${PROJECT_BINARY_DIR}/testfiles/vds/${fname}" "h5dump_vds_files")
endforeach (ddl_vds ${HDF5_ERROR_REFERENCE_VDS})
+ add_custom_target(h5dump_vds_files ALL COMMENT "Copying files needed by h5dump_vds tests" DEPENDS ${h5dump_vds_files_list})
##############################################################################
##############################################################################
@@ -114,10 +94,10 @@
set_tests_properties (H5DUMP-${resultfile} PROPERTIES WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles/vds")
if (NOT ${resultcode} STREQUAL "0")
set_tests_properties (H5DUMP-${resultfile} PROPERTIES WILL_FAIL "true")
- endif (NOT ${resultcode} STREQUAL "0")
+ endif ()
if (NOT "${last_vds_test}" STREQUAL "")
set_tests_properties (H5DUMP-${resultfile} PROPERTIES DEPENDS ${last_VDS_test})
- endif (NOT "${last_vds_test}" STREQUAL "")
+ endif ()
else (HDF5_ENABLE_USING_MEMCHECKER)
add_test (
NAME H5DUMP-${resultfile}-clear-objects
@@ -147,10 +127,10 @@
set_tests_properties (H5DUMP-${resultfile} PROPERTIES WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles/vds")
if (NOT ${resultcode} STREQUAL "0")
set_tests_properties (H5DUMP-${resultfile} PROPERTIES WILL_FAIL "true")
- endif (NOT ${resultcode} STREQUAL "0")
+ endif ()
if (NOT "${last_vds_test}" STREQUAL "")
set_tests_properties (H5DUMP-${resultfile} PROPERTIES DEPENDS ${last_VDS_test})
- endif (NOT "${last_vds_test}" STREQUAL "")
+ endif ()
else (HDF5_ENABLE_USING_MEMCHECKER)
add_test (
NAME H5DUMP-${resultfile}-clear-objects
diff --git a/tools/h5dump/CMakeTestsXML.cmake b/tools/h5dump/CMakeTestsXML.cmake
index afb1df6..6e8dd15 100644
--- a/tools/h5dump/CMakeTestsXML.cmake
+++ b/tools/h5dump/CMakeTestsXML.cmake
@@ -129,27 +129,14 @@
foreach (tst_xml_h5_file ${HDF5_XML_REFERENCE_TEST_FILES})
get_filename_component(fname "${tst_xml_h5_file}" NAME)
- set (dest "${PROJECT_BINARY_DIR}/testfiles/xml/${fname}")
- #message (STATUS " Copying ${tst_xml_h5_file}")
- add_custom_command (
- TARGET h5dump
- POST_BUILD
- COMMAND ${CMAKE_COMMAND}
- ARGS -E copy_if_different ${tst_xml_h5_file} ${dest}
- )
+ HDFTEST_COPY_FILE("${tst_xml_h5_file}" "${PROJECT_BINARY_DIR}/testfiles/xml/${fname}" "h5dump_xml_files")
endforeach (tst_xml_h5_file ${HDF5_XML_REFERENCE_TEST_FILES})
foreach (tst_xml_other_file ${HDF5_XML_REFERENCE_FILES})
get_filename_component(fname "${tst_xml_other_file}" NAME)
- set (dest "${PROJECT_BINARY_DIR}/testfiles/xml/${fname}")
- #message (STATUS " Copying ${tst_xml_other_file}")
- add_custom_command (
- TARGET h5dump
- POST_BUILD
- COMMAND ${CMAKE_COMMAND}
- ARGS -E copy_if_different ${tst_xml_other_file} ${dest}
- )
+ HDFTEST_COPY_FILE("${tst_xml_other_file}" "${PROJECT_BINARY_DIR}/testfiles/xml/${fname}" "h5dump_xml_files")
endforeach (tst_xml_other_file ${HDF5_XML_REFERENCE_FILES})
+ add_custom_target(h5dump_xml_files ALL COMMENT "Copying files needed by h5dump_xml tests" DEPENDS ${h5dump_xml_files_list})
##############################################################################
##############################################################################
@@ -176,10 +163,10 @@
set_tests_properties (H5DUMP-XML-${resultfile} PROPERTIES WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles/xml")
if (NOT ${resultcode} STREQUAL "0")
set_tests_properties (H5DUMP-XML-${resultfile} PROPERTIES WILL_FAIL "true")
- endif (NOT ${resultcode} STREQUAL "0")
+ endif ()
if (NOT "${last_xml_test}" STREQUAL "")
set_tests_properties (H5DUMP-XML-${resultfile} PROPERTIES DEPENDS ${last_xml_test})
- endif (NOT "${last_xml_test}" STREQUAL "")
+ endif ()
else (HDF5_ENABLE_USING_MEMCHECKER)
add_test (
NAME H5DUMP-XML-${resultfile}-clear-objects
diff --git a/tools/h5dump/h5dump.c b/tools/h5dump/h5dump.c
index 3b46912..562cfd5 100644
--- a/tools/h5dump/h5dump.c
+++ b/tools/h5dump/h5dump.c
@@ -638,7 +638,7 @@ parse_hsize_list(const char *h_list, subset_d *d)
for (ptr = h_list; i < size_count && ptr && *ptr && *ptr != ';' && *ptr != ']'; ptr++)
if(HDisdigit(*ptr)) {
/* we should have an integer now */
- p_list[i++] = (hsize_t)HDatoll(ptr);
+ p_list[i++] = (hsize_t)HDstrtoull(ptr, NULL, 0);
while (HDisdigit(*ptr))
/* scroll to end of integer */
diff --git a/tools/h5dump/h5dumpgentest.c b/tools/h5dump/h5dumpgentest.c
index 1cdf6cf..c95ada3 100644
--- a/tools/h5dump/h5dumpgentest.c
+++ b/tools/h5dump/h5dumpgentest.c
@@ -112,6 +112,8 @@
#define FILE79 "tintsattrs.h5"
#define FILE80 "tbitnopaque.h5"
#define FILE81 "tints4dims.h5"
+#define FILE82 "tcompound_complex2.h5"
+#define FILE83 "tvlenstr_array.h5"
/*-------------------------------------------------------------------------
* prototypes
@@ -289,14 +291,14 @@ typedef struct s1_t {
#define F66_DUMMYDBL "DummyDBL"
/* Declarations for gent_dataset_idx() for "FILE68a" */
-#define F68a_DSET_FIXED "dset_fixed"
-#define F68a_DSET_FIXED_FILTER "dset_filter"
-#define F68a_DSET_BTREE "dset_btree"
-#define F68a_DIM200 200
-#define F68a_DIM100 100
-#define F68a_DIM20 20
-#define F68a_DIM10 10
-#define F68a_CHUNK 5
+#define F68a_DSET_FIXED "dset_fixed"
+#define F68a_DSET_FIXED_FILTER "dset_filter"
+#define F68a_DSET_BTREE "dset_btree"
+#define F68a_DIM200 200
+#define F68a_DIM100 100
+#define F68a_DIM20 20
+#define F68a_DIM10 10
+#define F68a_CHUNK 5
/* "FILE70" macros and for FILE71 */
/* Name of dataset to create in datafile */
@@ -371,6 +373,25 @@ typedef struct s1_t {
#define F81_YDIM 6
#define F81_ZDIM 4
+/* "File 82" macros */
+/* Name of dataset to create in datafile */
+#define F82_DATASETNAME "CompoundComplex1D"
+/* Dataset dimensions */
+#define F82_DIM32 32
+#define F82_RANK 1
+//#define F82_RANK2 2
+//#define F82_RANK3 3
+//#define F82_RANK4 4
+
+/* "File 83" macros */
+/* Name of dataset to create in datafile */
+#define F83_DATASETNAME "ScalarArrayOfVlenStr"
+#define F83_DATASETNAME2 "CompoundArrayOfVlenStr"
+/* Dataset dimensions */
+#define F83_DIM 5
+#define F83_RANK 1
+#define F83_ARRAYDIM 3
+
static void
gent_group(void)
{
@@ -7023,16 +7044,16 @@ gent_fs_strategy_threshold(void)
/*
* Create a file with new format:
- * Create one dataset with (set_chunk, fixed dims, null max. dims)
- * so that Fixed Array indexing will be used.
- * Create one dataset with (set_chunk, fixed dims, null max. dims, filter)
- * so that Fixed Array indexing will be used.
+ * Create one dataset with (set_chunk, fixed dims, null max. dims)
+ * so that Fixed Array indexing will be used.
+ * Create one dataset with (set_chunk, fixed dims, null max. dims, filter)
+ * so that Fixed Array indexing will be used.
* Create one dataset with (set_chunk, fixed dims, fixed max. dims)
- * so that Fixed Array indexing will be used.
- *
+ * so that Fixed Array indexing will be used.
+ *
* Modifications:
- * Fixed Array indexing will be used for chunked dataset
- * with fixed max. dims setting.
+ * Fixed Array indexing will be used for chunked dataset
+ * with fixed max. dims setting.
*
*/
static void
@@ -7062,7 +7083,7 @@ gent_dataset_idx(void)
assert(ret >= 0);
/* dataset with fixed dimensions */
- dims[0] = F68a_DIM20;
+ dims[0] = F68a_DIM20;
dims[1] = F68a_DIM10;
space = H5Screate_simple(RANK, dims, NULL);
@@ -7075,7 +7096,7 @@ gent_dataset_idx(void)
H5Sclose(space);
/* dataset with non-fixed dimensions */
- maxdims[0] = F68a_DIM200;
+ maxdims[0] = F68a_DIM200;
maxdims[1] = F68a_DIM100;
space = H5Screate_simple(RANK, dims, maxdims);
@@ -9838,6 +9859,408 @@ gent_intsfourdims(void)
H5Fclose(fid);
}
+/*-------------------------------------------------------------------------
+ * Function: gent_compound_complex2
+ *
+ * Purpose: Generate a file to be used in testing compound datatypes of
+ * various sizes, dimensions, member types and nesting.
+ *-------------------------------------------------------------------------
+ */
+static void gent_compound_complex2(void)
+{
+ /* Third-level nested compound */
+ typedef struct {
+ short deep_nested_short[10];
+ int deep_nested_int[10];
+ long deep_nested_long[10];
+ double deep_nested_double[10];
+ float deep_nested_float[10];
+ } third_level_compound;
+
+ /* Second-level multiply-nested compounds */
+ typedef struct {
+ unsigned int multiple_nested_a[5];
+ int multiple_nested_b[5];
+ unsigned long multiple_nested_c[5];
+ long multiple_nested_d[5];
+ } further_nested;
+
+ typedef struct {
+ char further_nested_string[11];
+ char further_nested_string_array[4][13];
+ third_level_compound deep_nest;
+ } further_nested2;
+
+ /* First First-level nested compound */
+ typedef struct
+ {
+ double nested_a;
+ char nested_string[23];
+ char nested_string_array[4][12];
+ } nested_compound;
+
+ /* Second First-level nested compound */
+ typedef struct
+ {
+ float a;
+ further_nested b;
+ further_nested2 c;
+ } multiple_nested_compound;
+
+ /* Compound datatype with different member types */
+ typedef struct
+ {
+ /* Arrays nested inside compound */
+ unsigned int a[4];
+ int b[6];
+ float c[2][4];
+ nested_compound d; /* Compound inside compound */
+ multiple_nested_compound e; /* Compound inside compound with further nested compound */
+ } compound;
+
+ compound buf[F82_DIM32]; /* compound */
+
+ hid_t file, type=-1, space=-1, dset=-1;
+ hid_t dset_array_a, dset_array_b, dset_array_c;
+ hid_t cmpd_tid1 = -1, cmpd_tid2 = -1, cmpd_tid3 = -1;
+ size_t i;
+ size_t j, k;
+ unsigned dset_array_ndims;
+ hsize_t dset_array_a_dims[1], dset_array_b_dims[1], dset_array_c_dims[2];
+ hsize_t nelmts = F82_DIM32;
+
+ file = H5Fcreate(FILE82, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
+
+ if ((space = H5Screate_simple(F82_RANK, &nelmts, NULL)) >= 0) {
+ /* CompoundComplex1D */
+ if ((type = H5Tcreate(H5T_COMPOUND, sizeof(compound))) >= 0) {
+ hid_t str_type, array;
+ hsize_t dims[1];
+ hid_t nest1, nest2;
+
+ /* Insert top-level array members */
+ dset_array_ndims = 1; dset_array_a_dims[0] = 4;
+ dset_array_a = H5Tarray_create2(H5T_STD_U32LE, dset_array_ndims, dset_array_a_dims);
+ H5Tinsert(type, "a", HOFFSET(compound, a), dset_array_a);
+ H5Tclose(dset_array_a);
+
+ dset_array_ndims = 1; dset_array_b_dims[0] = 6;
+ dset_array_b = H5Tarray_create2(H5T_STD_I32LE, dset_array_ndims, dset_array_b_dims);
+ H5Tinsert(type, "b", HOFFSET(compound, b), dset_array_b);
+ H5Tclose(dset_array_b);
+
+ dset_array_ndims = 2; dset_array_c_dims[0] = 2; dset_array_c_dims[1] = 4;
+ dset_array_c = H5Tarray_create2(H5T_IEEE_F32LE, dset_array_ndims, dset_array_c_dims);
+ H5Tinsert(type, "c", HOFFSET(compound, c), dset_array_c);
+ H5Tclose(dset_array_c);
+
+ /* Insert first nested compound */
+ cmpd_tid1 = H5Tcreate(H5T_COMPOUND, sizeof(nested_compound));
+
+ H5Tinsert(cmpd_tid1, "nested_double", HOFFSET(nested_compound, nested_a), H5T_IEEE_F64LE);
+
+ dims[0] = 1;
+ str_type = mkstr(23, H5T_STR_NULLTERM);
+ array = H5Tarray_create2(str_type, 1, dims);
+ H5Tinsert(cmpd_tid1, "nested_string", HOFFSET(nested_compound, nested_string), array);
+ H5Tclose(array);
+ H5Tclose(str_type);
+
+ dims[0] = 4;
+ str_type = mkstr(12, H5T_STR_NULLTERM);
+ array = H5Tarray_create2(str_type, 1, dims);
+ H5Tinsert(cmpd_tid1, "nested_string_array", HOFFSET(nested_compound, nested_string_array), array);
+ H5Tclose(array);
+ H5Tclose(str_type);
+
+ H5Tinsert(type, "nested_compound", HOFFSET(compound, d), cmpd_tid1);
+
+ /* Insert second nested compound */
+ cmpd_tid2 = H5Tcreate(H5T_COMPOUND, sizeof(multiple_nested_compound));
+
+ H5Tinsert(cmpd_tid2, "nested_float", HOFFSET(multiple_nested_compound, a), H5T_IEEE_F32LE);
+
+ /* Add first further nested compound */
+ nest1 = H5Tcreate(H5T_COMPOUND, sizeof(further_nested));
+
+ dims[0] = 5;
+ array = H5Tarray_create2(H5T_STD_U32LE, 1, dims);
+ H5Tinsert(nest1, "nested_unsigned_int", HOFFSET(further_nested, multiple_nested_a), array);
+ H5Tclose(array);
+
+ array = H5Tarray_create2(H5T_STD_I32LE, 1, dims);
+ H5Tinsert(nest1, "nested_int", HOFFSET(further_nested, multiple_nested_b), array);
+ H5Tclose(array);
+
+ array = H5Tarray_create2(H5T_STD_U64LE, 1, dims);
+ H5Tinsert(nest1, "nested_unsigned_long", HOFFSET(further_nested, multiple_nested_c), array);
+ H5Tclose(array);
+
+ array = H5Tarray_create2(H5T_STD_I64LE, 1, dims);
+ H5Tinsert(nest1, "nested_long", HOFFSET(further_nested, multiple_nested_d), array);
+ H5Tclose(array);
+
+ H5Tinsert(cmpd_tid2, "further_nested_compoundA", HOFFSET(multiple_nested_compound, b), nest1);
+ H5Tclose(nest1);
+
+ /* Add second further nested compound */
+ nest2 = H5Tcreate(H5T_COMPOUND, sizeof(further_nested2));
+
+ dims[0] = 1;
+ str_type = mkstr(11, H5T_STR_NULLTERM);
+ array = H5Tarray_create2(str_type, 1, dims);
+ H5Tinsert(nest2, "nested_string", HOFFSET(further_nested2, further_nested_string), array);
+ H5Tclose(array);
+ H5Tclose(str_type);
+
+ dims[0] = 4;
+ str_type = mkstr(13, H5T_STR_NULLTERM);
+ array = H5Tarray_create2(str_type, 1, dims);
+ H5Tinsert(nest2, "nested_string_array", HOFFSET(further_nested2, further_nested_string_array), array);
+ H5Tclose(array);
+ H5Tclose(str_type);
+
+ /* Add a final third-level nested compound to this second-level compound */
+ cmpd_tid3 = H5Tcreate(H5T_COMPOUND, sizeof(third_level_compound));
+
+ dims[0] = 10;
+ array = H5Tarray_create2(H5T_STD_I16LE, 1, dims);
+ H5Tinsert(cmpd_tid3, "deep_nested_short", HOFFSET(third_level_compound, deep_nested_short), array);
+ H5Tclose(array);
+
+ array = H5Tarray_create2(H5T_STD_I32LE, 1, dims);
+ H5Tinsert(cmpd_tid3, "deep_nested_int", HOFFSET(third_level_compound, deep_nested_int), array);
+ H5Tclose(array);
+
+ array = H5Tarray_create2(H5T_STD_I64LE, 1, dims);
+ H5Tinsert(cmpd_tid3, "deep_nested_long", HOFFSET(third_level_compound, deep_nested_long), array);
+ H5Tclose(array);
+
+ array = H5Tarray_create2(H5T_IEEE_F64LE, 1, dims);
+ H5Tinsert(cmpd_tid3, "deep_nested_double", HOFFSET(third_level_compound, deep_nested_double), array);
+ H5Tclose(array);
+
+ array = H5Tarray_create2(H5T_IEEE_F32LE, 1, dims);
+ H5Tinsert(cmpd_tid3, "deep_nested_float", HOFFSET(third_level_compound, deep_nested_float), array);
+ H5Tclose(array);
+
+ H5Tinsert(nest2, "deep_nested_compound", HOFFSET(further_nested2, deep_nest), cmpd_tid3);
+
+ H5Tinsert(cmpd_tid2, "further_nested_compoundB", HOFFSET(multiple_nested_compound, c), nest2);
+ H5Tclose(nest2);
+
+ H5Tinsert(type, "multiple_nested_compound", HOFFSET(compound, e), cmpd_tid2);
+
+
+ if ((dset = H5Dcreate2(file, F82_DATASETNAME, type, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) >= 0) {
+ for(i = 0; i < nelmts; i++) {
+ for (j = 0; j < dset_array_a_dims[0]; j++)
+ buf[i].a[j] = (unsigned int)(j + i*10);
+ for (j = 0; j < dset_array_b_dims[0]; j++)
+ buf[i].b[j] = (int)(j - i*10);
+ for (j = 0; j < dset_array_c_dims[0]; j++)
+ for (k = 0; k < dset_array_c_dims[1]; k++)
+ buf[i].c[j][k] = (float)(j + k + i*10) + (float)(j) * 0.1F;
+
+ /* Set up first nested compound */
+ buf[i].d.nested_a = (double) i;
+
+ strcpy(buf[i].d.nested_string, "This is a test string.");
+
+ for (j = 0; j < 4; j++)
+ strcpy(buf[i].d.nested_string_array[j], "String test");
+
+ /* Set up multiple nested compound */
+ buf[i].e.a = (float) i;
+
+ for (j = 0; j < 5; j++) {
+ buf[i].e.b.multiple_nested_a[j] = (unsigned int)(j + i*10);
+ buf[i].e.b.multiple_nested_b[j] = (int)(j - i*10);
+ buf[i].e.b.multiple_nested_c[j] = (unsigned long)(j + i*10);
+ buf[i].e.b.multiple_nested_d[j] = (long)(j - i*10);
+ }
+
+ strcpy(buf[i].e.c.further_nested_string, "1234567890");
+ for (j = 0; j < 4; j++)
+ strcpy(buf[i].e.c.further_nested_string_array[j], "STRING ARRAY");
+
+ for (j = 0; j < 10; j++) {
+ buf[i].e.c.deep_nest.deep_nested_short[j] = (short)(j + i*10);
+ buf[i].e.c.deep_nest.deep_nested_int[j] = (int)(j - i*10);
+ buf[i].e.c.deep_nest.deep_nested_long[j] = (long)(j + i*10);
+ buf[i].e.c.deep_nest.deep_nested_double[j] = (double)(j + i*10);
+ buf[i].e.c.deep_nest.deep_nested_float[j] = (float)(j + i*10);
+ }
+ }
+
+ if (H5Dwrite(dset, type, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0)
+ fprintf(stderr, "gent_tcompound_complex2 H5Dwrite failed\n");
+
+ H5Dclose(dset);
+ }
+ H5Tclose(type);
+ }
+ H5Tclose(cmpd_tid1);
+ H5Tclose(cmpd_tid2);
+ H5Tclose(cmpd_tid3);
+ H5Sclose(space);
+ }
+
+// /* CompoundComplex2D */
+// if ((type = H5Tcreate(H5T_COMPOUND, sizeof(s_t))) >= 0) {
+// H5Tinsert(type, "a", HOFFSET(s_t, a), H5T_STD_B8LE);
+// H5Tinsert(type, "b", HOFFSET(s_t, b), H5T_STD_B16LE);
+// H5Tinsert(type, "c", HOFFSET(s_t, c), H5T_STD_B32LE);
+// H5Tinsert(type, "d", HOFFSET(s_t, d), H5T_STD_B64LE);
+// if ((space = H5Screate_simple(F82_RANK2, &nelmts, NULL)) >= 0) {
+// if ((dset = H5Dcreate2(file, "compound_1", type, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) >= 0) {
+// for(i = 0; i < nelmts; i++) {
+// buf5[i].a = (unsigned char)0xff ^ (unsigned char)i;
+// buf5[i].b = (unsigned int)0xffff ^ (unsigned int)(i * 16);
+// buf5[i].c = (unsigned long)0xffffffff ^ (unsigned long)(i * 32);
+// buf5[i].d = (unsigned long long)0xffffffffffffffff ^ (unsigned long long)(i * 64);
+// }
+//
+// H5Dwrite(dset, type, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf5);
+// H5Dclose(dset);
+// }
+// H5Sclose(space);
+// }
+// H5Tclose(type);
+// }
+//
+// /* CompoundComplex3D */
+// if ((type = H5Tcreate(H5T_COMPOUND, sizeof(s_t))) >= 0) {
+// H5Tinsert(type, "a", HOFFSET(s_t, a), H5T_STD_B8LE);
+// H5Tinsert(type, "b", HOFFSET(s_t, b), H5T_STD_B16LE);
+// H5Tinsert(type, "c", HOFFSET(s_t, c), H5T_STD_B32LE);
+// H5Tinsert(type, "d", HOFFSET(s_t, d), H5T_STD_B64LE);
+// if ((space = H5Screate_simple(F82_RANK3, &nelmts, NULL)) >= 0) {
+// if ((dset = H5Dcreate2(file, "compound_1", type, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) >= 0) {
+// for(i = 0; i < nelmts; i++) {
+// buf5[i].a = (unsigned char)0xff ^ (unsigned char)i;
+// buf5[i].b = (unsigned int)0xffff ^ (unsigned int)(i * 16);
+// buf5[i].c = (unsigned long)0xffffffff ^ (unsigned long)(i * 32);
+// buf5[i].d = (unsigned long long)0xffffffffffffffff ^ (unsigned long long)(i * 64);
+// }
+//
+// H5Dwrite(dset, type, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf5);
+// H5Dclose(dset);
+// }
+// H5Sclose(space);
+// }
+// H5Tclose(type);
+// }
+//
+// /* CompoundComplex4D */
+// if ((type = H5Tcreate(H5T_COMPOUND, sizeof(s_t))) >= 0) {
+// H5Tinsert(type, "a", HOFFSET(s_t, a), H5T_STD_B8LE);
+// H5Tinsert(type, "b", HOFFSET(s_t, b), H5T_STD_B16LE);
+// H5Tinsert(type, "c", HOFFSET(s_t, c), H5T_STD_B32LE);
+// H5Tinsert(type, "d", HOFFSET(s_t, d), H5T_STD_B64LE);
+// if ((space = H5Screate_simple(F82_RANK4, &nelmts, NULL)) >= 0) {
+// if ((dset = H5Dcreate2(file, "compound_1", type, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) >= 0) {
+// for(i = 0; i < nelmts; i++) {
+// buf5[i].a = (unsigned char)0xff ^ (unsigned char)i;
+// buf5[i].b = (unsigned int)0xffff ^ (unsigned int)(i * 16);
+// buf5[i].c = (unsigned long)0xffffffff ^ (unsigned long)(i * 32);
+// buf5[i].d = (unsigned long long)0xffffffffffffffff ^ (unsigned long long)(i * 64);
+// }
+//
+// H5Dwrite(dset, type, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf5);
+// H5Dclose(dset);
+// }
+// H5Sclose(space);
+// }
+// H5Tclose(type);
+// }
+
+ H5Fclose(file);
+}
+
+/*-------------------------------------------------------------------------
+ * Function: gent_vlenstr_array
+ *
+ * Purpose: Generate a file to be used in testing Arrays of variable
+ * length strings.
+ *-------------------------------------------------------------------------
+ */
+static void gent_vlenstr_array(void)
+{
+ /* Compound datatype with different member types */
+ typedef struct compound
+ {
+ /* Array of variable-length strings*/
+ const char *vlen_array[F83_ARRAYDIM];
+ } compound;
+ compound buf[F83_DIM];
+
+ const char *test[F83_ARRAYDIM] = {
+ "This is a variable-length test string.",
+ "This test string is also variable-length.",
+ "A final test of variable-length strings. This string is longer than the others."
+ };
+ const char *buffer[F83_DIM*F83_ARRAYDIM];
+
+ hid_t file, type=-1, space=-1, dset=-1;
+ hid_t cmpd_tid1, array_tid;
+ int i, j;
+
+ hsize_t dims[] = {F83_DIM}, arraydim[] = {F83_ARRAYDIM};
+ /* Initialize scalar data */
+ for (i = 0; i < F83_DIM; i++)
+ for (j = 0; j < 3; j++)
+ buffer[j + 3*i] = test[j];
+
+ /* Initialize compound data */
+ for (i = 0; i < F83_DIM; i++)
+ for (j = 0; j < 3; j++)
+ buf[i].vlen_array[j] = test[j];
+
+ file = H5Fcreate(FILE83, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
+
+ if ((space = H5Screate_simple(F83_RANK, dims, NULL)) >= 0) {
+ array_tid = H5Tcopy(H5T_C_S1);
+ H5Tset_size(array_tid, H5T_VARIABLE);
+
+ /* ScalarArrayOfVlenStr */
+ if ((type = H5Tarray_create2(array_tid, F83_RANK, arraydim)) >= 0) {
+ if ((dset = H5Dcreate2(file, F83_DATASETNAME, type, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) >= 0) {
+ if (H5Dwrite(dset, type, H5S_ALL, H5S_ALL, H5P_DEFAULT, buffer) < 0)
+ fprintf(stderr, "gent_vlenstr_array H5Dwrite failed\n");
+
+ H5Dclose(dset);
+ }
+ H5Tclose(type);
+ }
+ H5Tclose(array_tid);
+ H5Sclose(space);
+ }
+
+ if ((space = H5Screate_simple(F83_RANK, dims, NULL)) >= 0) {
+ /* CompoundArrayOfVlenStr */
+ if ((type = H5Tcreate(H5T_COMPOUND, sizeof(compound))) >= 0) {
+ cmpd_tid1 = H5Tcopy(H5T_C_S1);
+ H5Tset_size(cmpd_tid1, H5T_VARIABLE);
+
+ array_tid = H5Tarray_create2(cmpd_tid1, F83_RANK, arraydim);
+ H5Tinsert(type, "vlen_str_array", HOFFSET(compound, vlen_array), array_tid);
+
+ if ((dset = H5Dcreate2(file, F83_DATASETNAME2, type, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) >= 0) {
+ if (H5Dwrite(dset, type, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0)
+ fprintf(stderr, "gent_vlenstr_array H5Dwrite failed\n");
+
+ H5Dclose(dset);
+ }
+ H5Tclose(cmpd_tid1);
+ H5Tclose(type);
+ }
+ H5Sclose(space);
+ }
+
+ H5Fclose(file);
+}
+
/*-------------------------------------------------------------------------
* Function: main
@@ -9892,9 +10315,11 @@ int main(void)
gent_multi();
gent_large_objname();
gent_vlstr();
+ gent_vlenstr_array();
gent_char();
gent_attr_all();
gent_compound_complex();
+ gent_compound_complex2();
gent_named_dtype_attr();
gent_null_space();
gent_zero_dim_size();
diff --git a/tools/h5dump/testh5dump.sh.in b/tools/h5dump/testh5dump.sh.in
index 944fb85..9108f44 100644
--- a/tools/h5dump/testh5dump.sh.in
+++ b/tools/h5dump/testh5dump.sh.in
@@ -104,6 +104,7 @@ $SRC_H5DUMP_TESTFILES/tcmpdattrintsize.h5
$SRC_H5DUMP_TESTFILES/tcmpdintsize.h5
$SRC_H5DUMP_TESTFILES/tcompound.h5
$SRC_H5DUMP_TESTFILES/tcompound_complex.h5
+$SRC_H5DUMP_TESTFILES/tcompound_complex2.h5
$SRC_H5DUMP_TESTFILES/tdatareg.h5
$SRC_H5DUMP_TESTFILES/tdset.h5
$SRC_H5DUMP_TESTFILES/tempty.h5
@@ -169,6 +170,7 @@ $SRC_H5DUMP_TESTFILES/tvldtypes2.h5
$SRC_H5DUMP_TESTFILES/tvldtypes3.h5
$SRC_H5DUMP_TESTFILES/tvldtypes4.h5
$SRC_H5DUMP_TESTFILES/tvldtypes5.h5
+$SRC_H5DUMP_TESTFILES/tvlenstr_array.h5
$SRC_H5DUMP_TESTFILES/tvlstr.h5
$SRC_H5DUMP_TESTFILES/tvms.h5
"
@@ -229,6 +231,7 @@ $SRC_H5DUMP_TESTFILES/tcomp-1.ddl
$SRC_H5DUMP_TESTFILES/tcomp-2.ddl
$SRC_H5DUMP_TESTFILES/tcomp-3.ddl
$SRC_H5DUMP_TESTFILES/tcomp-4.ddl
+$SRC_H5DUMP_TESTFILES/tcompound_complex2.ddl
$SRC_H5DUMP_TESTFILES/tcompact.ddl
$SRC_H5DUMP_TESTFILES/tcontents.ddl
$SRC_H5DUMP_TESTFILES/tcontiguos.ddl
@@ -342,6 +345,7 @@ $SRC_H5DUMP_TESTFILES/tvldtypes2.ddl
$SRC_H5DUMP_TESTFILES/tvldtypes3.ddl
$SRC_H5DUMP_TESTFILES/tvldtypes4.ddl
$SRC_H5DUMP_TESTFILES/tvldtypes5.ddl
+$SRC_H5DUMP_TESTFILES/tvlenstr_array.ddl
$SRC_H5DUMP_TESTFILES/tvlstr.ddl
$SRC_H5DUMP_TESTFILES/tvms.ddl
$SRC_H5DUMP_TESTFILES/twidedisplay.ddl
@@ -419,7 +423,7 @@ CLEAN_TESTFILES_AND_TESTDIR()
# skip rm if srcdir is same as destdir
# this occurs when build/test performed in source dir and
# make cp fail
- SDIR=`$DIRNAME $tstfile`
+ SDIR=$SRC_H5DUMP_TESTFILES
INODE_SDIR=`$LS -i -d $SDIR | $AWK -F' ' '{print $1}'`
INODE_DDIR=`$LS -i -d $TESTDIR | $AWK -F' ' '{print $1}'`
if [ "$INODE_SDIR" != "$INODE_DDIR" ]; then
@@ -1034,6 +1038,7 @@ TOOLTEST tcomp-2.ddl --enable-error-stack -N /type1 --any_path /type2 --any_path
TOOLTEST4 tcomp-3.ddl --enable-error-stack -t /#6632 -g /group2 tcompound.h5
# test complicated compound datatype
TOOLTEST tcomp-4.ddl --enable-error-stack tcompound_complex.h5
+TOOLTEST tcompound_complex.ddl --enable-error-stack tcompound_complex2.h5
# tests for bitfields and opaque data types
TOOLTEST tbitnopaque.ddl --enable-error-stack tbitnopaque.h5
@@ -1068,6 +1073,7 @@ TOOLTEST tvldtypes5.ddl --enable-error-stack tvldtypes5.h5
#test for file with variable length string data
TOOLTEST tvlstr.ddl --enable-error-stack tvlstr.h5
+TOOLTEST tvlenstr_array.ddl --enable-error-stack tvlenstr_array.h5
# test for files with array data
TOOLTEST tarray1.ddl --enable-error-stack tarray1.h5
diff --git a/tools/h5dump/testh5dumppbits.sh.in b/tools/h5dump/testh5dumppbits.sh.in
index 4211c63..446020a 100644
--- a/tools/h5dump/testh5dumppbits.sh.in
+++ b/tools/h5dump/testh5dumppbits.sh.in
@@ -190,7 +190,7 @@ CLEAN_TESTFILES_AND_TESTDIR()
# skip rm if srcdir is same as destdir
# this occurs when build/test performed in source dir and
# make cp fail
- SDIR=`$DIRNAME $tstfile`
+ SDIR=$SRC_H5DUMP_TESTFILES/pbits
INODE_SDIR=`$LS -i -d $SDIR | $AWK -F' ' '{print $1}'`
INODE_DDIR=`$LS -i -d $TESTDIR | $AWK -F' ' '{print $1}'`
if [ "$INODE_SDIR" != "$INODE_DDIR" ]; then
diff --git a/tools/h5dump/testh5dumpvds.sh.in b/tools/h5dump/testh5dumpvds.sh.in
index 850c03a..16411f5 100644
--- a/tools/h5dump/testh5dumpvds.sh.in
+++ b/tools/h5dump/testh5dumpvds.sh.in
@@ -169,7 +169,7 @@ CLEAN_TESTFILES_AND_TESTDIR()
# skip rm if srcdir is same as destdir
# this occurs when build/test performed in source dir and
# make cp fail
- SDIR=`$DIRNAME $tstfile`
+ SDIR=$SRC_H5DUMP_TESTFILES/vds
INODE_SDIR=`$LS -i -d $SDIR | $AWK -F' ' '{print $1}'`
INODE_DDIR=`$LS -i -d $TESTDIR | $AWK -F' ' '{print $1}'`
if [ "$INODE_SDIR" != "$INODE_DDIR" ]; then
diff --git a/tools/h5dump/testh5dumpxml.sh.in b/tools/h5dump/testh5dumpxml.sh.in
index 1efde85..33a67c0 100644
--- a/tools/h5dump/testh5dumpxml.sh.in
+++ b/tools/h5dump/testh5dumpxml.sh.in
@@ -221,7 +221,7 @@ CLEAN_TESTFILES_AND_TESTDIR()
# skip rm if srcdir is same as destdir
# this occurs when build/test performed in source dir and
# make cp fail
- SDIR=`$DIRNAME $tstfile`
+ SDIR=$SRC_H5DUMP_TESTFILES
INODE_SDIR=`$LS -i -d $SDIR | $AWK -F' ' '{print $1}'`
INODE_DDIR=`$LS -i -d $TESTDIR | $AWK -F' ' '{print $1}'`
if [ "$INODE_SDIR" != "$INODE_DDIR" ]; then
diff --git a/tools/h5format_convert/CMakeTests.cmake b/tools/h5format_convert/CMakeTests.cmake
index 0621b30..37ee824 100644
--- a/tools/h5format_convert/CMakeTests.cmake
+++ b/tools/h5format_convert/CMakeTests.cmake
@@ -63,26 +63,13 @@
add_custom_target(h5fc-files ALL COMMENT "Copying files needed by h5fc tests")
foreach (ddl_file ${HDF5_REFERENCE_FILES})
- set (ddldest "${PROJECT_BINARY_DIR}/testfiles/${ddl_file}")
- #message (STATUS " Translating ${ddl_file}")
- add_custom_command (
- TARGET h5fc-files
- POST_BUILD
- COMMAND ${CMAKE_COMMAND}
- ARGS -E copy_if_different ${HDF5_TOOLS_H5FC_SOURCE_DIR}/testfiles/${ddl_file} ${ddldest}
- )
+ HDFTEST_COPY_FILE("${HDF5_TOOLS_H5FC_SOURCE_DIR}/testfiles/${ddl_file}" "${PROJECT_BINARY_DIR}/testfiles/${ddl_file}" "h5fc_files")
endforeach (ddl_file ${HDF5_REFERENCE_FILES})
foreach (h5_file ${HDF5_REFERENCE_TEST_FILES})
- set (dest "${PROJECT_BINARY_DIR}/testfiles/${h5_file}")
- #message (STATUS " Copying ${h5_file}")
- add_custom_command (
- TARGET h5fc-files
- POST_BUILD
- COMMAND ${CMAKE_COMMAND}
- ARGS -E copy_if_different ${HDF5_TOOLS_H5FC_SOURCE_DIR}/testfiles/${h5_file} ${dest}
- )
+ HDFTEST_COPY_FILE("${HDF5_TOOLS_H5FC_SOURCE_DIR}/testfiles/${h5_file}" "${PROJECT_BINARY_DIR}/testfiles/${h5_file}" "h5fc_files")
endforeach (h5_file ${HDF5_REFERENCE_TEST_FILES})
+ add_custom_target(h5fc_files ALL COMMENT "Copying files needed by h5fc tests" DEPENDS ${h5fc_files_list})
##############################################################################
##############################################################################
diff --git a/tools/h5format_convert/h5fc_gentest.c b/tools/h5format_convert/h5fc_gentest.c
index 8d3c5ae..97def9a 100644
--- a/tools/h5format_convert/h5fc_gentest.c
+++ b/tools/h5format_convert/h5fc_gentest.c
@@ -471,9 +471,9 @@ gen_err_level(const char *fname)
hsize_t extent[2] = {0, 0};
start[0] = 0;
- start[1] = n;
+ start[1] = (hsize_t)n;
extent[0] = 1;
- extent[1] = n+1;
+ extent[1] = (hsize_t)(n + 1);
/* Set current dimension sizes for the dataset */
if(H5Dset_extent(did, extent) < 0)
diff --git a/tools/h5import/CMakeTests.cmake b/tools/h5import/CMakeTests.cmake
index d03b233..ef029e9 100644
--- a/tools/h5import/CMakeTests.cmake
+++ b/tools/h5import/CMakeTests.cmake
@@ -63,37 +63,17 @@
file (MAKE_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles")
foreach (conf_file ${HDF5_REFERENCE_CONF_FILES})
- set (dest "${PROJECT_BINARY_DIR}/testfiles/${conf_file}")
- #message (STATUS " Copying ${conf_file}")
- add_custom_command (
- TARGET h5import
- POST_BUILD
- COMMAND ${CMAKE_COMMAND}
- ARGS -E copy_if_different ${HDF5_TOOLS_H5IMPORT_SOURCE_DIR}/testfiles/${conf_file} ${dest}
- )
+ HDFTEST_COPY_FILE("${HDF5_TOOLS_H5IMPORT_SOURCE_DIR}/testfiles/${conf_file}" "${PROJECT_BINARY_DIR}/testfiles/${conf_file}" "h5import_files")
endforeach (conf_file ${HDF5_REFERENCE_CONF_FILES})
foreach (txt_file ${HDF5_REFERENCE_TXT_FILES})
- set (dest "${PROJECT_BINARY_DIR}/testfiles/${txt_file}")
- #message (STATUS " Copying ${txt_file}")
- add_custom_command (
- TARGET h5import
- POST_BUILD
- COMMAND ${CMAKE_COMMAND}
- ARGS -E copy_if_different ${HDF5_TOOLS_H5IMPORT_SOURCE_DIR}/testfiles/${txt_file} ${dest}
- )
+ HDFTEST_COPY_FILE("${HDF5_TOOLS_H5IMPORT_SOURCE_DIR}/testfiles/${txt_file}" "${PROJECT_BINARY_DIR}/testfiles/${txt_file}" "h5import_files")
endforeach (txt_file ${HDF5_REFERENCE_TXT_FILES})
foreach (h5_file ${HDF5_REFERENCE_TEST_FILES})
- set (dest "${PROJECT_BINARY_DIR}/testfiles/${h5_file}")
- #message (STATUS " Copying ${h5_file}")
- add_custom_command (
- TARGET h5import
- POST_BUILD
- COMMAND ${CMAKE_COMMAND}
- ARGS -E copy_if_different ${HDF5_TOOLS_H5IMPORT_SOURCE_DIR}/testfiles/${h5_file} ${dest}
- )
+ HDFTEST_COPY_FILE("${HDF5_TOOLS_H5IMPORT_SOURCE_DIR}/testfiles/${h5_file}" "${PROJECT_BINARY_DIR}/testfiles/${h5_file}" "h5import_files")
endforeach (h5_file ${HDF5_REFERENCE_TEST_FILES})
+ add_custom_target(h5import_files ALL COMMENT "Copying files needed by h5import tests" DEPENDS ${h5import_files_list})
##############################################################################
##############################################################################
@@ -106,7 +86,7 @@
add_test (NAME H5IMPORT-${testname} COMMAND $<TARGET_FILE:h5import> ${importfile} -c ${conffile} -o ${testfile})
if (NOT "${last_test}" STREQUAL "")
set_tests_properties (H5IMPORT-${testname} PROPERTIES DEPENDS H5IMPORT-h5importtest)
- endif (NOT "${last_test}" STREQUAL "")
+ endif ()
else (HDF5_ENABLE_USING_MEMCHECKER)
add_test (
NAME H5IMPORT-${testname}-clear-objects
diff --git a/tools/h5import/h5import.c b/tools/h5import/h5import.c
index 9617df3..d1aab0c 100644
--- a/tools/h5import/h5import.c
+++ b/tools/h5import/h5import.c
@@ -1439,7 +1439,7 @@ static int processConfigurationFile(char *infile, struct Input *in)
#endif
if (HDstrcmp("H5T_VARIABLE;", temp)) {
char *more = temp;
- ival = HDstrtol(more, &more, 10);
+ ival = (int)HDstrtol(more, &more, 10);
if (getInputSize(in, ival) == -1) {
(void) HDfprintf(stderr, err5b, infile);
goto error;
@@ -2279,13 +2279,13 @@ static int parseDimensions(struct Input *in, char *strm)
HDstrncpy(temp, strm, sizeof(temp));
temp[sizeof(temp) - 1] = '\0';
in->sizeOfDimension[i++]
- = HDstrtol(HDstrtok (temp, delimiter), NULL, BASE_10);
+ = HDstrtoull(HDstrtok (temp, delimiter), NULL, BASE_10);
while (1) {
token = HDstrtok (NULL, delimiter);
if (token == NULL)
break;
- in->sizeOfDimension[i++] = HDstrtol(token, NULL, BASE_10);
+ in->sizeOfDimension[i++] = HDstrtoull(token, NULL, BASE_10);
}
return (0);
}
@@ -3121,7 +3121,7 @@ static int getRank(struct Input *in, FILE *strm)
/* same as getChunkedDimensionSizes. But defined separately for extensibility */
static int getDimensionSizes(struct Input *in, FILE *strm)
{
- int ival;
+ unsigned long long ullval;
int i = 0;
const char *err1 = "Unable to allocate dynamic memory.\n";
@@ -3132,8 +3132,8 @@ static int getDimensionSizes(struct Input *in, FILE *strm)
return (-1);
}
- while (fscanf(strm, "%d", (&ival)) == 1)
- in->sizeOfDimension[i++] = ival;
+ while (fscanf(strm, "%llu", (&ullval)) == 1)
+ in->sizeOfDimension[i++] = ullval;
if (in->rank != i) {
(void) HDfprintf(stderr, "%s", err2);
@@ -3144,7 +3144,7 @@ static int getDimensionSizes(struct Input *in, FILE *strm)
/* same as getDimensionSizes. But defined separately for extensibility */
static int getChunkedDimensionSizes(struct Input *in, FILE *strm)
{
- int ival;
+ unsigned long long ullval;
int i = 0;
const char *err1 = "Unable to allocate dynamic memory.\n";
@@ -3156,8 +3156,8 @@ static int getChunkedDimensionSizes(struct Input *in, FILE *strm)
return (-1);
}
- while (fscanf(strm, "%d", (&ival)) == 1)
- in->sizeOfChunk[i++] = ival;
+ while (fscanf(strm, "%llu", (&ullval)) == 1)
+ in->sizeOfChunk[i++] = ullval;
if (in->rank != i) {
(void) HDfprintf(stderr, "%s", err2);
@@ -3174,7 +3174,7 @@ static int getChunkedDimensionSizes(struct Input *in, FILE *strm)
static int getMaximumDimensionSizes(struct Input *in, FILE *strm)
{
- int ival;
+ long long llval;
int i = 0;
const char *err1 = "Unable to allocate dynamic memory.\n";
@@ -3186,11 +3186,11 @@ static int getMaximumDimensionSizes(struct Input *in, FILE *strm)
return (-1);
}
- while (fscanf(strm, "%d", (&ival)) == 1) {
- if (ival == -1)
+ while (fscanf(strm, "%lld", (&llval)) == 1) {
+ if (llval == -1)
in->maxsizeOfDimension[i++] = H5S_UNLIMITED;
else
- in->maxsizeOfDimension[i++] = ival;
+ in->maxsizeOfDimension[i++] = (hsize_t)llval;
}
if (in->rank != i) {
@@ -3927,7 +3927,7 @@ static int process(struct Options *opt)
return (-1);
}
HDfclose(extfile);
- H5Pset_external(proplist, in->externFilename, (off_t) 0, numOfElements * in->inputSize / 8);
+ H5Pset_external(proplist, in->externFilename, (off_t)0, numOfElements * (hsize_t)in->inputSize / 8);
}
/* create dataspace */
diff --git a/tools/h5import/h5importtest.c b/tools/h5import/h5importtest.c
index ac839fb..38fd75b 100644
--- a/tools/h5import/h5importtest.c
+++ b/tools/h5import/h5importtest.c
@@ -119,8 +119,8 @@ main(void)
#ifdef H5_SIZEOF_LONG_LONG
row4i64[i] = row4i64[i - 1] + rowi4i64;
#endif
- row4i16[i] = row4i16[i - 1] + rowi4i16;
- row4i8[i] = row4i8[i - 1] + rowi4i8;
+ row4i16[i] = (short)(row4i16[i - 1] + rowi4i16);
+ row4i8[i] = (char)(row4i8[i - 1] + rowi4i8);
}
for (j = 1; j < ncol; j++)
@@ -131,8 +131,8 @@ main(void)
#ifdef H5_SIZEOF_LONG_LONG
col4i64[j] = col4i64[j - 1] + coli4i64;
#endif
- col4i16[j] = col4i16[j - 1] + coli4i16;
- col4i8[j] = col4i8[j - 1] + coli4i8;
+ col4i16[j] = (short)(col4i16[j - 1] + coli4i16);
+ col4i8[j] = (char)(col4i8[j - 1] + coli4i8);
}
for (k = 1; k < npln; k++)
{
@@ -142,8 +142,8 @@ main(void)
#ifdef H5_SIZEOF_LONG_LONG
pln4i64[k] = pln4i64[k - 1] + plni4i64;
#endif
- pln4i16[k] = pln4i16[k - 1] + plni4i16;
- pln4i8[k] = pln4i8[k - 1] + plni4i8;
+ pln4i16[k] = (short)(pln4i16[k - 1] + plni4i16);
+ pln4i8[k] = (char)(pln4i8[k - 1] + plni4i8);
}
/*
@@ -157,8 +157,8 @@ main(void)
for (k = 0; k < npln; k++) {
b64r3[k][i][j] = row8[i] + col8[j] + pln8[k];
b32i3[k][i][j] = row4i[i] + col4i[j] + pln4i[k];
- b16i3[k][i][j] = row4i16[i] + col4i16[j] + pln4i16[k];
- b8i3[k][i][j] = row4i8[i] + col4i8[j] + pln4i8[k];
+ b16i3[k][i][j] = (short)(row4i16[i] + col4i16[j] + pln4i16[k]);
+ b8i3[k][i][j] = (char)(row4i8[i] + col4i8[j] + pln4i8[k]);
}
diff --git a/tools/h5import/h5importtestutil.sh.in b/tools/h5import/h5importtestutil.sh.in
index f2694a0..08e0c3f 100644
--- a/tools/h5import/h5importtestutil.sh.in
+++ b/tools/h5import/h5importtestutil.sh.in
@@ -161,7 +161,7 @@ CLEAN_TESTFILES_AND_TESTDIR()
# skip rm if srcdir is same as destdir
# this occurs when build/test performed in source dir and
# make cp fail
- SDIR=`$DIRNAME $tstfile`
+ SDIR=$SRC_H5IMPORT_TESTFILES
INODE_SDIR=`$LS -i -d $SDIR | $AWK -F' ' '{print $1}'`
INODE_DDIR=`$LS -i -d $TESTDIR | $AWK -F' ' '{print $1}'`
if [ "$INODE_SDIR" != "$INODE_DDIR" ]; then
diff --git a/tools/h5jam/CMakeTests.cmake b/tools/h5jam/CMakeTests.cmake
index 4459a12..6752c9a 100644
--- a/tools/h5jam/CMakeTests.cmake
+++ b/tools/h5jam/CMakeTests.cmake
@@ -22,26 +22,13 @@
file (MAKE_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles")
foreach (h5_file ${HDF5_REFERENCE_TEST_FILES})
- set (dest "${PROJECT_BINARY_DIR}/testfiles/${h5_file}")
- #message (STATUS " Copying ${h5_file}")
- add_custom_command (
- TARGET h5jam
- POST_BUILD
- COMMAND ${CMAKE_COMMAND}
- ARGS -E copy_if_different ${HDF5_TOOLS_H5JAM_SOURCE_DIR}/testfiles/${h5_file} ${dest}
- )
+ HDFTEST_COPY_FILE("${HDF5_TOOLS_H5JAM_SOURCE_DIR}/testfiles/${h5_file}" "${PROJECT_BINARY_DIR}/testfiles/${h5_file}" "h5jam_files")
endforeach (h5_file ${HDF5_REFERENCE_TEST_FILES})
foreach (txt_file ${HDF5_REFERENCE_TXT_FILES})
- set (dest "${PROJECT_BINARY_DIR}/testfiles/${txt_file}")
- #message (STATUS " Copying ${txt_file}")
- add_custom_command (
- TARGET h5jam
- POST_BUILD
- COMMAND ${CMAKE_COMMAND}
- ARGS -E copy_if_different ${HDF5_TOOLS_H5JAM_SOURCE_DIR}/testfiles/${txt_file} ${dest}
- )
+ HDFTEST_COPY_FILE("${HDF5_TOOLS_H5JAM_SOURCE_DIR}/testfiles/${txt_file}" "${PROJECT_BINARY_DIR}/testfiles/${txt_file}" "h5jam_files")
endforeach (txt_file ${HDF5_REFERENCE_TXT_FILES})
+ add_custom_target(h5jam_files ALL COMMENT "Copying files needed by h5jam tests" DEPENDS ${h5jam_files_list})
##############################################################################
##############################################################################
diff --git a/tools/h5jam/h5jamgentest.c b/tools/h5jam/h5jamgentest.c
index 7ae3169..a12b17a 100644
--- a/tools/h5jam/h5jamgentest.c
+++ b/tools/h5jam/h5jamgentest.c
@@ -248,7 +248,7 @@ gent_ub(const char * filename, size_t ub_size, size_t ub_fill)
space = H5Screate_simple(1, dims, NULL);
dataset = H5Dcreate2(group, "dset2.1", H5T_IEEE_F32BE, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
for (i = 0; i < 10; i++)
- dset2_1[i] = (float)(i*0.1F+1);
+ dset2_1[i] = (float)((float)i * 0.1F + 1.0F);
H5Dwrite(dataset, H5T_NATIVE_FLOAT, H5S_ALL, H5S_ALL, H5P_DEFAULT, dset2_1);
H5Sclose(space);
H5Dclose(dataset);
@@ -259,7 +259,7 @@ gent_ub(const char * filename, size_t ub_size, size_t ub_fill)
dataset = H5Dcreate2(group, "dset2.2", H5T_IEEE_F32BE, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
for (i = 0; i < 3; i++)
for (j = 0; j < 5; j++)
- dset2_2[i][j] = (float)((i+1)*j*0.1F);
+ dset2_2[i][j] = (float)(((float)i + 1.0F) * (float)j * 0.1F);
H5Dwrite(dataset, H5T_NATIVE_FLOAT, H5S_ALL, H5S_ALL, H5P_DEFAULT, dset2_2);
H5Sclose(space);
H5Dclose(dataset);
diff --git a/tools/h5jam/h5unjam.c b/tools/h5jam/h5unjam.c
index 8e4eac4..8f88398 100644
--- a/tools/h5jam/h5unjam.c
+++ b/tools/h5jam/h5unjam.c
@@ -347,17 +347,19 @@ done:
* Returns 0 on success, -1 on failure.
*/
herr_t
-copy_to_file( FILE *infid, FILE *ofid, ssize_t _where, ssize_t how_much )
+copy_to_file( FILE *infid, FILE *ofid, ssize_t _where, ssize_t show_much )
{
static char buf[COPY_BUF_SIZE];
+ size_t how_much;
off_t where = (off_t)_where;
off_t to;
off_t from;
herr_t ret_value = 0;
/* nothing to copy */
- if(how_much <= 0)
+ if(show_much <= 0)
goto done;
+ how_much = (size_t)show_much;
/* rewind */
HDfseek(infid, 0L, 0);
@@ -392,8 +394,8 @@ copy_to_file( FILE *infid, FILE *ofid, ssize_t _where, ssize_t how_much )
/* Update positions/size */
how_much -= bytes_read;
- from += bytes_read;
- to += bytes_read;
+ from += (off_t)bytes_read;
+ to += (off_t)bytes_read;
/* Write nchars bytes to output file */
bytes_wrote = HDfwrite(buf, (size_t)1, bytes_read, ofid);
diff --git a/tools/h5jam/testh5jam.sh.in b/tools/h5jam/testh5jam.sh.in
index 1664d6b..d8c9274 100644
--- a/tools/h5jam/testh5jam.sh.in
+++ b/tools/h5jam/testh5jam.sh.in
@@ -126,7 +126,7 @@ CLEAN_TESTFILES_AND_TESTDIR()
# skip rm if srcdir is same as destdir
# this occurs when build/test performed in source dir and
# make cp fail
- SDIR=`$DIRNAME $tstfile`
+ SDIR=$SRC_H5JAM_TESTFILES
INODE_SDIR=`$LS -i -d $SDIR | $AWK -F' ' '{print $1}'`
INODE_DDIR=`$LS -i -d $TESTDIR | $AWK -F' ' '{print $1}'`
if [ "$INODE_SDIR" != "$INODE_DDIR" ]; then
diff --git a/tools/h5ls/CMakeTests.cmake b/tools/h5ls/CMakeTests.cmake
index d704ffb..009ea79 100644
--- a/tools/h5ls/CMakeTests.cmake
+++ b/tools/h5ls/CMakeTests.cmake
@@ -97,16 +97,9 @@
# copy the list of test files
foreach (listfiles ${LIST_HDF5_TEST_FILES} ${LIST_OTHER_TEST_FILES})
get_filename_component(fname "${listfiles}" NAME)
- set (dest "${PROJECT_BINARY_DIR}/testfiles/${fname}")
- #message (STATUS " Copying ${listfiles} to ${dest}")
- add_custom_command (
- TARGET h5ls
- POST_BUILD
- COMMAND ${CMAKE_COMMAND}
- ARGS -E copy_if_different ${listfiles} ${dest}
- )
+ HDFTEST_COPY_FILE("${listfiles}" "${PROJECT_BINARY_DIR}/testfiles/${fname}" "h5ls_files")
endforeach (listfiles ${LIST_HDF5_TEST_FILES} ${LIST_OTHER_TEST_FILES})
-
+ add_custom_target(h5ls_files ALL COMMENT "Copying files needed by h5ls tests" DEPENDS ${h5ls_files_list})
##############################################################################
##############################################################################
@@ -121,10 +114,10 @@
set_tests_properties (H5LS-${resultfile} PROPERTIES WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles")
if (${resultcode} STREQUAL "1")
set_tests_properties (H5LS-${resultfile} PROPERTIES WILL_FAIL "true")
- endif (${resultcode} STREQUAL "1")
+ endif ()
if (NOT "${last_test}" STREQUAL "")
set_tests_properties (H5LS-${resultfile} PROPERTIES DEPENDS ${last_test})
- endif (NOT "${last_test}" STREQUAL "")
+ endif ()
else (HDF5_ENABLE_USING_MEMCHECKER)
add_test (
NAME H5LS-${resultfile}-clear-objects
@@ -323,7 +316,7 @@
ADD_H5_TEST (textlinksrc-6-old 0 -w80 -E textlinksrc.h5)
ADD_H5_TEST (textlinksrc-7-old 0 -w80 -E textlinksrc.h5/ext_link1)
- # tests for no-dangling-links
+ # tests for no-dangling-links
# if this option is given on dangling link, h5ls should return exit code 1
# when used alone , expect to print out help and return exit code 1
ADD_H5_TEST (textlinksrc-nodangle-1 1 -w80 --no-dangling-links textlinksrc.h5)
diff --git a/tools/h5ls/CMakeTestsVDS.cmake b/tools/h5ls/CMakeTestsVDS.cmake
index 3e85803..0d08774 100644
--- a/tools/h5ls/CMakeTestsVDS.cmake
+++ b/tools/h5ls/CMakeTestsVDS.cmake
@@ -48,16 +48,9 @@
# copy the list of test files
foreach (listfiles ${LIST_HDF5_TEST_FILES} ${LIST_OTHER_TEST_FILES})
get_filename_component(fname "${listfiles}" NAME)
- set (dest "${PROJECT_BINARY_DIR}/testfiles/vds/${fname}")
- #message (STATUS " Copying ${listfiles} to ${dest}")
- add_custom_command (
- TARGET h5ls
- POST_BUILD
- COMMAND ${CMAKE_COMMAND}
- ARGS -E copy_if_different ${HDF5_TOOLS_SRC_DIR}/testfiles/vds/${listfiles} ${dest}
- )
+ HDFTEST_COPY_FILE("${HDF5_TOOLS_SRC_DIR}/testfiles/vds/${listfiles}" "${PROJECT_BINARY_DIR}/testfiles/vds/${fname}" "h5ls_vds_files")
endforeach (listfiles ${LIST_HDF5_TEST_FILES} ${LIST_OTHER_TEST_FILES})
-
+ add_custom_target(h5ls_vds_files ALL COMMENT "Copying files needed by h5ls_vds tests" DEPENDS ${h5ls_vds_files_list})
##############################################################################
##############################################################################
@@ -72,10 +65,10 @@
set_tests_properties (H5LS-${resultfile} PROPERTIES WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles/vds")
if (${resultcode} STREQUAL "1")
set_tests_properties (H5LS-${resultfile} PROPERTIES WILL_FAIL "true")
- endif (${resultcode} STREQUAL "1")
+ endif ()
if (NOT "${last_test}" STREQUAL "")
set_tests_properties (H5LS-${resultfile} PROPERTIES DEPENDS ${last_test})
- endif (NOT "${last_test}" STREQUAL "")
+ endif ()
else (HDF5_ENABLE_USING_MEMCHECKER)
add_test (
NAME H5LS-${resultfile}-clear-objects
diff --git a/tools/h5ls/h5ls.c b/tools/h5ls/h5ls.c
index 98468c9..a032f08 100644
--- a/tools/h5ls/h5ls.c
+++ b/tools/h5ls/h5ls.c
@@ -177,66 +177,65 @@ static herr_t visit_obj(hid_t file, const char *oname, iter_t *iter);
static void
usage (void)
{
- HDfprintf(rawerrorstream, "\
-usage: %s [OPTIONS] file[/OBJECT] [file[/[OBJECT]...]\n\
- OPTIONS\n\
- -h, -?, --help Print a usage message and exit\n\
- -a, --address Print raw data address. If dataset is contiguous, address\n\
- is offset in file of beginning of raw data. If chunked,\n\
- returned list of addresses indicates offset of each chunk.\n\
- Must be used with -v, --verbose option.\n\
- Provides no information for non-dataset objects.\n\
- -d, --data Print the values of datasets\n\
- --enable-error-stack\n\
- Prints messages from the HDF5 error stack as they occur.\n\
- --follow-symlinks\n\
- Follow symbolic links (soft links and external links)\n\
- to display target object information.\n\
- Without this option, h5ls identifies a symbolic link\n\
- as a soft link or external link and prints the value\n\
- assigned to the symbolic link; it does not provide any\n\
- information regarding the target object or determine\n\
- whether the link is a dangling link.\n\
- --no-dangling-links\n\
- Must be used with --follow-symlinks option;\n\
- otherwise, h5ls shows error message and returns an exit\n\
- code of 1. \n\
- Check for any symbolic links (soft links or external links)\n\
- that do not resolve to an existing object (dataset, group,\n\
- or named datatype).\n\
- If any dangling link is found, this situation is treated\n\
- as an error and h5ls returns an exit code of 1.\n\
- -f, --full Print full path names instead of base names\n\
- -g, --group Show information about a group, not its contents\n\
- -l, --label Label members of compound datasets\n\
- -r, --recursive List all groups recursively, avoiding cycles\n\
- -s, --string Print 1-byte integer datasets as ASCII\n\
- -S, --simple Use a machine-readable output format\n\
- -wN, --width=N Set the number of columns of output\n\
- -v, --verbose Generate more verbose output\n\
- -V, --version Print version number and exit\n\
- --vfd=DRIVER Use the specified virtual file driver\n\
- -x, --hexdump Show raw data in hexadecimal format\n\
-\n\
- file/OBJECT\n\
- Each object consists of an HDF5 file name optionally followed by a\n\
- slash and an object name within the file (if no object is specified\n\
- within the file then the contents of the root group are displayed).\n\
- The file name may include a printf(3C) integer format such as\n\
- \"%%05d\" to open a file family.\n\
-\n\
- Deprecated Options\n\
- The following options have been deprecated in HDF5. While they remain\n\
- available, they have been superseded as indicated and may be removed\n\
- from HDF5 in the future. Use the indicated replacement option in all\n\
- new work; where possible, existing scripts, et cetera, should also be\n\
- updated to use the replacement option.\n\
-\n\
- -E or --external Follow external links.\n\
- Replaced by --follow-symlinks.\n\
- -e, --errors Show all HDF5 error reporting\n\
- Replaced by --enable-error-stack.\n",
- h5tools_getprogname());
+ FLUSHSTREAM(rawoutstream);
+ PRINTVALSTREAM(rawoutstream, "usage: h5ls [OPTIONS] file[/OBJECT] [file[/[OBJECT]...]\n");
+ PRINTVALSTREAM(rawoutstream, " OPTIONS\n");
+ PRINTVALSTREAM(rawoutstream, " -h, -?, --help Print a usage message and exit\n");
+ PRINTVALSTREAM(rawoutstream, " -a, --address Print raw data address. If dataset is contiguous, address\n");
+ PRINTVALSTREAM(rawoutstream, " is offset in file of beginning of raw data. If chunked,\n");
+ PRINTVALSTREAM(rawoutstream, " returned list of addresses indicates offset of each chunk.\n");
+ PRINTVALSTREAM(rawoutstream, " Must be used with -v, --verbose option.\n");
+ PRINTVALSTREAM(rawoutstream, " Provides no information for non-dataset objects.\n");
+ PRINTVALSTREAM(rawoutstream, " -d, --data Print the values of datasets\n");
+ PRINTVALSTREAM(rawoutstream, " --enable-error-stack\n");
+ PRINTVALSTREAM(rawoutstream, " Prints messages from the HDF5 error stack as they occur.\n");
+ PRINTVALSTREAM(rawoutstream, " --follow-symlinks\n");
+ PRINTVALSTREAM(rawoutstream, " Follow symbolic links (soft links and external links)\n");
+ PRINTVALSTREAM(rawoutstream, " to display target object information.\n");
+ PRINTVALSTREAM(rawoutstream, " Without this option, h5ls identifies a symbolic link\n");
+ PRINTVALSTREAM(rawoutstream, " as a soft link or external link and prints the value\n");
+ PRINTVALSTREAM(rawoutstream, " assigned to the symbolic link; it does not provide any\n");
+ PRINTVALSTREAM(rawoutstream, " information regarding the target object or determine\n");
+ PRINTVALSTREAM(rawoutstream, " whether the link is a dangling link.\n");
+ PRINTVALSTREAM(rawoutstream, " --no-dangling-links\n");
+ PRINTVALSTREAM(rawoutstream, " Must be used with --follow-symlinks option;\n");
+ PRINTVALSTREAM(rawoutstream, " otherwise, h5ls shows error message and returns an exit\n");
+ PRINTVALSTREAM(rawoutstream, " code of 1. \n");
+ PRINTVALSTREAM(rawoutstream, " Check for any symbolic links (soft links or external links)\n");
+ PRINTVALSTREAM(rawoutstream, " that do not resolve to an existing object (dataset, group,\n");
+ PRINTVALSTREAM(rawoutstream, " or named datatype).\n");
+ PRINTVALSTREAM(rawoutstream, " If any dangling link is found, this situation is treated\n");
+ PRINTVALSTREAM(rawoutstream, " as an error and h5ls returns an exit code of 1.\n");
+ PRINTVALSTREAM(rawoutstream, " -f, --full Print full path names instead of base names\n");
+ PRINTVALSTREAM(rawoutstream, " -g, --group Show information about a group, not its contents\n");
+ PRINTVALSTREAM(rawoutstream, " -l, --label Label members of compound datasets\n");
+ PRINTVALSTREAM(rawoutstream, " -r, --recursive List all groups recursively, avoiding cycles\n");
+ PRINTVALSTREAM(rawoutstream, " -s, --string Print 1-byte integer datasets as ASCII\n");
+ PRINTVALSTREAM(rawoutstream, " -S, --simple Use a machine-readable output format\n");
+ PRINTVALSTREAM(rawoutstream, " -wN, --width=N Set the number of columns of output\n");
+ PRINTVALSTREAM(rawoutstream, " -v, --verbose Generate more verbose output\n");
+ PRINTVALSTREAM(rawoutstream, " -V, --version Print version number and exit\n");
+ PRINTVALSTREAM(rawoutstream, " --vfd=DRIVER Use the specified virtual file driver\n");
+ PRINTVALSTREAM(rawoutstream, " -x, --hexdump Show raw data in hexadecimal format\n");
+ PRINTVALSTREAM(rawoutstream, "\n");
+ PRINTVALSTREAM(rawoutstream, " file/OBJECT\n");
+ PRINTVALSTREAM(rawoutstream, " Each object consists of an HDF5 file name optionally followed by a\n");
+ PRINTVALSTREAM(rawoutstream, " slash and an object name within the file (if no object is specified\n");
+ PRINTVALSTREAM(rawoutstream, " within the file then the contents of the root group are displayed).\n");
+ PRINTVALSTREAM(rawoutstream, " The file name may include a printf(3C) integer format such as\n");
+ PRINTVALSTREAM(rawoutstream, " \"%%05d\" to open a file family.\n");
+ PRINTVALSTREAM(rawoutstream, "\n");
+ PRINTVALSTREAM(rawoutstream, " Deprecated Options\n");
+ PRINTVALSTREAM(rawoutstream, " The following options have been deprecated in HDF5. While they remain\n");
+ PRINTVALSTREAM(rawoutstream, " available, they have been superseded as indicated and may be removed\n");
+ PRINTVALSTREAM(rawoutstream, " from HDF5 in the future. Use the indicated replacement option in all\n");
+ PRINTVALSTREAM(rawoutstream, " new work; where possible, existing scripts, et cetera, should also be\n");
+ PRINTVALSTREAM(rawoutstream, " updated to use the replacement option.\n");
+ PRINTVALSTREAM(rawoutstream, "\n");
+ PRINTVALSTREAM(rawoutstream, " -E or --external Follow external links.\n");
+ PRINTVALSTREAM(rawoutstream, " Replaced by --follow-symlinks.\n");
+ PRINTVALSTREAM(rawoutstream, " -e, --errors Show all HDF5 error reporting\n");
+ PRINTVALSTREAM(rawoutstream, " Replaced by --enable-error-stack.\n");
}
diff --git a/tools/h5ls/testh5ls.sh.in b/tools/h5ls/testh5ls.sh.in
index 73d7a46..e72c875 100644
--- a/tools/h5ls/testh5ls.sh.in
+++ b/tools/h5ls/testh5ls.sh.in
@@ -197,7 +197,7 @@ CLEAN_TESTFILES_AND_TESTDIR()
# skip rm if srcdir is same as destdir
# this occurs when build/test performed in source dir and
# make cp fail
- SDIR=`$DIRNAME $tstfile`
+ SDIR=$SRC_H5LS_TESTFILES
INODE_SDIR=`$LS -i -d $SDIR | $AWK -F' ' '{print $1}'`
INODE_DDIR=`$LS -i -d $TESTDIR | $AWK -F' ' '{print $1}'`
if [ "$INODE_SDIR" != "$INODE_DDIR" ]; then
diff --git a/tools/h5ls/testh5lsvds.sh.in b/tools/h5ls/testh5lsvds.sh.in
index d194992..47a48e3 100644
--- a/tools/h5ls/testh5lsvds.sh.in
+++ b/tools/h5ls/testh5lsvds.sh.in
@@ -148,7 +148,7 @@ CLEAN_TESTFILES_AND_TESTDIR()
# skip rm if srcdir is same as destdir
# this occurs when build/test performed in source dir and
# make cp fail
- SDIR=`$DIRNAME $tstfile`
+ SDIR=$SRC_H5LS_TESTFILES/vds
INODE_SDIR=`$LS -i -d $SDIR | $AWK -F' ' '{print $1}'`
INODE_DDIR=`$LS -i -d $TESTDIR | $AWK -F' ' '{print $1}'`
if [ "$INODE_SDIR" != "$INODE_DDIR" ]; then
diff --git a/tools/h5repack/CMakeTests.cmake b/tools/h5repack/CMakeTests.cmake
index d5379a4..d0aa6c8 100644
--- a/tools/h5repack/CMakeTests.cmake
+++ b/tools/h5repack/CMakeTests.cmake
@@ -121,19 +121,14 @@
${HDF5_TOOLS_H5REPACK_SOURCE_DIR}/testfiles/3_1_vds.h5-vds_chunk2x5x8-v.ddl
${HDF5_TOOLS_H5REPACK_SOURCE_DIR}/testfiles/4_vds.h5-vds_compa-v.ddl
${HDF5_TOOLS_H5REPACK_SOURCE_DIR}/testfiles/4_vds.h5-vds_conti-v.ddl
+ ${HDF5_TOOLS_H5REPACK_SOURCE_DIR}/testfiles/h5repack_layout.h5-plugin_zero.tst
)
foreach (h5_file ${LIST_HDF5_TEST_FILES} ${LIST_OTHER_TEST_FILES})
get_filename_component(fname "${h5_file}" NAME)
- set (dest "${PROJECT_BINARY_DIR}/testfiles/${fname}")
- #message (STATUS " Copying ${h5_file}")
- add_custom_command (
- TARGET h5repack
- POST_BUILD
- COMMAND ${CMAKE_COMMAND}
- ARGS -E copy_if_different ${h5_file} ${dest}
- )
+ HDFTEST_COPY_FILE("${h5_file}" "${PROJECT_BINARY_DIR}/testfiles/${fname}" "h5repack_files")
endforeach (h5_file ${LIST_HDF5_TEST_FILES} ${LIST_OTHER_TEST_FILES})
+ add_custom_target(h5repack_files ALL COMMENT "Copying files needed by h5repack tests" DEPENDS ${h5repack_files_list})
##############################################################################
##############################################################################
@@ -148,7 +143,7 @@
set_tests_properties (H5REPACK-${testname} PROPERTIES WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles")
if (NOT "${last_test}" STREQUAL "")
set_tests_properties (H5REPACK-${testname} PROPERTIES DEPENDS ${last_test})
- endif (NOT "${last_test}" STREQUAL "")
+ endif ()
set (last_test "H5REPACK-${testname}")
else (HDF5_ENABLE_USING_MEMCHECKER)
add_test (
@@ -187,7 +182,7 @@
)
if (NOT "${last_test}" STREQUAL "")
set_tests_properties (H5REPACK_OLD-${testname} PROPERTIES DEPENDS ${last_test})
- endif (NOT "${last_test}" STREQUAL "")
+ endif ()
add_test (
NAME H5REPACK_OLD-${testname}_DFF
COMMAND $<TARGET_FILE:h5diff> ${PROJECT_BINARY_DIR}/testfiles/${testfile} ${PROJECT_BINARY_DIR}/testfiles/out-${testname}.${testfile}
@@ -211,7 +206,7 @@
)
if (NOT "${last_test}" STREQUAL "")
set_tests_properties (H5REPACK-${testname} PROPERTIES DEPENDS ${last_test})
- endif (NOT "${last_test}" STREQUAL "")
+ endif ()
add_test (
NAME H5REPACK-${testname}_DFF
COMMAND $<TARGET_FILE:h5diff> ${PROJECT_BINARY_DIR}/testfiles/${testfile} ${PROJECT_BINARY_DIR}/testfiles/out-${testname}.${testfile}
@@ -250,7 +245,7 @@
endif (HDF5_ENABLE_USING_MEMCHECKER)
if (NOT "${last_test}" STREQUAL "")
set_tests_properties (H5REPACK_CMP-${testname} PROPERTIES DEPENDS ${last_test})
- endif (NOT "${last_test}" STREQUAL "")
+ endif ()
endif ("${testtype}" STREQUAL "SKIP")
ENDMACRO (ADD_H5_CMP_TEST)
@@ -284,7 +279,7 @@
endif (HDF5_ENABLE_USING_MEMCHECKER)
if (NOT "${last_test}" STREQUAL "")
set_tests_properties (H5REPACK_MASK-${testname} PROPERTIES DEPENDS ${last_test})
- endif (NOT "${last_test}" STREQUAL "")
+ endif ()
endif ("${testtype}" STREQUAL "SKIP")
ENDMACRO (ADD_H5_MASK_TEST)
@@ -303,7 +298,7 @@
COMMAND $<TARGET_FILE:h5repack> ${ARGN} ${PROJECT_BINARY_DIR}/testfiles/${resultfile} ${PROJECT_BINARY_DIR}/testfiles/out-${testname}.${resultfile})
if (NOT "${last_test}" STREQUAL "")
set_tests_properties (H5REPACK_DMP-${testname} PROPERTIES DEPENDS ${last_test})
- endif (NOT "${last_test}" STREQUAL "")
+ endif ()
if (NOT HDF5_ENABLE_USING_MEMCHECKER)
add_test (
NAME H5REPACK_DMP-h5dump-${testname}
@@ -337,7 +332,7 @@
)
if (NOT "${last_test}" STREQUAL "")
set_tests_properties (H5REPACK_VERIFY_LAYOUT-${testname} PROPERTIES DEPENDS ${last_test})
- endif (NOT "${last_test}" STREQUAL "")
+ endif ()
add_test (
NAME H5REPACK_VERIFY_LAYOUT-${testname}_DFF
COMMAND $<TARGET_FILE:h5diff> ${PROJECT_BINARY_DIR}/testfiles/${testfile} ${PROJECT_BINARY_DIR}/testfiles/out-${testname}.${testfile}
@@ -360,13 +355,13 @@
else ("${resultcode}" STREQUAL "0")
if ("${testfilter}" STREQUAL "CHUNKED")
set (nottestfilter "(CONTIGUOUS|COMPACT)")
- endif ("${testfilter}" STREQUAL "CHUNKED")
+ endif ()
if ("${testfilter}" STREQUAL "CONTIGUOUS")
set (nottestfilter "(CHUNK|COMPACT)")
- endif ("${testfilter}" STREQUAL "CONTIGUOUS")
+ endif ()
if ("${testfilter}" STREQUAL "COMPACT")
set (nottestfilter "(CONTIGUOUS|CHUNK)")
- endif ("${testfilter}" STREQUAL "COMPACT")
+ endif ()
add_test (
NAME H5REPACK_VERIFY_LAYOUT-${testname}_DMP
COMMAND "${CMAKE_COMMAND}"
@@ -402,7 +397,7 @@
set_tests_properties (H5REPACK_VERIFY_LAYOUT_VDS-${testname} PROPERTIES WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles")
if (NOT "${last_test}" STREQUAL "")
set_tests_properties (H5REPACK_VERIFY_LAYOUT_VDS-${testname} PROPERTIES DEPENDS ${last_test})
- endif (NOT "${last_test}" STREQUAL "")
+ endif ()
add_test (
NAME H5REPACK_VERIFY_LAYOUT_VDS-${testname}_DMP
COMMAND "${CMAKE_COMMAND}"
@@ -427,7 +422,7 @@
)
if (NOT "${last_test}" STREQUAL "")
set_tests_properties (H5REPACK_META-${testname}_N PROPERTIES DEPENDS ${last_test})
- endif (NOT "${last_test}" STREQUAL "")
+ endif ()
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
@@ -1151,6 +1146,12 @@
##############################################################################
ADD_H5_UD_TEST (plugin_test 0 h5repack_layout.h5 -v -f UD=257,1,9)
ADD_H5_UD_TEST (plugin_none 0 h5repack_layout.UD.h5 -v -f NONE)
+ # check for no parameters
+ set (TESTRETVAL 255)
+ if (WIN32)
+ set (TESTRETVAL -1)
+ endif()
+ ADD_H5_CMP_TEST (plugin_zero "" "TEST" ${TESTRETVAL} h5repack_layout.h5 -v -f UD=250,0)
if (HDF5_TEST_VFD)
# Run test with different Virtual File Driver
diff --git a/tools/h5repack/h5repack.c b/tools/h5repack/h5repack.c
index cf30b2b..ef2085c 100644
--- a/tools/h5repack/h5repack.c
+++ b/tools/h5repack/h5repack.c
@@ -122,35 +122,36 @@ int h5repack_end(pack_opt_t *options) {
*
*-------------------------------------------------------------------------
*/
-int h5repack_addfilter(const char* str, pack_opt_t *options) {
- obj_list_t *obj_list = NULL; /* one object list for the -f and -l option entry */
- filter_info_t filter; /* filter info for the current -f option entry */
- int n_objs; /* number of objects in the current -f or -l option entry */
- int is_glb; /* is the filter global */
-
- /* parse the -f option */
- if (NULL == (obj_list = parse_filter(str, &n_objs, &filter, options, &is_glb)))
- return -1;
-
- /* if it applies to all objects */
- if (is_glb) {
- int n;
-
- n = options->n_filter_g++; /* increase # of global filters */
-
- if (options->n_filter_g > H5_REPACK_MAX_NFILTERS) {
- error_msg("maximum number of filters exceeded for <%s>\n", str);
- HDfree(obj_list);
- return -1;
- }
-
- options->filter_g[n] = filter;
- }
- else
- options_add_filter(obj_list, n_objs, filter, options->op_tbl);
-
- HDfree(obj_list);
- return 0;
+int
+h5repack_addfilter(const char* str, pack_opt_t *options)
+{
+ obj_list_t *obj_list = NULL; /* one object list for the -f and -l option entry */
+ filter_info_t filter; /* filter info for the current -f option entry */
+ unsigned n_objs; /* number of objects in the current -f or -l option entry */
+ int is_glb; /* is the filter global */
+
+ /* parse the -f option */
+ if (NULL == (obj_list = parse_filter(str, &n_objs, &filter, options, &is_glb)))
+ return -1;
+
+ /* if it applies to all objects */
+ if (is_glb) {
+ int n;
+
+ n = options->n_filter_g++; /* increase # of global filters */
+ if (options->n_filter_g > H5_REPACK_MAX_NFILTERS) {
+ error_msg("maximum number of filters exceeded for <%s>\n", str);
+ HDfree(obj_list);
+ return -1;
+ }
+
+ options->filter_g[n] = filter;
+ }
+ else
+ options_add_filter(obj_list, n_objs, filter, options->op_tbl);
+
+ HDfree(obj_list);
+ return 0;
}
/*-------------------------------------------------------------------------
@@ -162,59 +163,53 @@ int h5repack_addfilter(const char* str, pack_opt_t *options) {
*
*-------------------------------------------------------------------------
*/
-
-int h5repack_addlayout(const char* str, pack_opt_t *options) {
-
- obj_list_t *obj_list = NULL; /*one object list for the -t and -c option entry */
- int n_objs; /*number of objects in the current -t or -c option entry */
- pack_info_t pack; /*info about layout to extract from parse */
- int j;
- int ret_value = -1;
-
- init_packobject(&pack);
-
- if (options->all_layout == 1) {
- error_msg(
- "invalid layout input: 'all' option \
- is present with other objects <%s>\n",
- str);
- return ret_value;
- }
-
- /* parse the layout option */
- obj_list = parse_layout(str, &n_objs, &pack, options);
- if (obj_list) {
-
- /* set layout option */
- options->layout_g = pack.layout;
-
- /* no individual dataset specified */
- if (options->all_layout == 1) {
- if (pack.layout == H5D_CHUNKED) {
- /* -2 means the NONE option, remove chunking
- and set the global layout to contiguous */
- if (pack.chunk.rank == -2) {
- options->layout_g = H5D_CONTIGUOUS;
- }
- /* otherwise set the global chunking type */
- else {
- options->chunk_g.rank = pack.chunk.rank;
- for (j = 0; j < pack.chunk.rank; j++)
- options->chunk_g.chunk_lengths[j] =
- pack.chunk.chunk_lengths[j];
- }
- }
- }
-
- /* individual dataset specified */
- if (options->all_layout == 0)
- ret_value = options_add_layout(obj_list, n_objs, &pack, options->op_tbl);
-
- HDfree(obj_list);
- ret_value = 0;
- }
-
- return ret_value;
+int
+h5repack_addlayout(const char* str, pack_opt_t *options)
+{
+ obj_list_t *obj_list = NULL; /*one object list for the -t and -c option entry */
+ unsigned n_objs; /*number of objects in the current -t or -c option entry */
+ pack_info_t pack; /*info about layout to extract from parse */
+ int j;
+ int ret_value = -1;
+
+ init_packobject(&pack);
+
+ if (options->all_layout == 1) {
+ error_msg( "invalid layout input: 'all' option is present with other objects <%s>\n", str);
+ return ret_value;
+ }
+
+ /* parse the layout option */
+ obj_list = parse_layout(str, &n_objs, &pack, options);
+ if (obj_list) {
+ /* set layout option */
+ options->layout_g = pack.layout;
+
+ /* no individual dataset specified */
+ if (options->all_layout == 1) {
+ if (pack.layout == H5D_CHUNKED) {
+ /* -2 means the NONE option, remove chunking
+ and set the global layout to contiguous */
+ if (pack.chunk.rank == -2)
+ options->layout_g = H5D_CONTIGUOUS;
+ /* otherwise set the global chunking type */
+ else {
+ options->chunk_g.rank = pack.chunk.rank;
+ for (j = 0; j < pack.chunk.rank; j++)
+ options->chunk_g.chunk_lengths[j] = pack.chunk.chunk_lengths[j];
+ }
+ }
+ }
+
+ /* individual dataset specified */
+ if (options->all_layout == 0)
+ ret_value = options_add_layout(obj_list, n_objs, &pack, options->op_tbl);
+
+ HDfree(obj_list);
+ ret_value = 0;
+ }
+
+ return ret_value;
}
/* Note: The below copy_named_datatype(), named_datatype_free(), copy_attr()
@@ -370,201 +365,201 @@ done:
*
*-------------------------------------------------------------------------
*/
-int copy_attr(hid_t loc_in, hid_t loc_out, named_dt_t **named_dt_head_p,
- trav_table_t *travt, pack_opt_t *options) {
- int ret_value = 0; /*no need to LEAVE() on ERROR: HERR_INIT(int, SUCCEED) */
+int
+copy_attr(hid_t loc_in, hid_t loc_out, named_dt_t **named_dt_head_p,
+ trav_table_t *travt, pack_opt_t *options)
+{
+ int ret_value = 0; /*no need to LEAVE() on ERROR: HERR_INIT(int, SUCCEED) */
hid_t attr_id = -1; /* attr ID */
- hid_t attr_out = -1; /* attr ID */
- hid_t space_id = -1; /* space ID */
- hid_t ftype_id = -1; /* file type ID */
- hid_t wtype_id = -1; /* read/write type ID */
- size_t msize; /* size of type */
- void *buf = NULL; /* data buffer */
- hsize_t nelmts; /* number of elements in dataset */
- int rank; /* rank of dataset */
- htri_t is_named; /* Whether the datatype is named */
- hsize_t dims[H5S_MAX_RANK];/* dimensions of dataset */
- char name[255];
- H5O_info_t oinfo; /* object info */
- int j;
- unsigned u;
- hbool_t is_ref = 0;
- H5T_class_t type_class = -1;
-
- if (H5Oget_info(loc_in, &oinfo) < 0)
- HGOTO_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Oget_info failed");
-
- /*-------------------------------------------------------------------------
- * copy all attributes
- *-------------------------------------------------------------------------
- */
- for (u = 0; u < (unsigned) oinfo.num_attrs; u++) {
- /* open attribute */
- if ((attr_id = H5Aopen_by_idx(loc_in, ".", H5_INDEX_CRT_ORDER,
- H5_ITER_INC, (hsize_t) u, H5P_DEFAULT, H5P_DEFAULT)) < 0)
- HGOTO_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Aopen_by_idx failed");
-
- /* get name */
- if (H5Aget_name(attr_id, (size_t) 255, name) < 0)
- HGOTO_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Pclose failed");
-
- /* get the file datatype */
- if ((ftype_id = H5Aget_type(attr_id)) < 0)
- HGOTO_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Aget_type failed");
-
- /* Check if the datatype is committed */
- if ((is_named = H5Tcommitted(ftype_id)) < 0)
- HGOTO_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Tcommitted failed");
+ hid_t attr_out = -1; /* attr ID */
+ hid_t space_id = -1; /* space ID */
+ hid_t ftype_id = -1; /* file type ID */
+ hid_t wtype_id = -1; /* read/write type ID */
+ size_t msize; /* size of type */
+ void *buf = NULL; /* data buffer */
+ hsize_t nelmts; /* number of elements in dataset */
+ int rank; /* rank of dataset */
+ htri_t is_named; /* Whether the datatype is named */
+ hsize_t dims[H5S_MAX_RANK];/* dimensions of dataset */
+ char name[255];
+ H5O_info_t oinfo; /* object info */
+ int j;
+ unsigned u;
+ hbool_t is_ref = 0;
+ H5T_class_t type_class = -1;
+
+ if (H5Oget_info(loc_in, &oinfo) < 0)
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Oget_info failed");
+
+ /*-------------------------------------------------------------------------
+ * copy all attributes
+ *-------------------------------------------------------------------------
+ */
+ for (u = 0; u < (unsigned) oinfo.num_attrs; u++) {
+ /* open attribute */
+ if ((attr_id = H5Aopen_by_idx(loc_in, ".", H5_INDEX_CRT_ORDER, H5_ITER_INC, (hsize_t) u, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Aopen_by_idx failed");
+
+ /* get name */
+ if (H5Aget_name(attr_id, (size_t) 255, name) < 0)
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pclose failed");
+
+ /* get the file datatype */
+ if ((ftype_id = H5Aget_type(attr_id)) < 0)
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Aget_type failed");
+
+ /* Check if the datatype is committed */
+ if ((is_named = H5Tcommitted(ftype_id)) < 0)
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Tcommitted failed");
if (is_named && travt) {
- hid_t fidout;
+ hid_t fidout;
- /* Create out file id */
- if ((fidout = H5Iget_file_id(loc_out)) < 0)
- HGOTO_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Iget_file_id failed");
+ /* Create out file id */
+ if ((fidout = H5Iget_file_id(loc_out)) < 0)
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Iget_file_id failed");
- /* Copy named dt */
- if ((wtype_id = copy_named_datatype(ftype_id, fidout,
- named_dt_head_p, travt, options)) < 0) {
- H5Fclose(fidout);
- HGOTO_ERROR(H5E_tools_g, H5E_tools_min_id_g, "copy_named_datatype failed");
+ /* Copy named dt */
+ if ((wtype_id = copy_named_datatype(ftype_id, fidout, named_dt_head_p, travt, options)) < 0) {
+ H5Fclose(fidout);
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "copy_named_datatype failed");
} /* end if */
- if (H5Fclose(fidout) < 0)
- HGOTO_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Fclose failed");
+ if (H5Fclose(fidout) < 0)
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Fclose failed");
} /* end if */
- else {
- if (options->use_native == 1)
- wtype_id = h5tools_get_native_type(ftype_id);
- else
- wtype_id = H5Tcopy(ftype_id);
- } /* end else */
-
- /* get the dataspace handle */
- if ((space_id = H5Aget_space(attr_id)) < 0)
- HGOTO_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Aget_space failed");
-
- /* get dimensions */
- if ((rank = H5Sget_simple_extent_dims(space_id, dims, NULL)) < 0)
- HGOTO_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Sget_simple_extent_dims failed");
-
- nelmts = 1;
- for (j = 0; j < rank; j++)
- nelmts *= dims[j];
-
- if ((msize = H5Tget_size(wtype_id)) == 0)
- HGOTO_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Tget_size failed");
-
- /*-------------------------------------------------------------------------
- * object references are a special case. We cannot just copy the buffers,
- * but instead we recreate the reference.
- * This is done on a second sweep of the file that just copies the referenced
- * objects at copy_refs_attr()
- *-------------------------------------------------------------------------
- */
- type_class = H5Tget_class(wtype_id);
- is_ref = (type_class == H5T_REFERENCE);
- if (type_class == H5T_VLEN || type_class == H5T_ARRAY) {
- hid_t base_type = -1;
- base_type = H5Tget_super(ftype_id);
- is_ref = (is_ref || (H5Tget_class(base_type) == H5T_REFERENCE));
- H5Tclose(base_type);
- }
-
- if (type_class == H5T_COMPOUND) {
- int nmembers = H5Tget_nmembers(wtype_id);
- for (j = 0; j < nmembers; j++) {
- hid_t mtid = H5Tget_member_type(wtype_id, (unsigned) j);
- H5T_class_t mtclass = H5Tget_class(mtid);
- H5Tclose(mtid);
-
- if (mtclass == H5T_REFERENCE) {
- is_ref = 1;
- break;
- }
- } /* for (j=0; i<nmembers; j++) */
- } /* if (type_class == H5T_COMPOUND) */
-
- if (is_ref) {
- ; /* handled by copy_refs_attr() */
- }
- else {
- /*-------------------------------------------------------------------------
- * read to memory
- *-------------------------------------------------------------------------
- */
-
- buf = (void *) HDmalloc((size_t)(nelmts * msize));
- if (buf == NULL) {
- error_msg("h5repack", "cannot read into memory\n");
- HGOTO_ERROR(H5E_tools_g, H5E_tools_min_id_g, "HDmalloc failed");
+ else {
+ if (options->use_native == 1)
+ wtype_id = h5tools_get_native_type(ftype_id);
+ else
+ wtype_id = H5Tcopy(ftype_id);
+ } /* end else */
+
+ /* get the dataspace handle */
+ if ((space_id = H5Aget_space(attr_id)) < 0)
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Aget_space failed");
+
+ /* get dimensions */
+ if ((rank = H5Sget_simple_extent_dims(space_id, dims, NULL)) < 0)
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Sget_simple_extent_dims failed");
+
+ nelmts = 1;
+ for (j = 0; j < rank; j++)
+ nelmts *= dims[j];
+
+ if ((msize = H5Tget_size(wtype_id)) == 0)
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Tget_size failed");
+
+ /*-------------------------------------------------------------------------
+ * object references are a special case. We cannot just copy the buffers,
+ * but instead we recreate the reference.
+ * This is done on a second sweep of the file that just copies the referenced
+ * objects at copy_refs_attr()
+ *-------------------------------------------------------------------------
+ */
+ type_class = H5Tget_class(wtype_id);
+ is_ref = (type_class == H5T_REFERENCE);
+ if (type_class == H5T_VLEN || type_class == H5T_ARRAY) {
+ hid_t base_type = -1;
+
+ base_type = H5Tget_super(ftype_id);
+ is_ref = (is_ref || (H5Tget_class(base_type) == H5T_REFERENCE));
+ H5Tclose(base_type);
+ }
+
+ if (type_class == H5T_COMPOUND) {
+ int nmembers = H5Tget_nmembers(wtype_id);
+
+ for (j = 0; j < nmembers; j++) {
+ hid_t mtid = H5Tget_member_type(wtype_id, (unsigned) j);
+ H5T_class_t mtclass = H5Tget_class(mtid);
+ H5Tclose(mtid);
+
+ if (mtclass == H5T_REFERENCE) {
+ is_ref = 1;
+ break;
+ }
+ } /* for (j=0; i<nmembers; j++) */
+ } /* if (type_class == H5T_COMPOUND) */
+
+ if (is_ref) {
+ ; /* handled by copy_refs_attr() */
+ }
+ else {
+ /*-------------------------------------------------------------------------
+ * read to memory
+ *-------------------------------------------------------------------------
+ */
+
+ buf = (void *) HDmalloc((size_t)(nelmts * msize));
+ if (buf == NULL) {
+ error_msg("h5repack", "cannot read into memory\n");
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "HDmalloc failed");
} /* end if */
- if (H5Aread(attr_id, wtype_id, buf) < 0)
- HGOTO_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Aread failed");
+ if (H5Aread(attr_id, wtype_id, buf) < 0)
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Aread failed");
- /*-------------------------------------------------------------------------
- * copy
- *-------------------------------------------------------------------------
- */
+ /*-------------------------------------------------------------------------
+ * copy
+ *-------------------------------------------------------------------------
+ */
- if ((attr_out = H5Acreate2(loc_out, name, wtype_id, space_id,
- H5P_DEFAULT, H5P_DEFAULT)) < 0)
- HGOTO_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Acreate2 failed");
+ if ((attr_out = H5Acreate2(loc_out, name, wtype_id, space_id, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Acreate2 failed");
if (H5Awrite(attr_out, wtype_id, buf) < 0)
- HGOTO_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Awrite failed");
-
- /*close*/
- if (H5Aclose(attr_out) < 0)
- HGOTO_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Aclose failed");
-
- /* Check if we have VL data and string in the attribute's datatype that must
- * be reclaimed */
- if (TRUE == h5tools_detect_vlen(wtype_id))
- H5Dvlen_reclaim(wtype_id, space_id, H5P_DEFAULT, buf);
- HDfree(buf);
- buf = NULL;
- } /*H5T_REFERENCE*/
-
- if (options->verbose)
- printf(FORMAT_OBJ_ATTR, "attr", name);
-
- /*-------------------------------------------------------------------------
- * close
- *-------------------------------------------------------------------------
- */
-
- if (H5Tclose(ftype_id) < 0)
- HGOTO_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Tclose failed");
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Awrite failed");
+
+ /*close*/
+ if (H5Aclose(attr_out) < 0)
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Aclose failed");
+
+ /* Check if we have VL data and string in the attribute's datatype that must
+ * be reclaimed */
+ if (TRUE == h5tools_detect_vlen(wtype_id))
+ H5Dvlen_reclaim(wtype_id, space_id, H5P_DEFAULT, buf);
+ HDfree(buf);
+ buf = NULL;
+ } /*H5T_REFERENCE*/
+
+ if (options->verbose)
+ printf(FORMAT_OBJ_ATTR, "attr", name);
+
+ /*-------------------------------------------------------------------------
+ * close
+ *-------------------------------------------------------------------------
+ */
+
+ if (H5Tclose(ftype_id) < 0)
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Tclose failed");
if (H5Tclose(wtype_id) < 0)
- HGOTO_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Tclose failed");
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Tclose failed");
if (H5Sclose(space_id) < 0)
- HGOTO_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Sclose failed");
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Sclose failed");
if (H5Aclose(attr_id) < 0)
- HGOTO_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Aclose failed");
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Aclose failed");
} /* u */
- return 0;
+ return 0;
done:
- H5E_BEGIN_TRY
- {
- if (buf) {
- /* Check if we have VL data and string in the attribute's datatype that must
- * be reclaimed */
- if (TRUE == h5tools_detect_vlen(wtype_id))
- H5Dvlen_reclaim(wtype_id, space_id, H5P_DEFAULT, buf);
-
- /* Free buf */
- HDfree(buf);
- } /* end if */
+ H5E_BEGIN_TRY {
+ if (buf) {
+ /* Check if we have VL data and string in the attribute's datatype that must
+ * be reclaimed */
+ if (TRUE == h5tools_detect_vlen(wtype_id))
+ H5Dvlen_reclaim(wtype_id, space_id, H5P_DEFAULT, buf);
+
+ /* Free buf */
+ HDfree(buf);
+ } /* end if */
- H5Tclose(ftype_id);
- H5Tclose(wtype_id);
- H5Sclose(space_id);
- H5Aclose(attr_id);
- H5Aclose(attr_out);
- } H5E_END_TRY;
+ H5Tclose(ftype_id);
+ H5Tclose(wtype_id);
+ H5Sclose(space_id);
+ H5Aclose(attr_id);
+ H5Aclose(attr_out);
+ } H5E_END_TRY;
- return -1;
+ return ret_value;
} /* end copy_attr() */
/*-------------------------------------------------------------------------
@@ -606,6 +601,9 @@ static int check_options(pack_opt_t *options) {
case H5D_CHUNKED:
strcpy(slayout, "chunked");
break;
+ case H5D_VIRTUAL:
+ strcpy(slayout, "virtual");
+ break;
case H5D_LAYOUT_ERROR:
case H5D_NLAYOUTS:
error_msg("invalid layout\n");
diff --git a/tools/h5repack/h5repack.h b/tools/h5repack/h5repack.h
index 329be1f..d2ab923 100644
--- a/tools/h5repack/h5repack.h
+++ b/tools/h5repack/h5repack.h
@@ -82,9 +82,9 @@ typedef struct {
/* store a table of all objects */
typedef struct {
- unsigned int size;
- unsigned int nelems;
- pack_info_t *objs;
+ unsigned int size;
+ unsigned int nelems;
+ pack_info_t *objs;
} pack_opttbl_t;
@@ -114,7 +114,7 @@ typedef struct {
hsize_t ublock_size; /* user block size */
hsize_t meta_block_size; /* metadata aggregation block size (for H5Pset_meta_block_size) */
hsize_t threshold; /* alignment threshold for H5Pset_alignment */
- hsize_t alignment ; /* alignment for H5Pset_alignment */
+ hsize_t alignment; /* alignment for H5Pset_alignment */
H5F_file_space_type_t fs_strategy; /* File space handling strategy */
hsize_t fs_threshold; /* Free space section threshold */
} pack_opt_t;
@@ -210,11 +210,11 @@ int apply_filters(const char* name, /* object name from traverse list */
int options_table_init( pack_opttbl_t **tbl );
int options_table_free( pack_opttbl_t *table );
int options_add_layout( obj_list_t *obj_list,
- int n_objs,
+ unsigned n_objs,
pack_info_t *pack,
pack_opttbl_t *table );
int options_add_filter ( obj_list_t *obj_list,
- int n_objs,
+ unsigned n_objs,
filter_info_t filt,
pack_opttbl_t *table );
pack_info_t* options_get_object( const char *path,
@@ -226,13 +226,13 @@ pack_info_t* options_get_object( const char *path,
*/
obj_list_t* parse_filter(const char *str,
- int *n_objs,
+ unsigned *n_objs,
filter_info_t *filt,
pack_opt_t *options,
int *is_glb);
obj_list_t* parse_layout(const char *str,
- int *n_objs,
+ unsigned *n_objs,
pack_info_t *pack, /* info about object */
pack_opt_t *options);
diff --git a/tools/h5repack/h5repack_filters.c b/tools/h5repack/h5repack_filters.c
index 56e08ef..e21b829 100644
--- a/tools/h5repack/h5repack_filters.c
+++ b/tools/h5repack/h5repack_filters.c
@@ -34,8 +34,8 @@
*
*-------------------------------------------------------------------------
*/
-static
-int aux_find_obj(const char* name, /* object name from traverse list */
+static int
+aux_find_obj(const char* name, /* object name from traverse list */
pack_opt_t *options, /* repack options */
pack_info_t *obj /*OUT*/) /* info about object to filter */
{
@@ -48,7 +48,7 @@ int aux_find_obj(const char* name, /* object name from traverse list */
if (HDstrcmp(options->op_tbl->objs[i].path,name)==0)
{
*obj = options->op_tbl->objs[i];
- return i;
+ return (int)i;
}
pdest = HDstrstr(name,options->op_tbl->objs[i].path);
@@ -58,7 +58,7 @@ int aux_find_obj(const char* name, /* object name from traverse list */
if( pdest != NULL && result==1 )
{
*obj = options->op_tbl->objs[i];
- return i;
+ return (int)i;
}
}/*i*/
@@ -76,8 +76,8 @@ int aux_find_obj(const char* name, /* object name from traverse list */
*
*-------------------------------------------------------------------------
*/
-static
-int aux_assign_obj(const char* name, /* object name from traverse list */
+static int
+aux_assign_obj(const char* name, /* object name from traverse list */
pack_opt_t *options, /* repack options */
pack_info_t *obj /*OUT*/) /* info about object to filter */
{
@@ -109,6 +109,7 @@ int aux_assign_obj(const char* name, /* object name from traverse lis
case H5D_LAYOUT_ERROR:
case H5D_COMPACT:
case H5D_CONTIGUOUS:
+ case H5D_VIRTUAL:
case H5D_NLAYOUTS:
break;
default:
@@ -128,6 +129,7 @@ int aux_assign_obj(const char* name, /* object name from traverse lis
case H5D_LAYOUT_ERROR:
case H5D_COMPACT:
case H5D_CONTIGUOUS:
+ case H5D_VIRTUAL:
case H5D_NLAYOUTS:
break;
default:
@@ -184,6 +186,7 @@ int aux_assign_obj(const char* name, /* object name from traverse lis
case H5D_LAYOUT_ERROR:
case H5D_COMPACT:
case H5D_CONTIGUOUS:
+ case H5D_VIRTUAL:
case H5D_NLAYOUTS:
break;
default:
@@ -433,7 +436,7 @@ int apply_filters(const char* name, /* object name from traverse list */
int scale_factor;
scale_type = (H5Z_SO_scale_type_t)obj.filter[i].cd_values[0];
- scale_factor = obj.filter[i].cd_values[1];
+ scale_factor = (int)obj.filter[i].cd_values[1];
if(H5Pset_chunk(dcpl_id, obj.chunk.rank, obj.chunk.chunk_lengths)<0)
return -1;
diff --git a/tools/h5repack/h5repack_main.c b/tools/h5repack/h5repack_main.c
index e903435..2d48a04 100644
--- a/tools/h5repack/h5repack_main.c
+++ b/tools/h5repack/h5repack_main.c
@@ -265,11 +265,11 @@ int read_info(const char *filename, pack_opt_t *options) {
c = '0';
while (c != ' ') {
if(fscanf(fp, "%c", &c) < 0 && HDferror(fp)) {
- error_msg("fscanf error\n");
- h5tools_setstatus(EXIT_FAILURE);
- ret_value = EXIT_FAILURE;
- goto done;
- } /* end if */
+ error_msg("fscanf error\n");
+ h5tools_setstatus(EXIT_FAILURE);
+ ret_value = EXIT_FAILURE;
+ goto done;
+ } /* end if */
if (HDfeof(fp))
break;
}
@@ -277,11 +277,11 @@ int read_info(const char *filename, pack_opt_t *options) {
/* go until end */
while (c != ' ') {
if(fscanf(fp, "%c", &c) < 0 && HDferror(fp)) {
- error_msg("fscanf error\n");
- h5tools_setstatus(EXIT_FAILURE);
- ret_value = EXIT_FAILURE;
- goto done;
- } /* end if */
+ error_msg("fscanf error\n");
+ h5tools_setstatus(EXIT_FAILURE);
+ ret_value = EXIT_FAILURE;
+ goto done;
+ } /* end if */
comp_info[i] = c;
i++;
if (HDfeof(fp))
@@ -292,10 +292,10 @@ int read_info(const char *filename, pack_opt_t *options) {
comp_info[i - 1] = '\0'; /*cut the last " */
if (h5repack_addfilter(comp_info, options) == -1) {
- error_msg("could not add compression option\n");
- h5tools_setstatus(EXIT_FAILURE);
- ret_value = EXIT_FAILURE;
- goto done;
+ error_msg("could not add compression option\n");
+ h5tools_setstatus(EXIT_FAILURE);
+ ret_value = EXIT_FAILURE;
+ goto done;
}
}
/*-------------------------------------------------------------------------
@@ -309,11 +309,11 @@ int read_info(const char *filename, pack_opt_t *options) {
c = '0';
while (c != ' ') {
if(fscanf(fp, "%c", &c) < 0 && HDferror(fp)) {
- error_msg("fscanf error\n");
- h5tools_setstatus(EXIT_FAILURE);
- ret_value = EXIT_FAILURE;
- goto done;
- } /* end if */
+ error_msg("fscanf error\n");
+ h5tools_setstatus(EXIT_FAILURE);
+ ret_value = EXIT_FAILURE;
+ goto done;
+ } /* end if */
if (HDfeof(fp))
break;
}
@@ -321,11 +321,11 @@ int read_info(const char *filename, pack_opt_t *options) {
/* go until end */
while (c != ' ') {
if(fscanf(fp, "%c", &c) < 0 && HDferror(fp)) {
- error_msg("fscanf error\n");
- h5tools_setstatus(EXIT_FAILURE);
- ret_value = EXIT_FAILURE;
- goto done;
- } /* end if */
+ error_msg("fscanf error\n");
+ h5tools_setstatus(EXIT_FAILURE);
+ ret_value = EXIT_FAILURE;
+ goto done;
+ } /* end if */
comp_info[i] = c;
i++;
if (HDfeof(fp))
@@ -336,10 +336,10 @@ int read_info(const char *filename, pack_opt_t *options) {
comp_info[i - 1] = '\0'; /*cut the last " */
if (h5repack_addlayout(comp_info, options) == -1) {
- error_msg("could not add chunck option\n");
- h5tools_setstatus(EXIT_FAILURE);
- ret_value = EXIT_FAILURE;
- goto done;
+ error_msg("could not add chunck option\n");
+ h5tools_setstatus(EXIT_FAILURE);
+ ret_value = EXIT_FAILURE;
+ goto done;
}
}
/*-------------------------------------------------------------------------
@@ -428,7 +428,7 @@ int parse_command_line(int argc, const char **argv, pack_opt_t* options) {
break;
case 'm':
- options->min_comp = HDatoi( opt_arg );
+ options->min_comp = HDstrtoull(opt_arg , NULL, 0);
if ((int) options->min_comp <= 0) {
error_msg("invalid minimum compress size <%s>\n", opt_arg);
h5tools_setstatus(EXIT_FAILURE);
@@ -515,7 +515,7 @@ int parse_command_line(int argc, const char **argv, pack_opt_t* options) {
break;
case 'a':
- options->alignment = HDatol( opt_arg );
+ options->alignment = HDstrtoull(opt_arg , NULL, 0);
if (options->alignment < 1) {
error_msg("invalid alignment size\n", opt_arg);
h5tools_setstatus(EXIT_FAILURE);
diff --git a/tools/h5repack/h5repack_opttable.c b/tools/h5repack/h5repack_opttable.c
index b54e887..8c98b76 100644
--- a/tools/h5repack/h5repack_opttable.c
+++ b/tools/h5repack/h5repack_opttable.c
@@ -105,21 +105,22 @@ static void aux_tblinsert_layout(pack_opttbl_t *table, unsigned int I,
*
*-------------------------------------------------------------------------
*/
-
-static int aux_inctable(pack_opttbl_t *table, int n_objs) {
- unsigned int i;
-
- table->size += n_objs;
- table->objs =
- (pack_info_t*) HDrealloc(table->objs, table->size * sizeof(pack_info_t));
- if (table->objs == NULL) {
- error_msg("not enough memory for options table\n");
- return -1;
- }
- for (i = table->nelems; i < table->size; i++) {
- init_packobject(&table->objs[i]);
- }
- return 0;
+static int
+aux_inctable(pack_opttbl_t *table, unsigned n_objs)
+{
+ unsigned u;
+
+ table->size += n_objs;
+ table->objs = (pack_info_t*) HDrealloc(table->objs, table->size * sizeof(pack_info_t));
+ if (table->objs == NULL) {
+ error_msg("not enough memory for options table\n");
+ return -1;
+ }
+
+ for (u = table->nelems; u < table->size; u++)
+ init_packobject(&table->objs[u]);
+
+ return 0;
}
@@ -183,80 +184,77 @@ int options_table_free(pack_opttbl_t *table) {
*
*-------------------------------------------------------------------------
*/
-
-int options_add_layout(obj_list_t *obj_list, int n_objs, pack_info_t *pack,
- pack_opttbl_t *table) {
- unsigned int i, I;
- int j, added = 0, found = 0;
-
- /* increase the size of the collection by N_OBJS if necessary */
- if (table->nelems + n_objs >= table->size) {
- if (aux_inctable(table, n_objs) < 0)
- return -1;
- }
-
- /* search if this object is already in the table; "path" is the key */
- if (table->nelems > 0) {
- /* go tru the supplied list of names */
- for (j = 0; j < n_objs; j++) {
- /* linear table search */
- for (i = 0; i < table->nelems; i++) {
- /*already on the table */
- if (HDstrcmp(obj_list[j].obj,table->objs[i].path) == 0) {
- /* already chunk info inserted for this one; exit */
- if (table->objs[i].chunk.rank > 0) {
- error_msg(
- "chunk information already inserted for <%s>\n",
- obj_list[j].obj);
- HDexit(EXIT_FAILURE);
- }
- /* insert the layout info */
- else {
- aux_tblinsert_layout(table, i, pack);
- found = 1;
- break;
- }
- } /* if */
- } /* i */
-
- if (found == 0) {
- /* keep the grow in a temp var */
- I = table->nelems + added;
- added++;
- HDstrcpy(table->objs[I].path, obj_list[j].obj);
- aux_tblinsert_layout(table, I, pack);
- }
- /* cases where we have an already inserted name but there is a new name also
- example:
- -f dset1:GZIP=1 -l dset1,dset2:CHUNK=20x20
- dset1 is already inserted, but dset2 must also be
- */
- else if (found == 1
- && HDstrcmp(obj_list[j].obj,table->objs[i].path) != 0) {
- /* keep the grow in a temp var */
- I = table->nelems + added;
- added++;
- HDstrcpy(table->objs[I].path, obj_list[j].obj);
- aux_tblinsert_layout(table, I, pack);
- }
- } /* j */
- }
-
- /* first time insertion */
- else {
- /* go tru the supplied list of names */
- for (j = 0; j < n_objs; j++) {
- I = table->nelems + added;
- added++;
- HDstrcpy(table->objs[I].path, obj_list[j].obj);
- aux_tblinsert_layout(table, I, pack);
-
- }
- }
-
- table->nelems += added;
-
- return 0;
+int
+options_add_layout(obj_list_t *obj_list, unsigned n_objs, pack_info_t *pack,
+ pack_opttbl_t *table)
+{
+ unsigned i, j, I;
+ unsigned added = 0;
+ hbool_t found = FALSE;
+
+ /* increase the size of the collection by N_OBJS if necessary */
+ if (table->nelems + n_objs >= table->size)
+ if (aux_inctable(table, n_objs) < 0)
+ return -1;
+
+ /* search if this object is already in the table; "path" is the key */
+ if (table->nelems > 0) {
+ /* go tru the supplied list of names */
+ for (j = 0; j < n_objs; j++) {
+ /* linear table search */
+ for (i = 0; i < table->nelems; i++) {
+ /*already on the table */
+ if (HDstrcmp(obj_list[j].obj,table->objs[i].path) == 0) {
+ /* already chunk info inserted for this one; exit */
+ if (table->objs[i].chunk.rank > 0) {
+ error_msg("chunk information already inserted for <%s>\n", obj_list[j].obj);
+ HDexit(EXIT_FAILURE);
+ }
+ /* insert the layout info */
+ else {
+ aux_tblinsert_layout(table, i, pack);
+ found = TRUE;
+ break;
+ }
+ } /* if */
+ } /* i */
+
+ if (!found) {
+ /* keep the grow in a temp var */
+ I = table->nelems + added;
+ added++;
+ HDstrcpy(table->objs[I].path, obj_list[j].obj);
+ aux_tblinsert_layout(table, I, pack);
+ }
+ /* cases where we have an already inserted name but there is a new name also
+ example:
+ -f dset1:GZIP=1 -l dset1,dset2:CHUNK=20x20
+ dset1 is already inserted, but dset2 must also be
+ */
+ else
+ if(found && HDstrcmp(obj_list[j].obj,table->objs[i].path) != 0) {
+ /* keep the grow in a temp var */
+ I = table->nelems + added;
+ added++;
+ HDstrcpy(table->objs[I].path, obj_list[j].obj);
+ aux_tblinsert_layout(table, I, pack);
+ }
+ } /* j */
+ }
+ /* first time insertion */
+ else {
+ /* go tru the supplied list of names */
+ for (j = 0; j < n_objs; j++) {
+ I = table->nelems + added;
+ added++;
+ HDstrcpy(table->objs[I].path, obj_list[j].obj);
+ aux_tblinsert_layout(table, I, pack);
+ }
+ }
+
+ table->nelems += added;
+
+ return 0;
}
/*-------------------------------------------------------------------------
@@ -268,71 +266,71 @@ int options_add_layout(obj_list_t *obj_list, int n_objs, pack_info_t *pack,
*
*-------------------------------------------------------------------------
*/
-
-int options_add_filter(obj_list_t *obj_list, int n_objs, filter_info_t filt,
- pack_opttbl_t *table) {
-
- unsigned int i, I;
- int j, added = 0, found = 0;
-
- /* increase the size of the collection by N_OBJS if necessary */
- if (table->nelems + n_objs >= table->size) {
- if (aux_inctable(table, n_objs) < 0)
- return -1;
- }
-
- /* search if this object is already in the table; "path" is the key */
- if (table->nelems > 0) {
- /* go tru the supplied list of names */
- for (j = 0; j < n_objs; j++) {
- /* linear table search */
- for (i = 0; i < table->nelems; i++) {
- /*already on the table */
- if (HDstrcmp(obj_list[j].obj,table->objs[i].path) == 0) {
- /* insert */
- aux_tblinsert_filter(table, i, filt);
- found = 1;
- break;
- } /* if */
- } /* i */
-
- if (found == 0) {
- /* keep the grow in a temp var */
- I = table->nelems + added;
- added++;
- HDstrcpy(table->objs[I].path, obj_list[j].obj);
- aux_tblinsert_filter(table, I, filt);
- }
- /* cases where we have an already inserted name but there is a new name also
- example:
- -l dset1:CHUNK=20x20 -f dset1,dset2:GZIP=1
- dset1 is already inserted, but dset2 must also be
- */
- else if (found == 1
- && HDstrcmp(obj_list[j].obj,table->objs[i].path) != 0) {
- /* keep the grow in a temp var */
- I = table->nelems + added;
- added++;
- HDstrcpy(table->objs[I].path, obj_list[j].obj);
- aux_tblinsert_filter(table, I, filt);
- }
- } /* j */
- }
-
- /* first time insertion */
- else {
- /* go tru the supplied list of names */
- for (j = 0; j < n_objs; j++) {
- I = table->nelems + added;
- added++;
- HDstrcpy(table->objs[I].path, obj_list[j].obj);
- aux_tblinsert_filter(table, I, filt);
- }
- }
-
- table->nelems += added;
-
- return 0;
+int
+options_add_filter(obj_list_t *obj_list, unsigned n_objs, filter_info_t filt,
+ pack_opttbl_t *table)
+{
+ unsigned int i, j, I;
+ unsigned added = 0;
+ hbool_t found = FALSE;
+
+ /* increase the size of the collection by N_OBJS if necessary */
+ if (table->nelems + n_objs >= table->size)
+ if (aux_inctable(table, n_objs) < 0)
+ return -1;
+
+ /* search if this object is already in the table; "path" is the key */
+ if (table->nelems > 0) {
+ /* go tru the supplied list of names */
+ for (j = 0; j < n_objs; j++) {
+ /* linear table search */
+ for (i = 0; i < table->nelems; i++) {
+ /*already on the table */
+ if (HDstrcmp(obj_list[j].obj, table->objs[i].path) == 0) {
+ /* insert */
+ aux_tblinsert_filter(table, i, filt);
+ found = TRUE;
+ break;
+ } /* if */
+ } /* i */
+
+ if (!found) {
+ /* keep the grow in a temp var */
+ I = table->nelems + added;
+ added++;
+ HDstrcpy(table->objs[I].path, obj_list[j].obj);
+ aux_tblinsert_filter(table, I, filt);
+ }
+ /* cases where we have an already inserted name but there is a new name also
+ example:
+ -l dset1:CHUNK=20x20 -f dset1,dset2:GZIP=1
+ dset1 is already inserted, but dset2 must also be
+ */
+ else
+ if(found && HDstrcmp(obj_list[j].obj,table->objs[i].path) != 0) {
+ /* keep the grow in a temp var */
+ I = table->nelems + added;
+ added++;
+ HDstrcpy(table->objs[I].path, obj_list[j].obj);
+ aux_tblinsert_filter(table, I, filt);
+ }
+ } /* j */
+ }
+
+ /* first time insertion */
+ else {
+ /* go tru the supplied list of names */
+ for (j = 0; j < n_objs; j++) {
+ I = table->nelems + added;
+ added++;
+ HDstrcpy(table->objs[I].path, obj_list[j].obj);
+ aux_tblinsert_filter(table, I, filt);
+ }
+ }
+
+ table->nelems += added;
+
+ return 0;
}
/*-------------------------------------------------------------------------
diff --git a/tools/h5repack/h5repack_parse.c b/tools/h5repack/h5repack_parse.c
index 1d71c13..004b9e4 100644
--- a/tools/h5repack/h5repack_parse.c
+++ b/tools/h5repack/h5repack_parse.c
@@ -31,493 +31,425 @@
* FLET, to apply the HDF5 checksum filter
* NBIT, to apply the HDF5 NBIT filter (NBIT compression)
* SOFF, to apply the HDF5 scale+offset filter (compression)
- * UD, to apply a User Defined filter k, m, n1[,…,nm]
+ * UD, to apply a User Defined filter k,m,n1[,…,nm]
* NONE, to remove the filter
*
* Examples:
* "GZIP=6"
* "A,B:NONE"
- *
- * Programmer: Pedro Vicente, pvn@ncsa.uiuc.edu
- *
- * Date: September, 23, 2003
- *
*-------------------------------------------------------------------------
*/
-
-
-obj_list_t* parse_filter(const char *str,
- int *n_objs,
- filter_info_t *filt,
- pack_opt_t *options,
- int *is_glb)
-{
- unsigned i, u;
+obj_list_t* parse_filter(const char *str, unsigned *n_objs, filter_info_t *filt,
+ pack_opt_t *options, int *is_glb) {
+ size_t i, m, u;
char c;
- size_t len=HDstrlen(str);
- int j, m, n, k, l, p, r, q, end_obj=-1, no_param=0;
+ size_t len = HDstrlen(str);
+ int k, l, p, q, end_obj = -1, no_param = 0;
+ unsigned j, n;
char sobj[MAX_NC_NAME];
char scomp[10];
char stype[6];
char smask[3];
- obj_list_t* obj_list=NULL;
+ obj_list_t* obj_list = NULL;
unsigned pixels_per_block;
-
/* initialize compression info */
- HDmemset(filt,0,sizeof(filter_info_t));
+ HDmemset(filt, 0, sizeof(filter_info_t));
*is_glb = 0;
/* check for the end of object list and number of objects */
- for ( i = 0, n = 0; i < len; i++)
- {
+ for (i = 0, n = 0; i < len; i++) {
c = str[i];
- if ( c==':' )
- {
- end_obj=i;
- }
- if ( c==',' )
- {
+ if (c == ':')
+ end_obj = (int) i;
+ if (c == ',')
n++;
- }
}
- if (end_obj==-1) /* missing : */
- {
+ /* Check for missing : */
+ if (end_obj == -1) {
/* apply to all objects */
- options->all_filter=1;
+ options->all_filter = 1;
*is_glb = 1;
}
n++;
- obj_list = (obj_list_t*) HDmalloc(n*sizeof(obj_list_t));
- if (obj_list==NULL)
- {
+ obj_list = (obj_list_t *) HDmalloc(n * sizeof(obj_list_t));
+ if (obj_list == NULL) {
error_msg("could not allocate object list\n");
return NULL;
}
- *n_objs=n;
+ *n_objs = n;
/* get object list */
- for ( j = 0, k = 0, n = 0; j < end_obj; j++, k++)
- {
- c = str[j];
- sobj[k] = c;
- if ( c==',' || j==end_obj-1)
- {
- if ( c==',') sobj[k]='\0'; else sobj[k+1]='\0';
- HDstrcpy(obj_list[n].obj,sobj);
- HDmemset(sobj,0,sizeof(sobj));
- n++;
- k=-1;
+ if (end_obj > 0)
+ for (j = 0, k = 0, n = 0; j < (unsigned) end_obj; j++, k++) {
+ c = str[j];
+ sobj[k] = c;
+ if (c == ',' || j == (unsigned) (end_obj - 1)) {
+ if (c == ',')
+ sobj[k] = '\0';
+ else
+ sobj[k + 1] = '\0';
+ HDstrcpy(obj_list[n].obj, sobj);
+ HDmemset(sobj, 0, sizeof(sobj));
+ n++;
+ k = -1;
+ }
}
- }
/* nothing after : */
- if (end_obj+1==(int)len)
- {
- if (obj_list) HDfree(obj_list);
- error_msg("input Error: Invalid compression type in <%s>\n",str);
+ if (end_obj + 1 == (int) len) {
+ if (obj_list)
+ HDfree(obj_list);
+ error_msg("input Error: Invalid compression type in <%s>\n", str);
HDexit(EXIT_FAILURE);
}
-
/* get filter additional parameters */
- m=0;
- for ( i=end_obj+1, k=0, j=0; i<len; i++,k++)
- {
+ m = 0;
+ for (i = (size_t)(end_obj + 1), k = 0, j = 0; i < len; i++, k++) {
c = str[i];
- scomp[k]=c;
- if ( c=='=' || i==len-1)
- {
- if ( c=='=') /*one more parameter */
- {
- scomp[k]='\0'; /*cut space */
+ scomp[k] = c;
+ if (c == '=' || i == len - 1) {
+ if (c == '=') { /*one more parameter */
+ scomp[k] = '\0'; /*cut space */
/*-------------------------------------------------------------------------
- * H5Z_FILTER_SZIP
- * szip has the format SZIP=<pixels per block,coding>
- * pixels per block is a even number in 2-32 and coding method is 'EC' or 'NN'
- * example SZIP=8,NN
- *-------------------------------------------------------------------------
- */
- if (HDstrcmp(scomp,"SZIP")==0)
- {
- l=-1; /* mask index check */
- for ( m=0,u=i+1; u<len; u++,m++)
- {
- if (str[u]==',')
- {
- stype[m]='\0'; /* end digit of szip */
- l=0; /* start EC or NN search */
- u++; /* skip ',' */
+ * H5Z_FILTER_SZIP
+ * szip has the format SZIP=<pixels per block,coding>
+ * pixels per block is a even number in 2-32 and coding method is 'EC' or 'NN'
+ * example SZIP=8,NN
+ *-------------------------------------------------------------------------
+ */
+ if (HDstrcmp(scomp, "SZIP") == 0) {
+ l = -1; /* mask index check */
+ for (m = 0, u = i + 1; u < len; u++, m++) {
+ if (str[u] == ',') {
+ stype[m] = '\0'; /* end digit of szip */
+ l = 0; /* start EC or NN search */
+ u++; /* skip ',' */
}
c = str[u];
- if (!isdigit(c) && l==-1)
- {
- if (obj_list) HDfree(obj_list);
- error_msg("compression parameter not digit in <%s>\n",str);
+ if (!HDisdigit(c) && l == -1) {
+ if (obj_list)
+ HDfree(obj_list);
+ error_msg("compression parameter not digit in <%s>\n", str);
HDexit(EXIT_FAILURE);
}
- if (l==-1)
- stype[m]=c;
- else
- {
- smask[l]=c;
+ if (l == -1)
+ stype[m] = c;
+ else {
+ smask[l] = c;
l++;
- if (l==2)
- {
- smask[l]='\0';
- i=len-1; /* end */
+ if (l == 2) {
+ smask[l] = '\0';
+ i = len - 1; /* end */
(*n_objs)--; /* we counted an extra ',' */
- if (HDstrcmp(smask,"NN")==0)
- filt->cd_values[j++]=H5_SZIP_NN_OPTION_MASK;
- else if (HDstrcmp(smask,"EC")==0)
- filt->cd_values[j++]=H5_SZIP_EC_OPTION_MASK;
- else
- {
+ if (HDstrcmp(smask,"NN") == 0)
+ filt->cd_values[j++] = H5_SZIP_NN_OPTION_MASK;
+ else if (HDstrcmp(smask,"EC") == 0)
+ filt->cd_values[j++] = H5_SZIP_EC_OPTION_MASK;
+ else {
error_msg("szip mask must be 'NN' or 'EC' \n");
HDexit(EXIT_FAILURE);
}
-
-
}
}
-
- } /* u */
+ } /* u */
} /*if */
/*-------------------------------------------------------------------------
- * H5Z_FILTER_SCALEOFFSET
- * scaleoffset has the format SOFF=<scale_factor,scale_type>
- * scale_type can be
- * integer datatype, H5Z_SO_INT (IN)
- * float datatype using D-scaling method, H5Z_SO_FLOAT_DSCALE (DS)
- * float datatype using E-scaling method, H5Z_SO_FLOAT_ESCALE (ES) , not yet implemented
- * for integer datatypes, scale_factor denotes Minimum Bits
- * for float datatypes, scale_factor denotes decimal scale factor
- * examples
- * SOFF=31,IN
- * SOFF=3,DF
- *-------------------------------------------------------------------------
- */
-
- else if (HDstrcmp(scomp,"SOFF")==0)
- {
- l=-1; /* mask index check */
- for ( m=0,u=i+1; u<len; u++,m++)
- {
- if (str[u]==',')
- {
- stype[m]='\0'; /* end digit */
- l=0; /* start 'IN' , 'DS', or 'ES' search */
- u++; /* skip ',' */
+ * H5Z_FILTER_SCALEOFFSET
+ * scaleoffset has the format SOFF=<scale_factor,scale_type>
+ * scale_type can be
+ * integer datatype, H5Z_SO_INT (IN)
+ * float datatype using D-scaling method, H5Z_SO_FLOAT_DSCALE (DS)
+ * float datatype using E-scaling method, H5Z_SO_FLOAT_ESCALE (ES) , not yet implemented
+ * for integer datatypes, scale_factor denotes Minimum Bits
+ * for float datatypes, scale_factor denotes decimal scale factor
+ * examples
+ * SOFF=31,IN
+ * SOFF=3,DF
+ *-------------------------------------------------------------------------
+ */
+ else if (HDstrcmp(scomp, "SOFF") == 0) {
+ l = -1; /* mask index check */
+ for (m = 0, u = i + 1; u < len; u++, m++) {
+ if (str[u] == ',') {
+ stype[m] = '\0'; /* end digit */
+ l = 0; /* start 'IN' , 'DS', or 'ES' search */
+ u++; /* skip ',' */
}
c = str[u];
- if (!isdigit(c) && l==-1)
- {
- if (obj_list) HDfree(obj_list);
- error_msg("compression parameter is not a digit in <%s>\n",str);
+ if (!HDisdigit(c) && l == -1) {
+ if (obj_list)
+ HDfree(obj_list);
+ error_msg("compression parameter is not a digit in <%s>\n", str);
HDexit(EXIT_FAILURE);
}
- if (l==-1)
- stype[m]=c;
- else
- {
- smask[l]=c;
+ if (l == -1)
+ stype[m] = c;
+ else {
+ smask[l] = c;
l++;
- if (l==2)
- {
- smask[l]='\0';
- i=len-1; /* end */
+ if (l == 2) {
+ smask[l] = '\0';
+ i = len - 1; /* end */
(*n_objs)--; /* we counted an extra ',' */
- if (HDstrcmp(smask,"IN")==0)
- filt->cd_values[j++]=H5Z_SO_INT;
- else if (HDstrcmp(smask,"DS")==H5Z_SO_FLOAT_DSCALE)
- filt->cd_values[j++]=H5Z_SO_FLOAT_DSCALE;
- else
- {
+ if (HDstrcmp(smask,"IN") == 0)
+ filt->cd_values[j++] = H5Z_SO_INT;
+ else if (HDstrcmp(smask, "DS") == H5Z_SO_FLOAT_DSCALE)
+ filt->cd_values[j++] = H5Z_SO_FLOAT_DSCALE;
+ else {
error_msg("scale type must be 'IN' or 'DS' \n");
HDexit(EXIT_FAILURE);
}
-
}
}
-
- } /* u */
+ } /* u */
} /*if */
+
/*-------------------------------------------------------------------------
- * User Defined
- * has the format UD=<filter_number,cd_value_count,value_1[,value_2,...,value_N]>
- * BZIP2 example
- * UD=307,1,9
- *-------------------------------------------------------------------------
- */
-
- else if (HDstrcmp(scomp,"UD")==0)
- {
- l=-1; /* filter number index check */
- p=-1; /* CD_VAL count check */
- r=-1; /* CD_VAL check */
- for ( m=0,q=0,u=i+1; u<len; u++,m++,q++)
- {
- if (str[u]==',')
- {
- stype[q]='\0'; /* end digit */
- if (l==-1)
- {
- filt->filtn=atoi(stype);
- l=0;
+ * User Defined
+ * has the format UD=<filter_number,cd_value_count,value_1[,value_2,...,value_N]>
+ * BZIP2 example
+ * UD=307,1,9
+ *-------------------------------------------------------------------------
+ */
+ else if (HDstrcmp(scomp, "UD") == 0) {
+ l = -1; /* filter number index check */
+ p = -1; /* CD_VAL count check */
+ for (m = 0, q = 0, u = i + 1; u < len; u++, m++, q++) {
+ if (str[u] == ',') {
+ stype[q] = '\0'; /* end digit */
+ if (l == -1) {
+ filt->filtn = HDatoi(stype);
+ l = 0;
}
- else if (p==-1)
- {
- filt->cd_nelmts=atoi(stype);
- p=0;
+ else if (p == -1) {
+ filt->cd_nelmts = HDstrtoull(stype, NULL, 0);
+ p = 0;
}
else
- r=0;
- q=0;
- u++; /* skip ',' */
+ filt->cd_values[j++] = (unsigned)HDstrtoul(stype, NULL, 0);
+ q = 0;
+ u++; /* skip ',' */
}
c = str[u];
- if (!isdigit(c) && l==-1)
- {
- if (obj_list) HDfree(obj_list);
- error_msg("filter number parameter is not a digit in <%s>\n",str);
+ if (!HDisdigit(c) && l == -1) {
+ if (obj_list)
+ HDfree(obj_list);
+ error_msg("filter number parameter is not a digit in <%s>\n", str);
HDexit(EXIT_FAILURE);
}
- stype[q]=c;
- if (l==0 && p==0)
- {
- if (r==0)
- filt->cd_values[j++]=atoi(stype);
- }
-
- } /* u */
-
- stype[q]='\0';
+ stype[q] = c;
+ } /* for u */
+ stype[q] = '\0';
} /*if */
-
/*-------------------------------------------------------------------------
- * all other filters
- *-------------------------------------------------------------------------
- */
-
- else
- {
+ * all other filters
+ *-------------------------------------------------------------------------
+ */
+ else {
/* here we could have 1 or 2 digits */
- for ( m=0,u=i+1; u<len; u++,m++)
- {
+ for (m = 0, u = i + 1; u < len; u++, m++) {
c = str[u];
- if (!isdigit(c)){
- if (obj_list) HDfree(obj_list);
- error_msg("compression parameter is not a digit in <%s>\n",str);
+ if (!HDisdigit(c)) {
+ if (obj_list)
+ HDfree(obj_list);
+ error_msg("compression parameter is not a digit in <%s>\n", str);
HDexit(EXIT_FAILURE);
}
- stype[m]=c;
+ stype[m] = c;
} /* u */
- stype[m]='\0';
+ stype[m] = '\0';
} /*if */
-
-
- filt->cd_values[j++]=atoi(stype);
- i+=m; /* jump */
+ filt->cd_values[j++] = (unsigned) HDstrtoul(stype, NULL, 0);
+ if(filt->cd_nelmts == 0)
+ j = 0;
+ i += m; /* jump */
}
- else if (i==len-1)
- { /*no more parameters */
- scomp[k+1]='\0';
- no_param=1;
+ else if (i == len - 1) { /*no more parameters */
+ scomp[k + 1] = '\0';
+ no_param = 1;
}
/*-------------------------------------------------------------------------
- * translate from string to filter symbol
- *-------------------------------------------------------------------------
- */
+ * translate from string to filter symbol
+ *-------------------------------------------------------------------------
+ */
/*-------------------------------------------------------------------------
- * H5Z_FILTER_NONE
- *-------------------------------------------------------------------------
- */
- if (HDstrcmp(scomp,"NONE")==0)
- {
- filt->filtn=H5Z_FILTER_NONE;
+ * H5Z_FILTER_NONE
+ *-------------------------------------------------------------------------
+ */
+ if (HDstrcmp(scomp, "NONE") == 0) {
+ filt->filtn = H5Z_FILTER_NONE;
filt->cd_nelmts = 0;
}
/*-------------------------------------------------------------------------
- * H5Z_FILTER_DEFLATE
- *-------------------------------------------------------------------------
- */
- else if (HDstrcmp(scomp,"GZIP")==0)
- {
- filt->filtn=H5Z_FILTER_DEFLATE;
+ * H5Z_FILTER_DEFLATE
+ *-------------------------------------------------------------------------
+ */
+ else if (HDstrcmp(scomp, "GZIP") == 0) {
+ filt->filtn = H5Z_FILTER_DEFLATE;
filt->cd_nelmts = 1;
- if (no_param)
- { /*no more parameters, GZIP must have parameter */
- if (obj_list) HDfree(obj_list);
- error_msg("missing compression parameter in <%s>\n",str);
+ if (no_param) { /*no more parameters, GZIP must have parameter */
+ if (obj_list)
+ HDfree(obj_list);
+ error_msg("missing compression parameter in <%s>\n", str);
HDexit(EXIT_FAILURE);
}
}
/*-------------------------------------------------------------------------
- * H5Z_FILTER_SZIP
- *-------------------------------------------------------------------------
- */
- else if (HDstrcmp(scomp,"SZIP")==0)
- {
- filt->filtn=H5Z_FILTER_SZIP;
+ * H5Z_FILTER_SZIP
+ *-------------------------------------------------------------------------
+ */
+ else if (HDstrcmp(scomp, "SZIP") == 0) {
+ filt->filtn = H5Z_FILTER_SZIP;
filt->cd_nelmts = 2;
- if (no_param)
- { /*no more parameters, SZIP must have parameter */
- if (obj_list) HDfree(obj_list);
- error_msg("missing compression parameter in <%s>\n",str);
+ if (no_param) { /*no more parameters, SZIP must have parameter */
+ if (obj_list)
+ HDfree(obj_list);
+ error_msg("missing compression parameter in <%s>\n", str);
HDexit(EXIT_FAILURE);
}
}
/*-------------------------------------------------------------------------
- * H5Z_FILTER_SHUFFLE
- *-------------------------------------------------------------------------
- */
- else if (HDstrcmp(scomp,"SHUF")==0)
- {
- filt->filtn=H5Z_FILTER_SHUFFLE;
+ * H5Z_FILTER_SHUFFLE
+ *-------------------------------------------------------------------------
+ */
+ else if (HDstrcmp(scomp, "SHUF") == 0) {
+ filt->filtn = H5Z_FILTER_SHUFFLE;
filt->cd_nelmts = 0;
- if (m>0)
- { /*shuffle does not have parameter */
- if (obj_list) HDfree(obj_list);
- error_msg("extra parameter in SHUF <%s>\n",str);
+ if (m > 0) { /*shuffle does not have parameter */
+ if (obj_list)
+ HDfree(obj_list);
+ error_msg("extra parameter in SHUF <%s>\n", str);
HDexit(EXIT_FAILURE);
}
}
/*-------------------------------------------------------------------------
- * H5Z_FILTER_FLETCHER32
- *-------------------------------------------------------------------------
- */
- else if (HDstrcmp(scomp,"FLET")==0)
- {
- filt->filtn=H5Z_FILTER_FLETCHER32;
+ * H5Z_FILTER_FLETCHER32
+ *-------------------------------------------------------------------------
+ */
+ else if (HDstrcmp(scomp, "FLET") == 0) {
+ filt->filtn = H5Z_FILTER_FLETCHER32;
filt->cd_nelmts = 0;
- if (m>0)
- { /*shuffle does not have parameter */
- if (obj_list) HDfree(obj_list);
- error_msg("extra parameter in FLET <%s>\n",str);
+ if (m > 0) { /*shuffle does not have parameter */
+ if (obj_list)
+ HDfree(obj_list);
+ error_msg("extra parameter in FLET <%s>\n", str);
HDexit(EXIT_FAILURE);
}
}
/*-------------------------------------------------------------------------
- * H5Z_FILTER_NBIT
- *-------------------------------------------------------------------------
- */
- else if (HDstrcmp(scomp,"NBIT")==0)
- {
- filt->filtn=H5Z_FILTER_NBIT;
+ * H5Z_FILTER_NBIT
+ *-------------------------------------------------------------------------
+ */
+ else if (HDstrcmp(scomp, "NBIT") == 0) {
+ filt->filtn = H5Z_FILTER_NBIT;
filt->cd_nelmts = 0;
- if (m>0)
- { /*nbit does not have parameter */
- if (obj_list) HDfree(obj_list);
- error_msg("extra parameter in NBIT <%s>\n",str);
+ if (m > 0) { /*nbit does not have parameter */
+ if (obj_list)
+ HDfree(obj_list);
+ error_msg("extra parameter in NBIT <%s>\n", str);
HDexit(EXIT_FAILURE);
}
}
/*-------------------------------------------------------------------------
- * H5Z_FILTER_SCALEOFFSET
- *-------------------------------------------------------------------------
- */
- else if (HDstrcmp(scomp,"SOFF")==0)
- {
- filt->filtn=H5Z_FILTER_SCALEOFFSET;
+ * H5Z_FILTER_SCALEOFFSET
+ *-------------------------------------------------------------------------
+ */
+ else if (HDstrcmp(scomp, "SOFF") == 0) {
+ filt->filtn = H5Z_FILTER_SCALEOFFSET;
filt->cd_nelmts = 2;
- if (no_param)
- { /*no more parameters, SOFF must have parameter */
- if (obj_list) HDfree(obj_list);
- error_msg("missing compression parameter in <%s>\n",str);
+ if (no_param) { /*no more parameters, SOFF must have parameter */
+ if (obj_list)
+ HDfree(obj_list);
+ error_msg("missing compression parameter in <%s>\n", str);
HDexit(EXIT_FAILURE);
}
}
/*-------------------------------------------------------------------------
- * User Defined Filter
- *-------------------------------------------------------------------------
- */
- else if (HDstrcmp(scomp,"UD")==0)
- {
- if (filt->cd_nelmts != j)
- { /* parameters does not match count */
- if (obj_list) HDfree(obj_list);
- error_msg("incorrect number of compression parameters in <%s>\n",str);
+ * User Defined Filter
+ *-------------------------------------------------------------------------
+ */
+ else if (HDstrcmp(scomp, "UD") == 0) {
+ /* parameters does not match count */
+ if (filt->cd_nelmts != j) {
+ if (obj_list)
+ HDfree(obj_list);
+ error_msg("incorrect number of compression parameters in <%s>\n", str);
HDexit(EXIT_FAILURE);
}
}
else {
- if (obj_list) HDfree(obj_list);
- error_msg("invalid filter type in <%s>\n",str);
+ if (obj_list)
+ HDfree(obj_list);
+ error_msg("invalid filter type in <%s>\n", str);
HDexit(EXIT_FAILURE);
}
}
} /*i*/
/*-------------------------------------------------------------------------
- * check valid parameters
- *-------------------------------------------------------------------------
- */
-
- switch (filt->filtn)
- {
+ * check valid parameters
+ *-------------------------------------------------------------------------
+ */
+ switch (filt->filtn) {
/*-------------------------------------------------------------------------
- * H5Z_FILTER_DEFLATE
- *-------------------------------------------------------------------------
- */
-
+ * H5Z_FILTER_DEFLATE
+ *-------------------------------------------------------------------------
+ */
case H5Z_FILTER_DEFLATE:
- if (filt->cd_values[0]>9 )
- {
- if (obj_list) HDfree(obj_list);
- error_msg("invalid compression parameter in <%s>\n",str);
+ if (filt->cd_values[0] > 9) {
+ if (obj_list)
+ HDfree(obj_list);
+ error_msg("invalid compression parameter in <%s>\n", str);
HDexit(EXIT_FAILURE);
}
break;
-
/*-------------------------------------------------------------------------
- * H5Z_FILTER_SZIP
- *-------------------------------------------------------------------------
- */
-
+ * H5Z_FILTER_SZIP
+ *-------------------------------------------------------------------------
+ */
case H5Z_FILTER_SZIP:
- pixels_per_block=filt->cd_values[0];
- if ((pixels_per_block%2)==1)
- {
- if (obj_list) HDfree(obj_list);
- error_msg("pixels_per_block is not even in <%s>\n",str);
+ pixels_per_block = filt->cd_values[0];
+ if ((pixels_per_block % 2) == 1) {
+ if (obj_list)
+ HDfree(obj_list);
+ error_msg("pixels_per_block is not even in <%s>\n", str);
HDexit(EXIT_FAILURE);
}
- if (pixels_per_block>H5_SZIP_MAX_PIXELS_PER_BLOCK)
- {
- if (obj_list) HDfree(obj_list);
- error_msg("pixels_per_block is too large in <%s>\n",str);
+ if (pixels_per_block > H5_SZIP_MAX_PIXELS_PER_BLOCK) {
+ if (obj_list)
+ HDfree(obj_list);
+ error_msg("pixels_per_block is too large in <%s>\n", str);
HDexit(EXIT_FAILURE);
}
- if ( (HDstrcmp(smask,"NN")!=0) && (HDstrcmp(smask,"EC")!=0) )
- {
- if (obj_list) HDfree(obj_list);
+ if ((HDstrcmp(smask,"NN") != 0) && (HDstrcmp(smask,"EC") != 0)) {
+ if (obj_list)
+ HDfree(obj_list);
error_msg("szip mask must be 'NN' or 'EC' \n");
HDexit(EXIT_FAILURE);
}
break;
default:
break;
-
-
};
return obj_list;
}
-
-
+
/*-------------------------------------------------------------------------
* Function: parse_layout
*
@@ -539,176 +471,146 @@ obj_list_t* parse_filter(const char *str,
*
*-------------------------------------------------------------------------
*/
-obj_list_t* parse_layout(const char *str,
- int *n_objs,
- pack_info_t *pack, /* info about layout needed */
- pack_opt_t *options)
-{
- obj_list_t* obj_list=NULL;
- unsigned i;
+obj_list_t* parse_layout(const char *str, unsigned *n_objs, pack_info_t *pack, /* info about layout needed */
+pack_opt_t *options) {
+ obj_list_t* obj_list = NULL;
+ unsigned i, j, n;
char c;
- size_t len=HDstrlen(str);
- int j, n, k, end_obj=-1, c_index;
+ size_t len = HDstrlen(str);
+ int k, end_obj = -1, c_index;
char sobj[MAX_NC_NAME];
char sdim[10];
char slayout[10];
-
HDmemset(sdim, '\0', sizeof(sdim));
HDmemset(sobj, '\0', sizeof(sobj));
HDmemset(slayout, '\0', sizeof(slayout));
/* check for the end of object list and number of objects */
- for ( i=0, n=0; i<len; i++)
- {
+ for (i = 0, n = 0; i < len; i++) {
c = str[i];
- if ( c==':' )
- {
- end_obj=i;
- }
- if ( c==',' )
- {
+ if (c == ':')
+ end_obj = (int) i;
+ if (c == ',')
n++;
- }
}
- if (end_obj==-1) { /* missing : chunk all */
- options->all_layout=1;
+ if (end_obj == -1) { /* missing : chunk all */
+ options->all_layout = 1;
}
n++;
- obj_list = (obj_list_t*) HDmalloc(n*sizeof(obj_list_t));
- if (obj_list==NULL)
- {
+ obj_list = (obj_list_t*) HDmalloc(n * sizeof(obj_list_t));
+ if (obj_list == NULL) {
error_msg("could not allocate object list\n");
return NULL;
}
- *n_objs=n;
+ *n_objs = n;
/* get object list */
- for ( j=0, k=0, n=0; j<end_obj; j++,k++)
- {
- c = str[j];
- sobj[k]=c;
- if ( c==',' || j==end_obj-1)
- {
- if ( c==',') sobj[k]='\0'; else sobj[k+1]='\0';
- HDstrcpy(obj_list[n].obj,sobj);
- HDmemset(sobj,0,sizeof(sobj));
- n++;
- k=-1;
+ if (end_obj > 0)
+ for (j = 0, k = 0, n = 0; j < (unsigned) end_obj; j++, k++) {
+ c = str[j];
+ sobj[k] = c;
+ if (c == ',' || j == (unsigned) (end_obj - 1)) {
+ if (c == ',')
+ sobj[k] = '\0';
+ else
+ sobj[k + 1] = '\0';
+ HDstrcpy(obj_list[n].obj, sobj);
+ HDmemset(sobj, 0, sizeof(sobj));
+ n++;
+ k = -1;
+ }
}
- }
/* nothing after : */
- if (end_obj+1==(int)len)
- {
- if (obj_list) HDfree(obj_list);
- error_msg("in parse layout, no characters after : in <%s>\n",str);
+ if (end_obj + 1 == (int) len) {
+ if (obj_list)
+ HDfree(obj_list);
+ error_msg("in parse layout, no characters after : in <%s>\n", str);
HDexit(EXIT_FAILURE);
}
/* get layout info */
- for ( j=end_obj+1, n=0; n<=5; j++,n++)
- {
- if (n==5)
- {
- slayout[n]='\0'; /*cut string */
- if (HDstrcmp(slayout,"COMPA")==0)
- pack->layout=H5D_COMPACT;
- else if (HDstrcmp(slayout,"CONTI")==0)
- pack->layout=H5D_CONTIGUOUS;
- else if (HDstrcmp(slayout,"CHUNK")==0)
- pack->layout=H5D_CHUNKED;
+ for (j = (unsigned) (end_obj + 1), n = 0; n <= 5; j++, n++) {
+ if (n == 5) {
+ slayout[n] = '\0'; /*cut string */
+ if (HDstrcmp(slayout, "COMPA") == 0)
+ pack->layout = H5D_COMPACT;
+ else if (HDstrcmp(slayout, "CONTI") == 0)
+ pack->layout = H5D_CONTIGUOUS;
+ else if (HDstrcmp(slayout, "CHUNK") == 0)
+ pack->layout = H5D_CHUNKED;
else {
- error_msg("in parse layout, not a valid layout in <%s>\n",str);
+ error_msg("in parse layout, not a valid layout in <%s>\n", str);
HDexit(EXIT_FAILURE);
}
}
- else
- {
+ else {
c = str[j];
- slayout[n]=c;
+ slayout[n] = c;
}
} /* j */
-
- if ( pack->layout==H5D_CHUNKED )
- {
-
+ if (pack->layout == H5D_CHUNKED) {
/*-------------------------------------------------------------------------
- * get chunk info
- *-------------------------------------------------------------------------
- */
- k=0;
-
- if (j>(int)len)
- {
- if (obj_list) HDfree(obj_list);
- error_msg("in parse layout, <%s> Chunk dimensions missing\n",str);
+ * get chunk info
+ *-------------------------------------------------------------------------
+ */
+ k = 0;
+ if (j > len) {
+ if (obj_list)
+ HDfree(obj_list);
+ error_msg("in parse layout, <%s> Chunk dimensions missing\n", str);
HDexit(EXIT_FAILURE);
}
- for ( i=j, c_index=0; i<len; i++)
- {
+ for (i = j, c_index = 0; i < len; i++) {
c = str[i];
- sdim[k]=c;
+ sdim[k] = c;
k++; /*increment sdim index */
- if (!isdigit(c) && c!='x'
- && c!='N' && c!='O' && c!='N' && c!='E'
- ){
- if (obj_list) HDfree(obj_list);
- error_msg("in parse layout, <%s> Not a valid character in <%s>\n",
- sdim,str);
+ if (!HDisdigit(c) && c != 'x' && c != 'N' && c != 'O' && c != 'N' && c != 'E') {
+ if (obj_list)
+ HDfree(obj_list);
+ error_msg("in parse layout, <%s> Not a valid character in <%s>\n", sdim, str);
HDexit(EXIT_FAILURE);
}
- if ( c=='x' || i==len-1)
- {
- if ( c=='x') {
- sdim[k-1]='\0';
- k=0;
- pack->chunk.chunk_lengths[c_index]=atoi(sdim);
- if (pack->chunk.chunk_lengths[c_index]==0) {
- if (obj_list) HDfree(obj_list);
- error_msg("in parse layout, <%s> conversion to number in <%s>\n",
- sdim,str);
+ if (c == 'x' || i == len - 1) {
+ if (c == 'x') {
+ sdim[k - 1] = '\0';
+ k = 0;
+ pack->chunk.chunk_lengths[c_index] = HDstrtoull(sdim, NULL, 0);
+ if (pack->chunk.chunk_lengths[c_index] == 0) {
+ if (obj_list)
+ HDfree(obj_list);
+ error_msg("in parse layout, <%s> conversion to number in <%s>\n", sdim, str);
HDexit(EXIT_FAILURE);
}
c_index++;
}
- else if (i==len-1) { /*no more parameters */
- sdim[k]='\0';
- k=0;
- if (HDstrcmp(sdim,"NONE")==0)
- {
- pack->chunk.rank=-2;
+ else if (i == len - 1) { /*no more parameters */
+ sdim[k] = '\0';
+ k = 0;
+ if (HDstrcmp(sdim,"NONE") == 0) {
+ pack->chunk.rank = -2;
}
- else
- {
- pack->chunk.chunk_lengths[c_index]=atoi(sdim);
- if (pack->chunk.chunk_lengths[c_index]==0){
- if (obj_list) HDfree(obj_list);
- error_msg("in parse layout, <%s> conversion to number in <%s>\n",
- sdim,str);
+ else {
+ pack->chunk.chunk_lengths[c_index] = HDstrtoull(sdim, NULL, 0);
+ if (pack->chunk.chunk_lengths[c_index] == 0) {
+ if (obj_list)
+ HDfree(obj_list);
+ error_msg("in parse layout, <%s> conversion to number in <%s>\n", sdim, str);
HDexit(EXIT_FAILURE);
}
- pack->chunk.rank=c_index+1;
+ pack->chunk.rank = c_index + 1;
}
} /*if */
} /*if c=='x' || i==len-1 */
} /*i*/
-
-
} /*H5D_CHUNKED*/
-
return obj_list;
}
-
-
-
-
-
-
diff --git a/tools/h5repack/h5repack_plugin.sh.in b/tools/h5repack/h5repack_plugin.sh.in
index 7502397..a064db6 100644
--- a/tools/h5repack/h5repack_plugin.sh.in
+++ b/tools/h5repack/h5repack_plugin.sh.in
@@ -127,7 +127,7 @@ CLEAN_TESTFILES_AND_TESTDIR()
# skip rm if srcdir is same as destdir
# this occurs when build/test performed in source dir and
# make cp fail
- SDIR=`$DIRNAME $tstfile`
+ SDIR=$SRC_H5REPACK_TESTFILES
INODE_SDIR=`$LS -i -d $SDIR | $AWK -F' ' '{print $1}'`
INODE_DDIR=`$LS -i -d $TESTDIR | $AWK -F' ' '{print $1}'`
if [ "$INODE_SDIR" != "$INODE_DDIR" ]; then
diff --git a/tools/h5repack/h5repacktst.c b/tools/h5repack/h5repacktst.c
index 07ea676..82b45fc 100644
--- a/tools/h5repack/h5repacktst.c
+++ b/tools/h5repack/h5repacktst.c
@@ -3421,7 +3421,7 @@ make_userblock(void)
/* Initialize userblock data */
for(u = 0; u < USERBLOCK_SIZE; u++)
- ub[u] = 'a' + (char)(u % 26);
+ ub[u] = (char)('a' + (char)(u % 26));
/* Re-open HDF5 file, as "plain" file */
if((fd = HDopen(FNAME16, O_WRONLY, 0644)) < 0)
@@ -3534,7 +3534,7 @@ make_userblock_file(void)
/* initialize userblock data */
for(u = 0; u < USERBLOCK_SIZE; u++)
- ub[u] = 'a' + (char)(u % 26);
+ ub[u] = (char)('a' + (char)(u % 26));
/* open file */
if((fd = HDopen(FNAME_UB,O_WRONLY|O_CREAT|O_TRUNC, 0644 )) < 0)
@@ -3591,7 +3591,8 @@ int write_dset_in(hid_t loc_id,
hid_t sid=-1;
hid_t tid=-1;
hid_t pid=-1;
- int val, i, j, k, n;
+ unsigned i, j;
+ int val, k, n;
float f;
/* create 1D attributes with dimension [2], 2 elements */
@@ -3646,13 +3647,10 @@ int write_dset_in(hid_t loc_id,
*/
- if (make_diffs)
- {
- for (i=0; i<2; i++)
- for (j=0; j<2; j++)
- {
- buf1[i][j]='z';
- }
+ if(make_diffs) {
+ for(i = 0; i < 2; i++)
+ for(j = 0; j < 2; j++)
+ buf1[i][j] = 'z';
}
@@ -3675,10 +3673,9 @@ int write_dset_in(hid_t loc_id,
*-------------------------------------------------------------------------
*/
- if (make_diffs)
- {
- for (i=0; i<2; i++)
- buf2[i]=buf2[1]=0;
+ if(make_diffs) {
+ for(i = 0; i < 2; i++)
+ buf2[i] = buf2[1] = 0;
}
if ((tid = H5Tcopy(H5T_STD_B8LE)) < 0)
@@ -3693,11 +3690,10 @@ int write_dset_in(hid_t loc_id,
*-------------------------------------------------------------------------
*/
- if (make_diffs)
- {
- for (i=0; i<2; i++)
- {
- buf3[i].a=0; buf3[i].b=0;
+ if(make_diffs) {
+ for(i = 0; i < 2; i++) {
+ buf3[i].a = 0;
+ buf3[i].b = 0;
}
}
@@ -3716,12 +3712,9 @@ int write_dset_in(hid_t loc_id,
*/
- if (make_diffs)
- {
- for (i=0; i<2; i++)
- {
- buf45[i]=GREEN;
- }
+ if(make_diffs) {
+ for(i = 0; i < 2; i++)
+ buf45[i] = GREEN;
}
if ((tid = H5Tcreate (H5T_COMPOUND, sizeof(s_t))) < 0)
@@ -3813,13 +3806,10 @@ int write_dset_in(hid_t loc_id,
*-------------------------------------------------------------------------
*/
- if (make_diffs)
- {
- for (i=0; i<2; i++)
- for (j=0; j<3; j++)
- {
- buf6[i][j]=0;
- }
+ if(make_diffs) {
+ for(i = 0; i < 2; i++)
+ for(j = 0; j < 3; j++)
+ buf6[i][j] = 0;
}
if ((tid = H5Tarray_create2(H5T_NATIVE_INT, 1, dimarray)) < 0)
@@ -3880,12 +3870,10 @@ int write_dset_in(hid_t loc_id,
*-------------------------------------------------------------------------
*/
- if (make_diffs)
- {
- for (i=0; i<2; i++)
- {
- buf7[i]=0;
- buf8[i]=0;
+ if(make_diffs) {
+ for(i = 0; i < 2; i++) {
+ buf7[i] = 0;
+ buf8[i] = 0;
}
}
@@ -4008,16 +3996,13 @@ int write_dset_in(hid_t loc_id,
/* Allocate and initialize VL dataset to write */
n = 0;
- for(i = 0; i < 3; i++)
- {
- for(j = 0; j < 2; j++)
- {
- int l;
+ for(i = 0; i < 3; i++) {
+ for(j = 0; j < 2; j++) {
+ unsigned l;
buf52[i][j].p = HDmalloc((i + 1) * sizeof(int));
buf52[i][j].len = (size_t)(i + 1);
- for(l = 0; l < i + 1; l++)
- {
+ for(l = 0; l < i + 1; l++) {
if(make_diffs)
((int *)buf52[i][j].p)[l] = 0;
else
@@ -4128,11 +4113,13 @@ int write_dset_in(hid_t loc_id,
n=1;
- for (i = 0; i < 4; i++) {
- for (j = 0; j < 3; j++) {
- for (k = 0; k < 2; k++) {
- if (make_diffs) buf23[i][j][k]=0;
- else buf23[i][j][k]=n++;
+ for(i = 0; i < 4; i++) {
+ for(j = 0; j < 3; j++) {
+ for(k = 0; k < 2; k++) {
+ if(make_diffs)
+ buf23[i][j][k] = 0;
+ else
+ buf23[i][j][k] = (char)(n++);
}
}
}
@@ -4164,16 +4151,16 @@ int write_dset_in(hid_t loc_id,
*/
n=1;
- for (i = 0; i < 4; i++) {
- for (j = 0; j < 3; j++) {
- for (k = 0; k < 2; k++) {
- if (make_diffs) {
- buf33[i][j][k].a=0;
- buf33[i][j][k].b=0;
+ for(i = 0; i < 4; i++) {
+ for(j = 0; j < 3; j++) {
+ for(k = 0; k < 2; k++) {
+ if(make_diffs) {
+ buf33[i][j][k].a = 0;
+ buf33[i][j][k].b = 0;
}
else {
- buf33[i][j][k].a=n++;
- buf33[i][j][k].b=n++;
+ buf33[i][j][k].a = (char)(n++);
+ buf33[i][j][k].b = n++;
}
}
}
@@ -4227,18 +4214,14 @@ int write_dset_in(hid_t loc_id,
/* Allocate and initialize VL dataset to write */
n = 0;
- for(i = 0; i < 4; i++)
- {
- for(j = 0; j < 3; j++)
- {
- for(k = 0; k < 2; k++)
- {
- int l;
+ for(i = 0; i < 4; i++) {
+ for(j = 0; j < 3; j++) {
+ for(k = 0; k < 2; k++) {
+ unsigned l;
buf53[i][j][k].p = HDmalloc((i + 1) * sizeof(int));
buf53[i][j][k].len = (size_t)(i + 1);
- for(l = 0; l < i + 1; l++)
- {
+ for(l = 0; l < i + 1; l++) {
if(make_diffs)
((int *)buf53[i][j][k].p)[l] = 0;
else
@@ -4274,10 +4257,8 @@ int write_dset_in(hid_t loc_id,
n = 1;
- for(i = 0; i < 24; i++)
- {
- for(j = 0; j < (int)dimarray[0]; j++)
- {
+ for(i = 0; i < 24; i++) {
+ for(j = 0; j < dimarray[0]; j++) {
if(make_diffs)
buf63[i][j] = 0;
else
@@ -4316,13 +4297,10 @@ int write_dset_in(hid_t loc_id,
if (write_dset(loc_id,3,dims3,"float3D",H5T_NATIVE_FLOAT,buf83) < 0)
goto out;
-
return 0;
-
out:
- H5E_BEGIN_TRY
- {
+ H5E_BEGIN_TRY {
H5Pclose(pid);
H5Sclose(sid);
H5Dclose(did);
@@ -4471,7 +4449,8 @@ int write_attr_in(hid_t loc_id,
hid_t aid = -1;
hid_t sid = -1;
hid_t tid = -1;
- int val, i, j, k, n;
+ int val, j, k, n;
+ unsigned i;
float f;
/* create 1D attributes with dimension [2], 2 elements */
@@ -5021,16 +5000,17 @@ int write_attr_in(hid_t loc_id,
/* Allocate and initialize VL dataset to write */
n=0;
- for (i = 0; i < 3; i++)
- {
- for (j = 0; j < 2; j++)
- {
- int l;
+ for(i = 0; i < 3; i++) {
+ for(j = 0; j < 2; j++) {
+ unsigned l;
+
buf52[i][j].p = HDmalloc((i + 1) * sizeof(int));
buf52[i][j].len = (size_t)(i + 1);
- for (l = 0; l < i + 1; l++)
- if (make_diffs)((int *)buf52[i][j].p)[l] = 0;
- else ((int *)buf52[i][j].p)[l] = n++;
+ for(l = 0; l < i + 1; l++)
+ if(make_diffs)
+ ((int *)buf52[i][j].p)[l] = 0;
+ else
+ ((int *)buf52[i][j].p)[l] = n++;
}
}
@@ -5239,14 +5219,13 @@ int write_attr_in(hid_t loc_id,
*/
n=1;
- for (i = 0; i < 4; i++)
- {
- for (j = 0; j < 3; j++)
- {
- for (k = 0; k < 2; k++)
- {
- if (make_diffs) buf23[i][j][k]=0;
- else buf23[i][j][k]=n++;
+ for(i = 0; i < 4; i++) {
+ for(j = 0; j < 3; j++) {
+ for(k = 0; k < 2; k++) {
+ if(make_diffs)
+ buf23[i][j][k] = 0;
+ else
+ buf23[i][j][k] = (char)(n++);
}
}
}
@@ -5308,21 +5287,16 @@ int write_attr_in(hid_t loc_id,
*/
n=1;
- for (i = 0; i < 4; i++)
- {
- for (j = 0; j < 3; j++)
- {
- for (k = 0; k < 2; k++)
- {
- if (make_diffs)
- {
- buf33[i][j][k].a=0;
- buf33[i][j][k].b=0;
+ for(i = 0; i < 4; i++) {
+ for(j = 0; j < 3; j++) {
+ for(k = 0; k < 2; k++) {
+ if(make_diffs) {
+ buf33[i][j][k].a = 0;
+ buf33[i][j][k].b = 0;
}
- else
- {
- buf33[i][j][k].a=n++;
- buf33[i][j][k].b=n++;
+ else {
+ buf33[i][j][k].a = (char)(n++);
+ buf33[i][j][k].b = n++;
}
}
}
@@ -5491,14 +5465,13 @@ int write_attr_in(hid_t loc_id,
{
for (k = 0; k < 2; k++)
{
- int l;
+ unsigned l;
+
buf53[i][j][k].p = HDmalloc((i + 1) * sizeof(int));
buf53[i][j][k].len = (size_t)i + 1;
for (l = 0; l < i + 1; l++)
if (make_diffs)
- {
((int *)buf53[i][j][k].p)[l] = 0;
- }
else
((int *)buf53[i][j][k].p)[l] = n++;
}
@@ -5622,8 +5595,7 @@ int write_attr_in(hid_t loc_id,
return 0;
out:
- H5E_BEGIN_TRY
- {
+ H5E_BEGIN_TRY {
H5Aclose(aid);
H5Sclose(sid);
H5Tclose(tid);
diff --git a/tools/h5repack/testfiles/h5repack_layout.h5-plugin_zero.tst b/tools/h5repack/testfiles/h5repack_layout.h5-plugin_zero.tst
new file mode 100644
index 0000000..0993d5b
--- /dev/null
+++ b/tools/h5repack/testfiles/h5repack_layout.h5-plugin_zero.tst
@@ -0,0 +1,9 @@
+Objects to modify layout are...
+Objects to apply filter are...
+ User Defined 250
+Making file <out-plugin_zero.h5repack_layout.h5>...
+-----------------------------------------
+ Type Filter (Compression) Name
+-----------------------------------------
+ group /
+h5repack error: <h5repack_layout.h5>: Could not copy data to: out-plugin_zero.h5repack_layout.h5
diff --git a/tools/h5stat/CMakeTests.cmake b/tools/h5stat/CMakeTests.cmake
index bb8c248..a371b81 100644
--- a/tools/h5stat/CMakeTests.cmake
+++ b/tools/h5stat/CMakeTests.cmake
@@ -49,26 +49,13 @@
)
foreach (ddl_file ${HDF5_REFERENCE_FILES})
- set (ddldest "${PROJECT_BINARY_DIR}/${ddl_file}")
- #message (STATUS " Translating ${ddl_file}")
- add_custom_command (
- TARGET h5stat
- POST_BUILD
- COMMAND ${CMAKE_COMMAND}
- ARGS -E copy_if_different ${HDF5_TOOLS_H5STAT_SOURCE_DIR}/testfiles/${ddl_file} ${ddldest}
- )
+ HDFTEST_COPY_FILE("${HDF5_TOOLS_H5STAT_SOURCE_DIR}/testfiles/${ddl_file}" "${PROJECT_BINARY_DIR}/${ddl_file}" "h5stat_files")
endforeach (ddl_file ${HDF5_REFERENCE_FILES})
foreach (h5_file ${HDF5_REFERENCE_TEST_FILES})
- set (dest "${PROJECT_BINARY_DIR}/${h5_file}")
- #message (STATUS " Copying ${h5_file}")
- add_custom_command (
- TARGET h5stat
- POST_BUILD
- COMMAND ${CMAKE_COMMAND}
- ARGS -E copy_if_different ${HDF5_TOOLS_H5STAT_SOURCE_DIR}/testfiles/${h5_file} ${dest}
- )
+ HDFTEST_COPY_FILE("${HDF5_TOOLS_H5STAT_SOURCE_DIR}/testfiles/${h5_file}" "${PROJECT_BINARY_DIR}/${h5_file}" "h5stat_files")
endforeach (h5_file ${HDF5_REFERENCE_TEST_FILES})
+ add_custom_target(h5stat_files ALL COMMENT "Copying files needed by h5stat tests" DEPENDS ${h5stat_files_list})
##############################################################################
##############################################################################
diff --git a/tools/h5stat/testh5stat.sh.in b/tools/h5stat/testh5stat.sh.in
index b48f327..cbb732c 100644
--- a/tools/h5stat/testh5stat.sh.in
+++ b/tools/h5stat/testh5stat.sh.in
@@ -151,7 +151,7 @@ CLEAN_TESTFILES_AND_TESTDIR()
# skip rm if srcdir is same as destdir
# this occurs when build/test performed in source dir and
# make cp fail
- SDIR=`$DIRNAME $tstfile`
+ SDIR=$SRC_H5STAT_TESTFILES
INODE_SDIR=`$LS -i -d $SDIR | $AWK -F' ' '{print $1}'`
INODE_DDIR=`$LS -i -d $TESTDIR | $AWK -F' ' '{print $1}'`
if [ "$INODE_SDIR" != "$INODE_DDIR" ]; then
diff --git a/tools/lib/h5diff_array.c b/tools/lib/h5diff_array.c
index 7897e49..9aadffe 100644
--- a/tools/lib/h5diff_array.c
+++ b/tools/lib/h5diff_array.c
@@ -13,10 +13,6 @@
* access to either file, you may request a copy from help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
-#include <math.h>
-#include <time.h>
-#include <sys/timeb.h>
-
#include "H5private.h"
#include "h5tools.h"
#include "h5tools_utils.h"
diff --git a/tools/lib/h5diff_attr.c b/tools/lib/h5diff_attr.c
index 2b6e080..2cda28c 100644
--- a/tools/lib/h5diff_attr.c
+++ b/tools/lib/h5diff_attr.c
@@ -75,14 +75,12 @@ static void table_attrs_free( table_attrs_t *table )
{
unsigned int i;
- if (table)
- {
- if(table->attrs)
- {
- for(i = 0; i < table->nattrs; i++)
- {
- if(table->attrs[i].name)
- HDfree(table->attrs[i].name );
+ if (table) {
+ if (table->attrs) {
+ for (i = 0; i < table->nattrs; i++) {
+ if (table->attrs[i].name) {
+ HDfree(table->attrs[i].name);
+ }
} /* end for */
HDfree(table->attrs);
table->attrs = NULL;
diff --git a/tools/lib/h5tools_filters.c b/tools/lib/h5tools_filters.c
index 748eb78..486d1c6 100644
--- a/tools/lib/h5tools_filters.c
+++ b/tools/lib/h5tools_filters.c
@@ -13,7 +13,7 @@
* access to either file, you may request a copy from help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
-#include "hdf5.h"
+#include "H5private.h"
#include "h5tools.h"
/*-------------------------------------------------------------------------
@@ -147,7 +147,7 @@ int h5tools_canreadf(const char* name, /* object name, serves also as boolean pr
*
*-------------------------------------------------------------------------
*/
-int
+H5_ATTR_CONST int
h5tools_can_encode(H5Z_filter_t filtn) {
switch (filtn) {
/* user defined filter */
diff --git a/tools/lib/h5tools_ref.c b/tools/lib/h5tools_ref.c
index 60666f1..8c869c8 100644
--- a/tools/lib/h5tools_ref.c
+++ b/tools/lib/h5tools_ref.c
@@ -39,7 +39,7 @@
typedef struct {
haddr_t objno; /* Object ID (i.e. address) */
- const char *path; /* Object path */
+ char *path; /* Object path */
} ref_path_node_t;
static H5SL_t *ref_path_table = NULL; /* the "table" (implemented with a skip list) */
diff --git a/tools/lib/io_timer.c b/tools/lib/io_timer.c
index 4d79a9b..6053ce9 100644
--- a/tools/lib/io_timer.c
+++ b/tools/lib/io_timer.c
@@ -55,9 +55,9 @@ io_time_t *timer_g; /* timer: global for stub functions */
static double sub_time(struct timeval* a, struct timeval* b)
{
return (((double)a->tv_sec +
- ((double)a->tv_usec) / MICROSECOND) -
+ ((double)a->tv_usec) / (double)MICROSECOND) -
((double)b->tv_sec +
- ((double)b->tv_usec) / MICROSECOND));
+ ((double)b->tv_usec) / (double)MICROSECOND));
}
diff --git a/tools/misc/CMakeTests.cmake b/tools/misc/CMakeTests.cmake
index b3e2f0b..6822be5 100644
--- a/tools/misc/CMakeTests.cmake
+++ b/tools/misc/CMakeTests.cmake
@@ -30,15 +30,9 @@
)
foreach (h5_file ${HDF5_REFERENCE_TEST_FILES})
- set (dest "${PROJECT_BINARY_DIR}/${h5_file}")
- #message (STATUS " Copying ${h5_file}")
- add_custom_command (
- TARGET h5repart
- POST_BUILD
- COMMAND ${CMAKE_COMMAND}
- ARGS -E copy_if_different ${HDF5_TOOLS_SRC_DIR}/testfiles/${h5_file} ${dest}
- )
+ HDFTEST_COPY_FILE("${HDF5_TOOLS_SRC_DIR}/testfiles/${h5_file}" "${PROJECT_BINARY_DIR}/${h5_file}" "h5repart_files")
endforeach (h5_file ${HDF5_REFERENCE_TEST_FILES})
+ add_custom_target(h5repart_files ALL COMMENT "Copying files needed by h5repart tests" DEPENDS ${h5repart_files_list})
set (HDF5_MKGRP_TEST_FILES
#h5mkgrp_help.txt
@@ -61,22 +55,12 @@
file (MAKE_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles")
foreach (h5_mkgrp_file ${HDF5_MKGRP_TEST_FILES})
- set (dest "${PROJECT_BINARY_DIR}/testfiles/${h5_mkgrp_file}")
- #message (STATUS " Copying ${h5_mkgrp_file}")
- add_custom_command (
- TARGET h5mkgrp
- POST_BUILD
- COMMAND ${CMAKE_COMMAND}
- ARGS -E copy_if_different ${HDF5_TOOLS_SRC_DIR}/testfiles/${h5_mkgrp_file} ${dest}
- )
+ HDFTEST_COPY_FILE("${HDF5_TOOLS_SRC_DIR}/testfiles/${h5_mkgrp_file}" "${PROJECT_BINARY_DIR}/testfiles/${h5_mkgrp_file}" "h5mkgrp_files")
endforeach (h5_mkgrp_file ${HDF5_MKGRP_TEST_FILES})
- add_custom_command (
- TARGET h5mkgrp
- POST_BUILD
- COMMAND ${CMAKE_COMMAND}
- ARGS -E copy_if_different ${PROJECT_SOURCE_DIR}/testfiles/h5mkgrp_help.txt ${PROJECT_BINARY_DIR}/testfiles/h5mkgrp_help.txt
- )
+ HDFTEST_COPY_FILE("${PROJECT_SOURCE_DIR}/testfiles/h5mkgrp_help.txt" "${PROJECT_BINARY_DIR}/testfiles/h5mkgrp_help.txt" "h5mkgrp_files")
+ add_custom_target(h5mkgrp_files ALL COMMENT "Copying files needed by h5mkgrp tests" DEPENDS ${h5mkgrp_files_list})
+
configure_file (${PROJECT_SOURCE_DIR}/testfiles/h5mkgrp_version.txt.in ${PROJECT_BINARY_DIR}/testfiles/h5mkgrp_version.txt @ONLY)
##############################################################################
diff --git a/tools/misc/h5mkgrp.c b/tools/misc/h5mkgrp.c
index 1c1bba1..ad2d306 100644
--- a/tools/misc/h5mkgrp.c
+++ b/tools/misc/h5mkgrp.c
@@ -63,7 +63,7 @@ param_t params; /* Command line parameter settings */
static void
leave(int ret)
{
- int curr_group;
+ size_t curr_group;
if (params.fname)
HDfree (params.fname);
@@ -180,7 +180,7 @@ parse_command_line(int argc, const char *argv[], param_t *parms)
} /* end if */
/* Allocate space for the group name pointers */
- parms->ngroups = (argc - opt_ind);
+ parms->ngroups = (size_t)(argc - opt_ind);
parms->groups = (char **)HDmalloc(parms->ngroups * sizeof(char *));
/* Retrieve the group names */
diff --git a/tools/misc/h5repart.c b/tools/misc/h5repart.c
index 8657cbc..e44c957 100644
--- a/tools/misc/h5repart.c
+++ b/tools/misc/h5repart.c
@@ -194,9 +194,7 @@ main (int argc, char *argv[])
int src, dst=-1; /*source & destination files */
int need_seek=FALSE; /*destination needs to seek? */
int need_write; /*data needs to be written? */
- /*struct stat sb; temporary file stat buffer */
- /*struct _stati64 sb;*/
- h5_stat_t sb;
+ h5_stat_t sb; /*temporary file stat buffer */
int verbose=FALSE; /*display file names? */
@@ -243,7 +241,7 @@ main (int argc, char *argv[])
family_to_sec2 = TRUE;
argno++;
} else if ('b'==argv[argno][1]) {
- blk_size = get_size (prog_name, &argno, argc, argv);
+ blk_size = (size_t)get_size (prog_name, &argno, argc, argv);
} else if ('m'==argv[argno][1]) {
dst_size = get_size (prog_name, &argno, argc, argv);
} else {
@@ -308,7 +306,7 @@ main (int argc, char *argv[])
if (dst_is_family) n = (size_t)MIN((off_t)n, dst_size-dst_offset);
if (left_overs) {
n = (size_t)MIN ((off_t)n, left_overs);
- left_overs -= n;
+ left_overs = left_overs - (off_t)n;
need_write = FALSE;
} else if (src_offset<src_act_size) {
n = (size_t)MIN ((off_t)n, src_act_size-src_offset);
@@ -359,16 +357,16 @@ main (int argc, char *argv[])
* loop. The destination offset must be updated so we can fix
* trailing holes.
*/
- src_offset += n;
+ src_offset = src_offset + (off_t)n;
if (src_offset==src_act_size) {
HDclose (src);
if (!src_is_family) {
- dst_offset += n;
+ dst_offset = dst_offset + (off_t)n;
break;
}
sprintf (src_name, src_gen_name, ++src_membno);
if ((src=HDopen (src_name, O_RDONLY,0))<0 && ENOENT==errno) {
- dst_offset += n;
+ dst_offset = dst_offset + (off_t)n;
break;
} else if (src<0) {
perror (src_name);
@@ -392,7 +390,7 @@ main (int argc, char *argv[])
* needed. The first member is extended to the logical member size
* but other members might be smaller if they end with a hole.
*/
- dst_offset += n;
+ dst_offset = dst_offset + (off_t)n;
if (dst_is_family && dst_offset==dst_size) {
if (0==dst_membno) {
if (HDlseek (dst, dst_size-1, SEEK_SET)<0) {
@@ -474,7 +472,7 @@ main (int argc, char *argv[])
}
/* Set the property of the new member size as hsize_t */
- hdsize = dst_size;
+ hdsize = (hsize_t)dst_size;
if(H5Pset(fapl, H5F_ACS_FAMILY_NEWSIZE_NAME, &hdsize) < 0) {
perror ("H5Pset");
exit (EXIT_FAILURE);
diff --git a/tools/misc/h5repart_gentest.c b/tools/misc/h5repart_gentest.c
index f7d9a73..8a34694 100644
--- a/tools/misc/h5repart_gentest.c
+++ b/tools/misc/h5repart_gentest.c
@@ -27,12 +27,13 @@
#define FAMILY_SIZE 1024
#define FILENAME "family_file%05d.h5"
+static int buf[FAMILY_NUMBER][FAMILY_SIZE];
+
int main(void)
{
hid_t file=(-1), fapl, space=(-1), dset=(-1);
char dname[]="dataset";
int i, j;
- int buf[FAMILY_NUMBER][FAMILY_SIZE];
hsize_t dims[2]={FAMILY_NUMBER, FAMILY_SIZE};
/* Set property list and file name for FAMILY driver */
diff --git a/tools/misc/testh5mkgrp.sh.in b/tools/misc/testh5mkgrp.sh.in
index 190e824..a0413e1 100644
--- a/tools/misc/testh5mkgrp.sh.in
+++ b/tools/misc/testh5mkgrp.sh.in
@@ -117,7 +117,7 @@ CLEAN_TESTFILES_AND_TESTDIR()
# skip rm if srcdir is same as destdir
# this occurs when build/test performed in source dir and
# make cp fail
- SDIR=`$DIRNAME $tstfile`
+ SDIR=$SRC_H5MKGRP_TESTFILES
INODE_SDIR=`$LS -i -d $SDIR | $AWK -F' ' '{print $1}'`
INODE_DDIR=`$LS -i -d $TESTDIR | $AWK -F' ' '{print $1}'`
if [ "$INODE_SDIR" != "$INODE_DDIR" ]; then
diff --git a/tools/misc/vds/UC_1.h b/tools/misc/vds/UC_1.h
index 24299d4..2150cfa 100644
--- a/tools/misc/vds/UC_1.h
+++ b/tools/misc/vds/UC_1.h
@@ -93,7 +93,6 @@ static hsize_t UC_1_DIMS[UC_1_N_SOURCES][RANK] = {
{0, UC_1_SM_HEIGHT, UC_1_WIDTH},
{0, UC_1_LG_HEIGHT, UC_1_WIDTH}
};
-static hsize_t UC_1_VDS_DIMS[RANK] = {0, UC_1_FULL_HEIGHT, UC_1_WIDTH};
/* Maximum size of datasets, both source and VDS */
static hsize_t UC_1_MAX_DIMS[UC_1_N_SOURCES][RANK] = {
@@ -104,18 +103,6 @@ static hsize_t UC_1_MAX_DIMS[UC_1_N_SOURCES][RANK] = {
{UC_1_N_MAX_PLANES, UC_1_SM_HEIGHT, UC_1_WIDTH},
{UC_1_N_MAX_PLANES, UC_1_LG_HEIGHT, UC_1_WIDTH}
};
-static hsize_t UC_1_VDS_MAX_DIMS[RANK] = {UC_1_N_MAX_PLANES, UC_1_FULL_HEIGHT, UC_1_WIDTH};
-
-/* Planes */
-static hsize_t UC_1_PLANES[UC_1_N_SOURCES][RANK] = {
- {1, UC_1_SM_HEIGHT, UC_1_WIDTH},
- {1, UC_1_LG_HEIGHT, UC_1_WIDTH},
- {1, UC_1_SM_HEIGHT, UC_1_WIDTH},
- {1, UC_1_LG_HEIGHT, UC_1_WIDTH},
- {1, UC_1_SM_HEIGHT, UC_1_WIDTH},
- {1, UC_1_LG_HEIGHT, UC_1_WIDTH}
-};
-static hsize_t UC_1_VDS_PLANE[RANK] = {1, UC_1_FULL_HEIGHT, UC_1_WIDTH};
/* File names for source datasets */
static char UC_1_FILE_NAMES[UC_1_N_SOURCES][NAME_LEN] = {
@@ -127,24 +114,8 @@ static char UC_1_FILE_NAMES[UC_1_N_SOURCES][NAME_LEN] = {
{"1_f.h5"}
};
-/* VDS file name */
-static char UC_1_VDS_FILE_NAME[NAME_LEN] = "1_vds.h5";
-
/* Dataset names */
-static char UC_1_SOURCE_DSET_NAME[NAME_LEN] = "source_dset";
static char UC_1_SOURCE_DSET_PATH[NAME_LEN] = "/source_dset";
-static char UC_1_VDS_DSET_NAME[NAME_LEN] = "vds_dset";
-
-/* Fill values */
-static int UC_1_FILL_VALUES[UC_1_N_SOURCES] = {
- -1,
- -2,
- -3,
- -4,
- -5,
- -6
-};
-static int UC_1_VDS_FILL_VALUE = -9;
#endif /* UC_1_H */
diff --git a/tools/misc/vds/UC_1_one_dim_gen.c b/tools/misc/vds/UC_1_one_dim_gen.c
index ee56622..f47b982 100644
--- a/tools/misc/vds/UC_1_one_dim_gen.c
+++ b/tools/misc/vds/UC_1_one_dim_gen.c
@@ -27,6 +27,36 @@
#include "UC_common.h"
#include "UC_1.h"
+static hsize_t UC_1_VDS_DIMS[RANK] = {0, UC_1_FULL_HEIGHT, UC_1_WIDTH};
+static hsize_t UC_1_VDS_MAX_DIMS[RANK] = {UC_1_N_MAX_PLANES, UC_1_FULL_HEIGHT, UC_1_WIDTH};
+
+/* Planes */
+static hsize_t UC_1_PLANES[UC_1_N_SOURCES][RANK] = {
+ {1, UC_1_SM_HEIGHT, UC_1_WIDTH},
+ {1, UC_1_LG_HEIGHT, UC_1_WIDTH},
+ {1, UC_1_SM_HEIGHT, UC_1_WIDTH},
+ {1, UC_1_LG_HEIGHT, UC_1_WIDTH},
+ {1, UC_1_SM_HEIGHT, UC_1_WIDTH},
+ {1, UC_1_LG_HEIGHT, UC_1_WIDTH}
+};
+
+/* VDS file name */
+static char UC_1_VDS_FILE_NAME[NAME_LEN] = "1_vds.h5";
+
+/* Dataset names */
+static char UC_1_SOURCE_DSET_NAME[NAME_LEN] = "source_dset";
+static char UC_1_VDS_DSET_NAME[NAME_LEN] = "vds_dset";
+
+/* Fill values */
+static int UC_1_FILL_VALUES[UC_1_N_SOURCES] = {
+ -1,
+ -2,
+ -3,
+ -4,
+ -5,
+ -6
+};
+static int UC_1_VDS_FILL_VALUE = -9;
int
main(void)
@@ -44,7 +74,7 @@ main(void)
hsize_t extent[RANK]; /* dataset extents */
hsize_t start[RANK]; /* starting point for hyperslab */
- int map_start = -1; /* starting point in the VDS map */
+ hsize_t map_start = 0; /* starting point in the VDS map */
int *buffer = NULL; /* data buffer */
hsize_t count = 0; /* number of elements in a plane */
@@ -53,7 +83,7 @@ main(void)
int i; /* iterator */
int j; /* iterator */
- int k; /* iterator */
+ hsize_t k; /* iterator */
/* Start by creating the virtual dataset (VDS) dataspace and creation
@@ -136,7 +166,7 @@ main(void)
for(k = 0; k < count; k++)
buffer[k] = value;
- start[0] = j;
+ start[0] = (hsize_t)j;
start[1] = 0;
start[2] = 0;
if(H5Sselect_hyperslab(fsid, H5S_SELECT_SET, start, NULL, UC_1_PLANES[i], NULL) < 0)
diff --git a/tools/misc/vds/UC_2.h b/tools/misc/vds/UC_2.h
index 8b9f19a..fe3f350 100644
--- a/tools/misc/vds/UC_2.h
+++ b/tools/misc/vds/UC_2.h
@@ -79,7 +79,6 @@ static hsize_t UC_2_DIMS[UC_2_N_SOURCES][RANK] = {
{0, UC_2_D_HEIGHT, UC_2_WIDTH},
{0, UC_2_E_HEIGHT, UC_2_WIDTH}
};
-static hsize_t UC_2_VDS_DIMS[RANK] = {0, UC_2_FULL_HEIGHT, UC_2_FULL_WIDTH};
/* Maximum size of datasets, both source and VDS */
static hsize_t UC_2_MAX_DIMS[UC_2_N_SOURCES][RANK] = {
@@ -89,36 +88,6 @@ static hsize_t UC_2_MAX_DIMS[UC_2_N_SOURCES][RANK] = {
{UC_2_N_MAX_PLANES, UC_2_D_HEIGHT, UC_2_WIDTH},
{UC_2_N_MAX_PLANES, UC_2_E_HEIGHT, UC_2_WIDTH}
};
-static hsize_t UC_2_VDS_MAX_DIMS[RANK] = {UC_2_N_MAX_PLANES, UC_2_FULL_HEIGHT, UC_2_FULL_WIDTH};
-
-/* Positions of source datasets in the VDS */
-static hsize_t UC_2_POSITIONS[UC_2_N_SOURCES][RANK] = {
- /* A */ {0, 0, 0},
- /* B */ {0, UC_2_A_HEIGHT, 0},
- /* C */ {0, UC_2_AB_HEIGHT, 0},
- /* D */ {0, 0, UC_2_WIDTH},
- /* E */ {0, UC_2_D_HEIGHT, UC_2_WIDTH}
-};
-
-/* Planes */
-static hsize_t UC_2_PLANES[UC_2_N_SOURCES][RANK] = {
- {1, UC_2_A_HEIGHT, UC_2_WIDTH},
- {1, UC_2_B_HEIGHT, UC_2_WIDTH},
- {1, UC_2_C_HEIGHT, UC_2_WIDTH},
- {1, UC_2_D_HEIGHT, UC_2_WIDTH},
- {1, UC_2_E_HEIGHT, UC_2_WIDTH}
-};
-static hsize_t UC_2_VDS_SUB_IMAGE[RANK] = {1, UC_2_FULL_HEIGHT, UC_2_WIDTH};
-static hsize_t UC_2_VDS_PLANE[RANK] = {1, UC_2_FULL_HEIGHT, UC_2_FULL_WIDTH};
-
-/* Chunk dimensions */
-static hsize_t UC_2_CHUNK_DIMS[UC_2_N_SOURCES][RANK] = {
- {UC_2_N_PLANES_IN_SERIES, UC_2_A_HEIGHT, UC_2_WIDTH},
- {UC_2_N_PLANES_IN_SERIES, UC_2_B_HEIGHT, UC_2_WIDTH},
- {UC_2_N_PLANES_IN_SERIES, UC_2_C_HEIGHT, UC_2_WIDTH},
- {UC_2_N_PLANES_IN_SERIES, UC_2_D_HEIGHT, UC_2_WIDTH},
- {UC_2_N_PLANES_IN_SERIES, UC_2_E_HEIGHT, UC_2_WIDTH}
-};
/* File names for source datasets */
static char UC_2_FILE_NAMES[UC_2_N_SOURCES][NAME_LEN] = {
@@ -137,15 +106,5 @@ static char UC_2_FILE_NAMES[UC_2_N_SOURCES][NAME_LEN] = {
#define UC_2_SOURCE_DSET_PATH "/source_dset"
#define UC_2_VDS_DSET_NAME "vds_dset"
-/* Fill values */
-static int UC_2_FILL_VALUES[UC_2_N_SOURCES] = {
- -1,
- -2,
- -3,
- -4,
- -5
-};
-static int UC_2_VDS_FILL_VALUE = -9;
-
#endif /* UC_2_H */
diff --git a/tools/misc/vds/UC_2_two_dims_gen.c b/tools/misc/vds/UC_2_two_dims_gen.c
index c3dfa65..d08cc5f 100644
--- a/tools/misc/vds/UC_2_two_dims_gen.c
+++ b/tools/misc/vds/UC_2_two_dims_gen.c
@@ -27,6 +27,46 @@
#include "UC_common.h"
#include "UC_2.h"
+static hsize_t UC_2_VDS_DIMS[RANK] = {0, UC_2_FULL_HEIGHT, UC_2_FULL_WIDTH};
+static hsize_t UC_2_VDS_MAX_DIMS[RANK] = {UC_2_N_MAX_PLANES, UC_2_FULL_HEIGHT, UC_2_FULL_WIDTH};
+
+/* Positions of source datasets in the VDS */
+static hsize_t UC_2_POSITIONS[UC_2_N_SOURCES][RANK] = {
+ /* A */ {0, 0, 0},
+ /* B */ {0, UC_2_A_HEIGHT, 0},
+ /* C */ {0, UC_2_AB_HEIGHT, 0},
+ /* D */ {0, 0, UC_2_WIDTH},
+ /* E */ {0, UC_2_D_HEIGHT, UC_2_WIDTH}
+};
+
+/* Planes */
+static hsize_t UC_2_PLANES[UC_2_N_SOURCES][RANK] = {
+ {1, UC_2_A_HEIGHT, UC_2_WIDTH},
+ {1, UC_2_B_HEIGHT, UC_2_WIDTH},
+ {1, UC_2_C_HEIGHT, UC_2_WIDTH},
+ {1, UC_2_D_HEIGHT, UC_2_WIDTH},
+ {1, UC_2_E_HEIGHT, UC_2_WIDTH}
+};
+
+/* Chunk dimensions */
+static hsize_t UC_2_CHUNK_DIMS[UC_2_N_SOURCES][RANK] = {
+ {UC_2_N_PLANES_IN_SERIES, UC_2_A_HEIGHT, UC_2_WIDTH},
+ {UC_2_N_PLANES_IN_SERIES, UC_2_B_HEIGHT, UC_2_WIDTH},
+ {UC_2_N_PLANES_IN_SERIES, UC_2_C_HEIGHT, UC_2_WIDTH},
+ {UC_2_N_PLANES_IN_SERIES, UC_2_D_HEIGHT, UC_2_WIDTH},
+ {UC_2_N_PLANES_IN_SERIES, UC_2_E_HEIGHT, UC_2_WIDTH}
+};
+
+/* Fill values */
+static int UC_2_FILL_VALUES[UC_2_N_SOURCES] = {
+ -1,
+ -2,
+ -3,
+ -4,
+ -5
+};
+static int UC_2_VDS_FILL_VALUE = -9;
+
int
main(void)
{
@@ -51,7 +91,7 @@ main(void)
int i; /* iterator */
int j; /* iterator */
- int k; /* iterator */
+ hsize_t k; /* iterator */
/* Start by creating the virtual dataset (VDS) dataspace and creation
@@ -132,7 +172,7 @@ main(void)
for(k = 0; k < count; k++)
buffer[k] = value;
- start[0] = j;
+ start[0] = (hsize_t)j;
start[1] = 0;
start[2] = 0;
if(H5Sselect_hyperslab(fsid, H5S_SELECT_SET, start, NULL, UC_2_PLANES[i], NULL) < 0)
diff --git a/tools/misc/vds/UC_3.h b/tools/misc/vds/UC_3.h
index a27c3cf..0654a48 100644
--- a/tools/misc/vds/UC_3.h
+++ b/tools/misc/vds/UC_3.h
@@ -60,10 +60,6 @@ static hsize_t UC_32_POSITIONS[UC_2_N_SOURCES][RANK] = {
/* E */ {0, 8, 12}
};
-/* Planes */
-static hsize_t UC_31_VDS_PLANE[RANK] = {1, UC_31_VDS_HEIGHT, UC_31_VDS_WIDTH};
-static hsize_t UC_32_VDS_PLANE[RANK] = {1, UC_32_VDS_HEIGHT, UC_32_VDS_WIDTH};
-
/* VDS file names */
#define UC_31_VDS_FILE_NAME "3_1_vds.h5"
#define UC_32_VDS_FILE_NAME "3_2_vds.h5"
diff --git a/tools/misc/vds/UC_4_printf_gen.c b/tools/misc/vds/UC_4_printf_gen.c
index c0bb6b5..d067d47 100644
--- a/tools/misc/vds/UC_4_printf_gen.c
+++ b/tools/misc/vds/UC_4_printf_gen.c
@@ -51,7 +51,7 @@ main(void)
int i; /* iterator */
int j; /* iterator */
- int k; /* iterator */
+ hsize_t k; /* iterator */
/************************************
* Create source files and datasets *
@@ -112,7 +112,7 @@ main(void)
for(k = 0; k < n; k++)
buffer[k] = value;
- start[0] = j;
+ start[0] = (hsize_t)j;
start[1] = 0;
start[2] = 0;
if(H5Sselect_hyperslab(fsid, H5S_SELECT_SET, start, NULL, UC_4_PLANE, NULL) < 0)
diff --git a/tools/misc/vds/UC_5_stride_gen.c b/tools/misc/vds/UC_5_stride_gen.c
index 9fa4908..38d24a6 100644
--- a/tools/misc/vds/UC_5_stride_gen.c
+++ b/tools/misc/vds/UC_5_stride_gen.c
@@ -44,7 +44,7 @@ main(void)
hsize_t start[RANK]; /* starting point for hyperslab */
hsize_t stride[RANK]; /* hypserslab stride */
hsize_t count[RANK]; /* hypserslab count */
- int map_start = -1; /* starting point in the VDS map */
+ hsize_t map_start = 0; /* starting point in the VDS map */
int *buffer = NULL; /* data buffer */
int value = -1; /* value written to datasets */
@@ -53,7 +53,7 @@ main(void)
int i; /* iterator */
int j; /* iterator */
- int k; /* iterator */
+ hsize_t k; /* iterator */
/* Start by creating the virtual dataset (VDS) dataspace and creation
* property list. The individual source datasets are then created
@@ -143,7 +143,7 @@ main(void)
for(k = 0; k < n; k++)
buffer[k] = value;
- start[0] = j;
+ start[0] = (hsize_t)j;
start[1] = 0;
start[2] = 0;
if(H5Sselect_hyperslab(fsid, H5S_SELECT_SET, start, NULL, UC_5_PLANE, NULL) < 0)
diff --git a/tools/perform/CMakeTests.cmake b/tools/perform/CMakeTests.cmake
index 63aa07b..0ea40a3 100644
--- a/tools/perform/CMakeTests.cmake
+++ b/tools/perform/CMakeTests.cmake
@@ -5,12 +5,8 @@
##############################################################################
##############################################################################
-add_custom_command (
- TARGET zip_perf
- POST_BUILD
- COMMAND ${CMAKE_COMMAND}
- ARGS -E copy_if_different ${HDF5_TOOLS_DIR}/testfiles/tfilters.h5 ${PROJECT_BINARY_DIR}/tfilters.h5
-)
+HDFTEST_COPY_FILE("${HDF5_TOOLS_DIR}/testfiles/tfilters.h5" "${PROJECT_BINARY_DIR}/tfilters.h5" "zip_perf_files")
+add_custom_target(zip_perf_files ALL COMMENT "Copying files needed by zip_perf tests" DEPENDS ${zip_perf_list})
#-----------------------------------------------------------------------------
# Add Tests
@@ -20,7 +16,7 @@ add_custom_command (
add_test (
NAME PERFORM_h5perform-clear-objects
COMMAND ${CMAKE_COMMAND}
- -E remove
+ -E remove
chunk.h5
iopipe.h5
iopipe.raw
diff --git a/tools/perform/chunk.c b/tools/perform/chunk.c
index 0ea16e8..b1419ee 100644
--- a/tools/perform/chunk.c
+++ b/tools/perform/chunk.c
@@ -57,9 +57,9 @@
#define RM_CACHE_STRT 25
#define RM_CACHE_END 25
#define RM_CACHE_DELT 5
-#define RM_START 0.50F
-#define RM_END 5.00F
-#define RM_DELTA 0.50F
+#define RM_START (double)0.50F
+#define RM_END (double)5.00F
+#define RM_DELTA (double)0.50F
#define RM_W0 0.0F
#define RM_NRDCC 521
@@ -67,9 +67,9 @@
#define DIAG_CACHE_STRT 25
#define DIAG_CACHE_END 25
#define DIAG_CACHE_DELT 5
-#define DIAG_START 0.50F
-#define DIAG_END 5.00F
-#define DIAG_DELTA 0.50F
+#define DIAG_START (double)0.50F
+#define DIAG_END (double)5.00F
+#define DIAG_DELTA (double)0.50F
/* #define DIAG_W0 0.65F */
/* #define DIAG_NRDCC 521 */
@@ -320,7 +320,7 @@ test_diag (int op, size_t cache_size, size_t io_size, size_t offset)
* Win32 version 5.0 compiler.
* 1998-11-06 ptl
*/
- return (double)(hssize_t)nio/(hssize_t)nio_g;
+ return (double)nio/(double)nio_g;
}
@@ -479,9 +479,7 @@ main (void)
for (cache_size=DIAG_CACHE_STRT;
cache_size<=DIAG_CACHE_END;
cache_size+=DIAG_CACHE_DELT) {
- for (io_percent=DIAG_START;
- io_percent<=DIAG_END;
- io_percent+=DIAG_DELTA) {
+ for (io_percent=DIAG_START; io_percent<=DIAG_END; io_percent+=DIAG_DELTA) {
io_size = MAX (1, (size_t)(CH_SIZE*io_percent));
printf ("Diag-rd %8d %8.2f", (int)cache_size, io_percent);
fflush (stdout);
diff --git a/tools/perform/iopipe.c b/tools/perform/iopipe.c
index 6ac7ccb..fd62d37 100644
--- a/tools/perform/iopipe.c
+++ b/tools/perform/iopipe.c
@@ -81,25 +81,25 @@ print_stats (const char *prefix,
double u_time, s_time;
u_time = ((double)(r_stop->ru_utime.tv_sec)+
- (double)(r_stop->ru_utime.tv_usec)/1000000.0F) -
+ (double)(r_stop->ru_utime.tv_usec)/(double)1000000.0F) -
((double)(r_start->ru_utime.tv_sec)+
- (double)(r_start->ru_utime.tv_usec)/1000000.0F);
+ (double)(r_start->ru_utime.tv_usec)/(double)1000000.0F);
s_time = ((double)(r_stop->ru_stime.tv_sec)+
- (double)(r_stop->ru_stime.tv_usec)/1000000.0F) -
+ (double)(r_stop->ru_stime.tv_usec)/(double)1000000.0F) -
((double)(r_start->ru_stime.tv_sec)+
- (double)(r_start->ru_stime.tv_usec)/1000000.0F);
+ (double)(r_start->ru_stime.tv_usec)/(double)1000000.0F);
#endif
#ifndef H5_HAVE_SYS_TIMEB
e_time = ((double)(t_stop->tv_sec)+
- (double)(t_stop->tv_usec)/1000000.0F) -
+ (double)(t_stop->tv_usec)/(double)1000000.0F) -
((double)(t_start->tv_sec)+
- (double)(t_start->tv_usec)/1000000.0F);
+ (double)(t_start->tv_usec)/(double)1000000.0F);
#else
e_time = ((double)(t_stop->tv_sec)+
- (double)(t_stop->tv_usec)/1000.0F) -
+ (double)(t_stop->tv_usec)/(double)1000.0F) -
((double)(t_start->tv_sec)+
- (double)(t_start->tv_usec)/1000.0F);
+ (double)(t_start->tv_usec)/(double)1000.0F);
#endif
bw = (double)nbytes / e_time;
@@ -196,7 +196,7 @@ main (void)
* 1998-11-06 ptl
*/
printf ("I/O request size is %1.1fMB\n",
- (double)(hssize_t)(size[0]*size[1])/1024.0F*1024);
+ (double)(hssize_t)(size[0]*size[1])/(double)1024.0F*(double)1024);
/* Open the files */
file = H5Fcreate (HDF5_FILE_NAME, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
diff --git a/tools/perform/overhead.c b/tools/perform/overhead.c
index 277f7a4..98093c7 100644
--- a/tools/perform/overhead.c
+++ b/tools/perform/overhead.c
@@ -199,7 +199,7 @@ test(fill_t fill_style, const double splits[],
int *had = NULL; /*for random filling */
const char *sname=NULL; /*fill style nam */
int mdc_nelmts; /*num meta objs to cache*/
- hsize_t i;
+ hsize_t i, k;
int j;
h5_stat_t sb;
@@ -236,13 +236,13 @@ test(fill_t fill_style, const double splits[],
hs_start[0] = i%2 ? i/2 : cur_size[0]-i/2;
break;
case FILL_OUTWARD:
- j = (int)(cur_size[0]-i)+1;
- hs_start[0] = j%2 ? j/2 : (hssize_t)cur_size[0]-j/2;
+ k = (cur_size[0] - i) + 1;
+ hs_start[0] = k % 2 ? (k / 2) : (hsize_t)((hssize_t)cur_size[0] - (hssize_t)(k / 2));
break;
case FILL_RANDOM:
for (j=HDrand()%(int)cur_size[0]; had[j]; j=(j+1)%(int)cur_size[0])
/*void*/;
- hs_start[0] = j;
+ hs_start[0] = (hsize_t)j;
had[j] = 1;
break;
case FILL_ALL:
@@ -265,14 +265,9 @@ test(fill_t fill_style, const double splits[],
if (verbose) {
if (H5Fflush(file, H5F_SCOPE_LOCAL) < 0) goto error;
if (HDfstat(fd, &sb) < 0) goto error;
- /*
- * The extra cast in the following statement is a bug workaround
- * for the Win32 version 5.0 compiler.
- * 1998-11-06 ptl
- */
printf("%4lu %8.3f ***\n",
(unsigned long)i,
- (double)(hssize_t)(sb.st_size-i*sizeof(int))/(hssize_t)i);
+ (double)(sb.st_size - (HDoff_t)(i * sizeof(int))) / (double)i);
}
}
@@ -316,8 +311,8 @@ test(fill_t fill_style, const double splits[],
if (HDfstat(fd, &sb) < 0) goto error;
printf("%-7s %8.3f\n", sname,
- (double)(hssize_t)(sb.st_size-cur_size[0]*sizeof(int))/
- (hssize_t)cur_size[0]);
+ (double)(sb.st_size - (HDoff_t)(cur_size[0] * sizeof(int))) /
+ (double)cur_size[0]);
}
HDclose(fd);
diff --git a/tools/perform/sio_engine.c b/tools/perform/sio_engine.c
index 505b0f7..abf1fa6 100644
--- a/tools/perform/sio_engine.c
+++ b/tools/perform/sio_engine.c
@@ -96,7 +96,7 @@ static herr_t do_fclose(iotype iot, file_descr *fd);
static void do_cleanupfile(iotype iot, char *fname);
/* global variables */
-static off_t offset[MAX_DIMS]; /* dataset size in bytes */
+static HDoff_t offset[MAX_DIMS]; /* dataset size in bytes */
static size_t buf_offset[MAX_DIMS]; /* dataset size in bytes */
static int order[MAX_DIMS]; /* dimension access order */
static size_t linear_buf_size; /* linear buffer size */
@@ -123,8 +123,8 @@ static hid_t h5dxpl = -1; /* Dataset transfer property list */
* Programmer: Christian Chilan, April, 2008
* Modifications:
*/
- results
-do_sio(parameters param)
+void
+do_sio(parameters param, results *res)
{
char *buffer = NULL; /*data buffer pointer */
size_t buf_size[MAX_DIMS]; /* general buffer size in bytes */
@@ -133,7 +133,6 @@ do_sio(parameters param)
char base_name[256]; /* test file base name */
/* return codes */
herr_t ret_code = 0; /*return code */
- results res;
char fname[FILENAME_MAX]; /* test file name */
int i;
@@ -148,11 +147,11 @@ do_sio(parameters param)
switch (iot) {
case POSIXIO:
fd.posixfd = -1;
- res.timers = io_time_new(SYS_CLOCK);
+ res->timers = io_time_new(SYS_CLOCK);
break;
case HDF5:
fd.h5fd = -1;
- res.timers = io_time_new(SYS_CLOCK);
+ res->timers = io_time_new(SYS_CLOCK);
break;
default:
/* unknown request */
@@ -209,18 +208,18 @@ do_sio(parameters param)
HDfprintf(output, "data filename=%s\n",
fname);
- set_time(res.timers, HDF5_GROSS_WRITE_FIXED_DIMS, TSTART);
+ set_time(res->timers, HDF5_GROSS_WRITE_FIXED_DIMS, TSTART);
hrc = do_fopen(&param, fname, &fd, SIO_CREATE | SIO_WRITE);
VRFY((hrc == SUCCESS), "do_fopen failed");
- set_time(res.timers, HDF5_FINE_WRITE_FIXED_DIMS, TSTART);
- hrc = do_write(&res, &fd, &param, buffer);
- set_time(res.timers, HDF5_FINE_WRITE_FIXED_DIMS, TSTOP);
+ set_time(res->timers, HDF5_FINE_WRITE_FIXED_DIMS, TSTART);
+ hrc = do_write(res, &fd, &param, buffer);
+ set_time(res->timers, HDF5_FINE_WRITE_FIXED_DIMS, TSTOP);
VRFY((hrc == SUCCESS), "do_write failed");
/* Close file for write */
hrc = do_fclose(iot, &fd);
- set_time(res.timers, HDF5_GROSS_WRITE_FIXED_DIMS, TSTOP);
+ set_time(res->timers, HDF5_GROSS_WRITE_FIXED_DIMS, TSTOP);
VRFY((hrc == SUCCESS), "do_fclose failed");
if (!param.h5_write_only) {
@@ -229,19 +228,19 @@ do_sio(parameters param)
*/
/* Open file for read */
- set_time(res.timers, HDF5_GROSS_READ_FIXED_DIMS, TSTART);
+ set_time(res->timers, HDF5_GROSS_READ_FIXED_DIMS, TSTART);
hrc = do_fopen(&param, fname, &fd, SIO_READ);
VRFY((hrc == SUCCESS), "do_fopen failed");
- set_time(res.timers, HDF5_FINE_READ_FIXED_DIMS, TSTART);
- hrc = do_read(&res, &fd, &param, buffer);
- set_time(res.timers, HDF5_FINE_READ_FIXED_DIMS, TSTOP);
+ set_time(res->timers, HDF5_FINE_READ_FIXED_DIMS, TSTART);
+ hrc = do_read(res, &fd, &param, buffer);
+ set_time(res->timers, HDF5_FINE_READ_FIXED_DIMS, TSTOP);
VRFY((hrc == SUCCESS), "do_read failed");
/* Close file for read */
hrc = do_fclose(iot, &fd);
- set_time(res.timers, HDF5_GROSS_READ_FIXED_DIMS, TSTOP);
+ set_time(res->timers, HDF5_GROSS_READ_FIXED_DIMS, TSTOP);
VRFY((hrc == SUCCESS), "do_fclose failed");
}
@@ -272,8 +271,7 @@ done:
if (buffer)
free(buffer);
- res.ret_code = ret_code;
- return res;
+ res->ret_code = ret_code;
}
/*
@@ -408,7 +406,8 @@ do_write(results *res, file_descr *fd, parameters *parms, void *buffer)
{
int ret_code = SUCCESS;
char dname[64];
- long i;
+ int i;
+ size_t u;
/* HDF5 variables */
herr_t hrc; /*HDF5 return code */
hsize_t h5dims[MAX_DIMS]; /*dataset dim sizes */
@@ -418,20 +417,20 @@ do_write(results *res, file_descr *fd, parameters *parms, void *buffer)
hsize_t h5start[MAX_DIMS]; /*selection start */
hsize_t h5maxdims[MAX_DIMS];
int rank; /*rank of dataset */
- /* Prepare buffer for verifying data */
+
+ /* Prepare buffer for verifying data */
/* if (parms->verify)
memset(buffer,1,linear_buf_size); */
buf_p=(unsigned char *)buffer;
- for (i=0; i < linear_buf_size; i++)
- buf_p[i]=i%128;
+ for(u = 0; u < linear_buf_size; u++)
+ buf_p[u] = u % 128;
rank = parms->rank;
- for (i=0; i<rank; i++) {
+ for(i = 0; i < rank; i++)
h5offset[i] = offset[i] = 0;
- }
/* I/O Access specific setup */
switch (parms->io_type) {
@@ -618,20 +617,22 @@ done:
* Programmer: Christian Chilan, April, 2008
* Modifications:
*/
-
-static herr_t dset_write(int local_dim, file_descr *fd, parameters *parms, void *buffer)
+static herr_t
+dset_write(int local_dim, file_descr *fd, parameters *parms, void *buffer)
{
int cur_dim = order[local_dim]-1;
int ret_code = SUCCESS;
int k;
hsize_t dims[MAX_DIMS], maxdims[MAX_DIMS];
- long i,j;
+ hsize_t i;
+ int j;
herr_t hrc;
/* iterates according to the dimensions in order array */
for (i=0; i < parms->dset_size[cur_dim]; i += parms->buf_size[cur_dim]){
- h5offset[cur_dim] = offset[cur_dim] = i;
+ h5offset[cur_dim] = (hssize_t)i;
+ offset[cur_dim] = (HDoff_t)i;
if (local_dim > 0){
@@ -643,17 +644,15 @@ static herr_t dset_write(int local_dim, file_descr *fd, parameters *parms, void
case POSIXIO:
/* initialize POSIX offset in the buffer */
- for (j=0; j < parms->rank; j++) {
- buf_offset[j]=0;
- }
+ for(j = 0; j < parms->rank; j++)
+ buf_offset[j] = 0;
buf_p = (unsigned char *)buffer;
/* write POSIX buffer */
posix_buffer_write(0, fd, parms, buffer);
break;
case HDF5:
- /* if dimensions are extendable, extend them as needed during
- access */
+ /* if dimensions are extendable, extend them as needed during access */
if (parms->h5_use_chunks && parms->h5_extendable) {
hrc=H5Sget_simple_extent_dims(h5dset_space_id,dims,maxdims);
@@ -661,7 +660,8 @@ static herr_t dset_write(int local_dim, file_descr *fd, parameters *parms, void
for (k=0; k < parms->rank; k++){
- if (dims[k] <= h5offset[k]) {
+ HDassert(h5offset[k] >= 0);
+ if (dims[k] <= (hsize_t)h5offset[k]) {
dims[k] = dims[k]+h5count[k];
hrc=H5Sset_extent_simple(h5dset_space_id,parms->rank,dims,maxdims);
VRFY((hrc >= 0), "H5Sset_extent_simple");
@@ -702,20 +702,17 @@ done:
* Modifications:
*/
-static herr_t posix_buffer_write(int local_dim, file_descr *fd, parameters *parms, void *buffer)
+static herr_t
+posix_buffer_write(int local_dim, file_descr *fd, parameters *parms, void *buffer)
{
- int dtype_size = 1;
int ret_code = SUCCESS;
- long i;
- size_t d_offset;
- size_t linear_dset_offset = 0;
- int j, rc;
/* if dimension is not contiguous, call recursively */
if (local_dim < parms->rank-1 && local_dim != cont_dim) {
+ size_t u;
- for (i=0; i < parms->buf_size[local_dim]; i += dtype_size) {
- buf_offset[local_dim] = i;
+ for(u = 0; u < parms->buf_size[local_dim]; u ++) {
+ buf_offset[local_dim] = u;
posix_buffer_write(local_dim+1, fd, parms, buffer);
/* if next dimension is cont_dim, it will fill out the buffer
@@ -726,17 +723,20 @@ static herr_t posix_buffer_write(int local_dim, file_descr *fd, parameters *parm
}
/* otherwise, perform contiguous POSIX access */
} else {
+ HDoff_t d_offset;
+ HDoff_t linear_dset_offset = 0;
+ int i, j, rc;
buf_offset[local_dim] = 0;
/* determine offset in the buffer */
- for (i=0; i < parms->rank; i++){
- d_offset=1;
+ for(i = 0; i < parms->rank; i++) {
+ d_offset = 1;
- for (j=i+1; j < parms->rank; j++)
- d_offset *= parms->dset_size[j];
+ for(j = i + 1; j < parms->rank; j++)
+ d_offset *= (HDoff_t)parms->dset_size[j];
- linear_dset_offset += (offset[i]+buf_offset[i])*d_offset;
+ linear_dset_offset += (offset[i] + (HDoff_t)buf_offset[i]) * d_offset;
}
/* only care if seek returns error */
@@ -751,6 +751,7 @@ static herr_t posix_buffer_write(int local_dim, file_descr *fd, parameters *parm
buf_p += cont_size;
}
+
done:
return ret_code;
}
@@ -768,7 +769,8 @@ do_read(results *res, file_descr *fd, parameters *parms, void *buffer)
char *buffer2 = NULL; /* Buffer for data verification */
int ret_code = SUCCESS;
char dname[64];
- long i;
+ int i;
+ size_t u;
/* HDF5 variables */
herr_t hrc; /*HDF5 return code */
hsize_t h5dims[MAX_DIMS]; /*dataset dim sizes */
@@ -784,8 +786,8 @@ do_read(results *res, file_descr *fd, parameters *parms, void *buffer)
} /* end if */
/* Prepare buffer for verifying data */
- for(i = 0; i < linear_buf_size; i++)
- buffer2[i] = i % 128;
+ for(u = 0; u < linear_buf_size; u++)
+ buffer2[u] = (char)(u % 128);
rank = parms->rank;
for(i = 0; i < rank; i++)
@@ -939,18 +941,21 @@ done:
* Modifications:
*/
-static herr_t dset_read(int local_dim, file_descr *fd, parameters *parms,
- void *buffer, const char *buffer2)
+static herr_t
+dset_read(int local_dim, file_descr *fd, parameters *parms, void *buffer,
+ const char *buffer2)
{
int cur_dim = order[local_dim]-1;
- int ret_code = SUCCESS;
- long i,j;
+ hsize_t i;
+ int j;
herr_t hrc;
+ int ret_code = SUCCESS;
/* iterate on the current dimension */
for (i=0; i < parms->dset_size[cur_dim]; i += parms->buf_size[cur_dim]){
- h5offset[cur_dim] = offset[cur_dim] = i;
+ h5offset[cur_dim] = (hssize_t)i;
+ offset[cur_dim] = (HDoff_t)i;
/* if traverse in order array is incomplete, recurse */
if (local_dim > 0){
@@ -977,13 +982,6 @@ static herr_t dset_read(int local_dim, file_descr *fd, parameters *parms,
hrc = H5Dread(h5ds_id, ELMT_H5_TYPE, h5mem_space_id,
h5dset_space_id, h5dxpl, buffer);
VRFY((hrc >= 0), "H5Dread");
-#if 0
- for (j=0; j<linear_buf_size; j++) {
- buf_p = (unsigned char*)buffer;
- if (buf_p[j]!=buffer2[j])
- printf("Inconsistent data in %d\n", j);
- }
-#endif
break;
default:
@@ -1006,26 +1004,26 @@ done:
* Modifications:
*/
-static herr_t posix_buffer_read(int local_dim, file_descr *fd, parameters *parms, void *buffer)
+static herr_t
+posix_buffer_read(int local_dim, file_descr *fd, parameters *parms, void *buffer)
{
- int dtype_size = 1;
int ret_code = SUCCESS;
- long i;
- size_t d_offset;
- size_t linear_dset_offset = 0;
- int j, rc;
/* if local dimension is not contiguous, recurse */
if (local_dim < parms->rank-1 && local_dim != cont_dim) {
+ size_t u;
- for (i=0; i < parms->buf_size[local_dim]; i += dtype_size) {
- buf_offset[local_dim] = i;
+ for(u = 0; u < parms->buf_size[local_dim]; u++) {
+ buf_offset[local_dim] = u;
ret_code = posix_buffer_read(local_dim+1, fd, parms, buffer);
if (local_dim+1==cont_dim)
break;
}
/* otherwise, perform contiguous POSIX access */
} else {
+ HDoff_t d_offset;
+ HDoff_t linear_dset_offset = 0;
+ int i, j, rc;
buf_offset[local_dim] = 0;
/* determine offset in buffer */
@@ -1033,9 +1031,9 @@ static herr_t posix_buffer_read(int local_dim, file_descr *fd, parameters *parms
d_offset=1;
for (j=i+1; j<parms->rank; j++)
- d_offset *= parms->dset_size[j];
+ d_offset *= (HDoff_t)parms->dset_size[j];
- linear_dset_offset += (offset[i]+buf_offset[i])*d_offset;
+ linear_dset_offset += (offset[i] + (HDoff_t)buf_offset[i]) * d_offset;
}
/* only care if seek returns error */
@@ -1167,7 +1165,7 @@ set_vfd(parameters *param)
memb_fapl[mt] = H5P_DEFAULT;
sprintf(sv[mt], "%%s-%c.h5", multi_letters[mt]);
memb_name[mt] = sv[mt];
- memb_addr[mt] = MAX(mt-1,0)*(HADDR_MAX/10);
+ memb_addr[mt] = (haddr_t)MAX(mt - 1,0) * (HADDR_MAX / 10);
}
if (H5Pset_fapl_multi(my_fapl, memb_map, memb_fapl, memb_name,
diff --git a/tools/perform/sio_perf.c b/tools/perform/sio_perf.c
index a69e929..aceccb0 100644
--- a/tools/perform/sio_perf.c
+++ b/tools/perform/sio_perf.c
@@ -68,7 +68,7 @@
#define SIO_HDF5 0x4
/* report 0.0 in case t is zero too */
-#define MB_PER_SEC(bytes,t) (((t)==0.0F) ? 0.0F : ((((double)bytes) / ONE_MB) / (t)))
+#define MB_PER_SEC(bytes,t) (H5_DBL_ABS_EQUAL(t, (double)0.0F) ? (double)0.0F : ((((double)bytes) / (double)ONE_MB) / (t)))
#ifndef TRUE
#define TRUE 1
@@ -279,18 +279,18 @@ struct options {
long num_files; /* number of files */
off_t num_bpp; /* number of bytes per proc per dset */
int num_iters; /* number of iterations */
- off_t dset_size[MAX_DIMS]; /* Dataset size */
+ hsize_t dset_size[MAX_DIMS]; /* Dataset size */
size_t buf_size[MAX_DIMS]; /* Buffer size */
size_t chk_size[MAX_DIMS]; /* Chunk size */
- int order[MAX_DIMS]; /* Dimension access order */
- int dset_rank; /* Rank */
- int buf_rank; /* Rank */
+ int order[MAX_DIMS]; /* Dimension access order */
+ int dset_rank; /* Rank */
+ int buf_rank; /* Rank */
int order_rank; /* Rank */
- int chk_rank; /* Rank */
+ int chk_rank; /* Rank */
int print_times; /* print times as well as throughputs */
int print_raw; /* print raw data throughput info */
- off_t h5_alignment; /* alignment in HDF5 file */
- off_t h5_threshold; /* threshold for alignment in HDF5 file */
+ hsize_t h5_alignment; /* alignment in HDF5 file */
+ hsize_t h5_threshold; /* threshold for alignment in HDF5 file */
int h5_use_chunks; /* Make HDF5 dataset chunked */
int h5_write_only; /* Perform the write tests only */
int h5_extendable; /* Perform the write tests only */
@@ -307,13 +307,13 @@ typedef struct _minmax {
} minmax;
/* local functions */
-static off_t parse_size_directive(const char *size);
+static hsize_t parse_size_directive(const char *size);
static struct options *parse_command_line(int argc, char *argv[]);
static void run_test_loop(struct options *options);
static int run_test(iotype iot, parameters parms, struct options *opts);
static void output_all_info(minmax *mm, int count, int indent_level);
static void get_minmax(minmax *mm, double val);
-static minmax accumulate_minmax_stuff(minmax *mm, int count);
+static void accumulate_minmax_stuff(const minmax *mm, int count, minmax *total_mm);
static void output_results(const struct options *options, const char *name,
minmax *table, int table_size, off_t data_size);
static void output_report(const char *fmt, ...);
@@ -392,6 +392,7 @@ run_test_loop(struct options *opts)
parameters parms;
int i;
size_t buf_bytes;
+
/* load options into parameter structure */
parms.num_files = opts->num_files;
parms.num_dsets = opts->num_dsets;
@@ -496,7 +497,8 @@ run_test(iotype iot, parameters parms, struct options *opts)
/* Do IO iteration times, collecting statistics each time */
for (i = 0; i < parms.num_iters; ++i) {
double t;
- res = do_sio(parms);
+
+ do_sio(parms, &res);
/* gather all of the "sys write" times */
t = get_time(res.timers, HDF5_MPI_WRITE);
@@ -711,30 +713,27 @@ get_minmax(minmax *mm, double val)
* Modifications:
* Changed to use seconds instead of MB/s - QAK, 5/9/02
*/
-static minmax
-accumulate_minmax_stuff(minmax *mm, int count)
+static void
+accumulate_minmax_stuff(const minmax *mm, int count, minmax *total_mm)
{
int i;
- minmax total_mm;
- total_mm.sum = 0.0F;
- total_mm.max = -DBL_MAX;
- total_mm.min = DBL_MAX;
- total_mm.num = count;
+ total_mm->sum = 0.0F;
+ total_mm->max = -DBL_MAX;
+ total_mm->min = DBL_MAX;
+ total_mm->num = count;
for (i = 0; i < count; ++i) {
double m = mm[i].max;
- total_mm.sum += m;
+ total_mm->sum += m;
- if (m < total_mm.min)
- total_mm.min = m;
+ if (m < total_mm->min)
+ total_mm->min = m;
- if (m > total_mm.max)
- total_mm.max = m;
+ if (m > total_mm->max)
+ total_mm->max = m;
}
-
- return total_mm;
}
@@ -752,7 +751,7 @@ output_results(const struct options *opts, const char *name, minmax *table,
{
minmax total_mm;
- total_mm = accumulate_minmax_stuff(table, table_size);
+ accumulate_minmax_stuff(table, table_size, &total_mm);
print_indent(3);
output_report("%s (%d iteration(s)):\n", name,table_size);
@@ -940,10 +939,11 @@ report_parameters(struct options *opts)
static struct options *
parse_command_line(int argc, char *argv[])
{
- register int opt;
+ int opt;
struct options *cl_opts;
int i, default_rank, actual_rank, ranks[4];
- cl_opts = (struct options *)malloc(sizeof(struct options));
+
+ cl_opts = (struct options *)HDmalloc(sizeof(struct options));
cl_opts->output_file = NULL;
cl_opts->io_types = 0; /* will set default after parsing options */
@@ -956,11 +956,11 @@ parse_command_line(int argc, char *argv[])
cl_opts->chk_rank = 0;
cl_opts->order_rank = 0;
- for (i=0; i<MAX_DIMS; i++){
- cl_opts->buf_size[i]=(i+1)*10;
- cl_opts->dset_size[i]=(i+1)*100;
- cl_opts->chk_size[i]=(i+1)*10;
- cl_opts->order[i]=i+1;
+ for(i = 0; i < MAX_DIMS; i++) {
+ cl_opts->buf_size[i] = (size_t)((i + 1) * 10);
+ cl_opts->dset_size[i] = (hsize_t)((i + 1) * 100);
+ cl_opts->chk_size[i] = (size_t)((i + 1) * 10);
+ cl_opts->order[i] = i + 1;
}
cl_opts->vfd = sec2;
@@ -985,7 +985,7 @@ parse_command_line(int argc, char *argv[])
while (end && *end != '\0') {
char buf[10];
- memset(buf, '\0', sizeof(buf));
+ HDmemset(buf, '\0', sizeof(buf));
for (i = 0; *end != '\0' && *end != ','; ++end)
if (isalnum(*end) && i < 10)
@@ -1024,7 +1024,7 @@ parse_command_line(int argc, char *argv[])
while (end && *end != '\0') {
char buf[10];
- memset(buf, '\0', sizeof(buf));
+ HDmemset(buf, '\0', sizeof(buf));
for (i = 0; *end != '\0' && *end != ','; ++end)
if (isalnum(*end) && i < 10)
@@ -1052,7 +1052,7 @@ parse_command_line(int argc, char *argv[])
while (end && *end != '\0') {
char buf[10];
- memset(buf, '\0', sizeof(buf));
+ HDmemset(buf, '\0', sizeof(buf));
for (i = 0; *end != '\0' && *end != ','; ++end)
if (isalnum(*end) && i < 10)
@@ -1110,7 +1110,7 @@ parse_command_line(int argc, char *argv[])
while (end && *end != '\0') {
char buf[10];
- memset(buf, '\0', sizeof(buf));
+ HDmemset(buf, '\0', sizeof(buf));
for (i = 0; *end != '\0' && *end != ','; ++end)
if (isalnum(*end) && i < 10)
@@ -1174,7 +1174,7 @@ parse_command_line(int argc, char *argv[])
while (end && *end != '\0') {
char buf[10];
- memset(buf, '\0', sizeof(buf));
+ HDmemset(buf, '\0', sizeof(buf));
for (i = 0; *end != '\0' && *end != ','; ++end)
if (isalnum(*end) && i < 10)
@@ -1202,13 +1202,13 @@ parse_command_line(int argc, char *argv[])
while (end && *end != '\0') {
char buf[10];
- memset(buf, '\0', sizeof(buf));
+ HDmemset(buf, '\0', sizeof(buf));
for (i = 0; *end != '\0' && *end != ','; ++end)
if (isalnum(*end) && i < 10)
buf[i++] = *end;
- cl_opts->order[j] = parse_size_directive(buf);
+ cl_opts->order[j] = (int)parse_size_directive(buf);
j++;
@@ -1294,13 +1294,13 @@ parse_command_line(int argc, char *argv[])
* Modifications:
*/
-static off_t
+static hsize_t
parse_size_directive(const char *size)
{
- off_t s;
+ hsize_t s;
char *endptr;
- s = strtol(size, &endptr, 10);
+ s = HDstrtoull(size, &endptr, 10);
if (endptr && *endptr) {
while (*endptr != '\0' && (*endptr == ' ' || *endptr == '\t'))
@@ -1311,14 +1311,17 @@ parse_size_directive(const char *size)
case 'k':
s *= ONE_KB;
break;
+
case 'M':
case 'm':
s *= ONE_MB;
break;
+
case 'G':
case 'g':
s *= ONE_GB;
break;
+
default:
fprintf(stderr, "Illegal size specifier '%c'\n", *endptr);
exit(EXIT_FAILURE);
diff --git a/tools/perform/sio_perf.h b/tools/perform/sio_perf.h
index 311d909..7a7d708 100644
--- a/tools/perform/sio_perf.h
+++ b/tools/perform/sio_perf.h
@@ -52,21 +52,21 @@ typedef enum vfdtype_ {
typedef struct parameters_ {
iotype io_type; /* The type of IO test to perform */
vfdtype vfd;
- long num_files; /* Number of files to create */
- long num_dsets; /* Number of datasets to create */
- off_t num_bytes; /* Number of bytes in each dset */
- int num_iters; /* Number of times to loop doing the IO */
- int rank; /* Rank of dataset */
- off_t dset_size[MAX_DIMS]; /* Dataset size */
- size_t buf_size[MAX_DIMS]; /* Buffer size */
- size_t chk_size[MAX_DIMS]; /* Chunk size */
- int order[MAX_DIMS]; /* Buffer size */
- hsize_t h5_align; /* HDF5 object alignment */
- hsize_t h5_thresh; /* HDF5 object alignment threshold */
- int h5_use_chunks; /* Make HDF5 dataset chunked */
- int h5_extendable; /* Make HDF5 dataset chunked */
- int h5_write_only; /* Perform the write tests only */
- int verify; /* Verify data correctness */
+ long num_files; /* Number of files to create */
+ long num_dsets; /* Number of datasets to create */
+ hsize_t num_bytes; /* Number of bytes in each dset */
+ int num_iters; /* Number of times to loop doing the IO */
+ int rank; /* Rank of dataset */
+ hsize_t dset_size[MAX_DIMS]; /* Dataset size */
+ size_t buf_size[MAX_DIMS]; /* Buffer size */
+ size_t chk_size[MAX_DIMS]; /* Chunk size */
+ int order[MAX_DIMS]; /* Buffer size */
+ hsize_t h5_align; /* HDF5 object alignment */
+ hsize_t h5_thresh; /* HDF5 object alignment threshold */
+ int h5_use_chunks; /* Make HDF5 dataset chunked */
+ int h5_extendable; /* Make HDF5 dataset chunked */
+ int h5_write_only; /* Perform the write tests only */
+ int verify; /* Verify data correctness */
} parameters;
typedef struct results_ {
@@ -95,7 +95,7 @@ extern int sio_debug_level; /* The debug level:
extern "C" {
#endif /* __cplusplus */
-extern results do_sio(parameters param);
+extern void do_sio(parameters param, results *res);
#ifdef __cplusplus
}
diff --git a/tools/perform/zip_perf.c b/tools/perform/zip_perf.c
index d025602..d9b1fa2 100644
--- a/tools/perform/zip_perf.c
+++ b/tools/perform/zip_perf.c
@@ -37,7 +37,7 @@
#define MICROSECOND 1000000.0F
/* report 0.0 in case t is zero too */
-#define MB_PER_SEC(bytes,t) ((fabs(t)<0.0000000001F) ? 0.0F : ((((double)bytes) / ONE_MB) / (t)))
+#define MB_PER_SEC(bytes,t) ((fabs(t) < (double)0.0000000001F) ? (double)0.0F : ((((double)bytes) / (double)ONE_MB) / (t)))
#ifndef TRUE
#define TRUE 1
@@ -173,7 +173,7 @@ write_file(Bytef *source, uLongf sourceLen)
/* destination buffer needs to be at least 0.1% larger than sourceLen
* plus 12 bytes */
- destLen = (uLongf)((double)sourceLen + ((double)sourceLen * 0.1F)) + 12;
+ destLen = (uLongf)((double)sourceLen + ((double)sourceLen * (double)0.1F)) + 12;
dest = (Bytef *)HDmalloc(destLen);
if (!dest)
@@ -184,9 +184,9 @@ write_file(Bytef *source, uLongf sourceLen)
HDgettimeofday(&timer_stop, NULL);
compression_time += ((double)timer_stop.tv_sec +
- ((double)timer_stop.tv_usec) / MICROSECOND) -
+ ((double)timer_stop.tv_usec) / (double)MICROSECOND) -
((double)timer_start.tv_sec +
- ((double)timer_start.tv_usec) / MICROSECOND);
+ ((double)timer_start.tv_usec) / (double)MICROSECOND);
if (report_once_flag) {
HDfprintf(stdout, "\tCompression Ratio: %g\n", ((double)destLen) / (double)sourceLen);
@@ -206,7 +206,7 @@ write_file(Bytef *source, uLongf sourceLen)
if (rc == (int)d_len)
break;
- d_len -= rc;
+ d_len -= (size_t)rc;
d_ptr += rc;
}
@@ -419,7 +419,7 @@ fill_with_random_data(Bytef *src, uLongf src_len)
break;
buf += rc;
- len -= rc;
+ len -= (size_t)rc;
}
} else {
HDfprintf(stdout, "Using random() for random data\n");
@@ -429,7 +429,7 @@ fill_with_random_data(Bytef *src, uLongf src_len)
}
if (compress_percent) {
- unsigned long s = src_len * compress_percent / 100;
+ size_t s = (size_t)((src_len * (uLongf)compress_percent) / 100);
HDmemset(src, '\0', s);
}
@@ -495,7 +495,7 @@ do_write_test(unsigned long file_size, unsigned long min_buf_size,
if (rc == (ssize_t)s_len)
break;
- s_len -= rc;
+ s_len -= (size_t)rc;
s_ptr += rc;
}
}
@@ -504,9 +504,9 @@ do_write_test(unsigned long file_size, unsigned long min_buf_size,
HDgettimeofday(&timer_stop, NULL);
total_time = ((double)timer_stop.tv_sec +
- ((double)timer_stop.tv_usec) / MICROSECOND) -
+ ((double)timer_stop.tv_usec) / (double)MICROSECOND) -
((double)timer_start.tv_sec +
- ((double)timer_start.tv_usec) / MICROSECOND);
+ ((double)timer_start.tv_usec) / (double)MICROSECOND);
HDfprintf(stdout, "\tUncompressed Write Time: %.2fs\n", total_time);
HDfprintf(stdout, "\tUncompressed Write Throughput: %.2fMB/s\n",
@@ -530,9 +530,9 @@ do_write_test(unsigned long file_size, unsigned long min_buf_size,
HDgettimeofday(&timer_stop, NULL);
total_time = ((double)timer_stop.tv_sec +
- ((double)timer_stop.tv_usec) / MICROSECOND) -
+ ((double)timer_stop.tv_usec) / (double)MICROSECOND) -
((double)timer_start.tv_sec +
- ((double)timer_start.tv_usec) / MICROSECOND);
+ ((double)timer_start.tv_usec) / (double)MICROSECOND);
HDfprintf(stdout, "\tCompressed Write Time: %.2fs\n", total_time);
HDfprintf(stdout, "\tCompressed Write Throughput: %.2fMB/s\n",
diff --git a/tools/testfiles/tcompound_complex2.ddl b/tools/testfiles/tcompound_complex2.ddl
new file mode 100644
index 0000000..562235d
--- /dev/null
+++ b/tools/testfiles/tcompound_complex2.ddl
@@ -0,0 +1,1051 @@
+HDF5 "tcompound_complex2.h5" {
+GROUP "/" {
+ DATASET "CompoundComplex1D" {
+ DATATYPE H5T_COMPOUND {
+ H5T_ARRAY { [4] H5T_STD_U32LE } "a";
+ H5T_ARRAY { [6] H5T_STD_I32LE } "b";
+ H5T_ARRAY { [2][4] H5T_IEEE_F32LE } "c";
+ H5T_COMPOUND {
+ H5T_IEEE_F64LE "nested_double";
+ H5T_ARRAY { [1] H5T_STRING {
+ STRSIZE 23;
+ STRPAD H5T_STR_NULLTERM;
+ CSET H5T_CSET_ASCII;
+ CTYPE H5T_C_S1;
+ } } "nested_string";
+ H5T_ARRAY { [4] H5T_STRING {
+ STRSIZE 12;
+ STRPAD H5T_STR_NULLTERM;
+ CSET H5T_CSET_ASCII;
+ CTYPE H5T_C_S1;
+ } } "nested_string_array";
+ } "nested_compound";
+ H5T_COMPOUND {
+ H5T_IEEE_F32LE "nested_float";
+ H5T_COMPOUND {
+ H5T_ARRAY { [5] H5T_STD_U32LE } "nested_unsigned_int";
+ H5T_ARRAY { [5] H5T_STD_I32LE } "nested_int";
+ H5T_ARRAY { [5] H5T_STD_U64LE } "nested_unsigned_long";
+ H5T_ARRAY { [5] H5T_STD_I64LE } "nested_long";
+ } "further_nested_compoundA";
+ H5T_COMPOUND {
+ H5T_ARRAY { [1] H5T_STRING {
+ STRSIZE 11;
+ STRPAD H5T_STR_NULLTERM;
+ CSET H5T_CSET_ASCII;
+ CTYPE H5T_C_S1;
+ } } "nested_string";
+ H5T_ARRAY { [4] H5T_STRING {
+ STRSIZE 13;
+ STRPAD H5T_STR_NULLTERM;
+ CSET H5T_CSET_ASCII;
+ CTYPE H5T_C_S1;
+ } } "nested_string_array";
+ H5T_COMPOUND {
+ H5T_ARRAY { [10] H5T_STD_I16LE } "deep_nested_short";
+ H5T_ARRAY { [10] H5T_STD_I32LE } "deep_nested_int";
+ H5T_ARRAY { [10] H5T_STD_I64LE } "deep_nested_long";
+ H5T_ARRAY { [10] H5T_IEEE_F64LE } "deep_nested_double";
+ H5T_ARRAY { [10] H5T_IEEE_F32LE } "deep_nested_float";
+ } "deep_nested_compound";
+ } "further_nested_compoundB";
+ } "multiple_nested_compound";
+ }
+ DATASPACE SIMPLE { ( 32 ) / ( 32 ) }
+ DATA {
+ (0): {
+ [ 0, 1, 2, 3 ],
+ [ 0, 1, 2, 3, 4, 5 ],
+ [ 0, 1, 2, 3,
+ 1.1, 2.1, 3.1, 4.1 ],
+ {
+ 0,
+ [ "This is a test string." ],
+ [ "String test", "String test", "String test", "String test" ]
+ },
+ {
+ 0,
+ {
+ [ 0, 1, 2, 3, 4 ],
+ [ 0, 1, 2, 3, 4 ],
+ [ 0, 1, 2, 3, 4 ],
+ [ 0, 1, 2, 3, 4 ]
+ },
+ {
+ [ "1234567890" ],
+ [ "STRING ARRAY", "STRING ARRAY", "STRING ARRAY", "STRING ARRAY" ],
+ {
+ [ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 ],
+ [ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 ],
+ [ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 ],
+ [ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 ],
+ [ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 ]
+ }
+ }
+ }
+ },
+ (1): {
+ [ 10, 11, 12, 13 ],
+ [ -10, -9, -8, -7, -6, -5 ],
+ [ 10, 11, 12, 13,
+ 11.1, 12.1, 13.1, 14.1 ],
+ {
+ 1,
+ [ "This is a test string." ],
+ [ "String test", "String test", "String test", "String test" ]
+ },
+ {
+ 1,
+ {
+ [ 10, 11, 12, 13, 14 ],
+ [ -10, -9, -8, -7, -6 ],
+ [ 10, 11, 12, 13, 14 ],
+ [ -10, -9, -8, -7, -6 ]
+ },
+ {
+ [ "1234567890" ],
+ [ "STRING ARRAY", "STRING ARRAY", "STRING ARRAY", "STRING ARRAY" ],
+ {
+ [ 10, 11, 12, 13, 14, 15, 16, 17, 18, 19 ],
+ [ -10, -9, -8, -7, -6, -5, -4, -3, -2, -1 ],
+ [ 10, 11, 12, 13, 14, 15, 16, 17, 18, 19 ],
+ [ 10, 11, 12, 13, 14, 15, 16, 17, 18, 19 ],
+ [ 10, 11, 12, 13, 14, 15, 16, 17, 18, 19 ]
+ }
+ }
+ }
+ },
+ (2): {
+ [ 20, 21, 22, 23 ],
+ [ -20, -19, -18, -17, -16, -15 ],
+ [ 20, 21, 22, 23,
+ 21.1, 22.1, 23.1, 24.1 ],
+ {
+ 2,
+ [ "This is a test string." ],
+ [ "String test", "String test", "String test", "String test" ]
+ },
+ {
+ 2,
+ {
+ [ 20, 21, 22, 23, 24 ],
+ [ -20, -19, -18, -17, -16 ],
+ [ 20, 21, 22, 23, 24 ],
+ [ -20, -19, -18, -17, -16 ]
+ },
+ {
+ [ "1234567890" ],
+ [ "STRING ARRAY", "STRING ARRAY", "STRING ARRAY", "STRING ARRAY" ],
+ {
+ [ 20, 21, 22, 23, 24, 25, 26, 27, 28, 29 ],
+ [ -20, -19, -18, -17, -16, -15, -14, -13, -12, -11 ],
+ [ 20, 21, 22, 23, 24, 25, 26, 27, 28, 29 ],
+ [ 20, 21, 22, 23, 24, 25, 26, 27, 28, 29 ],
+ [ 20, 21, 22, 23, 24, 25, 26, 27, 28, 29 ]
+ }
+ }
+ }
+ },
+ (3): {
+ [ 30, 31, 32, 33 ],
+ [ -30, -29, -28, -27, -26, -25 ],
+ [ 30, 31, 32, 33,
+ 31.1, 32.1, 33.1, 34.1 ],
+ {
+ 3,
+ [ "This is a test string." ],
+ [ "String test", "String test", "String test", "String test" ]
+ },
+ {
+ 3,
+ {
+ [ 30, 31, 32, 33, 34 ],
+ [ -30, -29, -28, -27, -26 ],
+ [ 30, 31, 32, 33, 34 ],
+ [ -30, -29, -28, -27, -26 ]
+ },
+ {
+ [ "1234567890" ],
+ [ "STRING ARRAY", "STRING ARRAY", "STRING ARRAY", "STRING ARRAY" ],
+ {
+ [ 30, 31, 32, 33, 34, 35, 36, 37, 38, 39 ],
+ [ -30, -29, -28, -27, -26, -25, -24, -23, -22, -21 ],
+ [ 30, 31, 32, 33, 34, 35, 36, 37, 38, 39 ],
+ [ 30, 31, 32, 33, 34, 35, 36, 37, 38, 39 ],
+ [ 30, 31, 32, 33, 34, 35, 36, 37, 38, 39 ]
+ }
+ }
+ }
+ },
+ (4): {
+ [ 40, 41, 42, 43 ],
+ [ -40, -39, -38, -37, -36, -35 ],
+ [ 40, 41, 42, 43,
+ 41.1, 42.1, 43.1, 44.1 ],
+ {
+ 4,
+ [ "This is a test string." ],
+ [ "String test", "String test", "String test", "String test" ]
+ },
+ {
+ 4,
+ {
+ [ 40, 41, 42, 43, 44 ],
+ [ -40, -39, -38, -37, -36 ],
+ [ 40, 41, 42, 43, 44 ],
+ [ -40, -39, -38, -37, -36 ]
+ },
+ {
+ [ "1234567890" ],
+ [ "STRING ARRAY", "STRING ARRAY", "STRING ARRAY", "STRING ARRAY" ],
+ {
+ [ 40, 41, 42, 43, 44, 45, 46, 47, 48, 49 ],
+ [ -40, -39, -38, -37, -36, -35, -34, -33, -32, -31 ],
+ [ 40, 41, 42, 43, 44, 45, 46, 47, 48, 49 ],
+ [ 40, 41, 42, 43, 44, 45, 46, 47, 48, 49 ],
+ [ 40, 41, 42, 43, 44, 45, 46, 47, 48, 49 ]
+ }
+ }
+ }
+ },
+ (5): {
+ [ 50, 51, 52, 53 ],
+ [ -50, -49, -48, -47, -46, -45 ],
+ [ 50, 51, 52, 53,
+ 51.1, 52.1, 53.1, 54.1 ],
+ {
+ 5,
+ [ "This is a test string." ],
+ [ "String test", "String test", "String test", "String test" ]
+ },
+ {
+ 5,
+ {
+ [ 50, 51, 52, 53, 54 ],
+ [ -50, -49, -48, -47, -46 ],
+ [ 50, 51, 52, 53, 54 ],
+ [ -50, -49, -48, -47, -46 ]
+ },
+ {
+ [ "1234567890" ],
+ [ "STRING ARRAY", "STRING ARRAY", "STRING ARRAY", "STRING ARRAY" ],
+ {
+ [ 50, 51, 52, 53, 54, 55, 56, 57, 58, 59 ],
+ [ -50, -49, -48, -47, -46, -45, -44, -43, -42, -41 ],
+ [ 50, 51, 52, 53, 54, 55, 56, 57, 58, 59 ],
+ [ 50, 51, 52, 53, 54, 55, 56, 57, 58, 59 ],
+ [ 50, 51, 52, 53, 54, 55, 56, 57, 58, 59 ]
+ }
+ }
+ }
+ },
+ (6): {
+ [ 60, 61, 62, 63 ],
+ [ -60, -59, -58, -57, -56, -55 ],
+ [ 60, 61, 62, 63,
+ 61.1, 62.1, 63.1, 64.1 ],
+ {
+ 6,
+ [ "This is a test string." ],
+ [ "String test", "String test", "String test", "String test" ]
+ },
+ {
+ 6,
+ {
+ [ 60, 61, 62, 63, 64 ],
+ [ -60, -59, -58, -57, -56 ],
+ [ 60, 61, 62, 63, 64 ],
+ [ -60, -59, -58, -57, -56 ]
+ },
+ {
+ [ "1234567890" ],
+ [ "STRING ARRAY", "STRING ARRAY", "STRING ARRAY", "STRING ARRAY" ],
+ {
+ [ 60, 61, 62, 63, 64, 65, 66, 67, 68, 69 ],
+ [ -60, -59, -58, -57, -56, -55, -54, -53, -52, -51 ],
+ [ 60, 61, 62, 63, 64, 65, 66, 67, 68, 69 ],
+ [ 60, 61, 62, 63, 64, 65, 66, 67, 68, 69 ],
+ [ 60, 61, 62, 63, 64, 65, 66, 67, 68, 69 ]
+ }
+ }
+ }
+ },
+ (7): {
+ [ 70, 71, 72, 73 ],
+ [ -70, -69, -68, -67, -66, -65 ],
+ [ 70, 71, 72, 73,
+ 71.1, 72.1, 73.1, 74.1 ],
+ {
+ 7,
+ [ "This is a test string." ],
+ [ "String test", "String test", "String test", "String test" ]
+ },
+ {
+ 7,
+ {
+ [ 70, 71, 72, 73, 74 ],
+ [ -70, -69, -68, -67, -66 ],
+ [ 70, 71, 72, 73, 74 ],
+ [ -70, -69, -68, -67, -66 ]
+ },
+ {
+ [ "1234567890" ],
+ [ "STRING ARRAY", "STRING ARRAY", "STRING ARRAY", "STRING ARRAY" ],
+ {
+ [ 70, 71, 72, 73, 74, 75, 76, 77, 78, 79 ],
+ [ -70, -69, -68, -67, -66, -65, -64, -63, -62, -61 ],
+ [ 70, 71, 72, 73, 74, 75, 76, 77, 78, 79 ],
+ [ 70, 71, 72, 73, 74, 75, 76, 77, 78, 79 ],
+ [ 70, 71, 72, 73, 74, 75, 76, 77, 78, 79 ]
+ }
+ }
+ }
+ },
+ (8): {
+ [ 80, 81, 82, 83 ],
+ [ -80, -79, -78, -77, -76, -75 ],
+ [ 80, 81, 82, 83,
+ 81.1, 82.1, 83.1, 84.1 ],
+ {
+ 8,
+ [ "This is a test string." ],
+ [ "String test", "String test", "String test", "String test" ]
+ },
+ {
+ 8,
+ {
+ [ 80, 81, 82, 83, 84 ],
+ [ -80, -79, -78, -77, -76 ],
+ [ 80, 81, 82, 83, 84 ],
+ [ -80, -79, -78, -77, -76 ]
+ },
+ {
+ [ "1234567890" ],
+ [ "STRING ARRAY", "STRING ARRAY", "STRING ARRAY", "STRING ARRAY" ],
+ {
+ [ 80, 81, 82, 83, 84, 85, 86, 87, 88, 89 ],
+ [ -80, -79, -78, -77, -76, -75, -74, -73, -72, -71 ],
+ [ 80, 81, 82, 83, 84, 85, 86, 87, 88, 89 ],
+ [ 80, 81, 82, 83, 84, 85, 86, 87, 88, 89 ],
+ [ 80, 81, 82, 83, 84, 85, 86, 87, 88, 89 ]
+ }
+ }
+ }
+ },
+ (9): {
+ [ 90, 91, 92, 93 ],
+ [ -90, -89, -88, -87, -86, -85 ],
+ [ 90, 91, 92, 93,
+ 91.1, 92.1, 93.1, 94.1 ],
+ {
+ 9,
+ [ "This is a test string." ],
+ [ "String test", "String test", "String test", "String test" ]
+ },
+ {
+ 9,
+ {
+ [ 90, 91, 92, 93, 94 ],
+ [ -90, -89, -88, -87, -86 ],
+ [ 90, 91, 92, 93, 94 ],
+ [ -90, -89, -88, -87, -86 ]
+ },
+ {
+ [ "1234567890" ],
+ [ "STRING ARRAY", "STRING ARRAY", "STRING ARRAY", "STRING ARRAY" ],
+ {
+ [ 90, 91, 92, 93, 94, 95, 96, 97, 98, 99 ],
+ [ -90, -89, -88, -87, -86, -85, -84, -83, -82, -81 ],
+ [ 90, 91, 92, 93, 94, 95, 96, 97, 98, 99 ],
+ [ 90, 91, 92, 93, 94, 95, 96, 97, 98, 99 ],
+ [ 90, 91, 92, 93, 94, 95, 96, 97, 98, 99 ]
+ }
+ }
+ }
+ },
+ (10): {
+ [ 100, 101, 102, 103 ],
+ [ -100, -99, -98, -97, -96, -95 ],
+ [ 100, 101, 102, 103,
+ 101.1, 102.1, 103.1, 104.1 ],
+ {
+ 10,
+ [ "This is a test string." ],
+ [ "String test", "String test", "String test", "String test" ]
+ },
+ {
+ 10,
+ {
+ [ 100, 101, 102, 103, 104 ],
+ [ -100, -99, -98, -97, -96 ],
+ [ 100, 101, 102, 103, 104 ],
+ [ -100, -99, -98, -97, -96 ]
+ },
+ {
+ [ "1234567890" ],
+ [ "STRING ARRAY", "STRING ARRAY", "STRING ARRAY", "STRING ARRAY" ],
+ {
+ [ 100, 101, 102, 103, 104, 105, 106, 107, 108, 109 ],
+ [ -100, -99, -98, -97, -96, -95, -94, -93, -92, -91 ],
+ [ 100, 101, 102, 103, 104, 105, 106, 107, 108, 109 ],
+ [ 100, 101, 102, 103, 104, 105, 106, 107, 108, 109 ],
+ [ 100, 101, 102, 103, 104, 105, 106, 107, 108, 109 ]
+ }
+ }
+ }
+ },
+ (11): {
+ [ 110, 111, 112, 113 ],
+ [ -110, -109, -108, -107, -106, -105 ],
+ [ 110, 111, 112, 113,
+ 111.1, 112.1, 113.1, 114.1 ],
+ {
+ 11,
+ [ "This is a test string." ],
+ [ "String test", "String test", "String test", "String test" ]
+ },
+ {
+ 11,
+ {
+ [ 110, 111, 112, 113, 114 ],
+ [ -110, -109, -108, -107, -106 ],
+ [ 110, 111, 112, 113, 114 ],
+ [ -110, -109, -108, -107, -106 ]
+ },
+ {
+ [ "1234567890" ],
+ [ "STRING ARRAY", "STRING ARRAY", "STRING ARRAY", "STRING ARRAY" ],
+ {
+ [ 110, 111, 112, 113, 114, 115, 116, 117, 118, 119 ],
+ [ -110, -109, -108, -107, -106, -105, -104, -103, -102, -101 ],
+ [ 110, 111, 112, 113, 114, 115, 116, 117, 118, 119 ],
+ [ 110, 111, 112, 113, 114, 115, 116, 117, 118, 119 ],
+ [ 110, 111, 112, 113, 114, 115, 116, 117, 118, 119 ]
+ }
+ }
+ }
+ },
+ (12): {
+ [ 120, 121, 122, 123 ],
+ [ -120, -119, -118, -117, -116, -115 ],
+ [ 120, 121, 122, 123,
+ 121.1, 122.1, 123.1, 124.1 ],
+ {
+ 12,
+ [ "This is a test string." ],
+ [ "String test", "String test", "String test", "String test" ]
+ },
+ {
+ 12,
+ {
+ [ 120, 121, 122, 123, 124 ],
+ [ -120, -119, -118, -117, -116 ],
+ [ 120, 121, 122, 123, 124 ],
+ [ -120, -119, -118, -117, -116 ]
+ },
+ {
+ [ "1234567890" ],
+ [ "STRING ARRAY", "STRING ARRAY", "STRING ARRAY", "STRING ARRAY" ],
+ {
+ [ 120, 121, 122, 123, 124, 125, 126, 127, 128, 129 ],
+ [ -120, -119, -118, -117, -116, -115, -114, -113, -112, -111 ],
+ [ 120, 121, 122, 123, 124, 125, 126, 127, 128, 129 ],
+ [ 120, 121, 122, 123, 124, 125, 126, 127, 128, 129 ],
+ [ 120, 121, 122, 123, 124, 125, 126, 127, 128, 129 ]
+ }
+ }
+ }
+ },
+ (13): {
+ [ 130, 131, 132, 133 ],
+ [ -130, -129, -128, -127, -126, -125 ],
+ [ 130, 131, 132, 133,
+ 131.1, 132.1, 133.1, 134.1 ],
+ {
+ 13,
+ [ "This is a test string." ],
+ [ "String test", "String test", "String test", "String test" ]
+ },
+ {
+ 13,
+ {
+ [ 130, 131, 132, 133, 134 ],
+ [ -130, -129, -128, -127, -126 ],
+ [ 130, 131, 132, 133, 134 ],
+ [ -130, -129, -128, -127, -126 ]
+ },
+ {
+ [ "1234567890" ],
+ [ "STRING ARRAY", "STRING ARRAY", "STRING ARRAY", "STRING ARRAY" ],
+ {
+ [ 130, 131, 132, 133, 134, 135, 136, 137, 138, 139 ],
+ [ -130, -129, -128, -127, -126, -125, -124, -123, -122, -121 ],
+ [ 130, 131, 132, 133, 134, 135, 136, 137, 138, 139 ],
+ [ 130, 131, 132, 133, 134, 135, 136, 137, 138, 139 ],
+ [ 130, 131, 132, 133, 134, 135, 136, 137, 138, 139 ]
+ }
+ }
+ }
+ },
+ (14): {
+ [ 140, 141, 142, 143 ],
+ [ -140, -139, -138, -137, -136, -135 ],
+ [ 140, 141, 142, 143,
+ 141.1, 142.1, 143.1, 144.1 ],
+ {
+ 14,
+ [ "This is a test string." ],
+ [ "String test", "String test", "String test", "String test" ]
+ },
+ {
+ 14,
+ {
+ [ 140, 141, 142, 143, 144 ],
+ [ -140, -139, -138, -137, -136 ],
+ [ 140, 141, 142, 143, 144 ],
+ [ -140, -139, -138, -137, -136 ]
+ },
+ {
+ [ "1234567890" ],
+ [ "STRING ARRAY", "STRING ARRAY", "STRING ARRAY", "STRING ARRAY" ],
+ {
+ [ 140, 141, 142, 143, 144, 145, 146, 147, 148, 149 ],
+ [ -140, -139, -138, -137, -136, -135, -134, -133, -132, -131 ],
+ [ 140, 141, 142, 143, 144, 145, 146, 147, 148, 149 ],
+ [ 140, 141, 142, 143, 144, 145, 146, 147, 148, 149 ],
+ [ 140, 141, 142, 143, 144, 145, 146, 147, 148, 149 ]
+ }
+ }
+ }
+ },
+ (15): {
+ [ 150, 151, 152, 153 ],
+ [ -150, -149, -148, -147, -146, -145 ],
+ [ 150, 151, 152, 153,
+ 151.1, 152.1, 153.1, 154.1 ],
+ {
+ 15,
+ [ "This is a test string." ],
+ [ "String test", "String test", "String test", "String test" ]
+ },
+ {
+ 15,
+ {
+ [ 150, 151, 152, 153, 154 ],
+ [ -150, -149, -148, -147, -146 ],
+ [ 150, 151, 152, 153, 154 ],
+ [ -150, -149, -148, -147, -146 ]
+ },
+ {
+ [ "1234567890" ],
+ [ "STRING ARRAY", "STRING ARRAY", "STRING ARRAY", "STRING ARRAY" ],
+ {
+ [ 150, 151, 152, 153, 154, 155, 156, 157, 158, 159 ],
+ [ -150, -149, -148, -147, -146, -145, -144, -143, -142, -141 ],
+ [ 150, 151, 152, 153, 154, 155, 156, 157, 158, 159 ],
+ [ 150, 151, 152, 153, 154, 155, 156, 157, 158, 159 ],
+ [ 150, 151, 152, 153, 154, 155, 156, 157, 158, 159 ]
+ }
+ }
+ }
+ },
+ (16): {
+ [ 160, 161, 162, 163 ],
+ [ -160, -159, -158, -157, -156, -155 ],
+ [ 160, 161, 162, 163,
+ 161.1, 162.1, 163.1, 164.1 ],
+ {
+ 16,
+ [ "This is a test string." ],
+ [ "String test", "String test", "String test", "String test" ]
+ },
+ {
+ 16,
+ {
+ [ 160, 161, 162, 163, 164 ],
+ [ -160, -159, -158, -157, -156 ],
+ [ 160, 161, 162, 163, 164 ],
+ [ -160, -159, -158, -157, -156 ]
+ },
+ {
+ [ "1234567890" ],
+ [ "STRING ARRAY", "STRING ARRAY", "STRING ARRAY", "STRING ARRAY" ],
+ {
+ [ 160, 161, 162, 163, 164, 165, 166, 167, 168, 169 ],
+ [ -160, -159, -158, -157, -156, -155, -154, -153, -152, -151 ],
+ [ 160, 161, 162, 163, 164, 165, 166, 167, 168, 169 ],
+ [ 160, 161, 162, 163, 164, 165, 166, 167, 168, 169 ],
+ [ 160, 161, 162, 163, 164, 165, 166, 167, 168, 169 ]
+ }
+ }
+ }
+ },
+ (17): {
+ [ 170, 171, 172, 173 ],
+ [ -170, -169, -168, -167, -166, -165 ],
+ [ 170, 171, 172, 173,
+ 171.1, 172.1, 173.1, 174.1 ],
+ {
+ 17,
+ [ "This is a test string." ],
+ [ "String test", "String test", "String test", "String test" ]
+ },
+ {
+ 17,
+ {
+ [ 170, 171, 172, 173, 174 ],
+ [ -170, -169, -168, -167, -166 ],
+ [ 170, 171, 172, 173, 174 ],
+ [ -170, -169, -168, -167, -166 ]
+ },
+ {
+ [ "1234567890" ],
+ [ "STRING ARRAY", "STRING ARRAY", "STRING ARRAY", "STRING ARRAY" ],
+ {
+ [ 170, 171, 172, 173, 174, 175, 176, 177, 178, 179 ],
+ [ -170, -169, -168, -167, -166, -165, -164, -163, -162, -161 ],
+ [ 170, 171, 172, 173, 174, 175, 176, 177, 178, 179 ],
+ [ 170, 171, 172, 173, 174, 175, 176, 177, 178, 179 ],
+ [ 170, 171, 172, 173, 174, 175, 176, 177, 178, 179 ]
+ }
+ }
+ }
+ },
+ (18): {
+ [ 180, 181, 182, 183 ],
+ [ -180, -179, -178, -177, -176, -175 ],
+ [ 180, 181, 182, 183,
+ 181.1, 182.1, 183.1, 184.1 ],
+ {
+ 18,
+ [ "This is a test string." ],
+ [ "String test", "String test", "String test", "String test" ]
+ },
+ {
+ 18,
+ {
+ [ 180, 181, 182, 183, 184 ],
+ [ -180, -179, -178, -177, -176 ],
+ [ 180, 181, 182, 183, 184 ],
+ [ -180, -179, -178, -177, -176 ]
+ },
+ {
+ [ "1234567890" ],
+ [ "STRING ARRAY", "STRING ARRAY", "STRING ARRAY", "STRING ARRAY" ],
+ {
+ [ 180, 181, 182, 183, 184, 185, 186, 187, 188, 189 ],
+ [ -180, -179, -178, -177, -176, -175, -174, -173, -172, -171 ],
+ [ 180, 181, 182, 183, 184, 185, 186, 187, 188, 189 ],
+ [ 180, 181, 182, 183, 184, 185, 186, 187, 188, 189 ],
+ [ 180, 181, 182, 183, 184, 185, 186, 187, 188, 189 ]
+ }
+ }
+ }
+ },
+ (19): {
+ [ 190, 191, 192, 193 ],
+ [ -190, -189, -188, -187, -186, -185 ],
+ [ 190, 191, 192, 193,
+ 191.1, 192.1, 193.1, 194.1 ],
+ {
+ 19,
+ [ "This is a test string." ],
+ [ "String test", "String test", "String test", "String test" ]
+ },
+ {
+ 19,
+ {
+ [ 190, 191, 192, 193, 194 ],
+ [ -190, -189, -188, -187, -186 ],
+ [ 190, 191, 192, 193, 194 ],
+ [ -190, -189, -188, -187, -186 ]
+ },
+ {
+ [ "1234567890" ],
+ [ "STRING ARRAY", "STRING ARRAY", "STRING ARRAY", "STRING ARRAY" ],
+ {
+ [ 190, 191, 192, 193, 194, 195, 196, 197, 198, 199 ],
+ [ -190, -189, -188, -187, -186, -185, -184, -183, -182, -181 ],
+ [ 190, 191, 192, 193, 194, 195, 196, 197, 198, 199 ],
+ [ 190, 191, 192, 193, 194, 195, 196, 197, 198, 199 ],
+ [ 190, 191, 192, 193, 194, 195, 196, 197, 198, 199 ]
+ }
+ }
+ }
+ },
+ (20): {
+ [ 200, 201, 202, 203 ],
+ [ -200, -199, -198, -197, -196, -195 ],
+ [ 200, 201, 202, 203,
+ 201.1, 202.1, 203.1, 204.1 ],
+ {
+ 20,
+ [ "This is a test string." ],
+ [ "String test", "String test", "String test", "String test" ]
+ },
+ {
+ 20,
+ {
+ [ 200, 201, 202, 203, 204 ],
+ [ -200, -199, -198, -197, -196 ],
+ [ 200, 201, 202, 203, 204 ],
+ [ -200, -199, -198, -197, -196 ]
+ },
+ {
+ [ "1234567890" ],
+ [ "STRING ARRAY", "STRING ARRAY", "STRING ARRAY", "STRING ARRAY" ],
+ {
+ [ 200, 201, 202, 203, 204, 205, 206, 207, 208, 209 ],
+ [ -200, -199, -198, -197, -196, -195, -194, -193, -192, -191 ],
+ [ 200, 201, 202, 203, 204, 205, 206, 207, 208, 209 ],
+ [ 200, 201, 202, 203, 204, 205, 206, 207, 208, 209 ],
+ [ 200, 201, 202, 203, 204, 205, 206, 207, 208, 209 ]
+ }
+ }
+ }
+ },
+ (21): {
+ [ 210, 211, 212, 213 ],
+ [ -210, -209, -208, -207, -206, -205 ],
+ [ 210, 211, 212, 213,
+ 211.1, 212.1, 213.1, 214.1 ],
+ {
+ 21,
+ [ "This is a test string." ],
+ [ "String test", "String test", "String test", "String test" ]
+ },
+ {
+ 21,
+ {
+ [ 210, 211, 212, 213, 214 ],
+ [ -210, -209, -208, -207, -206 ],
+ [ 210, 211, 212, 213, 214 ],
+ [ -210, -209, -208, -207, -206 ]
+ },
+ {
+ [ "1234567890" ],
+ [ "STRING ARRAY", "STRING ARRAY", "STRING ARRAY", "STRING ARRAY" ],
+ {
+ [ 210, 211, 212, 213, 214, 215, 216, 217, 218, 219 ],
+ [ -210, -209, -208, -207, -206, -205, -204, -203, -202, -201 ],
+ [ 210, 211, 212, 213, 214, 215, 216, 217, 218, 219 ],
+ [ 210, 211, 212, 213, 214, 215, 216, 217, 218, 219 ],
+ [ 210, 211, 212, 213, 214, 215, 216, 217, 218, 219 ]
+ }
+ }
+ }
+ },
+ (22): {
+ [ 220, 221, 222, 223 ],
+ [ -220, -219, -218, -217, -216, -215 ],
+ [ 220, 221, 222, 223,
+ 221.1, 222.1, 223.1, 224.1 ],
+ {
+ 22,
+ [ "This is a test string." ],
+ [ "String test", "String test", "String test", "String test" ]
+ },
+ {
+ 22,
+ {
+ [ 220, 221, 222, 223, 224 ],
+ [ -220, -219, -218, -217, -216 ],
+ [ 220, 221, 222, 223, 224 ],
+ [ -220, -219, -218, -217, -216 ]
+ },
+ {
+ [ "1234567890" ],
+ [ "STRING ARRAY", "STRING ARRAY", "STRING ARRAY", "STRING ARRAY" ],
+ {
+ [ 220, 221, 222, 223, 224, 225, 226, 227, 228, 229 ],
+ [ -220, -219, -218, -217, -216, -215, -214, -213, -212, -211 ],
+ [ 220, 221, 222, 223, 224, 225, 226, 227, 228, 229 ],
+ [ 220, 221, 222, 223, 224, 225, 226, 227, 228, 229 ],
+ [ 220, 221, 222, 223, 224, 225, 226, 227, 228, 229 ]
+ }
+ }
+ }
+ },
+ (23): {
+ [ 230, 231, 232, 233 ],
+ [ -230, -229, -228, -227, -226, -225 ],
+ [ 230, 231, 232, 233,
+ 231.1, 232.1, 233.1, 234.1 ],
+ {
+ 23,
+ [ "This is a test string." ],
+ [ "String test", "String test", "String test", "String test" ]
+ },
+ {
+ 23,
+ {
+ [ 230, 231, 232, 233, 234 ],
+ [ -230, -229, -228, -227, -226 ],
+ [ 230, 231, 232, 233, 234 ],
+ [ -230, -229, -228, -227, -226 ]
+ },
+ {
+ [ "1234567890" ],
+ [ "STRING ARRAY", "STRING ARRAY", "STRING ARRAY", "STRING ARRAY" ],
+ {
+ [ 230, 231, 232, 233, 234, 235, 236, 237, 238, 239 ],
+ [ -230, -229, -228, -227, -226, -225, -224, -223, -222, -221 ],
+ [ 230, 231, 232, 233, 234, 235, 236, 237, 238, 239 ],
+ [ 230, 231, 232, 233, 234, 235, 236, 237, 238, 239 ],
+ [ 230, 231, 232, 233, 234, 235, 236, 237, 238, 239 ]
+ }
+ }
+ }
+ },
+ (24): {
+ [ 240, 241, 242, 243 ],
+ [ -240, -239, -238, -237, -236, -235 ],
+ [ 240, 241, 242, 243,
+ 241.1, 242.1, 243.1, 244.1 ],
+ {
+ 24,
+ [ "This is a test string." ],
+ [ "String test", "String test", "String test", "String test" ]
+ },
+ {
+ 24,
+ {
+ [ 240, 241, 242, 243, 244 ],
+ [ -240, -239, -238, -237, -236 ],
+ [ 240, 241, 242, 243, 244 ],
+ [ -240, -239, -238, -237, -236 ]
+ },
+ {
+ [ "1234567890" ],
+ [ "STRING ARRAY", "STRING ARRAY", "STRING ARRAY", "STRING ARRAY" ],
+ {
+ [ 240, 241, 242, 243, 244, 245, 246, 247, 248, 249 ],
+ [ -240, -239, -238, -237, -236, -235, -234, -233, -232, -231 ],
+ [ 240, 241, 242, 243, 244, 245, 246, 247, 248, 249 ],
+ [ 240, 241, 242, 243, 244, 245, 246, 247, 248, 249 ],
+ [ 240, 241, 242, 243, 244, 245, 246, 247, 248, 249 ]
+ }
+ }
+ }
+ },
+ (25): {
+ [ 250, 251, 252, 253 ],
+ [ -250, -249, -248, -247, -246, -245 ],
+ [ 250, 251, 252, 253,
+ 251.1, 252.1, 253.1, 254.1 ],
+ {
+ 25,
+ [ "This is a test string." ],
+ [ "String test", "String test", "String test", "String test" ]
+ },
+ {
+ 25,
+ {
+ [ 250, 251, 252, 253, 254 ],
+ [ -250, -249, -248, -247, -246 ],
+ [ 250, 251, 252, 253, 254 ],
+ [ -250, -249, -248, -247, -246 ]
+ },
+ {
+ [ "1234567890" ],
+ [ "STRING ARRAY", "STRING ARRAY", "STRING ARRAY", "STRING ARRAY" ],
+ {
+ [ 250, 251, 252, 253, 254, 255, 256, 257, 258, 259 ],
+ [ -250, -249, -248, -247, -246, -245, -244, -243, -242, -241 ],
+ [ 250, 251, 252, 253, 254, 255, 256, 257, 258, 259 ],
+ [ 250, 251, 252, 253, 254, 255, 256, 257, 258, 259 ],
+ [ 250, 251, 252, 253, 254, 255, 256, 257, 258, 259 ]
+ }
+ }
+ }
+ },
+ (26): {
+ [ 260, 261, 262, 263 ],
+ [ -260, -259, -258, -257, -256, -255 ],
+ [ 260, 261, 262, 263,
+ 261.1, 262.1, 263.1, 264.1 ],
+ {
+ 26,
+ [ "This is a test string." ],
+ [ "String test", "String test", "String test", "String test" ]
+ },
+ {
+ 26,
+ {
+ [ 260, 261, 262, 263, 264 ],
+ [ -260, -259, -258, -257, -256 ],
+ [ 260, 261, 262, 263, 264 ],
+ [ -260, -259, -258, -257, -256 ]
+ },
+ {
+ [ "1234567890" ],
+ [ "STRING ARRAY", "STRING ARRAY", "STRING ARRAY", "STRING ARRAY" ],
+ {
+ [ 260, 261, 262, 263, 264, 265, 266, 267, 268, 269 ],
+ [ -260, -259, -258, -257, -256, -255, -254, -253, -252, -251 ],
+ [ 260, 261, 262, 263, 264, 265, 266, 267, 268, 269 ],
+ [ 260, 261, 262, 263, 264, 265, 266, 267, 268, 269 ],
+ [ 260, 261, 262, 263, 264, 265, 266, 267, 268, 269 ]
+ }
+ }
+ }
+ },
+ (27): {
+ [ 270, 271, 272, 273 ],
+ [ -270, -269, -268, -267, -266, -265 ],
+ [ 270, 271, 272, 273,
+ 271.1, 272.1, 273.1, 274.1 ],
+ {
+ 27,
+ [ "This is a test string." ],
+ [ "String test", "String test", "String test", "String test" ]
+ },
+ {
+ 27,
+ {
+ [ 270, 271, 272, 273, 274 ],
+ [ -270, -269, -268, -267, -266 ],
+ [ 270, 271, 272, 273, 274 ],
+ [ -270, -269, -268, -267, -266 ]
+ },
+ {
+ [ "1234567890" ],
+ [ "STRING ARRAY", "STRING ARRAY", "STRING ARRAY", "STRING ARRAY" ],
+ {
+ [ 270, 271, 272, 273, 274, 275, 276, 277, 278, 279 ],
+ [ -270, -269, -268, -267, -266, -265, -264, -263, -262, -261 ],
+ [ 270, 271, 272, 273, 274, 275, 276, 277, 278, 279 ],
+ [ 270, 271, 272, 273, 274, 275, 276, 277, 278, 279 ],
+ [ 270, 271, 272, 273, 274, 275, 276, 277, 278, 279 ]
+ }
+ }
+ }
+ },
+ (28): {
+ [ 280, 281, 282, 283 ],
+ [ -280, -279, -278, -277, -276, -275 ],
+ [ 280, 281, 282, 283,
+ 281.1, 282.1, 283.1, 284.1 ],
+ {
+ 28,
+ [ "This is a test string." ],
+ [ "String test", "String test", "String test", "String test" ]
+ },
+ {
+ 28,
+ {
+ [ 280, 281, 282, 283, 284 ],
+ [ -280, -279, -278, -277, -276 ],
+ [ 280, 281, 282, 283, 284 ],
+ [ -280, -279, -278, -277, -276 ]
+ },
+ {
+ [ "1234567890" ],
+ [ "STRING ARRAY", "STRING ARRAY", "STRING ARRAY", "STRING ARRAY" ],
+ {
+ [ 280, 281, 282, 283, 284, 285, 286, 287, 288, 289 ],
+ [ -280, -279, -278, -277, -276, -275, -274, -273, -272, -271 ],
+ [ 280, 281, 282, 283, 284, 285, 286, 287, 288, 289 ],
+ [ 280, 281, 282, 283, 284, 285, 286, 287, 288, 289 ],
+ [ 280, 281, 282, 283, 284, 285, 286, 287, 288, 289 ]
+ }
+ }
+ }
+ },
+ (29): {
+ [ 290, 291, 292, 293 ],
+ [ -290, -289, -288, -287, -286, -285 ],
+ [ 290, 291, 292, 293,
+ 291.1, 292.1, 293.1, 294.1 ],
+ {
+ 29,
+ [ "This is a test string." ],
+ [ "String test", "String test", "String test", "String test" ]
+ },
+ {
+ 29,
+ {
+ [ 290, 291, 292, 293, 294 ],
+ [ -290, -289, -288, -287, -286 ],
+ [ 290, 291, 292, 293, 294 ],
+ [ -290, -289, -288, -287, -286 ]
+ },
+ {
+ [ "1234567890" ],
+ [ "STRING ARRAY", "STRING ARRAY", "STRING ARRAY", "STRING ARRAY" ],
+ {
+ [ 290, 291, 292, 293, 294, 295, 296, 297, 298, 299 ],
+ [ -290, -289, -288, -287, -286, -285, -284, -283, -282, -281 ],
+ [ 290, 291, 292, 293, 294, 295, 296, 297, 298, 299 ],
+ [ 290, 291, 292, 293, 294, 295, 296, 297, 298, 299 ],
+ [ 290, 291, 292, 293, 294, 295, 296, 297, 298, 299 ]
+ }
+ }
+ }
+ },
+ (30): {
+ [ 300, 301, 302, 303 ],
+ [ -300, -299, -298, -297, -296, -295 ],
+ [ 300, 301, 302, 303,
+ 301.1, 302.1, 303.1, 304.1 ],
+ {
+ 30,
+ [ "This is a test string." ],
+ [ "String test", "String test", "String test", "String test" ]
+ },
+ {
+ 30,
+ {
+ [ 300, 301, 302, 303, 304 ],
+ [ -300, -299, -298, -297, -296 ],
+ [ 300, 301, 302, 303, 304 ],
+ [ -300, -299, -298, -297, -296 ]
+ },
+ {
+ [ "1234567890" ],
+ [ "STRING ARRAY", "STRING ARRAY", "STRING ARRAY", "STRING ARRAY" ],
+ {
+ [ 300, 301, 302, 303, 304, 305, 306, 307, 308, 309 ],
+ [ -300, -299, -298, -297, -296, -295, -294, -293, -292, -291 ],
+ [ 300, 301, 302, 303, 304, 305, 306, 307, 308, 309 ],
+ [ 300, 301, 302, 303, 304, 305, 306, 307, 308, 309 ],
+ [ 300, 301, 302, 303, 304, 305, 306, 307, 308, 309 ]
+ }
+ }
+ }
+ },
+ (31): {
+ [ 310, 311, 312, 313 ],
+ [ -310, -309, -308, -307, -306, -305 ],
+ [ 310, 311, 312, 313,
+ 311.1, 312.1, 313.1, 314.1 ],
+ {
+ 31,
+ [ "This is a test string." ],
+ [ "String test", "String test", "String test", "String test" ]
+ },
+ {
+ 31,
+ {
+ [ 310, 311, 312, 313, 314 ],
+ [ -310, -309, -308, -307, -306 ],
+ [ 310, 311, 312, 313, 314 ],
+ [ -310, -309, -308, -307, -306 ]
+ },
+ {
+ [ "1234567890" ],
+ [ "STRING ARRAY", "STRING ARRAY", "STRING ARRAY", "STRING ARRAY" ],
+ {
+ [ 310, 311, 312, 313, 314, 315, 316, 317, 318, 319 ],
+ [ -310, -309, -308, -307, -306, -305, -304, -303, -302, -301 ],
+ [ 310, 311, 312, 313, 314, 315, 316, 317, 318, 319 ],
+ [ 310, 311, 312, 313, 314, 315, 316, 317, 318, 319 ],
+ [ 310, 311, 312, 313, 314, 315, 316, 317, 318, 319 ]
+ }
+ }
+ }
+ }
+ }
+ }
+}
+}
diff --git a/tools/testfiles/tcompound_complex2.h5 b/tools/testfiles/tcompound_complex2.h5
new file mode 100644
index 0000000..eee6073
--- /dev/null
+++ b/tools/testfiles/tcompound_complex2.h5
Binary files differ
diff --git a/tools/testfiles/textlinksrc-nodangle-1.ls b/tools/testfiles/textlinksrc-nodangle-1.ls
index 9c19957..6d1da9e 100644
--- a/tools/testfiles/textlinksrc-nodangle-1.ls
+++ b/tools/testfiles/textlinksrc-nodangle-1.ls
@@ -1,5 +1,3 @@
-Error: --no-dangling-links must be used along with --follow-symlinks option!
-
usage: h5ls [OPTIONS] file[/OBJECT] [file[/[OBJECT]...]
OPTIONS
-h, -?, --help Print a usage message and exit
@@ -58,3 +56,5 @@ usage: h5ls [OPTIONS] file[/OBJECT] [file[/[OBJECT]...]
Replaced by --follow-symlinks.
-e, --errors Show all HDF5 error reporting
Replaced by --enable-error-stack.
+Error: --no-dangling-links must be used along with --follow-symlinks option!
+
diff --git a/tools/testfiles/tgroup-1.ls b/tools/testfiles/tgroup-1.ls
index 893c9ce..069d43e 100644
--- a/tools/testfiles/tgroup-1.ls
+++ b/tools/testfiles/tgroup-1.ls
@@ -1,5 +1,3 @@
-Error: 'recursive' option not compatible with 'group info' option!
-
usage: h5ls [OPTIONS] file[/OBJECT] [file[/[OBJECT]...]
OPTIONS
-h, -?, --help Print a usage message and exit
@@ -58,3 +56,5 @@ usage: h5ls [OPTIONS] file[/OBJECT] [file[/[OBJECT]...]
Replaced by --follow-symlinks.
-e, --errors Show all HDF5 error reporting
Replaced by --enable-error-stack.
+Error: 'recursive' option not compatible with 'group info' option!
+
diff --git a/tools/testfiles/tvlenstr_array.ddl b/tools/testfiles/tvlenstr_array.ddl
new file mode 100644
index 0000000..87efbb6
--- /dev/null
+++ b/tools/testfiles/tvlenstr_array.ddl
@@ -0,0 +1,48 @@
+HDF5 "tvlenstr_array.h5" {
+GROUP "/" {
+ DATASET "CompoundArrayOfVlenStr" {
+ DATATYPE H5T_COMPOUND {
+ H5T_ARRAY { [3] H5T_STRING {
+ STRSIZE H5T_VARIABLE;
+ STRPAD H5T_STR_NULLTERM;
+ CSET H5T_CSET_ASCII;
+ CTYPE H5T_C_S1;
+ } } "vlen_str_array";
+ }
+ DATASPACE SIMPLE { ( 5 ) / ( 5 ) }
+ DATA {
+ (0): {
+ [ "This is a variable-length test string.", "This test string is also variable-length.", "A final test of variable-length strings. This string is longer than the others." ]
+ },
+ (1): {
+ [ "This is a variable-length test string.", "This test string is also variable-length.", "A final test of variable-length strings. This string is longer than the others." ]
+ },
+ (2): {
+ [ "This is a variable-length test string.", "This test string is also variable-length.", "A final test of variable-length strings. This string is longer than the others." ]
+ },
+ (3): {
+ [ "This is a variable-length test string.", "This test string is also variable-length.", "A final test of variable-length strings. This string is longer than the others." ]
+ },
+ (4): {
+ [ "This is a variable-length test string.", "This test string is also variable-length.", "A final test of variable-length strings. This string is longer than the others." ]
+ }
+ }
+ }
+ DATASET "ScalarArrayOfVlenStr" {
+ DATATYPE H5T_ARRAY { [3] H5T_STRING {
+ STRSIZE H5T_VARIABLE;
+ STRPAD H5T_STR_NULLTERM;
+ CSET H5T_CSET_ASCII;
+ CTYPE H5T_C_S1;
+ } }
+ DATASPACE SIMPLE { ( 5 ) / ( 5 ) }
+ DATA {
+ (0): [ "This is a variable-length test string.", "This test string is also variable-length.", "A final test of variable-length strings. This string is longer than the others." ],
+ (1): [ "This is a variable-length test string.", "This test string is also variable-length.", "A final test of variable-length strings. This string is longer than the others." ],
+ (2): [ "This is a variable-length test string.", "This test string is also variable-length.", "A final test of variable-length strings. This string is longer than the others." ],
+ (3): [ "This is a variable-length test string.", "This test string is also variable-length.", "A final test of variable-length strings. This string is longer than the others." ],
+ (4): [ "This is a variable-length test string.", "This test string is also variable-length.", "A final test of variable-length strings. This string is longer than the others." ]
+ }
+ }
+}
+}
diff --git a/tools/testfiles/tvlenstr_array.h5 b/tools/testfiles/tvlenstr_array.h5
new file mode 100644
index 0000000..4277f20
--- /dev/null
+++ b/tools/testfiles/tvlenstr_array.h5
Binary files differ