summaryrefslogtreecommitdiffstats
path: root/src
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
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')
-rw-r--r--src/H5Dcontig.c7
-rw-r--r--src/H5Dint.c17
-rw-r--r--src/H5Ocopy.c3
-rw-r--r--src/H5Olayout.c10
4 files changed, 24 insertions, 13 deletions
diff --git a/src/H5Dcontig.c b/src/H5Dcontig.c
index f894739..cafa4a4 100644
--- a/src/H5Dcontig.c
+++ b/src/H5Dcontig.c
@@ -494,11 +494,8 @@ H5D_contig_is_space_alloc(const H5O_storage_t *storage)
/* Sanity checks */
HDassert(storage);
- /* Set return value, indicating space is allocated when size is zero */
- if(0 == storage->u.contig.size)
- ret_value = TRUE;
- else
- ret_value = (hbool_t)H5F_addr_defined(storage->u.contig.addr);
+ /* Set return value */
+ ret_value = (hbool_t)H5F_addr_defined(storage->u.contig.addr);
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5D_contig_is_space_alloc() */
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;
diff --git a/src/H5Ocopy.c b/src/H5Ocopy.c
index 1f8b4d8..d9a4b42 100644
--- a/src/H5Ocopy.c
+++ b/src/H5Ocopy.c
@@ -964,8 +964,7 @@ H5O_copy_header(const H5O_loc_t *oloc_src, H5O_loc_t *oloc_dst /*out */,
HGOTO_ERROR(H5E_SLIST, H5E_CANTCREATE, FAIL, "cannot make skip list")
/* copy the object from the source file to the destination file */
- if(H5O_copy_header_real(oloc_src, oloc_dst, dxpl_id, &cpy_info, NULL, NULL)
- < 0)
+ if(H5O_copy_header_real(oloc_src, oloc_dst, dxpl_id, &cpy_info, NULL, NULL) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_CANTCOPY, FAIL, "unable to copy object")
done:
diff --git a/src/H5Olayout.c b/src/H5Olayout.c
index e4d6486..1b17bff 100644
--- a/src/H5Olayout.c
+++ b/src/H5Olayout.c
@@ -241,6 +241,8 @@ H5O_layout_decode(H5F_t *f, hid_t UNUSED dxpl_id, H5O_t UNUSED *open_oh,
mesg->ops = H5D_LOPS_CHUNK;
break;
+ case H5D_LAYOUT_ERROR:
+ case H5D_NLAYOUTS:
default:
HGOTO_ERROR(H5E_OHDR, H5E_CANTLOAD, NULL, "Invalid layout class")
} /* end switch */
@@ -342,6 +344,8 @@ H5O_layout_encode(H5F_t *f, hbool_t UNUSED disable_shared, uint8_t *p, const voi
UINT32ENCODE(p, mesg->u.chunk.dim[u]);
break;
+ case H5D_LAYOUT_ERROR:
+ case H5D_NLAYOUTS:
default:
HGOTO_ERROR(H5E_OHDR, H5E_CANTENCODE, FAIL, "Invalid layout class")
} /* end switch */
@@ -556,6 +560,8 @@ H5O_layout_delete(H5F_t *f, hid_t dxpl_id, H5O_t *open_oh, void *_mesg)
HGOTO_ERROR(H5E_OHDR, H5E_CANTFREE, FAIL, "unable to free raw data")
break;
+ case H5D_LAYOUT_ERROR:
+ case H5D_NLAYOUTS:
default:
HGOTO_ERROR(H5E_OHDR, H5E_BADTYPE, FAIL, "not valid storage type")
} /* end switch */
@@ -641,6 +647,8 @@ H5O_layout_copy_file(H5F_t *file_src, void *mesg_src, H5F_t *file_dst,
} /* end if */
break;
+ case H5D_LAYOUT_ERROR:
+ case H5D_NLAYOUTS:
default:
HGOTO_ERROR(H5E_OHDR, H5E_CANTLOAD, NULL, "Invalid layout class")
} /* end switch */
@@ -737,6 +745,8 @@ H5O_layout_debug(H5F_t UNUSED *f, hid_t UNUSED dxpl_id, const void *_mesg,
"Data Size:", mesg->storage.u.compact.size);
break;
+ case H5D_LAYOUT_ERROR:
+ case H5D_NLAYOUTS:
default:
HDfprintf(stream, "%*s%-*s %s (%u)\n", indent, "", fwidth,
"Type:", "Unknown", (unsigned)mesg->type);