diff options
Diffstat (limited to 'fortran/src')
-rw-r--r-- | fortran/src/H5Ff.c | 54 | ||||
-rw-r--r-- | fortran/src/H5Fff.f90 | 30 | ||||
-rw-r--r-- | fortran/src/H5f90proto.h | 4 |
3 files changed, 58 insertions, 30 deletions
diff --git a/fortran/src/H5Ff.c b/fortran/src/H5Ff.c index cdbb695..6b76ba0 100644 --- a/fortran/src/H5Ff.c +++ b/fortran/src/H5Ff.c @@ -37,7 +37,7 @@ nh5fcreate_c(_fcd name, int_f *namelen, int_f *access_flags, hid_t_f* crt_prp, h { int ret_value = -1; char *c_name; - int c_namelen; + int_f c_namelen; hid_t c_file_id; unsigned c_access_flags; hid_t c_crt_prp; @@ -66,7 +66,7 @@ nh5fcreate_c(_fcd name, int_f *namelen, int_f *access_flags, hid_t_f* crt_prp, h * Convert FORTRAN name to C name */ c_namelen = *namelen; - c_name = (char *)HD5f2cstring(name, c_namelen); + c_name = (char *)HD5f2cstring(name, (size_t)c_namelen); if (c_name == NULL) return ret_value; /* @@ -184,7 +184,7 @@ nh5funmount_c (hid_t_f *loc_id, _fcd dsetname, int_f *namelen) { int ret_value = -1; char *c_name; - int c_namelen; + int_f c_namelen; hid_t c_loc_id; htri_t status; @@ -194,7 +194,7 @@ nh5funmount_c (hid_t_f *loc_id, _fcd dsetname, int_f *namelen) * Convert FORTRAN name to C name */ c_namelen = *namelen; - c_name = (char *)HD5f2cstring(dsetname, c_namelen); + c_name = (char *)HD5f2cstring(dsetname, (size_t)c_namelen); if (c_name == NULL) return ret_value; /* @@ -228,7 +228,7 @@ nh5fopen_c (_fcd name, int_f *namelen, int_f *access_flags, hid_t_f *acc_prp, hi { int ret_value = -1; char *c_name; - int c_namelen; + int_f c_namelen; hid_t c_file_id; unsigned c_access_flags; hid_t c_acc_prp; @@ -250,7 +250,7 @@ nh5fopen_c (_fcd name, int_f *namelen, int_f *access_flags, hid_t_f *acc_prp, hi * Convert FORTRAN name to C name */ c_namelen = *namelen; - c_name = (char *)HD5f2cstring(name, c_namelen); + c_name = (char *)HD5f2cstring(name, (size_t)c_namelen); if (c_name == NULL) return ret_value; /* @@ -361,14 +361,14 @@ nh5fis_hdf5_c (_fcd name, int_f *namelen, int_f *flag) { int ret_value = -1; char *c_name; - int c_namelen; + int_f c_namelen; htri_t status; /* * Convert FORTRAN name to C name */ c_namelen = *namelen; - c_name = (char *)HD5f2cstring(name, c_namelen); + c_name = (char *)HD5f2cstring(name, (size_t)c_namelen); if (c_name == NULL) return ret_value; /* @@ -397,7 +397,7 @@ nh5fclose_c ( hid_t_f *file_id ) int ret_value = 0; hid_t c_file_id; - c_file_id = *file_id; + c_file_id = (hid_t*)*file_id; if ( H5Fclose(c_file_id) < 0 ) ret_value = -1; return ret_value; } @@ -411,21 +411,23 @@ nh5fclose_c ( hid_t_f *file_id ) * Programmer: Elena Pourmal * Monday, September 30, 2002 * Modifications: + * Changed type of obj_count to size_t_f + * Thursday, September 25, 2008 *---------------------------------------------------------------------------*/ int_f -nh5fget_obj_count_c ( hid_t_f *file_id , int_f *obj_type, int_f * obj_count) +nh5fget_obj_count_c ( hid_t_f *file_id , int_f *obj_type, size_t_f * obj_count) { int ret_value = 0; hid_t c_file_id; unsigned c_obj_type; - int c_obj_count; + ssize_t c_obj_count; c_file_id = (hid_t)*file_id; c_obj_type = (unsigned) *obj_type; if ( (c_obj_count=H5Fget_obj_count(c_file_id, c_obj_type)) < 0 ) ret_value = -1; - *obj_count = (int_f)c_obj_count; + *obj_count = (size_t_f)c_obj_count; return ret_value; } /*---------------------------------------------------------------------------- @@ -438,20 +440,34 @@ nh5fget_obj_count_c ( hid_t_f *file_id , int_f *obj_type, int_f * obj_count) * Programmer: Elena Pourmal * Monday, September 30, 2002 * Modifications: + * Changed type of max_obj to size_t_f; added parameter for the + * number of open objects + * Thursday, September 25, 2008 EIP *---------------------------------------------------------------------------*/ - int_f -nh5fget_obj_ids_c ( hid_t_f *file_id , int_f *obj_type, int_f *max_objs, hid_t_f *obj_ids) +nh5fget_obj_ids_c ( hid_t_f *file_id , int_f *obj_type, size_t_f *max_objs, hid_t_f *obj_ids, +size_t_f *num_objs) { int ret_value = 0; hid_t c_file_id; unsigned c_obj_type; - int c_max_objs; + int i; + size_t c_max_objs; + ssize_t c_num_objs; + hid_t *c_obj_ids; c_file_id = (hid_t)*file_id; c_obj_type = (unsigned) *obj_type; - c_max_objs = (int)*max_objs; - if ( H5Fget_obj_ids(c_file_id, c_obj_type, c_max_objs, (hid_t *)obj_ids) < 0 ) ret_value = -1; + c_max_objs = (size_t)*max_objs; + c_obj_ids = (hid_t *)HDmalloc(sizeof(hid_t)*c_max_objs); + + c_num_objs = H5Fget_obj_ids(c_file_id, c_obj_type, c_max_objs, c_obj_ids); + if ( c_num_objs < 0 ) ret_value = -1; + for (i=0; i< c_max_objs; i++) obj_ids[i] = (hid_t_f)c_obj_ids[i]; + + HDfree(c_obj_ids); + *num_objs = (size_t_f)c_num_objs; + return ret_value; } /*---------------------------------------------------------------------------- @@ -494,7 +510,7 @@ int_f nh5fget_name_c(hid_t_f *obj_id, size_t_f *size, _fcd buf, size_t_f *buflen) { char *c_buf=NULL; /* Buffer to hold C string */ - ssize_t size_c; + ssize_t size_c = -1; int_f ret_value=0; /* Return value */ /* @@ -504,7 +520,7 @@ nh5fget_name_c(hid_t_f *obj_id, size_t_f *size, _fcd buf, size_t_f *buflen) HGOTO_DONE(FAIL); /* - * Call H5Aget_name function + * Call H5Fget_name function */ if ((size_c = (size_t_f)H5Fget_name((hid_t)*obj_id, c_buf, (size_t)*buflen)) < 0) HGOTO_DONE(FAIL); diff --git a/fortran/src/H5Fff.f90 b/fortran/src/H5Fff.f90 index ac03517..433336c 100644 --- a/fortran/src/H5Fff.f90 +++ b/fortran/src/H5Fff.f90 @@ -708,7 +708,8 @@ ! September 30, 2002 ! ! Modifications: -! +! Changed the type of obj_count to INTEGER(SIZE_T) +! September 25, 2008 EIP ! Comment: !---------------------------------------------------------------------- @@ -723,7 +724,8 @@ IMPLICIT NONE INTEGER(HID_T), INTENT(IN) :: file_id ! File identifier INTEGER, INTENT(IN) :: obj_type ! Object type - INTEGER, INTENT(OUT) :: obj_count ! Number of open objects + INTEGER(SIZE_T), INTENT(OUT) :: obj_count + ! Number of open objects INTEGER, INTENT(OUT) :: hdferr ! Error code INTERFACE @@ -734,7 +736,8 @@ !DEC$ ENDIF INTEGER(HID_T), INTENT(IN) :: file_id INTEGER, INTENT(IN) :: obj_type ! Object type - INTEGER, INTENT(OUT) :: obj_count ! Number of open objects + INTEGER(SIZE_T), INTENT(OUT) :: obj_count + ! Number of open objects END FUNCTION h5fget_obj_count_c END INTERFACE @@ -767,11 +770,15 @@ ! September 30, 2002 ! ! Modifications: +! Added optional parameter num_objs for number of open objects +! of the specified type and changed type of max_obj to +! INTEGER(SIZE_T) +! September 25, 2008 EIP ! ! Comment: !---------------------------------------------------------------------- - SUBROUTINE h5fget_obj_ids_f(file_id, obj_type, max_objs, obj_ids, hdferr) + SUBROUTINE h5fget_obj_ids_f(file_id, obj_type, max_objs, obj_ids, hdferr, num_objs) ! !This definition is needed for Windows DLLs !DEC$if defined(BUILD_HDF5_DLL) @@ -782,25 +789,30 @@ IMPLICIT NONE INTEGER(HID_T), INTENT(IN) :: file_id ! File identifier INTEGER, INTENT(IN) :: obj_type ! Object type - INTEGER, INTENT(IN) :: max_objs ! Maximum # of objects to retrieve + INTEGER(SIZE_T), INTENT(IN) :: max_objs ! Maximum # of objects to retrieve INTEGER(HID_T), DIMENSION(*), INTENT(INOUT) :: obj_ids ! Array of open objects iidentifiers - INTEGER, INTENT(OUT) :: hdferr ! Error code + INTEGER, INTENT(OUT) :: hdferr ! Error code + INTEGER(SIZE_T), INTENT(OUT), OPTIONAL :: num_objs + INTEGER(SIZE_T) :: c_num_objs + ! Number of open objects of the specified type INTERFACE - INTEGER FUNCTION h5fget_obj_ids_c(file_id, obj_type, max_objs, obj_ids) + INTEGER FUNCTION h5fget_obj_ids_c(file_id, obj_type, max_objs, obj_ids, c_num_objs) USE H5GLOBAL !DEC$ IF DEFINED(HDF5F90_WINDOWS) !MS$ATTRIBUTES C,reference,alias:'_H5FGET_OBJ_IDS_C':: h5fget_obj_ids_c !DEC$ ENDIF INTEGER(HID_T), INTENT(IN) :: file_id INTEGER, INTENT(IN) :: obj_type - INTEGER, INTENT(IN) :: max_objs + INTEGER(SIZE_T), INTENT(IN) :: max_objs INTEGER(HID_T), DIMENSION(*), INTENT(INOUT) :: obj_ids + INTEGER(SIZE_T), INTENT(OUT) :: c_num_objs END FUNCTION h5fget_obj_ids_c END INTERFACE - hdferr = h5fget_obj_ids_c(file_id, obj_type, max_objs, obj_ids) + hdferr = h5fget_obj_ids_c(file_id, obj_type, max_objs, obj_ids, c_num_objs) + if (present(num_objs)) num_objs= c_num_objs END SUBROUTINE h5fget_obj_ids_f diff --git a/fortran/src/H5f90proto.h b/fortran/src/H5f90proto.h index e43b063..a506496 100644 --- a/fortran/src/H5f90proto.h +++ b/fortran/src/H5f90proto.h @@ -69,8 +69,8 @@ H5_FCDLL int_f nh5funmount_c (hid_t_f *loc_id, _fcd dsetname, int_f *namelen); H5_FCDLL int_f nh5freopen_c (hid_t_f *file_id1, hid_t_f *file_id2); H5_FCDLL int_f nh5fget_create_plist_c (hid_t_f *file_id, hid_t_f *prop_id); H5_FCDLL int_f nh5fget_access_plist_c (hid_t_f *file_id, hid_t_f *access_id); -H5_FCDLL int_f nh5fget_obj_count_c (hid_t_f *file_id, int_f *obj_type, int_f *obj_count); -H5_FCDLL int_f nh5fget_obj_ids_c (hid_t_f *file_id, int_f *obj_type, int_f *max_objs, int_f *obj_ids); +H5_FCDLL int_f nh5fget_obj_count_c (hid_t_f *file_id, int_f *obj_type, size_t_f *obj_count); +H5_FCDLL int_f nh5fget_obj_ids_c (hid_t_f *file_id, int_f *obj_type, size_t_f *max_objs, hid_t_f *obj_ids, size_t_f *num_objs); H5_FCDLL int_f nh5fget_freespace_c (hid_t_f *file_id, hssize_t_f *free_space); H5_FCDLL int_f nh5fflush_c (hid_t_f *obj_id, int_f *scope); H5_FCDLL int_f nh5fget_name_c(hid_t_f *obj_id, size_t_f *size, _fcd buf, size_t_f *buflen); |