diff options
author | Scot Breitenfeld <brtnfld@hdfgroup.org> | 2015-02-19 16:17:16 (GMT) |
---|---|---|
committer | Scot Breitenfeld <brtnfld@hdfgroup.org> | 2015-02-19 16:17:16 (GMT) |
commit | 3eeed2f1d558bd74c2360b31366e2650026d165f (patch) | |
tree | bc7bff3483c7cca9abe666a5170107e2b7e9a3ab /fortran | |
parent | fc082e60f3a258cba67ab1a16e11748a31de10eb (diff) | |
download | hdf5-3eeed2f1d558bd74c2360b31366e2650026d165f.zip hdf5-3eeed2f1d558bd74c2360b31366e2650026d165f.tar.gz hdf5-3eeed2f1d558bd74c2360b31366e2650026d165f.tar.bz2 |
[svn-r26241] Fixed issue with default 8 byte integers using xlf compilers.
Diffstat (limited to 'fortran')
-rw-r--r-- | fortran/src/H5Tf.c | 31 | ||||
-rw-r--r-- | fortran/src/H5Tff_F03.f90 | 6 | ||||
-rw-r--r-- | fortran/src/H5Tff_F90.f90 | 2 | ||||
-rw-r--r-- | fortran/test/tH5T_F03.f90 | 18 |
4 files changed, 31 insertions, 26 deletions
diff --git a/fortran/src/H5Tf.c b/fortran/src/H5Tf.c index b6bcf5f..878119f 100644 --- a/fortran/src/H5Tf.c +++ b/fortran/src/H5Tf.c @@ -1738,21 +1738,23 @@ nh5tenum_create_c ( hid_t_f *parent_id , hid_t_f *new_type_id) /****if* H5Tf/h5tenum_insert_c * NAME - * h5tenum_insert_c + * h5tenum_insert_c * PURPOSE - * Call H5Tenum_insert to insert a new enumeration datatype member. + * Call H5Tenum_insert to insert a new enumeration datatype member. * INPUTS - * type_id - identifier of the datatype - * name - Name of the new member - * namelen - length of the name - * value - value of the new member + * type_id - identifier of the datatype + * name - Name of the new member + * namelen - length of the name + * value - value of the new member * RETURNS - * 0 on success, -1 on failure + * 0 on success, -1 on failure * AUTHOR * XIANGYANG SU - * Thursday, February 3, 2000 + * Thursday, February 3, 2000 * HISTORY - * + * 'value' is no longer cast into an int. If the user passes in an 8 byte integer then + * it should not be cast to an int (which might be 4 bytes). Instead the value + * is written as the size of an int_f. * SOURCE */ @@ -1761,19 +1763,18 @@ nh5tenum_insert_c(hid_t_f *type_id, _fcd name, int_f* namelen, int_f* value) /******/ { int ret_value = -1; - hid_t c_type_id; char* c_name; size_t c_namelen; - int_f c_value; herr_t error; + int_f c_value; c_namelen = *namelen; c_name = (char *)HD5f2cstring(name, c_namelen); if (c_name == NULL) return ret_value; - c_type_id = (hid_t)*type_id; - c_value = (int)*value; - error = H5Tenum_insert(c_type_id, c_name, &c_value); + c_value = *value; + error = H5Tenum_insert((hid_t)*type_id, c_name, &c_value); + HDfree(c_name); if(error < 0) return ret_value; @@ -2437,7 +2438,7 @@ h5tconvert_c(hid_t_f *src_id, hid_t_f *dst_id, size_t_f *nelmts, void *buf, void * 0 on success, -1 on failure * AUTHOR * M. Scot Breitenfeld - * 2/6/2015 + * February 6, 2015 * * SOURCE */ diff --git a/fortran/src/H5Tff_F03.f90 b/fortran/src/H5Tff_F03.f90 index beff717..2c9f212 100644 --- a/fortran/src/H5Tff_F03.f90 +++ b/fortran/src/H5Tff_F03.f90 @@ -118,7 +118,7 @@ CONTAINS END SUBROUTINE h5tconvert_f ! -!****s* (F03) H5T/h5tenaum_insert_f03 +!****s* (F03) H5T/h5tenum_insert_f90 ! ! NAME ! h5tenum_insert_f @@ -146,7 +146,7 @@ CONTAINS IMPLICIT NONE INTEGER(HID_T), INTENT(IN) :: type_id ! Datatype identifier CHARACTER(LEN=*), INTENT(IN) :: name !Name of the new member - INTEGER, INTENT(IN) :: value !value of the new member + INTEGER, INTENT(IN) :: value ! value of the new member INTEGER, INTENT(OUT) :: hdferr ! Error code !***** INTEGER :: namelen @@ -169,7 +169,7 @@ CONTAINS END SUBROUTINE h5tenum_insert_f90 ! -!****s* (F03) H5T/h5tenaum_insert_f03 +!****s* (F03) H5T/h5tenum_insert_f03 ! ! NAME ! h5tenum_insert_f diff --git a/fortran/src/H5Tff_F90.f90 b/fortran/src/H5Tff_F90.f90 index 8540d2b..380fbec 100644 --- a/fortran/src/H5Tff_F90.f90 +++ b/fortran/src/H5Tff_F90.f90 @@ -44,7 +44,7 @@ CONTAINS !****s* H5T/h5tenum_insert_f ! ! NAME -! h5tenaum_insert_f +! h5tenum_insert_f ! ! PURPOSE ! Inserts a new enumeration datatype member. diff --git a/fortran/test/tH5T_F03.f90 b/fortran/test/tH5T_F03.f90 index d9a671c..e019d0f 100644 --- a/fortran/test/tH5T_F03.f90 +++ b/fortran/test/tH5T_F03.f90 @@ -1428,7 +1428,11 @@ SUBROUTINE t_enum(total_error) f_ptr = C_LOC(val(1)) CALL H5Tconvert_f(M_BASET, F_BASET, INT(1,SIZE_T), f_ptr, error) CALL check("H5Tconvert_f",error, total_error) - CALL H5Tenum_insert_f(filetype, TRIM(names(i+1)), val(1), error) + IF(i.GE.1)THEN ! test both F90 and F03 APIs + CALL H5Tenum_insert_f(filetype, TRIM(names(i+1)), f_ptr, error) + ELSE + CALL H5Tenum_insert_f(filetype, TRIM(names(i+1)), val(1), error) + ENDIF CALL check("H5Tenum_insert_f",error, total_error) ENDDO ! @@ -3134,7 +3138,7 @@ SUBROUTINE t_enum_conv(total_error) ENUMERATOR :: E1_RED, E1_GREEN, E1_BLUE, E1_WHITE, E1_BLACK END ENUM - INTEGER :: val + INTEGER(KIND(E1_RED)), TARGET :: val ! Enumerated data array ! Some values are out of range for testing. The library should accept them @@ -3185,19 +3189,19 @@ SUBROUTINE t_enum_conv(total_error) ! Initialize enum data. ! val = E1_RED - CALL H5Tenum_insert_f(dtype, "RED", val, error) + CALL H5Tenum_insert_f(dtype, "RED", C_LOC(val), error) CALL check("h5tenum_insert_f",error, total_error) val = E1_GREEN - CALL H5Tenum_insert_f(dtype, "GREEN", val, error) + CALL H5Tenum_insert_f(dtype, "GREEN", C_LOC(val), error) CALL check("h5tenum_insert_f",error, total_error) val = E1_BLUE - CALL H5Tenum_insert_f(dtype, "BLUE", val, error) + CALL H5Tenum_insert_f(dtype, "BLUE", C_LOC(val), error) CALL check("h5tenum_insert_f",error, total_error) val = E1_WHITE - CALL H5Tenum_insert_f(dtype, "WHITE", val, error) + CALL H5Tenum_insert_f(dtype, "WHITE", C_LOC(val), error) CALL check("h5tenum_insert_f",error, total_error) val = E1_BLACK - CALL H5Tenum_insert_f(dtype, "BLACK", val, error) + CALL H5Tenum_insert_f(dtype, "BLACK", C_LOC(val), error) CALL check("h5tenum_insert_f",error, total_error) ! ! Create dataspace. Setting maximum size to be the current size. |