Skip to content

Commit

Permalink
Fix region reference examples
Browse files Browse the repository at this point in the history
  • Loading branch information
byrnHDF committed Sep 1, 2023
1 parent a96d9bc commit 3b8a8b0
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 7 deletions.
2 changes: 0 additions & 2 deletions C/H5T/h5ex_t_regrefatt.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
8 changes: 3 additions & 5 deletions JAVA/H5T/H5Ex_T_RegionReferenceAttribute.java
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand All @@ -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);
}
}
Expand Down Expand Up @@ -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++) {
Expand Down
4 changes: 4 additions & 0 deletions JAVA/H5T/testfiles/112/H5Ex_T_RegionReferenceAttribute.tst
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
A1[0]:
-> /DS2: hdf5
A1[1]:
-> /DS2: Therowthedog
4 changes: 4 additions & 0 deletions JAVA/H5T/testfiles/114/H5Ex_T_RegionReferenceAttribute.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
A1[0]:
-> /DS2: hdf5
A1[1]:
-> /DS2: Therowthedog

0 comments on commit 3b8a8b0

Please sign in to comment.