diff options
author | Quincey Koziol <koziol@hdfgroup.org> | 2003-12-31 20:28:47 (GMT) |
---|---|---|
committer | Quincey Koziol <koziol@hdfgroup.org> | 2003-12-31 20:28:47 (GMT) |
commit | 502b49b2b91d25e16668d8eee1610f7a2fe00fc7 (patch) | |
tree | 477fff080d993b8554f229cb29307be4a7273d69 /test | |
parent | 9599f877c37caf9b0d5d8c33e4b7d13cf056d690 (diff) | |
download | hdf5-502b49b2b91d25e16668d8eee1610f7a2fe00fc7.zip hdf5-502b49b2b91d25e16668d8eee1610f7a2fe00fc7.tar.gz hdf5-502b49b2b91d25e16668d8eee1610f7a2fe00fc7.tar.bz2 |
[svn-r8008] Purpose:
Bug fix
Description:
Range check the szip 'pixels per block' against the chunk size of the
dataset when attempting to create a new dataset, since the szip library
requires the PPB to be at least the size of the fastest changing dimension
in the chunk.
Platforms tested:
FreeBSD 4.9 (sleipnir)
too minor for h5committest
Diffstat (limited to 'test')
-rw-r--r-- | test/dsets.c | 55 |
1 files changed, 55 insertions, 0 deletions
diff --git a/test/dsets.c b/test/dsets.c index dbe215b..185832f 100644 --- a/test/dsets.c +++ b/test/dsets.c @@ -2590,7 +2590,9 @@ file) unsigned szip_options_mask=H5_SZIP_NN_OPTION_MASK; unsigned szip_pixels_per_block; const hsize_t dims[2] = {500, 4096}; /* Dataspace dimensions */ + const hsize_t dims2[2] = {4, 2}; /* Dataspace dimensions */ const hsize_t chunk_dims[2] = {250, 2048}; /* Chunk dimensions */ + const hsize_t chunk_dims2[2] = {2, 1}; /* Chunk dimensions */ herr_t ret; /* Status value */ #else /* H5_HAVE_FILTER_SZIP */ const char *not_supported= " Szip filter is not enabled."; @@ -2674,6 +2676,59 @@ file) goto error; } /* end if */ + /* Create another data space */ + if ((sid = H5Screate_simple(2, dims2, NULL))<0) { + H5_FAILED(); + printf(" Line %d: Can't open dataspace\n",__LINE__); + goto error; + } /* end if */ + + /* Create dcpl with special filter */ + if((dcpl = H5Pcreate(H5P_DATASET_CREATE))<0) { + H5_FAILED(); + printf(" Line %d: Can't create dcpl\n",__LINE__); + goto error; + } /* end if */ + if(H5Pset_chunk(dcpl, 2, chunk_dims2)<0) { + H5_FAILED(); + printf(" Line %d: Can't set chunk sizes\n",__LINE__); + goto error; + } /* end if */ + + /* Set (invalid at dataset creation time) szip parameters */ + szip_pixels_per_block=32; + if(H5Pset_szip (dcpl, szip_options_mask, szip_pixels_per_block)<0) { + H5_FAILED(); + printf(" Line %d: Can't set szip filter\n",__LINE__); + goto error; + } + + /* Create new dataset */ + /* (Should fail because the 'can apply' filter should indicate inappropriate combination) */ + H5E_BEGIN_TRY { + dsid = H5Dcreate(file, DSET_CAN_APPLY_SZIP_NAME, H5T_NATIVE_INT, sid, dcpl); + } H5E_END_TRY; + if (dsid >=0) { + H5_FAILED(); + printf(" Line %d: Shouldn't have created dataset!\n",__LINE__); + H5Dclose(dsid); + goto error; + } /* end if */ + + /* Close dataspace */ + if(H5Sclose(sid)<0) { + H5_FAILED(); + printf(" Line %d: Can't close dataspace\n",__LINE__); + goto error; + } /* end if */ + + /* Close dataset creation property list */ + if(H5Pclose(dcpl)<0) { + H5_FAILED(); + printf(" Line %d: Can't close dcpl\n",__LINE__); + goto error; + } /* end if */ + PASSED(); #else /* H5_HAVE_FILTER_SZIP */ |