summaryrefslogtreecommitdiffstats
path: root/testpar/t_chunk_alloc.c
diff options
context:
space:
mode:
Diffstat (limited to 'testpar/t_chunk_alloc.c')
-rw-r--r--testpar/t_chunk_alloc.c44
1 files changed, 16 insertions, 28 deletions
diff --git a/testpar/t_chunk_alloc.c b/testpar/t_chunk_alloc.c
index e496a58..5d02822 100644
--- a/testpar/t_chunk_alloc.c
+++ b/testpar/t_chunk_alloc.c
@@ -126,46 +126,34 @@ create_chunked_dataset(const char *filename, int nchunks, write_type write_patte
VRFY((file_id >= 0), "H5Fcreate");
/* Modify dataset creation properties, i.e. enable chunking */
- cparms = H5Pcreate (H5P_DATASET_CREATE);
+ cparms = H5Pcreate(H5P_DATASET_CREATE);
VRFY((cparms >= 0), "");
hrc = H5Pset_alloc_time(cparms, H5D_ALLOC_TIME_EARLY);
VRFY((hrc >= 0), "");
- hrc = H5Pset_chunk ( cparms, 1, chunk_dims);
+ hrc = H5Pset_chunk(cparms, 1, chunk_dims);
VRFY((hrc >= 0), "");
/* Create a new dataset within the file using cparms creation properties. */
- dataset = H5Dcreate (file_id, DATASETNAME, H5T_NATIVE_UCHAR, dataspace, cparms);
+ dataset = H5Dcreate2(file_id, DATASETNAME, H5T_NATIVE_UCHAR, dataspace, H5P_DEFAULT, cparms, H5P_DEFAULT);
VRFY((dataset >= 0), "");
- switch (write_pattern) {
-
- /* writes only the second to last chunk */
- case sec_last:
-
- memset(buffer, 100, CHUNKSIZE);
-
- count[0] = 1;
- stride[0] = 1;
- block[0] = chunk_dims[0];
- offset[0] = (nchunks-2)*chunk_dims[0];
-
- hrc = H5Sselect_hyperslab(dataspace, H5S_SELECT_SET, offset, stride, count, block);
- VRFY((hrc >= 0), "");
+ if(write_pattern == sec_last) {
+ HDmemset(buffer, 100, CHUNKSIZE);
- /* Write sec_last chunk */
- hrc = H5Dwrite(dataset, H5T_NATIVE_UCHAR, memspace, dataspace, H5P_DEFAULT, buffer);
- VRFY((hrc >= 0), "H5Dwrite");
+ count[0] = 1;
+ stride[0] = 1;
+ block[0] = chunk_dims[0];
+ offset[0] = (nchunks-2)*chunk_dims[0];
- break;
-
-
- /* doesn't write anything */
- case none:
+ hrc = H5Sselect_hyperslab(dataspace, H5S_SELECT_SET, offset, stride, count, block);
+ VRFY((hrc >= 0), "");
- break;
- }
+ /* Write sec_last chunk */
+ hrc = H5Dwrite(dataset, H5T_NATIVE_UCHAR, memspace, dataspace, H5P_DEFAULT, buffer);
+ VRFY((hrc >= 0), "H5Dwrite");
+ } /* end if */
/* Close resources */
hrc = H5Dclose (dataset);
@@ -187,7 +175,7 @@ create_chunked_dataset(const char *filename, int nchunks, write_type write_patte
/* verify file size */
filesize = get_filesize(filename);
- est_filesize = nchunks*CHUNKSIZE*sizeof(unsigned char);
+ est_filesize = nchunks * CHUNKSIZE * sizeof(unsigned char);
VRFY((filesize >= est_filesize), "file size check");
}