summaryrefslogtreecommitdiffstats
path: root/src/H5Smpio.c
diff options
context:
space:
mode:
authorQuincey Koziol <koziol@hdfgroup.org>2004-04-17 20:31:50 (GMT)
committerQuincey Koziol <koziol@hdfgroup.org>2004-04-17 20:31:50 (GMT)
commit880d8357bf87cf0761e53ecb0c7b1fb1edbd1528 (patch)
treed71b5c1c36fdbd5571079c8782477308e95284eb /src/H5Smpio.c
parent7456a9293d0672d8c327f58951b30aa911d95dc2 (diff)
downloadhdf5-880d8357bf87cf0761e53ecb0c7b1fb1edbd1528.zip
hdf5-880d8357bf87cf0761e53ecb0c7b1fb1edbd1528.tar.gz
hdf5-880d8357bf87cf0761e53ecb0c7b1fb1edbd1528.tar.bz2
[svn-r8376] Purpose:
Code cleanup Description: Update null dataspace changes to try to write older version of dataspace information whenever possible. Refactor common code to only one location. Allow I/O operations to succeed on null dataspaces. Platforms tested: FreeBSD 4.9 (sleipnir) h5committest
Diffstat (limited to 'src/H5Smpio.c')
-rw-r--r--src/H5Smpio.c16
1 files changed, 11 insertions, 5 deletions
diff --git a/src/H5Smpio.c b/src/H5Smpio.c
index 9b5a2fa..7c732b1 100644
--- a/src/H5Smpio.c
+++ b/src/H5Smpio.c
@@ -104,17 +104,22 @@ H5S_mpio_all_type( const H5S_t *space, size_t elmt_size,
hbool_t *is_derived_type )
{
hsize_t total_bytes;
+ hssize_t snelmts; /*total number of elmts (signed) */
+ hsize_t nelmts; /*total number of elmts */
unsigned u;
+ herr_t ret_value = SUCCEED;
- FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5S_mpio_all_type);
+ FUNC_ENTER_NOAPI_NOINIT(H5S_mpio_all_type);
/* Check args */
assert (space);
/* Just treat the entire extent as a block of bytes */
- total_bytes = (hsize_t)elmt_size;
- for (u=0; u<space->extent.u.simple.rank; ++u)
- total_bytes *= space->extent.u.simple.size[u];
+ if((snelmts = H5S_get_simple_extent_npoints(space))<0)
+ HGOTO_ERROR (H5E_ARGS, H5E_BADVALUE, FAIL, "src dataspace has invalid selection")
+ H5_ASSIGN_OVERFLOW(nelmts,snelmts,hssize_t,hsize_t);
+
+ total_bytes = (hsize_t)elmt_size*nelmts;
/* fill in the return values */
*new_type = MPI_BYTE;
@@ -122,7 +127,8 @@ H5S_mpio_all_type( const H5S_t *space, size_t elmt_size,
*extra_offset = 0;
*is_derived_type = 0;
- FUNC_LEAVE_NOAPI(SUCCEED);
+done:
+ FUNC_LEAVE_NOAPI(ret_value);
} /* H5S_mpio_all_type() */