disallow szip if zlib already in use

This commit is contained in:
Edward Hartnett 2020-02-07 04:46:15 -07:00
parent 78cd7f7512
commit dc4e880c37
2 changed files with 12 additions and 4 deletions

View File

@ -1047,7 +1047,7 @@ if test "x$enable_hdf5" = xyes; then
# H5Pset_fapl_mpiposix and H5Pget_fapl_mpiposix have been removed since HDF5 1.8.12.
# Use H5Pset_fapl_mpio and H5Pget_fapl_mpio, instead.
AC_CHECK_FUNCS([H5Pget_fapl_mpio H5Pset_deflate H5Z_SZIP H5free_memory H5resize_memory H5allocate_memory H5Pset_libver_bounds H5Pset_all_coll_metadata_ops H5Z_SZIP H5Dread_chunk])
AC_CHECK_FUNCS([H5Pget_fapl_mpio H5Pset_deflate H5Z_SZIP H5free_memory H5resize_memory H5allocate_memory H5Pset_libver_bounds H5Pset_all_coll_metadata_ops H5Dread_chunk])
# Check to see if HDF5 library has collective metadata APIs, (HDF5 >= 1.10.0)
if test "x$ac_cv_func_H5Pset_all_coll_metadata_ops" = xyes; then

View File

@ -916,6 +916,9 @@ NC4_def_var_deflate(int ncid, int varid, int shuffle, int deflate,
* SZIP compression cannot be applied to variables with any
* user-defined type.
*
* If zlib compression has already be turned on for a variable, then
* this function will return ::NC_EINVAL.
*
* @note The options_mask parameter may be either NC_SZIP_EC (entropy
* coding) or NC_SZIP_NN (nearest neighbor):
* * The entropy coding method is best suited for data that has been
@ -949,7 +952,8 @@ NC4_def_var_deflate(int ncid, int varid, int shuffle, int deflate,
* not netCDF-4/HDF5.
* @returns ::NC_ELATEDEF Too late to change settings for this variable.
* @returns ::NC_ENOTINDEFINE Not in define mode.
* @returns ::NC_EINVAL Invalid input
* @returns ::NC_EINVAL Invalid input, or zlib filter already applied
* to this var.
* @author Ed Hartnett
*/
int
@ -1194,9 +1198,13 @@ NC4_def_var_filter(int ncid, int varid, unsigned int id, size_t nparams,
#endif /* USE_PARALLEL */
#ifdef HAVE_H5Z_SZIP
if(id == H5Z_FILTER_SZIP) {
if(nparams != 2)
if (id == H5Z_FILTER_SZIP)
{
if (nparams != 2)
return NC_EFILTER; /* incorrect no. of parameters */
/* If zlib compression is already applied, return error. */
if (var->deflate)
return NC_EINVAL;
}
#else /*!HAVE_H5Z_SZIP*/
if(id == H5Z_FILTER_SZIP)