summaryrefslogtreecommitdiffstats
path: root/src/H5Dint.c
diff options
context:
space:
mode:
authorQuincey Koziol <koziol@hdfgroup.org>2012-03-13 04:21:02 (GMT)
committerQuincey Koziol <koziol@hdfgroup.org>2012-03-13 04:21:02 (GMT)
commit864e6b0e70c25b189b00e257d6c5ee8fbd2d1dbc (patch)
tree58a5444d8c34e9515b7c26b0b423904d1fe5b65e /src/H5Dint.c
parent493e1e8f805964a62918b11908d28dae93b0d47a (diff)
downloadhdf5-864e6b0e70c25b189b00e257d6c5ee8fbd2d1dbc.zip
hdf5-864e6b0e70c25b189b00e257d6c5ee8fbd2d1dbc.tar.gz
hdf5-864e6b0e70c25b189b00e257d6c5ee8fbd2d1dbc.tar.bz2
[svn-r22059] Description:
Bring r22058 from trunk to 1.8 branch: Better fix for zero-sized dataset error (r22053). Tested on: Mac OSX/64 10.7.3 (amazon) w/debug & parallel
Diffstat (limited to 'src/H5Dint.c')
-rw-r--r--src/H5Dint.c17
1 files changed, 11 insertions, 6 deletions
diff --git a/src/H5Dint.c b/src/H5Dint.c
index 54f60b5..98d3447 100644
--- a/src/H5Dint.c
+++ b/src/H5Dint.c
@@ -1596,15 +1596,20 @@ H5D_alloc_storage(H5D_t *dset/*in,out*/, hid_t dxpl_id, H5D_time_alloc_t time_al
switch(layout->type) {
case H5D_CONTIGUOUS:
if(!(*dset->shared->layout.ops->is_space_alloc)(&dset->shared->layout.storage)) {
- /* Reserve space in the file for the entire array */
- if(H5D_contig_alloc(f, dxpl_id, &layout->storage.u.contig/*out*/) < 0)
- HGOTO_ERROR(H5E_IO, H5E_CANTINIT, FAIL, "unable to initialize contiguous storage")
+ /* Check if we have a zero-sized dataset */
+ if(layout->storage.u.contig.size > 0) {
+ /* Reserve space in the file for the entire array */
+ if(H5D_contig_alloc(f, dxpl_id, &layout->storage.u.contig/*out*/) < 0)
+ HGOTO_ERROR(H5E_IO, H5E_CANTINIT, FAIL, "unable to initialize contiguous storage")
+
+ /* Indicate that we should initialize storage space */
+ must_init_space = TRUE;
+ } /* end if */
+ else
+ layout->storage.u.contig.addr = HADDR_UNDEF;
/* Indicate that we set the storage addr */
addr_set = TRUE;
-
- /* Indicate that we should initialize storage space */
- must_init_space = TRUE;
} /* end if */
break;