summaryrefslogtreecommitdiffstats
path: root/src/H5Dint.c
diff options
context:
space:
mode:
authorRaymond Lu <songyulu@hdfgroup.org>2011-04-07 21:56:38 (GMT)
committerRaymond Lu <songyulu@hdfgroup.org>2011-04-07 21:56:38 (GMT)
commit4b7f286a45b24de8cb5d08780df21fc7b79542ed (patch)
tree7d02277da5b03000fcc25ef6b6d4f2356e77e634 /src/H5Dint.c
parentbaba8a3d59da7ab265900a4e94a7ee47d8856a4e (diff)
downloadhdf5-4b7f286a45b24de8cb5d08780df21fc7b79542ed.zip
hdf5-4b7f286a45b24de8cb5d08780df21fc7b79542ed.tar.gz
hdf5-4b7f286a45b24de8cb5d08780df21fc7b79542ed.tar.bz2
[svn-r20440] Bug 1386 - allow dimension size to be zero even though it isn't unlimited. I added test cases for contiguous, compact, and chunked, and external storage datasets, and also attribute. The test includes dataspace selections. I'll handle the tools in the next step.
Tested on jam, amani, and heiwa.
Diffstat (limited to 'src/H5Dint.c')
-rw-r--r--src/H5Dint.c27
1 files changed, 17 insertions, 10 deletions
diff --git a/src/H5Dint.c b/src/H5Dint.c
index 40f262c..8c73888 100644
--- a/src/H5Dint.c
+++ b/src/H5Dint.c
@@ -1628,16 +1628,23 @@ H5D_alloc_storage(H5D_t *dset/*in,out*/, hid_t dxpl_id, H5D_time_alloc_t time_al
case H5D_COMPACT:
/* Check if space is already allocated */
if(NULL == layout->storage.u.compact.buf) {
- /* Reserve space in layout header message for the entire array. */
- HDassert(layout->storage.u.compact.size > 0);
- if(NULL == (layout->storage.u.compact.buf = H5MM_malloc(layout->storage.u.compact.size)))
- HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "unable to allocate memory for compact dataset")
- if(!full_overwrite)
- HDmemset(layout->storage.u.compact.buf, 0, layout->storage.u.compact.size);
- layout->storage.u.compact.dirty = TRUE;
-
- /* Indicate that we should initialize storage space */
- must_init_space = TRUE;
+ /* Reserve space in layout header message for the entire array.
+ * Starting from the 1.8.7 release, we allow dataspace to have
+ * zero dimension size. So the storage size can be zero.
+ * SLU 2011/4/4 */
+ if(layout->storage.u.compact.size > 0) {
+ if(NULL == (layout->storage.u.compact.buf = H5MM_malloc(layout->storage.u.compact.size)))
+ HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "unable to allocate memory for compact dataset")
+ if(!full_overwrite)
+ HDmemset(layout->storage.u.compact.buf, 0, layout->storage.u.compact.size);
+ layout->storage.u.compact.dirty = TRUE;
+
+ /* Indicate that we should initialize storage space */
+ must_init_space = TRUE;
+ } else {
+ layout->storage.u.compact.dirty = FALSE;
+ must_init_space = FALSE;
+ }
} /* end if */
break;