[svn-r9312] Purpose:

Bug fix.

Description:
    Allow I/O to occur on 0 element selections.

Platforms tested:
    h5committest
This commit is contained in:
Quincey Koziol 2004-09-22 22:05:15 -05:00
parent f235187dba
commit 9fc48a0097
2 changed files with 13 additions and 6 deletions

View File

@ -1134,9 +1134,8 @@ H5D_contig_read(hsize_t nelmts, H5D_t *dataset,
/* Sanity check dataset, then read it */
assert(((dataset->layout.type==H5D_CONTIGUOUS && H5F_addr_defined(dataset->layout.u.contig.addr))
|| (dataset->layout.type==H5D_CHUNKED && H5F_addr_defined(dataset->layout.u.chunk.addr)))
|| dataset->efl.nused>0 ||
H5S_NULL == H5S_GET_EXTENT_TYPE(file_space) ||
dataset->layout.type==H5D_COMPACT);
|| dataset->efl.nused>0 || 0 == nelmts
|| dataset->layout.type==H5D_COMPACT);
H5_CHECK_OVERFLOW(nelmts,hsize_t,size_t);
status = (sconv->read)(dataset->ent.file, dxpl_cache, dxpl_id,
dataset, (H5D_storage_t *)&(dataset->efl),
@ -1243,8 +1242,8 @@ H5D_contig_read(hsize_t nelmts, H5D_t *dataset,
/* Sanity check that space is allocated, then read data from it */
assert(((dataset->layout.type==H5D_CONTIGUOUS && H5F_addr_defined(dataset->layout.u.contig.addr))
|| (dataset->layout.type==H5D_CHUNKED && H5F_addr_defined(dataset->layout.u.chunk.addr)))
|| dataset->efl.nused>0 ||
dataset->layout.type==H5D_COMPACT);
|| dataset->efl.nused>0 || 0 == nelmts
|| dataset->layout.type==H5D_COMPACT);
n = H5S_select_fgath(dataset->ent.file, dxpl_cache, dxpl_id,
dataset, (H5D_storage_t *)&(dataset->efl),
file_space, &file_iter, smine_nelmts,
@ -1639,7 +1638,8 @@ H5D_chunk_read(hsize_t nelmts, H5D_t *dataset,
/* Sanity check dataset, then read it */
assert(((dataset->layout.type==H5D_CONTIGUOUS && H5F_addr_defined(dataset->layout.u.contig.addr))
|| (dataset->layout.type==H5D_CHUNKED && H5F_addr_defined(dataset->layout.u.chunk.addr)))
|| dataset->efl.nused>0 || dataset->layout.type==H5D_COMPACT);
|| dataset->efl.nused>0 || 0 == nelmts
|| dataset->layout.type==H5D_COMPACT);
/* Get first node in chunk tree */
chunk_node=H5TB_first(fm.fsel->root);

View File

@ -5374,6 +5374,7 @@ test_select_none(void)
hsize_t dims1[] = {SPACE7_DIM1, SPACE7_DIM2};
hsize_t dims2[] = {SPACE7_DIM1, SPACE7_DIM2};
uint8_t *wbuf, /* buffer to write to disk */
*rbuf, /* buffer to read from disk */
*tbuf; /* temporary buffer pointer */
int i,j; /* Counters */
herr_t ret; /* Generic return value */
@ -5383,6 +5384,7 @@ test_select_none(void)
/* Allocate write & read buffers */
wbuf=malloc(sizeof(uint8_t)*SPACE7_DIM1*SPACE7_DIM2);
rbuf=malloc(sizeof(uint8_t)*SPACE7_DIM1*SPACE7_DIM2);
/* Initialize write buffer */
for(i=0, tbuf=wbuf; i<SPACE7_DIM1; i++)
@ -5412,6 +5414,10 @@ test_select_none(void)
ret = H5Sselect_none(sid2);
CHECK(ret, FAIL, "H5Sselect_none");
/* Attempt to read "nothing" from disk (before space is allocated) */
ret=H5Dread(dataset,H5T_NATIVE_UCHAR,sid2,sid1,H5P_DEFAULT,rbuf);
CHECK(ret, FAIL, "H5Dread");
/* Write "nothing" to disk */
ret=H5Dwrite(dataset,H5T_NATIVE_UCHAR,sid2,sid1,H5P_DEFAULT,wbuf);
CHECK(ret, FAIL, "H5Dwrite");
@ -5446,6 +5452,7 @@ test_select_none(void)
/* Free memory buffers */
free(wbuf);
free(rbuf);
} /* test_select_none() */
/****************************************************************