summaryrefslogtreecommitdiffstats
path: root/fortran
diff options
context:
space:
mode:
authorScot Breitenfeld <brtnfld@hdfgroup.org>2008-05-14 18:50:15 (GMT)
committerScot Breitenfeld <brtnfld@hdfgroup.org>2008-05-14 18:50:15 (GMT)
commita30c706f7952c68a5bc0da3482a259f96c4c4a02 (patch)
tree7e2c1dd2f10a8ab006ee27516556734a6680c7ed /fortran
parent86790dab743b1ed55f106001185c70e1e77f40be (diff)
downloadhdf5-a30c706f7952c68a5bc0da3482a259f96c4c4a02.zip
hdf5-a30c706f7952c68a5bc0da3482a259f96c4c4a02.tar.gz
hdf5-a30c706f7952c68a5bc0da3482a259f96c4c4a02.tar.bz2
[svn-r14995] Purpose:
Changed the interface for the get_name_by_idx_f routine Description: Changed the 'size' which is the correct size of the returned buffer to be an optional parameter.
Diffstat (limited to 'fortran')
-rw-r--r--fortran/src/H5Aff.f9023
-rw-r--r--fortran/src/H5Lff.f9020
2 files changed, 27 insertions, 16 deletions
diff --git a/fortran/src/H5Aff.f90 b/fortran/src/H5Aff.f90
index cad5231..9834914 100644
--- a/fortran/src/H5Aff.f90
+++ b/fortran/src/H5Aff.f90
@@ -2785,7 +2785,7 @@ CONTAINS
! H5_INDEX_UNKNOWN_F = -1 - Unknown index type
! H5_INDEX_NAME_F - Index on names
! H5_INDEX_CRT_ORDER_F - Index on creation order
-! H5_INDEX_N _F - Number of indices defined
+! H5_INDEX_N_F - Number of indices defined
!
! order - Order in which to iterate over index; Possible values are:
!
@@ -2797,16 +2797,15 @@ CONTAINS
!
! order - Index traversal order
! n - Attribute’s position in index
-! size - Size, in bytes, of attribute name
!
! Outputs:
! name - Attribute name
-! name_size_out - Size of Attribute name returned from function
! hdferr: - error code
! Success: 0
! Failure: -1
! Optional parameters:
! lapl_id - Link access property list
+! size - Size, in bytes, of attribute name
!
! Programmer: M.S. Breitenfeld
! January, 2008
@@ -2815,7 +2814,7 @@ CONTAINS
!----------------------------------------------------------------------
SUBROUTINE h5aget_name_by_idx_f(loc_id, obj_name, idx_type, order, &
- n, name, size, hdferr, lapl_id)
+ n, name, hdferr, size, lapl_id)
!This definition is needed for Windows DLLs
!DEC$if defined(BUILD_HDF5_DLL)
!DEC$attributes dllexport :: h5aget_name_by_idx_f
@@ -2839,9 +2838,8 @@ CONTAINS
INTEGER(HSIZE_T), INTENT(IN) :: n ! Attribute’s position in index
- CHARACTER(LEN=*), INTENT(OUT) :: name ! Attribute name
+ CHARACTER(LEN=*), INTENT(OUT) :: name ! Attribute name
- INTEGER(SIZE_T), INTENT(INOUT) :: size ! Buffer size ! *TEST* check for 0 value *CHECK* should this return the correct value
INTEGER, INTENT(OUT) :: hdferr ! Error code:
! Returns attribute name size,
@@ -2849,12 +2847,14 @@ CONTAINS
INTEGER(SIZE_T) :: obj_namelen
INTEGER(HID_T), OPTIONAL, INTENT(IN) :: lapl_id ! Link access property list
INTEGER(HID_T) :: lapl_id_default
+ INTEGER(SIZE_T), OPTIONAL, INTENT(OUT) :: size ! Indicates the size, in the number of characters, of the attribute
+ INTEGER(SIZE_T) :: size_default
!
! MS FORTRAN needs explicit interface for C functions called here.
!
INTERFACE
INTEGER FUNCTION h5aget_name_by_idx_c(loc_id, obj_name, obj_namelen, idx_type, order, &
- n, name, size, lapl_id_default)
+ n, name, size_default, lapl_id_default)
USE H5GLOBAL
!DEC$ IF DEFINED(HDF5F90_WINDOWS)
!DEC$ ATTRIBUTES C,reference,decorate,alias:'H5AGET_NAME_BY_IDX_C'::h5aget_name_by_idx_c
@@ -2867,7 +2867,7 @@ CONTAINS
INTEGER(HSIZE_T), INTENT(IN) :: n
CHARACTER(LEN=*), INTENT(OUT) :: name
- INTEGER(SIZE_T), INTENT(INOUT) :: size
+ INTEGER(SIZE_T) :: size_default
INTEGER(HID_T) :: lapl_id_default
INTEGER(SIZE_T) :: obj_namelen
END FUNCTION h5aget_name_by_idx_c
@@ -2877,8 +2877,13 @@ CONTAINS
lapl_id_default = H5P_DEFAULT_F
IF(PRESENT(lapl_id)) lapl_id_default = lapl_id
+ size_default = LEN(name)
+
hdferr = h5aget_name_by_idx_c(loc_id, obj_name, obj_namelen, idx_type, order, &
- n, name, size, lapl_id_default)
+ n, name, size_default, lapl_id_default)
+
+ IF(PRESENT(size)) size = size_default
+
END SUBROUTINE h5aget_name_by_idx_f
diff --git a/fortran/src/H5Lff.f90 b/fortran/src/H5Lff.f90
index 98d7729..a343c31 100644
--- a/fortran/src/H5Lff.f90
+++ b/fortran/src/H5Lff.f90
@@ -950,13 +950,13 @@ CONTAINS
!
! Outputs:
! name - Buffer in which link value is returned
-! size - Maximum number of characters of link value to be returned.
! hdferr - error code
! Success: 0
! Failure: -1
!
! Optional parameters:
! lapl_id - List access property list identifier.
+! size - Maximum number of characters of link value to be returned.
!
! Programmer: M. S. Breitenfeld
! March 10, 2008
@@ -965,7 +965,7 @@ CONTAINS
!
!----------------------------------------------------------------------
SUBROUTINE h5lget_name_by_idx_f(loc_id, group_name, index_field, order, n, &
- size, name, hdferr, lapl_id)
+ name, hdferr, size, lapl_id)
!This definition is needed for Windows DLLs
!DEC$if defined(BUILD_HDF5_DLL)
!DEC$attributes dllexport :: h5lget_name_by_idx_f
@@ -984,8 +984,6 @@ CONTAINS
! H5_ITER_DEC_F - Decreasing order
! H5_ITER_NATIVE_F - No particular order, whatever is fastest
INTEGER(HSIZE_T), INTENT(IN) :: n ! Attribute’s position in index
- INTEGER(SIZE_T), INTENT(INOUT) :: size ! Indicates the size, in the number of characters, of the attribute
- ! returns correct size
CHARACTER(LEN=*), INTENT(OUT) :: name ! Buffer in which link value is returned
INTEGER, INTENT(OUT) :: hdferr ! Error code:
! 0 on success and -1 on failure
@@ -993,12 +991,15 @@ CONTAINS
INTEGER(SIZE_T) :: group_namelen
INTEGER(HID_T), OPTIONAL, INTENT(IN) :: lapl_id ! Link access property list
INTEGER(HID_T) :: lapl_id_default
+ INTEGER(SIZE_T), OPTIONAL, INTENT(OUT) :: size ! Indicates the size, in the number of characters, of the link
+ INTEGER(SIZE_T) :: size_default
+
! MS FORTRAN needs explicit interface for C functions called here.
!
INTERFACE
INTEGER FUNCTION h5lget_name_by_idx_c(loc_id, group_name, group_namelen, index_field, order, n, &
- size, name, lapl_id_default)
+ size_default, name, lapl_id_default)
USE H5GLOBAL
!DEC$ IF DEFINED(HDF5F90_WINDOWS)
!DEC$ ATTRIBUTES C,reference,decorate,alias:'H5LGET_NAME_BY_IDX_C'::h5lget_name_by_idx_c
@@ -1009,7 +1010,7 @@ CONTAINS
INTEGER, INTENT(IN) :: index_field
INTEGER, INTENT(IN) :: order
INTEGER(HSIZE_T), INTENT(IN) :: n
- INTEGER(SIZE_T), INTENT(INOUT) :: size
+ INTEGER(SIZE_T) :: size_default
CHARACTER(LEN=*), INTENT(OUT) :: name
INTEGER(HID_T) :: lapl_id_default
END FUNCTION h5lget_name_by_idx_c
@@ -1020,8 +1021,13 @@ CONTAINS
lapl_id_default = H5P_DEFAULT_F
IF(PRESENT(lapl_id)) lapl_id_default = lapl_id
+ size_default = LEN(name)
+
hdferr = h5lget_name_by_idx_c(loc_id, group_name, group_namelen, index_field, order, n, &
- size, name, lapl_id_default)
+ size_default, name, lapl_id_default)
+
+ IF(PRESENT(size)) size = size_default
+
END SUBROUTINE h5lget_name_by_idx_f