summaryrefslogtreecommitdiffstats
path: root/fortran/src/H5_f.c
diff options
context:
space:
mode:
authorElena Pourmal <epourmal@hdfgroup.org>2005-06-22 18:23:21 (GMT)
committerElena Pourmal <epourmal@hdfgroup.org>2005-06-22 18:23:21 (GMT)
commitea66068977639b7b2737bb9db1e59b26db914d1e (patch)
treebc1ce12c71d0f91dba3c2d0ddccd81862a588c89 /fortran/src/H5_f.c
parentec071c6c149c44d9b3a056948502ca2af3b875b9 (diff)
downloadhdf5-ea66068977639b7b2737bb9db1e59b26db914d1e.zip
hdf5-ea66068977639b7b2737bb9db1e59b26db914d1e.tar.gz
hdf5-ea66068977639b7b2737bb9db1e59b26db914d1e.tar.bz2
[svn-r10970] Purpose: New feature/bug #350 fix
Description: When compiler flag was used to set the size of Fortran integer to 8 bytes, library would fail. Solution: Cleaned up the code; added detection of Fortran INTEGER type size and appropriately defined int_f type for C-stubs routines. Platforms tested: Solaris 2.8 32 and 64-bit, AIX 5.1 64-bit parallel PGI Fortran with -i8 flag on heping Absoft Fortran with -i8 flag on heping g95 on mir (Fortran integer is 8 bytes by default that cannot be changed - compiler bug ;-) AIX Fortran with -qintsize=8 32 and 64-bit modes on copper Misc. update:
Diffstat (limited to 'fortran/src/H5_f.c')
-rw-r--r--fortran/src/H5_f.c23
1 files changed, 20 insertions, 3 deletions
diff --git a/fortran/src/H5_f.c b/fortran/src/H5_f.c
index 07eff36..8d88667 100644
--- a/fortran/src/H5_f.c
+++ b/fortran/src/H5_f.c
@@ -43,7 +43,22 @@ nh5init_types_c( hid_t_f * types, hid_t_f * floatingtypes, hid_t_f * integertype
int ret_value = -1;
hid_t c_type_id;
+ size_t tmp_val;
+
+/* Fortran INTEGER is may not be the same as C in; do all checking to find
+ an appropriate size
+*/
+ if (sizeof(int_f) == sizeof(int)) {
if ((types[0] = (hid_t_f)H5Tcopy(H5T_NATIVE_INT)) < 0) return ret_value;
+ } /*end if */
+ else if (sizeof(int_f) == sizeof(long)) {
+ if ((types[0] = (hid_t_f)H5Tcopy(H5T_NATIVE_LONG)) < 0) return ret_value;
+ } /*end if */
+ else
+ if (sizeof(int_f) == sizeof(long long)) {
+ if ((types[0] = (hid_t_f)H5Tcopy(H5T_NATIVE_LLONG)) < 0) return ret_value;
+ } /*end else */
+
/* Accomodate Crays with this check */
if(sizeof(real_f)==sizeof(double)) {
if ((types[1] = (hid_t_f)H5Tcopy(H5T_NATIVE_DOUBLE)) < 0) return ret_value;
@@ -52,11 +67,13 @@ nh5init_types_c( hid_t_f * types, hid_t_f * floatingtypes, hid_t_f * integertype
if ((types[1] = (hid_t_f)H5Tcopy(H5T_NATIVE_FLOAT)) < 0) return ret_value;
} /* end else */
if ((types[2] = (hid_t_f)H5Tcopy(H5T_NATIVE_DOUBLE)) < 0) return ret_value;
+
/*
if ((types[3] = H5Tcopy(H5T_NATIVE_UINT8)) < 0) return ret_value;
*/
if ((c_type_id = H5Tcopy(H5T_FORTRAN_S1)) < 0) return ret_value;
- if(H5Tset_size(c_type_id, 1) < 0) return ret_value;
+ tmp_val = 1;
+ if(H5Tset_size(c_type_id, tmp_val) < 0) return ret_value;
if(H5Tset_strpad(c_type_id, H5T_STR_SPACEPAD) < 0) return ret_value;
types[3] = (hid_t_f)c_type_id;
@@ -188,7 +205,7 @@ int_f
nh5init_flags_c( int_f *h5d_flags, int_f *h5f_flags,
int_f *h5fd_flags, hid_t_f *h5fd_hid_flags,
int_f *h5g_flags, int_f *h5i_flags,
- int_f *h5p_flags, int_f *h5r_flags, int_f *h5s_flags,
+ hid_t_f *h5p_flags, int_f *h5r_flags, int_f *h5s_flags,
int_f *h5t_flags, int_f *h5z_flags)
{
int ret_value = -1;
@@ -317,7 +334,7 @@ nh5init_flags_c( int_f *h5d_flags, int_f *h5f_flags,
h5s_flags[3] = H5S_SELECT_SET;
h5s_flags[4] = H5S_SELECT_OR;
h5s_flags[5] = (int_f)H5S_UNLIMITED;
- h5s_flags[6] = H5S_ALL;
+ h5s_flags[6] = (int_f)H5S_ALL;
h5s_flags[7] = H5S_SELECT_NOOP;
h5s_flags[8] = H5S_SELECT_AND;