From 3b8a8b0982c555e5c1a7c7fa377421718a280a90 Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Fri, 1 Sep 2023 08:26:48 -0500 Subject: [PATCH] Fix region reference examples --- C/H5T/h5ex_t_regrefatt.c | 2 -- JAVA/H5T/H5Ex_T_RegionReferenceAttribute.java | 8 +++----- .../H5T/testfiles/112/H5Ex_T_RegionReferenceAttribute.tst | 4 ++++ .../H5T/testfiles/114/H5Ex_T_RegionReferenceAttribute.txt | 4 ++++ 4 files changed, 11 insertions(+), 7 deletions(-) create mode 100644 JAVA/H5T/testfiles/112/H5Ex_T_RegionReferenceAttribute.tst create mode 100644 JAVA/H5T/testfiles/114/H5Ex_T_RegionReferenceAttribute.txt diff --git a/C/H5T/h5ex_t_regrefatt.c b/C/H5T/h5ex_t_regrefatt.c index 23d8fc75..7599adb9 100644 --- a/C/H5T/h5ex_t_regrefatt.c +++ b/C/H5T/h5ex_t_regrefatt.c @@ -152,11 +152,9 @@ main(void) if (file < 0) goto done; -#if H5_VERSION_LE(1, 11, 0) dset = H5Dopen(file, DATASET, H5P_DEFAULT); if (dset < 0) goto done; -#endif attr = H5Aopen(dset, ATTRIBUTE, H5P_DEFAULT); if (attr < 0) diff --git a/JAVA/H5T/H5Ex_T_RegionReferenceAttribute.java b/JAVA/H5T/H5Ex_T_RegionReferenceAttribute.java index 0331a1f7..f09f15f2 100644 --- a/JAVA/H5T/H5Ex_T_RegionReferenceAttribute.java +++ b/JAVA/H5T/H5Ex_T_RegionReferenceAttribute.java @@ -126,7 +126,7 @@ private static void writeRegRef() try { dataspace_id = H5.H5Screate(HDF5Constants.H5S_NULL); dataset_id = - H5.H5Dcreate(file_id, DATASETNAME, HDF5Constants.H5T_STD_I32LE, space, + H5.H5Dcreate(file_id, DATASETNAME, HDF5Constants.H5T_STD_I32LE, dataspace_id, HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT); } catch (Exception e) { @@ -144,8 +144,7 @@ private static void writeRegRef() dataspace_id = H5.H5Screate_simple(1, dims, null); if ((file_id >= 0) && (attribute_id >= 0)) { attribute_id = H5.H5Acreate(file_id, ATTRIBUTENAME, HDF5Constants.H5T_STD_REF, dataspace_id, - HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT, - HDF5Constants.H5P_DEFAULT); + HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT); H5.H5Awrite(attribute_id, HDF5Constants.H5T_STD_REF, dset_data); } } @@ -233,8 +232,7 @@ private static void readRegRef() H5.H5Sget_simple_extent_dims(attribute_id, dims, null); // Read data. - H5.H5Aread(attribute_id, HDF5Constants.H5T_STD_REF, HDF5Constants.H5S_ALL, - HDF5Constants.H5S_ALL, HDF5Constants.H5P_DEFAULT, dset_data); + H5.H5Aread(attribute_id, HDF5Constants.H5T_STD_REF, dset_data); // Output the data to the screen. for (int indx = 0; indx < dims[0]; indx++) { diff --git a/JAVA/H5T/testfiles/112/H5Ex_T_RegionReferenceAttribute.tst b/JAVA/H5T/testfiles/112/H5Ex_T_RegionReferenceAttribute.tst new file mode 100644 index 00000000..d50fc760 --- /dev/null +++ b/JAVA/H5T/testfiles/112/H5Ex_T_RegionReferenceAttribute.tst @@ -0,0 +1,4 @@ +A1[0]: + -> /DS2: hdf5 +A1[1]: + -> /DS2: Therowthedog diff --git a/JAVA/H5T/testfiles/114/H5Ex_T_RegionReferenceAttribute.txt b/JAVA/H5T/testfiles/114/H5Ex_T_RegionReferenceAttribute.txt new file mode 100644 index 00000000..d50fc760 --- /dev/null +++ b/JAVA/H5T/testfiles/114/H5Ex_T_RegionReferenceAttribute.txt @@ -0,0 +1,4 @@ +A1[0]: + -> /DS2: hdf5 +A1[1]: + -> /DS2: Therowthedog