From 498a6de93576a2d386d3b5ba1818355dce7ae8a4 Mon Sep 17 00:00:00 2001 From: Allen Byrne <50328838+byrnHDF@users.noreply.github.com> Date: Mon, 1 Mar 2021 14:07:44 -0600 Subject: 1 12 merge java copyright header changes (#391) * OESS-98 fix tools test for plugins * sync fork * Merge of changes from dev * Move problem option to bottom of the list until fixed * HDFFV-11106 - fix parsing optional args * HDFFV-11106 add note * grammer fix * Whitespace after clang formatting * Undo format version 11 changes * Update check to working version * Merge workflow and minor changes from develop * Update supported platforms * PR#3 merge from develop * Merge gcc 10 diagnostics option from develop * Merge #318 OSX changes from develop * Merge serval small changes from dev * fix typo * Minor non-space formatting changes * GH #386 copyright corrections for java folder * revert because logic requires false return --- MANIFEST | 3 + configure.ac | 47 +- java/Makefile.am | 1 - java/examples/Makefile.am | 1 - java/examples/datasets/H5Ex_D_Alloc.java | 11 +- java/examples/datasets/H5Ex_D_Checksum.java | 15 +- java/examples/datasets/H5Ex_D_Chunk.java | 17 +- java/examples/datasets/H5Ex_D_Compact.java | 17 +- java/examples/datasets/H5Ex_D_External.java | 15 +- java/examples/datasets/H5Ex_D_FillValue.java | 9 +- java/examples/datasets/H5Ex_D_Gzip.java | 15 +- java/examples/datasets/H5Ex_D_Hyperslab.java | 15 +- java/examples/datasets/H5Ex_D_Nbit.java | 17 +- java/examples/datasets/H5Ex_D_ReadWrite.java | 11 +- java/examples/datasets/H5Ex_D_Shuffle.java | 15 +- java/examples/datasets/H5Ex_D_Sofloat.java | 15 +- java/examples/datasets/H5Ex_D_Soint.java | 15 +- java/examples/datasets/H5Ex_D_Szip.java | 15 +- java/examples/datasets/H5Ex_D_Transform.java | 15 +- java/examples/datasets/H5Ex_D_UnlimitedAdd.java | 21 +- java/examples/datasets/H5Ex_D_UnlimitedGzip.java | 23 +- java/examples/datasets/H5Ex_D_UnlimitedMod.java | 21 +- java/examples/datasets/JavaDatasetExample.sh.in | 1 - java/examples/datasets/Makefile.am | 1 - java/examples/datatypes/H5Ex_T_Array.java | 19 +- java/examples/datatypes/H5Ex_T_ArrayAttribute.java | 25 +- java/examples/datatypes/H5Ex_T_Bit.java | 13 +- java/examples/datatypes/H5Ex_T_BitAttribute.java | 19 +- java/examples/datatypes/H5Ex_T_Commit.java | 13 +- java/examples/datatypes/H5Ex_T_Compound.java | 23 +- .../datatypes/H5Ex_T_CompoundAttribute.java | 29 +- java/examples/datatypes/H5Ex_T_Float.java | 13 +- java/examples/datatypes/H5Ex_T_FloatAttribute.java | 19 +- java/examples/datatypes/H5Ex_T_Integer.java | 13 +- .../datatypes/H5Ex_T_IntegerAttribute.java | 19 +- .../examples/datatypes/H5Ex_T_ObjectReference.java | 25 +- .../datatypes/H5Ex_T_ObjectReferenceAttribute.java | 29 +- java/examples/datatypes/H5Ex_T_Opaque.java | 19 +- .../examples/datatypes/H5Ex_T_OpaqueAttribute.java | 23 +- java/examples/datatypes/H5Ex_T_String.java | 21 +- .../examples/datatypes/H5Ex_T_StringAttribute.java | 27 +- java/examples/datatypes/H5Ex_T_VLString.java | 15 +- java/examples/datatypes/JavaDatatypeExample.sh.in | 1 - java/examples/datatypes/Makefile.am | 1 - java/examples/groups/H5Ex_G_Compact.java | 7 +- java/examples/groups/H5Ex_G_Corder.java | 9 +- java/examples/groups/H5Ex_G_Create.java | 5 +- java/examples/groups/H5Ex_G_Intermediate.java | 7 +- java/examples/groups/H5Ex_G_Iterate.java | 3 +- java/examples/groups/H5Ex_G_Phase.java | 11 +- java/examples/groups/H5Ex_G_Traverse.java | 3 +- java/examples/groups/H5Ex_G_Visit.java | 3 +- java/examples/groups/JavaGroupExample.sh.in | 1 - java/examples/groups/Makefile.am | 1 - java/examples/intro/H5_CreateAttribute.java | 9 +- java/examples/intro/H5_CreateDataset.java | 7 +- java/examples/intro/H5_CreateFile.java | 3 +- java/examples/intro/H5_CreateGroup.java | 5 +- .../intro/H5_CreateGroupAbsoluteRelative.java | 9 +- java/examples/intro/H5_CreateGroupDataset.java | 17 +- java/examples/intro/H5_ReadWrite.java | 7 +- java/examples/intro/JavaIntroExample.sh.in | 1 - java/examples/intro/Makefile.am | 1 - java/src/Makefile.am | 1 - java/src/hdf/hdf5lib/HDF5Constants.java | 5 + java/src/hdf/hdf5lib/HDF5GroupInfo.java | 9 +- java/src/hdf/hdf5lib/HDFArray.java | 513 ++++++-------- java/src/hdf/hdf5lib/callbacks/Callbacks.java | 1 - java/src/hdf/hdf5lib/callbacks/H5A_iterate_cb.java | 1 - java/src/hdf/hdf5lib/callbacks/H5A_iterate_t.java | 1 - java/src/hdf/hdf5lib/callbacks/H5D_append_cb.java | 1 - java/src/hdf/hdf5lib/callbacks/H5D_append_t.java | 1 - java/src/hdf/hdf5lib/callbacks/H5D_iterate_cb.java | 1 - java/src/hdf/hdf5lib/callbacks/H5D_iterate_t.java | 1 - java/src/hdf/hdf5lib/callbacks/H5E_walk_cb.java | 1 - java/src/hdf/hdf5lib/callbacks/H5E_walk_t.java | 1 - .../hdf5lib/callbacks/H5L_iterate_opdata_t.java | 1 - java/src/hdf/hdf5lib/callbacks/H5L_iterate_t.java | 1 - .../hdf5lib/callbacks/H5O_iterate_opdata_t.java | 1 - java/src/hdf/hdf5lib/callbacks/H5O_iterate_t.java | 1 - .../hdf5lib/callbacks/H5P_cls_close_func_cb.java | 1 - .../hdf5lib/callbacks/H5P_cls_close_func_t.java | 1 - .../hdf5lib/callbacks/H5P_cls_copy_func_cb.java | 1 - .../hdf/hdf5lib/callbacks/H5P_cls_copy_func_t.java | 1 - .../hdf5lib/callbacks/H5P_cls_create_func_cb.java | 1 - .../hdf5lib/callbacks/H5P_cls_create_func_t.java | 1 - java/src/hdf/hdf5lib/callbacks/H5P_iterate_cb.java | 1 - java/src/hdf/hdf5lib/callbacks/H5P_iterate_t.java | 1 - .../hdf5lib/callbacks/H5P_prp_close_func_cb.java | 1 - .../hdf5lib/callbacks/H5P_prp_compare_func_cb.java | 1 - .../hdf5lib/callbacks/H5P_prp_copy_func_cb.java | 1 - .../hdf5lib/callbacks/H5P_prp_create_func_cb.java | 1 - .../hdf5lib/callbacks/H5P_prp_delete_func_cb.java | 1 - .../hdf/hdf5lib/callbacks/H5P_prp_get_func_cb.java | 1 - .../hdf/hdf5lib/callbacks/H5P_prp_set_func_cb.java | 1 - .../hdf/hdf5lib/structs/H5AC_cache_config_t.java | 1 - java/src/hdf/hdf5lib/structs/H5A_info_t.java | 13 +- java/src/hdf/hdf5lib/structs/H5E_error2_t.java | 1 - java/src/hdf/hdf5lib/structs/H5F_info2_t.java | 1 - java/src/hdf/hdf5lib/structs/H5G_info_t.java | 1 - java/src/hdf/hdf5lib/structs/H5L_info_t.java | 1 - java/src/hdf/hdf5lib/structs/H5O_hdr_info_t.java | 1 - java/src/hdf/hdf5lib/structs/H5O_info_t.java | 1 - .../src/hdf/hdf5lib/structs/H5O_native_info_t.java | 1 - java/src/hdf/hdf5lib/structs/H5_ih_info_t.java | 1 - java/src/jni/Makefile.am | 1 - java/src/jni/exceptionImp.h | 1 - java/src/jni/h5Constants.c | 8 +- java/src/jni/h5Imp.h | 1 - java/src/jni/h5aImp.c | 4 +- java/src/jni/h5aImp.h | 1 - java/src/jni/h5dImp.c | 5 +- java/src/jni/h5dImp.h | 1 - java/src/jni/h5eImp.c | 1 - java/src/jni/h5eImp.h | 1 - java/src/jni/h5fImp.h | 1 - java/src/jni/h5gImp.h | 1 - java/src/jni/h5iImp.h | 1 - java/src/jni/h5jni.h | 1 - java/src/jni/h5lImp.c | 1 - java/src/jni/h5lImp.h | 1 - java/src/jni/h5oImp.c | 1 - java/src/jni/h5oImp.h | 1 - java/src/jni/h5pACPLImp.c | 1 - java/src/jni/h5pACPLImp.h | 1 - java/src/jni/h5pDAPLImp.c | 1 - java/src/jni/h5pDAPLImp.h | 1 - java/src/jni/h5pDCPLImp.c | 1 - java/src/jni/h5pDCPLImp.h | 1 - java/src/jni/h5pDXPLImp.c | 1 - java/src/jni/h5pDXPLImp.h | 1 - java/src/jni/h5pFAPLImp.c | 1 - java/src/jni/h5pFAPLImp.h | 1 - java/src/jni/h5pFCPLImp.c | 1 - java/src/jni/h5pFCPLImp.h | 1 - java/src/jni/h5pGAPLImp.c | 1 - java/src/jni/h5pGAPLImp.h | 1 - java/src/jni/h5pGCPLImp.c | 1 - java/src/jni/h5pGCPLImp.h | 1 - java/src/jni/h5pImp.h | 1 - java/src/jni/h5pLAPLImp.c | 1 - java/src/jni/h5pLAPLImp.h | 1 - java/src/jni/h5pLCPLImp.c | 1 - java/src/jni/h5pLCPLImp.h | 1 - java/src/jni/h5pOCPLImp.c | 1 - java/src/jni/h5pOCPLImp.h | 1 - java/src/jni/h5pOCpyPLImp.c | 1 - java/src/jni/h5pOCpyPLImp.h | 1 - java/src/jni/h5pStrCPLImp.c | 1 - java/src/jni/h5pStrCPLImp.h | 1 - java/src/jni/h5plImp.c | 1 - java/src/jni/h5plImp.h | 1 - java/src/jni/h5rImp.h | 1 - java/src/jni/h5sImp.h | 1 - java/src/jni/h5tImp.h | 1 - java/src/jni/h5util.c | 747 +++++++++++---------- java/src/jni/h5util.h | 6 +- java/src/jni/h5vlImp.c | 1 - java/src/jni/h5vlImp.h | 1 - java/src/jni/h5zImp.h | 1 - java/src/jni/nativeData.h | 1 - java/test/CMakeLists.txt | 5 + java/test/Makefile.am | 2 +- java/test/TestH5.java | 155 ++++- java/test/TestH5A.java | 115 ++-- java/test/TestH5D.java | 41 +- java/test/TestH5Dparams.java | 1 - java/test/TestH5Dplist.java | 9 +- java/test/TestH5E.java | 1 - java/test/TestH5Edefault.java | 85 ++- java/test/TestH5Eparams.java | 1 - java/test/TestH5Eregister.java | 1 - java/test/TestH5F.java | 19 +- java/test/TestH5Fbasic.java | 17 +- java/test/TestH5Fparams.java | 13 +- java/test/TestH5Fswmr.java | 13 +- java/test/TestH5G.java | 31 +- java/test/TestH5Gbasic.java | 17 +- java/test/TestH5Giterate.java | 7 +- java/test/TestH5Lbasic.java | 3 +- java/test/TestH5Lcreate.java | 19 +- java/test/TestH5Lparams.java | 1 - java/test/TestH5Obasic.java | 55 +- java/test/TestH5Ocopy.java | 41 +- java/test/TestH5Ocreate.java | 27 +- java/test/TestH5Oparams.java | 1 - java/test/TestH5P.java | 31 +- java/test/TestH5PData.java | 11 +- java/test/TestH5PL.java | 11 +- java/test/TestH5Pfapl.java | 29 +- java/test/TestH5Pfaplhdfs.java | 11 +- java/test/TestH5Pfapls3.java | 11 +- java/test/TestH5Plist.java | 33 +- java/test/TestH5Pvirtual.java | 27 +- java/test/TestH5R.java | 118 +--- java/test/TestH5Rref.java | 562 ++++++++++++++++ java/test/TestH5S.java | 21 +- java/test/TestH5Sbasic.java | 25 +- java/test/TestH5T.java | 23 +- java/test/TestH5Tbasic.java | 13 +- java/test/TestH5Tparams.java | 1 - java/test/TestH5VL.java | 53 +- java/test/TestH5Z.java | 1 - java/test/junit.sh.in | 29 +- java/test/testfiles/JUnit-TestH5.txt | 4 +- java/test/testfiles/JUnit-TestH5Rref.txt | 10 + test/use_common.c | 4 +- tools/lib/h5diff_array.c | 96 +-- tools/lib/h5tools.c | 2 +- tools/lib/h5tools_str.c | 2 +- tools/lib/h5tools_utils.c | 6 +- tools/src/h5diff/h5diff_common.c | 36 +- tools/src/h5import/h5import.c | 4 +- tools/src/h5ls/h5ls.c | 2 +- tools/src/h5repack/h5repack_copy.c | 8 +- tools/src/h5repack/h5repack_verify.c | 6 +- tools/src/misc/h5debug.c | 4 +- tools/src/misc/h5repart.c | 2 +- tools/test/h5diff/testfiles/h5diff_10.txt | 12 + tools/test/h5diff/testfiles/h5diff_600.txt | 12 + tools/test/h5diff/testfiles/h5diff_603.txt | 12 + tools/test/h5diff/testfiles/h5diff_606.txt | 12 + tools/test/h5diff/testfiles/h5diff_612.txt | 12 + tools/test/h5diff/testfiles/h5diff_615.txt | 12 + tools/test/h5diff/testfiles/h5diff_621.txt | 12 + tools/test/h5diff/testfiles/h5diff_622.txt | 12 + tools/test/h5diff/testfiles/h5diff_623.txt | 12 + tools/test/h5diff/testfiles/h5diff_624.txt | 12 + tools/test/h5dump/CMakeTests.cmake | 8 +- tools/test/h5dump/h5dumpgentest.c | 52 ++ tools/test/h5dump/testh5dump.sh.in | 6 +- tools/testfiles/tldouble.ddl | 11 + 232 files changed, 2455 insertions(+), 1828 deletions(-) create mode 100644 java/test/TestH5Rref.java create mode 100644 java/test/testfiles/JUnit-TestH5Rref.txt create mode 100644 tools/testfiles/tldouble.ddl diff --git a/MANIFEST b/MANIFEST index 7f9aca1..f907988 100644 --- a/MANIFEST +++ b/MANIFEST @@ -2007,6 +2007,7 @@ ./tools/testfiles/tintsnodata.h5 ./tools/testfiles/tlarge_objname.ddl ./tools/testfiles/tlarge_objname.h5 +./tools/testfiles/tldouble.ddl ./tools/testfiles/tldouble.h5 ./tools/testfiles/tlonglinks.ddl ./tools/testfiles/tlonglinks.h5 @@ -3416,6 +3417,7 @@ ./java/test/testfiles/JUnit-TestH5Pvirtual.txt ./java/test/testfiles/JUnit-TestH5PL.txt ./java/test/testfiles/JUnit-TestH5R.txt +./java/test/testfiles/JUnit-TestH5Rref.txt ./java/test/testfiles/JUnit-TestH5Sbasic.txt ./java/test/testfiles/JUnit-TestH5S.txt ./java/test/testfiles/JUnit-TestH5Tparams.txt @@ -3456,6 +3458,7 @@ ./java/test/TestH5Pvirtual.java ./java/test/TestH5PL.java ./java/test/TestH5R.java +./java/test/TestH5Rref.java ./java/test/TestH5Sbasic.java ./java/test/TestH5S.java ./java/test/TestH5Tparams.java diff --git a/configure.ac b/configure.ac index 56d4c2a..61a9e37 100644 --- a/configure.ac +++ b/configure.ac @@ -37,14 +37,42 @@ AC_CONFIG_MACRO_DIR([m4]) AM_INIT_AUTOMAKE([foreign subdir-objects]) m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])]) # use silent rules where available - automake 1.11 -## AM_MAINTAINER_MODE turns off "rebuild rules" that contain dependencies -## for Makefiles, configure, src/H5config.h, etc. If AM_MAINTAINER_MODE -## is enabled, these files will be rebuilt if out of date. This is a -## problem because if users try to build on a machine with -## the wrong versions of autoconf and automake, these files will be -## rebuilt with the wrong versions and bad things can happen. -## Also, CVS doesn't preserve dependencies between timestamps, so -## Makefiles will often think rebuilding needs to occur when it doesn't. +## AM_MAINTAINER_MODE determines the behavior of "rebuild rules" that contain +## dependencies for Makefile.in files, configure, src/H5config.h, etc. If +## AM_MAINTAINER_MODE is enabled, these files will be rebuilt if out of date. +## When disabled, the autotools build files can get out of sync and the build +## system will not complain or try to regenerate downstream files. +## +## The AM_MAINTAINER_MODE macro also determines whether the +## --(enable|disable)-maintainer-mode configure option is available. When the +## macro is present, with or without a parameter, the option will be added +## to the generated configure script. +## +## In summary: +## +## AM_MAINTAINER_MODE([enable]) +## - Build dependencies ON by default +## - Configure option exists +## +## AM_MAINTAINER_MODE([disable]) +## - Build dependencies OFF by default +## - Configure option exists +## +## AM_MAINTAINER_MODE +## - Build dependencies OFF by default +## - Configure option exists +## +## No AM_MAINTAINER_MODE macro +## - Build dependencies ON by default +## - No configure option to control build dependencies +## +## The biggest concern for us is that version control systems like git +## usually don't preserve dependencies between timestamps, so the build +## system will often think that upstream build files like Makefile.am are +## dirty and that rebuilding needs to occur when it doesn't. This is a problem +## in release branches where we provide the autotools-generated files. Users +## who don't have autoconf, automake, etc. will then have difficulty building +## release branches checked out from git. ## ## By default, it is enabled. Users can configure with ## --disable-maintainer-mode to prevent running the autotools. @@ -3264,6 +3292,9 @@ if test "x$HAVE_LIBHDFS" = "xyes"; then [Proceed to build with libhdfs]) fi +## Read-only HDFS files are not built if not required. +AM_CONDITIONAL([HDFS_VFD_CONDITIONAL], [test "X$HAVE_LIBHDFS" = "Xyes"]) + ## Checkpoint the cache AC_CACHE_SAVE diff --git a/java/Makefile.am b/java/Makefile.am index abc7f1d..1ca3248 100644 --- a/java/Makefile.am +++ b/java/Makefile.am @@ -1,6 +1,5 @@ # # 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 diff --git a/java/examples/Makefile.am b/java/examples/Makefile.am index c499bd5..eb7b7f5 100644 --- a/java/examples/Makefile.am +++ b/java/examples/Makefile.am @@ -1,6 +1,5 @@ # # 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 diff --git a/java/examples/datasets/H5Ex_D_Alloc.java b/java/examples/datasets/H5Ex_D_Alloc.java index dd7e7ae..4e10c23 100644 --- a/java/examples/datasets/H5Ex_D_Alloc.java +++ b/java/examples/datasets/H5Ex_D_Alloc.java @@ -1,6 +1,5 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * 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 * @@ -65,11 +64,11 @@ public class H5Ex_D_Alloc { } private static void allocation() { - long file_id = -1; - long filespace_id = -1; - long dataset_id1 = -1; - long dataset_id2 = -1; - long dcpl_id = -1; + long file_id = HDF5Constants.H5I_INVALID_HID; + long filespace_id = HDF5Constants.H5I_INVALID_HID; + long dataset_id1 = HDF5Constants.H5I_INVALID_HID; + long dataset_id2 = HDF5Constants.H5I_INVALID_HID; + long dcpl_id = HDF5Constants.H5I_INVALID_HID; long[] dims = { DIM_X, DIM_Y }; int[][] dset_data = new int[DIM_X][DIM_Y]; int space_status = 0; diff --git a/java/examples/datasets/H5Ex_D_Checksum.java b/java/examples/datasets/H5Ex_D_Checksum.java index 9dcfdb3..781dd68 100644 --- a/java/examples/datasets/H5Ex_D_Checksum.java +++ b/java/examples/datasets/H5Ex_D_Checksum.java @@ -1,6 +1,5 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * 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 * @@ -93,10 +92,10 @@ public class H5Ex_D_Checksum { } private static void writeChecksum() { - long file_id = -1; - long filespace_id = -1; - long dataset_id = -1; - long dcpl_id = -1; + long file_id = HDF5Constants.H5I_INVALID_HID; + long filespace_id = HDF5Constants.H5I_INVALID_HID; + long dataset_id = HDF5Constants.H5I_INVALID_HID; + long dcpl_id = HDF5Constants.H5I_INVALID_HID; long[] dims = { DIM_X, DIM_Y }; long[] chunk_dims = { CHUNK_X, CHUNK_Y }; int[][] dset_data = new int[DIM_X][DIM_Y]; @@ -193,9 +192,9 @@ public class H5Ex_D_Checksum { } private static void readChecksum() { - long file_id = -1; - long dataset_id = -1; - long dcpl_id = -1; + long file_id = HDF5Constants.H5I_INVALID_HID; + long dataset_id = HDF5Constants.H5I_INVALID_HID; + long dcpl_id = HDF5Constants.H5I_INVALID_HID; int[][] dset_data = new int[DIM_X][DIM_Y]; // Open an existing file. diff --git a/java/examples/datasets/H5Ex_D_Chunk.java b/java/examples/datasets/H5Ex_D_Chunk.java index 3afa53c..2ddf293 100644 --- a/java/examples/datasets/H5Ex_D_Chunk.java +++ b/java/examples/datasets/H5Ex_D_Chunk.java @@ -1,6 +1,5 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * 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 * @@ -66,10 +65,10 @@ public class H5Ex_D_Chunk { } private static void writeChunk() { - long file_id = -1; - long filespace_id = -1; - long dataset_id = -1; - long dcpl_id = -1; + long file_id = HDF5Constants.H5I_INVALID_HID; + long filespace_id = HDF5Constants.H5I_INVALID_HID; + long dataset_id = HDF5Constants.H5I_INVALID_HID; + long dcpl_id = HDF5Constants.H5I_INVALID_HID; long[] dims = { DIM_X, DIM_Y }; long[] chunk_dims = { CHUNK_X, CHUNK_Y }; int[][] dset_data = new int[DIM_X][DIM_Y]; @@ -201,10 +200,10 @@ public class H5Ex_D_Chunk { } private static void readChunk() { - long file_id = -1; - long filespace_id = -1; - long dataset_id = -1; - long dcpl_id = -1; + long file_id = HDF5Constants.H5I_INVALID_HID; + long filespace_id = HDF5Constants.H5I_INVALID_HID; + long dataset_id = HDF5Constants.H5I_INVALID_HID; + long dcpl_id = HDF5Constants.H5I_INVALID_HID; int[][] dset_data = new int[DIM_X][DIM_Y]; // Open an existing file. diff --git a/java/examples/datasets/H5Ex_D_Compact.java b/java/examples/datasets/H5Ex_D_Compact.java index 347c05c..0abf8da 100644 --- a/java/examples/datasets/H5Ex_D_Compact.java +++ b/java/examples/datasets/H5Ex_D_Compact.java @@ -1,6 +1,5 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * 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 * @@ -60,10 +59,10 @@ public class H5Ex_D_Compact { } private static void writeCompact() { - long file_id = -1; - long filespace_id = -1; - long dataset_id = -1; - long dcpl_id = -1; + long file_id = HDF5Constants.H5I_INVALID_HID; + long filespace_id = HDF5Constants.H5I_INVALID_HID; + long dataset_id = HDF5Constants.H5I_INVALID_HID; + long dcpl_id = HDF5Constants.H5I_INVALID_HID; long[] dims = { DIM_X, DIM_Y }; int[][] dset_data = new int[DIM_X][DIM_Y]; @@ -163,10 +162,10 @@ public class H5Ex_D_Compact { } private static void readCompact() { - long file_id = -1; - long filespace_id = -1; - long dataset_id = -1; - long dcpl_id = -1; + long file_id = HDF5Constants.H5I_INVALID_HID; + long filespace_id = HDF5Constants.H5I_INVALID_HID; + long dataset_id = HDF5Constants.H5I_INVALID_HID; + long dcpl_id = HDF5Constants.H5I_INVALID_HID; int[][] dset_data = new int[DIM_X][DIM_Y]; // Open file and dataset using the default properties. diff --git a/java/examples/datasets/H5Ex_D_External.java b/java/examples/datasets/H5Ex_D_External.java index 5cf03af..9c3787f 100644 --- a/java/examples/datasets/H5Ex_D_External.java +++ b/java/examples/datasets/H5Ex_D_External.java @@ -1,6 +1,5 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * 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 * @@ -34,10 +33,10 @@ public class H5Ex_D_External { private static final int NAME_BUF_SIZE = 32; private static void writeExternal() { - long file_id = -1; - long dcpl_id = -1; - long filespace_id = -1; - long dataset_id = -1; + long file_id = HDF5Constants.H5I_INVALID_HID; + long dcpl_id = HDF5Constants.H5I_INVALID_HID; + long filespace_id = HDF5Constants.H5I_INVALID_HID; + long dataset_id = HDF5Constants.H5I_INVALID_HID; long[] dims = { DIM_X, DIM_Y }; int[][] dset_data = new int[DIM_X][DIM_Y]; @@ -138,9 +137,9 @@ public class H5Ex_D_External { } private static void readExternal() { - long file_id = -1; - long dcpl_id = -1; - long dataset_id = -1; + long file_id = HDF5Constants.H5I_INVALID_HID; + long dcpl_id = HDF5Constants.H5I_INVALID_HID; + long dataset_id = HDF5Constants.H5I_INVALID_HID; int[][] dset_data = new int[DIM_X][DIM_Y]; String[] Xname = new String[1]; diff --git a/java/examples/datasets/H5Ex_D_FillValue.java b/java/examples/datasets/H5Ex_D_FillValue.java index a19c026..3526993 100644 --- a/java/examples/datasets/H5Ex_D_FillValue.java +++ b/java/examples/datasets/H5Ex_D_FillValue.java @@ -1,6 +1,5 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * 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 * @@ -40,10 +39,10 @@ public class H5Ex_D_FillValue { private static final int FILLVAL = 99; private static void fillValue() { - long file_id = -1; - long dcpl_id = -1; - long dataspace_id = -1; - long dataset_id = -1; + long file_id = HDF5Constants.H5I_INVALID_HID; + long dcpl_id = HDF5Constants.H5I_INVALID_HID; + long dataspace_id = HDF5Constants.H5I_INVALID_HID; + long dataset_id = HDF5Constants.H5I_INVALID_HID; long[] dims = { DIM_X, DIM_Y }; long[] extdims = { EDIM_X, EDIM_Y }; long[] chunk_dims = { CHUNK_X, CHUNK_Y }; diff --git a/java/examples/datasets/H5Ex_D_Gzip.java b/java/examples/datasets/H5Ex_D_Gzip.java index 67d15bb..404ff05 100644 --- a/java/examples/datasets/H5Ex_D_Gzip.java +++ b/java/examples/datasets/H5Ex_D_Gzip.java @@ -1,6 +1,5 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * 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 * @@ -95,10 +94,10 @@ public class H5Ex_D_Gzip { } private static void writeGzip() { - long file_id = -1; - long filespace_id = -1; - long dataset_id = -1; - long dcpl_id = -1; + long file_id = HDF5Constants.H5I_INVALID_HID; + long filespace_id = HDF5Constants.H5I_INVALID_HID; + long dataset_id = HDF5Constants.H5I_INVALID_HID; + long dcpl_id = HDF5Constants.H5I_INVALID_HID; long[] dims = { DIM_X, DIM_Y }; long[] chunk_dims = { CHUNK_X, CHUNK_Y }; int[][] dset_data = new int[DIM_X][DIM_Y]; @@ -196,9 +195,9 @@ public class H5Ex_D_Gzip { } private static void readGzip() { - long file_id = -1; - long dataset_id = -1; - long dcpl_id = -1; + long file_id = HDF5Constants.H5I_INVALID_HID; + long dataset_id = HDF5Constants.H5I_INVALID_HID; + long dcpl_id = HDF5Constants.H5I_INVALID_HID; int[][] dset_data = new int[DIM_X][DIM_Y]; // Open an existing file. diff --git a/java/examples/datasets/H5Ex_D_Hyperslab.java b/java/examples/datasets/H5Ex_D_Hyperslab.java index 57dfa6a..fa3473f 100644 --- a/java/examples/datasets/H5Ex_D_Hyperslab.java +++ b/java/examples/datasets/H5Ex_D_Hyperslab.java @@ -1,6 +1,5 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * 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 * @@ -34,9 +33,9 @@ public class H5Ex_D_Hyperslab { private static final int RANK = 2; private static void writeHyperslab() { - long file_id = -1; - long filespace_id = -1; - long dataset_id = -1; + long file_id = HDF5Constants.H5I_INVALID_HID; + long filespace_id = HDF5Constants.H5I_INVALID_HID; + long dataset_id = HDF5Constants.H5I_INVALID_HID; long[] dims = { DIM_X, DIM_Y }; int[][] dset_data = new int[DIM_X][DIM_Y]; @@ -142,10 +141,10 @@ public class H5Ex_D_Hyperslab { } private static void readHyperslab() { - long file_id = -1; - long filespace_id = -1; - long dataset_id = -1; - long dcpl_id = -1; + long file_id = HDF5Constants.H5I_INVALID_HID; + long filespace_id = HDF5Constants.H5I_INVALID_HID; + long dataset_id = HDF5Constants.H5I_INVALID_HID; + long dcpl_id = HDF5Constants.H5I_INVALID_HID; int[][] dset_data = new int[DIM_X][DIM_Y]; // Open an existing file. diff --git a/java/examples/datasets/H5Ex_D_Nbit.java b/java/examples/datasets/H5Ex_D_Nbit.java index d995a02..35d23a9 100644 --- a/java/examples/datasets/H5Ex_D_Nbit.java +++ b/java/examples/datasets/H5Ex_D_Nbit.java @@ -1,6 +1,5 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * 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 * @@ -96,11 +95,11 @@ public class H5Ex_D_Nbit { } private static void writeData() throws Exception { - long file_id = -1; - long filespace_id = -1; - long dataset_id = -1; - long dtype_id = -1; - long dcpl_id = -1; + long file_id = HDF5Constants.H5I_INVALID_HID; + long filespace_id = HDF5Constants.H5I_INVALID_HID; + long dataset_id = HDF5Constants.H5I_INVALID_HID; + long dtype_id = HDF5Constants.H5I_INVALID_HID; + long dcpl_id = HDF5Constants.H5I_INVALID_HID; long[] dims = { DIM_X, DIM_Y }; long[] chunk_dims = { CHUNK_X, CHUNK_Y }; int[][] dset_data = new int[DIM_X][DIM_Y]; @@ -157,9 +156,9 @@ public class H5Ex_D_Nbit { } private static void readData() throws Exception { - long file_id = -1; - long dataset_id = -1; - long dcpl_id = -1; + long file_id = HDF5Constants.H5I_INVALID_HID; + long dataset_id = HDF5Constants.H5I_INVALID_HID; + long dcpl_id = HDF5Constants.H5I_INVALID_HID; int[][] dset_data = new int[DIM_X][DIM_Y]; // Open an existing file. diff --git a/java/examples/datasets/H5Ex_D_ReadWrite.java b/java/examples/datasets/H5Ex_D_ReadWrite.java index 3f6e9ac..db930d3 100644 --- a/java/examples/datasets/H5Ex_D_ReadWrite.java +++ b/java/examples/datasets/H5Ex_D_ReadWrite.java @@ -1,6 +1,5 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * 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 * @@ -32,9 +31,9 @@ public class H5Ex_D_ReadWrite { private static final int RANK = 2; private static void WriteDataset() { - long file_id = -1; - long filespace_id = -1; - long dataset_id = -1; + long file_id = HDF5Constants.H5I_INVALID_HID; + long filespace_id = HDF5Constants.H5I_INVALID_HID; + long dataset_id = HDF5Constants.H5I_INVALID_HID; long[] dims = { DIM_X, DIM_Y }; int[][] dset_data = new int[DIM_X][DIM_Y]; @@ -109,8 +108,8 @@ public class H5Ex_D_ReadWrite { } private static void ReadDataset() { - long file_id = -1; - long dataset_id = -1; + long file_id = HDF5Constants.H5I_INVALID_HID; + long dataset_id = HDF5Constants.H5I_INVALID_HID; int[][] dset_data = new int[DIM_X][DIM_Y]; // Open file using the default properties. diff --git a/java/examples/datasets/H5Ex_D_Shuffle.java b/java/examples/datasets/H5Ex_D_Shuffle.java index 9677e75..1dd7c6a 100644 --- a/java/examples/datasets/H5Ex_D_Shuffle.java +++ b/java/examples/datasets/H5Ex_D_Shuffle.java @@ -1,6 +1,5 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * 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 * @@ -122,10 +121,10 @@ public class H5Ex_D_Shuffle { } private static void writeShuffle() { - long file_id = -1; - long filespace_id = -1; - long dataset_id = -1; - long dcpl_id = -1; + long file_id = HDF5Constants.H5I_INVALID_HID; + long filespace_id = HDF5Constants.H5I_INVALID_HID; + long dataset_id = HDF5Constants.H5I_INVALID_HID; + long dcpl_id = HDF5Constants.H5I_INVALID_HID; long[] dims = { DIM_X, DIM_Y }; long[] chunk_dims = { CHUNK_X, CHUNK_Y }; int[][] dset_data = new int[DIM_X][DIM_Y]; @@ -229,9 +228,9 @@ public class H5Ex_D_Shuffle { } private static void readShuffle() { - long file_id = -1; - long dataset_id = -1; - long dcpl_id = -1; + long file_id = HDF5Constants.H5I_INVALID_HID; + long dataset_id = HDF5Constants.H5I_INVALID_HID; + long dcpl_id = HDF5Constants.H5I_INVALID_HID; int[][] dset_data = new int[DIM_X][DIM_Y]; // Open an existing file. diff --git a/java/examples/datasets/H5Ex_D_Sofloat.java b/java/examples/datasets/H5Ex_D_Sofloat.java index 5818371..a42aba4 100644 --- a/java/examples/datasets/H5Ex_D_Sofloat.java +++ b/java/examples/datasets/H5Ex_D_Sofloat.java @@ -1,6 +1,5 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * 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 * @@ -96,10 +95,10 @@ public class H5Ex_D_Sofloat { } private static void writeData() { - long file_id = -1; - long filespace_id = -1; - long dataset_id = -1; - long dcpl_id = -1; + long file_id = HDF5Constants.H5I_INVALID_HID; + long filespace_id = HDF5Constants.H5I_INVALID_HID; + long dataset_id = HDF5Constants.H5I_INVALID_HID; + long dcpl_id = HDF5Constants.H5I_INVALID_HID; long[] dims = { DIM_X, DIM_Y }; long[] chunk_dims = { CHUNK_X, CHUNK_Y }; double[][] dset_data = new double[DIM_X][DIM_Y]; @@ -213,9 +212,9 @@ public class H5Ex_D_Sofloat { } private static void readData() { - long file_id = -1; - long dataset_id = -1; - long dcpl_id = -1; + long file_id = HDF5Constants.H5I_INVALID_HID; + long dataset_id = HDF5Constants.H5I_INVALID_HID; + long dcpl_id = HDF5Constants.H5I_INVALID_HID; double[][] dset_data = new double[DIM_X][DIM_Y]; // Open file using the default properties. diff --git a/java/examples/datasets/H5Ex_D_Soint.java b/java/examples/datasets/H5Ex_D_Soint.java index 3f5f170..dd7664f 100644 --- a/java/examples/datasets/H5Ex_D_Soint.java +++ b/java/examples/datasets/H5Ex_D_Soint.java @@ -1,6 +1,5 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * 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 * @@ -96,10 +95,10 @@ public class H5Ex_D_Soint { } private static void writeData() { - long file_id = -1; - long filespace_id = -1; - long dataset_id = -1; - long dcpl_id = -1; + long file_id = HDF5Constants.H5I_INVALID_HID; + long filespace_id = HDF5Constants.H5I_INVALID_HID; + long dataset_id = HDF5Constants.H5I_INVALID_HID; + long dcpl_id = HDF5Constants.H5I_INVALID_HID; long[] dims = { DIM_X, DIM_Y }; long[] chunk_dims = { CHUNK_X, CHUNK_Y }; int[][] dset_data = new int[DIM_X][DIM_Y]; @@ -195,9 +194,9 @@ public class H5Ex_D_Soint { } private static void readData() { - long file_id = -1; - long dataset_id = -1; - long dcpl_id = -1; + long file_id = HDF5Constants.H5I_INVALID_HID; + long dataset_id = HDF5Constants.H5I_INVALID_HID; + long dcpl_id = HDF5Constants.H5I_INVALID_HID; int[][] dset_data = new int[DIM_X][DIM_Y]; // Open file using the default properties. diff --git a/java/examples/datasets/H5Ex_D_Szip.java b/java/examples/datasets/H5Ex_D_Szip.java index 57ba873..3fdc712 100644 --- a/java/examples/datasets/H5Ex_D_Szip.java +++ b/java/examples/datasets/H5Ex_D_Szip.java @@ -1,6 +1,5 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * 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 * @@ -95,10 +94,10 @@ public class H5Ex_D_Szip { } private static void writeSzip() { - long file_id = -1; - long filespace_id = -1; - long dataset_id = -1; - long dcpl_id = -1; + long file_id = HDF5Constants.H5I_INVALID_HID; + long filespace_id = HDF5Constants.H5I_INVALID_HID; + long dataset_id = HDF5Constants.H5I_INVALID_HID; + long dcpl_id = HDF5Constants.H5I_INVALID_HID; long[] dims = { DIM_X, DIM_Y }; long[] chunk_dims = { CHUNK_X, CHUNK_Y }; int[][] dset_data = new int[DIM_X][DIM_Y]; @@ -196,9 +195,9 @@ public class H5Ex_D_Szip { } private static void readSzip() { - long file_id = -1; - long dataset_id = -1; - long dcpl_id = -1; + long file_id = HDF5Constants.H5I_INVALID_HID; + long dataset_id = HDF5Constants.H5I_INVALID_HID; + long dcpl_id = HDF5Constants.H5I_INVALID_HID; int[][] dset_data = new int[DIM_X][DIM_Y]; // Open an existing file. diff --git a/java/examples/datasets/H5Ex_D_Transform.java b/java/examples/datasets/H5Ex_D_Transform.java index 04bfa2e..069e80b 100644 --- a/java/examples/datasets/H5Ex_D_Transform.java +++ b/java/examples/datasets/H5Ex_D_Transform.java @@ -1,6 +1,5 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * 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 * @@ -36,10 +35,10 @@ public class H5Ex_D_Transform { private static String RTRANSFORM = "x-1"; private static void writeData() { - long file_id = -1; - long filespace_id = -1; - long dataset_id = -1; - long dxpl_id = -1; + long file_id = HDF5Constants.H5I_INVALID_HID; + long filespace_id = HDF5Constants.H5I_INVALID_HID; + long dataset_id = HDF5Constants.H5I_INVALID_HID; + long dxpl_id = HDF5Constants.H5I_INVALID_HID; long[] dims = { DIM_X, DIM_Y }; int[][] dset_data = new int[DIM_X][DIM_Y]; @@ -144,9 +143,9 @@ public class H5Ex_D_Transform { private static void readData() { - long file_id = -1; - long dataset_id = -1; - long dxpl_id = -1; + long file_id = HDF5Constants.H5I_INVALID_HID; + long dataset_id = HDF5Constants.H5I_INVALID_HID; + long dxpl_id = HDF5Constants.H5I_INVALID_HID; int[][] dset_data = new int[DIM_X][DIM_Y]; // Open an existing file using the default properties. diff --git a/java/examples/datasets/H5Ex_D_UnlimitedAdd.java b/java/examples/datasets/H5Ex_D_UnlimitedAdd.java index 925023a..c82b2d6 100644 --- a/java/examples/datasets/H5Ex_D_UnlimitedAdd.java +++ b/java/examples/datasets/H5Ex_D_UnlimitedAdd.java @@ -1,6 +1,5 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * 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 * @@ -39,10 +38,10 @@ public class H5Ex_D_UnlimitedAdd { private static final int NDIMS = 2; private static void writeUnlimited() { - long file_id = -1; - long dcpl_id = -1; - long dataspace_id = -1; - long dataset_id = -1; + long file_id = HDF5Constants.H5I_INVALID_HID; + long dcpl_id = HDF5Constants.H5I_INVALID_HID; + long dataspace_id = HDF5Constants.H5I_INVALID_HID; + long dataset_id = HDF5Constants.H5I_INVALID_HID; long[] dims = { DIM_X, DIM_Y }; long[] chunk_dims = { CHUNK_X, CHUNK_Y }; long[] maxdims = { HDF5Constants.H5S_UNLIMITED, HDF5Constants.H5S_UNLIMITED }; @@ -143,9 +142,9 @@ public class H5Ex_D_UnlimitedAdd { } private static void extendUnlimited() { - long file_id = -1; - long dataspace_id = -1; - long dataset_id = -1; + long file_id = HDF5Constants.H5I_INVALID_HID; + long dataspace_id = HDF5Constants.H5I_INVALID_HID; + long dataset_id = HDF5Constants.H5I_INVALID_HID; long[] dims = { DIM_X, DIM_Y }; long[] extdims = { EDIM_X, EDIM_Y }; long[] start = { 0, 0 }; @@ -293,9 +292,9 @@ public class H5Ex_D_UnlimitedAdd { } private static void readUnlimited() { - long file_id = -1; - long dataspace_id = -1; - long dataset_id = -1; + long file_id = HDF5Constants.H5I_INVALID_HID; + long dataspace_id = HDF5Constants.H5I_INVALID_HID; + long dataset_id = HDF5Constants.H5I_INVALID_HID; long[] dims = { DIM_X, DIM_Y }; int[][] dset_data; diff --git a/java/examples/datasets/H5Ex_D_UnlimitedGzip.java b/java/examples/datasets/H5Ex_D_UnlimitedGzip.java index 40ddc60..675b1ba 100644 --- a/java/examples/datasets/H5Ex_D_UnlimitedGzip.java +++ b/java/examples/datasets/H5Ex_D_UnlimitedGzip.java @@ -1,6 +1,5 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * 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 * @@ -99,10 +98,10 @@ public class H5Ex_D_UnlimitedGzip { } private static void writeUnlimited() { - long file_id = -1; - long dcpl_id = -1; - long dataspace_id = -1; - long dataset_id = -1; + long file_id = HDF5Constants.H5I_INVALID_HID; + long dcpl_id = HDF5Constants.H5I_INVALID_HID; + long dataspace_id = HDF5Constants.H5I_INVALID_HID; + long dataset_id = HDF5Constants.H5I_INVALID_HID; long[] dims = { DIM_X, DIM_Y }; long[] chunk_dims = { CHUNK_X, CHUNK_Y }; long[] maxdims = { HDF5Constants.H5S_UNLIMITED, HDF5Constants.H5S_UNLIMITED }; @@ -200,9 +199,9 @@ public class H5Ex_D_UnlimitedGzip { } private static void extendUnlimited() { - long file_id = -1; - long dataspace_id = -1; - long dataset_id = -1; + long file_id = HDF5Constants.H5I_INVALID_HID; + long dataspace_id = HDF5Constants.H5I_INVALID_HID; + long dataset_id = HDF5Constants.H5I_INVALID_HID; long[] dims = { DIM_X, DIM_Y }; long[] extdims = { EDIM_X, EDIM_Y }; long[] start = { 0, 0 }; @@ -350,10 +349,10 @@ public class H5Ex_D_UnlimitedGzip { } private static void readUnlimited() { - long file_id = -1; - long dataspace_id = -1; - long dataset_id = -1; - long dcpl_id = -1; + long file_id = HDF5Constants.H5I_INVALID_HID; + long dataspace_id = HDF5Constants.H5I_INVALID_HID; + long dataset_id = HDF5Constants.H5I_INVALID_HID; + long dcpl_id = HDF5Constants.H5I_INVALID_HID; long[] dims = { DIM_X, DIM_Y }; int[][] dset_data; diff --git a/java/examples/datasets/H5Ex_D_UnlimitedMod.java b/java/examples/datasets/H5Ex_D_UnlimitedMod.java index 0476bc1..273ac3e 100644 --- a/java/examples/datasets/H5Ex_D_UnlimitedMod.java +++ b/java/examples/datasets/H5Ex_D_UnlimitedMod.java @@ -1,6 +1,5 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * 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 * @@ -39,10 +38,10 @@ public class H5Ex_D_UnlimitedMod { private static final int NDIMS = 2; private static void writeUnlimited() { - long file_id = -1; - long dcpl_id = -1; - long dataspace_id = -1; - long dataset_id = -1; + long file_id = HDF5Constants.H5I_INVALID_HID; + long dcpl_id = HDF5Constants.H5I_INVALID_HID; + long dataspace_id = HDF5Constants.H5I_INVALID_HID; + long dataset_id = HDF5Constants.H5I_INVALID_HID; long[] dims = { DIM_X, DIM_Y }; long[] chunk_dims = { CHUNK_X, CHUNK_Y }; long[] maxdims = { HDF5Constants.H5S_UNLIMITED, HDF5Constants.H5S_UNLIMITED }; @@ -143,9 +142,9 @@ public class H5Ex_D_UnlimitedMod { } private static void extendUnlimited() { - long file_id = -1; - long dataspace_id = -1; - long dataset_id = -1; + long file_id = HDF5Constants.H5I_INVALID_HID; + long dataspace_id = HDF5Constants.H5I_INVALID_HID; + long dataset_id = HDF5Constants.H5I_INVALID_HID; long[] dims = { DIM_X, DIM_Y }; long[] extdims = { EDIM_X, EDIM_Y }; int[][] dset_data; @@ -279,9 +278,9 @@ public class H5Ex_D_UnlimitedMod { } private static void readUnlimited() { - long file_id = -1; - long dataspace_id = -1; - long dataset_id = -1; + long file_id = HDF5Constants.H5I_INVALID_HID; + long dataspace_id = HDF5Constants.H5I_INVALID_HID; + long dataset_id = HDF5Constants.H5I_INVALID_HID; long[] dims = { DIM_X, DIM_Y }; int[][] dset_data; diff --git a/java/examples/datasets/JavaDatasetExample.sh.in b/java/examples/datasets/JavaDatasetExample.sh.in index 4604a44..f29739a 100644 --- a/java/examples/datasets/JavaDatasetExample.sh.in +++ b/java/examples/datasets/JavaDatasetExample.sh.in @@ -1,7 +1,6 @@ #! /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 diff --git a/java/examples/datasets/Makefile.am b/java/examples/datasets/Makefile.am index 8357614..41a914b 100644 --- a/java/examples/datasets/Makefile.am +++ b/java/examples/datasets/Makefile.am @@ -1,6 +1,5 @@ # # 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 diff --git a/java/examples/datatypes/H5Ex_T_Array.java b/java/examples/datatypes/H5Ex_T_Array.java index 30eb360..3939b38 100644 --- a/java/examples/datatypes/H5Ex_T_Array.java +++ b/java/examples/datatypes/H5Ex_T_Array.java @@ -1,6 +1,5 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * 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 * @@ -34,11 +33,11 @@ public class H5Ex_T_Array { private static final int NDIMS = 2; private static void CreateDataset() { - long file_id = -1; - long filetype_id = -1; - long memtype_id = -1; - long dataspace_id = -1; - long dataset_id = -1; + long file_id = HDF5Constants.H5I_INVALID_HID; + long filetype_id = HDF5Constants.H5I_INVALID_HID; + long memtype_id = HDF5Constants.H5I_INVALID_HID; + long dataspace_id = HDF5Constants.H5I_INVALID_HID; + long dataset_id = HDF5Constants.H5I_INVALID_HID; long[] dims = { DIM0 }; long[] adims = { ADIM0, ADIM1 }; int[][][] dset_data = new int[DIM0][ADIM0][ADIM1]; @@ -152,10 +151,10 @@ public class H5Ex_T_Array { } private static void ReadDataset() { - long file_id = -1; - long filetype_id = -1; - long memtype_id = -1; - long dataset_id = -1; + long file_id = HDF5Constants.H5I_INVALID_HID; + long filetype_id = HDF5Constants.H5I_INVALID_HID; + long memtype_id = HDF5Constants.H5I_INVALID_HID; + long dataset_id = HDF5Constants.H5I_INVALID_HID; long[] dims = { DIM0 }; long[] adims = { ADIM0, ADIM1 }; int[][][] dset_data; diff --git a/java/examples/datatypes/H5Ex_T_ArrayAttribute.java b/java/examples/datatypes/H5Ex_T_ArrayAttribute.java index 26d7fb6..c4c4bc4 100644 --- a/java/examples/datatypes/H5Ex_T_ArrayAttribute.java +++ b/java/examples/datatypes/H5Ex_T_ArrayAttribute.java @@ -1,6 +1,5 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * 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 * @@ -35,12 +34,12 @@ public class H5Ex_T_ArrayAttribute { private static final int NDIMS = 2; private static void CreateDataset() { - long file_id = -1; - long filetype_id = -1; - long memtype_id = -1; - long dataspace_id = -1; - long dataset_id = -1; - long attribute_id = -1; + long file_id = HDF5Constants.H5I_INVALID_HID; + long filetype_id = HDF5Constants.H5I_INVALID_HID; + long memtype_id = HDF5Constants.H5I_INVALID_HID; + long dataspace_id = HDF5Constants.H5I_INVALID_HID; + long dataset_id = HDF5Constants.H5I_INVALID_HID; + long attribute_id = HDF5Constants.H5I_INVALID_HID; long[] dims = { DIM0 }; long[] adims = { ADIM0, ADIM1 }; int[][][] dset_data = new int[DIM0][ADIM0][ADIM1]; @@ -84,7 +83,7 @@ public class H5Ex_T_ArrayAttribute { dataset_id = H5.H5Dcreate(file_id, DATASETNAME, HDF5Constants.H5T_STD_I32LE, dataspace_id, HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT); H5.H5Sclose(dataspace_id); - dataspace_id = -1; + dataspace_id = HDF5Constants.H5I_INVALID_HID; } } catch (Exception e) { @@ -175,11 +174,11 @@ public class H5Ex_T_ArrayAttribute { } private static void ReadDataset() { - long file_id = -1; - long filetype_id = -1; - long memtype_id = -1; - long dataset_id = -1; - long attribute_id = -1; + long file_id = HDF5Constants.H5I_INVALID_HID; + long filetype_id = HDF5Constants.H5I_INVALID_HID; + long memtype_id = HDF5Constants.H5I_INVALID_HID; + long dataset_id = HDF5Constants.H5I_INVALID_HID; + long attribute_id = HDF5Constants.H5I_INVALID_HID; long[] dims = { DIM0 }; long[] adims = { ADIM0, ADIM1 }; int[][][] dset_data; diff --git a/java/examples/datatypes/H5Ex_T_Bit.java b/java/examples/datatypes/H5Ex_T_Bit.java index 30acda4..45d4e8a 100644 --- a/java/examples/datatypes/H5Ex_T_Bit.java +++ b/java/examples/datatypes/H5Ex_T_Bit.java @@ -1,6 +1,5 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * 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 * @@ -32,9 +31,9 @@ public class H5Ex_T_Bit { private static final int RANK = 2; private static void CreateDataset() { - long file_id = -1; - long dataspace_id = -1; - long dataset_id = -1; + long file_id = HDF5Constants.H5I_INVALID_HID; + long dataspace_id = HDF5Constants.H5I_INVALID_HID; + long dataset_id = HDF5Constants.H5I_INVALID_HID; long[] dims = { DIM0, DIM1 }; int[][] dset_data = new int[DIM0][DIM1]; @@ -116,9 +115,9 @@ public class H5Ex_T_Bit { } private static void ReadDataset() { - long file_id = -1; - long dataspace_id = -1; - long dataset_id = -1; + long file_id = HDF5Constants.H5I_INVALID_HID; + long dataspace_id = HDF5Constants.H5I_INVALID_HID; + long dataset_id = HDF5Constants.H5I_INVALID_HID; long[] dims = { DIM0, DIM1 }; int[][] dset_data; diff --git a/java/examples/datatypes/H5Ex_T_BitAttribute.java b/java/examples/datatypes/H5Ex_T_BitAttribute.java index 2059dd5..9b33ca5 100644 --- a/java/examples/datatypes/H5Ex_T_BitAttribute.java +++ b/java/examples/datatypes/H5Ex_T_BitAttribute.java @@ -1,6 +1,5 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * 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 * @@ -33,10 +32,10 @@ public class H5Ex_T_BitAttribute { private static final int RANK = 2; private static void CreateDataset() { - long file_id = -1; - long dataspace_id = -1; - long dataset_id = -1; - long attribute_id = -1; + long file_id = HDF5Constants.H5I_INVALID_HID; + long dataspace_id = HDF5Constants.H5I_INVALID_HID; + long dataset_id = HDF5Constants.H5I_INVALID_HID; + long attribute_id = HDF5Constants.H5I_INVALID_HID; long[] dims = { DIM0, DIM1 }; int[][] dset_data = new int[DIM0][DIM1]; @@ -66,7 +65,7 @@ public class H5Ex_T_BitAttribute { dataset_id = H5.H5Dcreate(file_id, DATASETNAME, HDF5Constants.H5T_STD_I32LE, dataspace_id, HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT); H5.H5Sclose(dataspace_id); - dataspace_id = -1; + dataspace_id = HDF5Constants.H5I_INVALID_HID; } } catch (Exception e) { @@ -139,10 +138,10 @@ public class H5Ex_T_BitAttribute { } private static void ReadDataset() { - long file_id = -1; - long dataspace_id = -1; - long dataset_id = -1; - long attribute_id = -1; + long file_id = HDF5Constants.H5I_INVALID_HID; + long dataspace_id = HDF5Constants.H5I_INVALID_HID; + long dataset_id = HDF5Constants.H5I_INVALID_HID; + long attribute_id = HDF5Constants.H5I_INVALID_HID; long[] dims = { DIM0, DIM1 }; int[][] dset_data; diff --git a/java/examples/datatypes/H5Ex_T_Commit.java b/java/examples/datatypes/H5Ex_T_Commit.java index 35caa6b..62db5ea 100644 --- a/java/examples/datatypes/H5Ex_T_Commit.java +++ b/java/examples/datatypes/H5Ex_T_Commit.java @@ -1,6 +1,5 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * 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 * @@ -101,9 +100,9 @@ public class H5Ex_T_Commit { } private static void CreateDataType() { - long file_id = -1; - long strtype_id = -1; - long filetype_id = -1; + long file_id = HDF5Constants.H5I_INVALID_HID; + long strtype_id = HDF5Constants.H5I_INVALID_HID; + long filetype_id = HDF5Constants.H5I_INVALID_HID; Sensor_Datatype datatypes = new Sensor_Datatype(); // Create a new file using default properties. try { @@ -183,9 +182,9 @@ public class H5Ex_T_Commit { } private static void ReadDataType() { - long file_id = -1; - long typeclass_id = -1; - long filetype_id = -1; + long file_id = HDF5Constants.H5I_INVALID_HID; + long typeclass_id = HDF5Constants.H5I_INVALID_HID; + long filetype_id = HDF5Constants.H5I_INVALID_HID; // Open an existing file. try { diff --git a/java/examples/datatypes/H5Ex_T_Compound.java b/java/examples/datatypes/H5Ex_T_Compound.java index 61e79c7..8c83ebb 100644 --- a/java/examples/datatypes/H5Ex_T_Compound.java +++ b/java/examples/datatypes/H5Ex_T_Compound.java @@ -1,6 +1,5 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * 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 * @@ -122,12 +121,12 @@ public class H5Ex_T_Compound { } private static void CreateDataset() { - long file_id = -1; - long strtype_id = -1; - long memtype_id = -1; - long filetype_id = -1; - long dataspace_id = -1; - long dataset_id = -1; + long file_id = HDF5Constants.H5I_INVALID_HID; + long strtype_id = HDF5Constants.H5I_INVALID_HID; + long memtype_id = HDF5Constants.H5I_INVALID_HID; + long filetype_id = HDF5Constants.H5I_INVALID_HID; + long dataspace_id = HDF5Constants.H5I_INVALID_HID; + long dataset_id = HDF5Constants.H5I_INVALID_HID; long[] dims = { DIM0 }; Sensor[] object_data = new Sensor[DIM0]; byte[] dset_data = null; @@ -286,11 +285,11 @@ public class H5Ex_T_Compound { } private static void ReadDataset() { - long file_id = -1; - long strtype_id = -1; - long memtype_id = -1; - long dataspace_id = -1; - long dataset_id = -1; + long file_id = HDF5Constants.H5I_INVALID_HID; + long strtype_id = HDF5Constants.H5I_INVALID_HID; + long memtype_id = HDF5Constants.H5I_INVALID_HID; + long dataspace_id = HDF5Constants.H5I_INVALID_HID; + long dataset_id = HDF5Constants.H5I_INVALID_HID; long[] dims = { DIM0 }; Sensor[] object_data2; byte[] dset_data; diff --git a/java/examples/datatypes/H5Ex_T_CompoundAttribute.java b/java/examples/datatypes/H5Ex_T_CompoundAttribute.java index 4294b4a..58d2fb7 100644 --- a/java/examples/datatypes/H5Ex_T_CompoundAttribute.java +++ b/java/examples/datatypes/H5Ex_T_CompoundAttribute.java @@ -1,6 +1,5 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * 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 * @@ -125,13 +124,13 @@ public class H5Ex_T_CompoundAttribute { } private static void CreateDataset() { - long file_id = -1; - long strtype_id = -1; - long memtype_id = -1; - long filetype_id = -1; - long dataspace_id = -1; - long dataset_id = -1; - long attribute_id = -1; + long file_id = HDF5Constants.H5I_INVALID_HID; + long strtype_id = HDF5Constants.H5I_INVALID_HID; + long memtype_id = HDF5Constants.H5I_INVALID_HID; + long filetype_id = HDF5Constants.H5I_INVALID_HID; + long dataspace_id = HDF5Constants.H5I_INVALID_HID; + long dataset_id = HDF5Constants.H5I_INVALID_HID; + long attribute_id = HDF5Constants.H5I_INVALID_HID; long[] dims = { DIM0 }; Sensor[] object_data = new Sensor[DIM0]; byte[] dset_data = null; @@ -205,7 +204,7 @@ public class H5Ex_T_CompoundAttribute { dataset_id = H5.H5Dcreate(file_id, DATASETNAME, HDF5Constants.H5T_STD_I32LE, dataspace_id, HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT); H5.H5Sclose(dataspace_id); - dataspace_id = -1; + dataspace_id = HDF5Constants.H5I_INVALID_HID; } } catch (Exception e) { @@ -310,12 +309,12 @@ public class H5Ex_T_CompoundAttribute { } private static void ReadDataset() { - long file_id = -1; - long strtype_id = -1; - long memtype_id = -1; - long dataspace_id = -1; - long dataset_id = -1; - long attribute_id = -1; + long file_id = HDF5Constants.H5I_INVALID_HID; + long strtype_id = HDF5Constants.H5I_INVALID_HID; + long memtype_id = HDF5Constants.H5I_INVALID_HID; + long dataspace_id = HDF5Constants.H5I_INVALID_HID; + long dataset_id = HDF5Constants.H5I_INVALID_HID; + long attribute_id = HDF5Constants.H5I_INVALID_HID; long[] dims = { DIM0 }; Sensor[] object_data2; byte[] dset_data; diff --git a/java/examples/datatypes/H5Ex_T_Float.java b/java/examples/datatypes/H5Ex_T_Float.java index e469d63..e8da7f6 100644 --- a/java/examples/datatypes/H5Ex_T_Float.java +++ b/java/examples/datatypes/H5Ex_T_Float.java @@ -1,6 +1,5 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * 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 * @@ -36,9 +35,9 @@ public class H5Ex_T_Float { private static final int RANK = 2; private static void CreateDataset() { - long file_id = -1; - long dataspace_id = -1; - long dataset_id = -1; + long file_id = HDF5Constants.H5I_INVALID_HID; + long dataspace_id = HDF5Constants.H5I_INVALID_HID; + long dataset_id = HDF5Constants.H5I_INVALID_HID; long[] dims = { DIM0, DIM1 }; double[][] dset_data = new double[DIM0][DIM1]; @@ -120,9 +119,9 @@ public class H5Ex_T_Float { } private static void ReadDataset() { - long file_id = -1; - long dataspace_id = -1; - long dataset_id = -1; + long file_id = HDF5Constants.H5I_INVALID_HID; + long dataspace_id = HDF5Constants.H5I_INVALID_HID; + long dataset_id = HDF5Constants.H5I_INVALID_HID; long[] dims = { DIM0, DIM1 }; double[][] dset_data; diff --git a/java/examples/datatypes/H5Ex_T_FloatAttribute.java b/java/examples/datatypes/H5Ex_T_FloatAttribute.java index b6c92be..eb8e1f8 100644 --- a/java/examples/datatypes/H5Ex_T_FloatAttribute.java +++ b/java/examples/datatypes/H5Ex_T_FloatAttribute.java @@ -1,6 +1,5 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * 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 * @@ -37,10 +36,10 @@ public class H5Ex_T_FloatAttribute { private static final int RANK = 2; private static void CreateDataset() { - long file_id = -1; - long dataspace_id = -1; - long dataset_id = -1; - long attribute_id = -1; + long file_id = HDF5Constants.H5I_INVALID_HID; + long dataspace_id = HDF5Constants.H5I_INVALID_HID; + long dataset_id = HDF5Constants.H5I_INVALID_HID; + long attribute_id = HDF5Constants.H5I_INVALID_HID; long[] dims = { DIM0, DIM1 }; double[][] dset_data = new double[DIM0][DIM1]; @@ -66,7 +65,7 @@ public class H5Ex_T_FloatAttribute { dataset_id = H5.H5Dcreate(file_id, DATASETNAME, HDF5Constants.H5T_STD_I32LE, dataspace_id, HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT); H5.H5Sclose(dataspace_id); - dataspace_id = -1; + dataspace_id = HDF5Constants.H5I_INVALID_HID; } } catch (Exception e) { @@ -139,10 +138,10 @@ public class H5Ex_T_FloatAttribute { } private static void ReadDataset() { - long file_id = -1; - long dataspace_id = -1; - long dataset_id = -1; - long attribute_id = -1; + long file_id = HDF5Constants.H5I_INVALID_HID; + long dataspace_id = HDF5Constants.H5I_INVALID_HID; + long dataset_id = HDF5Constants.H5I_INVALID_HID; + long attribute_id = HDF5Constants.H5I_INVALID_HID; long[] dims = { DIM0, DIM1 }; double[][] dset_data; diff --git a/java/examples/datatypes/H5Ex_T_Integer.java b/java/examples/datatypes/H5Ex_T_Integer.java index f0b3755..bb8e0cb 100644 --- a/java/examples/datatypes/H5Ex_T_Integer.java +++ b/java/examples/datatypes/H5Ex_T_Integer.java @@ -1,6 +1,5 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * 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 * @@ -34,9 +33,9 @@ public class H5Ex_T_Integer { private static final int RANK = 2; private static void CreateDataset() { - long file_id = -1; - long dataspace_id = -1; - long dataset_id = -1; + long file_id = HDF5Constants.H5I_INVALID_HID; + long dataspace_id = HDF5Constants.H5I_INVALID_HID; + long dataset_id = HDF5Constants.H5I_INVALID_HID; long[] dims = { DIM0, DIM1 }; int[][] dset_data = new int[DIM0][DIM1]; @@ -117,9 +116,9 @@ public class H5Ex_T_Integer { } private static void ReadDataset() { - long file_id = -1; - long dataspace_id = -1; - long dataset_id = -1; + long file_id = HDF5Constants.H5I_INVALID_HID; + long dataspace_id = HDF5Constants.H5I_INVALID_HID; + long dataset_id = HDF5Constants.H5I_INVALID_HID; long[] dims = { DIM0, DIM1 }; int[][] dset_data; diff --git a/java/examples/datatypes/H5Ex_T_IntegerAttribute.java b/java/examples/datatypes/H5Ex_T_IntegerAttribute.java index 8c85c63..b0df5e4 100644 --- a/java/examples/datatypes/H5Ex_T_IntegerAttribute.java +++ b/java/examples/datatypes/H5Ex_T_IntegerAttribute.java @@ -1,6 +1,5 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * 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 * @@ -35,10 +34,10 @@ public class H5Ex_T_IntegerAttribute { private static final int RANK = 2; private static void CreateDataset() { - long file_id = -1; - long dataspace_id = -1; - long dataset_id = -1; - long attribute_id = -1; + long file_id = HDF5Constants.H5I_INVALID_HID; + long dataspace_id = HDF5Constants.H5I_INVALID_HID; + long dataset_id = HDF5Constants.H5I_INVALID_HID; + long attribute_id = HDF5Constants.H5I_INVALID_HID; long[] dims = { DIM0, DIM1 }; int[][] dset_data = new int[DIM0][DIM1]; @@ -64,7 +63,7 @@ public class H5Ex_T_IntegerAttribute { dataset_id = H5.H5Dcreate(file_id, DATASETNAME, HDF5Constants.H5T_STD_I32LE, dataspace_id, HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT); H5.H5Sclose(dataspace_id); - dataspace_id = -1; + dataspace_id = HDF5Constants.H5I_INVALID_HID; } } catch (Exception e) { @@ -137,10 +136,10 @@ public class H5Ex_T_IntegerAttribute { } private static void ReadDataset() { - long file_id = -1; - long dataspace_id = -1; - long dataset_id = -1; - long attribute_id = -1; + long file_id = HDF5Constants.H5I_INVALID_HID; + long dataspace_id = HDF5Constants.H5I_INVALID_HID; + long dataset_id = HDF5Constants.H5I_INVALID_HID; + long attribute_id = HDF5Constants.H5I_INVALID_HID; long[] dims = { DIM0, DIM1 }; int[][] dset_data; diff --git a/java/examples/datatypes/H5Ex_T_ObjectReference.java b/java/examples/datatypes/H5Ex_T_ObjectReference.java index 97f02af..38536b8 100644 --- a/java/examples/datatypes/H5Ex_T_ObjectReference.java +++ b/java/examples/datatypes/H5Ex_T_ObjectReference.java @@ -1,6 +1,5 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * 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 * @@ -65,11 +64,11 @@ public class H5Ex_T_ObjectReference { } private static void writeObjRef() { - long file_id = -1; - long dataspace_id = -1; - long filespace_id = -1; - long group_id = -1; - long dataset_id = -1; + long file_id = HDF5Constants.H5I_INVALID_HID; + long dataspace_id = HDF5Constants.H5I_INVALID_HID; + long filespace_id = HDF5Constants.H5I_INVALID_HID; + long group_id = HDF5Constants.H5I_INVALID_HID; + long dataset_id = HDF5Constants.H5I_INVALID_HID; long[] dims = { DIM0 }; byte[][] dset_data = new byte[DIM0][8]; @@ -90,9 +89,9 @@ public class H5Ex_T_ObjectReference { HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT); if (dataset_id >= 0) H5.H5Dclose(dataset_id); - dataset_id = -1; + dataset_id = HDF5Constants.H5I_INVALID_HID; H5.H5Sclose(dataspace_id); - dataspace_id = -1; + dataspace_id = HDF5Constants.H5I_INVALID_HID; } } catch (Exception e) { @@ -106,7 +105,7 @@ public class H5Ex_T_ObjectReference { HDF5Constants.H5P_DEFAULT); if (group_id >= 0) H5.H5Gclose(group_id); - group_id = -1; + group_id = HDF5Constants.H5I_INVALID_HID; } catch (Exception e) { e.printStackTrace(); @@ -187,11 +186,11 @@ public class H5Ex_T_ObjectReference { } private static void readObjRef() { - long file_id = -1; - long dataset_id = -1; - long dataspace_id = -1; + long file_id = HDF5Constants.H5I_INVALID_HID; + long dataset_id = HDF5Constants.H5I_INVALID_HID; + long dataspace_id = HDF5Constants.H5I_INVALID_HID; int object_type = -1; - long object_id = -1; + long object_id = HDF5Constants.H5I_INVALID_HID; long[] dims = { DIM0 }; byte[][] dset_data; diff --git a/java/examples/datatypes/H5Ex_T_ObjectReferenceAttribute.java b/java/examples/datatypes/H5Ex_T_ObjectReferenceAttribute.java index b1cab7c..b38b0a0 100644 --- a/java/examples/datatypes/H5Ex_T_ObjectReferenceAttribute.java +++ b/java/examples/datatypes/H5Ex_T_ObjectReferenceAttribute.java @@ -1,6 +1,5 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * 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 * @@ -67,11 +66,11 @@ public class H5Ex_T_ObjectReferenceAttribute { } private static void CreateDataset() { - long file_id = -1; - long dataspace_id = -1; - long group_id = -1; - long dataset_id = -1; - long attribute_id = -1; + long file_id = HDF5Constants.H5I_INVALID_HID; + long dataspace_id = HDF5Constants.H5I_INVALID_HID; + long group_id = HDF5Constants.H5I_INVALID_HID; + long dataset_id = HDF5Constants.H5I_INVALID_HID; + long attribute_id = HDF5Constants.H5I_INVALID_HID; long[] dims = { DIM0 }; byte[][] dset_data = new byte[DIM0][8]; @@ -92,9 +91,9 @@ public class H5Ex_T_ObjectReferenceAttribute { HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT); if (dataset_id >= 0) H5.H5Dclose(dataset_id); - dataset_id = -1; + dataset_id = HDF5Constants.H5I_INVALID_HID; H5.H5Sclose(dataspace_id); - dataspace_id = -1; + dataspace_id = HDF5Constants.H5I_INVALID_HID; } } catch (Exception e) { @@ -108,7 +107,7 @@ public class H5Ex_T_ObjectReferenceAttribute { HDF5Constants.H5P_DEFAULT); if (group_id >= 0) H5.H5Gclose(group_id); - group_id = -1; + group_id = HDF5Constants.H5I_INVALID_HID; } catch (Exception e) { e.printStackTrace(); @@ -139,7 +138,7 @@ public class H5Ex_T_ObjectReferenceAttribute { dataset_id = H5.H5Dcreate(file_id, DATASETNAME, HDF5Constants.H5T_STD_I32LE, dataspace_id, HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT); H5.H5Sclose(dataspace_id); - dataspace_id = -1; + dataspace_id = HDF5Constants.H5I_INVALID_HID; } } catch (Exception e) { @@ -212,12 +211,12 @@ public class H5Ex_T_ObjectReferenceAttribute { } private static void ReadDataset() { - long file_id = -1; - long dataspace_id = -1; - long dataset_id = -1; - long attribute_id = -1; + long file_id = HDF5Constants.H5I_INVALID_HID; + long dataspace_id = HDF5Constants.H5I_INVALID_HID; + long dataset_id = HDF5Constants.H5I_INVALID_HID; + long attribute_id = HDF5Constants.H5I_INVALID_HID; int object_type = -1; - long object_id = -1; + long object_id = HDF5Constants.H5I_INVALID_HID; long[] dims = { DIM0 }; byte[][] dset_data; diff --git a/java/examples/datatypes/H5Ex_T_Opaque.java b/java/examples/datatypes/H5Ex_T_Opaque.java index 1d9ab1b..e851fb2 100644 --- a/java/examples/datatypes/H5Ex_T_Opaque.java +++ b/java/examples/datatypes/H5Ex_T_Opaque.java @@ -1,6 +1,5 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * 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 * @@ -32,10 +31,10 @@ public class H5Ex_T_Opaque { private static final int RANK = 1; private static void CreateDataset() { - long file_id = -1; - long dataspace_id = -1; - long datatype_id = -1; - long dataset_id = -1; + long file_id = HDF5Constants.H5I_INVALID_HID; + long dataspace_id = HDF5Constants.H5I_INVALID_HID; + long datatype_id = HDF5Constants.H5I_INVALID_HID; + long dataset_id = HDF5Constants.H5I_INVALID_HID; long[] dims = { DIM0 }; byte[] dset_data = new byte[DIM0 * LEN]; byte[] str_data = { 'O', 'P', 'A', 'Q', 'U', 'E' }; @@ -138,11 +137,11 @@ public class H5Ex_T_Opaque { } private static void ReadDataset() { - long file_id = -1; - long datatype_id = -1; - long dataspace_id = -1; - long dataset_id = -1; - long type_len = -1; + long file_id = HDF5Constants.H5I_INVALID_HID; + long datatype_id = HDF5Constants.H5I_INVALID_HID; + long dataspace_id = HDF5Constants.H5I_INVALID_HID; + long dataset_id = HDF5Constants.H5I_INVALID_HID; + long type_len = HDF5Constants.H5I_INVALID_HID; long[] dims = { DIM0 }; byte[] dset_data; String tag_name = null; diff --git a/java/examples/datatypes/H5Ex_T_OpaqueAttribute.java b/java/examples/datatypes/H5Ex_T_OpaqueAttribute.java index 8955d77..3e16ab4 100644 --- a/java/examples/datatypes/H5Ex_T_OpaqueAttribute.java +++ b/java/examples/datatypes/H5Ex_T_OpaqueAttribute.java @@ -1,6 +1,5 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * 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 * @@ -33,11 +32,11 @@ public class H5Ex_T_OpaqueAttribute { private static final int RANK = 1; private static void CreateDataset() { - long file_id = -1; - long dataspace_id = -1; - long datatype_id = -1; - long dataset_id = -1; - long attribute_id = -1; + long file_id = HDF5Constants.H5I_INVALID_HID; + long dataspace_id = HDF5Constants.H5I_INVALID_HID; + long datatype_id = HDF5Constants.H5I_INVALID_HID; + long dataset_id = HDF5Constants.H5I_INVALID_HID; + long attribute_id = HDF5Constants.H5I_INVALID_HID; long[] dims = { DIM0 }; byte[] dset_data = new byte[DIM0 * LEN]; byte[] str_data = { 'O', 'P', 'A', 'Q', 'U', 'E' }; @@ -65,7 +64,7 @@ public class H5Ex_T_OpaqueAttribute { dataset_id = H5.H5Dcreate(file_id, DATASETNAME, HDF5Constants.H5T_STD_I32LE, dataspace_id, HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT); H5.H5Sclose(dataspace_id); - dataspace_id = -1; + dataspace_id = HDF5Constants.H5I_INVALID_HID; } } catch (Exception e) { @@ -158,11 +157,11 @@ public class H5Ex_T_OpaqueAttribute { } private static void ReadDataset() { - long file_id = -1; - long datatype_id = -1; - long dataspace_id = -1; - long dataset_id = -1; - long attribute_id = -1; + long file_id = HDF5Constants.H5I_INVALID_HID; + long datatype_id = HDF5Constants.H5I_INVALID_HID; + long dataspace_id = HDF5Constants.H5I_INVALID_HID; + long dataset_id = HDF5Constants.H5I_INVALID_HID; + long attribute_id = HDF5Constants.H5I_INVALID_HID; long type_len = -1; long[] dims = { DIM0 }; byte[] dset_data; diff --git a/java/examples/datatypes/H5Ex_T_String.java b/java/examples/datatypes/H5Ex_T_String.java index f91d866..e497bd8 100644 --- a/java/examples/datatypes/H5Ex_T_String.java +++ b/java/examples/datatypes/H5Ex_T_String.java @@ -1,6 +1,5 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * 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 * @@ -32,11 +31,11 @@ public class H5Ex_T_String { private static final int RANK = 1; private static void CreateDataset() { - long file_id = -1; - long memtype_id = -1; - long filetype_id = -1; - long dataspace_id = -1; - long dataset_id = -1; + long file_id = HDF5Constants.H5I_INVALID_HID; + long memtype_id = HDF5Constants.H5I_INVALID_HID; + long filetype_id = HDF5Constants.H5I_INVALID_HID; + long dataspace_id = HDF5Constants.H5I_INVALID_HID; + long dataset_id = HDF5Constants.H5I_INVALID_HID; long[] dims = { DIM0 }; byte[][] dset_data = new byte[DIM0][SDIM]; StringBuffer[] str_data = { new StringBuffer("Parting"), new StringBuffer("is such"), @@ -156,11 +155,11 @@ public class H5Ex_T_String { } private static void ReadDataset() { - long file_id = -1; - long filetype_id = -1; - long memtype_id = -1; - long dataspace_id = -1; - long dataset_id = -1; + long file_id = HDF5Constants.H5I_INVALID_HID; + long filetype_id = HDF5Constants.H5I_INVALID_HID; + long memtype_id = HDF5Constants.H5I_INVALID_HID; + long dataspace_id = HDF5Constants.H5I_INVALID_HID; + long dataset_id = HDF5Constants.H5I_INVALID_HID; long sdim = 0; long[] dims = { DIM0 }; byte[][] dset_data; diff --git a/java/examples/datatypes/H5Ex_T_StringAttribute.java b/java/examples/datatypes/H5Ex_T_StringAttribute.java index 7fe46c8..700f6a9 100644 --- a/java/examples/datatypes/H5Ex_T_StringAttribute.java +++ b/java/examples/datatypes/H5Ex_T_StringAttribute.java @@ -1,6 +1,5 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * 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 * @@ -33,12 +32,12 @@ public class H5Ex_T_StringAttribute { private static final int RANK = 1; private static void CreateDataset() { - long file_id = -1; - long memtype_id = -1; - long filetype_id = -1; - long dataspace_id = -1; - long dataset_id = -1; - long attribute_id = -1; + long file_id = HDF5Constants.H5I_INVALID_HID; + long memtype_id = HDF5Constants.H5I_INVALID_HID; + long filetype_id = HDF5Constants.H5I_INVALID_HID; + long dataspace_id = HDF5Constants.H5I_INVALID_HID; + long dataset_id = HDF5Constants.H5I_INVALID_HID; + long attribute_id = HDF5Constants.H5I_INVALID_HID; long[] dims = { DIM0 }; byte[][] dset_data = new byte[DIM0][SDIM]; StringBuffer[] str_data = { new StringBuffer("Parting"), new StringBuffer("is such"), @@ -80,7 +79,7 @@ public class H5Ex_T_StringAttribute { dataset_id = H5.H5Dcreate(file_id, DATASETNAME, HDF5Constants.H5T_STD_I32LE, dataspace_id, HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT); H5.H5Sclose(dataspace_id); - dataspace_id = -1; + dataspace_id = HDF5Constants.H5I_INVALID_HID; } } catch (Exception e) { @@ -179,12 +178,12 @@ public class H5Ex_T_StringAttribute { } private static void ReadDataset() { - long file_id = -1; - long filetype_id = -1; - long memtype_id = -1; - long dataspace_id = -1; - long dataset_id = -1; - long attribute_id = -1; + long file_id = HDF5Constants.H5I_INVALID_HID; + long filetype_id = HDF5Constants.H5I_INVALID_HID; + long memtype_id = HDF5Constants.H5I_INVALID_HID; + long dataspace_id = HDF5Constants.H5I_INVALID_HID; + long dataset_id = HDF5Constants.H5I_INVALID_HID; + long attribute_id = HDF5Constants.H5I_INVALID_HID; long sdim = 0; long[] dims = { DIM0 }; byte[][] dset_data; diff --git a/java/examples/datatypes/H5Ex_T_VLString.java b/java/examples/datatypes/H5Ex_T_VLString.java index e1c9bd5..8a29e60 100644 --- a/java/examples/datatypes/H5Ex_T_VLString.java +++ b/java/examples/datatypes/H5Ex_T_VLString.java @@ -1,6 +1,5 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * 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 * @@ -26,10 +25,10 @@ public class H5Ex_T_VLString private static String DATASETNAME = "DS1"; private static void createDataset() { - long file_id = -1; - long type_id = -1; - long dataspace_id = -1; - long dataset_id = -1; + long file_id = HDF5Constants.H5I_INVALID_HID; + long type_id = HDF5Constants.H5I_INVALID_HID; + long dataspace_id = HDF5Constants.H5I_INVALID_HID; + long dataset_id = HDF5Constants.H5I_INVALID_HID; int rank = 1; String[] str_data = { "Parting", "is such", "sweet", "sorrow." }; long[] dims = { str_data.length }; @@ -93,9 +92,9 @@ public class H5Ex_T_VLString } private static void readDataset() { - long file_id = -1; - long type_id = -1; - long dataset_id = -1; + long file_id = HDF5Constants.H5I_INVALID_HID; + long type_id = HDF5Constants.H5I_INVALID_HID; + long dataset_id = HDF5Constants.H5I_INVALID_HID; String[] str_data = { "", "", "", "" }; try { diff --git a/java/examples/datatypes/JavaDatatypeExample.sh.in b/java/examples/datatypes/JavaDatatypeExample.sh.in index d48d5de..e26d8c0 100644 --- a/java/examples/datatypes/JavaDatatypeExample.sh.in +++ b/java/examples/datatypes/JavaDatatypeExample.sh.in @@ -1,7 +1,6 @@ #! /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 diff --git a/java/examples/datatypes/Makefile.am b/java/examples/datatypes/Makefile.am index 26f64cb..90790f7 100644 --- a/java/examples/datatypes/Makefile.am +++ b/java/examples/datatypes/Makefile.am @@ -1,6 +1,5 @@ # # 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 diff --git a/java/examples/groups/H5Ex_G_Compact.java b/java/examples/groups/H5Ex_G_Compact.java index 6078c6c..313c9c7 100644 --- a/java/examples/groups/H5Ex_G_Compact.java +++ b/java/examples/groups/H5Ex_G_Compact.java @@ -1,6 +1,5 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * 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 * @@ -60,9 +59,9 @@ public class H5Ex_G_Compact { } public static void CreateGroup() { - long file_id = -1; - long group_id = -1; - long fapl_id = -1; + long file_id = HDF5Constants.H5I_INVALID_HID; + long group_id = HDF5Constants.H5I_INVALID_HID; + long fapl_id = HDF5Constants.H5I_INVALID_HID; H5G_info_t ginfo; long size; diff --git a/java/examples/groups/H5Ex_G_Corder.java b/java/examples/groups/H5Ex_G_Corder.java index 74f70ba..5df850e 100644 --- a/java/examples/groups/H5Ex_G_Corder.java +++ b/java/examples/groups/H5Ex_G_Corder.java @@ -1,6 +1,5 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * 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 * @@ -25,10 +24,10 @@ public class H5Ex_G_Corder { private static String FILE = "H5Ex_G_Corder.h5"; private static void CreateGroup() throws Exception { - long file_id = -1; - long group_id = -1; - long subgroup_id = -1; - long gcpl_id = -1; + long file_id = HDF5Constants.H5I_INVALID_HID; + long group_id = HDF5Constants.H5I_INVALID_HID; + long subgroup_id = HDF5Constants.H5I_INVALID_HID; + long gcpl_id = HDF5Constants.H5I_INVALID_HID; int status; H5G_info_t ginfo; int i; diff --git a/java/examples/groups/H5Ex_G_Create.java b/java/examples/groups/H5Ex_G_Create.java index f653987..9304538 100644 --- a/java/examples/groups/H5Ex_G_Create.java +++ b/java/examples/groups/H5Ex_G_Create.java @@ -1,6 +1,5 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * 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 * @@ -25,8 +24,8 @@ public class H5Ex_G_Create { private static String GROUPNAME = "G1"; private static void CreateGroup() { - long file_id = -1; - long group_id = -1; + long file_id = HDF5Constants.H5I_INVALID_HID; + long group_id = HDF5Constants.H5I_INVALID_HID; // Create a new file using default properties. try { diff --git a/java/examples/groups/H5Ex_G_Intermediate.java b/java/examples/groups/H5Ex_G_Intermediate.java index 6109e9a..ad0290c 100644 --- a/java/examples/groups/H5Ex_G_Intermediate.java +++ b/java/examples/groups/H5Ex_G_Intermediate.java @@ -1,6 +1,5 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * 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 * @@ -31,9 +30,9 @@ public class H5Ex_G_Intermediate { private void CreateGroup() throws Exception { - long file_id = -1; - long group_id = -1; - long gcpl_id = -1; + long file_id = HDF5Constants.H5I_INVALID_HID; + long group_id = HDF5Constants.H5I_INVALID_HID; + long gcpl_id = HDF5Constants.H5I_INVALID_HID; try { // Create a new file_id using the default properties. diff --git a/java/examples/groups/H5Ex_G_Iterate.java b/java/examples/groups/H5Ex_G_Iterate.java index 71361f8..6caecac 100644 --- a/java/examples/groups/H5Ex_G_Iterate.java +++ b/java/examples/groups/H5Ex_G_Iterate.java @@ -1,6 +1,5 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * 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 * @@ -58,7 +57,7 @@ public class H5Ex_G_Iterate { } private static void do_iterate() { - long file_id = -1; + long file_id = HDF5Constants.H5I_INVALID_HID; // Open a file using default properties. try { diff --git a/java/examples/groups/H5Ex_G_Phase.java b/java/examples/groups/H5Ex_G_Phase.java index 7824123..67a2f53 100644 --- a/java/examples/groups/H5Ex_G_Phase.java +++ b/java/examples/groups/H5Ex_G_Phase.java @@ -1,6 +1,5 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * 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 * @@ -60,11 +59,11 @@ public class H5Ex_G_Phase { } private static void CreateGroup() { - long file_id = -1; - long group_id = -1; - long subgroup_id = -1; - long fapl_id = -1; - long gcpl_id = -1; + long file_id = HDF5Constants.H5I_INVALID_HID; + long group_id = HDF5Constants.H5I_INVALID_HID; + long subgroup_id = HDF5Constants.H5I_INVALID_HID; + long fapl_id = HDF5Constants.H5I_INVALID_HID; + long gcpl_id = HDF5Constants.H5I_INVALID_HID; H5G_info_t ginfo; String name = "G0"; // Name of subgroup_id int i; diff --git a/java/examples/groups/H5Ex_G_Traverse.java b/java/examples/groups/H5Ex_G_Traverse.java index 76ed6c8..c5b6373 100644 --- a/java/examples/groups/H5Ex_G_Traverse.java +++ b/java/examples/groups/H5Ex_G_Traverse.java @@ -1,6 +1,5 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * 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 * @@ -43,7 +42,7 @@ public class H5Ex_G_Traverse { public static H5L_iterate_t iter_cb = new H5L_iter_callbackT(); private static void OpenGroup() { - long file_id = -1; + long file_id = HDF5Constants.H5I_INVALID_HID; H5O_info_t infobuf; opdata od = new opdata(); diff --git a/java/examples/groups/H5Ex_G_Visit.java b/java/examples/groups/H5Ex_G_Visit.java index c479259..790be80 100644 --- a/java/examples/groups/H5Ex_G_Visit.java +++ b/java/examples/groups/H5Ex_G_Visit.java @@ -1,6 +1,5 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * 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 * @@ -47,7 +46,7 @@ public class H5Ex_G_Visit { private void VisitGroup() throws Exception { - long file_id = -1; + long file_id = HDF5Constants.H5I_INVALID_HID; try { // Open file diff --git a/java/examples/groups/JavaGroupExample.sh.in b/java/examples/groups/JavaGroupExample.sh.in index 7981176..3b0e9d1 100644 --- a/java/examples/groups/JavaGroupExample.sh.in +++ b/java/examples/groups/JavaGroupExample.sh.in @@ -1,7 +1,6 @@ #! /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 diff --git a/java/examples/groups/Makefile.am b/java/examples/groups/Makefile.am index 85badb3..bfde9ae 100644 --- a/java/examples/groups/Makefile.am +++ b/java/examples/groups/Makefile.am @@ -1,6 +1,5 @@ # # 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 diff --git a/java/examples/intro/H5_CreateAttribute.java b/java/examples/intro/H5_CreateAttribute.java index 22b03ad..949a770 100644 --- a/java/examples/intro/H5_CreateAttribute.java +++ b/java/examples/intro/H5_CreateAttribute.java @@ -1,6 +1,5 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * 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 * @@ -28,10 +27,10 @@ public class H5_CreateAttribute { private static String DATASETATTRIBUTE = "Units"; private static void CreateDatasetAttribute() { - long file_id = -1; - long dataspace_id = -1; - long dataset_id = -1; - long attribute_id = -1; + long file_id = HDF5Constants.H5I_INVALID_HID; + long dataspace_id = HDF5Constants.H5I_INVALID_HID; + long dataset_id = HDF5Constants.H5I_INVALID_HID; + long attribute_id = HDF5Constants.H5I_INVALID_HID; long[] dims1 = { DIM_X, DIM_Y }; long[] dims = { 2 }; int[] attr_data = { 100, 200 }; diff --git a/java/examples/intro/H5_CreateDataset.java b/java/examples/intro/H5_CreateDataset.java index 7b56e83..f938be2 100644 --- a/java/examples/intro/H5_CreateDataset.java +++ b/java/examples/intro/H5_CreateDataset.java @@ -1,6 +1,5 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * 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 * @@ -27,9 +26,9 @@ public class H5_CreateDataset { private static final int DIM_Y = 6; private static void CreateDataset() { - long file_id = -1; - long dataspace_id = -1; - long dataset_id = -1; + long file_id = HDF5Constants.H5I_INVALID_HID; + long dataspace_id = HDF5Constants.H5I_INVALID_HID; + long dataset_id = HDF5Constants.H5I_INVALID_HID; long[] dims = { DIM_X, DIM_Y }; // Create a new file using default properties. diff --git a/java/examples/intro/H5_CreateFile.java b/java/examples/intro/H5_CreateFile.java index 367e61f..d48ba6c 100644 --- a/java/examples/intro/H5_CreateFile.java +++ b/java/examples/intro/H5_CreateFile.java @@ -1,6 +1,5 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * 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 * @@ -24,7 +23,7 @@ public class H5_CreateFile { static final String FILENAME = "H5_CreateFile.h5"; private static void CreateFile() { - long file_id = -1; + long file_id = HDF5Constants.H5I_INVALID_HID; // Create a new file using default properties. try { diff --git a/java/examples/intro/H5_CreateGroup.java b/java/examples/intro/H5_CreateGroup.java index 54f6252..c0bb954 100644 --- a/java/examples/intro/H5_CreateGroup.java +++ b/java/examples/intro/H5_CreateGroup.java @@ -1,6 +1,5 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * 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 * @@ -25,8 +24,8 @@ public class H5_CreateGroup { private static String GROUPNAME = "MyGroup"; private static void CreateGroup() { - long file_id = -1; - long group_id = -1; + long file_id = HDF5Constants.H5I_INVALID_HID; + long group_id = HDF5Constants.H5I_INVALID_HID; // Create a new file using default properties. try { diff --git a/java/examples/intro/H5_CreateGroupAbsoluteRelative.java b/java/examples/intro/H5_CreateGroupAbsoluteRelative.java index b9c35d7..f2c6168 100644 --- a/java/examples/intro/H5_CreateGroupAbsoluteRelative.java +++ b/java/examples/intro/H5_CreateGroupAbsoluteRelative.java @@ -1,6 +1,5 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * 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 * @@ -27,10 +26,10 @@ public class H5_CreateGroupAbsoluteRelative { private static String GROUPNAME_B = "GroupB"; private static void CreateGroupAbsoluteAndRelative() { - long file_id = -1; - long group1_id = -1; - long group2_id = -1; - long group3_id = -1; + long file_id = HDF5Constants.H5I_INVALID_HID; + long group1_id = HDF5Constants.H5I_INVALID_HID; + long group2_id = HDF5Constants.H5I_INVALID_HID; + long group3_id = HDF5Constants.H5I_INVALID_HID; // Create a new file using default properties. try { diff --git a/java/examples/intro/H5_CreateGroupDataset.java b/java/examples/intro/H5_CreateGroupDataset.java index 191a21a..f1d1cba 100644 --- a/java/examples/intro/H5_CreateGroupDataset.java +++ b/java/examples/intro/H5_CreateGroupDataset.java @@ -1,6 +1,5 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * 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 * @@ -32,12 +31,12 @@ public class H5_CreateGroupDataset { private static final int DIM2_Y = 10; private static void h5_crtgrpd() { - long file_id = -1; - long dataspace_id = -1; - long dataset_id = -1; - long group_id = -1; - long group1_id = -1; - long group2_id = -1; + long file_id = HDF5Constants.H5I_INVALID_HID; + long dataspace_id = HDF5Constants.H5I_INVALID_HID; + long dataset_id = HDF5Constants.H5I_INVALID_HID; + long group_id = HDF5Constants.H5I_INVALID_HID; + long group1_id = HDF5Constants.H5I_INVALID_HID; + long group2_id = HDF5Constants.H5I_INVALID_HID; int[][] dset1_data = new int[DIM1_X][DIM1_Y]; int[][] dset2_data = new int[DIM2_X][DIM2_Y]; long[] dims1 = { DIM1_X, DIM1_Y }; @@ -108,7 +107,7 @@ public class H5_CreateGroupDataset { try { if (dataspace_id >= 0) H5.H5Sclose(dataspace_id); - dataspace_id = -1; + dataspace_id = HDF5Constants.H5I_INVALID_HID; } catch (Exception e) { e.printStackTrace(); @@ -118,7 +117,7 @@ public class H5_CreateGroupDataset { try { if (dataset_id >= 0) H5.H5Dclose(dataset_id); - dataset_id = -1; + dataset_id = HDF5Constants.H5I_INVALID_HID; } catch (Exception e) { e.printStackTrace(); diff --git a/java/examples/intro/H5_ReadWrite.java b/java/examples/intro/H5_ReadWrite.java index 812ac77..67e1ac5 100644 --- a/java/examples/intro/H5_ReadWrite.java +++ b/java/examples/intro/H5_ReadWrite.java @@ -1,6 +1,5 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * 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 * @@ -27,9 +26,9 @@ public class H5_ReadWrite { private static final int DIM_Y = 6; private static void ReadWriteDataset() { - long file_id = -1; - long dataspace_id = -1; - long dataset_id = -1; + long file_id = HDF5Constants.H5I_INVALID_HID; + long dataspace_id = HDF5Constants.H5I_INVALID_HID; + long dataset_id = HDF5Constants.H5I_INVALID_HID; long[] dims = { DIM_X, DIM_Y }; int[][] dset_data = new int[DIM_X][DIM_Y]; diff --git a/java/examples/intro/JavaIntroExample.sh.in b/java/examples/intro/JavaIntroExample.sh.in index 9677686..db741e5 100644 --- a/java/examples/intro/JavaIntroExample.sh.in +++ b/java/examples/intro/JavaIntroExample.sh.in @@ -1,7 +1,6 @@ #! /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 diff --git a/java/examples/intro/Makefile.am b/java/examples/intro/Makefile.am index 981ace0..7d1aeab 100644 --- a/java/examples/intro/Makefile.am +++ b/java/examples/intro/Makefile.am @@ -1,6 +1,5 @@ # # 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 diff --git a/java/src/Makefile.am b/java/src/Makefile.am index ce9e7dc..98630e6 100644 --- a/java/src/Makefile.am +++ b/java/src/Makefile.am @@ -1,6 +1,5 @@ # # 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 diff --git a/java/src/hdf/hdf5lib/HDF5Constants.java b/java/src/hdf/hdf5lib/HDF5Constants.java index 5d2e69b..e481c12 100644 --- a/java/src/hdf/hdf5lib/HDF5Constants.java +++ b/java/src/hdf/hdf5lib/HDF5Constants.java @@ -47,10 +47,15 @@ public class HDF5Constants { public static final int H5_SZIP_ALLOW_K13_OPTION_MASK = H5_SZIP_ALLOW_K13_OPTION_MASK(); /** Special parameters for szip compression */ public static final int H5_SZIP_CHIP_OPTION_MASK = H5_SZIP_CHIP_OPTION_MASK(); + /** indices on links, unknown index type */ public static final int H5_INDEX_UNKNOWN = H5_INDEX_UNKNOWN(); + /** indices on links, index on names */ public static final int H5_INDEX_NAME = H5_INDEX_NAME(); + /** indices on links, index on creation order */ public static final int H5_INDEX_CRT_ORDER = H5_INDEX_CRT_ORDER(); + /** indices on links, number of indices defined */ public static final int H5_INDEX_N = H5_INDEX_N(); + /** */ public static final int H5_ITER_UNKNOWN = H5_ITER_UNKNOWN(); public static final int H5_ITER_INC = H5_ITER_INC(); public static final int H5_ITER_DEC = H5_ITER_DEC(); diff --git a/java/src/hdf/hdf5lib/HDF5GroupInfo.java b/java/src/hdf/hdf5lib/HDF5GroupInfo.java index 44b41bb..e08f991 100644 --- a/java/src/hdf/hdf5lib/HDF5GroupInfo.java +++ b/java/src/hdf/hdf5lib/HDF5GroupInfo.java @@ -41,6 +41,8 @@ public class HDF5GroupInfo { long mtime; int linklen; + /** Container for the information reported about an HDF5 Object + * from the H5Gget_obj_info() method */ public HDF5GroupInfo() { fileno = new long[2]; objno = new long[2]; @@ -88,27 +90,32 @@ public class HDF5GroupInfo { linklen = 0; } - /* accessors */ + /** fileno accessors */ public long[] getFileno() { return fileno; } + /** accessors */ public long[] getObjno() { return objno; } + /** accessors */ public int getType() { return type; } + /** accessors */ public int getNlink() { return nlink; } + /** accessors */ public long getMtime() { return mtime; } + /** accessors */ public int getLinklen() { return linklen; } diff --git a/java/src/hdf/hdf5lib/HDFArray.java b/java/src/hdf/hdf5lib/HDFArray.java index 789cc7c..385d71b 100644 --- a/java/src/hdf/hdf5lib/HDFArray.java +++ b/java/src/hdf/hdf5lib/HDFArray.java @@ -11,7 +11,6 @@ * help@hdfgroup.org. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ - package hdf.hdf5lib; import hdf.hdf5lib.exceptions.HDF5Exception; @@ -21,19 +20,16 @@ import java.util.Arrays; /** * This is a class for handling multidimensional arrays for HDF. *

- * The purpose is to allow the storage and retrieval of arbitrary array types - * containing scientific data. + * The purpose is to allow the storage and retrieval of arbitrary array types containing scientific data. *

- * The methods support the conversion of an array to and from Java to a - * one-dimensional array of bytes suitable for I/O by the C library. + * The methods support the conversion of an array to and from Java to a one-dimensional array of bytes suitable for I/O + * by the C library. *

- * This class heavily uses the HDFNativeData class to - * convert between Java and C representations. + * This class heavily uses the HDFNativeData class to convert between + * Java and C representations. */ public class HDFArray { - private Object _theArray = null; private ArrayDescriptor _desc = null; private byte[] _barray = null; @@ -41,31 +37,27 @@ public class HDFArray { // public HDFArray() {} /** - * The input must be a Java Array (possibly multidimensional) of primitive - * numbers or sub-classes of Number. + * The input must be a Java Array (possibly multidimensional) of primitive numbers or sub-classes of Number. *

- * The input is analysed to determine the number of dimensions and size of - * each dimension, as well as the type of the elements. + * The input is analysed to determine the number of dimensions and size of each dimension, as well as the type of + * the elements. *

* The description is saved in private variables, and used to convert data. * * @param anArray - * The array object. - * + * The array object. * @exception hdf.hdf5lib.exceptions.HDF5Exception - * object is not an array. + * object is not an array. */ - public HDFArray(Object anArray) throws HDF5Exception { - + public HDFArray(Object anArray) throws HDF5Exception + { if (anArray == null) { - HDF5JavaException ex = new HDF5JavaException( - "HDFArray: array is null?: "); + HDF5JavaException ex = new HDF5JavaException("HDFArray: array is null?: "); } Class tc = anArray.getClass(); if (tc.isArray() == false) { /* exception: not an array */ - HDF5JavaException ex = new HDF5JavaException( - "HDFArray: not an array?: "); + HDF5JavaException ex = new HDF5JavaException("HDFArray: not an array?: "); throw (ex); } _theArray = anArray; @@ -73,8 +65,7 @@ public class HDFArray { /* extra error checking -- probably not needed */ if (_desc == null) { - HDF5JavaException ex = new HDF5JavaException( - "HDFArray: internal error: array description failed?: "); + HDF5JavaException ex = new HDF5JavaException("HDFArray: internal error: array description failed?: "); throw (ex); } } @@ -82,49 +73,48 @@ public class HDFArray { /** * Allocate a one-dimensional array of bytes sufficient to store the array. * - * @return A one-D array of bytes, filled with zeroes. The bytes are - * sufficient to hold the data of the Array passed to the - * constructor. + * @return A one-D array of bytes, filled with zeroes. The bytes are sufficient to hold the data of the Array passed + * to the constructor. * @exception hdf.hdf5lib.exceptions.HDF5JavaException - * Allocation failed. + * Allocation failed. */ - public byte[] emptyBytes() throws HDF5JavaException { + public byte[] emptyBytes() + throws HDF5JavaException + { byte[] b = null; - if ((ArrayDescriptor.dims == 1) && (ArrayDescriptor.NT == 'B')) { + if ((ArrayDescriptor.dims == 1) + && (ArrayDescriptor.NT == 'B')) { b = (byte[]) _theArray; } else { b = new byte[ArrayDescriptor.totalSize]; } if (b == null) { - HDF5JavaException ex = new HDF5JavaException( - "HDFArray: emptyBytes: allocation failed"); + HDF5JavaException ex = new HDF5JavaException("HDFArray: emptyBytes: allocation failed"); throw (ex); } return (b); } /** - * Given a Java array of numbers, convert it to a one-dimensional array of - * bytes in correct native order. + * Given a Java array of numbers, convert it to a one-dimensional array of bytes in correct native order. * - * @return A one-D array of bytes, constructed from the Array passed to the - * constructor. + * @return A one-D array of bytes, constructed from the Array passed to the constructor. * @exception hdf.hdf5lib.exceptions.HDF5JavaException - * the object not an array or other internal error. + * the object not an array or other internal error. */ - public byte[] byteify() throws HDF5JavaException { - + public byte[] byteify() + throws HDF5JavaException + { if (_barray != null) { return _barray; } if (_theArray == null) { /* exception: not an array */ - HDF5JavaException ex = new HDF5JavaException( - "HDFArray: byteify not an array?: "); + HDF5JavaException ex = new HDF5JavaException("HDFArray: byteify not an array?: "); throw (ex); } @@ -141,73 +131,53 @@ public class HDFArray { byte[] therow; if (ArrayDescriptor.NT == 'I') { - therow = HDFNativeData.intToByte(0, - ArrayDescriptor.dimlen[1], (int[]) _theArray); + therow = HDFNativeData.intToByte(0, ArrayDescriptor.dimlen[1], (int[]) _theArray); } else if (ArrayDescriptor.NT == 'S') { - therow = HDFNativeData.shortToByte(0, - ArrayDescriptor.dimlen[1], (short[]) _theArray); + therow = HDFNativeData.shortToByte(0, ArrayDescriptor.dimlen[1], (short[]) _theArray); } else if (ArrayDescriptor.NT == 'F') { - therow = HDFNativeData.floatToByte(0, - ArrayDescriptor.dimlen[1], (float[]) _theArray); + therow = HDFNativeData.floatToByte(0, ArrayDescriptor.dimlen[1], (float[]) _theArray); } else if (ArrayDescriptor.NT == 'J') { - therow = HDFNativeData.longToByte(0, - ArrayDescriptor.dimlen[1], (long[]) _theArray); + therow = HDFNativeData.longToByte(0, ArrayDescriptor.dimlen[1], (long[]) _theArray); } else if (ArrayDescriptor.NT == 'D') { - therow = HDFNativeData - .doubleToByte(0, ArrayDescriptor.dimlen[1], - (double[]) _theArray); + therow = HDFNativeData.doubleToByte(0, ArrayDescriptor.dimlen[1], (double[]) _theArray); } else if (ArrayDescriptor.NT == 'L') { if (ArrayDescriptor.className.equals("java.lang.Byte")) { therow = ByteObjToByte((Byte[]) _theArray); } - else if (ArrayDescriptor.className - .equals("java.lang.Integer")) { + else if (ArrayDescriptor.className.equals("java.lang.Integer")) { therow = IntegerToByte((Integer[]) _theArray); } - else if (ArrayDescriptor.className - .equals("java.lang.Short")) { + else if (ArrayDescriptor.className.equals("java.lang.Short")) { therow = ShortToByte((Short[]) _theArray); } - else if (ArrayDescriptor.className - .equals("java.lang.Float")) { + else if (ArrayDescriptor.className.equals("java.lang.Float")) { therow = FloatObjToByte((Float[]) _theArray); } - else if (ArrayDescriptor.className - .equals("java.lang.Double")) { + else if (ArrayDescriptor.className.equals("java.lang.Double")) { therow = DoubleObjToByte((Double[]) _theArray); } - else if (ArrayDescriptor.className - .equals("java.lang.Long")) { + else if (ArrayDescriptor.className.equals("java.lang.Long")) { therow = LongObjToByte((Long[]) _theArray); } else { - HDF5JavaException ex = new HDF5JavaException( - "HDFArray: unknown type of Object?"); + HDF5JavaException ex = new HDF5JavaException("HDFArray: unknown type of Object?"); throw (ex); } } else { - HDF5JavaException ex = new HDF5JavaException( - "HDFArray: unknown type of data?"); + HDF5JavaException ex = new HDF5JavaException("HDFArray: unknown type of data?"); throw (ex); } - System - .arraycopy( - therow, - 0, - _barray, - 0, - (ArrayDescriptor.dimlen[1] * ArrayDescriptor.NTsize)); + System.arraycopy(therow, 0, _barray, 0, (ArrayDescriptor.dimlen[1] * ArrayDescriptor.NTsize)); return _barray; } catch (OutOfMemoryError err) { - HDF5JavaException ex = new HDF5JavaException( - "HDFArray: byteify array too big?"); + HDF5JavaException ex = new HDF5JavaException("HDFArray: byteify array too big?"); throw (ex); } } @@ -217,8 +187,7 @@ public class HDFArray { _barray = new byte[ArrayDescriptor.totalSize]; } catch (OutOfMemoryError err) { - HDF5JavaException ex = new HDF5JavaException( - "HDFArray: byteify array too big?"); + HDF5JavaException ex = new HDF5JavaException("HDFArray: byteify array too big?"); throw (ex); } @@ -241,8 +210,7 @@ public class HDFArray { else { /* check range of index */ if (index > (ArrayDescriptor.dimlen[i] - 1)) { - throw new java.lang.IndexOutOfBoundsException( - "HDFArray: byteify index OOB?"); + throw new java.lang.IndexOutOfBoundsException("HDFArray: byteify index OOB?"); } oo = java.lang.reflect.Array.get(oo, index); ArrayDescriptor.currentindex[i] = index; @@ -254,144 +222,107 @@ public class HDFArray { byte arow[]; try { if (ArrayDescriptor.NT == 'J') { - arow = HDFNativeData - .longToByte( - 0, - ArrayDescriptor.dimlen[ArrayDescriptor.dims], - (long[]) ArrayDescriptor.objs[ArrayDescriptor.dims - 1]); - arow = HDFNativeData - .longToByte( - 0, - ArrayDescriptor.dimlen[ArrayDescriptor.dims], - (long[]) ArrayDescriptor.objs[ArrayDescriptor.dims - 1]); + arow = HDFNativeData.longToByte(0, ArrayDescriptor.dimlen[ArrayDescriptor.dims], + (long[]) ArrayDescriptor.objs[ArrayDescriptor.dims - 1]); + arow = HDFNativeData.longToByte(0, ArrayDescriptor.dimlen[ArrayDescriptor.dims], + (long[]) ArrayDescriptor.objs[ArrayDescriptor.dims - 1]); } else if (ArrayDescriptor.NT == 'I') { - arow = HDFNativeData - .intToByte( - 0, - ArrayDescriptor.dimlen[ArrayDescriptor.dims], - (int[]) ArrayDescriptor.objs[ArrayDescriptor.dims - 1]); + arow = HDFNativeData.intToByte(0, ArrayDescriptor.dimlen[ArrayDescriptor.dims], + (int[]) ArrayDescriptor.objs[ArrayDescriptor.dims - 1]); } else if (ArrayDescriptor.NT == 'S') { - arow = HDFNativeData - .shortToByte( - 0, - ArrayDescriptor.dimlen[ArrayDescriptor.dims], - (short[]) ArrayDescriptor.objs[ArrayDescriptor.dims - 1]); + arow = HDFNativeData.shortToByte(0, ArrayDescriptor.dimlen[ArrayDescriptor.dims], + (short[]) ArrayDescriptor.objs[ArrayDescriptor.dims - 1]); } else if (ArrayDescriptor.NT == 'B') { arow = (byte[]) ArrayDescriptor.objs[ArrayDescriptor.dims - 1]; } else if (ArrayDescriptor.NT == 'F') { /* 32 bit float */ - arow = HDFNativeData - .floatToByte( - 0, - ArrayDescriptor.dimlen[ArrayDescriptor.dims], - (float[]) ArrayDescriptor.objs[ArrayDescriptor.dims - 1]); + arow = HDFNativeData.floatToByte(0, ArrayDescriptor.dimlen[ArrayDescriptor.dims], + (float[]) ArrayDescriptor.objs[ArrayDescriptor.dims - 1]); } else if (ArrayDescriptor.NT == 'D') { /* 64 bit float */ - arow = HDFNativeData - .doubleToByte( - 0, - ArrayDescriptor.dimlen[ArrayDescriptor.dims], - (double[]) ArrayDescriptor.objs[ArrayDescriptor.dims - 1]); + arow = HDFNativeData.doubleToByte(0, ArrayDescriptor.dimlen[ArrayDescriptor.dims], + (double[]) ArrayDescriptor.objs[ArrayDescriptor.dims - 1]); } else if (ArrayDescriptor.NT == 'L') { if (ArrayDescriptor.className.equals("java.lang.Byte")) { arow = ByteObjToByte((Byte[]) ArrayDescriptor.objs[ArrayDescriptor.dims - 1]); } - else if (ArrayDescriptor.className - .equals("java.lang.Integer")) { + else if (ArrayDescriptor.className.equals("java.lang.Integer")) { arow = IntegerToByte((Integer[]) ArrayDescriptor.objs[ArrayDescriptor.dims - 1]); } - else if (ArrayDescriptor.className - .equals("java.lang.Short")) { + else if (ArrayDescriptor.className.equals("java.lang.Short")) { arow = ShortToByte((Short[]) ArrayDescriptor.objs[ArrayDescriptor.dims - 1]); } - else if (ArrayDescriptor.className - .equals("java.lang.Float")) { + else if (ArrayDescriptor.className.equals("java.lang.Float")) { arow = FloatObjToByte((Float[]) ArrayDescriptor.objs[ArrayDescriptor.dims - 1]); } - else if (ArrayDescriptor.className - .equals("java.lang.Double")) { + else if (ArrayDescriptor.className.equals("java.lang.Double")) { arow = DoubleObjToByte((Double[]) ArrayDescriptor.objs[ArrayDescriptor.dims - 1]); } else if (ArrayDescriptor.className.equals("java.lang.Long")) { arow = LongObjToByte((Long[]) ArrayDescriptor.objs[ArrayDescriptor.dims - 1]); } else { - HDF5JavaException ex = new HDF5JavaException( - "HDFArray: byteify Object type not implemented?"); + HDF5JavaException ex = new HDF5JavaException("HDFArray: byteify Object type not implemented?"); throw (ex); } } else { - HDF5JavaException ex = new HDF5JavaException( - "HDFArray: byteify unknown type not implemented?"); + HDF5JavaException ex = new HDF5JavaException("HDFArray: byteify unknown type not implemented?"); throw (ex); } - System - .arraycopy( - arow, - 0, - _barray, - n, - (ArrayDescriptor.dimlen[ArrayDescriptor.dims] * ArrayDescriptor.NTsize)); + System.arraycopy(arow, 0, _barray, n, + (ArrayDescriptor.dimlen[ArrayDescriptor.dims] * ArrayDescriptor.NTsize)); n += ArrayDescriptor.bytetoindex[ArrayDescriptor.dims - 1]; } catch (OutOfMemoryError err) { - HDF5JavaException ex = new HDF5JavaException( - "HDFArray: byteify array too big?"); + HDF5JavaException ex = new HDF5JavaException("HDFArray: byteify array too big?"); throw (ex); } } /* assert: the whole array is completed--currentindex should == len - 1 */ - /* error checks */ - if (n < ArrayDescriptor.totalSize) { - throw new java.lang.InternalError(new String( - "HDFArray::byteify: Panic didn't complete all input data: n= " - + n + " size = " + ArrayDescriptor.totalSize)); + throw new java.lang.InternalError(new String("HDFArray::byteify: Panic didn't complete all input data: n= " + + n + " size = " + ArrayDescriptor.totalSize)); } for (i = 0; i < ArrayDescriptor.dims; i++) { if (ArrayDescriptor.currentindex[i] != ArrayDescriptor.dimlen[i] - 1) { throw new java.lang.InternalError(new String( - "Panic didn't complete all data: currentindex[" + i - + "] = " + ArrayDescriptor.currentindex[i] - + " (should be " - + (ArrayDescriptor.dimlen[i] - 1) + " ?)")); + "Panic didn't complete all data: currentindex[" + i + "] = " + ArrayDescriptor.currentindex[i] + + " (should be " + (ArrayDescriptor.dimlen[i] - 1) + " ?)")); } } return _barray; } /** - * Given a one-dimensional array of bytes representing numbers, convert it - * to a java array of the shape and size passed to the constructor. + * Given a one-dimensional array of bytes representing numbers, convert it to a java array of the shape and size + * passed to the constructor. * * @param bytes - * The bytes to construct the Array. - * @return An Array (possibly multidimensional) of primitive or number - * objects. - * @exception hdf.hdf5lib.exceptions.HDF5JavaException - * the object not an array or other internal error. + * The bytes to construct the Array. + * @return + * An Array (possibly multidimensional) of primitive or number objects. + * @exception + * hdf.hdf5lib.exceptions.HDF5JavaException the object not an array or other internal error. */ - public Object arrayify(byte[] bytes) throws HDF5JavaException { - + public Object arrayify(byte[] bytes) throws HDF5JavaException + { if (_theArray == null) { /* exception: not an array */ - HDF5JavaException ex = new HDF5JavaException( - "arrayify: not an array?: "); + HDF5JavaException ex = new HDF5JavaException("arrayify: not an array?: "); throw (ex); } if (java.lang.reflect.Array.getLength(bytes) != ArrayDescriptor.totalSize) { /* exception: array not right size */ - HDF5JavaException ex = new HDF5JavaException( - "arrayify: array is wrong size?: "); + HDF5JavaException ex = new HDF5JavaException("arrayify: array is wrong size?: "); throw (ex); } _barray = bytes; /* hope that the bytes are correct.... */ @@ -402,95 +333,76 @@ public class HDFArray { try { if (ArrayDescriptor.NT == 'I') { int[] x = HDFNativeData.byteToInt(_barray); - System.arraycopy(x, 0, _theArray, 0, - ArrayDescriptor.dimlen[1]); + System.arraycopy(x, 0, _theArray, 0, ArrayDescriptor.dimlen[1]); return _theArray; } else if (ArrayDescriptor.NT == 'S') { short[] x = HDFNativeData.byteToShort(_barray); - System.arraycopy(x, 0, _theArray, 0, - ArrayDescriptor.dimlen[1]); + System.arraycopy(x, 0, _theArray, 0, ArrayDescriptor.dimlen[1]); return _theArray; } else if (ArrayDescriptor.NT == 'F') { float x[] = HDFNativeData.byteToFloat(_barray); - System.arraycopy(x, 0, _theArray, 0, - ArrayDescriptor.dimlen[1]); + System.arraycopy(x, 0, _theArray, 0, ArrayDescriptor.dimlen[1]); return _theArray; } else if (ArrayDescriptor.NT == 'J') { long x[] = HDFNativeData.byteToLong(_barray); - System.arraycopy(x, 0, _theArray, 0, - ArrayDescriptor.dimlen[1]); + System.arraycopy(x, 0, _theArray, 0, ArrayDescriptor.dimlen[1]); return _theArray; } else if (ArrayDescriptor.NT == 'D') { double x[] = HDFNativeData.byteToDouble(_barray); - System.arraycopy(x, 0, _theArray, 0, - ArrayDescriptor.dimlen[1]); + System.arraycopy(x, 0, _theArray, 0, ArrayDescriptor.dimlen[1]); return _theArray; } else if (ArrayDescriptor.NT == 'B') { - System.arraycopy(_barray, 0, _theArray, 0, - ArrayDescriptor.dimlen[1]); + System.arraycopy(_barray, 0, _theArray, 0, ArrayDescriptor.dimlen[1]); return _theArray; } else if (ArrayDescriptor.NT == 'L') { if (ArrayDescriptor.className.equals("java.lang.Byte")) { Byte I[] = ByteToByteObj(_barray); - System.arraycopy(I, 0, _theArray, 0, - ArrayDescriptor.dimlen[1]); + System.arraycopy(I, 0, _theArray, 0, ArrayDescriptor.dimlen[1]); return _theArray; } - else if (ArrayDescriptor.className - .equals("java.lang.Integer")) { + else if (ArrayDescriptor.className.equals("java.lang.Integer")) { Integer I[] = ByteToInteger(_barray); - System.arraycopy(I, 0, _theArray, 0, - ArrayDescriptor.dimlen[1]); + System.arraycopy(I, 0, _theArray, 0, ArrayDescriptor.dimlen[1]); return _theArray; } - else if (ArrayDescriptor.className - .equals("java.lang.Short")) { + else if (ArrayDescriptor.className.equals("java.lang.Short")) { Short I[] = ByteToShort(_barray); - System.arraycopy(I, 0, _theArray, 0, - ArrayDescriptor.dimlen[1]); + System.arraycopy(I, 0, _theArray, 0, ArrayDescriptor.dimlen[1]); return _theArray; } - else if (ArrayDescriptor.className - .equals("java.lang.Float")) { + else if (ArrayDescriptor.className.equals("java.lang.Float")) { Float I[] = ByteToFloatObj(_barray); - System.arraycopy(I, 0, _theArray, 0, - ArrayDescriptor.dimlen[1]); + System.arraycopy(I, 0, _theArray, 0, ArrayDescriptor.dimlen[1]); return _theArray; } - else if (ArrayDescriptor.className - .equals("java.lang.Double")) { + else if (ArrayDescriptor.className.equals("java.lang.Double")) { Double I[] = ByteToDoubleObj(_barray); - System.arraycopy(I, 0, _theArray, 0, - ArrayDescriptor.dimlen[1]); + System.arraycopy(I, 0, _theArray, 0, ArrayDescriptor.dimlen[1]); return _theArray; } else if (ArrayDescriptor.className.equals("java.lang.Long")) { Long I[] = ByteToLongObj(_barray); - System.arraycopy(I, 0, _theArray, 0, - ArrayDescriptor.dimlen[1]); + System.arraycopy(I, 0, _theArray, 0, ArrayDescriptor.dimlen[1]); return _theArray; } else { - HDF5JavaException ex = new HDF5JavaException( - "arrayify: Object type not implemented yet..."); + HDF5JavaException ex = new HDF5JavaException("arrayify: Object type not implemented yet..."); throw (ex); } } else { - HDF5JavaException ex = new HDF5JavaException( - "arrayify: unknown type not implemented yet..."); + HDF5JavaException ex = new HDF5JavaException("arrayify: unknown type not implemented yet..."); throw (ex); } } catch (OutOfMemoryError err) { - HDF5JavaException ex = new HDF5JavaException( - "HDFArray: arrayify array too big?"); + HDF5JavaException ex = new HDF5JavaException("HDFArray: arrayify array too big?"); throw (ex); } } @@ -502,6 +414,7 @@ public class HDFArray { int index = 0; int i; Object flattenedArray = null; + switch (ArrayDescriptor.NT) { case 'J': flattenedArray = (Object) HDFNativeData.byteToLong(_barray); @@ -522,36 +435,27 @@ public class HDFArray { flattenedArray = (Object) _barray; break; case 'L': - switch (ArrayDescriptor.className) { - case "java.lang.Byte": - flattenedArray = (Object) ByteToByteObj(_barray); - break; - case "java.lang.Short": - flattenedArray = (Object) ByteToShort(_barray); - break; - case "java.lang.Integer": - flattenedArray = (Object) ByteToInteger(_barray); - break; - case "java.lang.Long": - flattenedArray = (Object) ByteToLongObj(_barray); - break; - case "java.lang.Float": - flattenedArray = (Object) ByteToFloatObj(_barray); - break; - case "java.lang.Double": - flattenedArray = (Object) ByteToDoubleObj(_barray); - break; - default: - HDF5JavaException ex = new HDF5JavaException( - "HDFArray: unsupported Object type: " - + ArrayDescriptor.NT); - throw (ex); - } // end of switch statement for arrays of boxed objects - default: - HDF5JavaException ex = new HDF5JavaException( - "HDFArray: unknown or unsupported type: " - + ArrayDescriptor.NT); - throw (ex); + { + if (ArrayDescriptor.className.equals("java.lang.Byte")) + flattenedArray = (Object) ByteToByteObj(_barray); + else if (ArrayDescriptor.className.equals("java.lang.Short")) + flattenedArray = (Object) ByteToShort(_barray); + else if (ArrayDescriptor.className.equals("java.lang.Integer")) + flattenedArray = (Object) ByteToInteger(_barray); + else if (ArrayDescriptor.className.equals("java.lang.Long")) + flattenedArray = (Object) ByteToLongObj(_barray); + else if (ArrayDescriptor.className.equals("java.lang.Float")) + flattenedArray = (Object) ByteToFloatObj(_barray); + else if (ArrayDescriptor.className.equals("java.lang.Double")) + flattenedArray = (Object) ByteToDoubleObj(_barray); + else { + HDF5JavaException ex = new HDF5JavaException("HDFArray: unsupported Object type: " + ArrayDescriptor.NT); + throw (ex); + } + } // end of statement for arrays of boxed objects + default: + HDF5JavaException ex = new HDF5JavaException("HDFArray: unknown or unsupported type: " + ArrayDescriptor.NT); + throw (ex); } // end of switch statement for arrays of primitives while (n < ArrayDescriptor.totalSize) { @@ -580,7 +484,6 @@ public class HDFArray { /* array-ify */ try { - Object arow = null; int mm = m + ArrayDescriptor.dimlen[ArrayDescriptor.dims]; switch (ArrayDescriptor.NT) { @@ -603,75 +506,64 @@ public class HDFArray { arow = (Object) Arrays.copyOfRange((double[]) flattenedArray, m, mm); break; case 'L': - switch (ArrayDescriptor.className) { - case "java.lang.Byte": - arow = (Object) Arrays.copyOfRange((Byte[])flattenedArray, m, mm); - break; - case "java.lang.Short": - arow = (Object) Arrays.copyOfRange((Short[])flattenedArray, m, mm); - break; - case "java.lang.Integer": - arow = (Object) Arrays.copyOfRange((Integer[])flattenedArray, m, mm); - break; - case "java.lang.Long": - arow = (Object) Arrays.copyOfRange((Long[])flattenedArray, m, mm); - break; - case "java.lang.Float": - arow = (Object) Arrays.copyOfRange((Float[])flattenedArray, m, mm); - break; - case "java.lang.Double": - arow = (Object) Arrays.copyOfRange((Double[])flattenedArray, m, mm); - break; - } // end of switch statement for arrays of boxed numerics + { + if (ArrayDescriptor.className.equals("java.lang.Byte")) + arow = (Object) Arrays.copyOfRange((Byte[]) flattenedArray, m, mm); + else if (ArrayDescriptor.className.equals("java.lang.Short")) + arow = (Object) Arrays.copyOfRange((Short[]) flattenedArray, m, mm); + else if (ArrayDescriptor.className.equals("java.lang.Integer")) + arow = (Object) Arrays.copyOfRange((Integer[]) flattenedArray, m, mm); + else if (ArrayDescriptor.className.equals("java.lang.Long")) + arow = (Object) Arrays.copyOfRange((Long[]) flattenedArray, m, mm); + else if (ArrayDescriptor.className.equals("java.lang.Float")) + arow = (Object) Arrays.copyOfRange((Float[]) flattenedArray, m, mm); + else if (ArrayDescriptor.className.equals("java.lang.Double")) + arow = (Object) Arrays.copyOfRange((Double[]) flattenedArray, m, mm); + else { + HDF5JavaException ex = new HDF5JavaException("HDFArray: unsupported Object type: " + ArrayDescriptor.NT); + throw (ex); + } + } // end of statement for arrays of boxed numerics } // end of switch statement for arrays of primitives - java.lang.reflect.Array.set( - ArrayDescriptor.objs[ArrayDescriptor.dims - 2], - (ArrayDescriptor.currentindex[ArrayDescriptor.dims - 1]), - arow); + java.lang.reflect.Array.set(ArrayDescriptor.objs[ArrayDescriptor.dims - 2], + (ArrayDescriptor.currentindex[ArrayDescriptor.dims - 1]), arow); n += ArrayDescriptor.bytetoindex[ArrayDescriptor.dims - 1]; ArrayDescriptor.currentindex[ArrayDescriptor.dims - 1]++; m = mm; } catch (OutOfMemoryError err) { - HDF5JavaException ex = new HDF5JavaException( - "HDFArray: arrayify array too big?"); + HDF5JavaException ex = new HDF5JavaException("HDFArray: arrayify array too big?"); throw (ex); } - } /* assert: the whole array is completed--currentindex should == len - 1 */ - /* error checks */ - if (n < ArrayDescriptor.totalSize) { - throw new java.lang.InternalError(new String( - "HDFArray::arrayify Panic didn't complete all input data: n= " - + n + " size = " + ArrayDescriptor.totalSize)); + throw new java.lang.InternalError(new String("HDFArray::arrayify Panic didn't complete all input data: n= " + + n + " size = " + ArrayDescriptor.totalSize)); } for (i = 0; i <= ArrayDescriptor.dims - 2; i++) { if (ArrayDescriptor.currentindex[i] != ArrayDescriptor.dimlen[i] - 1) { - throw new java.lang.InternalError(new String( - "HDFArray::arrayify Panic didn't complete all data: currentindex[" - + i + "] = " + ArrayDescriptor.currentindex[i] - + " (should be " - + (ArrayDescriptor.dimlen[i] - 1) + "?")); + throw new java.lang.InternalError( + new String("HDFArray::arrayify Panic didn't complete all data: currentindex[" + i + "] = " + + ArrayDescriptor.currentindex[i] + " (should be " + (ArrayDescriptor.dimlen[i] - 1) + + "?")); } } - if (ArrayDescriptor.currentindex[ArrayDescriptor.dims - 1] != ArrayDescriptor.dimlen[ArrayDescriptor.dims - 1]) { - throw new java.lang.InternalError(new String( - "HDFArray::arrayify Panic didn't complete all data: currentindex[" - + i + "] = " + ArrayDescriptor.currentindex[i] - + " (should be " + (ArrayDescriptor.dimlen[i]) - + "?")); + if (ArrayDescriptor.currentindex[ArrayDescriptor.dims - 1] != ArrayDescriptor.dimlen[ArrayDescriptor.dims + - 1]) { + throw new java.lang.InternalError( + new String("HDFArray::arrayify Panic didn't complete all data: currentindex[" + i + "] = " + + ArrayDescriptor.currentindex[i] + " (should be " + (ArrayDescriptor.dimlen[i]) + "?")); } - return _theArray; } - private byte[] IntegerToByte(Integer in[]) { + private byte[] IntegerToByte(Integer in[]) + { int nelems = java.lang.reflect.Array.getLength(in); int[] out = new int[nelems]; @@ -681,7 +573,8 @@ public class HDFArray { return HDFNativeData.intToByte(0, nelems, out); } - private Integer[] ByteToInteger(byte[] bin) { + private Integer[] ByteToInteger(byte[] bin) + { int in[] = HDFNativeData.byteToInt(bin); int nelems = java.lang.reflect.Array.getLength(in); Integer[] out = new Integer[nelems]; @@ -692,7 +585,8 @@ public class HDFArray { return out; } - private Integer[] ByteToInteger(int start, int len, byte[] bin) { + private Integer[] ByteToInteger(int start, int len, byte[] bin) + { int in[] = HDFNativeData.byteToInt(start, len, bin); int nelems = java.lang.reflect.Array.getLength(in); Integer[] out = new Integer[nelems]; @@ -703,7 +597,8 @@ public class HDFArray { return out; } - private byte[] ShortToByte(Short in[]) { + private byte[] ShortToByte(Short in[]) + { int nelems = java.lang.reflect.Array.getLength(in); short[] out = new short[nelems]; @@ -713,7 +608,8 @@ public class HDFArray { return HDFNativeData.shortToByte(0, nelems, out); } - private Short[] ByteToShort(byte[] bin) { + private Short[] ByteToShort(byte[] bin) + { short in[] = HDFNativeData.byteToShort(bin); int nelems = java.lang.reflect.Array.getLength((Object) in); Short[] out = new Short[nelems]; @@ -724,7 +620,8 @@ public class HDFArray { return out; } - private Short[] ByteToShort(int start, int len, byte[] bin) { + private Short[] ByteToShort(int start, int len, byte[] bin) + { short in[] = (short[]) HDFNativeData.byteToShort(start, len, bin); int nelems = java.lang.reflect.Array.getLength((Object) in); Short[] out = new Short[nelems]; @@ -735,7 +632,8 @@ public class HDFArray { return out; } - private byte[] ByteObjToByte(Byte in[]) { + private byte[] ByteObjToByte(Byte in[]) + { int nelems = java.lang.reflect.Array.getLength((Object) in); byte[] out = new byte[nelems]; @@ -745,7 +643,8 @@ public class HDFArray { return out; } - private Byte[] ByteToByteObj(byte[] bin) { + private Byte[] ByteToByteObj(byte[] bin) + { int nelems = java.lang.reflect.Array.getLength((Object) bin); Byte[] out = new Byte[nelems]; @@ -755,7 +654,8 @@ public class HDFArray { return out; } - private Byte[] ByteToByteObj(int start, int len, byte[] bin) { + private Byte[] ByteToByteObj(int start, int len, byte[] bin) + { Byte[] out = new Byte[len]; for (int i = 0; i < len; i++) { @@ -764,7 +664,8 @@ public class HDFArray { return out; } - private byte[] FloatObjToByte(Float in[]) { + private byte[] FloatObjToByte(Float in[]) + { int nelems = java.lang.reflect.Array.getLength((Object) in); float[] out = new float[nelems]; @@ -774,7 +675,8 @@ public class HDFArray { return HDFNativeData.floatToByte(0, nelems, out); } - private Float[] ByteToFloatObj(byte[] bin) { + private Float[] ByteToFloatObj(byte[] bin) + { float in[] = (float[]) HDFNativeData.byteToFloat(bin); int nelems = java.lang.reflect.Array.getLength((Object) in); Float[] out = new Float[nelems]; @@ -785,7 +687,8 @@ public class HDFArray { return out; } - private Float[] ByteToFloatObj(int start, int len, byte[] bin) { + private Float[] ByteToFloatObj(int start, int len, byte[] bin) + { float in[] = (float[]) HDFNativeData.byteToFloat(start, len, bin); int nelems = java.lang.reflect.Array.getLength((Object) in); Float[] out = new Float[nelems]; @@ -796,7 +699,8 @@ public class HDFArray { return out; } - private byte[] DoubleObjToByte(Double in[]) { + private byte[] DoubleObjToByte(Double in[]) + { int nelems = java.lang.reflect.Array.getLength((Object) in); double[] out = new double[nelems]; @@ -806,7 +710,8 @@ public class HDFArray { return HDFNativeData.doubleToByte(0, nelems, out); } - private Double[] ByteToDoubleObj(byte[] bin) { + private Double[] ByteToDoubleObj(byte[] bin) + { double in[] = (double[]) HDFNativeData.byteToDouble(bin); int nelems = java.lang.reflect.Array.getLength((Object) in); Double[] out = new Double[nelems]; @@ -817,7 +722,8 @@ public class HDFArray { return out; } - private Double[] ByteToDoubleObj(int start, int len, byte[] bin) { + private Double[] ByteToDoubleObj(int start, int len, byte[] bin) + { double in[] = (double[]) HDFNativeData.byteToDouble(start, len, bin); int nelems = java.lang.reflect.Array.getLength((Object) in); Double[] out = new Double[nelems]; @@ -828,7 +734,8 @@ public class HDFArray { return out; } - private byte[] LongObjToByte(Long in[]) { + private byte[] LongObjToByte(Long in[]) + { int nelems = java.lang.reflect.Array.getLength((Object) in); long[] out = new long[nelems]; @@ -838,7 +745,8 @@ public class HDFArray { return HDFNativeData.longToByte(0, nelems, out); } - private Long[] ByteToLongObj(byte[] bin) { + private Long[] ByteToLongObj(byte[] bin) + { long in[] = (long[]) HDFNativeData.byteToLong(bin); int nelems = java.lang.reflect.Array.getLength((Object) in); Long[] out = new Long[nelems]; @@ -849,7 +757,8 @@ public class HDFArray { return out; } - private Long[] ByteToLongObj(int start, int len, byte[] bin) { + private Long[] ByteToLongObj(int start, int len, byte[] bin) + { long in[] = (long[]) HDFNativeData.byteToLong(start, len, bin); int nelems = java.lang.reflect.Array.getLength((Object) in); Long[] out = new Long[nelems]; @@ -862,13 +771,11 @@ public class HDFArray { } /** - * This private class is used by HDFArray to discover the shape and type of an - * arbitrary array. + * This private class is used by HDFArray to discover the shape and type of an arbitrary array. *

* We use java.lang.reflection here. */ class ArrayDescriptor { - static String theType = ""; static Class theClass = null; static int[] dimlen = null; @@ -883,13 +790,12 @@ class ArrayDescriptor { static int dims = 0; static String className; - public ArrayDescriptor(Object anArray) throws HDF5Exception { - + public ArrayDescriptor(Object anArray) throws HDF5Exception + { Class tc = anArray.getClass(); if (tc.isArray() == false) { /* exception: not an array */ - HDF5Exception ex = new HDF5JavaException( - "ArrayDescriptor: not an array?: "); + HDF5Exception ex = new HDF5JavaException("ArrayDescriptor: not an array?: "); throw (ex); } @@ -921,10 +827,12 @@ class ArrayDescriptor { else if (NT == 'S') { NTsize = 2; } - else if ((NT == 'I') || (NT == 'F')) { + else if ((NT == 'I') + || (NT == 'F')) { NTsize = 4; } - else if ((NT == 'J') || (NT == 'D')) { + else if ((NT == 'J') + || (NT == 'D')) { NTsize = 8; } else if (css.startsWith("Ljava.lang.Byte")) { @@ -961,16 +869,14 @@ class ArrayDescriptor { NT = 'L'; className = "java.lang.String"; NTsize = 1; - throw new HDF5JavaException(new String( - "ArrayDesciptor: Warning: String array not fully supported yet")); + throw new HDF5JavaException(new String("ArrayDesciptor: Warning: String array not fully supported yet")); } else { /* * exception: not a numeric type */ - throw new HDF5JavaException(new String( - "ArrayDesciptor: Error: array is not numeric (type is " - + css + ") ?")); + throw new HDF5JavaException( + new String("ArrayDesciptor: Error: array is not numeric (type is " + css + ") ?")); } /* fill in the table */ @@ -1014,20 +920,19 @@ class ArrayDescriptor { /** * Debug dump */ - public void dumpInfo() { + public void dumpInfo() + { System.out.println("Type: " + theType); System.out.println("Class: " + theClass); System.out.println("NT: " + NT + " NTsize: " + NTsize); - System.out.println("Array has " + dims + " dimensions (" + totalSize - + " bytes, " + totalElements + " elements)"); + System.out + .println("Array has " + dims + " dimensions (" + totalSize + " bytes, " + totalElements + " elements)"); int i; for (i = 0; i <= dims; i++) { Class tc = objs[i].getClass(); String ss = tc.toString(); - System.out.println(i + ": start " + dimstart[i] + ": len " - + dimlen[i] + " current " + currentindex[i] - + " bytetoindex " + bytetoindex[i] + " object " + objs[i] - + " otype " + ss); + System.out.println(i + ": start " + dimstart[i] + ": len " + dimlen[i] + " current " + currentindex[i] + + " bytetoindex " + bytetoindex[i] + " object " + objs[i] + " otype " + ss); } } } diff --git a/java/src/hdf/hdf5lib/callbacks/Callbacks.java b/java/src/hdf/hdf5lib/callbacks/Callbacks.java index e2033fa..11fa465 100644 --- a/java/src/hdf/hdf5lib/callbacks/Callbacks.java +++ b/java/src/hdf/hdf5lib/callbacks/Callbacks.java @@ -1,6 +1,5 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * 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 * diff --git a/java/src/hdf/hdf5lib/callbacks/H5A_iterate_cb.java b/java/src/hdf/hdf5lib/callbacks/H5A_iterate_cb.java index d02c8d1..6c68f36 100644 --- a/java/src/hdf/hdf5lib/callbacks/H5A_iterate_cb.java +++ b/java/src/hdf/hdf5lib/callbacks/H5A_iterate_cb.java @@ -1,6 +1,5 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * 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 * diff --git a/java/src/hdf/hdf5lib/callbacks/H5A_iterate_t.java b/java/src/hdf/hdf5lib/callbacks/H5A_iterate_t.java index fb5ca27..d612db3 100644 --- a/java/src/hdf/hdf5lib/callbacks/H5A_iterate_t.java +++ b/java/src/hdf/hdf5lib/callbacks/H5A_iterate_t.java @@ -1,6 +1,5 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * 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 * diff --git a/java/src/hdf/hdf5lib/callbacks/H5D_append_cb.java b/java/src/hdf/hdf5lib/callbacks/H5D_append_cb.java index 1ec3a54..cf7ada6 100644 --- a/java/src/hdf/hdf5lib/callbacks/H5D_append_cb.java +++ b/java/src/hdf/hdf5lib/callbacks/H5D_append_cb.java @@ -1,6 +1,5 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * 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 * diff --git a/java/src/hdf/hdf5lib/callbacks/H5D_append_t.java b/java/src/hdf/hdf5lib/callbacks/H5D_append_t.java index c4d88ce..7fdb454 100644 --- a/java/src/hdf/hdf5lib/callbacks/H5D_append_t.java +++ b/java/src/hdf/hdf5lib/callbacks/H5D_append_t.java @@ -1,6 +1,5 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * 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 * diff --git a/java/src/hdf/hdf5lib/callbacks/H5D_iterate_cb.java b/java/src/hdf/hdf5lib/callbacks/H5D_iterate_cb.java index d397b2f..54c12e3 100644 --- a/java/src/hdf/hdf5lib/callbacks/H5D_iterate_cb.java +++ b/java/src/hdf/hdf5lib/callbacks/H5D_iterate_cb.java @@ -1,6 +1,5 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * 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 * diff --git a/java/src/hdf/hdf5lib/callbacks/H5D_iterate_t.java b/java/src/hdf/hdf5lib/callbacks/H5D_iterate_t.java index a852d06..305cf98 100644 --- a/java/src/hdf/hdf5lib/callbacks/H5D_iterate_t.java +++ b/java/src/hdf/hdf5lib/callbacks/H5D_iterate_t.java @@ -1,6 +1,5 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * 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 * diff --git a/java/src/hdf/hdf5lib/callbacks/H5E_walk_cb.java b/java/src/hdf/hdf5lib/callbacks/H5E_walk_cb.java index 69dce0e..5722195 100644 --- a/java/src/hdf/hdf5lib/callbacks/H5E_walk_cb.java +++ b/java/src/hdf/hdf5lib/callbacks/H5E_walk_cb.java @@ -1,6 +1,5 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * 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 * diff --git a/java/src/hdf/hdf5lib/callbacks/H5E_walk_t.java b/java/src/hdf/hdf5lib/callbacks/H5E_walk_t.java index ea11510..5bf0c8b 100644 --- a/java/src/hdf/hdf5lib/callbacks/H5E_walk_t.java +++ b/java/src/hdf/hdf5lib/callbacks/H5E_walk_t.java @@ -1,6 +1,5 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * 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 * diff --git a/java/src/hdf/hdf5lib/callbacks/H5L_iterate_opdata_t.java b/java/src/hdf/hdf5lib/callbacks/H5L_iterate_opdata_t.java index d0c07c0..d89fd2a 100644 --- a/java/src/hdf/hdf5lib/callbacks/H5L_iterate_opdata_t.java +++ b/java/src/hdf/hdf5lib/callbacks/H5L_iterate_opdata_t.java @@ -1,6 +1,5 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * 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 * diff --git a/java/src/hdf/hdf5lib/callbacks/H5L_iterate_t.java b/java/src/hdf/hdf5lib/callbacks/H5L_iterate_t.java index a93e76d..53635bf 100644 --- a/java/src/hdf/hdf5lib/callbacks/H5L_iterate_t.java +++ b/java/src/hdf/hdf5lib/callbacks/H5L_iterate_t.java @@ -1,6 +1,5 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * 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 * diff --git a/java/src/hdf/hdf5lib/callbacks/H5O_iterate_opdata_t.java b/java/src/hdf/hdf5lib/callbacks/H5O_iterate_opdata_t.java index 42d0db1..fd643b4 100644 --- a/java/src/hdf/hdf5lib/callbacks/H5O_iterate_opdata_t.java +++ b/java/src/hdf/hdf5lib/callbacks/H5O_iterate_opdata_t.java @@ -1,6 +1,5 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * 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 * diff --git a/java/src/hdf/hdf5lib/callbacks/H5O_iterate_t.java b/java/src/hdf/hdf5lib/callbacks/H5O_iterate_t.java index 3a59c6b..ecf868c 100644 --- a/java/src/hdf/hdf5lib/callbacks/H5O_iterate_t.java +++ b/java/src/hdf/hdf5lib/callbacks/H5O_iterate_t.java @@ -1,6 +1,5 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * 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 * diff --git a/java/src/hdf/hdf5lib/callbacks/H5P_cls_close_func_cb.java b/java/src/hdf/hdf5lib/callbacks/H5P_cls_close_func_cb.java index ad9682a..0a09a94 100644 --- a/java/src/hdf/hdf5lib/callbacks/H5P_cls_close_func_cb.java +++ b/java/src/hdf/hdf5lib/callbacks/H5P_cls_close_func_cb.java @@ -1,6 +1,5 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * 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 * diff --git a/java/src/hdf/hdf5lib/callbacks/H5P_cls_close_func_t.java b/java/src/hdf/hdf5lib/callbacks/H5P_cls_close_func_t.java index fd17222..11e3a99 100644 --- a/java/src/hdf/hdf5lib/callbacks/H5P_cls_close_func_t.java +++ b/java/src/hdf/hdf5lib/callbacks/H5P_cls_close_func_t.java @@ -1,6 +1,5 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * 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 * diff --git a/java/src/hdf/hdf5lib/callbacks/H5P_cls_copy_func_cb.java b/java/src/hdf/hdf5lib/callbacks/H5P_cls_copy_func_cb.java index 36a085b..53f86be 100644 --- a/java/src/hdf/hdf5lib/callbacks/H5P_cls_copy_func_cb.java +++ b/java/src/hdf/hdf5lib/callbacks/H5P_cls_copy_func_cb.java @@ -1,6 +1,5 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * 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 * diff --git a/java/src/hdf/hdf5lib/callbacks/H5P_cls_copy_func_t.java b/java/src/hdf/hdf5lib/callbacks/H5P_cls_copy_func_t.java index 9e1d929..78e5282 100644 --- a/java/src/hdf/hdf5lib/callbacks/H5P_cls_copy_func_t.java +++ b/java/src/hdf/hdf5lib/callbacks/H5P_cls_copy_func_t.java @@ -1,6 +1,5 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * 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 * diff --git a/java/src/hdf/hdf5lib/callbacks/H5P_cls_create_func_cb.java b/java/src/hdf/hdf5lib/callbacks/H5P_cls_create_func_cb.java index cf51171..8f4e782 100644 --- a/java/src/hdf/hdf5lib/callbacks/H5P_cls_create_func_cb.java +++ b/java/src/hdf/hdf5lib/callbacks/H5P_cls_create_func_cb.java @@ -1,6 +1,5 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * 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 * diff --git a/java/src/hdf/hdf5lib/callbacks/H5P_cls_create_func_t.java b/java/src/hdf/hdf5lib/callbacks/H5P_cls_create_func_t.java index b7e21a1..d919d97 100644 --- a/java/src/hdf/hdf5lib/callbacks/H5P_cls_create_func_t.java +++ b/java/src/hdf/hdf5lib/callbacks/H5P_cls_create_func_t.java @@ -1,6 +1,5 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * 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 * diff --git a/java/src/hdf/hdf5lib/callbacks/H5P_iterate_cb.java b/java/src/hdf/hdf5lib/callbacks/H5P_iterate_cb.java index f9cfd99..db98a67 100644 --- a/java/src/hdf/hdf5lib/callbacks/H5P_iterate_cb.java +++ b/java/src/hdf/hdf5lib/callbacks/H5P_iterate_cb.java @@ -1,6 +1,5 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * 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 * diff --git a/java/src/hdf/hdf5lib/callbacks/H5P_iterate_t.java b/java/src/hdf/hdf5lib/callbacks/H5P_iterate_t.java index a591b1d..0035619 100644 --- a/java/src/hdf/hdf5lib/callbacks/H5P_iterate_t.java +++ b/java/src/hdf/hdf5lib/callbacks/H5P_iterate_t.java @@ -1,6 +1,5 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * 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 * diff --git a/java/src/hdf/hdf5lib/callbacks/H5P_prp_close_func_cb.java b/java/src/hdf/hdf5lib/callbacks/H5P_prp_close_func_cb.java index b1552a7..1aa7ce4 100644 --- a/java/src/hdf/hdf5lib/callbacks/H5P_prp_close_func_cb.java +++ b/java/src/hdf/hdf5lib/callbacks/H5P_prp_close_func_cb.java @@ -1,6 +1,5 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * 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 * diff --git a/java/src/hdf/hdf5lib/callbacks/H5P_prp_compare_func_cb.java b/java/src/hdf/hdf5lib/callbacks/H5P_prp_compare_func_cb.java index e1d7f21..49cef7d 100644 --- a/java/src/hdf/hdf5lib/callbacks/H5P_prp_compare_func_cb.java +++ b/java/src/hdf/hdf5lib/callbacks/H5P_prp_compare_func_cb.java @@ -1,6 +1,5 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * 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 * diff --git a/java/src/hdf/hdf5lib/callbacks/H5P_prp_copy_func_cb.java b/java/src/hdf/hdf5lib/callbacks/H5P_prp_copy_func_cb.java index a28e27b..f4924ee 100644 --- a/java/src/hdf/hdf5lib/callbacks/H5P_prp_copy_func_cb.java +++ b/java/src/hdf/hdf5lib/callbacks/H5P_prp_copy_func_cb.java @@ -1,6 +1,5 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * 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 * diff --git a/java/src/hdf/hdf5lib/callbacks/H5P_prp_create_func_cb.java b/java/src/hdf/hdf5lib/callbacks/H5P_prp_create_func_cb.java index 3a396fc..bce024b 100644 --- a/java/src/hdf/hdf5lib/callbacks/H5P_prp_create_func_cb.java +++ b/java/src/hdf/hdf5lib/callbacks/H5P_prp_create_func_cb.java @@ -1,6 +1,5 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * 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 * diff --git a/java/src/hdf/hdf5lib/callbacks/H5P_prp_delete_func_cb.java b/java/src/hdf/hdf5lib/callbacks/H5P_prp_delete_func_cb.java index db6487d..8c5dccc 100644 --- a/java/src/hdf/hdf5lib/callbacks/H5P_prp_delete_func_cb.java +++ b/java/src/hdf/hdf5lib/callbacks/H5P_prp_delete_func_cb.java @@ -1,6 +1,5 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * 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 * diff --git a/java/src/hdf/hdf5lib/callbacks/H5P_prp_get_func_cb.java b/java/src/hdf/hdf5lib/callbacks/H5P_prp_get_func_cb.java index dacf4ad..0f3457f 100644 --- a/java/src/hdf/hdf5lib/callbacks/H5P_prp_get_func_cb.java +++ b/java/src/hdf/hdf5lib/callbacks/H5P_prp_get_func_cb.java @@ -1,6 +1,5 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * 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 * diff --git a/java/src/hdf/hdf5lib/callbacks/H5P_prp_set_func_cb.java b/java/src/hdf/hdf5lib/callbacks/H5P_prp_set_func_cb.java index 4440d82..a55ca3a 100644 --- a/java/src/hdf/hdf5lib/callbacks/H5P_prp_set_func_cb.java +++ b/java/src/hdf/hdf5lib/callbacks/H5P_prp_set_func_cb.java @@ -1,6 +1,5 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * 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 * diff --git a/java/src/hdf/hdf5lib/structs/H5AC_cache_config_t.java b/java/src/hdf/hdf5lib/structs/H5AC_cache_config_t.java index c658489..9f04211 100644 --- a/java/src/hdf/hdf5lib/structs/H5AC_cache_config_t.java +++ b/java/src/hdf/hdf5lib/structs/H5AC_cache_config_t.java @@ -1,6 +1,5 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * 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 * diff --git a/java/src/hdf/hdf5lib/structs/H5A_info_t.java b/java/src/hdf/hdf5lib/structs/H5A_info_t.java index a274551..f2c10f0 100644 --- a/java/src/hdf/hdf5lib/structs/H5A_info_t.java +++ b/java/src/hdf/hdf5lib/structs/H5A_info_t.java @@ -1,6 +1,5 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * 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 * @@ -21,10 +20,14 @@ import java.io.Serializable; */ public class H5A_info_t implements Serializable{ private static final long serialVersionUID = 2791443594041667613L; - public boolean corder_valid; // Indicate if creation order is valid - public long corder; // Creation order of attribute - public int cset; // Character set of attribute name - public long data_size; // Size of raw data + /** Indicate if creation order is valid */ + public boolean corder_valid; + /** Creation order of attribute */ + public long corder; + /** Character set of attribute name */ + public int cset; + /** Size of raw data */ + public long data_size; H5A_info_t(boolean corder_valid, long corder, int cset, long data_size) { this.corder_valid = corder_valid; diff --git a/java/src/hdf/hdf5lib/structs/H5E_error2_t.java b/java/src/hdf/hdf5lib/structs/H5E_error2_t.java index 16816ea..e074156 100644 --- a/java/src/hdf/hdf5lib/structs/H5E_error2_t.java +++ b/java/src/hdf/hdf5lib/structs/H5E_error2_t.java @@ -1,6 +1,5 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * 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 * diff --git a/java/src/hdf/hdf5lib/structs/H5F_info2_t.java b/java/src/hdf/hdf5lib/structs/H5F_info2_t.java index 8baaa43..bb87201 100644 --- a/java/src/hdf/hdf5lib/structs/H5F_info2_t.java +++ b/java/src/hdf/hdf5lib/structs/H5F_info2_t.java @@ -1,6 +1,5 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * 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 * diff --git a/java/src/hdf/hdf5lib/structs/H5G_info_t.java b/java/src/hdf/hdf5lib/structs/H5G_info_t.java index e6f42b7..6d4f405 100644 --- a/java/src/hdf/hdf5lib/structs/H5G_info_t.java +++ b/java/src/hdf/hdf5lib/structs/H5G_info_t.java @@ -1,6 +1,5 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * 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 * diff --git a/java/src/hdf/hdf5lib/structs/H5L_info_t.java b/java/src/hdf/hdf5lib/structs/H5L_info_t.java index 2c25f7c..eaf0da5 100644 --- a/java/src/hdf/hdf5lib/structs/H5L_info_t.java +++ b/java/src/hdf/hdf5lib/structs/H5L_info_t.java @@ -1,6 +1,5 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * 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 * diff --git a/java/src/hdf/hdf5lib/structs/H5O_hdr_info_t.java b/java/src/hdf/hdf5lib/structs/H5O_hdr_info_t.java index e4f20c6..9a1749d 100644 --- a/java/src/hdf/hdf5lib/structs/H5O_hdr_info_t.java +++ b/java/src/hdf/hdf5lib/structs/H5O_hdr_info_t.java @@ -1,6 +1,5 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * 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 * diff --git a/java/src/hdf/hdf5lib/structs/H5O_info_t.java b/java/src/hdf/hdf5lib/structs/H5O_info_t.java index bd076d6..cc94247 100644 --- a/java/src/hdf/hdf5lib/structs/H5O_info_t.java +++ b/java/src/hdf/hdf5lib/structs/H5O_info_t.java @@ -1,6 +1,5 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * 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 * diff --git a/java/src/hdf/hdf5lib/structs/H5O_native_info_t.java b/java/src/hdf/hdf5lib/structs/H5O_native_info_t.java index 0b19bcb..ff801e8 100644 --- a/java/src/hdf/hdf5lib/structs/H5O_native_info_t.java +++ b/java/src/hdf/hdf5lib/structs/H5O_native_info_t.java @@ -1,6 +1,5 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * 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 * diff --git a/java/src/hdf/hdf5lib/structs/H5_ih_info_t.java b/java/src/hdf/hdf5lib/structs/H5_ih_info_t.java index 96082ab..0551469 100644 --- a/java/src/hdf/hdf5lib/structs/H5_ih_info_t.java +++ b/java/src/hdf/hdf5lib/structs/H5_ih_info_t.java @@ -1,6 +1,5 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * 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 * diff --git a/java/src/jni/Makefile.am b/java/src/jni/Makefile.am index 96973d4..bf086d2 100644 --- a/java/src/jni/Makefile.am +++ b/java/src/jni/Makefile.am @@ -1,6 +1,5 @@ # # 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 diff --git a/java/src/jni/exceptionImp.h b/java/src/jni/exceptionImp.h index 4b81605..72edf4c 100644 --- a/java/src/jni/exceptionImp.h +++ b/java/src/jni/exceptionImp.h @@ -1,6 +1,5 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * 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 * diff --git a/java/src/jni/h5Constants.c b/java/src/jni/h5Constants.c index 06fc606..ee1448b 100644 --- a/java/src/jni/h5Constants.c +++ b/java/src/jni/h5Constants.c @@ -1403,7 +1403,7 @@ Java_hdf_hdf5lib_HDF5Constants_H5FD_1DIRECT(JNIEnv *env, jclass cls) #ifdef H5_HAVE_DIRECT return H5FD_DIRECT; #else - return -1; + return H5I_INVALID_HID; #endif } JNIEXPORT jlong JNICALL @@ -1417,7 +1417,7 @@ Java_hdf_hdf5lib_HDF5Constants_H5FD_1HDFS(JNIEnv *env, jclass cls) #ifdef H5_HAVE_LIBHDFS return H5FD_HDFS; #else - return -1; + return H5I_INVALID_HID; #endif } JNIEXPORT jlong JNICALL @@ -1446,7 +1446,7 @@ Java_hdf_hdf5lib_HDF5Constants_H5FD_1ROS3(JNIEnv *env, jclass cls) #ifdef H5_HAVE_ROS3_VFD return H5FD_ROS3; #else - return -1; + return H5I_INVALID_HID; #endif } JNIEXPORT jlong JNICALL @@ -1460,7 +1460,7 @@ Java_hdf_hdf5lib_HDF5Constants_H5FD_1WINDOWS(JNIEnv *env, jclass cls) #ifdef H5_HAVE_WINDOWS return H5FD_DIRECT; #else - return -1; + return H5I_INVALID_HID; #endif } JNIEXPORT jint JNICALL diff --git a/java/src/jni/h5Imp.h b/java/src/jni/h5Imp.h index 226a2fe..776f295 100644 --- a/java/src/jni/h5Imp.h +++ b/java/src/jni/h5Imp.h @@ -1,6 +1,5 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * 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 * diff --git a/java/src/jni/h5aImp.c b/java/src/jni/h5aImp.c index c365144..6bf86d0 100644 --- a/java/src/jni/h5aImp.c +++ b/java/src/jni/h5aImp.c @@ -1133,7 +1133,7 @@ H5AreadVL_asstr(JNIEnv *env, hid_t aid, hid_t tid, jobjectArray buf) for (i = 0; i < (size_t)n; i++) { h5str.s[0] = '\0'; - if (!h5str_sprintf(ENVONLY, &h5str, aid, tid, &(((char *)readBuf)[i * typeSize]), typeSize, 0)) + if (!h5str_sprintf(ENVONLY, &h5str, aid, tid, &(((char *)readBuf)[i * typeSize]), 0)) CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE); if (NULL == (jstr = ENVPTR->NewStringUTF(ENVONLY, h5str.s))) @@ -1425,7 +1425,7 @@ Java_hdf_hdf5lib_H5_H5Aread_1reg_1ref(JNIEnv *env, jclass clss, jlong attr_id, j for (i = 0; i < n; i++) { h5str.s[0] = '\0'; - if (!h5str_sprintf(ENVONLY, &h5str, (hid_t)attr_id, (hid_t)mem_type_id, (void *)&ref_data[i], 0, 0)) + if (!h5str_sprintf(ENVONLY, &h5str, (hid_t)attr_id, (hid_t)mem_type_id, (void *)&ref_data[i], 0)) CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE); if (NULL == (jstr = ENVPTR->NewStringUTF(ENVONLY, h5str.s))) diff --git a/java/src/jni/h5aImp.h b/java/src/jni/h5aImp.h index 7615946..3d9a230 100644 --- a/java/src/jni/h5aImp.h +++ b/java/src/jni/h5aImp.h @@ -1,6 +1,5 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * 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 * diff --git a/java/src/jni/h5dImp.c b/java/src/jni/h5dImp.c index f8f2325..73b252a 100644 --- a/java/src/jni/h5dImp.c +++ b/java/src/jni/h5dImp.c @@ -1290,7 +1290,7 @@ H5DreadVL_asstr(JNIEnv *env, hid_t did, hid_t tid, hid_t mem_sid, hid_t file_sid for (i = 0; i < (size_t)n; i++) { h5str.s[0] = '\0'; - if (!h5str_sprintf(ENVONLY, &h5str, did, tid, &(((char *)readBuf)[i * typeSize]), typeSize, 0)) + if (!h5str_sprintf(ENVONLY, &h5str, did, tid, &(((char *)readBuf)[i * typeSize]), 0)) CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE); if (NULL == (jstr = ENVPTR->NewStringUTF(ENVONLY, h5str.s))) @@ -1669,8 +1669,7 @@ Java_hdf_hdf5lib_H5_H5Dread_1reg_1ref(JNIEnv *env, jclass clss, jlong dataset_id for (i = 0; i < n; i++) { h5str.s[0] = '\0'; - if (!h5str_sprintf(ENVONLY, &h5str, (hid_t)dataset_id, (hid_t)mem_type_id, (void *)&ref_data[i], 0, - 0)) + if (!h5str_sprintf(ENVONLY, &h5str, (hid_t)dataset_id, (hid_t)mem_type_id, (void *)&ref_data[i], 0)) CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE); if (NULL == (jstr = ENVPTR->NewStringUTF(ENVONLY, h5str.s))) diff --git a/java/src/jni/h5dImp.h b/java/src/jni/h5dImp.h index c1ed065..61dfeaa 100644 --- a/java/src/jni/h5dImp.h +++ b/java/src/jni/h5dImp.h @@ -1,6 +1,5 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * 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 * diff --git a/java/src/jni/h5eImp.c b/java/src/jni/h5eImp.c index 7d7a2cf..5bdeae8 100644 --- a/java/src/jni/h5eImp.c +++ b/java/src/jni/h5eImp.c @@ -1,6 +1,5 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * 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 * diff --git a/java/src/jni/h5eImp.h b/java/src/jni/h5eImp.h index d849b92..3133ca9 100644 --- a/java/src/jni/h5eImp.h +++ b/java/src/jni/h5eImp.h @@ -1,6 +1,5 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * 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 * diff --git a/java/src/jni/h5fImp.h b/java/src/jni/h5fImp.h index ed90ee9..d7e3ded 100644 --- a/java/src/jni/h5fImp.h +++ b/java/src/jni/h5fImp.h @@ -1,6 +1,5 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * 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 * diff --git a/java/src/jni/h5gImp.h b/java/src/jni/h5gImp.h index 393d5d8..4b0cb4d 100644 --- a/java/src/jni/h5gImp.h +++ b/java/src/jni/h5gImp.h @@ -1,6 +1,5 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * 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 * diff --git a/java/src/jni/h5iImp.h b/java/src/jni/h5iImp.h index eff5048..ed54303 100644 --- a/java/src/jni/h5iImp.h +++ b/java/src/jni/h5iImp.h @@ -1,6 +1,5 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * 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 * diff --git a/java/src/jni/h5jni.h b/java/src/jni/h5jni.h index fb6f22a..aab5479 100644 --- a/java/src/jni/h5jni.h +++ b/java/src/jni/h5jni.h @@ -1,6 +1,5 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * 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 * diff --git a/java/src/jni/h5lImp.c b/java/src/jni/h5lImp.c index fabd920..43db4e9 100644 --- a/java/src/jni/h5lImp.c +++ b/java/src/jni/h5lImp.c @@ -1,6 +1,5 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * 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 * diff --git a/java/src/jni/h5lImp.h b/java/src/jni/h5lImp.h index 2e949fe..134ed17 100644 --- a/java/src/jni/h5lImp.h +++ b/java/src/jni/h5lImp.h @@ -1,6 +1,5 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * 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 * diff --git a/java/src/jni/h5oImp.c b/java/src/jni/h5oImp.c index e06ad79..3037bc6 100644 --- a/java/src/jni/h5oImp.c +++ b/java/src/jni/h5oImp.c @@ -1,6 +1,5 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * 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 * diff --git a/java/src/jni/h5oImp.h b/java/src/jni/h5oImp.h index e6675be..2abb0d9 100644 --- a/java/src/jni/h5oImp.h +++ b/java/src/jni/h5oImp.h @@ -1,6 +1,5 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * 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 * diff --git a/java/src/jni/h5pACPLImp.c b/java/src/jni/h5pACPLImp.c index 611016f..6290e0e 100644 --- a/java/src/jni/h5pACPLImp.c +++ b/java/src/jni/h5pACPLImp.c @@ -1,6 +1,5 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * 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 * diff --git a/java/src/jni/h5pACPLImp.h b/java/src/jni/h5pACPLImp.h index 21c0cc6..8d9bf7d 100644 --- a/java/src/jni/h5pACPLImp.h +++ b/java/src/jni/h5pACPLImp.h @@ -1,6 +1,5 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * 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 * diff --git a/java/src/jni/h5pDAPLImp.c b/java/src/jni/h5pDAPLImp.c index 430fc79..82802b9 100644 --- a/java/src/jni/h5pDAPLImp.c +++ b/java/src/jni/h5pDAPLImp.c @@ -1,6 +1,5 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * 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 * diff --git a/java/src/jni/h5pDAPLImp.h b/java/src/jni/h5pDAPLImp.h index a15e964..353f652 100644 --- a/java/src/jni/h5pDAPLImp.h +++ b/java/src/jni/h5pDAPLImp.h @@ -1,6 +1,5 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * 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 * diff --git a/java/src/jni/h5pDCPLImp.c b/java/src/jni/h5pDCPLImp.c index 9e8b2b6..760a5a8 100644 --- a/java/src/jni/h5pDCPLImp.c +++ b/java/src/jni/h5pDCPLImp.c @@ -1,6 +1,5 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * 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 * diff --git a/java/src/jni/h5pDCPLImp.h b/java/src/jni/h5pDCPLImp.h index 6adcbe4..302019f 100644 --- a/java/src/jni/h5pDCPLImp.h +++ b/java/src/jni/h5pDCPLImp.h @@ -1,6 +1,5 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * 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 * diff --git a/java/src/jni/h5pDXPLImp.c b/java/src/jni/h5pDXPLImp.c index 8b930dc..c555d53 100644 --- a/java/src/jni/h5pDXPLImp.c +++ b/java/src/jni/h5pDXPLImp.c @@ -1,6 +1,5 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * 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 * diff --git a/java/src/jni/h5pDXPLImp.h b/java/src/jni/h5pDXPLImp.h index 8d2df68..250c3f8 100644 --- a/java/src/jni/h5pDXPLImp.h +++ b/java/src/jni/h5pDXPLImp.h @@ -1,6 +1,5 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * 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 * diff --git a/java/src/jni/h5pFAPLImp.c b/java/src/jni/h5pFAPLImp.c index 23c84c4..ad85aae 100644 --- a/java/src/jni/h5pFAPLImp.c +++ b/java/src/jni/h5pFAPLImp.c @@ -1,6 +1,5 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * 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 * diff --git a/java/src/jni/h5pFAPLImp.h b/java/src/jni/h5pFAPLImp.h index 166834f..4bb48e2 100644 --- a/java/src/jni/h5pFAPLImp.h +++ b/java/src/jni/h5pFAPLImp.h @@ -1,6 +1,5 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * 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 * diff --git a/java/src/jni/h5pFCPLImp.c b/java/src/jni/h5pFCPLImp.c index fe12760..ded3248 100644 --- a/java/src/jni/h5pFCPLImp.c +++ b/java/src/jni/h5pFCPLImp.c @@ -1,6 +1,5 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * 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 * diff --git a/java/src/jni/h5pFCPLImp.h b/java/src/jni/h5pFCPLImp.h index 7799e49..0fe3944 100644 --- a/java/src/jni/h5pFCPLImp.h +++ b/java/src/jni/h5pFCPLImp.h @@ -1,6 +1,5 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * 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 * diff --git a/java/src/jni/h5pGAPLImp.c b/java/src/jni/h5pGAPLImp.c index c43609d..b92e180 100644 --- a/java/src/jni/h5pGAPLImp.c +++ b/java/src/jni/h5pGAPLImp.c @@ -1,6 +1,5 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * 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 * diff --git a/java/src/jni/h5pGAPLImp.h b/java/src/jni/h5pGAPLImp.h index db95f5d..478402a 100644 --- a/java/src/jni/h5pGAPLImp.h +++ b/java/src/jni/h5pGAPLImp.h @@ -1,6 +1,5 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * 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 * diff --git a/java/src/jni/h5pGCPLImp.c b/java/src/jni/h5pGCPLImp.c index 46d102f..2ba140d 100644 --- a/java/src/jni/h5pGCPLImp.c +++ b/java/src/jni/h5pGCPLImp.c @@ -1,6 +1,5 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * 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 * diff --git a/java/src/jni/h5pGCPLImp.h b/java/src/jni/h5pGCPLImp.h index a1b8b28..6a40908 100644 --- a/java/src/jni/h5pGCPLImp.h +++ b/java/src/jni/h5pGCPLImp.h @@ -1,6 +1,5 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * 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 * diff --git a/java/src/jni/h5pImp.h b/java/src/jni/h5pImp.h index 49d36a6..b80ce46 100644 --- a/java/src/jni/h5pImp.h +++ b/java/src/jni/h5pImp.h @@ -1,6 +1,5 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * 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 * diff --git a/java/src/jni/h5pLAPLImp.c b/java/src/jni/h5pLAPLImp.c index 8b5afa2..1db495c 100644 --- a/java/src/jni/h5pLAPLImp.c +++ b/java/src/jni/h5pLAPLImp.c @@ -1,6 +1,5 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * 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 * diff --git a/java/src/jni/h5pLAPLImp.h b/java/src/jni/h5pLAPLImp.h index 204901d..46adc0c 100644 --- a/java/src/jni/h5pLAPLImp.h +++ b/java/src/jni/h5pLAPLImp.h @@ -1,6 +1,5 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * 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 * diff --git a/java/src/jni/h5pLCPLImp.c b/java/src/jni/h5pLCPLImp.c index 455936b..b5eebd1 100644 --- a/java/src/jni/h5pLCPLImp.c +++ b/java/src/jni/h5pLCPLImp.c @@ -1,6 +1,5 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * 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 * diff --git a/java/src/jni/h5pLCPLImp.h b/java/src/jni/h5pLCPLImp.h index b744815..7601adb 100644 --- a/java/src/jni/h5pLCPLImp.h +++ b/java/src/jni/h5pLCPLImp.h @@ -1,6 +1,5 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * 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 * diff --git a/java/src/jni/h5pOCPLImp.c b/java/src/jni/h5pOCPLImp.c index 6cf62d7..bdcba46 100644 --- a/java/src/jni/h5pOCPLImp.c +++ b/java/src/jni/h5pOCPLImp.c @@ -1,6 +1,5 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * 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 * diff --git a/java/src/jni/h5pOCPLImp.h b/java/src/jni/h5pOCPLImp.h index ccc4c78..c16f1be 100644 --- a/java/src/jni/h5pOCPLImp.h +++ b/java/src/jni/h5pOCPLImp.h @@ -1,6 +1,5 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * 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 * diff --git a/java/src/jni/h5pOCpyPLImp.c b/java/src/jni/h5pOCpyPLImp.c index 9cf18fd..b525b68 100644 --- a/java/src/jni/h5pOCpyPLImp.c +++ b/java/src/jni/h5pOCpyPLImp.c @@ -1,6 +1,5 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * 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 * diff --git a/java/src/jni/h5pOCpyPLImp.h b/java/src/jni/h5pOCpyPLImp.h index 82369b3..d8682cb 100644 --- a/java/src/jni/h5pOCpyPLImp.h +++ b/java/src/jni/h5pOCpyPLImp.h @@ -1,6 +1,5 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * 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 * diff --git a/java/src/jni/h5pStrCPLImp.c b/java/src/jni/h5pStrCPLImp.c index 33dbdd7..a056e3a 100644 --- a/java/src/jni/h5pStrCPLImp.c +++ b/java/src/jni/h5pStrCPLImp.c @@ -1,6 +1,5 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * 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 * diff --git a/java/src/jni/h5pStrCPLImp.h b/java/src/jni/h5pStrCPLImp.h index 01cde89..8a56494 100644 --- a/java/src/jni/h5pStrCPLImp.h +++ b/java/src/jni/h5pStrCPLImp.h @@ -1,6 +1,5 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * 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 * diff --git a/java/src/jni/h5plImp.c b/java/src/jni/h5plImp.c index bef1242..9193028 100644 --- a/java/src/jni/h5plImp.c +++ b/java/src/jni/h5plImp.c @@ -1,6 +1,5 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * 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 * diff --git a/java/src/jni/h5plImp.h b/java/src/jni/h5plImp.h index 228d512..b809efa 100644 --- a/java/src/jni/h5plImp.h +++ b/java/src/jni/h5plImp.h @@ -1,6 +1,5 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * 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 * diff --git a/java/src/jni/h5rImp.h b/java/src/jni/h5rImp.h index 94e7911..582b837 100644 --- a/java/src/jni/h5rImp.h +++ b/java/src/jni/h5rImp.h @@ -1,6 +1,5 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * 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 * diff --git a/java/src/jni/h5sImp.h b/java/src/jni/h5sImp.h index c4a1828..1ceaf3f 100644 --- a/java/src/jni/h5sImp.h +++ b/java/src/jni/h5sImp.h @@ -1,6 +1,5 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * 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 * diff --git a/java/src/jni/h5tImp.h b/java/src/jni/h5tImp.h index 3769cf3..3faeb00 100644 --- a/java/src/jni/h5tImp.h +++ b/java/src/jni/h5tImp.h @@ -1,6 +1,5 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * 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 * diff --git a/java/src/jni/h5util.c b/java/src/jni/h5util.c index 5b38daf..3e1962e 100644 --- a/java/src/jni/h5util.c +++ b/java/src/jni/h5util.c @@ -28,8 +28,6 @@ extern "C" { #include "hdf5.h" #include "h5util.h" -#define SKIP_UNUSED_DUMP_ROUTINES - /* size of hyperslab buffer when a dataset is bigger than H5TOOLS_MALLOCSIZE */ hsize_t H5TOOLS_BUFSIZE = (32 * 1024 * 1024); /* 32 MB */ int H5TOOLS_TEXT_BLOCK = 16; /* Number of elements on a line in a text export file */ @@ -54,18 +52,19 @@ void * edata; /* Local Prototypes */ /********************/ -#ifndef SKIP_UNUSED_DUMP_ROUTINES -static int h5str_dump_region_blocks(JNIEnv *env, h5str_t *str, hid_t region, hid_t region_obj); -static int h5str_dump_region_points(JNIEnv *env, h5str_t *str, hid_t region, hid_t region_obj); -#endif +static int h5str_dump_region_blocks(JNIEnv *env, h5str_t *str, hid_t region, hid_t region_obj, + int expand_data); +static int h5str_dump_region_points(JNIEnv *env, h5str_t *str, hid_t region, hid_t region_obj, + int expand_data); +static int h5str_dump_region_attribute(JNIEnv *env, h5str_t *str, hid_t region_id); static int h5str_is_zero(const void *_mem, size_t size); static hid_t h5str_get_native_type(hid_t type); static hid_t h5str_get_little_endian_type(hid_t type); static hid_t h5str_get_big_endian_type(hid_t type); static htri_t h5str_detect_vlen(hid_t tid); static htri_t h5str_detect_vlen_str(hid_t tid); -static int h5tools_dump_simple_data(JNIEnv *env, FILE *stream, hid_t container, hid_t type, void *_mem, - hsize_t nelmts); +static int h5str_dump_simple_data(JNIEnv *env, FILE *stream, hid_t container, hid_t type, void *_mem, + hsize_t nelmts); static int h5str_render_bin_output(FILE *stream, hid_t container, hid_t tid, void *_mem, hsize_t block_nelmts); static int render_bin_output_region_data_blocks(FILE *stream, hid_t region_id, hid_t container, int ndims, @@ -185,13 +184,14 @@ h5str_convert(JNIEnv *env, char **in_str, hid_t container, hid_t tid, void *out_ H5T_class_t tclass = H5T_NO_CLASS; const char delimiter[] = " ," H5_COMPOUND_BEGIN_INDICATOR H5_COMPOUND_END_INDICATOR H5_ARRAY_BEGIN_INDICATOR H5_ARRAY_END_INDICATOR H5_VLEN_BEGIN_INDICATOR H5_VLEN_END_INDICATOR; - size_t typeSize = 0; - hid_t mtid = H5I_INVALID_HID; - char * this_str = NULL; - char * token; - char * cptr = NULL; - int n; - size_t retVal = 0; + + size_t retVal = 0; + size_t typeSize = 0; + hid_t mtid = H5I_INVALID_HID; + char * this_str = NULL; + char * cptr = NULL; + char * token; + int n; if (!in_str) H5_NULL_ARGUMENT_ERROR(ENVONLY, "h5str_convert: in_str is NULL"); @@ -239,7 +239,7 @@ h5str_convert(JNIEnv *env, char **in_str, hid_t container, hid_t tid, void *out_ case sizeof(long double): { long double tmp_ldouble = 0.0; - sscanf(token, "%Lf", &tmp_ldouble); + sscanf(token, "%Lg", &tmp_ldouble); HDmemcpy(cptr, &tmp_ldouble, sizeof(long double)); break; } @@ -644,27 +644,27 @@ done: * * Purpose: Object reference -- show the name of the referenced object. * - * Return: Nothing + * Return: SUCCEED or FAIL *------------------------------------------------------------------------- */ -void -h5str_sprint_reference(JNIEnv *env, h5str_t *out_str, hid_t container, void *ref_p) +int +h5str_sprint_reference(JNIEnv *env, h5str_t *out_str, void *ref_p) { - ssize_t buf_size; - char * ref_name = NULL; - const H5R_ref_t *ref_vp = (H5R_ref_t *)ref_p; + ssize_t buf_size; + char * ref_name = NULL; + H5R_ref_t *ref_vp = (H5R_ref_t *)ref_p; - UNUSED(container); + int ret_value = FAIL; if (!h5str_append(out_str, " \"")) - CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE); + H5_LIBRARY_ERROR(ENVONLY); buf_size = H5Rget_file_name(ref_vp, NULL, 0); if (buf_size) { ref_name = (char *)HDmalloc(sizeof(char) * (size_t)buf_size + 1); if (H5Rget_file_name(ref_vp, ref_name, buf_size + 1) >= 0) { ref_name[buf_size] = '\0'; if (!h5str_append(out_str, ref_name)) - CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE); + H5_LIBRARY_ERROR(ENVONLY); } HDfree(ref_name); ref_name = NULL; @@ -676,7 +676,7 @@ h5str_sprint_reference(JNIEnv *env, h5str_t *out_str, hid_t container, void *ref if (H5Rget_obj_name(ref_vp, H5P_DEFAULT, ref_name, buf_size + 1) >= 0) { ref_name[buf_size] = '\0'; if (!h5str_append(out_str, ref_name)) - CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE); + H5_LIBRARY_ERROR(ENVONLY); } HDfree(ref_name); ref_name = NULL; @@ -689,17 +689,61 @@ h5str_sprint_reference(JNIEnv *env, h5str_t *out_str, hid_t container, void *ref if (H5Rget_attr_name(ref_vp, ref_name, buf_size + 1) >= 0) { ref_name[buf_size] = '\0'; if (!h5str_append(out_str, ref_name)) - CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE); + H5_LIBRARY_ERROR(ENVONLY); } HDfree(ref_name); ref_name = NULL; } } if (!h5str_append(out_str, "\"")) - CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE); + H5_LIBRARY_ERROR(ENVONLY); + + ret_value = SUCCEED; done: if (ref_name) HDfree(ref_name); + + return ret_value; +} /* h5str_sprint_reference */ + +int +h5str_region_dataset(JNIEnv *env, h5str_t *out_str, H5R_ref_t *ref_vp, int expand_data) +{ + hid_t new_obj_id = H5I_INVALID_HID; + hid_t new_obj_sid = H5I_INVALID_HID; + H5S_sel_type region_type; + + int ret_value = FAIL; + + if ((new_obj_id = H5Ropen_object(ref_vp, H5P_DEFAULT, H5P_DEFAULT)) < 0) { + ret_value = SUCCEED; /* An uncreated region is a valid state */ + goto done; + } + + if ((new_obj_sid = H5Ropen_region(ref_vp, H5P_DEFAULT, H5P_DEFAULT)) < 0) + H5_LIBRARY_ERROR(ENVONLY); + + if ((region_type = H5Sget_select_type(new_obj_sid)) > H5S_SEL_ERROR) { + if (H5S_SEL_POINTS == region_type) { + if (h5str_dump_region_points(ENVONLY, out_str, new_obj_sid, new_obj_id, expand_data) < 0) + CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE); + } + else if (H5S_SEL_HYPERSLABS == region_type) { + if (h5str_dump_region_blocks(ENVONLY, out_str, new_obj_sid, new_obj_id, expand_data) < 0) + CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE); + } + } + + ret_value = SUCCEED; +done: + if (new_obj_sid >= 0) + if (H5Sclose(new_obj_sid) < 0) + H5_LIBRARY_ERROR(ENVONLY); + if (new_obj_id >= 0) + if (H5Dclose(new_obj_id) < 0) + H5_LIBRARY_ERROR(ENVONLY); + + return ret_value; } /* @@ -710,8 +754,7 @@ done: * FAILURE: 0 */ size_t -h5str_sprintf(JNIEnv *env, h5str_t *out_str, hid_t container, hid_t tid, void *in_buf, size_t in_buf_len, - int expand_data) +h5str_sprintf(JNIEnv *env, h5str_t *out_str, hid_t container, hid_t tid, void *in_buf, int expand_data) { unsigned char *ucptr = (unsigned char *)in_buf; static char fmt_llong[8], fmt_ullong[8]; @@ -719,7 +762,6 @@ h5str_sprintf(JNIEnv *env, h5str_t *out_str, hid_t container, hid_t tid, void *i size_t typeSize = 0; H5T_sign_t nsign = H5T_SGN_ERROR; hid_t mtid = H5I_INVALID_HID; - hid_t obj = H5I_INVALID_HID; char * cptr = (char *)in_buf; char * this_str = NULL; int n; @@ -734,8 +776,6 @@ h5str_sprintf(JNIEnv *env, h5str_t *out_str, hid_t container, hid_t tid, void *i H5_LIBRARY_ERROR(ENVONLY); if (!(typeSize = H5Tget_size(tid))) H5_LIBRARY_ERROR(ENVONLY); - if (!(nsign = H5Tget_sign(tid))) - H5_LIBRARY_ERROR(ENVONLY); /* Build default formats for long long types */ if (!fmt_llong[0]) { @@ -744,7 +784,6 @@ h5str_sprintf(JNIEnv *env, h5str_t *out_str, hid_t container, hid_t tid, void *i if (HDsnprintf(fmt_ullong, sizeof(fmt_ullong), "%%%su", H5_PRINTF_LL_WIDTH) < 0) H5_JNI_FATAL_ERROR(ENVONLY, "h5str_sprintf: HDsnprintf failure"); } /* end if */ - switch (tclass) { case H5T_FLOAT: { switch (typeSize) { @@ -805,6 +844,8 @@ h5str_sprintf(JNIEnv *env, h5str_t *out_str, hid_t container, hid_t tid, void *i htri_t is_variable; char * tmp_str; + typeSize = 0; + if ((is_variable = H5Tis_variable_str(tid)) < 0) H5_LIBRARY_ERROR(ENVONLY); @@ -1003,7 +1044,7 @@ h5str_sprintf(JNIEnv *env, h5str_t *out_str, hid_t container, hid_t tid, void *i H5_LIBRARY_ERROR(ENVONLY); if (!h5str_append(out_str, H5_COMPOUND_BEGIN_INDICATOR)) - CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE); + H5_LIBRARY_ERROR(ENVONLY); for (i = 0; i < (unsigned)n; i++) { offset = H5Tget_member_offset(tid, i); @@ -1011,12 +1052,12 @@ h5str_sprintf(JNIEnv *env, h5str_t *out_str, hid_t container, hid_t tid, void *i if ((mtid = H5Tget_member_type(tid, i)) < 0) H5_LIBRARY_ERROR(ENVONLY); - if (!h5str_sprintf(ENVONLY, out_str, container, mtid, &cptr[offset], in_buf_len, expand_data)) + if (!h5str_sprintf(ENVONLY, out_str, container, mtid, &cptr[offset], expand_data)) CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE); if ((i + 1) < (unsigned)n) if (!h5str_append(out_str, ", ")) - CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE); + H5_LIBRARY_ERROR(ENVONLY); if (H5Tclose(mtid) < 0) H5_LIBRARY_ERROR(ENVONLY); @@ -1024,7 +1065,7 @@ h5str_sprintf(JNIEnv *env, h5str_t *out_str, hid_t container, hid_t tid, void *i } if (!h5str_append(out_str, H5_COMPOUND_END_INDICATOR)) - CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE); + H5_LIBRARY_ERROR(ENVONLY); break; } @@ -1034,7 +1075,7 @@ h5str_sprintf(JNIEnv *env, h5str_t *out_str, hid_t container, hid_t tid, void *i if (H5Tenum_nameof(tid, cptr, enum_name, sizeof enum_name) >= 0) { if (!h5str_append(out_str, enum_name)) - CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE); + H5_LIBRARY_ERROR(ENVONLY); } else { size_t i; @@ -1057,130 +1098,120 @@ h5str_sprintf(JNIEnv *env, h5str_t *out_str, hid_t container, hid_t tid, void *i } case H5T_REFERENCE: { - if (h5str_is_zero(cptr, typeSize)) { - if (!h5str_append(out_str, "NULL")) - CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE); - break; - } - if (H5Tequal(tid, H5T_STD_REF)) { - H5O_type_t obj_type = -1; /* Object type */ - H5R_type_t ref_type; /* Reference type */ - const H5R_ref_t *ref_vp = (H5R_ref_t *)cptr; + hid_t new_obj_id = H5I_INVALID_HID; + H5O_type_t obj_type = -1; /* Object type */ + H5R_type_t ref_type; /* Reference type */ + + H5R_ref_t *ref_vp = (H5R_ref_t *)cptr; ref_type = H5Rget_type(ref_vp); - H5Rget_obj_type3(ref_vp, H5P_DEFAULT, &obj_type); switch (ref_type) { - case H5R_OBJECT1: { - /* Object references -- show the type and OID of the referenced object. */ - H5O_info2_t oi; - - if ((obj = H5Ropen_object(ref_vp, H5P_DEFAULT, H5P_DEFAULT)) >= 0) { - H5Oget_info3(obj, &oi, H5O_INFO_BASIC); - if (H5Oclose(obj) < 0) - CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE); + case H5R_OBJECT1: + if (H5Rget_obj_type3(ref_vp, H5P_DEFAULT, &obj_type) >= 0) { + switch (obj_type) { + case H5O_TYPE_DATASET: + if (h5str_region_dataset(ENVONLY, out_str, ref_vp, expand_data) < 0) + CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE); + break; + + case H5O_TYPE_GROUP: + case H5O_TYPE_NAMED_DATATYPE: + case H5O_TYPE_MAP: + case H5O_TYPE_UNKNOWN: + case H5O_TYPE_NTYPES: + default: { + /* Object references -- show the type and OID of the referenced object. */ + H5O_info2_t oi; + char * obj_tok_str = NULL; + if ((new_obj_id = H5Ropen_object(ref_vp, H5P_DEFAULT, H5P_DEFAULT)) >= + 0) { + H5Oget_info3(new_obj_id, &oi, H5O_INFO_BASIC); + H5Otoken_to_str(new_obj_id, &oi.token, &obj_tok_str); + if (H5Dclose(new_obj_id) < 0) + H5_LIBRARY_ERROR(ENVONLY); + } + else + H5_LIBRARY_ERROR(ENVONLY); + + if (NULL == (this_str = (char *)HDmalloc(14))) + H5_OUT_OF_MEMORY_ERROR( + ENVONLY, "h5str_sprintf: failed to allocate string buffer"); + if (HDsprintf(this_str, "%u-", (unsigned)oi.type) < 0) + H5_JNI_FATAL_ERROR(ENVONLY, "h5str_sprintf: HDsprintf failure"); + if (!h5str_append(out_str, this_str)) + H5_LIBRARY_ERROR(ENVONLY); + HDfree(this_str); + this_str = NULL; + + /* Print OID */ + { + char *token_str; + + H5Otoken_to_str(tid, &oi.token, &token_str); + + if (NULL == (this_str = (char *)HDmalloc(64 + strlen(token_str) + 1))) + H5_OUT_OF_MEMORY_ERROR( + ENVONLY, "h5str_sprintf: failed to allocate string buffer"); + if (HDsprintf(this_str, "%lu:%s", oi.fileno, token_str) < 0) + H5_JNI_FATAL_ERROR(ENVONLY, "h5str_sprintf: HDsprintf failure"); + + H5free_memory(token_str); + } + } break; + } /* end switch */ } else - CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE); - - if (NULL == (this_str = (char *)HDmalloc(14))) - H5_OUT_OF_MEMORY_ERROR(ENVONLY, - "h5str_sprintf: failed to allocate string buffer"); - if (HDsprintf(this_str, "%u-", (unsigned)oi.type) < 0) - H5_JNI_FATAL_ERROR(ENVONLY, "h5str_sprintf: HDsprintf failure"); - if (!h5str_append(out_str, this_str)) - CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE); - HDfree(this_str); - this_str = NULL; - - switch (obj_type) { - case H5O_TYPE_GROUP: - if (!h5str_append(out_str, H5_TOOLS_GROUP)) - CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE); - break; - - case H5O_TYPE_DATASET: - if (!h5str_append(out_str, H5_TOOLS_DATASET)) - CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE); - break; - - case H5O_TYPE_NAMED_DATATYPE: - if (!h5str_append(out_str, H5_TOOLS_DATATYPE)) - CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE); - break; - - case H5O_TYPE_MAP: - case H5O_TYPE_UNKNOWN: - case H5O_TYPE_NTYPES: - default: - break; - } /* end switch */ - H5Oclose(obj); - h5str_sprint_reference(ENVONLY, out_str, container, ref_vp); - - /* Print OID */ - { - char *token_str; - - H5Otoken_to_str(tid, &oi.token, &token_str); - - if (NULL == (this_str = (char *)HDmalloc(64 + strlen(token_str) + 1))) - H5_OUT_OF_MEMORY_ERROR(ENVONLY, - "h5str_sprintf: failed to allocate string buffer"); - if (HDsprintf(this_str, "%lu:%s", oi.fileno, token_str) < 0) - H5_JNI_FATAL_ERROR(ENVONLY, "h5str_sprintf: HDsprintf failure"); - - H5free_memory(token_str); - } - - } - - break; + H5_LIBRARY_ERROR(ENVONLY); + break; case H5R_DATASET_REGION1: - if (!h5str_append(out_str, H5_TOOLS_DATASET)) + if (h5str_region_dataset(ENVONLY, out_str, ref_vp, expand_data) < 0) CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE); - h5str_sprint_reference(ENVONLY, out_str, container, (void *)cptr); break; case H5R_OBJECT2: - switch (obj_type) { - case H5O_TYPE_GROUP: - if (!h5str_append(out_str, H5_TOOLS_GROUP)) - CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE); - break; - - case H5O_TYPE_DATASET: - if (!h5str_append(out_str, H5_TOOLS_DATASET)) - CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE); - break; - - case H5O_TYPE_NAMED_DATATYPE: - if (!h5str_append(out_str, H5_TOOLS_DATATYPE)) - CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE); - break; - - case H5O_TYPE_MAP: - case H5O_TYPE_UNKNOWN: - case H5O_TYPE_NTYPES: - default: - break; - } /* end switch */ - h5str_sprint_reference(ENVONLY, out_str, container, (void *)cptr); + if (H5Rget_obj_type3(ref_vp, H5P_DEFAULT, &obj_type) >= 0) { + switch (obj_type) { + case H5O_TYPE_GROUP: + break; + + case H5O_TYPE_DATASET: + if (h5str_region_dataset(ENVONLY, out_str, ref_vp, expand_data) < 0) + CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE); + break; + + case H5O_TYPE_NAMED_DATATYPE: + break; + + case H5O_TYPE_MAP: + case H5O_TYPE_UNKNOWN: + case H5O_TYPE_NTYPES: + default: + break; + } /* end switch */ + } + else + H5_JNI_FATAL_ERROR(ENVONLY, "h5str_sprintf: H5R_OBJECT2 failed"); break; case H5R_DATASET_REGION2: - if (!h5str_append(out_str, H5_TOOLS_DATASET)) + if (h5str_region_dataset(ENVONLY, out_str, ref_vp, expand_data) < 0) CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE); - h5str_sprint_reference(ENVONLY, out_str, container, (void *)cptr); break; case H5R_ATTR: - if (!h5str_append(out_str, H5_TOOLS_ATTRIBUTE)) - CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE); - h5str_sprint_reference(ENVONLY, out_str, container, (void *)cptr); + if ((new_obj_id = H5Ropen_attr(ref_vp, H5P_DEFAULT, H5P_DEFAULT)) >= 0) { + if (h5str_dump_region_attribute(ENVONLY, out_str, new_obj_id) < 0) + CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE); + if (H5Aclose(new_obj_id) < 0) + H5_LIBRARY_ERROR(ENVONLY); + } break; case H5R_BADTYPE: case H5R_MAXTYPE: default: break; } /* end switch */ + + if (H5Rdestroy(ref_vp) < 0) + H5_LIBRARY_ERROR(ENVONLY); } else if (H5Tequal(tid, H5T_STD_REF_DSETREG)) { /* (H5R_DSET_REG_REF_BUF_SIZE == typeSize) */ @@ -1200,7 +1231,7 @@ h5str_sprintf(JNIEnv *env, h5str_t *out_str, hid_t container, hid_t tid, void *i int rank = 0; if (!h5str_append(out_str, H5_ARRAY_BEGIN_INDICATOR)) - CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE); + H5_LIBRARY_ERROR(ENVONLY); if ((mtid = H5Tget_super(tid)) < 0) H5_LIBRARY_ERROR(ENVONLY); @@ -1218,17 +1249,16 @@ h5str_sprintf(JNIEnv *env, h5str_t *out_str, hid_t container, hid_t tid, void *i total_elmts *= dims[i]; for (i = 0; i < total_elmts; i++) { - if (!h5str_sprintf(ENVONLY, out_str, container, mtid, &(cptr[i * baseSize]), in_buf_len, - expand_data)) + if (!h5str_sprintf(ENVONLY, out_str, container, mtid, &(cptr[i * baseSize]), expand_data)) CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE); if ((i + 1) < total_elmts) if (!h5str_append(out_str, ", ")) - CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE); + H5_LIBRARY_ERROR(ENVONLY); } if (!h5str_append(out_str, H5_ARRAY_END_INDICATOR)) - CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE); + H5_LIBRARY_ERROR(ENVONLY); if (H5Tclose(mtid) < 0) H5_LIBRARY_ERROR(ENVONLY); @@ -1249,20 +1279,20 @@ h5str_sprintf(JNIEnv *env, h5str_t *out_str, hid_t container, hid_t tid, void *i H5_LIBRARY_ERROR(ENVONLY); if (!h5str_append(out_str, H5_VLEN_BEGIN_INDICATOR)) - CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE); + H5_LIBRARY_ERROR(ENVONLY); for (i = 0; i < (unsigned)vl_buf->len; i++) { if (!h5str_sprintf(ENVONLY, out_str, container, mtid, &(((char *)vl_buf->p)[i * baseSize]), - vl_buf->len, expand_data)) + expand_data)) CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE); if ((i + 1) < (unsigned)vl_buf->len) if (!h5str_append(out_str, ", ")) - CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE); + H5_LIBRARY_ERROR(ENVONLY); } if (!h5str_append(out_str, H5_VLEN_END_INDICATOR)) - CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE); + H5_LIBRARY_ERROR(ENVONLY); if (H5Tclose(mtid) < 0) H5_LIBRARY_ERROR(ENVONLY); @@ -1304,7 +1334,7 @@ h5str_sprintf(JNIEnv *env, h5str_t *out_str, hid_t container, hid_t tid, void *i if (this_str) { if (!h5str_append(out_str, this_str)) - CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE); + H5_LIBRARY_ERROR(ENVONLY); HDfree(this_str); this_str = NULL; @@ -1405,12 +1435,12 @@ h5str_print_region_data_blocks(JNIEnv *env, hid_t region_id, h5str_t *str, int n for (numindex = 0; numindex < numelem; numindex++) { if (!h5str_sprintf(ENVONLY, str, region_id, type_id, ((char *)region_buf + numindex * type_size), - 0, 1)) + 1)) CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE); if (numindex + 1 < numelem) if (!h5str_append(str, ", ")) - CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE); + H5_LIBRARY_ERROR(ENVONLY); } /* end for (jndx = 0; jndx < numelem; jndx++, region_elmtno++, ctx.cur_elmt++) */ } /* end for (blkndx = 0; blkndx < nblocks; blkndx++) */ @@ -1434,7 +1464,7 @@ done: } /* end h5str_print_region_data_blocks */ int -h5str_dump_region_blocks_data(JNIEnv *env, h5str_t *str, hid_t region, hid_t region_id) +h5str_dump_region_blocks(JNIEnv *env, h5str_t *str, hid_t region_space, hid_t region_id, int expand_data) { hssize_t nblocks; hsize_t alloc_size; @@ -1443,29 +1473,31 @@ h5str_dump_region_blocks_data(JNIEnv *env, h5str_t *str, hid_t region, hid_t reg hid_t type_id = H5I_INVALID_HID; int ndims = -1; int ret_value = FAIL; + int i; + char tmp_str[256]; /* * This function fails if the region does not have blocks. */ - H5E_BEGIN_TRY { nblocks = H5Sget_select_hyper_nblocks(region); } + H5E_BEGIN_TRY { nblocks = H5Sget_select_hyper_nblocks(region_space); } H5E_END_TRY; - if (nblocks < 0) - H5_LIBRARY_ERROR(ENVONLY); - - if ((ndims = H5Sget_simple_extent_ndims(region)) < 0) + if (nblocks <= 0) { + ret_value = SUCCEED; + goto done; + } + if ((ndims = H5Sget_simple_extent_ndims(region_space)) < 0) H5_LIBRARY_ERROR(ENVONLY); /* Print block information */ alloc_size = (hsize_t)nblocks * (hsize_t)ndims * 2 * (hsize_t)sizeof(ptdata[0]); - if (alloc_size == (hsize_t)((size_t)alloc_size)) { - if (NULL == (ptdata = (hsize_t *)HDmalloc((size_t)alloc_size))) - H5_OUT_OF_MEMORY_ERROR(ENVONLY, - "h5str_dump_region_blocks_data: failed to allocate region block buffer"); + if (NULL == (ptdata = (hsize_t *)HDmalloc((size_t)alloc_size))) + H5_OUT_OF_MEMORY_ERROR(ENVONLY, "h5str_dump_region_blocks: failed to allocate region block buffer"); - if (H5Sget_select_hyper_blocklist(region, (hsize_t)0, (hsize_t)nblocks, ptdata) < 0) - H5_LIBRARY_ERROR(ENVONLY); + if (H5Sget_select_hyper_blocklist(region_space, (hsize_t)0, (hsize_t)nblocks, ptdata) < 0) + H5_LIBRARY_ERROR(ENVONLY); + if (expand_data) { if ((dtype = H5Dget_type(region_id)) < 0) H5_LIBRARY_ERROR(ENVONLY); @@ -1474,66 +1506,19 @@ h5str_dump_region_blocks_data(JNIEnv *env, h5str_t *str, hid_t region, hid_t reg if (h5str_print_region_data_blocks(ENVONLY, region_id, str, ndims, type_id, nblocks, ptdata) < 0) CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE); - } /* if (alloc_size == (hsize_t)((size_t)alloc_size)) */ - - ret_value = SUCCEED; - -done: - if (type_id >= 0) - H5Tclose(type_id); - if (dtype >= 0) - H5Tclose(dtype); - if (ptdata) - HDfree(ptdata); - - return ret_value; -} /* end h5str_dump_region_blocks_data */ - -#ifndef SKIP_UNUSED_DUMP_ROUTINES -static int -h5str_dump_region_blocks(JNIEnv *env, h5str_t *str, hid_t region, hid_t region_id) -{ - hssize_t nblocks; - hsize_t alloc_size; - hsize_t *ptdata = NULL; - char tmp_str[256]; - int ndims = -1; - int ret_value = FAIL; - - UNUSED(region_id); - - /* - * This function fails if the region does not have blocks. - */ - H5E_BEGIN_TRY { nblocks = H5Sget_select_hyper_nblocks(region); } - H5E_END_TRY; - - if (nblocks < 0) - H5_LIBRARY_ERROR(ENVONLY); - - if ((ndims = H5Sget_simple_extent_ndims(region)) < 0) - H5_LIBRARY_ERROR(ENVONLY); - - /* Print block information */ - alloc_size = (hsize_t)nblocks * (hsize_t)ndims * 2 * (hsize_t)sizeof(ptdata[0]); - if (alloc_size == (hsize_t)((size_t)alloc_size)) { - int i; - - if (NULL == (ptdata = (hsize_t *)HDmalloc((size_t)alloc_size))) - H5_OUT_OF_MEMORY_ERROR(ENVONLY, - "h5str_dump_region_blocks: failed to allocate region block buffer"); - - if (H5Sget_select_hyper_blocklist(region, (hsize_t)0, (hsize_t)nblocks, ptdata) < 0) + } + else { + if (!h5str_append(str, " REGION_TYPE BLOCK")) H5_LIBRARY_ERROR(ENVONLY); if (!h5str_append(str, " {")) - CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE); + H5_LIBRARY_ERROR(ENVONLY); for (i = 0; i < nblocks; i++) { int j; if (!h5str_append(str, " ")) - CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE); + H5_LIBRARY_ERROR(ENVONLY); /* Start coordinates and opposite corner */ for (j = 0; j < ndims; j++) { @@ -1543,7 +1528,7 @@ h5str_dump_region_blocks(JNIEnv *env, h5str_t *str, hid_t region, hid_t region_i H5_JNI_FATAL_ERROR(ENVONLY, "h5str_dump_region_blocks: HDsprintf failure"); if (!h5str_append(str, tmp_str)) - CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE); + H5_LIBRARY_ERROR(ENVONLY); } for (j = 0; j < ndims; j++) { @@ -1554,28 +1539,30 @@ h5str_dump_region_blocks(JNIEnv *env, h5str_t *str, hid_t region, hid_t region_i H5_JNI_FATAL_ERROR(ENVONLY, "h5str_dump_region_blocks: HDsprintf failure"); if (!h5str_append(str, tmp_str)) - CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE); + H5_LIBRARY_ERROR(ENVONLY); } if (!h5str_append(str, ") ")) - CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE); + H5_LIBRARY_ERROR(ENVONLY); tmp_str[0] = '\0'; } if (!h5str_append(str, " }")) - CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE); - } /* if (alloc_size == (hsize_t)((size_t)alloc_size)) */ - + H5_LIBRARY_ERROR(ENVONLY); + } ret_value = SUCCEED; done: + if (type_id >= 0) + H5Tclose(type_id); + if (dtype >= 0) + H5Tclose(dtype); if (ptdata) HDfree(ptdata); return ret_value; } /* end h5str_dump_region_blocks */ -#endif /*------------------------------------------------------------------------- * Purpose: Print the data values from a dataset referenced by region points. @@ -1628,12 +1615,12 @@ h5str_print_region_data_points(JNIEnv *env, hid_t region_space, hid_t region_id, if (H5Sget_simple_extent_dims(mem_space, total_size, NULL) < 0) H5_LIBRARY_ERROR(ENVONLY); - if (!h5str_sprintf(ENVONLY, str, region_id, type_id, ((char *)region_buf + jndx * type_size), 0, 1)) + if (!h5str_sprintf(ENVONLY, str, region_id, type_id, ((char *)region_buf + jndx * type_size), 1)) CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE); if (jndx + 1 < (size_t)npoints) if (!h5str_append(str, ", ")) - CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE); + H5_LIBRARY_ERROR(ENVONLY); } /* end for (jndx = 0; jndx < npoints; jndx++, elmtno++) */ ret_value = SUCCEED; @@ -1650,140 +1637,93 @@ done: } /* end h5str_print_region_data_points */ int -h5str_dump_region_points_data(JNIEnv *env, h5str_t *str, hid_t region, hid_t region_id) +h5str_dump_region_points(JNIEnv *env, h5str_t *str, hid_t region_space, hid_t region_id, int expand_data) { - hssize_t npoints; hsize_t alloc_size; + hssize_t npoints = -1; hsize_t *ptdata = NULL; hid_t dtype = H5I_INVALID_HID; hid_t type_id = H5I_INVALID_HID; int ndims = -1; int ret_value = FAIL; + int i; + char tmp_str[256]; /* * This function fails if the region does not have points. */ - H5E_BEGIN_TRY { npoints = H5Sget_select_elem_npoints(region); } + H5E_BEGIN_TRY { npoints = H5Sget_select_elem_npoints(region_space); } H5E_END_TRY; - if (npoints < 0) - H5_LIBRARY_ERROR(ENVONLY); - - if ((ndims = H5Sget_simple_extent_ndims(region)) < 0) + if (npoints <= 0) { + ret_value = SUCCEED; + goto done; + } + if ((ndims = H5Sget_simple_extent_ndims(region_space)) < 0) H5_LIBRARY_ERROR(ENVONLY); /* Print point information */ - if (npoints > 0) { - alloc_size = (hsize_t)npoints * (hsize_t)ndims * (hsize_t)sizeof(ptdata[0]); - if (alloc_size == (hsize_t)((size_t)alloc_size)) { - if (NULL == (ptdata = (hsize_t *)HDmalloc((size_t)alloc_size))) - H5_OUT_OF_MEMORY_ERROR( - ENVONLY, "h5str_dump_region_points_data: failed to allocate region point data buffer"); + alloc_size = (hsize_t)npoints * (hsize_t)ndims * (hsize_t)sizeof(ptdata[0]); + if (NULL == (ptdata = (hsize_t *)HDmalloc((size_t)alloc_size))) + H5_OUT_OF_MEMORY_ERROR(ENVONLY, + "h5str_dump_region_points: failed to allocate region point data buffer"); - if (H5Sget_select_elem_pointlist(region, (hsize_t)0, (hsize_t)npoints, ptdata) < 0) - H5_LIBRARY_ERROR(ENVONLY); + if (H5Sget_select_elem_pointlist(region_space, (hsize_t)0, (hsize_t)npoints, ptdata) < 0) + H5_LIBRARY_ERROR(ENVONLY); - if ((dtype = H5Dget_type(region_id)) < 0) - H5_LIBRARY_ERROR(ENVONLY); + if (expand_data) { + if ((dtype = H5Dget_type(region_id)) < 0) + H5_LIBRARY_ERROR(ENVONLY); - if ((type_id = H5Tget_native_type(dtype, H5T_DIR_DEFAULT)) < 0) - H5_LIBRARY_ERROR(ENVONLY); + if ((type_id = H5Tget_native_type(dtype, H5T_DIR_DEFAULT)) < 0) + H5_LIBRARY_ERROR(ENVONLY); - if (h5str_print_region_data_points(ENVONLY, region, region_id, str, ndims, type_id, npoints, - ptdata) < 0) - CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE); - } + if (h5str_print_region_data_points(ENVONLY, region_space, region_id, str, ndims, type_id, npoints, + ptdata) < 0) + CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE); } + else { + if (!h5str_append(str, " REGION_TYPE POINT")) + H5_LIBRARY_ERROR(ENVONLY); - ret_value = SUCCEED; - -done: - if (type_id >= 0) - H5Tclose(type_id); - if (dtype >= 0) - H5Tclose(dtype); - if (ptdata) - HDfree(ptdata); - - return ret_value; -} /* end h5str_dump_region_points_data */ - -#ifndef SKIP_UNUSED_DUMP_ROUTINES -static int -h5str_dump_region_points(JNIEnv *env, h5str_t *str, hid_t region, hid_t region_id) -{ - hssize_t npoints; - hsize_t alloc_size; - hsize_t *ptdata = NULL; - char tmp_str[256]; - int ndims = -1; - int ret_value = FAIL; - - UNUSED(region_id); - - /* - * This function fails if the region does not have points. - */ - H5E_BEGIN_TRY { npoints = H5Sget_select_elem_npoints(region); } - H5E_END_TRY; - - if (npoints < 0) - H5_LIBRARY_ERROR(ENVONLY); - - if ((ndims = H5Sget_simple_extent_ndims(region)) < 0) - H5_LIBRARY_ERROR(ENVONLY); - - /* Print point information */ - if (npoints > 0) { - int i; + if (!h5str_append(str, " {")) + H5_LIBRARY_ERROR(ENVONLY); - alloc_size = (hsize_t)npoints * (hsize_t)ndims * (hsize_t)sizeof(ptdata[0]); - if (alloc_size == (hsize_t)((size_t)alloc_size)) { - if (NULL == (ptdata = (hsize_t *)HDmalloc((size_t)alloc_size))) - H5_OUT_OF_MEMORY_ERROR(ENVONLY, - "h5str_dump_region_points: failed to allocate region point buffer"); + for (i = 0; i < npoints; i++) { + int j; - if (H5Sget_select_elem_pointlist(region, (hsize_t)0, (hsize_t)npoints, ptdata) < 0) + if (!h5str_append(str, " ")) H5_LIBRARY_ERROR(ENVONLY); - if (!h5str_append(str, " {")) - CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE); - - for (i = 0; i < npoints; i++) { - int j; - - if (!h5str_append(str, " ")) - CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE); - - for (j = 0; j < ndims; j++) { - tmp_str[0] = '\0'; - - if (HDsprintf(tmp_str, "%s%lu", j ? "," : "(", (unsigned long)(ptdata[i * ndims + j])) < - 0) - H5_JNI_FATAL_ERROR(ENVONLY, "h5str_dump_region_points: HDsprintf failure"); + for (j = 0; j < ndims; j++) { + tmp_str[0] = '\0'; - if (!h5str_append(str, tmp_str)) - CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE); - } /* end for (j = 0; j < ndims; j++) */ + if (HDsprintf(tmp_str, "%s%lu", j ? "," : "(", (unsigned long)(ptdata[i * ndims + j])) < 0) + H5_JNI_FATAL_ERROR(ENVONLY, "h5str_dump_region_points: HDsprintf failure"); - if (!h5str_append(str, ") ")) - CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE); - } /* end for (i = 0; i < npoints; i++) */ + if (!h5str_append(str, tmp_str)) + H5_LIBRARY_ERROR(ENVONLY); + } /* end for (j = 0; j < ndims; j++) */ - if (!h5str_append(str, " }")) - CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE); - } /* end if (alloc_size == (hsize_t)((size_t) alloc_size)) */ - } /* end if (npoints > 0) */ + if (!h5str_append(str, ") ")) + H5_LIBRARY_ERROR(ENVONLY); + } /* end for (i = 0; i < npoints; i++) */ + if (!h5str_append(str, " }")) + H5_LIBRARY_ERROR(ENVONLY); + } ret_value = SUCCEED; done: + if (type_id >= 0) + H5Tclose(type_id); + if (dtype >= 0) + H5Tclose(dtype); if (ptdata) HDfree(ptdata); return ret_value; } /* end h5str_dump_region_points */ -#endif static int h5str_is_zero(const void *_mem, size_t size) @@ -2308,30 +2248,22 @@ h5str_render_bin_output(FILE *stream, hid_t container, hid_t tid, void *_mem, hs /* Region data */ for (block_index = 0; block_index < block_nelmts; block_index++) { mem = ((unsigned char *)_mem) + block_index * size; - if ((region_id = H5Ropen_object((const H5R_ref_t *)mem, H5P_DEFAULT, H5P_DEFAULT)) < 0) + if ((region_id = H5Ropen_object((H5R_ref_t *)mem, H5P_DEFAULT, H5P_DEFAULT)) < 0) continue; - else { - if ((region_space = - H5Ropen_region((const H5R_ref_t *)mem, H5P_DEFAULT, H5P_DEFAULT)) >= 0) { - if (!h5str_is_zero(mem, H5Tget_size(H5T_STD_REF))) { - region_type = H5Sget_select_type(region_space); - if (region_type == H5S_SEL_POINTS) - ret_value = render_bin_output_region_points(stream, region_space, - region_id, container); - else - ret_value = render_bin_output_region_blocks(stream, region_space, - region_id, container); - } - H5Sclose(region_space); - } /* end if (region_space >= 0) */ - H5Dclose(region_id); - } - - if ((region_type = H5Sget_select_type(region_space)) < 0) { + if ((region_space = H5Ropen_region((H5R_ref_t *)mem, H5P_DEFAULT, H5P_DEFAULT)) >= 0) { + if (!h5str_is_zero(mem, H5Tget_size(H5T_STD_REF))) { + region_type = H5Sget_select_type(region_space); + if (region_type == H5S_SEL_POINTS) + ret_value = render_bin_output_region_points(stream, region_space, region_id, + container); + else if (region_type == H5S_SEL_HYPERSLABS) + ret_value = render_bin_output_region_blocks(stream, region_space, region_id, + container); + } H5Sclose(region_space); - H5Dclose(region_id); - continue; - } + } /* end if (region_space >= 0) */ + H5Dclose(region_id); + if (ret_value < 0) break; } @@ -2711,6 +2643,109 @@ done: return ret_value; } /* end render_bin_output_region_points */ +/*------------------------------------------------------------------------- + * Purpose: Print some values from an attribute referenced by object reference. + * + * Parameters Description: + * FILE *buffer is the string into which to render + *------------------------------------------------------------------------- + */ +static int +h5str_dump_region_attribute(JNIEnv *env, h5str_t *str, hid_t region_id) +{ + int ret_value = SUCCEED; + hid_t atype = H5I_INVALID_HID; + hid_t type_id = H5I_INVALID_HID; + hid_t region_space = H5I_INVALID_HID; + hsize_t total_size[H5S_MAX_RANK]; /* total size of dataset*/ + size_t i; /* counter */ + size_t size; /* datum size */ + int sndims; /* rank of dataspace */ + hsize_t p_nelmts; /* total selected elmts */ + hsize_t alloc_size; + + unsigned char *buf = NULL; /* buffer for raw data */ + + /* VL data special information */ + unsigned int vl_data = 0; /* contains VL datatypes */ + + if ((region_space = H5Aget_space(region_id)) < 0) { + ret_value = FAIL; + goto done; + } + + if ((sndims = H5Sget_simple_extent_ndims(region_space)) < 0) { + ret_value = FAIL; + goto done; + } + + /* Assume entire data space to be read */ + H5Sget_simple_extent_dims(region_space, total_size, NULL); + p_nelmts = 1; + + for (i = 0; i < sndims; i++) + p_nelmts *= total_size[i]; + + if ((atype = H5Aget_type(region_id)) < 0) { + ret_value = FAIL; + goto done; + } + if ((type_id = H5Tget_native_type(atype, H5T_DIR_DEFAULT)) < 0) { + ret_value = FAIL; + goto done; + } + + /* Check if we have VL data in the dataset's datatype */ + if (h5str_detect_vlen(type_id) == TRUE) + vl_data = TRUE; + + if (!(size = H5Tget_size(type_id))) { + ret_value = FAIL; + goto done; + } + + alloc_size = p_nelmts * size; + HDassert(alloc_size == (hsize_t)((size_t)alloc_size)); /*check for overflow*/ + if (NULL != (buf = (unsigned char *)HDmalloc((size_t)alloc_size))) { + /* Read the data */ + if (H5Aread(region_id, type_id, buf) >= 0) { + + for (i = 0; i < p_nelmts; i++) { + size_t bytes_in = 0; /* # of bytes to write */ + void * memref = buf + i * size; + + if (!(bytes_in = h5str_sprintf(ENVONLY, str, region_id, type_id, memref, 1))) + CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE); + + if ((i < p_nelmts - 1) && (bytes_in > 0)) { + if (!h5str_append(str, ", ")) + H5_LIBRARY_ERROR(ENVONLY); + } + } + + /* Reclaim any VL memory, if necessary */ + if (vl_data) { + if (H5Treclaim(type_id, region_space, H5P_DEFAULT, buf) < 0) + H5_LIBRARY_ERROR(ENVONLY); + } + } + else + H5_LIBRARY_ERROR(ENVONLY); + } + +done: + if (buf) + HDfree(buf); + if (region_space >= 0) + H5Sclose(region_space); + if (type_id >= 0) + H5Tclose(type_id); + if (atype >= 0) + H5Tclose(type_id); + + return ret_value; +} + int h5str_dump_simple_dset(JNIEnv *env, FILE *stream, hid_t dset, int binary_order) { @@ -2865,7 +2900,7 @@ h5str_dump_simple_dset(JNIEnv *env, FILE *stream, hid_t dset, int binary_order) H5_LIBRARY_ERROR(ENVONLY); if (binary_order == 99) { - if (h5tools_dump_simple_data(ENVONLY, stream, dset, p_type, sm_buf, hs_nelmts) < 0) + if (h5str_dump_simple_data(ENVONLY, stream, dset, p_type, sm_buf, hs_nelmts) < 0) CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE); } else { @@ -2936,7 +2971,7 @@ H5Tdetect_variable_str(hid_t tid) } /* end H5Tdetect_variable_str */ static int -h5tools_dump_simple_data(JNIEnv *env, FILE *stream, hid_t container, hid_t type, void *_mem, hsize_t nelmts) +h5str_dump_simple_data(JNIEnv *env, FILE *stream, hid_t container, hid_t type, void *_mem, hsize_t nelmts) { unsigned char *mem = (unsigned char *)_mem; h5str_t buffer; /* string into which to render */ @@ -2956,38 +2991,38 @@ h5tools_dump_simple_data(JNIEnv *env, FILE *stream, hid_t container, hid_t type, h5str_new(&buffer, 32 * size); if (!buffer.s) - H5_OUT_OF_MEMORY_ERROR(ENVONLY, "h5tools_dump_simple_data: failed to allocate buffer"); + H5_OUT_OF_MEMORY_ERROR(ENVONLY, "h5str_dump_simple_data: failed to allocate buffer"); - if (!(bytes_in = h5str_sprintf(ENVONLY, &buffer, container, type, memref, 0, 1))) + if (!(bytes_in = h5str_sprintf(ENVONLY, &buffer, container, type, memref, 1))) CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE); - if (i > 0) { + if ((i > 0) && (bytes_in > 0)) { if (HDfprintf(stream, ", ") < 0) - H5_JNI_FATAL_ERROR(ENVONLY, "h5tools_dump_simple_data: HDfprintf failure"); + H5_JNI_FATAL_ERROR(ENVONLY, "h5str_dump_simple_data: HDfprintf failure"); if (line_count >= H5TOOLS_TEXT_BLOCK) { line_count = 0; if (HDfprintf(stream, "\n") < 0) - H5_JNI_FATAL_ERROR(ENVONLY, "h5tools_dump_simple_data: HDfprintf failure"); + H5_JNI_FATAL_ERROR(ENVONLY, "h5str_dump_simple_data: HDfprintf failure"); } } if (HDfprintf(stream, "%s", buffer.s) < 0) - H5_JNI_FATAL_ERROR(ENVONLY, "h5tools_dump_simple_data: HDfprintf failure"); + H5_JNI_FATAL_ERROR(ENVONLY, "h5str_dump_simple_data: HDfprintf failure"); h5str_free(&buffer); } /* end for (i = 0; i < nelmts... */ if (HDfprintf(stream, "\n") < 0) - H5_JNI_FATAL_ERROR(ENVONLY, "h5tools_dump_simple_data: HDfprintf failure"); + H5_JNI_FATAL_ERROR(ENVONLY, "h5str_dump_simple_data: HDfprintf failure"); done: if (buffer.s) h5str_free(&buffer); return ret_value; -} /* end h5tools_dump_simple_data */ +} /* end h5str_dump_simple_data */ /* * Utility Java APIs @@ -3041,7 +3076,7 @@ Java_hdf_hdf5lib_H5_H5AreadComplex(JNIEnv *env, jclass clss, jlong attr_id, jlon for (i = 0; i < (size_t)n; i++) { h5str.s[0] = '\0'; - if (!h5str_sprintf(ENVONLY, &h5str, attr_id, mem_type_id, readBuf + (i * size), 0, 0)) + if (!h5str_sprintf(ENVONLY, &h5str, attr_id, mem_type_id, readBuf + (i * size), 0)) CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE); if (NULL == (jstr = ENVPTR->NewStringUTF(ENVONLY, h5str.s))) diff --git a/java/src/jni/h5util.h b/java/src/jni/h5util.h index 4b79eda..a5e9607 100644 --- a/java/src/jni/h5util.h +++ b/java/src/jni/h5util.h @@ -41,13 +41,11 @@ extern void h5str_resize(h5str_t *str, size_t new_len); extern char * h5str_append(h5str_t *str, const char *cstr); extern size_t h5str_convert(JNIEnv *env, char **in_str, hid_t container, hid_t tid, void *out_buf, size_t out_buf_offset); -extern void h5str_sprint_reference(JNIEnv *env, h5str_t *out_str, hid_t container, void *ref_p); +extern int h5str_sprint_reference(JNIEnv *env, h5str_t *out_str, void *ref_p); extern size_t h5str_sprintf(JNIEnv *env, h5str_t *out_str, hid_t container, hid_t tid, void *in_buf, - size_t in_buf_len, int expand_data); + int expand_data); extern void h5str_array_free(char **strs, size_t len); extern int h5str_dump_simple_dset(JNIEnv *env, FILE *stream, hid_t dset, int binary_order); -extern int h5str_dump_region_blocks_data(JNIEnv *env, h5str_t *str, hid_t region, hid_t region_obj); -extern int h5str_dump_region_points_data(JNIEnv *env, h5str_t *str, hid_t region, hid_t region_obj); extern htri_t H5Tdetect_variable_str(hid_t tid); diff --git a/java/src/jni/h5vlImp.c b/java/src/jni/h5vlImp.c index 9b48d21..40f8863 100644 --- a/java/src/jni/h5vlImp.c +++ b/java/src/jni/h5vlImp.c @@ -1,6 +1,5 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * 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 * diff --git a/java/src/jni/h5vlImp.h b/java/src/jni/h5vlImp.h index 70c5006..bf467af 100644 --- a/java/src/jni/h5vlImp.h +++ b/java/src/jni/h5vlImp.h @@ -1,6 +1,5 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * 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 * diff --git a/java/src/jni/h5zImp.h b/java/src/jni/h5zImp.h index 924776c..4e8982e 100644 --- a/java/src/jni/h5zImp.h +++ b/java/src/jni/h5zImp.h @@ -1,6 +1,5 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * 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 * diff --git a/java/src/jni/nativeData.h b/java/src/jni/nativeData.h index 398dfc9..0150c75 100644 --- a/java/src/jni/nativeData.h +++ b/java/src/jni/nativeData.h @@ -1,6 +1,5 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * 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 * diff --git a/java/test/CMakeLists.txt b/java/test/CMakeLists.txt index b0a0d53..6544b77 100644 --- a/java/test/CMakeLists.txt +++ b/java/test/CMakeLists.txt @@ -27,6 +27,7 @@ set (HDF5_JAVA_TEST_SOURCES TestH5Lbasic TestH5Lcreate TestH5R + TestH5Rref TestH5P TestH5PData TestH5Pfapl @@ -93,6 +94,8 @@ HDFTEST_COPY_FILE("${PROJECT_SOURCE_DIR}/h5ex_g_iterate.orig" "${PROJECT_BINARY_ HDFTEST_COPY_FILE("${PROJECT_SOURCE_DIR}/h5ex_g_iterate.orig" "${PROJECT_BINARY_DIR}/h5ex_g_iterateL2.hdf" "${HDF5_JAVA_TEST_LIB_TARGET}_files") HDFTEST_COPY_FILE("${PROJECT_SOURCE_DIR}/h5ex_g_iterate.orig" "${PROJECT_BINARY_DIR}/h5ex_g_iterateO1.hdf" "${HDF5_JAVA_TEST_LIB_TARGET}_files") HDFTEST_COPY_FILE("${PROJECT_SOURCE_DIR}/h5ex_g_iterate.orig" "${PROJECT_BINARY_DIR}/h5ex_g_iterateO2.hdf" "${HDF5_JAVA_TEST_LIB_TARGET}_files") +HDFTEST_COPY_FILE("${HDF5_TOOLS_DIR}/testfiles/trefer_reg.h5" "${PROJECT_BINARY_DIR}/trefer_reg.h5" "${HDF5_JAVA_TEST_LIB_TARGET}_files") +HDFTEST_COPY_FILE("${HDF5_TOOLS_DIR}/testfiles/trefer_attr.h5" "${PROJECT_BINARY_DIR}/trefer_attr.h5" "${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}) @@ -206,6 +209,8 @@ if (HDF5_TEST_JAVA AND HDF5_TEST_SERIAL) HDFTEST_COPY_FILE("${PROJECT_SOURCE_DIR}/h5ex_g_iterate.orig" "${PROJECT_BINARY_DIR}/${voltest}/h5ex_g_iterateL2.hdf" "${HDF5_JAVA_TEST_LIB_TARGET}_${voltest}_files") HDFTEST_COPY_FILE("${PROJECT_SOURCE_DIR}/h5ex_g_iterate.orig" "${PROJECT_BINARY_DIR}/${voltest}/h5ex_g_iterateO1.hdf" "${HDF5_JAVA_TEST_LIB_TARGET}_${voltest}_files") HDFTEST_COPY_FILE("${PROJECT_SOURCE_DIR}/h5ex_g_iterate.orig" "${PROJECT_BINARY_DIR}/${voltest}/h5ex_g_iterateO2.hdf" "${HDF5_JAVA_TEST_LIB_TARGET}_${voltest}_files") + HDFTEST_COPY_FILE("${HDF5_TOOLS_DIR}/testfiles/trefer_reg.h5" "${PROJECT_BINARY_DIR}/${voltest}/trefer_reg.h5" "${HDF5_JAVA_TEST_LIB_TARGET}_${voltest}_files") + HDFTEST_COPY_FILE("${HDF5_TOOLS_DIR}/testfiles/trefer_attr.h5" "${PROJECT_BINARY_DIR}/${voltest}/trefer_attr.h5" "${HDF5_JAVA_TEST_LIB_TARGET}_${voltest}_files") add_custom_target(${HDF5_JAVA_TEST_LIB_TARGET}_${voltest}_files ALL COMMENT "Copying files needed by ${HDF5_JAVA_TEST_LIB_TARGET} tests" DEPENDS ${${HDF5_JAVA_TEST_LIB_TARGET}_${voltest}_files_list}) diff --git a/java/test/Makefile.am b/java/test/Makefile.am index e953c6b..41cd56e 100644 --- a/java/test/Makefile.am +++ b/java/test/Makefile.am @@ -1,6 +1,5 @@ # # 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 @@ -58,6 +57,7 @@ noinst_JAVA = \ TestH5Lbasic.java \ TestH5Lcreate.java \ TestH5R.java \ + TestH5Rref.java \ TestH5P.java \ TestH5PData.java \ TestH5Pfapl.java \ diff --git a/java/test/TestH5.java b/java/test/TestH5.java index 1f9ea06..a6b60d3 100644 --- a/java/test/TestH5.java +++ b/java/test/TestH5.java @@ -1,6 +1,5 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * 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 * @@ -32,6 +31,7 @@ import java.io.StreamTokenizer; import hdf.hdf5lib.H5; import hdf.hdf5lib.HDF5Constants; +import hdf.hdf5lib.exceptions.HDF5Exception; import hdf.hdf5lib.exceptions.HDF5LibraryException; import org.junit.After; @@ -47,22 +47,21 @@ import org.junit.rules.TestName; */ public class TestH5 { @Rule public TestName testname = new TestName(); - @Before - public void showTestName() { - System.out.print(testname.getMethodName()); - } - @After - public void nextTestName() { - System.out.println(); - } private static final String H5_FILE = "testData.h5"; private static final String EXPORT_FILE = "testExport.txt"; + private static final String H5_DREG_FILE = "trefer_reg.h5"; + private static final String EXPORT_DREG_FILE = "testExportReg.txt"; + private static final String H5_AREG_FILE = "trefer_attr.h5"; + private static final String EXPORT_AREG_FILE = "testExportAReg.txt"; private static final int DIM_X = 4; private static final int DIM_Y = 6; + private static final int DIM_BLKS = 36; + private static final int DIM_PNTS = 10; + private static final int DIM_ATTR = 12; private static final int RANK = 2; - long H5fid = -1; - long H5dsid = -1; - long H5did = -1; + long H5fid = HDF5Constants.H5I_INVALID_HID; + long H5dsid = HDF5Constants.H5I_INVALID_HID; + long H5did = HDF5Constants.H5I_INVALID_HID; long[] H5dims = { DIM_X, DIM_Y }; private final void _deleteFile(String filename) { @@ -78,7 +77,7 @@ public class TestH5 { } private final long _createDataset(long fid, long dsid, String name, long dapl) { - long did = -1; + long did = HDF5Constants.H5I_INVALID_HID; try { did = H5.H5Dcreate(fid, name, HDF5Constants.H5T_STD_I32LE, dsid, HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT, dapl); @@ -115,22 +114,64 @@ public class TestH5 { } } - public final void _closeH5File() throws HDF5LibraryException { + private final void _closeH5File() { if (H5did >= 0) try {H5.H5Dclose(H5did);} catch (Exception ex) {} if (H5dsid > 0) try {H5.H5Sclose(H5dsid);} catch (Exception ex) {} if (H5fid > 0) try {H5.H5Fclose(H5fid);} catch (Exception ex) {} - H5fid = -1; - H5dsid = -1; - H5did = -1; + H5fid = HDF5Constants.H5I_INVALID_HID; + H5dsid = HDF5Constants.H5I_INVALID_HID; + H5did = HDF5Constants.H5I_INVALID_HID; + } + + public void _openH5File(String filename, String dsetname) { + try { + H5fid = H5.H5Fopen(filename, + HDF5Constants.H5F_ACC_RDWR, HDF5Constants.H5P_DEFAULT); + } + catch (Throwable err) { + err.printStackTrace(); + fail("TestH5._openH5file: " + err); + } + assertTrue("TestH5._openH5file: H5.H5Fopen: ", H5fid >= 0); + try { + H5did = H5.H5Dopen(H5fid, dsetname, HDF5Constants.H5P_DEFAULT); + } + catch (Throwable err) { + err.printStackTrace(); + fail("TestH5._openH5file: " + err); + } + assertTrue("TestH5._openH5file: H5.H5Dopen: ", H5did >= 0); + try { + H5dsid = H5.H5Dget_space(H5did); + } + catch (Throwable err) { + err.printStackTrace(); + fail("TestH5._openH5file: " + err); + } + assertTrue("TestH5._openH5file: H5.H5Screate_simple: ",H5dsid > 0); } public final void _deleteH5file() { + _closeH5File(); _deleteFile(H5_FILE); } + @After + public void closeH5File() throws HDF5LibraryException { + _closeH5File(); + System.out.println(); + } + + @Before + public void verifyCount() + throws NullPointerException, HDF5Exception { + assertTrue("H5 open ids is 0", H5.getOpenIDCount()==0); + System.out.print(testname.getMethodName()); + } + /** * Test method for {@link hdf.hdf5lib.H5#J2C(int)}. * NOTE: @@ -411,4 +452,84 @@ public class TestH5 { } _deleteH5file(); } + + @Test + public void testH5export_regdataset() { + int[] dset_data_expect = {66, 69, 72, 75, 78, 81, 96, 99, 102, 105, 108, + 111, 126, 129, 132, 135, 138, 141, 156, 159, 162, 165, 168, 171, + 186, 189, 192, 195, 198, 201, 216, 219, 222, 225, 228, 231, + 207, 66, 252, 48, 84, 96, 12, 14, 213, 99}; + int[] dset_indata = new int[DIM_BLKS+DIM_PNTS]; + String objName = "/Dataset1"; + + _openH5File(H5_DREG_FILE, objName); + + try { + H5.H5export_dataset(EXPORT_DREG_FILE, H5_DREG_FILE, objName, 99); + } + catch (HDF5LibraryException err) { + err.printStackTrace(); + fail("H5export_dataset failed: " + err); + } + + File file = new File(EXPORT_DREG_FILE); + + try { + Reader reader = new FileReader(EXPORT_DREG_FILE); + StreamTokenizer streamTokenizer = new StreamTokenizer(reader); + int indx = 0; + while(streamTokenizer.nextToken() != StreamTokenizer.TT_EOF){ + if(streamTokenizer.ttype == StreamTokenizer.TT_NUMBER) { + dset_indata[indx] = (int)streamTokenizer.nval; + indx++; + } + } + reader.close(); + } + catch (IOException err) { + err.printStackTrace(); + fail("read file failed: " + err); + } + for(int row = 0; row < DIM_X; row++) + assertTrue("H5export_dataset: <"+row+">"+dset_indata[row], dset_indata[row]==dset_data_expect[row]); + } + + @Test + public void testH5export_attrdataset() { + int[] dset_data_expect = {0, 3, 6, 9, 1, 4, 7, 10, 2, 5, 8, 11}; + int[] dset_indata = new int[DIM_ATTR]; + String objName = "/Dataset3"; + + _openH5File(H5_AREG_FILE, objName); + + try { + H5.H5export_dataset(EXPORT_AREG_FILE, H5_AREG_FILE, objName, 99); + } + catch (HDF5LibraryException err) { + err.printStackTrace(); + fail("H5export_dataset failed: " + err); + } + + File file = new File(EXPORT_AREG_FILE); + + try { + Reader reader = new FileReader(EXPORT_AREG_FILE); + StreamTokenizer streamTokenizer = new StreamTokenizer(reader); + int indx = 0; + int jndx = 0; + while(streamTokenizer.nextToken() != StreamTokenizer.TT_EOF){ + if(streamTokenizer.ttype == StreamTokenizer.TT_NUMBER) { + dset_indata[indx] = (int)streamTokenizer.nval; + indx++; + } + } + reader.close(); + } + catch (IOException err) { + err.printStackTrace(); + fail("read file failed: " + err); + } + for(int row = 0; row < DIM_X; row++) + assertTrue("H5export_dataset: <"+row+">"+dset_indata[row], dset_indata[row]==dset_data_expect[row]); + } } diff --git a/java/test/TestH5A.java b/java/test/TestH5A.java index cff03f9..f2134d2 100644 --- a/java/test/TestH5A.java +++ b/java/test/TestH5A.java @@ -1,6 +1,5 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * 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 * @@ -43,14 +42,14 @@ public class TestH5A { private static final String H5_FILE = "testA.h5"; private static final int DIM_X = 4; private static final int DIM_Y = 6; - long H5fid = -1; - long H5dsid = -1; - long H5did = -1; + long H5fid = HDF5Constants.H5I_INVALID_HID; + long H5dsid = HDF5Constants.H5I_INVALID_HID; + long H5did = HDF5Constants.H5I_INVALID_HID; long[] H5dims = { DIM_X, DIM_Y }; - long type_id = -1; - long space_id = -1; - long lapl_id = -1; - long aapl_id = -1; + long type_id = HDF5Constants.H5I_INVALID_HID; + long space_id = HDF5Constants.H5I_INVALID_HID; + long lapl_id = HDF5Constants.H5I_INVALID_HID; + long aapl_id = HDF5Constants.H5I_INVALID_HID; private final void _deleteFile(String filename) { File file = new File(filename); @@ -61,7 +60,7 @@ public class TestH5A { } private final long _createDataset(long fid, long dsid, String name, long dapl) { - long did = -1; + long did = HDF5Constants.H5I_INVALID_HID; try { did = H5.H5Dcreate(fid, name, HDF5Constants.H5T_STD_I32BE, dsid, HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT, dapl); @@ -132,7 +131,7 @@ public class TestH5A { @Test public void testH5Acreate2() { - long attr_id = -1; + long attr_id = HDF5Constants.H5I_INVALID_HID; try { attr_id = H5.H5Acreate(H5did, "dset", type_id, space_id, HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT); assertTrue("testH5Acreate2", attr_id >= 0); @@ -160,8 +159,8 @@ public class TestH5A { @Test public void testH5Aopen() { String attr_name = "dset"; - long attribute_id = -1; - long attr_id = -1; + long attribute_id = HDF5Constants.H5I_INVALID_HID; + long attr_id = HDF5Constants.H5I_INVALID_HID; try { attr_id = H5.H5Acreate(H5did, attr_name, type_id, space_id, @@ -197,8 +196,8 @@ public class TestH5A { int idx_type = HDF5Constants.H5_INDEX_CRT_ORDER; int order = HDF5Constants.H5_ITER_INC; long n = 0; - long attr_id = -1; - long attribute_id = -1; + long attr_id = HDF5Constants.H5I_INVALID_HID; + long attribute_id = HDF5Constants.H5I_INVALID_HID; try { attr_id = H5.H5Acreate(H5did, "file", type_id, space_id, @@ -256,7 +255,7 @@ public class TestH5A { public void testH5Acreate_by_name() { String obj_name = "."; String attr_name = "DATASET"; - long attribute_id = -1; + long attribute_id = HDF5Constants.H5I_INVALID_HID; boolean bool_val = false; try { @@ -288,7 +287,7 @@ public class TestH5A { long loc_id = H5fid; String old_attr_name = "old"; String new_attr_name = "new"; - long attr_id = -1; + long attr_id = HDF5Constants.H5I_INVALID_HID; int ret_val = -1; boolean bool_val = false; @@ -326,7 +325,7 @@ public class TestH5A { String obj_name = "."; String old_attr_name = "old"; String new_attr_name = "new"; - long attr_id = -1; + long attr_id = HDF5Constants.H5I_INVALID_HID; int ret_val = -1; boolean bool_val = false; @@ -368,7 +367,7 @@ public class TestH5A { String obj_name = "."; String attr_name = "DATASET1"; String ret_name = null; - long attribute_id = -1; + long attribute_id = HDF5Constants.H5I_INVALID_HID; try { attribute_id = H5.H5Acreate_by_name(H5fid, obj_name, attr_name, @@ -398,8 +397,8 @@ public class TestH5A { int idx_type = HDF5Constants.H5_INDEX_NAME; int order = HDF5Constants.H5_ITER_INC; int n = 0; - long attr1_id = -1; - long attr2_id = -1; + long attr1_id = HDF5Constants.H5I_INVALID_HID; + long attr2_id = HDF5Constants.H5I_INVALID_HID; try { attr1_id = H5.H5Acreate_by_name(loc_id, obj_name, attr_name, @@ -435,8 +434,8 @@ public class TestH5A { @Test public void testH5Aget_storage_size() { - long attr_id = -1; - long attr_size = -1; + long attr_id = HDF5Constants.H5I_INVALID_HID; + long attr_size = HDF5Constants.H5I_INVALID_HID; try { attr_id = H5.H5Acreate(H5did, "dset", type_id, space_id, @@ -458,8 +457,8 @@ public class TestH5A { @Test public void testH5Aget_info() { H5A_info_t attr_info = null; - long attribute_id = -1; - long attr_id = -1; + long attribute_id = HDF5Constants.H5I_INVALID_HID; + long attr_id = HDF5Constants.H5I_INVALID_HID; try { attr_id = H5.H5Acreate(H5did, "dset", type_id, space_id, @@ -490,8 +489,8 @@ public class TestH5A { @Test public void testH5Aget_info1() { H5A_info_t attr_info = null; - long attribute_id = -1; - long attr_id = -1; + long attribute_id = HDF5Constants.H5I_INVALID_HID; + long attr_id = HDF5Constants.H5I_INVALID_HID; int order = HDF5Constants.H5_ITER_INC; try { @@ -526,8 +525,8 @@ public class TestH5A { @Test public void testH5Aget_info_by_idx() { - long attr_id = -1; - long attr2_id = -1;; + long attr_id = HDF5Constants.H5I_INVALID_HID; + long attr2_id = HDF5Constants.H5I_INVALID_HID;; H5A_info_t attr_info = null; try { @@ -582,7 +581,7 @@ public class TestH5A { @Test public void testH5Aget_info_by_name() { - long attr_id = -1; + long attr_id = HDF5Constants.H5I_INVALID_HID; H5A_info_t attr_info = null; String obj_name = "."; String attr_name = "DATASET"; @@ -607,7 +606,7 @@ public class TestH5A { @Test public void testH5Adelete_by_name() { - long attr_id = -1; + long attr_id = HDF5Constants.H5I_INVALID_HID; int ret_val = -1; boolean bool_val = false; boolean exists = false; @@ -650,8 +649,8 @@ public class TestH5A { @Test public void testH5Aexists() { boolean exists = false; - long attr_id = -1; - long attribute_id = -1; + long attr_id = HDF5Constants.H5I_INVALID_HID; + long attribute_id = HDF5Constants.H5I_INVALID_HID; try { exists = H5.H5Aexists(H5fid, "None"); @@ -689,10 +688,10 @@ public class TestH5A { @Test public void testH5Adelete_by_idx_order() { boolean exists = false; - long attr1_id = -1; - long attr2_id = -1; - long attr3_id = -1; - long attr4_id = -1; + long attr1_id = HDF5Constants.H5I_INVALID_HID; + long attr2_id = HDF5Constants.H5I_INVALID_HID; + long attr3_id = HDF5Constants.H5I_INVALID_HID; + long attr4_id = HDF5Constants.H5I_INVALID_HID; try { attr1_id = H5.H5Acreate_by_name(H5fid, ".", "attribute1", @@ -731,9 +730,9 @@ public class TestH5A { @Test public void testH5Adelete_by_idx_name1() { boolean exists = false; - long attr1_id = -1; - long attr2_id = -1; - long attr3_id = -1; + long attr1_id = HDF5Constants.H5I_INVALID_HID; + long attr2_id = HDF5Constants.H5I_INVALID_HID; + long attr3_id = HDF5Constants.H5I_INVALID_HID; try { attr1_id = H5.H5Acreate_by_name(H5fid, ".", "attribute1", @@ -766,10 +765,10 @@ public class TestH5A { @Test public void testH5Adelete_by_idx_name2() { boolean exists = false; - long attr1_id = -1; - long attr2_id = -1; - long attr3_id = -1; - long attr4_id = -1; + long attr1_id = HDF5Constants.H5I_INVALID_HID; + long attr2_id = HDF5Constants.H5I_INVALID_HID; + long attr3_id = HDF5Constants.H5I_INVALID_HID; + long attr4_id = HDF5Constants.H5I_INVALID_HID; try { attr1_id = H5.H5Acreate_by_name(H5fid, ".", "attribute1", @@ -821,8 +820,8 @@ public class TestH5A { public void testH5Aopen_by_name() { String obj_name = "."; String attr_name = "DATASET"; - long attribute_id = -1; - long aid = -1; + long attribute_id = HDF5Constants.H5I_INVALID_HID; + long aid = HDF5Constants.H5I_INVALID_HID; try { attribute_id = H5.H5Acreate_by_name(H5fid, obj_name, attr_name, @@ -856,9 +855,9 @@ public class TestH5A { @Test public void testH5Awrite_readVL() { String attr_name = "VLdata"; - long attr_id = -1; - long atype_id = -1; - long aspace_id = -1; + long attr_id = HDF5Constants.H5I_INVALID_HID; + long atype_id = HDF5Constants.H5I_INVALID_HID; + long aspace_id = HDF5Constants.H5I_INVALID_HID; String[] str_data = { "Parting", "is such", "sweet", "sorrow." }; long[] dims = { str_data.length }; long lsize = 1; @@ -923,8 +922,8 @@ public class TestH5A { public void testH5Aget_create_plist() { String attr_name = "DATASET1"; int char_encoding = 0; - long plist_id = -1; - long attribute_id = -1; + long plist_id = HDF5Constants.H5I_INVALID_HID; + long attribute_id = HDF5Constants.H5I_INVALID_HID; try { plist_id = H5.H5Pcreate(HDF5Constants.H5P_ATTRIBUTE_CREATE); @@ -984,10 +983,10 @@ public class TestH5A { @Test public void testH5Aiterate() { - long attr1_id = -1; - long attr2_id = -1; - long attr3_id = -1; - long attr4_id = -1; + long attr1_id = HDF5Constants.H5I_INVALID_HID; + long attr2_id = HDF5Constants.H5I_INVALID_HID; + long attr3_id = HDF5Constants.H5I_INVALID_HID; + long attr4_id = HDF5Constants.H5I_INVALID_HID; class idata { public String attr_name = null; @@ -1052,10 +1051,10 @@ public class TestH5A { @Test public void testH5Aiterate_by_name() { - long attr1_id = -1; - long attr2_id = -1; - long attr3_id = -1; - long attr4_id = -1; + long attr1_id = HDF5Constants.H5I_INVALID_HID; + long attr2_id = HDF5Constants.H5I_INVALID_HID; + long attr3_id = HDF5Constants.H5I_INVALID_HID; + long attr4_id = HDF5Constants.H5I_INVALID_HID; class idata { public String attr_name = null; diff --git a/java/test/TestH5D.java b/java/test/TestH5D.java index 21f0879..863ce79 100644 --- a/java/test/TestH5D.java +++ b/java/test/TestH5D.java @@ -1,6 +1,5 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * 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 * @@ -39,13 +38,13 @@ public class TestH5D { private static final int DIM_X = 4; private static final int DIM_Y = 6; private static final int RANK = 2; - long H5fid = -1; - long H5faplid = -1; - long H5dsid = -1; - long H5dtid = -1; - long H5did = -1; - long H5did0 = -1; - long H5dcpl_id = -1; + long H5fid = HDF5Constants.H5I_INVALID_HID; + long H5faplid = HDF5Constants.H5I_INVALID_HID; + long H5dsid = HDF5Constants.H5I_INVALID_HID; + long H5dtid = HDF5Constants.H5I_INVALID_HID; + long H5did = HDF5Constants.H5I_INVALID_HID; + long H5did0 = HDF5Constants.H5I_INVALID_HID; + long H5dcpl_id = HDF5Constants.H5I_INVALID_HID; long[] H5dims = { DIM_X, DIM_Y }; // Values for the status of space allocation @@ -195,9 +194,9 @@ public class TestH5D { try {H5.H5Fclose(H5fid);} catch (Exception ex) {} } - private final void _openH5file(String name, long dapl) { + private final void _openH5file(String filename, String dsetname, long dapl) { try { - H5fid = H5.H5Fopen(H5_FILE, + H5fid = H5.H5Fopen(filename, HDF5Constants.H5F_ACC_RDWR, HDF5Constants.H5P_DEFAULT); } catch (Throwable err) { @@ -206,7 +205,7 @@ public class TestH5D { } assertTrue("TestH5D._openH5file: H5.H5Fopen: ",H5fid >= 0); try { - H5did = H5.H5Dopen(H5fid, name, dapl); + H5did = H5.H5Dopen(H5fid, dsetname, dapl); } catch (Throwable err) { err.printStackTrace(); @@ -268,7 +267,7 @@ public class TestH5D { @Test public void testH5Dcreate() { - long dataset_id = -1; + long dataset_id = HDF5Constants.H5I_INVALID_HID; try { dataset_id = H5.H5Dcreate(H5fid, "dset", HDF5Constants.H5T_STD_I32BE, H5dsid, @@ -292,7 +291,7 @@ public class TestH5D { @Test public void testH5Dcreate_anon() { - long dataset_id = -1; + long dataset_id = HDF5Constants.H5I_INVALID_HID; try { dataset_id = H5.H5Dcreate_anon(H5fid, HDF5Constants.H5T_STD_I32BE, H5dsid, HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT); @@ -315,12 +314,12 @@ public class TestH5D { @Test public void testH5Dopen() { - long dataset_id = -1; + long dataset_id = HDF5Constants.H5I_INVALID_HID; _createDataset(H5fid, H5dsid, "dset", HDF5Constants.H5P_DEFAULT); try { H5.H5Dclose(H5did); - H5did = -1; + H5did = HDF5Constants.H5I_INVALID_HID; dataset_id = H5.H5Dopen(H5fid, "dset", HDF5Constants.H5P_DEFAULT); } catch (Exception err) { @@ -388,8 +387,8 @@ public class TestH5D { @Test public void testH5Dget_access_plist() { - long dapl_id = -1; - long test_dapl_id = -1; + long dapl_id = HDF5Constants.H5I_INVALID_HID; + long test_dapl_id = HDF5Constants.H5I_INVALID_HID; int[] mdc_nelmts1 = {0}; int[] mdc_nelmts2 = {0}; long[] rdcc_nelmts1 = {0}; @@ -500,7 +499,7 @@ public class TestH5D { @Test(expected = HDF5LibraryException.class) public void testH5Dget_space_closed() throws Throwable { - long dataset_id = -1; + long dataset_id = HDF5Constants.H5I_INVALID_HID; try { dataset_id = H5.H5Dcreate(H5fid, "dset", HDF5Constants.H5T_STD_I32BE, H5dsid, @@ -518,7 +517,7 @@ public class TestH5D { @Test public void testH5Dget_space() { - long dataspace_id = -1; + long dataspace_id = HDF5Constants.H5I_INVALID_HID; _createDataset(H5fid, H5dsid, "dset", HDF5Constants.H5P_DEFAULT); try { @@ -542,7 +541,7 @@ public class TestH5D { @Test(expected = HDF5LibraryException.class) public void testH5Dget_type_closed() throws Throwable { - long dataset_id = -1; + long dataset_id = HDF5Constants.H5I_INVALID_HID; try { dataset_id = H5.H5Dcreate(H5fid, "dset", HDF5Constants.H5T_STD_I32BE, H5dsid, @@ -560,7 +559,7 @@ public class TestH5D { @Test public void testH5Dget_type() { - long datatype_id = -1; + long datatype_id = HDF5Constants.H5I_INVALID_HID; _createDataset(H5fid, H5dsid, "dset", HDF5Constants.H5P_DEFAULT); try { diff --git a/java/test/TestH5Dparams.java b/java/test/TestH5Dparams.java index 66f0d83..3661139 100644 --- a/java/test/TestH5Dparams.java +++ b/java/test/TestH5Dparams.java @@ -1,6 +1,5 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * 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 * diff --git a/java/test/TestH5Dplist.java b/java/test/TestH5Dplist.java index 97ce084..774b9dd 100644 --- a/java/test/TestH5Dplist.java +++ b/java/test/TestH5Dplist.java @@ -1,6 +1,5 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * 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 * @@ -42,10 +41,10 @@ public class TestH5Dplist { private static final int NDIMS = 2; private static final int FILLVAL = 99; private static final int RANK = 2; - long H5fid = -1; - long H5dsid = -1; - long H5did = -1; - long H5dcpl_id = -1; + long H5fid = HDF5Constants.H5I_INVALID_HID; + long H5dsid = HDF5Constants.H5I_INVALID_HID; + long H5did = HDF5Constants.H5I_INVALID_HID; + long H5dcpl_id = HDF5Constants.H5I_INVALID_HID; long[] H5dims = { DIM_X, DIM_Y }; long[] H5extdims = { EDIM_X, EDIM_Y }; long[] H5chunk_dims = { CHUNK_X, CHUNK_Y }; diff --git a/java/test/TestH5E.java b/java/test/TestH5E.java index 68cd933..cad0a06 100644 --- a/java/test/TestH5E.java +++ b/java/test/TestH5E.java @@ -1,6 +1,5 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * 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 * diff --git a/java/test/TestH5Edefault.java b/java/test/TestH5Edefault.java index 2f05c75..9e93cea 100644 --- a/java/test/TestH5Edefault.java +++ b/java/test/TestH5Edefault.java @@ -1,6 +1,5 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * 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 * @@ -58,27 +57,27 @@ public class TestH5Edefault { @Ignore public void testH5Eprint() { - /* - * If HDF5_VOL_CONNECTOR is set, this might not be the - * native connector and the error stack might be different. - * Only check for the specific error stack if the native - * connector is being used. - */ - String connector = System.getenv("HDF5_VOL_CONNECTOR"); - if (connector == null) { - try { - H5.H5Fopen("test", HDF5Constants.H5F_ACC_RDWR, HDF5Constants.H5P_DEFAULT); - } - catch (Throwable err) { - } - try { - H5.H5Eprint2(HDF5Constants.H5E_DEFAULT, null); - } - catch (Throwable err) { - err.printStackTrace(); - fail("H5.H5Eprint: " + err); - } - } + /* + * If HDF5_VOL_CONNECTOR is set, this might not be the + * native connector and the error stack might be different. + * Only check for the specific error stack if the native + * connector is being used. + */ + String connector = System.getenv("HDF5_VOL_CONNECTOR"); + if (connector == null) { + try { + H5.H5Fopen("test", HDF5Constants.H5F_ACC_RDWR, HDF5Constants.H5P_DEFAULT); + } + catch (Throwable err) { + } + try { + H5.H5Eprint2(HDF5Constants.H5E_DEFAULT, null); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5.H5Eprint: " + err); + } + } } @Test @@ -439,27 +438,27 @@ public class TestH5Edefault { @Ignore public void testH5EprintInt() { - /* - * If HDF5_VOL_CONNECTOR is set, this might not be the - * native connector and the error stack might be different. - * Only check for the specific error stack if the native - * connector is being used. - */ - String connector = System.getenv("HDF5_VOL_CONNECTOR"); - if (connector == null) { - try { - H5.H5Fopen("test", HDF5Constants.H5F_ACC_RDWR, HDF5Constants.H5P_DEFAULT); - } - catch (Throwable err) { - } - try { - H5.H5Eprint2(HDF5Constants.H5E_DEFAULT, null); - } - catch (Throwable err) { - err.printStackTrace(); - fail("H5.H5EprintInt: " + err); - } - } + /* + * If HDF5_VOL_CONNECTOR is set, this might not be the + * native connector and the error stack might be different. + * Only check for the specific error stack if the native + * connector is being used. + */ + String connector = System.getenv("HDF5_VOL_CONNECTOR"); + if (connector == null) { + try { + H5.H5Fopen("test", HDF5Constants.H5F_ACC_RDWR, HDF5Constants.H5P_DEFAULT); + } + catch (Throwable err) { + } + try { + H5.H5Eprint2(HDF5Constants.H5E_DEFAULT, null); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5.H5EprintInt: " + err); + } + } } @Test diff --git a/java/test/TestH5Eparams.java b/java/test/TestH5Eparams.java index e74475f..e55f1fc 100644 --- a/java/test/TestH5Eparams.java +++ b/java/test/TestH5Eparams.java @@ -1,6 +1,5 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * 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 * diff --git a/java/test/TestH5Eregister.java b/java/test/TestH5Eregister.java index 99f8303..99e8e5f 100644 --- a/java/test/TestH5Eregister.java +++ b/java/test/TestH5Eregister.java @@ -1,6 +1,5 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * 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 * diff --git a/java/test/TestH5F.java b/java/test/TestH5F.java index 3ef4635..16786b9 100644 --- a/java/test/TestH5F.java +++ b/java/test/TestH5F.java @@ -1,6 +1,5 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * 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 * @@ -49,7 +48,7 @@ public class TestH5F { HDF5Constants.H5F_OBJ_DATASET, HDF5Constants.H5F_OBJ_GROUP, HDF5Constants.H5F_OBJ_DATATYPE, HDF5Constants.H5F_OBJ_ATTR, HDF5Constants.H5F_OBJ_ALL }; - long H5fid = -1; + long H5fid = HDF5Constants.H5I_INVALID_HID; private final void _deleteFile(String filename) { File file = new File(filename); @@ -74,7 +73,7 @@ public class TestH5F { public void deleteH5file() throws HDF5LibraryException { if (H5fid > 0) { try {H5.H5Fclose(H5fid);} catch (Exception ex) {} - H5fid = -1; + H5fid = HDF5Constants.H5I_INVALID_HID; } _deleteFile(H5_FILE); System.out.println(); @@ -82,7 +81,7 @@ public class TestH5F { @Test public void testH5Fget_create_plist() { - long plist = -1; + long plist = HDF5Constants.H5I_INVALID_HID; try { plist = H5.H5Fget_create_plist(H5fid); @@ -106,7 +105,7 @@ public class TestH5F { @Test public void testH5Fget_access_plist() { - long plist = -1; + long plist = HDF5Constants.H5I_INVALID_HID; try { plist = H5.H5Fget_access_plist(H5fid); @@ -134,7 +133,7 @@ public class TestH5F { if (H5fid > 0) { try {H5.H5Fclose(H5fid);} catch (Exception ex) {} - H5fid = -1; + H5fid = HDF5Constants.H5I_INVALID_HID; } try { @@ -159,7 +158,7 @@ public class TestH5F { if (H5fid > 0) { try {H5.H5Fclose(H5fid);} catch (Exception ex) {} - H5fid = -1; + H5fid = HDF5Constants.H5I_INVALID_HID; } try { @@ -182,8 +181,8 @@ public class TestH5F { public void testH5Fget_fileno_same() { long fileno1 = 0; long fileno2 = 0; - long fid1 = -1; - long fid2 = -1; + long fid1 = HDF5Constants.H5I_INVALID_HID; + long fid2 = HDF5Constants.H5I_INVALID_HID; try { fid1 = H5.H5Fcreate(H5_FILE2, HDF5Constants.H5F_ACC_TRUNC, @@ -213,7 +212,7 @@ public class TestH5F { public void testH5Fget_fileno_diff() { long fileno1 = 0; long fileno2 = 0; - long fid2 = -1; + long fid2 = HDF5Constants.H5I_INVALID_HID; try { fid2 = H5.H5Fcreate(H5_FILE2, HDF5Constants.H5F_ACC_TRUNC, diff --git a/java/test/TestH5Fbasic.java b/java/test/TestH5Fbasic.java index 225e311..4f3d928 100644 --- a/java/test/TestH5Fbasic.java +++ b/java/test/TestH5Fbasic.java @@ -1,6 +1,5 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * 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 * @@ -35,7 +34,7 @@ public class TestH5Fbasic { @Rule public TestName testname = new TestName(); private static final String H5_FILE = "testFb.h5"; private static final String TXT_FILE = "testFb.txt"; - long H5fid = -1; + long H5fid = HDF5Constants.H5I_INVALID_HID; private final void _deleteFile(String filename) { File file = new File(filename); @@ -90,7 +89,7 @@ public class TestH5Fbasic { @Test(expected = HDF5LibraryException.class) public void testH5Fopen_read_only() throws Throwable { - long fid = -1; + long fid = HDF5Constants.H5I_INVALID_HID; try { fid = H5.H5Fopen(H5_FILE, HDF5Constants.H5F_ACC_RDWR, @@ -125,8 +124,8 @@ public class TestH5Fbasic { @Test(expected = HDF5LibraryException.class) public void testH5Freopen_closed() throws Throwable { - long fid = -1; - long fid2 = -1; + long fid = HDF5Constants.H5I_INVALID_HID; + long fid2 = HDF5Constants.H5I_INVALID_HID; try { fid = H5.H5Fopen(H5_FILE, HDF5Constants.H5F_ACC_RDWR, @@ -148,8 +147,8 @@ public class TestH5Fbasic { @Test public void testH5Freopen() { - long fid = -1; - long fid2 = -1; + long fid = HDF5Constants.H5I_INVALID_HID; + long fid2 = HDF5Constants.H5I_INVALID_HID; try { fid = H5.H5Fopen(H5_FILE, HDF5Constants.H5F_ACC_RDWR, @@ -182,7 +181,7 @@ public class TestH5Fbasic { @Test public void testH5Fclose() { - long fid = -1; + long fid = HDF5Constants.H5I_INVALID_HID; try { fid = H5.H5Fopen(H5_FILE, HDF5Constants.H5F_ACC_RDWR, @@ -202,7 +201,7 @@ public class TestH5Fbasic { @Test(expected = HDF5LibraryException.class) public void testH5Fclose_twice() throws Throwable { - long fid = -1; + long fid = HDF5Constants.H5I_INVALID_HID; try { fid = H5.H5Fopen(H5_FILE, HDF5Constants.H5F_ACC_RDWR, diff --git a/java/test/TestH5Fparams.java b/java/test/TestH5Fparams.java index 85bfdf5..0376485 100644 --- a/java/test/TestH5Fparams.java +++ b/java/test/TestH5Fparams.java @@ -1,6 +1,5 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * 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 * @@ -105,7 +104,7 @@ public class TestH5Fparams { @Test public void testH5Fcreate() { - long fid = -1; + long fid = HDF5Constants.H5I_INVALID_HID; File file = null; try { @@ -132,7 +131,7 @@ public class TestH5Fparams { @Test public void testH5Fflush_global() { - long fid = -1; + long fid = HDF5Constants.H5I_INVALID_HID; try { fid = H5.H5Fcreate("test.h5", HDF5Constants.H5F_ACC_TRUNC, @@ -158,7 +157,7 @@ public class TestH5Fparams { @Test public void testH5Fflush_local() { - long fid = -1; + long fid = HDF5Constants.H5I_INVALID_HID; try { fid = H5.H5Fcreate("test.h5", HDF5Constants.H5F_ACC_TRUNC, @@ -184,7 +183,7 @@ public class TestH5Fparams { @Test public void testH5Fget_info() { - long fid = -1; + long fid = HDF5Constants.H5I_INVALID_HID; try { try { @@ -215,7 +214,7 @@ public class TestH5Fparams { @Ignore//(expected = HDF5FunctionArgumentException.class) public void testH5Fset_libver_bounds_invalidlow() throws Throwable { - long fid = -1; + long fid = HDF5Constants.H5I_INVALID_HID; try { try { @@ -234,7 +233,7 @@ public class TestH5Fparams { @Ignore//(expected = HDF5FunctionArgumentException.class) public void testH5Fset_libver_bounds_invalidhigh() throws Throwable { - long fid = -1; + long fid = HDF5Constants.H5I_INVALID_HID; try { try { diff --git a/java/test/TestH5Fswmr.java b/java/test/TestH5Fswmr.java index 6a7ccfa..1ec78fe 100644 --- a/java/test/TestH5Fswmr.java +++ b/java/test/TestH5Fswmr.java @@ -1,6 +1,5 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * 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 * @@ -33,9 +32,9 @@ public class TestH5Fswmr { @Rule public TestName testname = new TestName(); private static final String H5_FILE = "testswmr.h5"; - long H5fid = -1; - long H5fapl = -1; - long H5fcpl = -1; + long H5fid = HDF5Constants.H5I_INVALID_HID; + long H5fapl = HDF5Constants.H5I_INVALID_HID; + long H5fcpl = HDF5Constants.H5I_INVALID_HID; private final void _deleteFile(String filename) { File file = new File(filename); @@ -63,15 +62,15 @@ public class TestH5Fswmr { public void deleteH5file() throws HDF5LibraryException { if (H5fapl > 0) { try {H5.H5Pclose(H5fapl);} catch (Exception ex) {} - H5fapl = -1; + H5fapl = HDF5Constants.H5I_INVALID_HID; } if (H5fcpl > 0) { try {H5.H5Pclose(H5fcpl);} catch (Exception ex) {} - H5fcpl = -1; + H5fcpl = HDF5Constants.H5I_INVALID_HID; } if (H5fid > 0) { try {H5.H5Fclose(H5fid);} catch (Exception ex) {} - H5fid = -1; + H5fid = HDF5Constants.H5I_INVALID_HID; } _deleteFile(H5_FILE); System.out.println(); diff --git a/java/test/TestH5G.java b/java/test/TestH5G.java index abd9642..edf2cbe 100644 --- a/java/test/TestH5G.java +++ b/java/test/TestH5G.java @@ -1,6 +1,5 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * 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 * @@ -39,11 +38,11 @@ public class TestH5G { private static final String[] GROUPS = { "/G1", "/G1/G11", "/G1/G12", "/G1/G11/G111", "/G1/G11/G112", "/G1/G11/G113", "/G1/G11/G114" }; private static final String[] GROUPS2 = { "/G1", "/G1/G14", "/G1/G12", "/G1/G13", "/G1/G11"}; - long H5fid = -1; - long H5fid2 = -1; + long H5fid = HDF5Constants.H5I_INVALID_HID; + long H5fid2 = HDF5Constants.H5I_INVALID_HID; private final long _createGroup(long fid, String name) { - long gid = -1; + long gid = HDF5Constants.H5I_INVALID_HID; try { gid = H5.H5Gcreate(fid, name, HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT); @@ -58,8 +57,8 @@ public class TestH5G { } private final long _createGroup2(long fid, String name) { - long gid = -1; - long gcpl = -1; + long gid = HDF5Constants.H5I_INVALID_HID; + long gcpl = HDF5Constants.H5I_INVALID_HID; try { gcpl = H5.H5Pcreate(HDF5Constants.H5P_GROUP_CREATE); //create gcpl } @@ -92,12 +91,12 @@ public class TestH5G { } private final long _openGroup(long fid, String name) { - long gid = -1; + long gid = HDF5Constants.H5I_INVALID_HID; try { gid = H5.H5Gopen(fid, name, HDF5Constants.H5P_DEFAULT); } catch (Throwable err) { - gid = -1; + gid = HDF5Constants.H5I_INVALID_HID; err.printStackTrace(); fail("H5.H5Gopen: " + err); } @@ -134,7 +133,7 @@ public class TestH5G { assertTrue("TestH5G.createH5file: H5.H5Fcreate: ", H5fid > 0); assertTrue("TestH5G.createH5file: H5.H5Fcreate: ", H5fid2 > 0); - long gid = -1; + long gid = HDF5Constants.H5I_INVALID_HID; for (int i = 0; i < GROUPS.length; i++) { gid = _createGroup(H5fid, GROUPS[i]); @@ -165,7 +164,7 @@ public class TestH5G { @Test public void testH5Gopen() { - long gid = -1; + long gid = HDF5Constants.H5I_INVALID_HID; for (int i = 0; i < GROUPS.length; i++) { try { gid = H5.H5Gopen(H5fid, GROUPS[i], HDF5Constants.H5P_DEFAULT); @@ -185,8 +184,8 @@ public class TestH5G { @Test public void testH5Gget_create_plist() { - long gid = -1; - long pid = -1; + long gid = HDF5Constants.H5I_INVALID_HID; + long pid = HDF5Constants.H5I_INVALID_HID; for (int i = 0; i < GROUPS.length; i++) { try { @@ -325,7 +324,7 @@ public class TestH5G { int names_found = 0; try { names_found = H5.H5Gget_obj_info_all(gid, null, objNames, objTypes, lnkTypes, - objTokens, HDF5Constants.H5_INDEX_NAME); + objTokens, HDF5Constants.H5_INDEX_NAME); } catch (Throwable err) { err.printStackTrace(); @@ -366,7 +365,7 @@ public class TestH5G { int names_found = 0; try { names_found = H5.H5Gget_obj_info_all(gid, null, objNames, objTypes, lnkTypes, - objTokens, HDF5Constants.H5_INDEX_NAME); + objTokens, HDF5Constants.H5_INDEX_NAME); } catch (Throwable err) { err.printStackTrace(); @@ -401,7 +400,7 @@ public class TestH5G { int names_found = 0; try { names_found = H5.H5Gget_obj_info_max(gid, objNames, objTypes, lnkTypes, - objTokens, groups_max_size); + objTokens, groups_max_size); } catch (Throwable err) { err.printStackTrace(); @@ -432,7 +431,7 @@ public class TestH5G { int names_found = 0; try { names_found = H5.H5Gget_obj_info_max(gid, objNames, objTypes, lnkTypes, - objTokens, groups_max_size); + objTokens, groups_max_size); } catch (Throwable err) { err.printStackTrace(); diff --git a/java/test/TestH5Gbasic.java b/java/test/TestH5Gbasic.java index aea417e..6e2e450 100644 --- a/java/test/TestH5Gbasic.java +++ b/java/test/TestH5Gbasic.java @@ -1,6 +1,5 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * 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 * @@ -33,10 +32,10 @@ import org.junit.rules.TestName; public class TestH5Gbasic { @Rule public TestName testname = new TestName(); private static final String H5_FILE = "testGb.h5"; - long H5fid = -1; + long H5fid = HDF5Constants.H5I_INVALID_HID; private final long _createGroup(long fid, String name) { - long gid = -1; + long gid = HDF5Constants.H5I_INVALID_HID; try { gid = H5.H5Gcreate(fid, name, HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT); @@ -85,7 +84,7 @@ public class TestH5Gbasic { @Test(expected = NullPointerException.class) public void testH5Gcreate_null() throws Throwable { - long gid = -1; + long gid = HDF5Constants.H5I_INVALID_HID; // it should fail because the group name is null gid = H5.H5Gcreate(H5fid, null, HDF5Constants.H5P_DEFAULT, @@ -102,7 +101,7 @@ public class TestH5Gbasic { @Test public void testH5Gcreate() { - long gid = -1; + long gid = HDF5Constants.H5I_INVALID_HID; try { gid = H5.H5Gcreate(H5fid, "/testH5Gcreate", HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT, @@ -145,7 +144,7 @@ public class TestH5Gbasic { @Test public void testH5Gcreate_anon() { - long gid = -1; + long gid = HDF5Constants.H5I_INVALID_HID; try { gid = H5.H5Gcreate_anon(H5fid, HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT); @@ -161,7 +160,7 @@ public class TestH5Gbasic { @Test(expected = NullPointerException.class) public void testH5Gopen_null() throws Throwable { - long gid = -1; + long gid = HDF5Constants.H5I_INVALID_HID; gid = H5.H5Gopen(H5fid, null, HDF5Constants.H5P_DEFAULT); @@ -175,7 +174,7 @@ public class TestH5Gbasic { @Test(expected = HDF5LibraryException.class) public void testH5Gopen_not_exists() throws Throwable { - long gid = -1; + long gid = HDF5Constants.H5I_INVALID_HID; gid = H5.H5Gopen(H5fid, "Never_created", HDF5Constants.H5P_DEFAULT); @@ -209,7 +208,7 @@ public class TestH5Gbasic { @Test public void testH5Gget_create_plist() { - long pid = -1; + long pid = HDF5Constants.H5I_INVALID_HID; long gid = _createGroup(H5fid, "/testH5Gcreate"); assertTrue(gid > 0); diff --git a/java/test/TestH5Giterate.java b/java/test/TestH5Giterate.java index af210ca..388d2ac 100644 --- a/java/test/TestH5Giterate.java +++ b/java/test/TestH5Giterate.java @@ -1,6 +1,5 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * 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 * @@ -31,15 +30,15 @@ import org.junit.rules.TestName; public class TestH5Giterate { @Rule public TestName testname = new TestName(); private static final String H5_FILE = "h5ex_g_iterate.hdf"; - long H5fid = -1; + long H5fid = HDF5Constants.H5I_INVALID_HID; private final long _openGroup(long fid, String name) { - long gid = -1; + long gid = HDF5Constants.H5I_INVALID_HID; try { gid = H5.H5Gopen(fid, name, HDF5Constants.H5P_DEFAULT); } catch (Throwable err) { - gid = -1; + gid = HDF5Constants.H5I_INVALID_HID; err.printStackTrace(); fail("H5.H5Gcreate: " + err); } diff --git a/java/test/TestH5Lbasic.java b/java/test/TestH5Lbasic.java index bc4d65c..a28fc3d 100644 --- a/java/test/TestH5Lbasic.java +++ b/java/test/TestH5Lbasic.java @@ -1,6 +1,5 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * 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 * @@ -35,7 +34,7 @@ import org.junit.rules.TestName; public class TestH5Lbasic { @Rule public TestName testname = new TestName(); private static final String H5_FILE = "h5ex_g_iterateL1.hdf"; - long H5fid = -1; + long H5fid = HDF5Constants.H5I_INVALID_HID; @Before public void openH5file() diff --git a/java/test/TestH5Lcreate.java b/java/test/TestH5Lcreate.java index de29c1e..44af2e5 100644 --- a/java/test/TestH5Lcreate.java +++ b/java/test/TestH5Lcreate.java @@ -1,6 +1,5 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * 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 * @@ -41,13 +40,13 @@ public class TestH5Lcreate { private static final String H5_FILE = "testL.h5"; private static final int DIM_X = 4; private static final int DIM_Y = 6; - long H5fcpl = -1; - long H5fid = -1; - long H5dsid = -1; - long H5did1 = -1; - long H5did2 = -1; - long H5gcpl = -1; - long H5gid = -1; + long H5fcpl = HDF5Constants.H5I_INVALID_HID; + long H5fid = HDF5Constants.H5I_INVALID_HID; + long H5dsid = HDF5Constants.H5I_INVALID_HID; + long H5did1 = HDF5Constants.H5I_INVALID_HID; + long H5did2 = HDF5Constants.H5I_INVALID_HID; + long H5gcpl = HDF5Constants.H5I_INVALID_HID; + long H5gid = HDF5Constants.H5I_INVALID_HID; long[] H5dims = { DIM_X, DIM_Y }; private final void _deleteFile(String filename) { @@ -64,7 +63,7 @@ public class TestH5Lcreate { } private final long _createDataset(long fid, long dsid, String name, long dapl) { - long did = -1; + long did = HDF5Constants.H5I_INVALID_HID; try { did = H5.H5Dcreate(fid, name, HDF5Constants.H5T_STD_I32BE, dsid, @@ -80,7 +79,7 @@ public class TestH5Lcreate { } private final long _createGroup(long fid, String name) { - long gid = -1; + long gid = HDF5Constants.H5I_INVALID_HID; try { H5gcpl = HDF5Constants.H5P_DEFAULT; gid = H5.H5Gcreate(fid, name, HDF5Constants.H5P_DEFAULT, diff --git a/java/test/TestH5Lparams.java b/java/test/TestH5Lparams.java index 2ce1eca..30ee242 100644 --- a/java/test/TestH5Lparams.java +++ b/java/test/TestH5Lparams.java @@ -1,6 +1,5 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * 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 * diff --git a/java/test/TestH5Obasic.java b/java/test/TestH5Obasic.java index 89474c4..350b7aa 100644 --- a/java/test/TestH5Obasic.java +++ b/java/test/TestH5Obasic.java @@ -1,6 +1,5 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * 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 * @@ -41,7 +40,7 @@ public class TestH5Obasic { private static final String H5_FILE = "h5ex_g_iterateO1.hdf"; private static H5O_token_t H5la_ds1 = null; private static H5O_token_t H5la_l1 = null; - long H5fid = -1; + long H5fid = HDF5Constants.H5I_INVALID_HID; @Before public void openH5file() @@ -69,7 +68,7 @@ public class TestH5Obasic { @Test(expected = HDF5LibraryException.class) public void testH5Oopen_not_exists() throws Throwable { - long oid = -1; + long oid = HDF5Constants.H5I_INVALID_HID; oid = H5.H5Oopen(H5fid, "Never_created", HDF5Constants.H5P_DEFAULT); @@ -78,7 +77,7 @@ public class TestH5Obasic { @Test public void testH5Oget_info_dataset() { - long oid = -1; + long oid = HDF5Constants.H5I_INVALID_HID; H5O_info_t obj_info = null; try { @@ -96,7 +95,7 @@ public class TestH5Obasic { @Test public void testH5Oget_info_hardlink() { - long oid = -1; + long oid = HDF5Constants.H5I_INVALID_HID; H5O_info_t obj_info = null; try { oid = H5.H5Oopen(H5fid, "L1", HDF5Constants.H5P_DEFAULT); @@ -113,7 +112,7 @@ public class TestH5Obasic { @Test public void testH5Oget_info_group() { - long oid = -1; + long oid = HDF5Constants.H5I_INVALID_HID; H5O_info_t obj_info = null; try { oid = H5.H5Oopen(H5fid, "G1", HDF5Constants.H5P_DEFAULT); @@ -130,7 +129,7 @@ public class TestH5Obasic { @Test public void testH5Oget_info_datatype() { - long oid = -1; + long oid = HDF5Constants.H5I_INVALID_HID; H5O_info_t obj_info = null; try { oid = H5.H5Oopen(H5fid, "DT1", HDF5Constants.H5P_DEFAULT); @@ -234,7 +233,7 @@ public class TestH5Obasic { @Test public void testH5Oget_info_by_idx_n0() { - long oid = -1; + long oid = HDF5Constants.H5I_INVALID_HID; H5O_info_t obj_info = null; try { oid = H5.H5Oopen(H5fid, "DS1", HDF5Constants.H5P_DEFAULT); @@ -260,7 +259,7 @@ public class TestH5Obasic { @Test public void testH5Oget_info_by_idx_n3() { - long oid = -1; + long oid = HDF5Constants.H5I_INVALID_HID; H5O_info_t obj_info = null; try { oid = H5.H5Oopen(H5fid, "L1", HDF5Constants.H5P_DEFAULT); @@ -286,7 +285,7 @@ public class TestH5Obasic { @Test public void testH5Oget_native_info_dataset() { - long oid = -1; + long oid = HDF5Constants.H5I_INVALID_HID; H5O_native_info_t native_info = null; try { @@ -306,7 +305,7 @@ public class TestH5Obasic { @Test public void testH5Oget_native_info_hardlink() { - long oid = -1; + long oid = HDF5Constants.H5I_INVALID_HID; H5O_native_info_t native_info = null; try { @@ -326,7 +325,7 @@ public class TestH5Obasic { @Test public void testH5Oget_native_info_group() { - long oid = -1; + long oid = HDF5Constants.H5I_INVALID_HID; H5O_native_info_t native_info = null; try { @@ -346,7 +345,7 @@ public class TestH5Obasic { @Test public void testH5Oget_native_info_datatype() { - long oid = -1; + long oid = HDF5Constants.H5I_INVALID_HID; H5O_native_info_t native_info = null; try { @@ -376,10 +375,10 @@ public class TestH5Obasic { @Test public void testH5Oget_native_info_by_name_dataset() { - H5O_native_info_t native_info = null; + H5O_native_info_t native_info = null; try { - native_info = H5.H5Oget_native_info_by_name(H5fid, "DS1", HDF5Constants.H5P_DEFAULT); + native_info = H5.H5Oget_native_info_by_name(H5fid, "DS1", HDF5Constants.H5P_DEFAULT); } catch (Throwable err) { err.printStackTrace(); @@ -393,10 +392,10 @@ public class TestH5Obasic { @Test public void testH5Oget_native_info_by_name_hardlink() { - H5O_native_info_t native_info = null; + H5O_native_info_t native_info = null; try { - native_info = H5.H5Oget_native_info_by_name(H5fid, "L1", HDF5Constants.H5P_DEFAULT); + native_info = H5.H5Oget_native_info_by_name(H5fid, "L1", HDF5Constants.H5P_DEFAULT); } catch (Throwable err) { err.printStackTrace(); @@ -410,10 +409,10 @@ public class TestH5Obasic { @Test public void testH5Oget_native_info_by_name_group() { - H5O_native_info_t native_info = null; + H5O_native_info_t native_info = null; try { - native_info = H5.H5Oget_native_info_by_name(H5fid, "G1", HDF5Constants.H5P_DEFAULT); + native_info = H5.H5Oget_native_info_by_name(H5fid, "G1", HDF5Constants.H5P_DEFAULT); } catch (Throwable err) { err.printStackTrace(); @@ -427,10 +426,10 @@ public class TestH5Obasic { @Test public void testH5Oget_native_info_by_name_datatype() { - H5O_native_info_t native_info = null; + H5O_native_info_t native_info = null; try { - native_info = H5.H5Oget_native_info_by_name(H5fid, "DT1", HDF5Constants.H5P_DEFAULT); + native_info = H5.H5Oget_native_info_by_name(H5fid, "DT1", HDF5Constants.H5P_DEFAULT); } catch (Throwable err) { err.printStackTrace(); @@ -464,7 +463,7 @@ public class TestH5Obasic { @Test public void testH5Oget_native_info_by_idx_n0() { - long oid = -1; + long oid = HDF5Constants.H5I_INVALID_HID; H5O_native_info_t native_info = null; H5O_hdr_info_t ohdr; H5_ih_info_t oinfo; @@ -486,7 +485,7 @@ public class TestH5Obasic { try {H5.H5Oclose(oid);} catch (Exception ex) {} try { - native_info = H5.H5Oget_native_info_by_idx(H5fid, "/", HDF5Constants.H5_INDEX_NAME, HDF5Constants.H5_ITER_INC, 0, HDF5Constants.H5P_DEFAULT); + native_info = H5.H5Oget_native_info_by_idx(H5fid, "/", HDF5Constants.H5_INDEX_NAME, HDF5Constants.H5_ITER_INC, 0, HDF5Constants.H5P_DEFAULT); } catch (Throwable err) { err.printStackTrace(); @@ -503,7 +502,7 @@ public class TestH5Obasic { @Test public void testH5Oget_native_info_by_idx_n3() { - long oid = -1; + long oid = HDF5Constants.H5I_INVALID_HID; H5O_native_info_t native_info = null; H5O_hdr_info_t ohdr; H5_ih_info_t oinfo; @@ -525,7 +524,7 @@ public class TestH5Obasic { try {H5.H5Oclose(oid);} catch (Exception ex) {} try { - native_info = H5.H5Oget_native_info_by_idx(H5fid, "/", HDF5Constants.H5_INDEX_NAME, HDF5Constants.H5_ITER_INC, 3, HDF5Constants.H5P_DEFAULT); + native_info = H5.H5Oget_native_info_by_idx(H5fid, "/", HDF5Constants.H5_INDEX_NAME, HDF5Constants.H5_ITER_INC, 3, HDF5Constants.H5P_DEFAULT); } catch (Throwable err) { err.printStackTrace(); @@ -630,7 +629,7 @@ public class TestH5Obasic { @Test public void testH5Oopen_by_token() { - long oid = -1; + long oid = HDF5Constants.H5I_INVALID_HID; H5O_info_t obj_info = null; try { try { @@ -668,7 +667,7 @@ public class TestH5Obasic { @Test public void testH5Oopen_by_idx_n0() { - long oid = -1; + long oid = HDF5Constants.H5I_INVALID_HID; H5O_info_t obj_info = null; try { try { @@ -706,7 +705,7 @@ public class TestH5Obasic { @Test public void testH5Oopen_by_idx_n3() { - long oid = -1; + long oid = HDF5Constants.H5I_INVALID_HID; H5O_info_t obj_info = null; try { try { diff --git a/java/test/TestH5Ocopy.java b/java/test/TestH5Ocopy.java index 4888e76..b3b1acd 100644 --- a/java/test/TestH5Ocopy.java +++ b/java/test/TestH5Ocopy.java @@ -1,6 +1,5 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * 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 * @@ -36,13 +35,13 @@ public class TestH5Ocopy { private static final String FILENAME = "testRefsattribute.h5"; private static final int DIM_X = 4; private static final int DIM_Y = 6; - long H5fid = -1; - long H5dsid = -1; - long H5did1 = -1; - long H5did2 = -1; - long H5gcpl = -1; - long H5gid = -1; - long H5dsid2 = -1; + long H5fid = HDF5Constants.H5I_INVALID_HID; + long H5dsid = HDF5Constants.H5I_INVALID_HID; + long H5did1 = HDF5Constants.H5I_INVALID_HID; + long H5did2 = HDF5Constants.H5I_INVALID_HID; + long H5gcpl = HDF5Constants.H5I_INVALID_HID; + long H5gid = HDF5Constants.H5I_INVALID_HID; + long H5dsid2 = HDF5Constants.H5I_INVALID_HID; long[] dims = { 2 }; private final void _deleteFile(String filename) { @@ -59,7 +58,7 @@ public class TestH5Ocopy { } private final long _createDataset(long fid, long dsid, String name, long dapl) { - long did = -1; + long did = HDF5Constants.H5I_INVALID_HID; try { did = H5.H5Dcreate(fid, name, HDF5Constants.H5T_STD_I32BE, dsid, @@ -75,7 +74,7 @@ public class TestH5Ocopy { } private final long _createGroup(long fid, String name) { - long gid = -1; + long gid = HDF5Constants.H5I_INVALID_HID; try { H5gcpl = HDF5Constants.H5P_DEFAULT; gid = H5.H5Gcreate(fid, name, HDF5Constants.H5P_DEFAULT, @@ -136,10 +135,10 @@ public class TestH5Ocopy { @Test public void testH5OcopyRefsAttr() { - long ocp_plist_id = -1; + long ocp_plist_id = HDF5Constants.H5I_INVALID_HID; byte rbuf0[]=null , rbuf1[] = null; byte[] dset_data = new byte[16]; - long attribute_id = -1; + long attribute_id = HDF5Constants.H5I_INVALID_HID; try { @@ -184,9 +183,9 @@ public class TestH5Ocopy { public void testH5OcopyRefsDatasettodiffFile() { byte rbuf1[] = null; byte[] dset_data = new byte[16]; - long ocp_plist_id = -1; - long dataset_id = -1; - long H5fid2 = -1; + long ocp_plist_id = HDF5Constants.H5I_INVALID_HID; + long dataset_id = HDF5Constants.H5I_INVALID_HID; + long H5fid2 = HDF5Constants.H5I_INVALID_HID; try { rbuf1 = H5.H5Rcreate(H5fid, "DS2", HDF5Constants.H5R_OBJECT, -1); @@ -244,9 +243,9 @@ public class TestH5Ocopy { public void testH5OcopyRefsDatasettosameFile() { byte rbuf0[]=null , rbuf1[] = null; byte[] dset_data = new byte[16]; - long ocp_plist_id = -1; - long dataset_id = -1; - long did = -1; + long ocp_plist_id = HDF5Constants.H5I_INVALID_HID; + long dataset_id = HDF5Constants.H5I_INVALID_HID; + long did = HDF5Constants.H5I_INVALID_HID; int obj_type = -1; byte[] read_data = new byte[16]; @@ -328,9 +327,9 @@ public class TestH5Ocopy { // @Test(expected = HDF5LibraryException.class) // public void testH5OcopyInvalidRef() throws Throwable { // final long _pid_ = HDF5Constants.H5P_DEFAULT; -// long sid = -1; -// long did = -1; -// long aid = -1; +// long sid = HDF5Constants.H5I_INVALID_HID; +// long did = HDF5Constants.H5I_INVALID_HID; +// long aid = HDF5Constants.H5I_INVALID_HID; // // try { // sid = H5.H5Screate_simple(1, new long[] {1}, null); diff --git a/java/test/TestH5Ocreate.java b/java/test/TestH5Ocreate.java index 959e990..78ea744 100644 --- a/java/test/TestH5Ocreate.java +++ b/java/test/TestH5Ocreate.java @@ -1,6 +1,5 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * 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 * @@ -41,13 +40,13 @@ public class TestH5Ocreate { private static final String H5_FILE = "testO.h5"; private static final int DIM_X = 4; private static final int DIM_Y = 6; - long H5fcpl = -1; - long H5fid = -1; - long H5dsid = -1; - long H5did1 = -1; - long H5did2 = -1; - long H5gcpl = -1; - long H5gid = -1; + long H5fcpl = HDF5Constants.H5I_INVALID_HID; + long H5fid = HDF5Constants.H5I_INVALID_HID; + long H5dsid = HDF5Constants.H5I_INVALID_HID; + long H5did1 = HDF5Constants.H5I_INVALID_HID; + long H5did2 = HDF5Constants.H5I_INVALID_HID; + long H5gcpl = HDF5Constants.H5I_INVALID_HID; + long H5gid = HDF5Constants.H5I_INVALID_HID; long[] H5dims = { DIM_X, DIM_Y }; private final void _deleteFile(String filename) { @@ -64,7 +63,7 @@ public class TestH5Ocreate { } private final long _createDataset(long fid, long dsid, String name, long dapl) { - long did = -1; + long did = HDF5Constants.H5I_INVALID_HID; try { did = H5.H5Dcreate(fid, name, HDF5Constants.H5T_STD_I32BE, dsid, @@ -80,7 +79,7 @@ public class TestH5Ocreate { } private final long _createGroup(long fid, String name) { - long gid = -1; + long gid = HDF5Constants.H5I_INVALID_HID; try { H5gcpl = HDF5Constants.H5P_DEFAULT; gid = H5.H5Gcreate(fid, name, HDF5Constants.H5P_DEFAULT, @@ -293,7 +292,7 @@ public class TestH5Ocreate { @Test public void testH5Olink() { - long oid = -1; + long oid = HDF5Constants.H5I_INVALID_HID; H5O_info_t obj_info = null; H5O_info_t dst_obj_info = null; try { @@ -380,7 +379,7 @@ public class TestH5Ocreate { @Test public void testH5Ocomment() { - long oid = -1; + long oid = HDF5Constants.H5I_INVALID_HID; String obj_comment = null; try { oid = H5.H5Oopen(H5fid, "DS1", HDF5Constants.H5P_DEFAULT); @@ -405,7 +404,7 @@ public class TestH5Ocreate { @Test public void testH5Ocomment_clear() { - long oid = -1; + long oid = HDF5Constants.H5I_INVALID_HID; String obj_comment = null; try { oid = H5.H5Oopen(H5fid, "DS1", HDF5Constants.H5P_DEFAULT); @@ -506,7 +505,7 @@ public class TestH5Ocreate { @Test public void testH5Oinc_dec_count() { - long oid = -1; + long oid = HDF5Constants.H5I_INVALID_HID; H5O_info_t obj_info = null; try { try { diff --git a/java/test/TestH5Oparams.java b/java/test/TestH5Oparams.java index 1ad31cb..5cbabe1 100644 --- a/java/test/TestH5Oparams.java +++ b/java/test/TestH5Oparams.java @@ -1,6 +1,5 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * 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 * diff --git a/java/test/TestH5P.java b/java/test/TestH5P.java index 786c330..3879128 100644 --- a/java/test/TestH5P.java +++ b/java/test/TestH5P.java @@ -1,6 +1,5 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * 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 * @@ -41,20 +40,20 @@ public class TestH5P { private static final int DIM_X = 4; private static final int DIM_Y = 6; long[] H5dims = { DIM_X, DIM_Y }; - long H5fid = -1; - long H5dsid = -1; - long H5did = -1; - long lapl_id = -1; - long fapl_id = -1; - long fcpl_id = -1; - long ocpl_id = -1; - long ocp_plist_id = -1; - long lcpl_id = -1; - long plapl_id = -1; - long plist_id = -1; - long gapl_id = -1; - long gcpl_id = -1; - long acpl_id = -1; + long H5fid = HDF5Constants.H5I_INVALID_HID; + long H5dsid = HDF5Constants.H5I_INVALID_HID; + long H5did = HDF5Constants.H5I_INVALID_HID; + long lapl_id = HDF5Constants.H5I_INVALID_HID; + long fapl_id = HDF5Constants.H5I_INVALID_HID; + long fcpl_id = HDF5Constants.H5I_INVALID_HID; + long ocpl_id = HDF5Constants.H5I_INVALID_HID; + long ocp_plist_id = HDF5Constants.H5I_INVALID_HID; + long lcpl_id = HDF5Constants.H5I_INVALID_HID; + long plapl_id = HDF5Constants.H5I_INVALID_HID; + long plist_id = HDF5Constants.H5I_INVALID_HID; + long gapl_id = HDF5Constants.H5I_INVALID_HID; + long gcpl_id = HDF5Constants.H5I_INVALID_HID; + long acpl_id = HDF5Constants.H5I_INVALID_HID; private final void _deleteFile(String filename) { File file = new File(filename); @@ -65,7 +64,7 @@ public class TestH5P { } private final long _createDataset(long fid, long dsid, String name, long dapl) { - long did = -1; + long did = HDF5Constants.H5I_INVALID_HID; try { did = H5.H5Dcreate(fid, name, HDF5Constants.H5T_STD_I32BE, dsid, HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT, dapl); diff --git a/java/test/TestH5PData.java b/java/test/TestH5PData.java index 82864cd..8b04629 100644 --- a/java/test/TestH5PData.java +++ b/java/test/TestH5PData.java @@ -1,6 +1,5 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * 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 * @@ -37,10 +36,10 @@ public class TestH5PData { private static final String H5_FILE = "testPD.h5"; private static final int DIM_X = 12; private static final int DIM_Y = 18; - long H5fid = -1; - long H5dsid = -1; - long H5did = -1; - long plist_id = -1; + long H5fid = HDF5Constants.H5I_INVALID_HID; + long H5dsid = HDF5Constants.H5I_INVALID_HID; + long H5did = HDF5Constants.H5I_INVALID_HID; + long plist_id = HDF5Constants.H5I_INVALID_HID; long[] H5dims = { DIM_X, DIM_Y }; double windchillF[][] = {{36.0, 31.0, 25.0, 19.0, 13.0, 7.0, 1.0, -5.0, -11.0, -16.0, -22.0, -28.0, -34.0, -40.0, -46.0, -52.0, -57.0, -63.0}, @@ -66,7 +65,7 @@ public class TestH5PData { } private final long _createFloatDataset(long fid, long dsid, String name, long dapl) { - long did = -1; + long did = HDF5Constants.H5I_INVALID_HID; try { did = H5.H5Dcreate(fid, name, HDF5Constants.H5T_NATIVE_FLOAT, dsid, HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT, dapl); diff --git a/java/test/TestH5PL.java b/java/test/TestH5PL.java index 98665dc..d44cc0b 100644 --- a/java/test/TestH5PL.java +++ b/java/test/TestH5PL.java @@ -1,6 +1,5 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * 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 * @@ -147,11 +146,11 @@ public class TestH5PL { @Ignore public void TestH5PLdlopen() { - long file_id = -1; - long filespace_id = -1; - long dataset_id = -1; - long fapl_id = -1; - long dcpl_id = -1; + long file_id = HDF5Constants.H5I_INVALID_HID; + long filespace_id = HDF5Constants.H5I_INVALID_HID; + long dataset_id = HDF5Constants.H5I_INVALID_HID; + long fapl_id = HDF5Constants.H5I_INVALID_HID; + long dcpl_id = HDF5Constants.H5I_INVALID_HID; try { int[] cd_values = {9, 0, 0, 0}; int[] libversion = {0, 0, 0}; diff --git a/java/test/TestH5Pfapl.java b/java/test/TestH5Pfapl.java index d5d0901..cc674e2 100644 --- a/java/test/TestH5Pfapl.java +++ b/java/test/TestH5Pfapl.java @@ -1,6 +1,5 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * 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 * @@ -47,17 +46,17 @@ public class TestH5Pfapl { private static final int DIM_Y = 6; private static final int DIMF_X = 12; private static final int DIMF_Y = 18; - long H5fid = -1; - long H5dsid = -1; - long H5did = -1; - long H5Fdsid = -1; - long H5Fdid = -1; + long H5fid = HDF5Constants.H5I_INVALID_HID; + long H5dsid = HDF5Constants.H5I_INVALID_HID; + long H5did = HDF5Constants.H5I_INVALID_HID; + long H5Fdsid = HDF5Constants.H5I_INVALID_HID; + long H5Fdid = HDF5Constants.H5I_INVALID_HID; long[] H5dims = { DIM_X, DIM_Y }; - long fapl_id = -1; - long plapl_id = -1; - long dapl_id = -1; - long plist_id = -1; - long btplist_id = -1; + long fapl_id = HDF5Constants.H5I_INVALID_HID; + long plapl_id = HDF5Constants.H5I_INVALID_HID; + long dapl_id = HDF5Constants.H5I_INVALID_HID; + long plist_id = HDF5Constants.H5I_INVALID_HID; + long btplist_id = HDF5Constants.H5I_INVALID_HID; long[] H5Fdims = { DIMF_X, DIMF_Y }; double windchillF[][] = {{36.0, 31.0, 25.0, 19.0, 13.0, 7.0, 1.0, -5.0, -11.0, -16.0, -22.0, -28.0, -34.0, -40.0, -46.0, -52.0, -57.0, -63.0}, @@ -130,7 +129,7 @@ public class TestH5Pfapl { } private final long _createDataset(long fid, long dsid, String name, long dapl) { - long did = -1; + long did = HDF5Constants.H5I_INVALID_HID; try { did = H5.H5Dcreate(fid, name, HDF5Constants.H5T_STD_I32BE, dsid, HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT, dapl); @@ -385,7 +384,7 @@ public class TestH5Pfapl { @Test public void testH5Pget_elink_fapl() { - long ret_val_id = -1; + long ret_val_id = HDF5Constants.H5I_INVALID_HID; try { ret_val_id = H5.H5Pget_elink_fapl(plapl_id); assertTrue("H5Pget_elink_fapl", ret_val_id >= 0); @@ -403,7 +402,7 @@ public class TestH5Pfapl { @Test public void testH5P_elink_fapl() { - long ret_val_id = -1; + long ret_val_id = HDF5Constants.H5I_INVALID_HID; try { H5.H5Pset_elink_fapl(plapl_id, fapl_id ); ret_val_id = H5.H5Pget_elink_fapl(plapl_id); @@ -421,7 +420,7 @@ public class TestH5Pfapl { @Test public void testH5P_elink_file_cache_size() { - long elink_fapl_id = -1; + long elink_fapl_id = HDF5Constants.H5I_INVALID_HID; int efc_size = 0; try { H5.H5Pset_elink_fapl(plapl_id, fapl_id ); diff --git a/java/test/TestH5Pfaplhdfs.java b/java/test/TestH5Pfaplhdfs.java index 398a4d4..d922666 100644 --- a/java/test/TestH5Pfaplhdfs.java +++ b/java/test/TestH5Pfaplhdfs.java @@ -1,6 +1,5 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * 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 * @@ -34,11 +33,11 @@ import org.junit.rules.TestName; public class TestH5Pfaplhdfs { @Rule public TestName testname = new TestName(); - long fapl_id = -1; - long plapl_id = -1; - long dapl_id = -1; - long plist_id = -1; - long btplist_id = -1; + long fapl_id = HDF5Constants.H5I_INVALID_HID; + long plapl_id = HDF5Constants.H5I_INVALID_HID; + long dapl_id = HDF5Constants.H5I_INVALID_HID; + long plist_id = HDF5Constants.H5I_INVALID_HID; + long btplist_id = HDF5Constants.H5I_INVALID_HID; @Before public void createFileAccess() throws NullPointerException, HDF5Exception diff --git a/java/test/TestH5Pfapls3.java b/java/test/TestH5Pfapls3.java index a55856c..dda2716 100644 --- a/java/test/TestH5Pfapls3.java +++ b/java/test/TestH5Pfapls3.java @@ -1,6 +1,5 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * 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 * @@ -34,11 +33,11 @@ import org.junit.rules.TestName; public class TestH5Pfapls3 { @Rule public TestName testname = new TestName(); - long fapl_id = -1; - long plapl_id = -1; - long dapl_id = -1; - long plist_id = -1; - long btplist_id = -1; + long fapl_id = HDF5Constants.H5I_INVALID_HID; + long plapl_id = HDF5Constants.H5I_INVALID_HID; + long dapl_id = HDF5Constants.H5I_INVALID_HID; + long plist_id = HDF5Constants.H5I_INVALID_HID; + long btplist_id = HDF5Constants.H5I_INVALID_HID; @Before public void createFileAccess() throws NullPointerException, HDF5Exception diff --git a/java/test/TestH5Plist.java b/java/test/TestH5Plist.java index 7c43693..0d53071 100644 --- a/java/test/TestH5Plist.java +++ b/java/test/TestH5Plist.java @@ -1,6 +1,5 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * 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 * @@ -85,7 +84,7 @@ public class TestH5Plist { PROP3_NAME, PROP4_NAME}; - long plist_class_id = -1; + long plist_class_id = HDF5Constants.H5I_INVALID_HID; @Before public void createPropClass()throws NullPointerException, HDF5Exception @@ -114,9 +113,9 @@ public class TestH5Plist { @Test public void testH5P_genprop_basic_class() { int status = -1; - long cid1 = -1; // Generic Property class ID - long cid2 = -1; // Generic Property class ID - long cid3 = -1; // Generic Property class ID + long cid1 = HDF5Constants.H5I_INVALID_HID; // Generic Property class ID + long cid2 = HDF5Constants.H5I_INVALID_HID; // Generic Property class ID + long cid3 = HDF5Constants.H5I_INVALID_HID; // Generic Property class ID String name = null; // Name of class try { @@ -162,7 +161,7 @@ public class TestH5Plist { // Close parent class try { H5.H5Pclose_class(cid2); - cid2 = -1; + cid2 = HDF5Constants.H5I_INVALID_HID; } catch (Throwable err) { err.printStackTrace(); @@ -172,7 +171,7 @@ public class TestH5Plist { // Close class try { H5.H5Pclose_class(plist_class_id); - plist_class_id = -1; + plist_class_id = HDF5Constants.H5I_INVALID_HID; } catch (Throwable err) { err.printStackTrace(); @@ -242,7 +241,7 @@ public class TestH5Plist { // Close parent class's parent try { H5.H5Pclose_class(cid3); - cid3 = -1; + cid3 = HDF5Constants.H5I_INVALID_HID; } catch (Throwable err) { err.printStackTrace(); @@ -252,7 +251,7 @@ public class TestH5Plist { // Close parent class's parent try { H5.H5Pclose_class(cid2); - cid2 = -1; + cid2 = HDF5Constants.H5I_INVALID_HID; } catch (Throwable err) { err.printStackTrace(); @@ -262,7 +261,7 @@ public class TestH5Plist { // Close parent class's parent try { H5.H5Pclose_class(cid1); - cid1 = -1; + cid1 = HDF5Constants.H5I_INVALID_HID; } catch (Throwable err) { err.printStackTrace(); @@ -634,7 +633,7 @@ public class TestH5Plist { @Test public void testH5P_genprop_basic_list_prop() { boolean status = false; - long lid1 = -1; // Generic Property list ID + long lid1 = HDF5Constants.H5I_INVALID_HID; // Generic Property list ID long nprops = -1; // Number of properties in class try { @@ -760,7 +759,7 @@ public class TestH5Plist { // @Test // public void testH5P_genprop_class_callback() { // class cdata { -// public long cls_id = -1; +// public long cls_id = HDF5Constants.H5I_INVALID_HID; // public int cls_count = -1; // cdata(long id, int count) { // this.cls_id = id; @@ -813,11 +812,11 @@ public class TestH5Plist { // } // H5P_cls_close_func_cb cls_close_cb = new H5P_cls_close_callback(); // -// long cid1 = -1; // Generic Property class ID -// long cid2 = -1; // Generic Property class ID -// long lid1 = -1; // Generic Property list ID -// long lid2 = -1; // Generic Property list ID -// long lid3 = -1; // Generic Property list ID +// long cid1 = HDF5Constants.H5I_INVALID_HID; // Generic Property class ID +// long cid2 = HDF5Constants.H5I_INVALID_HID; // Generic Property class ID +// long lid1 = HDF5Constants.H5I_INVALID_HID; // Generic Property list ID +// long lid2 = HDF5Constants.H5I_INVALID_HID; // Generic Property list ID +// long lid3 = HDF5Constants.H5I_INVALID_HID; // Generic Property list ID // long nprops = -1; // Number of properties in class // // try { diff --git a/java/test/TestH5Pvirtual.java b/java/test/TestH5Pvirtual.java index 4c9a763..0478356 100644 --- a/java/test/TestH5Pvirtual.java +++ b/java/test/TestH5Pvirtual.java @@ -1,6 +1,5 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * 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 * @@ -52,13 +51,13 @@ public class TestH5Pvirtual { private static final int fill_value = -1; long[] H5dims = { DIM_Y }; long[] VDSH5dims = { VDSDIM_X, VDSDIM_Y }; - long H5fid = -1; - long H5dsid = -1; - long H5dssid = -1; - long H5dvsid = -1; - long H5did = -1; - long H5dcplid = -1; - long H5dapl_id = -1; + long H5fid = HDF5Constants.H5I_INVALID_HID; + long H5dsid = HDF5Constants.H5I_INVALID_HID; + long H5dssid = HDF5Constants.H5I_INVALID_HID; + long H5dvsid = HDF5Constants.H5I_INVALID_HID; + long H5did = HDF5Constants.H5I_INVALID_HID; + long H5dcplid = HDF5Constants.H5I_INVALID_HID; + long H5dapl_id = HDF5Constants.H5I_INVALID_HID; private final void _deleteFile(String filename) { File file = new File(filename); @@ -69,8 +68,8 @@ public class TestH5Pvirtual { } private final long _createDataset(long fid, long dsid, String name, long dcpl, long dapl) { - long did = -1; - long space_id = -1; + long did = HDF5Constants.H5I_INVALID_HID; + long space_id = HDF5Constants.H5I_INVALID_HID; long[] start = {0, 0}; long[] stride = null; long[] count = {1, 1}; @@ -100,9 +99,9 @@ public class TestH5Pvirtual { int[] dset_data = new int[DIM_Y]; // Create source files and datasets for (int i=0; i < 3; i++) { - long space_id = -1; - long dset_id = -1; - long file_id = -1; + long space_id = HDF5Constants.H5I_INVALID_HID; + long dset_id = HDF5Constants.H5I_INVALID_HID; + long file_id = HDF5Constants.H5I_INVALID_HID; for (int j = 0; j < DIM_Y; j++) dset_data[j] = i+1; try { @@ -265,7 +264,7 @@ public class TestH5Pvirtual { @Test public void testH5Pget_selection_source_dataset() throws Throwable { - long src_space = -1; + long src_space = HDF5Constants.H5I_INVALID_HID; long src_selection = -1; H5did = _createDataset(H5fid, H5dsid, "VDS", H5dcplid, H5dapl_id); diff --git a/java/test/TestH5R.java b/java/test/TestH5R.java index a51c7b6..031b8e4 100644 --- a/java/test/TestH5R.java +++ b/java/test/TestH5R.java @@ -1,6 +1,5 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * 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 * @@ -39,11 +38,11 @@ public class TestH5R { private static final String H5_FILE = "testH5R.h5"; private static final int DIM_X = 4; private static final int DIM_Y = 6; - long H5fid = -1; - long H5dsid = -1; - long H5did = -1; - long H5gid = -1; - long H5did2 = -1; + long H5fid = HDF5Constants.H5I_INVALID_HID; + long H5dsid = HDF5Constants.H5I_INVALID_HID; + long H5did = HDF5Constants.H5I_INVALID_HID; + long H5gid = HDF5Constants.H5I_INVALID_HID; + long H5did2 = HDF5Constants.H5I_INVALID_HID; long[] H5dims = { DIM_X, DIM_Y }; int[][] dset_data = new int[DIM_X][DIM_Y]; int FILLVAL = 99; @@ -62,7 +61,7 @@ public class TestH5R { } private final long _createDataset(long fid, long dsid, String name, long dapl) { - long did = -1; + long did = HDF5Constants.H5I_INVALID_HID; try { did = H5.H5Dcreate(fid, name, HDF5Constants.H5T_STD_I32BE, dsid, @@ -78,7 +77,7 @@ public class TestH5R { } private final long _createGroup(long fid, String name) { - long gid = -1; + long gid = HDF5Constants.H5I_INVALID_HID; try { gid = H5.H5Gcreate(fid, name, HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT); @@ -150,109 +149,6 @@ public class TestH5R { System.out.println(); } - // Test v1.8 APIs params - /* - * @Ignore public void testH5Rget_name() { long loc_id = H5fid; int ref_type = - * HDF5Constants.H5R_OBJECT; long ret_val = -1; byte[] ref = null; String[] name = {""}; String - * objName = "/dset"; - * - * try { ref = H5.H5Rcreate(H5fid, objName, ref_type, -1); } catch (Throwable err) { - * err.printStackTrace(); fail("H5.H5Rget_name:H5Rcreate " + err); } - * - * try { ret_val = H5.H5Rget_name(loc_id, ref_type, ref, name, 16); } catch (Throwable err) { - * err.printStackTrace(); fail("H5.H5Rget_name: " + err); } - * - * assertTrue("testH5Rget_name: H5Rget_name", ret_val>0); assertTrue("The name of the object: ", - * objName.equals(name[0])); } - * - * @Ignore public void testH5Rget_obj_type2() { int ref_type=HDF5Constants.H5R_OBJECT; byte[] - * ref=null; - * - * String objName = "/dset"; int obj_type = -1; - * - * try { ref = H5.H5Rcreate(H5fid, objName, ref_type, -1); } catch(Throwable err) { - * err.printStackTrace(); } - * - * try { obj_type = H5.H5Rget_obj_type(H5fid, HDF5Constants.H5R_OBJECT, ref); } catch (Throwable - * err) { err.printStackTrace(); fail("H5.H5Rget_obj_type2: " + err); } assertEquals(obj_type, - * HDF5Constants.H5O_TYPE_DATASET); } - * - * @Ignore public void testH5Rcreate_refobj() { byte[] ref = null; - * - * try { ref = H5.H5Rcreate(H5fid, "/dset", HDF5Constants.H5R_OBJECT, -1); } catch (Throwable err) { - * err.printStackTrace(); fail("H5.H5Rcreate: " + err); } assertNotNull(ref); } - * - * @Ignore public void testH5Rcreate_regionrefobj() { byte[] ref = null; try { ref = - * H5.H5Rcreate(H5fid, "/dset", HDF5Constants.H5R_DATASET_REGION, H5dsid); } catch (Throwable err) { - * err.printStackTrace(); fail("H5.H5Rcreate: " + err); } assertNotNull(ref); } - * - * @Ignore public void testH5Rdereference() { byte[] ref1 = null; byte[] ref2 = null; long - * dataset_id = -1; long group_id = -1; try { //Create reference on dataset ref1 = - * H5.H5Rcreate(H5fid, "/dset", HDF5Constants.H5R_DATASET_REGION, H5dsid); dataset_id= - * H5.H5Rdereference(H5fid, HDF5Constants.H5P_DEFAULT, HDF5Constants.H5R_DATASET_REGION, ref1); - * - * //Create reference on group ref2 = H5.H5Rcreate(H5gid, "/Group1", HDF5Constants.H5R_OBJECT, -1); - * group_id= H5.H5Rdereference(H5gid, HDF5Constants.H5P_DEFAULT, HDF5Constants.H5R_OBJECT, ref2); - * assertNotNull(ref1); assertNotNull(ref2); assertTrue(dataset_id >= 0); assertTrue(group_id >= 0); - * } catch (Throwable err) { err.printStackTrace(); fail("TestH5Rdereference " + err); } finally { - * try {H5.H5Dclose(dataset_id);} catch (Exception ex) {} try {H5.H5Gclose(group_id);} catch - * (Exception ex) {} } } - * - * @Ignore public void testH5Rget_region() { byte[] ref = null; long dsid = -1; try { ref = - * H5.H5Rcreate(H5fid, "/dset", HDF5Constants.H5R_DATASET_REGION, H5dsid); dsid = - * H5.H5Rget_region(H5fid, HDF5Constants.H5R_DATASET_REGION, ref); assertNotNull(ref); - * assertTrue(dsid >= 0); } catch (Throwable err) { err.printStackTrace(); - * fail("TestH5Rget_region: " + err); } finally { try {H5.H5Sclose(dsid);} catch (Exception ex) {} } - * } - * - * @Ignore//(expected = IllegalArgumentException.class) public void testH5Rget_name_Invalidreftype() - * throws Throwable { byte[] ref = null; String[] name = {""}; ref = H5.H5Rcreate(H5fid, "/dset", - * HDF5Constants.H5R_OBJECT, -1); H5.H5Rget_name(H5fid, HDF5Constants.H5R_DATASET_REGION, ref, name, - * 16); } - * - * @Ignore//(expected = NullPointerException.class) public void testH5Rget_name_NULLreference() - * throws Throwable { byte[] ref = null; String[] name = {""}; H5.H5Rget_name(H5fid, - * HDF5Constants.H5R_OBJECT, ref, name, 16); } - * - * @Ignore//(expected = HDF5LibraryException.class) public void - * testH5Rget_obj_type2_Invalidreftype() throws Throwable { byte[] ref = null; ref = - * H5.H5Rcreate(H5fid, "/dset", HDF5Constants.H5R_OBJECT, -1); H5.H5Rget_obj_type(H5fid, - * HDF5Constants.H5R_DATASET_REGION, ref); } - * - * @Ignore//(expected = HDF5LibraryException.class) public void testH5Rcreate_InvalidObjectName() - * throws Throwable { byte[] ref=H5.H5Rcreate(H5fid, "/GROUPS", HDF5Constants.H5R_OBJECT, -1); } - * - * @Ignore//(expected = HDF5LibraryException.class) public void testH5Rcreate_Invalidspace_id() - * throws Throwable { byte[] ref=H5.H5Rcreate(H5fid, "/dset", HDF5Constants.H5R_DATASET_REGION, -1); - * } - * - * @Ignore//(expected = IllegalArgumentException.class) public void testH5Rcreate_Invalidreftype() - * throws Throwable { byte[] ref=H5.H5Rcreate(H5fid, "/dset", HDF5Constants.H5R_BADTYPE, -1); } - * - * @Ignore//(expected = IllegalArgumentException.class) public void - * testH5Rgetregion_Invalidreftype() throws Throwable { byte[] ref = null; ref = H5.H5Rcreate(H5fid, - * "/dset", HDF5Constants.H5R_OBJECT, H5dsid); H5.H5Rget_region(H5fid, - * HDF5Constants.H5R_DATASET_REGION, ref); } - * - * @Ignore//(expected = IllegalArgumentException.class) public void - * testH5Rgetregion_Badreferencetype() throws Throwable { byte[] ref = null; ref = - * H5.H5Rcreate(H5fid, "/dset", HDF5Constants.H5R_OBJECT, H5dsid); H5.H5Rget_region(H5fid, - * HDF5Constants.H5R_OBJECT, ref); } - * - * @Ignore//(expected = NullPointerException.class) public void testH5Rgetregion_Nullreference() - * throws Throwable { byte[] ref = null; H5.H5Rget_region(H5fid, HDF5Constants.H5R_DATASET_REGION, - * ref); } - * - * @Ignore//(expected = NullPointerException.class) public void testH5Rdereference_Nullreference() - * throws Throwable { byte[] ref = null; H5.H5Rdereference(H5did2, HDF5Constants.H5P_DEFAULT, - * HDF5Constants.H5R_OBJECT, ref); } - * - * @Ignore//(expected = IllegalArgumentException.class) public void - * testH5Rdereference_Invalidreference() throws Throwable { byte[] ref1 = null; byte[] ref2 = null; - * ref1 = H5.H5Rcreate(H5fid, "/dset", HDF5Constants.H5R_DATASET_REGION, H5dsid); ref2 = - * H5.H5Rcreate(H5gid, "/Group1", HDF5Constants.H5R_OBJECT, -1); H5.H5Rdereference(H5gid, - * HDF5Constants.H5P_DEFAULT, HDF5Constants.H5R_OBJECT, ref1); } - */ // Test v1.12 APIs params @Test diff --git a/java/test/TestH5Rref.java b/java/test/TestH5Rref.java new file mode 100644 index 0000000..e306d7a --- /dev/null +++ b/java/test/TestH5Rref.java @@ -0,0 +1,562 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright by The HDF Group. * + * Copyright by the Board of Trustees of the University of Illinois. * + * All rights reserved. * + * * + * This file is part of HDF5. The full HDF5 copyright notice, including * + * terms governing use, modification, and redistribution, is contained in * + * the COPYING file, which can be found at the root of the source code * + * distribution tree, or in https://support.hdfgroup.org/ftp/HDF5/releases. * + * If you do not have access to either file, you may request a copy from * + * help@hdfgroup.org. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +package test; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertTrue; +import static org.junit.Assert.fail; + +import java.io.File; + +import hdf.hdf5lib.H5; +import hdf.hdf5lib.HDF5Constants; +import hdf.hdf5lib.exceptions.HDF5Exception; +import hdf.hdf5lib.exceptions.HDF5LibraryException; +import hdf.hdf5lib.exceptions.HDF5FunctionArgumentException; + +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 TestH5Rref { + @Rule public TestName testname = new TestName(); + private static final String H5_DREG_FILE = "trefer_reg.h5"; + private static final String H5_AREG_FILE = "trefer_attr.h5"; + long H5fid = HDF5Constants.H5I_INVALID_HID; + long H5dsid = HDF5Constants.H5I_INVALID_HID; + long H5did = HDF5Constants.H5I_INVALID_HID; + + private boolean byteArrayCheck(final byte[] array) { + for (byte b : array) { + if (b != 0) { + return false; + } + } + return true; + } + + public void openH5file(String filename, String dsetname) { + try { + H5fid = H5.H5Fopen(filename, + HDF5Constants.H5F_ACC_RDWR, HDF5Constants.H5P_DEFAULT); + } + catch (Throwable err) { + err.printStackTrace(); + fail("TestH5R._openH5file: " + err); + } + assertTrue("TestH5R._openH5file: H5.H5Fopen: ", H5fid >= 0); + try { + H5did = H5.H5Dopen(H5fid, dsetname, HDF5Constants.H5P_DEFAULT); + } + catch (Throwable err) { + err.printStackTrace(); + fail("TestH5R._openH5file: " + err); + } + assertTrue("TestH5R._openH5file: H5.H5Dopen: ", H5did >= 0); + try { + H5dsid = H5.H5Dget_space(H5did); + } + catch (Throwable err) { + err.printStackTrace(); + fail("TestH5R._openH5file: " + err); + } + assertTrue("TestH5R._openH5file: H5.H5Screate_simple: ",H5dsid > 0); + } + + @After + public void closeH5file() throws HDF5LibraryException { + if (H5did >= 0) + try {H5.H5Dclose(H5did);} catch (Exception ex) {} + if (H5dsid > 0) + try {H5.H5Sclose(H5dsid);} catch (Exception ex) {} + if (H5fid > 0) + try {H5.H5Fclose(H5fid);} catch (Exception ex) {} + H5fid = HDF5Constants.H5I_INVALID_HID; + H5dsid = HDF5Constants.H5I_INVALID_HID; + H5did = HDF5Constants.H5I_INVALID_HID; + System.out.println(); + } + + @Before + public void verifyCount() + throws NullPointerException, HDF5Exception { + assertTrue("H5 open ids is 0", H5.getOpenIDCount()==0); + System.out.print(testname.getMethodName()); + } + + // Test v1.12 APIs params + + @Test + public void testH5Rget_object() { + int ref_type = HDF5Constants.H5R_OBJECT1; + long f_type = HDF5Constants.H5I_INVALID_HID; + int obj_type = -1; + int ndims = 1; + long ret_val = -1; + byte[][] refbuf = null; + String name = ""; + String objName = "/DS_NA"; + + try { + openH5file(H5_DREG_FILE, objName); + } + catch (Throwable err) { + err.printStackTrace(); + fail("testH5Rget_object: openH5file: " + err); + } + try { + f_type = H5.H5Dget_type(H5did); + int result = H5.H5Tget_class(f_type); + assertTrue("testH5Rget_object: H5Tget_class", result > 0); + String class_name = H5.H5Tget_class_name(result); + assertTrue("testH5Rget_object: H5Tget_class", class_name.compareTo("H5T_REFERENCE")==0); + } + catch (Throwable err) { + err.printStackTrace(); + fail("testH5Rget_object: " + err); + } + finally { + try {H5.H5Tclose(f_type);} catch (Exception ex) {} + } + try { + ndims = H5.H5Sget_simple_extent_ndims(H5dsid); + } + catch (Throwable err) { + err.printStackTrace(); + fail("testH5Rget_object: H5Sget_simple_extent_ndims: " + err); + } + refbuf = new byte[ndims][HDF5Constants.H5R_REF_BUF_SIZE]; + // Read the reference from the dataset. + try { + H5.H5Dread(H5did, HDF5Constants.H5T_STD_REF, + HDF5Constants.H5S_ALL, HDF5Constants.H5S_ALL, + HDF5Constants.H5P_DEFAULT, refbuf); + } + catch (Exception err) { + err.printStackTrace(); + fail("testH5Rget_object: H5Dread: " + err); + } + + for (int i = 0; i < ndims; i++) { + try { + ret_val = H5.H5Rget_type(refbuf[i]); + assertTrue("testH5Rget_object: H5Rget_type["+i+"]="+ret_val, ret_val == ref_type); + if (!byteArrayCheck(refbuf[i])) { + try { + obj_type = H5.H5Rget_obj_type3(refbuf[i], HDF5Constants.H5P_DEFAULT); + assertEquals(obj_type, HDF5Constants.H5O_TYPE_DATASET); + } + catch (Throwable err2) { + err2.printStackTrace(); + fail("testH5Rget_object: H5.H5Rget_obj_type3: " + err2); + } + } + } + catch (Throwable err) { + err.printStackTrace(); + fail("testH5Rget_object: H5Rget_type: " + err); + } + finally { + H5.H5Rdestroy(refbuf[i]); + } + } + } + + @Test + public void testH5Rget_obj_type3() { + long f_type = HDF5Constants.H5I_INVALID_HID; + int ref_type = HDF5Constants.H5R_DATASET_REGION2; + int obj_type = -1; + int ndims = 1; + long ret_val = -1; + byte[][] refbuf = null; + String objName = "/Dataset1"; + + try { + openH5file(H5_DREG_FILE, objName); + } + catch (Throwable err) { + err.printStackTrace(); + fail("testH5Rget_obj_type3: openH5file: " + err); + } + try { + f_type = H5.H5Dget_type(H5did); + int result = H5.H5Tget_class(f_type); + assertTrue("testH5Rget_obj_type3: H5Tget_class", result > 0); + String class_name = H5.H5Tget_class_name(result); + assertTrue("testH5Rget_obj_type3: H5Tget_class="+class_name, class_name.compareTo("H5T_REFERENCE")==0); + } + catch (Throwable err) { + err.printStackTrace(); + fail("testH5Rget_obj_type3: " + err); + } + finally { + try {H5.H5Tclose(f_type);} catch (Exception ex) {} + } + try { + ndims = H5.H5Sget_simple_extent_ndims(H5dsid); + } + catch (Throwable err) { + err.printStackTrace(); + fail("testH5Rget_obj_type3: H5Sget_simple_extent_ndims: " + err); + } + refbuf = new byte[ndims][HDF5Constants.H5R_REF_BUF_SIZE]; + // Read the reference from the dataset. + try { + H5.H5Dread(H5did, HDF5Constants.H5T_STD_REF, + HDF5Constants.H5S_ALL, HDF5Constants.H5S_ALL, + HDF5Constants.H5P_DEFAULT, refbuf); + } + catch (Exception err) { + err.printStackTrace(); + fail("testH5Rget_obj_type3: H5Dread: " + err); + } + + for (int i = 0; i < ndims; i++) { + try { + ret_val = H5.H5Rget_type(refbuf[i]); + assertTrue("testH5Rget_obj_type3: H5Rget_type["+i+"]="+ret_val, ret_val == ref_type); + if (!byteArrayCheck(refbuf[i])) { + try { + obj_type = H5.H5Rget_obj_type3(refbuf[i], HDF5Constants.H5P_DEFAULT); + assertEquals(obj_type, HDF5Constants.H5O_TYPE_DATASET); + } + catch (Throwable err2) { + err2.printStackTrace(); + fail("testH5Rget_obj_type3: H5.H5Rget_obj_type3: " + err2); + } + } + } + catch (Throwable err) { + err.printStackTrace(); + fail("testH5Rget_obj_type3: H5Rget_type: " + err); + } + finally { + H5.H5Rdestroy(refbuf[i]); + } + } + } + + @Test + public void testH5Rget_region_dataset() { + long f_type = HDF5Constants.H5I_INVALID_HID; + long loc_id = HDF5Constants.H5I_INVALID_HID; + long loc_sid = HDF5Constants.H5I_INVALID_HID; + int ref_type = HDF5Constants.H5R_DATASET_REGION2; + int ndims = 1; + long ret_val = -1; + byte[][] refbuf = null; + String name = ""; + String objName = "/Dataset1"; + + try { + openH5file(H5_DREG_FILE, objName); + } + catch (Throwable err) { + err.printStackTrace(); + fail("testH5Rget_region_dataset: openH5file: " + err); + } + try { + f_type = H5.H5Dget_type(H5did); + int result = H5.H5Tget_class(f_type); + assertTrue("testH5Rget_region_dataset: H5Tget_class", result > 0); + String class_name = H5.H5Tget_class_name(result); + assertTrue("testH5Rget_region_dataset: H5Tget_class="+class_name, class_name.compareTo("H5T_REFERENCE")==0); + } + catch (Throwable err) { + err.printStackTrace(); + fail("testH5Rget_region_dataset: " + err); + } + finally { + try {H5.H5Tclose(f_type);} catch (Exception ex) {} + } + try { + ndims = H5.H5Sget_simple_extent_ndims(H5dsid); + } + catch (Throwable err) { + err.printStackTrace(); + fail("testH5Rget_region_dataset: H5Sget_simple_extent_ndims: " + err); + } + refbuf = new byte[ndims][HDF5Constants.H5R_REF_BUF_SIZE]; + // Read the reference from the dataset. + try { + H5.H5Dread(H5did, HDF5Constants.H5T_STD_REF, + HDF5Constants.H5S_ALL, HDF5Constants.H5S_ALL, + HDF5Constants.H5P_DEFAULT, refbuf); + } + catch (Exception err) { + err.printStackTrace(); + fail("testH5Rget_obj_type3: H5Dread: " + err); + } + for (int i = 0; i < ndims; i++) { + try { + ret_val = H5.H5Rget_type(refbuf[i]); + assertTrue("testH5Rget_region_dataset: H5Rget_type["+i+"]="+ret_val, ret_val == ref_type); + try { + loc_id = H5.H5Ropen_object(refbuf[i], HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT); + assertTrue(loc_id >= 0); + boolean regionzero = byteArrayCheck(refbuf[i]); + if (i > 1) + assertTrue(regionzero); + else { + try { + loc_sid = H5.H5Ropen_region(refbuf[i], HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT); + assertTrue(loc_sid >= 0); + int region_type = -1; + try { + int reg_ndims = H5.H5Sget_simple_extent_ndims(loc_sid); + region_type = H5.H5Sget_select_type(loc_sid); + if (i == 1) + assertTrue(region_type == HDF5Constants.H5S_SEL_POINTS); + else + assertTrue(region_type == HDF5Constants.H5S_SEL_HYPERSLABS); + if (region_type == HDF5Constants.H5S_SEL_POINTS) { + long reg_npoints = H5.H5Sget_select_elem_npoints(loc_sid); + // Coordinates for get point selection + long getcoord[] = new long[reg_ndims * (int)reg_npoints]; + // Known coordinates for point selection + long coord[][] = {{6,9},{2,2},{8,4},{1,6},{2,8},{3,2}, + {0,4},{9,0},{7,1},{3,3}}; + try { + H5.H5Sget_select_elem_pointlist(loc_sid, 0, reg_npoints, getcoord); + assertTrue("H5.H5Sget_select_elem_pointlist", coord[0][0] == getcoord[0]); + assertTrue("H5.H5Sget_select_elem_pointlist", coord[0][1] == getcoord[1]); + assertTrue("H5.H5Sget_select_elem_pointlist", coord[1][0] == getcoord[2]); + assertTrue("H5.H5Sget_select_elem_pointlist", coord[1][1] == getcoord[3]); + assertTrue("H5.H5Sget_select_elem_pointlist", coord[2][0] == getcoord[4]); + assertTrue("H5.H5Sget_select_elem_pointlist", coord[2][1] == getcoord[5]); + } + catch (Throwable err3) { + err3.printStackTrace(); + fail("H5.H5Sget_select_elem_pointlist: " + err3); + } + } + else if (region_type == HDF5Constants.H5S_SEL_HYPERSLABS) { + long reg_nblocks = H5.H5Sget_select_hyper_nblocks(loc_sid); + assertTrue("H5Sget_select_hyper_nblocks", reg_nblocks == 1); + // Coordinates for get block selection + long getblocks[] = new long[reg_ndims * (int)reg_nblocks * 2]; + long start[] = {2,2}; + long block[] = {8,8}; + try { + H5.H5Sget_select_hyper_blocklist(loc_sid, 0, reg_nblocks, getblocks); + assertTrue("H5.H5Sget_select_hyper_blocklist", start[0] == getblocks[0]); + assertTrue("H5.H5Sget_select_hyper_blocklist", start[1] == getblocks[1]); + assertTrue("H5.H5Sget_select_hyper_blocklist", (block[0]-1) == getblocks[2]); + assertTrue("H5.H5Sget_select_hyper_blocklist", (block[1]-1) == getblocks[3]); + } + catch (Throwable err3) { + err3.printStackTrace(); + fail("H5.H5Sget_select_hyper_blocklist: " + err3); + } + } + } + catch (Throwable err2) { + err2.printStackTrace(); + fail("testH5Rget_region_dataset: H5Sget_select_type: " + err2); + } + } + catch (Throwable err1) { + err1.printStackTrace(); + fail("testH5Rget_region_dataset: " + err1); + } + finally { + try {H5.H5Sclose(loc_sid);} catch (Exception ex) {} + } + } + } + catch (Throwable err0) { + err0.printStackTrace(); + fail("testH5Rget_region_dataset: " + err0); + } + finally { + try {H5.H5Dclose(loc_id);} catch (Exception ex) {} + } + } + catch (Throwable err) { + err.printStackTrace(); + fail("testH5Rget_region_dataset: H5Rget_type: " + err); + } + finally { + H5.H5Rdestroy(refbuf[i]); + } + } //for (int i = 0; i < ndims; i++) + } + + @Test + public void testH5Rget_region_attribute() { + long f_type = HDF5Constants.H5I_INVALID_HID; + long loc_id = HDF5Constants.H5I_INVALID_HID; + long loc_sid = HDF5Constants.H5I_INVALID_HID; + int ref_type = HDF5Constants.H5R_ATTR; + int obj_type = -1; + int ndims = 1; + long ret_val = -1; + byte[][] refbuf = null; + String objName = "/Dataset3"; + + try { + openH5file(H5_AREG_FILE, objName); + } + catch (Throwable err) { + err.printStackTrace(); + fail("testH5Rget_region_attribute: openH5file: " + err); + } + try { + f_type = H5.H5Dget_type(H5did); + int result = H5.H5Tget_class(f_type); + assertTrue("testH5Rget_region_attribute: H5Tget_class", result > 0); + String class_name = H5.H5Tget_class_name(result); + assertTrue("testH5Rget_region_attribute: H5Tget_class="+class_name, class_name.compareTo("H5T_REFERENCE")==0); + } + catch (Throwable err) { + err.printStackTrace(); + fail("testH5Rget_region_attribute: " + err); + } + finally { + try {H5.H5Tclose(f_type);} catch (Exception ex) {} + } + try { + ndims = H5.H5Sget_simple_extent_ndims(H5dsid); + } + catch (Throwable err) { + err.printStackTrace(); + fail("testH5Rget_region_attribute: H5Sget_simple_extent_ndims: " + err); + } + refbuf = new byte[ndims][HDF5Constants.H5R_REF_BUF_SIZE]; + // Read the reference from the dataset. + try { + H5.H5Dread(H5did, HDF5Constants.H5T_STD_REF, + HDF5Constants.H5S_ALL, HDF5Constants.H5S_ALL, + HDF5Constants.H5P_DEFAULT, refbuf); + } + catch (Exception err) { + err.printStackTrace(); + fail("testH5Rget_region_attribute: H5Dread: " + err); + } + + for (int i = 0; i < ndims; i++) { + try { + ret_val = H5.H5Rget_type(refbuf[i]); + assertTrue("testH5Rget_region_attribute: H5Rget_type["+i+"]="+ret_val, ret_val == ref_type); + try { + loc_id = H5.H5Ropen_attr(refbuf[i], HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT); + assertTrue(loc_id >= 0); + if (!byteArrayCheck(refbuf[i])) { + try { + loc_sid = H5.H5Aget_space(loc_id); + assertTrue(loc_sid >= 0); + } + catch (Throwable err1) { + err1.printStackTrace(); + fail("testH5Rget_region_attribute: " + err1); + } + finally { + try {H5.H5Sclose(loc_sid);} catch (Exception ex) {} + } + } + } + catch (Throwable err0) { + err0.printStackTrace(); + fail("testH5Rget_region_attribute: " + err0); + } + finally { + try {H5.H5Aclose(loc_id);} catch (Exception ex) {} + } + } + catch (Throwable err) { + err.printStackTrace(); + fail("testH5Rget_region_attribute: H5Rget_type: " + err); + } + finally { + H5.H5Rdestroy(refbuf[i]); + } + } + } + + +// These tests need to be updated with new APIs +// @Test// +// public void testH5Rget_group() { +// long loc_id = H5fid; +// int ref_type = HDF5Constants.H5R_OBJECT2; +// long ret_val = -1; +// byte[] ref = null; +// String name = ""; +// String objName = "/dset"; +// +// try { +// ref = H5.H5Rcreate_object(H5fid, objName, HDF5Constants.H5P_DEFAULT); +// } +// catch (Throwable err) { +// err.printStackTrace(); +// fail("testH5Rget_object: H5Rcreate_object " + err); +// } +// try { +// dataset_id= H5.H5Rdereference(H5fid, HDF5Constants.H5P_DEFAULT, HDF5Constants.H5R_DATASET_REGION, ref1); +// +// //Create reference on group +// ref2 = H5.H5Rcreate(H5gid, "/Group1", HDF5Constants.H5R_OBJECT, -1); +// group_id= H5.H5Rdereference(H5gid, HDF5Constants.H5P_DEFAULT, HDF5Constants.H5R_OBJECT, ref2); +// assertNotNull(ref1); +// assertNotNull(ref2); +// assertTrue(dataset_id >= 0); +// assertTrue(group_id >= 0); +// } +// catch (Throwable err) { +// err.printStackTrace(); +// fail("TestH5Rdereference " + err); +// } +// finally { +// try {H5.H5Dclose(dataset_id);} catch (Exception ex) {} +// try {H5.H5Gclose(group_id);} catch (Exception ex) {} +// } +// } + +// @Test// +// public void testH5Rget_attr() { +// long loc_id = H5fid; +// int ref_type = HDF5Constants.H5R_OBJECT2; +// long ret_val = -1; +// byte[] ref = null; +// String name = ""; +// String objName = "/dset"; +// +// try { +// ref = H5.H5Rcreate_object(H5fid, objName, HDF5Constants.H5P_DEFAULT); +// } +// catch (Throwable err) { +// err.printStackTrace(); +// fail("testH5Rget_object: H5Rcreate_object " + err); +// } +// try { +// dsid = H5.H5Rget_region(H5fid, HDF5Constants.H5R_DATASET_REGION, ref); +// assertNotNull(ref); +// assertTrue(dsid >= 0); +// } +// catch (Throwable err) { +// err.printStackTrace(); +// fail("TestH5Rget_region: " + err); +// } +// finally { +// try {H5.H5Sclose(dsid);} catch (Exception ex) {} +// } +// } + +} diff --git a/java/test/TestH5S.java b/java/test/TestH5S.java index 03943a4..7eeed7a 100644 --- a/java/test/TestH5S.java +++ b/java/test/TestH5S.java @@ -1,6 +1,5 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * 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 * @@ -30,7 +29,7 @@ import org.junit.rules.TestName; public class TestH5S { @Rule public TestName testname = new TestName(); - long H5sid = -1; + long H5sid = HDF5Constants.H5I_INVALID_HID; int H5rank = 2; long H5dims[] = {5, 5}; long H5maxdims[] = {10, 10}; @@ -181,7 +180,7 @@ public class TestH5S { @Test public void testH5Scopy() { - long sid = -1; + long sid = HDF5Constants.H5I_INVALID_HID; int read_rank = -1; try { @@ -201,7 +200,7 @@ public class TestH5S { @Test public void testH5Sextent_copy() { - long sid = -1; + long sid = HDF5Constants.H5I_INVALID_HID; int class_type = -1; try { @@ -222,7 +221,7 @@ public class TestH5S { @Test public void testH5Sextent_equal() { - long sid = -1; + long sid = HDF5Constants.H5I_INVALID_HID; boolean result = false; try { @@ -252,8 +251,8 @@ public class TestH5S { @Test public void testH5Sencode_decode_null_dataspace() { - long sid = -1; - long decoded_sid = -1; + long sid = HDF5Constants.H5I_INVALID_HID; + long decoded_sid = HDF5Constants.H5I_INVALID_HID; byte[] null_sbuf = null; boolean result = false; @@ -299,8 +298,8 @@ public class TestH5S { @Test public void testH5Sencode_decode_scalar_dataspace() { - long sid = -1; - long decoded_sid = -1; + long sid = HDF5Constants.H5I_INVALID_HID; + long decoded_sid = HDF5Constants.H5I_INVALID_HID; byte[] scalar_sbuf = null; boolean result = false; int iresult = -1; @@ -470,7 +469,7 @@ public class TestH5S { @Test public void testH5Sget_select_hyper() { - long space1 = -1; + long space1 = HDF5Constants.H5I_INVALID_HID; long start[] = {0,0}; long stride[] = {1,1}; long count[] = {1,1}; @@ -508,7 +507,7 @@ public class TestH5S { @Test public void testH5Sget_select_valid() { - long space1 = -1; + long space1 = HDF5Constants.H5I_INVALID_HID; long start[] = {1,0}; long stride[] = {1,1}; long count[] = {2,3}; diff --git a/java/test/TestH5Sbasic.java b/java/test/TestH5Sbasic.java index e6698c6..548ac95 100644 --- a/java/test/TestH5Sbasic.java +++ b/java/test/TestH5Sbasic.java @@ -1,6 +1,5 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * 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 * @@ -56,7 +55,7 @@ public class TestH5Sbasic { @Test public void testH5Screate_scalar() { - long sid = -1; + long sid = HDF5Constants.H5I_INVALID_HID; int class_type = -1; try { sid = H5.H5Screate(HDF5Constants.H5S_SCALAR); @@ -75,7 +74,7 @@ public class TestH5Sbasic { @Test public void testH5Screate_null() { - long sid = -1; + long sid = HDF5Constants.H5I_INVALID_HID; int class_type = -1; try { sid = H5.H5Screate(HDF5Constants.H5S_NULL); @@ -125,7 +124,7 @@ public class TestH5Sbasic { @Test public void testH5Screate_simple() { - long sid = -1; + long sid = HDF5Constants.H5I_INVALID_HID; int class_type = -1; int rank = 2; long dims[] = {5, 5}; @@ -148,7 +147,7 @@ public class TestH5Sbasic { @Test public void testH5Screate_simple_unlimted() { - long sid = -1; + long sid = HDF5Constants.H5I_INVALID_HID; int class_type = -1; int rank = 2; long dims[] = {5, 5}; @@ -171,7 +170,7 @@ public class TestH5Sbasic { @Test public void testH5Screate_simple_unlimted_1d() { - long sid = -1; + long sid = HDF5Constants.H5I_INVALID_HID; int class_type = -1; int rank = 1; long dims[] = {5}; @@ -194,7 +193,7 @@ public class TestH5Sbasic { @Test public void testH5Screate_simple_max_default() { - long sid = -1; + long sid = HDF5Constants.H5I_INVALID_HID; int rank = 2; long dims[] = {5, 5}; @@ -213,7 +212,7 @@ public class TestH5Sbasic { @Test public void testH5Screate_simple_extent() { - long sid = -1; + long sid = HDF5Constants.H5I_INVALID_HID; int rank = 2; long dims[] = {5, 5}; long maxdims[] = {10, 10}; @@ -270,7 +269,7 @@ public class TestH5Sbasic { @Test(expected = IllegalArgumentException.class) public void testH5Sselect_adjust_rank_offset() throws Throwable { - long sid = -1; + long sid = HDF5Constants.H5I_INVALID_HID; long offset[][] = {{0,1},{2,4},{5,6}}; try { @@ -292,7 +291,7 @@ public class TestH5Sbasic { @Test(expected = IllegalArgumentException.class) public void testH5Sselect_intersect_block_rank_start() throws Throwable { - long sid = -1; + long sid = HDF5Constants.H5I_INVALID_HID; long start[] = new long[2]; long end[] = null; @@ -308,7 +307,7 @@ public class TestH5Sbasic { @Test(expected = IllegalArgumentException.class) public void testH5Sselect_intersect_block_rank_end() throws Throwable { - long sid = -1; + long sid = HDF5Constants.H5I_INVALID_HID; long start[] = null; long end[] = new long[2]; @@ -336,7 +335,7 @@ public class TestH5Sbasic { @Test(expected = NullPointerException.class) public void testH5Scombine_hyperslab_null_start() throws Throwable { - long sid = -1; + long sid = HDF5Constants.H5I_INVALID_HID; long start[] = null; long stride[] = null; long count[] = new long[2]; @@ -354,7 +353,7 @@ public class TestH5Sbasic { @Test(expected = NullPointerException.class) public void testH5Scombine_hyperslab_null_count() throws Throwable { - long sid = -1; + long sid = HDF5Constants.H5I_INVALID_HID; long start[] = new long[2]; long stride[] = null; long count[] = null; diff --git a/java/test/TestH5T.java b/java/test/TestH5T.java index 18b5985..c882f8e 100644 --- a/java/test/TestH5T.java +++ b/java/test/TestH5T.java @@ -1,6 +1,5 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * 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 * @@ -33,8 +32,8 @@ import org.junit.rules.TestName; public class TestH5T { @Rule public TestName testname = new TestName(); private static final String H5_FILE = "testT.h5"; - long H5fid = -1; - long H5strdid = -1; + long H5fid = HDF5Constants.H5I_INVALID_HID; + long H5strdid = HDF5Constants.H5I_INVALID_HID; private final void _deleteFile(String filename) { File file = null; @@ -129,7 +128,7 @@ public class TestH5T { @Test public void testH5Tarray_create() { - long filetype_id = -1; + long filetype_id = HDF5Constants.H5I_INVALID_HID; long[] adims = { 3, 5 }; try { @@ -148,7 +147,7 @@ public class TestH5T { @Test public void testH5Tget_array_ndims() { - long filetype_id = -1; + long filetype_id = HDF5Constants.H5I_INVALID_HID; int ndims = 0; long[] adims = { 3, 5 }; @@ -176,7 +175,7 @@ public class TestH5T { @Test public void testH5Tget_array_dims() { - long filetype_id = -1; + long filetype_id = HDF5Constants.H5I_INVALID_HID; int ndims = 0; long[] adims = { 3, 5 }; long[] rdims = new long[2]; @@ -207,7 +206,7 @@ public class TestH5T { @Test public void testH5Tenum_functions() { - long filetype_id =-1; + long filetype_id =HDF5Constants.H5I_INVALID_HID; String enum_type ="Enum_type"; byte[] enum_val = new byte[1]; String enum_name = null; @@ -275,7 +274,7 @@ public class TestH5T { @Test public void testH5Tenum_create_functions() { - long filetype_id = -1; + long filetype_id = HDF5Constants.H5I_INVALID_HID; byte[] enum_val = new byte[1]; // Create a enumerate datatype @@ -315,7 +314,7 @@ public class TestH5T { @Test public void testH5Topaque_functions() { - long filetype_id = -1; + long filetype_id = HDF5Constants.H5I_INVALID_HID; String opaque_name = null; // Create a opaque datatype @@ -345,7 +344,7 @@ public class TestH5T { @Test public void testH5Tvlen_create() { - long filetype_id = -1; + long filetype_id = HDF5Constants.H5I_INVALID_HID; try { filetype_id = H5.H5Tvlen_create(HDF5Constants.H5T_C_S1); @@ -368,7 +367,7 @@ public class TestH5T { @Test public void testH5Tis_variable_str() { - long filetype_id = -1; + long filetype_id = HDF5Constants.H5I_INVALID_HID; try { filetype_id = H5.H5Tcopy(HDF5Constants.H5T_C_S1); @@ -399,7 +398,7 @@ public class TestH5T { @Test public void testH5Tcompound_functions() { - long filetype_id =-1; + long filetype_id =HDF5Constants.H5I_INVALID_HID; // Create a compound datatype try { diff --git a/java/test/TestH5Tbasic.java b/java/test/TestH5Tbasic.java index 6dbc6e3..7aac2ab 100644 --- a/java/test/TestH5Tbasic.java +++ b/java/test/TestH5Tbasic.java @@ -1,6 +1,5 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * 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 * @@ -40,7 +39,7 @@ public class TestH5Tbasic { @Test public void testH5Tcopy() { - long H5strdid = -1; + long H5strdid = HDF5Constants.H5I_INVALID_HID; try { H5strdid = H5.H5Tcopy(HDF5Constants.H5T_C_S1); assertTrue("H5.H5Tcopy",H5strdid > 0); @@ -57,7 +56,7 @@ public class TestH5Tbasic { @Test public void testH5Tequal() { - long H5strdid = -1; + long H5strdid = HDF5Constants.H5I_INVALID_HID; try { H5strdid = H5.H5Tcopy(HDF5Constants.H5T_C_S1); assertTrue("H5.H5Tcopy",H5strdid > 0); @@ -76,7 +75,7 @@ public class TestH5Tbasic { @Test public void testH5Tequal_not() { - long H5strdid = -1; + long H5strdid = HDF5Constants.H5I_INVALID_HID; try { H5strdid = H5.H5Tcopy(HDF5Constants.H5T_STD_U64LE); assertTrue("H5.H5Tcopy",H5strdid > 0); @@ -98,8 +97,8 @@ public class TestH5Tbasic { String[] strs = {"a1234","b1234"}; int srcLen = 5; int dstLen = 10; - long srcId = -1; - long dstId = -1; + long srcId = HDF5Constants.H5I_INVALID_HID; + long dstId = HDF5Constants.H5I_INVALID_HID; int dimSize = strs.length; byte[] buf = new byte[dimSize*dstLen]; @@ -131,7 +130,7 @@ public class TestH5Tbasic { @Test public void testH5Torder_size() { - long H5strdid = -1; + long H5strdid = HDF5Constants.H5I_INVALID_HID; try { // Fixed length string H5strdid = H5.H5Tcopy(HDF5Constants.H5T_C_S1); diff --git a/java/test/TestH5Tparams.java b/java/test/TestH5Tparams.java index 4180de5..92a034c 100644 --- a/java/test/TestH5Tparams.java +++ b/java/test/TestH5Tparams.java @@ -1,6 +1,5 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * 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 * diff --git a/java/test/TestH5VL.java b/java/test/TestH5VL.java index 554c1f7..4253d20 100644 --- a/java/test/TestH5VL.java +++ b/java/test/TestH5VL.java @@ -1,6 +1,5 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * 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 * @@ -72,28 +71,28 @@ public class TestH5VL { @Test public void testH5VLget_connector_id() { - String H5_FILE = "testFvl.h5"; + String H5_FILE = "testFvl.h5"; long H5fid = H5.H5Fcreate(H5_FILE, HDF5Constants.H5F_ACC_TRUNC, HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT); - try { - long native_id = H5.H5VLget_connector_id(H5fid); - assertTrue("H5.H5VLget_connector_id", native_id >= 0); - - /* - * If HDF5_VOL_CONNECTOR is set, this might not be the - * native connector. Only check for the native connector - * if this isn't set. - */ - String connector = System.getenv("HDF5_VOL_CONNECTOR"); - if (connector == null) - assertEquals(HDF5Constants.H5VL_NATIVE, native_id); - } - catch (Throwable err) { - err.printStackTrace(); - fail("H5.H5VLget_connector_id " + err); - } + try { + long native_id = H5.H5VLget_connector_id(H5fid); + assertTrue("H5.H5VLget_connector_id", native_id >= 0); + + /* + * If HDF5_VOL_CONNECTOR is set, this might not be the + * native connector. Only check for the native connector + * if this isn't set. + */ + String connector = System.getenv("HDF5_VOL_CONNECTOR"); + if (connector == null) + assertEquals(HDF5Constants.H5VL_NATIVE, native_id); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5.H5VLget_connector_id " + err); + } finally { if (H5fid > 0) { try {H5.H5Fclose(H5fid);} catch (Exception ex) {} @@ -139,14 +138,14 @@ public class TestH5VL { try { String native_name = H5.H5VLget_connector_name(H5fid); - /* - * If HDF5_VOL_CONNECTOR is set, this might not be the - * native connector. Only check for the native connector - * if this isn't set. - */ - String connector = System.getenv("HDF5_VOL_CONNECTOR"); - if (connector == null) - assertTrue("H5.H5VLget_connector_name H5VL_NATIVE", native_name.compareToIgnoreCase(HDF5Constants.H5VL_NATIVE_NAME)==0); + /* + * If HDF5_VOL_CONNECTOR is set, this might not be the + * native connector. Only check for the native connector + * if this isn't set. + */ + String connector = System.getenv("HDF5_VOL_CONNECTOR"); + if (connector == null) + assertTrue("H5.H5VLget_connector_name H5VL_NATIVE", native_name.compareToIgnoreCase(HDF5Constants.H5VL_NATIVE_NAME)==0); } catch (Throwable err) { err.printStackTrace(); diff --git a/java/test/TestH5Z.java b/java/test/TestH5Z.java index 696642b..fde8f1a 100644 --- a/java/test/TestH5Z.java +++ b/java/test/TestH5Z.java @@ -1,6 +1,5 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * 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 * diff --git a/java/test/junit.sh.in b/java/test/junit.sh.in index 2eabdf0..81ce13b 100644 --- a/java/test/junit.sh.in +++ b/java/test/junit.sh.in @@ -1,7 +1,6 @@ #! /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 @@ -46,6 +45,8 @@ HDFLIB_HOME="$top_srcdir/java/lib" BLDDIR="." BLDLIBDIR="$BLDDIR/testlibs" HDFTEST_HOME="$top_srcdir/java/test" +TOOLS_TESTFILES="$top_srcdir/tools/testfiles" + JARFILE=jar@PACKAGE_TARNAME@-@PACKAGE_VERSION@.jar TESTJARFILE=jar@PACKAGE_TARNAME@test.jar test -d $BLDLIBDIR || mkdir -p $BLDLIBDIR @@ -93,6 +94,7 @@ $HDFTEST_HOME/testfiles/JUnit-TestH5Lparams.txt $HDFTEST_HOME/testfiles/JUnit-TestH5Lbasic.txt $HDFTEST_HOME/testfiles/JUnit-TestH5Lcreate.txt $HDFTEST_HOME/testfiles/JUnit-TestH5R.txt +$HDFTEST_HOME/testfiles/JUnit-TestH5Rref.txt $HDFTEST_HOME/testfiles/JUnit-TestH5P.txt $HDFTEST_HOME/testfiles/JUnit-TestH5PData.txt $HDFTEST_HOME/testfiles/JUnit-TestH5Pfapl.txt @@ -146,7 +148,7 @@ COPY_LIBFILES_TO_BLDLIBDIR() fi fi done - if [ "$IS_DARWIN" = "yes" ]; then + if [ "$IS_DARWIN" = "yes" ]; then (cd testlibs; \ install_name_tool -add_rpath @loader_path libhdf5_java.dylib; \ exist_path=` otool -l libhdf5_java.dylib | grep libhdf5 | grep -v java | awk '{print $2}'`; \ @@ -248,6 +250,8 @@ COPY_DATAFILES_TO_BLDDIR() $CP -f $HDFTEST_HOME/h5ex_g_iterate.orig $BLDDIR/h5ex_g_iterateL2.hdf $CP -f $HDFTEST_HOME/h5ex_g_iterate.orig $BLDDIR/h5ex_g_iterateO1.hdf $CP -f $HDFTEST_HOME/h5ex_g_iterate.orig $BLDDIR/h5ex_g_iterateO2.hdf + $CP -f $TOOLS_TESTFILES/trefer_reg.h5 $BLDDIR/trefer_reg.h5 + $CP -f $TOOLS_TESTFILES/trefer_attr.h5 $BLDDIR/trefer_attr.h5 } CLEAN_DATAFILES_AND_BLDDIR() @@ -768,6 +772,27 @@ else test yes = "$verbose" && $DIFF JUnit-TestH5R.txt JUnit-TestH5R.out |sed 's/^/ /' fi +echo "$JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH -ea org.junit.runner.JUnitCore test.TestH5Rref" +TESTING JUnit-TestH5Rref +($RUNSERIAL $JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH -ea org.junit.runner.JUnitCore test.TestH5Rref > JUnit-TestH5Rref.ext) + +# Extract file name, line number, version and thread IDs because they may be different +sed -e 's/thread [0-9]*/thread (IDs)/' -e 's/: .*\.c /: (file name) /' \ + -e 's/line [0-9]*/line (number)/' \ + -e 's/Time: [0-9]*[\.,[0-9]*]*/Time: XXXX/' \ + -e 's/v[1-9]*\.[0-9]*\./version (number)\./' \ + -e 's/[1-9]*\.[0-9]*\.[0-9]*[^)]*/version (number)/' \ + JUnit-TestH5Rref.ext > JUnit-TestH5Rref.out + +if diff JUnit-TestH5Rref.out JUnit-TestH5Rref.txt > /dev/null; then + echo " PASSED JUnit-TestH5Rref" +else + echo "**FAILED** JUnit-TestH5Rref" + echo " Expected result differs from actual result" + nerrors="`expr $nerrors + 1`" + test yes = "$verbose" && $DIFF JUnit-TestH5Rref.txt JUnit-TestH5Rref.out |sed 's/^/ /' +fi + echo "$JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH -ea org.junit.runner.JUnitCore test.TestH5P" TESTING JUnit-TestH5P ($RUNSERIAL $JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH -ea org.junit.runner.JUnitCore test.TestH5P > JUnit-TestH5P.ext) diff --git a/java/test/testfiles/JUnit-TestH5.txt b/java/test/testfiles/JUnit-TestH5.txt index 4bab633..59765d9 100644 --- a/java/test/testfiles/JUnit-TestH5.txt +++ b/java/test/testfiles/JUnit-TestH5.txt @@ -3,8 +3,10 @@ JUnit version 4.11 .testJ2C .testH5export_dataset .testIsSerializable +.testH5export_attrdataset .testH5garbage_collect .testH5error_off +.testH5export_regdataset .serializeToDisk .testH5open .testH5check_version @@ -13,5 +15,5 @@ JUnit version 4.11 Time: XXXX -OK (11 tests) +OK (13 tests) diff --git a/java/test/testfiles/JUnit-TestH5Rref.txt b/java/test/testfiles/JUnit-TestH5Rref.txt new file mode 100644 index 0000000..05019c0 --- /dev/null +++ b/java/test/testfiles/JUnit-TestH5Rref.txt @@ -0,0 +1,10 @@ +JUnit version 4.11 +.testH5Rget_region_dataset +.testH5Rget_object +.testH5Rget_region_attribute +.testH5Rget_obj_type3 + +Time: XXXX + +OK (4 tests) + diff --git a/test/use_common.c b/test/use_common.c index f33a21b..4a878c7 100644 --- a/test/use_common.c +++ b/test/use_common.c @@ -442,7 +442,7 @@ read_uc_file(hbool_t towait, options_t *opts) { hid_t fid; /* File ID for new HDF5 file */ hid_t dsid; /* dataset ID */ - UC_CTYPE *buffer, *bufptr; /* read data buffer */ + UC_CTYPE *buffer = NULL, *bufptr = NULL; /* read data buffer */ hid_t f_sid; /* dataset file space id */ hid_t m_sid; /* memory space id */ int rank; /* rank */ @@ -605,6 +605,8 @@ read_uc_file(hbool_t towait, options_t *opts) return -1; } + HDfree(buffer); + if (nreadererr) return -1; else diff --git a/tools/lib/h5diff_array.c b/tools/lib/h5diff_array.c index d9616e1..f97ef50 100644 --- a/tools/lib/h5diff_array.c +++ b/tools/lib/h5diff_array.c @@ -472,9 +472,7 @@ diff_datum(void *_mem1, void *_mem2, hsize_t elemtno, diff_opt_t *opts, hid_t co size_t size = 0; hbool_t iszero1; hbool_t iszero2; - hsize_t nfound = 0; /* differences found */ - double per; - hbool_t both_zero; + hsize_t nfound = 0; /* differences found */ diff_err_t ret_value = opts->err_stat; H5TOOLS_START_DEBUG("ph:%d elemtno:%d - errstat:%d", opts->print_header, elemtno, opts->err_stat); @@ -3364,48 +3362,66 @@ print_pos(diff_opt_t *opts, hsize_t idx, size_t u) hsize_t curr_pos = idx; parallel_print("[ "); - H5TOOLS_DEBUG("do calc_acc_pos[%ld] nelmts:%d - errstat:%d", i, opts->hs_nelmts, opts->err_stat); + H5TOOLS_DEBUG("do calc_acc_pos[%ld] nelmts:%d - errstat:%d", idx, opts->hs_nelmts, + opts->err_stat); if (opts->sset[0] != NULL) { /* Subsetting is used - calculate total position */ - hsize_t elmnt_cnt = 1; - hsize_t dim_cnt = 0; /* previous dim size */ - hsize_t str_cnt = 0; /* previous dim stride */ - hsize_t curr_idx = idx; /* calculated running position */ - hsize_t str_idx = 0; - hsize_t blk_idx = 0; - hsize_t cnt_idx = 0; - hsize_t hs_idx = 0; - j = opts->rank - 1; + hsize_t prev_dim_size = 0; /* previous dim size */ + hsize_t prev_str = 0; /* previouw stride idx*/ + hsize_t str_cnt = 0; /* stride multiplier*/ + hsize_t curr_idx = 0; /* calculated running position */ + hsize_t str_idx = 0; + hsize_t blk_idx = 0; + hsize_t cnt_idx = 0; + hsize_t dim_size = 0; /* current dim size */ + hsize_t elmnt_cnt = 1; + hsize_t next_idx = idx; + hsize_t data_idx = 0; + j = opts->rank - 1; + H5TOOLS_DEBUG("...begin:%ld=> opts->rank:%ld (idx:%ld)", j, opts->rank, idx); do { - cnt_idx = opts->sset[0]->count.data[j]; /* Count value for current dim */ - H5TOOLS_DEBUG("... sset loop:%d with curr_pos:%ld (curr_idx:%ld) - count:%ld", j, - curr_pos, curr_idx, cnt_idx); - blk_idx = opts->sset[0]->block.data[j]; /* Block value for current dim */ - H5TOOLS_DEBUG("... sset loop:%d with curr_pos:%ld (curr_idx:%ld) - block:%ld", j, - curr_pos, curr_idx, blk_idx); - hs_idx = cnt_idx * blk_idx; /* hyperslab area value for current dim */ - H5TOOLS_DEBUG("... sset loop:%d with curr_pos:%ld (curr_idx:%ld) - hs:%ld", j, curr_pos, - curr_idx, hs_idx); - str_idx = opts->sset[0]->stride.data[j]; /* Stride value for current dim */ - H5TOOLS_DEBUG("... sset loop:%d with curr_pos:%ld (curr_idx:%ld) - stride:%ld", j, - curr_pos, curr_idx, str_idx); - elmnt_cnt *= opts->dims[j]; /* Total number of elements in dimension */ - H5TOOLS_DEBUG("... sset loop:%d with elmnt_cnt:%ld", j, elmnt_cnt); - if (str_idx > blk_idx) - curr_idx += dim_cnt * (str_idx - blk_idx); /* */ - else if (curr_idx >= hs_idx) - curr_idx += dim_cnt * str_cnt; - H5TOOLS_DEBUG("... sset loop:%d with idx:%ld (curr_idx:%ld) - stride:%ld", j, idx, - curr_idx, str_idx); - dim_cnt = elmnt_cnt; /* */ - if (str_idx > blk_idx) - str_cnt = str_idx - blk_idx; /* */ - else - str_cnt = str_idx; /* */ - H5TOOLS_DEBUG("... sset loop:%d with dim_cnt:%ld - str_cnt:%ld", j, dim_cnt, str_cnt); + curr_idx = next_idx; /* New current data position */ + cnt_idx = opts->sset[0]->count.data[j]; /* Count value for current dim */ + blk_idx = opts->sset[0]->block.data[j]; /* Block value for current dim */ + str_idx = opts->sset[0]->stride.data[j]; /* Stride value for current dim */ + H5TOOLS_DEBUG("... sset loop:%d with curr_pos:%ld (curr_idx:%ld) - c:%ld b:%ld s:%ld", j, + curr_pos, curr_idx, cnt_idx, blk_idx, str_idx); + dim_size = opts->dims[j]; /* Current dimension size */ + // elmnt_cnt *= dim_size; /* Total number of elements in dimension */ + H5TOOLS_DEBUG("... sset loop:%d with elmnt_cnt:%ld - (prev_dim_size:%ld - dim_size:%ld) " + "- str_cnt:%ld", + j, elmnt_cnt, prev_dim_size, dim_size, str_cnt); + data_idx = elmnt_cnt * dim_size; + H5TOOLS_DEBUG("... sset loop:%d with curr_pos:%ld (data_idx:%ld)", j, curr_pos, data_idx); + for (i = 0; i < cnt_idx; i++) { + H5TOOLS_DEBUG("... ... data loop:%d with cnt_idx:%ld - str_cnt:%ld (curr_idx:%ld - " + "data_idx:%ld)", + i, cnt_idx, str_cnt, curr_idx, data_idx); + if (curr_idx >= data_idx) { + /* get to next block */ + data_idx += str_idx * dim_size; + /* get next block */ + str_cnt++; + H5TOOLS_DEBUG( + "... ... data loop:%d with cnt_idx:%ld - str_cnt:%ld - data_idx:%ld", i, + cnt_idx, str_cnt, data_idx); + } + H5TOOLS_DEBUG("... ... end data loop:%d with dim_cnt:%ld - str_cnt:%ld - " + "(curr_idx:%ld - data_idx:%ld)", + i, dim_size, str_cnt, curr_idx, data_idx); + } + next_idx += dim_size * str_cnt; // + prev_dim_size; + H5TOOLS_DEBUG("... sset loop:%d with curr_idx:%ld (next_idx:%ld)", j, curr_idx, next_idx); + str_cnt = 0; + prev_str = str_idx; + prev_dim_size = dim_size; + H5TOOLS_DEBUG("... end sset loop:%d with prev_dim_size:%ld (curr_idx:%ld - data_idx:%ld) " + "- str_cnt:%ld", + j, prev_dim_size, curr_idx, data_idx, str_cnt); + elmnt_cnt *= dim_size; /* Total number of elements in dimension */ j--; - } while (curr_idx >= elmnt_cnt && j >= 0); + } while (next_idx >= elmnt_cnt && j >= 0); curr_pos = curr_idx; /* New current position */ H5TOOLS_DEBUG("pos loop:%d,%d with elmnt_cnt:%ld - curr_pos:%ld", i, j, elmnt_cnt, curr_pos); } /* if (opts->sset[0] != NULL) */ diff --git a/tools/lib/h5tools.c b/tools/lib/h5tools.c index f6566d9..3b78491 100644 --- a/tools/lib/h5tools.c +++ b/tools/lib/h5tools.c @@ -1778,7 +1778,7 @@ render_bin_output(FILE *stream, hid_t container, hid_t tid, void *_mem, hsize_t } break; case H5T_ARRAY: { int k, ndims; - hsize_t dims[H5S_MAX_RANK], temp_nelmts, nelmts; + hsize_t dims[H5S_MAX_RANK], temp_nelmts, nelmts = 0; hid_t memb = H5I_INVALID_HID; H5TOOLS_DEBUG("H5T_ARRAY"); diff --git a/tools/lib/h5tools_str.c b/tools/lib/h5tools_str.c index dd3ae67..212b13e 100644 --- a/tools/lib/h5tools_str.c +++ b/tools/lib/h5tools_str.c @@ -705,7 +705,7 @@ h5tools_str_sprint(h5tools_str_t *str, const h5tool_format_t *info, hid_t contai long double templdouble; HDmemcpy(&templdouble, vp, sizeof(long double)); - h5tools_str_append(str, OPT(info->fmt_double, "%Lf"), templdouble); + h5tools_str_append(str, "%Lg", templdouble); #endif } break; diff --git a/tools/lib/h5tools_utils.c b/tools/lib/h5tools_utils.c index 708fb2c..b33d908 100644 --- a/tools/lib/h5tools_utils.c +++ b/tools/lib/h5tools_utils.c @@ -196,7 +196,7 @@ get_option(int argc, const char **argv, const char *opts, const struct long_opti /* long command line option */ int i; const char ch = '='; - char * arg = &argv[opt_ind][2]; + char * arg = HDstrdup(&argv[opt_ind][2]); size_t arg_len = 0; opt_arg = strchr(&argv[opt_ind][2], ch); @@ -208,8 +208,6 @@ get_option(int argc, const char **argv, const char *opts, const struct long_opti arg[arg_len] = 0; for (i = 0; l_opts && l_opts[i].name; i++) { - size_t len = HDstrlen(l_opts[i].name); - if (HDstrcmp(arg, l_opts[i].name) == 0) { /* we've found a matching long command line flag */ opt_opt = l_opts[i].shortval; @@ -253,6 +251,8 @@ get_option(int argc, const char **argv, const char *opts, const struct long_opti opt_ind++; sp = 1; + + HDfree(arg); } else { register char *cp; /* pointer into current token */ diff --git a/tools/src/h5diff/h5diff_common.c b/tools/src/h5diff/h5diff_common.c index b51950e..99cd653 100644 --- a/tools/src/h5diff/h5diff_common.c +++ b/tools/src/h5diff/h5diff_common.c @@ -76,7 +76,6 @@ check_options(diff_opt_t *opts) } } -#if TRILABS_227 /*------------------------------------------------------------------------- * Function: parse_hsize_list * @@ -192,7 +191,6 @@ parse_subset_params(const char *dset) return s; } -#endif /*------------------------------------------------------------------------- * Function: parse_command_line @@ -480,11 +478,9 @@ parse_command_line(int argc, const char *argv[], const char **fname1, const char * TRILABS_227 is complete except for an issue with printing indices * the following calls will enable subsetting */ -#if TRILABS_227 opts->sset[0] = parse_subset_params(*objname1); opts->sset[1] = parse_subset_params(*objname2); -#endif H5TOOLS_ENDDEBUG(""); } @@ -822,19 +818,27 @@ usage(void) /* * TRILABS_227 is complete except for an issue with printing indices * the following will be needed for subsetting + */ PRINTVALSTREAM(rawoutstream, " Subsetting options:\n"); - PRINTVALSTREAM(rawoutstream, " Subsetting is available by using the fcompact form of subsetting, as - follows:\n"); PRINTVALSTREAM(rawoutstream, " obj1 /foo/mydataset[START;STRIDE;COUNT;BLOCK]\n"); - PRINTVALSTREAM(rawoutstream, " It is not required to use all parameters, but until the last parameter - value used,\n"); PRINTVALSTREAM(rawoutstream, " all of the semicolons (;) are required, even when a - parameter value is not specified. Example:\n"); PRINTVALSTREAM(rawoutstream, " obj1 - /foo/mydataset[START;;COUNT;BLOCK]\n"); PRINTVALSTREAM(rawoutstream, " obj1 /foo/mydataset[START]\n"); - PRINTVALSTREAM(rawoutstream, " The STRIDE, COUNT, and BLOCK parameters are optional and will default to 1 - in\n"); PRINTVALSTREAM(rawoutstream, " each dimension. START is optional and will default to 0 in each - dimension.\n"); PRINTVALSTREAM(rawoutstream, " Each of START, STRIDE, COUNT, and BLOCK must be a - comma-separated list of integers with\n"); PRINTVALSTREAM(rawoutstream, " one integer for each dimension - of the dataset.\n"); PRINTVALSTREAM(rawoutstream, "\n"); - */ + PRINTVALSTREAM(rawoutstream, + " Subsetting is available by using the fcompact form of subsetting, as follows:\n"); + PRINTVALSTREAM(rawoutstream, " obj1 /foo/mydataset[START;STRIDE;COUNT;BLOCK]\n"); + PRINTVALSTREAM(rawoutstream, + " It is not required to use all parameters, but until the last parameter value used,\n"); + PRINTVALSTREAM( + rawoutstream, + " all of the semicolons (;) are required, even when a parameter value is not specified. Example:\n"); + PRINTVALSTREAM(rawoutstream, " obj1 /foo/mydataset[START;;COUNT;BLOCK]\n"); + PRINTVALSTREAM(rawoutstream, " obj1 /foo/mydataset[START]\n"); + PRINTVALSTREAM(rawoutstream, + " The STRIDE, COUNT, and BLOCK parameters are optional and will default to 1 in\n"); + PRINTVALSTREAM(rawoutstream, + " each dimension. START is optional and will default to 0 in each dimension.\n"); + PRINTVALSTREAM( + rawoutstream, + " Each of START, STRIDE, COUNT, and BLOCK must be a comma-separated list of integers with\n"); + PRINTVALSTREAM(rawoutstream, " one integer for each dimension of the dataset.\n"); + PRINTVALSTREAM(rawoutstream, "\n"); PRINTVALSTREAM(rawoutstream, " Exit code:\n"); PRINTVALSTREAM(rawoutstream, " 0 if no differences, 1 if differences found, 2 if error\n"); PRINTVALSTREAM(rawoutstream, "\n"); diff --git a/tools/src/h5import/h5import.c b/tools/src/h5import/h5import.c index e3f4384..471af51 100644 --- a/tools/src/h5import/h5import.c +++ b/tools/src/h5import/h5import.c @@ -2536,7 +2536,7 @@ parsePathInfo(struct path_info *path, char *temp) token = HDstrtok(temp, delimiter); if (HDstrlen(token) >= MAX_PATH_NAME_LENGTH) { - (void)HDfprintf(stderr, err1); + (void)HDfprintf(stderr, "%s", err1); return (-1); } HDstrcpy(path->group[i++], token); @@ -2546,7 +2546,7 @@ parsePathInfo(struct path_info *path, char *temp) if (token == NULL) break; if (HDstrlen(token) >= MAX_PATH_NAME_LENGTH) { - (void)HDfprintf(stderr, err1); + (void)HDfprintf(stderr, "%s", err1); return (-1); } HDstrcpy(path->group[i++], token); diff --git a/tools/src/h5ls/h5ls.c b/tools/src/h5ls/h5ls.c index b29ed72..06c90d0 100644 --- a/tools/src/h5ls/h5ls.c +++ b/tools/src/h5ls/h5ls.c @@ -2648,7 +2648,7 @@ int main(int argc, const char *argv[]) { hid_t file_id = H5I_INVALID_HID; - char * fname = NULL, *oname = NULL, *x; + char * fname = NULL, *oname = NULL, *x = NULL; const char * s = NULL; char * rest; int argno; diff --git a/tools/src/h5repack/h5repack_copy.c b/tools/src/h5repack/h5repack_copy.c index 20d277d..0aef710 100644 --- a/tools/src/h5repack/h5repack_copy.c +++ b/tools/src/h5repack/h5repack_copy.c @@ -357,14 +357,14 @@ copy_objects(const char *fnamein, const char *fnameout, pack_opt_t *options) done: H5E_BEGIN_TRY { - H5Pclose(fcpl_in); - H5Pclose(gcpl_in); H5Pclose(fcpl); + H5Pclose(options->fout_fapl); + options->fout_fapl = H5P_DEFAULT; + H5Pclose(gcpl_in); H5Gclose(grp_in); - H5Fclose(fidin); + H5Pclose(fcpl_in); H5Fclose(fidout); H5Fclose(fidin); - H5Fclose(fidout); } H5E_END_TRY; if (travt) diff --git a/tools/src/h5repack/h5repack_verify.c b/tools/src/h5repack/h5repack_verify.c index cc5501d..0542d03 100644 --- a/tools/src/h5repack/h5repack_verify.c +++ b/tools/src/h5repack/h5repack_verify.c @@ -378,9 +378,11 @@ h5repack_cmp_pl(const char *fname1, hid_t fname1_fapl, const char *fname2, hid_t *------------------------------------------------------------------------- */ /* Open the files */ - if ((fid1 = h5tools_fopen(fname1, H5F_ACC_RDONLY, fname1_fapl, TRUE, NULL, 0)) < 0) + if ((fid1 = h5tools_fopen(fname1, H5F_ACC_RDONLY, fname1_fapl, + (fname1_fapl == H5P_DEFAULT) ? FALSE : TRUE, NULL, 0)) < 0) H5TOOLS_GOTO_ERROR((-1), "h5tools_fopen failed <%s>: %s", fname1, H5FOPENERROR); - if ((fid2 = h5tools_fopen(fname2, H5F_ACC_RDONLY, fname2_fapl, TRUE, NULL, 0)) < 0) + if ((fid2 = h5tools_fopen(fname2, H5F_ACC_RDONLY, fname2_fapl, + (fname2_fapl == H5P_DEFAULT) ? FALSE : TRUE, NULL, 0)) < 0) H5TOOLS_GOTO_ERROR((-1), "h5tools_fopen failed <%s>: %s", fname2, H5FOPENERROR); /*------------------------------------------------------------------------- diff --git a/tools/src/misc/h5debug.c b/tools/src/misc/h5debug.c index 2426a11..8962a76 100644 --- a/tools/src/misc/h5debug.c +++ b/tools/src/misc/h5debug.c @@ -246,8 +246,8 @@ main(int argc, char *argv[]) haddr_t extra[10]; uint8_t sig[H5F_SIGNATURE_LEN]; size_t u; - H5E_auto2_t func; - void * edata; + H5E_auto2_t func = NULL; + void * edata = NULL; hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */ herr_t status = SUCCEED; int exit_value = 0; diff --git a/tools/src/misc/h5repart.c b/tools/src/misc/h5repart.c index 77b40a1..a75f6d8 100644 --- a/tools/src/misc/h5repart.c +++ b/tools/src/misc/h5repart.c @@ -97,7 +97,7 @@ static off_t get_size(const char *progname, int *argno, int argc, char *argv[]) { off_t retval = -1; - char *suffix; + char *suffix = NULL; if (isdigit((int)(argv[*argno][2]))) { retval = HDstrtol(argv[*argno] + 2, &suffix, 10); diff --git a/tools/test/h5diff/testfiles/h5diff_10.txt b/tools/test/h5diff/testfiles/h5diff_10.txt index b5ff01a..3631db7 100644 --- a/tools/test/h5diff/testfiles/h5diff_10.txt +++ b/tools/test/h5diff/testfiles/h5diff_10.txt @@ -143,6 +143,18 @@ usage: h5diff [OPTIONS] file1 file2 [obj1[ obj2]] (The option --follow-symlinks overrides the default behavior when symbolic links are compared.). + Subsetting options: + Subsetting is available by using the fcompact form of subsetting, as follows: + obj1 /foo/mydataset[START;STRIDE;COUNT;BLOCK] + It is not required to use all parameters, but until the last parameter value used, + all of the semicolons (;) are required, even when a parameter value is not specified. Example: + obj1 /foo/mydataset[START;;COUNT;BLOCK] + obj1 /foo/mydataset[START] + The STRIDE, COUNT, and BLOCK parameters are optional and will default to 1 in + each dimension. START is optional and will default to 0 in each dimension. + Each of START, STRIDE, COUNT, and BLOCK must be a comma-separated list of integers with + one integer for each dimension of the dataset. + Exit code: 0 if no differences, 1 if differences found, 2 if error diff --git a/tools/test/h5diff/testfiles/h5diff_600.txt b/tools/test/h5diff/testfiles/h5diff_600.txt index f52d8cc..8a4ce6d 100644 --- a/tools/test/h5diff/testfiles/h5diff_600.txt +++ b/tools/test/h5diff/testfiles/h5diff_600.txt @@ -143,6 +143,18 @@ usage: h5diff [OPTIONS] file1 file2 [obj1[ obj2]] (The option --follow-symlinks overrides the default behavior when symbolic links are compared.). + Subsetting options: + Subsetting is available by using the fcompact form of subsetting, as follows: + obj1 /foo/mydataset[START;STRIDE;COUNT;BLOCK] + It is not required to use all parameters, but until the last parameter value used, + all of the semicolons (;) are required, even when a parameter value is not specified. Example: + obj1 /foo/mydataset[START;;COUNT;BLOCK] + obj1 /foo/mydataset[START] + The STRIDE, COUNT, and BLOCK parameters are optional and will default to 1 in + each dimension. START is optional and will default to 0 in each dimension. + Each of START, STRIDE, COUNT, and BLOCK must be a comma-separated list of integers with + one integer for each dimension of the dataset. + Exit code: 0 if no differences, 1 if differences found, 2 if error diff --git a/tools/test/h5diff/testfiles/h5diff_603.txt b/tools/test/h5diff/testfiles/h5diff_603.txt index 84111b3..d4c7336 100644 --- a/tools/test/h5diff/testfiles/h5diff_603.txt +++ b/tools/test/h5diff/testfiles/h5diff_603.txt @@ -144,6 +144,18 @@ usage: h5diff [OPTIONS] file1 file2 [obj1[ obj2]] (The option --follow-symlinks overrides the default behavior when symbolic links are compared.). + Subsetting options: + Subsetting is available by using the fcompact form of subsetting, as follows: + obj1 /foo/mydataset[START;STRIDE;COUNT;BLOCK] + It is not required to use all parameters, but until the last parameter value used, + all of the semicolons (;) are required, even when a parameter value is not specified. Example: + obj1 /foo/mydataset[START;;COUNT;BLOCK] + obj1 /foo/mydataset[START] + The STRIDE, COUNT, and BLOCK parameters are optional and will default to 1 in + each dimension. START is optional and will default to 0 in each dimension. + Each of START, STRIDE, COUNT, and BLOCK must be a comma-separated list of integers with + one integer for each dimension of the dataset. + Exit code: 0 if no differences, 1 if differences found, 2 if error diff --git a/tools/test/h5diff/testfiles/h5diff_606.txt b/tools/test/h5diff/testfiles/h5diff_606.txt index d915d36..3123587 100644 --- a/tools/test/h5diff/testfiles/h5diff_606.txt +++ b/tools/test/h5diff/testfiles/h5diff_606.txt @@ -144,6 +144,18 @@ usage: h5diff [OPTIONS] file1 file2 [obj1[ obj2]] (The option --follow-symlinks overrides the default behavior when symbolic links are compared.). + Subsetting options: + Subsetting is available by using the fcompact form of subsetting, as follows: + obj1 /foo/mydataset[START;STRIDE;COUNT;BLOCK] + It is not required to use all parameters, but until the last parameter value used, + all of the semicolons (;) are required, even when a parameter value is not specified. Example: + obj1 /foo/mydataset[START;;COUNT;BLOCK] + obj1 /foo/mydataset[START] + The STRIDE, COUNT, and BLOCK parameters are optional and will default to 1 in + each dimension. START is optional and will default to 0 in each dimension. + Each of START, STRIDE, COUNT, and BLOCK must be a comma-separated list of integers with + one integer for each dimension of the dataset. + Exit code: 0 if no differences, 1 if differences found, 2 if error diff --git a/tools/test/h5diff/testfiles/h5diff_612.txt b/tools/test/h5diff/testfiles/h5diff_612.txt index 1ef8cdf..ce2d887 100644 --- a/tools/test/h5diff/testfiles/h5diff_612.txt +++ b/tools/test/h5diff/testfiles/h5diff_612.txt @@ -144,6 +144,18 @@ usage: h5diff [OPTIONS] file1 file2 [obj1[ obj2]] (The option --follow-symlinks overrides the default behavior when symbolic links are compared.). + Subsetting options: + Subsetting is available by using the fcompact form of subsetting, as follows: + obj1 /foo/mydataset[START;STRIDE;COUNT;BLOCK] + It is not required to use all parameters, but until the last parameter value used, + all of the semicolons (;) are required, even when a parameter value is not specified. Example: + obj1 /foo/mydataset[START;;COUNT;BLOCK] + obj1 /foo/mydataset[START] + The STRIDE, COUNT, and BLOCK parameters are optional and will default to 1 in + each dimension. START is optional and will default to 0 in each dimension. + Each of START, STRIDE, COUNT, and BLOCK must be a comma-separated list of integers with + one integer for each dimension of the dataset. + Exit code: 0 if no differences, 1 if differences found, 2 if error diff --git a/tools/test/h5diff/testfiles/h5diff_615.txt b/tools/test/h5diff/testfiles/h5diff_615.txt index 881362e..61fd036 100644 --- a/tools/test/h5diff/testfiles/h5diff_615.txt +++ b/tools/test/h5diff/testfiles/h5diff_615.txt @@ -144,6 +144,18 @@ usage: h5diff [OPTIONS] file1 file2 [obj1[ obj2]] (The option --follow-symlinks overrides the default behavior when symbolic links are compared.). + Subsetting options: + Subsetting is available by using the fcompact form of subsetting, as follows: + obj1 /foo/mydataset[START;STRIDE;COUNT;BLOCK] + It is not required to use all parameters, but until the last parameter value used, + all of the semicolons (;) are required, even when a parameter value is not specified. Example: + obj1 /foo/mydataset[START;;COUNT;BLOCK] + obj1 /foo/mydataset[START] + The STRIDE, COUNT, and BLOCK parameters are optional and will default to 1 in + each dimension. START is optional and will default to 0 in each dimension. + Each of START, STRIDE, COUNT, and BLOCK must be a comma-separated list of integers with + one integer for each dimension of the dataset. + Exit code: 0 if no differences, 1 if differences found, 2 if error diff --git a/tools/test/h5diff/testfiles/h5diff_621.txt b/tools/test/h5diff/testfiles/h5diff_621.txt index ba39a99..dc8655d 100644 --- a/tools/test/h5diff/testfiles/h5diff_621.txt +++ b/tools/test/h5diff/testfiles/h5diff_621.txt @@ -144,6 +144,18 @@ usage: h5diff [OPTIONS] file1 file2 [obj1[ obj2]] (The option --follow-symlinks overrides the default behavior when symbolic links are compared.). + Subsetting options: + Subsetting is available by using the fcompact form of subsetting, as follows: + obj1 /foo/mydataset[START;STRIDE;COUNT;BLOCK] + It is not required to use all parameters, but until the last parameter value used, + all of the semicolons (;) are required, even when a parameter value is not specified. Example: + obj1 /foo/mydataset[START;;COUNT;BLOCK] + obj1 /foo/mydataset[START] + The STRIDE, COUNT, and BLOCK parameters are optional and will default to 1 in + each dimension. START is optional and will default to 0 in each dimension. + Each of START, STRIDE, COUNT, and BLOCK must be a comma-separated list of integers with + one integer for each dimension of the dataset. + Exit code: 0 if no differences, 1 if differences found, 2 if error diff --git a/tools/test/h5diff/testfiles/h5diff_622.txt b/tools/test/h5diff/testfiles/h5diff_622.txt index 70421fc..f20ffbe 100644 --- a/tools/test/h5diff/testfiles/h5diff_622.txt +++ b/tools/test/h5diff/testfiles/h5diff_622.txt @@ -144,6 +144,18 @@ usage: h5diff [OPTIONS] file1 file2 [obj1[ obj2]] (The option --follow-symlinks overrides the default behavior when symbolic links are compared.). + Subsetting options: + Subsetting is available by using the fcompact form of subsetting, as follows: + obj1 /foo/mydataset[START;STRIDE;COUNT;BLOCK] + It is not required to use all parameters, but until the last parameter value used, + all of the semicolons (;) are required, even when a parameter value is not specified. Example: + obj1 /foo/mydataset[START;;COUNT;BLOCK] + obj1 /foo/mydataset[START] + The STRIDE, COUNT, and BLOCK parameters are optional and will default to 1 in + each dimension. START is optional and will default to 0 in each dimension. + Each of START, STRIDE, COUNT, and BLOCK must be a comma-separated list of integers with + one integer for each dimension of the dataset. + Exit code: 0 if no differences, 1 if differences found, 2 if error diff --git a/tools/test/h5diff/testfiles/h5diff_623.txt b/tools/test/h5diff/testfiles/h5diff_623.txt index 0d74268..f73d202 100644 --- a/tools/test/h5diff/testfiles/h5diff_623.txt +++ b/tools/test/h5diff/testfiles/h5diff_623.txt @@ -144,6 +144,18 @@ usage: h5diff [OPTIONS] file1 file2 [obj1[ obj2]] (The option --follow-symlinks overrides the default behavior when symbolic links are compared.). + Subsetting options: + Subsetting is available by using the fcompact form of subsetting, as follows: + obj1 /foo/mydataset[START;STRIDE;COUNT;BLOCK] + It is not required to use all parameters, but until the last parameter value used, + all of the semicolons (;) are required, even when a parameter value is not specified. Example: + obj1 /foo/mydataset[START;;COUNT;BLOCK] + obj1 /foo/mydataset[START] + The STRIDE, COUNT, and BLOCK parameters are optional and will default to 1 in + each dimension. START is optional and will default to 0 in each dimension. + Each of START, STRIDE, COUNT, and BLOCK must be a comma-separated list of integers with + one integer for each dimension of the dataset. + Exit code: 0 if no differences, 1 if differences found, 2 if error diff --git a/tools/test/h5diff/testfiles/h5diff_624.txt b/tools/test/h5diff/testfiles/h5diff_624.txt index cb8b8b4..903b738 100644 --- a/tools/test/h5diff/testfiles/h5diff_624.txt +++ b/tools/test/h5diff/testfiles/h5diff_624.txt @@ -144,6 +144,18 @@ usage: h5diff [OPTIONS] file1 file2 [obj1[ obj2]] (The option --follow-symlinks overrides the default behavior when symbolic links are compared.). + Subsetting options: + Subsetting is available by using the fcompact form of subsetting, as follows: + obj1 /foo/mydataset[START;STRIDE;COUNT;BLOCK] + It is not required to use all parameters, but until the last parameter value used, + all of the semicolons (;) are required, even when a parameter value is not specified. Example: + obj1 /foo/mydataset[START;;COUNT;BLOCK] + obj1 /foo/mydataset[START] + The STRIDE, COUNT, and BLOCK parameters are optional and will default to 1 in + each dimension. START is optional and will default to 0 in each dimension. + Each of START, STRIDE, COUNT, and BLOCK must be a comma-separated list of integers with + one integer for each dimension of the dataset. + Exit code: 0 if no differences, 1 if differences found, 2 if error diff --git a/tools/test/h5dump/CMakeTests.cmake b/tools/test/h5dump/CMakeTests.cmake index 0d8563e..f54da76 100644 --- a/tools/test/h5dump/CMakeTests.cmake +++ b/tools/test/h5dump/CMakeTests.cmake @@ -127,7 +127,7 @@ ${HDF5_TOOLS_DIR}/testfiles/tintsattrs.ddl ${HDF5_TOOLS_DIR}/testfiles/tintsnodata.ddl ${HDF5_TOOLS_DIR}/testfiles/tlarge_objname.ddl - #${HDF5_TOOLS_DIR}/testfiles/tldouble.ddl + ${HDF5_TOOLS_DIR}/testfiles/tldouble.ddl ${HDF5_TOOLS_DIR}/testfiles/tlonglinks.ddl ${HDF5_TOOLS_DIR}/testfiles/tloop-1.ddl ${HDF5_TOOLS_DIR}/testfiles/tmulti.ddl @@ -293,7 +293,7 @@ ${HDF5_TOOLS_DIR}/testfiles/tintsattrs.h5 ${HDF5_TOOLS_DIR}/testfiles/tintsnodata.h5 ${HDF5_TOOLS_DIR}/testfiles/tlarge_objname.h5 - #${HDF5_TOOLS_DIR}/testfiles/tldouble.h5 + ${HDF5_TOOLS_DIR}/testfiles/tldouble.h5 ${HDF5_TOOLS_DIR}/testfiles/tlonglinks.h5 ${HDF5_TOOLS_DIR}/testfiles/tloop.h5 ${HDF5_TOOLS_DIR}/testfiles/tmulti-b.h5 @@ -1085,7 +1085,7 @@ ADD_H5_TEST (zerodim 0 --enable-error-stack zerodim.h5) # test for long double (some systems do not have long double) - #ADD_H5_TEST (tldouble 0 --enable-error-stack tldouble.h5) +# ADD_H5_TEST (tldouble 0 --enable-error-stack tldouble.h5) # test for vms ADD_H5_TEST (tvms 0 --enable-error-stack tvms.h5) @@ -1170,7 +1170,7 @@ ADD_H5_TEST (err_attr_dspace 1 err_attr_dspace.h5) # test to verify HDFFV-9407: long double full precision - ADD_H5_GREP_TEST (t128bit_float 1 "1.123456789012345" -m %.35Lf t128bit_float.h5) +# ADD_H5_GREP_TEST (t128bit_float 1 "1.123456789012345" -m %.35Lg t128bit_float.h5) ############################################################################## ### P L U G I N T E S T S diff --git a/tools/test/h5dump/h5dumpgentest.c b/tools/test/h5dump/h5dumpgentest.c index 2746f70..fed3a56 100644 --- a/tools/test/h5dump/h5dumpgentest.c +++ b/tools/test/h5dump/h5dumpgentest.c @@ -115,6 +115,7 @@ #define FILE85 "tgrpnullspace.h5" #define FILE86 "err_attr_dspace.h5" #define FILE87 "tintsnodata.h5" +#define FILE88 "tldouble_scalar.h5" /*------------------------------------------------------------------------- * prototypes @@ -6333,6 +6334,57 @@ error: } /*------------------------------------------------------------------------- + * Function: gent_ldouble_scalar + * + * Purpose: make file with a long double scalar dataset + * + *------------------------------------------------------------------------- + */ +static int +gent_ldouble_scalar(void) +{ + hid_t fid; + hid_t did; + hid_t tid; + hid_t sid; + hsize_t dims[1] = {6}; + long double buf[6] = {0.0, 1.0, 2.0, 3.0, 4.0, 5.0}; + + if ((fid = H5Fcreate(FILE88, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0) + goto error; + + if ((sid = H5Screate(H5S_SCALAR)) < 0) + goto error; + + if ((tid = H5Tarray_create(H5T_NATIVE_LDOUBLE, 1, dims)) < 0) + goto error; + + if (H5Tget_size(tid) == 0) + goto error; + + if ((did = H5Dcreate2(fid, "dset", tid, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) + goto error; + + if (H5Dwrite(did, tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0) + goto error; + + if (H5Sclose(sid) < 0) + goto error; + if (H5Tclose(tid) < 0) + goto error; + if (H5Dclose(did) < 0) + goto error; + if (H5Fclose(fid) < 0) + goto error; + + return 0; + +error: + HDprintf("error !\n"); + return -1; +} + +/*------------------------------------------------------------------------- * Function: gent_binary * * Purpose: Generate a file to be used in the binary output test diff --git a/tools/test/h5dump/testh5dump.sh.in b/tools/test/h5dump/testh5dump.sh.in index 2c4f2da..8f478b0 100644 --- a/tools/test/h5dump/testh5dump.sh.in +++ b/tools/test/h5dump/testh5dump.sh.in @@ -142,7 +142,7 @@ $SRC_H5DUMP_TESTFILES/thyperslab.h5 $SRC_H5DUMP_TESTFILES/tintsattrs.h5 $SRC_H5DUMP_TESTFILES/tints4dims.h5 $SRC_H5DUMP_TESTFILES/tlarge_objname.h5 -#$SRC_H5DUMP_TESTFILES/tldouble.h5 +$SRC_H5DUMP_TESTFILES/tldouble.h5 $SRC_H5DUMP_TESTFILES/tlonglinks.h5 $SRC_H5DUMP_TESTFILES/tloop.h5 $SRC_H5DUMP_TESTFILES/tmulti-b.h5 @@ -287,7 +287,7 @@ $SRC_H5DUMP_TESTFILES/tints4dimsCountEq.ddl $SRC_H5DUMP_TESTFILES/tints4dimsStride2.ddl $SRC_H5DUMP_TESTFILES/tintsattrs.ddl $SRC_H5DUMP_TESTFILES/tlarge_objname.ddl -#$SRC_H5DUMP_TESTFILES/tldouble.ddl +$SRC_H5DUMP_TESTFILES/tldouble.ddl $SRC_H5DUMP_TESTFILES/tlonglinks.ddl $SRC_H5DUMP_TESTFILES/tloop-1.ddl $SRC_H5DUMP_TESTFILES/tmulti.ddl @@ -1443,7 +1443,7 @@ TOOLTEST3 non_existing.ddl --enable-error-stack tgroup.h5 non_existing.h5 TOOLTEST err_attr_dspace.ddl err_attr_dspace.h5 # test to verify HDFFV-9407: long double full precision -GREPTEST OUTTXT "1.123456789012345" t128bit_float.ddl -m %.35Lf t128bit_float.h5 +#GREPTEST OUTTXT "1.123456789012345" t128bit_float.ddl -m %.35Lf t128bit_float.h5 # Clean up temporary files/directories CLEAN_TESTFILES_AND_TESTDIR diff --git a/tools/testfiles/tldouble.ddl b/tools/testfiles/tldouble.ddl new file mode 100644 index 0000000..c032ef3 --- /dev/null +++ b/tools/testfiles/tldouble.ddl @@ -0,0 +1,11 @@ +HDF5 "tldouble.h5" { +GROUP "/" { + DATASET "dset" { + DATATYPE H5T_NATIVE_LDOUBLE + DATASPACE SIMPLE { ( 3 ) / ( 3 ) } + DATA { + (0): 1, 2, 3 + } + } +} +} -- cgit v0.12