From 6df8b198a6d394b0fe5184b3d46797441c84be15 Mon Sep 17 00:00:00 2001 From: Quincey Koziol Date: Wed, 15 Oct 2003 15:04:31 -0500 Subject: [svn-r7639] Purpose: Code cleanup Description: Remove UNICOS-specific ifdefs and replace with portable code. Platforms tested: h5committest --- fortran/src/H5Df.c | 18 +++--------------- fortran/src/H5_f.c | 12 +++++++----- 2 files changed, 10 insertions(+), 20 deletions(-) diff --git a/fortran/src/H5Df.c b/fortran/src/H5Df.c index 22ce62c..70f0846 100644 --- a/fortran/src/H5Df.c +++ b/fortran/src/H5Df.c @@ -1420,11 +1420,7 @@ nh5dwrite_vl_real_c ( hid_t_f *dset_id , hid_t_f *mem_type_id, hid_t_f *mem_spa hid_t c_file_space_id; hid_t c_xfer_prp; herr_t status; -#if defined (_UNICOS) - double *tmp; -#else - float *tmp; -#endif + real_f *tmp; size_t max_len; hvl_t *c_buf; @@ -1442,11 +1438,7 @@ nh5dwrite_vl_real_c ( hid_t_f *dset_id , hid_t_f *mem_type_id, hid_t_f *mem_spa c_buf = (hvl_t *)malloc((size_t)num_elem * sizeof(hvl_t)); if (c_buf == NULL) return ret_value; -#if defined (_UNICOS) - tmp = (double *)buf; -#else - tmp = (float *)buf; -#endif + tmp = (real_f *)buf; for (i=0; i < num_elem; i++) { c_buf[i].len = (size_t)len[i]; c_buf[i].p = tmp; @@ -1518,11 +1510,7 @@ nh5dread_vl_real_c ( hid_t_f *dset_id , hid_t_f *mem_type_id, hid_t_f *mem_spac if ( status <0 ) goto DONE; for (i=0; i < num_elem; i++) { len[i] = (size_t_f)c_buf[i].len; -#if defined (_UNICOS) - memcpy(&buf[i*max_len], c_buf[i].p, c_buf[i].len*sizeof(double)); -#else - memcpy(&buf[i*max_len], c_buf[i].p, c_buf[i].len*sizeof(float)); -#endif + memcpy(&buf[i*max_len], c_buf[i].p, c_buf[i].len*sizeof(real_f)); } H5Dvlen_reclaim(c_mem_type_id, c_mem_space_id, H5P_DEFAULT, c_buf); diff --git a/fortran/src/H5_f.c b/fortran/src/H5_f.c index 2571027..8ef7007 100644 --- a/fortran/src/H5_f.c +++ b/fortran/src/H5_f.c @@ -44,11 +44,13 @@ nh5init_types_c( hid_t_f * types, hid_t_f * floatingtypes, hid_t_f * integertype int ret_value = -1; hid_t c_type_id; if ((types[0] = (hid_t_f)H5Tcopy(H5T_NATIVE_INT)) < 0) return ret_value; -#if defined(_UNICOS) - if ((types[1] = (hid_t_f)H5Tcopy(H5T_NATIVE_DOUBLE)) < 0) return ret_value; -#else - if ((types[1] = (hid_t_f)H5Tcopy(H5T_NATIVE_FLOAT)) < 0) return ret_value; -#endif + /* 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; + } /* end if */ + else { + 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; -- cgit v0.12