diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/H5Pdcpl.c | 14 | ||||
-rw-r--r-- | src/H5Z.c | 12 | ||||
-rw-r--r-- | src/H5Zszip.c | 4 |
3 files changed, 19 insertions, 11 deletions
diff --git a/src/H5Pdcpl.c b/src/H5Pdcpl.c index 1751436..f249901 100644 --- a/src/H5Pdcpl.c +++ b/src/H5Pdcpl.c @@ -27,6 +27,12 @@ #include "H5Ppkg.h" /* Property lists */ #include "H5Zprivate.h" /* Data filters */ +#ifdef H5_HAVE_FILTER_SZIP +#ifdef H5_HAVE_SZLIB_H +# include "szlib.h" +#endif /* H5_HAVE_SZLIB_H */ +#endif /* H5_HAVE_FILTER_SZIP */ + /* Local datatypes */ /* Static function prototypes */ @@ -1083,9 +1089,11 @@ H5Pset_szip(hid_t plist_id, unsigned options_mask, unsigned pixels_per_block) H5TRACE3("e","iIuIu",plist_id,options_mask,pixels_per_block); /* Check arguments */ -#if !defined( H5_SZIP_CAN_ENCODE) && defined(H5_HAVE_FILTER_SZIP) - HGOTO_ERROR (H5E_PLINE, H5E_NOENCODER, FAIL, "Szip filter present but encoding disabled"); -#endif +#ifdef H5_HAVE_FILTER_SZIP + if(SZ_encoder_enabled()<=0) + HGOTO_ERROR(H5E_PLINE, H5E_NOENCODER, FAIL, "Filter present but encoding is disabled."); +#endif /* H5_HAVE_FILTER_SZIP */ + if ((pixels_per_block%2)==1) HGOTO_ERROR (H5E_ARGS, H5E_BADVALUE, FAIL, "pixels_per_block is not even"); if (pixels_per_block>H5_SZIP_MAX_PIXELS_PER_BLOCK) @@ -573,11 +573,6 @@ H5Z_prelude_callback(hid_t dcpl_id, hid_t type_id, H5Z_prelude_type_t prelude_ty /* Check if there is a "can apply" callback */ if(fclass->can_apply) { herr_t status; -#ifndef H5_SZIP_CAN_ENCODE - /* If this is the Szip filter, make sure it can encode */ - if (dcpl_pline.filter[u].id == H5Z_FILTER_SZIP) - HGOTO_ERROR(H5E_PLINE, H5E_NOENCODER, FAIL, "Filter present but encoding is disabled"); -#endif /* Make callback to filter's "can apply" function */ status=(fclass->can_apply)(dcpl_id, type_id, space_id); @@ -1242,9 +1237,10 @@ herr_t H5Zget_filter_info(H5Z_filter_t filter, unsigned int *filter_config_flags if (filter == H5Z_FILTER_SZIP) { *filter_config_flags = 0; -#ifdef H5_SZIP_CAN_ENCODE - *filter_config_flags |= H5Z_FILTER_CONFIG_ENCODE_ENABLED; -#endif +#ifdef H5_HAVE_FILTER_SZIP + if(SZ_encoder_enabled()>0) + *filter_config_flags |= H5Z_FILTER_CONFIG_ENCODE_ENABLED; +#endif /* H5_HAVE_FILTER_SZIP */ *filter_config_flags |= H5Z_FILTER_CONFIG_DECODE_ENABLED; } else diff --git a/src/H5Zszip.c b/src/H5Zszip.c index 64dbf70..79fc721 100644 --- a/src/H5Zszip.c +++ b/src/H5Zszip.c @@ -89,6 +89,10 @@ H5Z_can_apply_szip(hid_t UNUSED dcpl_id, hid_t type_id, hid_t UNUSED space_id) FUNC_ENTER_NOAPI(H5Z_can_apply_szip, FAIL) + /* If this is the Szip filter, make sure it can encode */ + if (SZ_encoder_enabled()<=0) + HGOTO_ERROR(H5E_PLINE, H5E_NOENCODER, FAIL, "Filter present but encoding is disabled."); + /* Get datatype's size, for checking the "bits-per-pixel" */ if((dtype_size=(8*H5Tget_size(type_id)))==0) HGOTO_ERROR(H5E_PLINE, H5E_BADTYPE, FAIL, "bad datatype size") |