diff options
author | Scot Breitenfeld <brtnfld@hdfgroup.org> | 2022-04-19 18:05:54 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-04-19 18:05:54 (GMT) |
commit | 32ef796e470da3e4de364d8dc469b03f5f6fafdc (patch) | |
tree | 12c32550a87790eaa310d2c7525728ca354b910c /fortran/src | |
parent | 14da68ebffbb5750a86a180863e7c18ae5c8d461 (diff) | |
download | hdf5-32ef796e470da3e4de364d8dc469b03f5f6fafdc.zip hdf5-32ef796e470da3e4de364d8dc469b03f5f6fafdc.tar.gz hdf5-32ef796e470da3e4de364d8dc469b03f5f6fafdc.tar.bz2 |
HDFFV-11306 Fixed (#1657)
* HDFFV-11306,
* Fixed it so both h5open_f and h5close_f can be called multiple times.
* Fixed an issue with open objects remaining after h5close_f was called.
* Added additional tests.
* comments clean-up
Diffstat (limited to 'fortran/src')
-rw-r--r-- | fortran/src/H5_f.c | 12 | ||||
-rw-r--r-- | fortran/src/H5_ff.F90 | 11 |
2 files changed, 17 insertions, 6 deletions
diff --git a/fortran/src/H5_f.c b/fortran/src/H5_f.c index 0277e5c..468debe 100644 --- a/fortran/src/H5_f.c +++ b/fortran/src/H5_f.c @@ -65,12 +65,6 @@ h5init_types_c(hid_t_f *types, hid_t_f *floatingtypes, hid_t_f *integertypes) * Find the HDF5 type of the Fortran Integer KIND. */ - /* Initialized INTEGER KIND types to default to native integer */ - for (i = 0; i < 5; i++) { - if ((types[i] = (hid_t_f)H5Tcopy(H5T_NATIVE_INT)) < 0) - return ret_value; - } - for (i = 0; i < H5_FORTRAN_NUM_INTEGER_KINDS; i++) { if (IntKinds_SizeOf[i] == sizeof(char)) { if ((types[i] = (hid_t_f)H5Tcopy(H5T_NATIVE_CHAR)) < 0) @@ -96,6 +90,12 @@ h5init_types_c(hid_t_f *types, hid_t_f *floatingtypes, hid_t_f *integertypes) } /*end else */ } + /* Initialized missing INTEGER KIND types to default to native integer */ + for (i = H5_FORTRAN_NUM_INTEGER_KINDS; i < 5; i++) { + if ((types[i] = (hid_t_f)H5Tcopy(H5T_NATIVE_INT)) < 0) + return ret_value; + } + if (sizeof(int_f) == sizeof(int)) { if ((types[5] = (hid_t_f)H5Tcopy(H5T_NATIVE_INT)) < 0) return ret_value; diff --git a/fortran/src/H5_ff.F90 b/fortran/src/H5_ff.F90 index 350d978..0aa4b04 100644 --- a/fortran/src/H5_ff.F90 +++ b/fortran/src/H5_ff.F90 @@ -250,6 +250,9 @@ CONTAINS END INTERFACE + ! Check if H5open_f has already been called. If so, skip doing it again. + IF(H5OPEN_NUM_OBJ .NE. 0) RETURN + error = h5init_types_c(predef_types, floating_types, integer_types) H5T_NATIVE_INTEGER_KIND(1:5) = predef_types(1:5) @@ -668,6 +671,7 @@ CONTAINS ! October 13, 2011 ! Fortran90 Interface: SUBROUTINE h5close_f(error) + USE H5F, ONLY : h5fget_obj_count_f, H5OPEN_NUM_OBJ IMPLICIT NONE INTEGER, INTENT(OUT) :: error !***** @@ -685,10 +689,17 @@ CONTAINS INTEGER(HID_T), DIMENSION(1:I_TYPES_LEN) :: i_types END FUNCTION h5close_types_c END INTERFACE + + ! Check if h5close_f has already been called. Skip doing it again. + IF(H5OPEN_NUM_OBJ .EQ. 0) RETURN + error = h5close_types_c(predef_types, PREDEF_TYPES_LEN, & floating_types, FLOATING_TYPES_LEN, & integer_types, INTEGER_TYPES_LEN ) + ! Reset the number of open objects from h5open_f to zero + CALL h5fget_obj_count_f(INT(H5F_OBJ_ALL_F,HID_T), H5F_OBJ_ALL_F, H5OPEN_NUM_OBJ, error) + END SUBROUTINE h5close_f !****s* H5LIB/h5get_libversion_f |