diff options
author | Dana Robinson <derobins@hdfgroup.org> | 2017-05-09 23:29:44 (GMT) |
---|---|---|
committer | Dana Robinson <derobins@hdfgroup.org> | 2017-05-09 23:29:44 (GMT) |
commit | 3d8416251d3cffbe2688f86fa87c4b5602ec0d5b (patch) | |
tree | a6ed106494005a98b0e26b9a1035d2039c004c9c /src | |
parent | 1a4bda1bd824df2da1e8c3441881fb7fca6a4413 (diff) | |
download | hdf5-3d8416251d3cffbe2688f86fa87c4b5602ec0d5b.zip hdf5-3d8416251d3cffbe2688f86fa87c4b5602ec0d5b.tar.gz hdf5-3d8416251d3cffbe2688f86fa87c4b5602ec0d5b.tar.bz2 |
Fixes the chunk overwrite bug (HDFFV-10187) and adds a new H5DO HL test.
Diffstat (limited to 'src')
-rw-r--r-- | src/H5Dchunk.c | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/src/H5Dchunk.c b/src/H5Dchunk.c index 2523c5d..8152d14 100644 --- a/src/H5Dchunk.c +++ b/src/H5Dchunk.c @@ -445,11 +445,18 @@ H5D__chunk_direct_write(const H5D_t *dset, hid_t dxpl_id, uint32_t filters, /* Set up the size of chunk for user data */ udata.chunk_block.length = data_size; - /* Create the chunk it if it doesn't exist, or reallocate the chunk - * if its size changed. - */ - if(H5D__chunk_file_alloc(&idx_info, &old_chunk, &udata.chunk_block, &need_insert, scaled) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTALLOC, FAIL, "unable to allocate chunk") + if (0 == idx_info.pline->nused && H5F_addr_defined(old_chunk.offset)) { + /* If there are no filters and we are overwriting the chunk we can just set values */ + udata.chunk_block.offset = old_chunk.offset; + need_insert = FALSE; + } + else { + /* Otherwise, create the chunk it if it doesn't exist, or reallocate the chunk + * if its size has changed. + */ + if (H5D__chunk_file_alloc(&idx_info, &old_chunk, &udata.chunk_block, &need_insert, scaled) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_CANTALLOC, FAIL, "unable to allocate chunk") + } /* Make sure the address of the chunk is returned. */ if(!H5F_addr_defined(udata.chunk_block.offset)) |