summaryrefslogtreecommitdiffstats
path: root/test/h5test.c
diff options
context:
space:
mode:
authorRobert E. McGrath <mcgrath@ncsa.uiuc.edu>2004-11-02 19:12:06 (GMT)
committerRobert E. McGrath <mcgrath@ncsa.uiuc.edu>2004-11-02 19:12:06 (GMT)
commit3f0abcc71f1803b59d8ca64b9ec642235fdfc1c9 (patch)
treecdad2edff464edf39f132edc8082615f1ca51738 /test/h5test.c
parentf7c4277bbbbe531ba37b36bb6b2e1b3f2966efea (diff)
downloadhdf5-3f0abcc71f1803b59d8ca64b9ec642235fdfc1c9.zip
hdf5-3f0abcc71f1803b59d8ca64b9ec642235fdfc1c9.tar.gz
hdf5-3f0abcc71f1803b59d8ca64b9ec642235fdfc1c9.tar.bz2
[svn-r9494] Purpose:
Fix SZIP filter to dynmically detect encoder. Description: Solution: See: http://hdf.ncsa.uiuc.edu/RFC/SZIP/Szip_dynamic_12_Oct.pdf Changes to library tests, contingent on detecting SZIP encoder.
Diffstat (limited to 'test/h5test.c')
-rw-r--r--test/h5test.c47
1 files changed, 47 insertions, 0 deletions
diff --git a/test/h5test.c b/test/h5test.c
index 042c763..5344fe2 100644
--- a/test/h5test.c
+++ b/test/h5test.c
@@ -799,3 +799,50 @@ print_func(const char *format, ...)
return ret_value;
}
+#ifdef H5_HAVE_FILTER_SZIP
+
+
+/*-------------------------------------------------------------------------
+ * Function: h5_szip_can_encode
+ *
+ * Purpose: Retrieve the filter config flags for szip, tell if
+ * encoder is available.
+ *
+ * Return: 1: decode+encode is enabled
+ * 0: only decode is enabled
+ * -1: other
+ *
+ * Programmer:
+ *
+ * Modifications:
+ *
+ *-------------------------------------------------------------------------
+ */
+int h5_szip_can_encode(void )
+{
+
+ herr_t status;
+ unsigned int filter_config_flags;
+
+ status =H5Zget_filter_info(H5Z_FILTER_SZIP, &filter_config_flags);
+ if ((filter_config_flags &
+ (H5Z_FILTER_CONFIG_ENCODE_ENABLED|H5Z_FILTER_CONFIG_DECODE_ENABLED)) == 0) {
+ /* filter present but neither encode nor decode is supported (???) */
+ return -1;
+ } else if ((filter_config_flags &
+ (H5Z_FILTER_CONFIG_ENCODE_ENABLED|H5Z_FILTER_CONFIG_DECODE_ENABLED)) ==
+ H5Z_FILTER_CONFIG_DECODE_ENABLED) {
+ /* decoder only: read but not write */
+ return 0;
+ } else if ((filter_config_flags &
+ (H5Z_FILTER_CONFIG_ENCODE_ENABLED|H5Z_FILTER_CONFIG_DECODE_ENABLED)) ==
+ H5Z_FILTER_CONFIG_ENCODE_ENABLED) {
+ /* encoder only: write but not read (???) */
+ return -1;
+ } else if ((filter_config_flags &
+ (H5Z_FILTER_CONFIG_ENCODE_ENABLED|H5Z_FILTER_CONFIG_DECODE_ENABLED)) ==
+ (H5Z_FILTER_CONFIG_ENCODE_ENABLED|H5Z_FILTER_CONFIG_DECODE_ENABLED)) {
+ return 1;
+ }
+}
+#endif /* H5_HAVE_FILTER_SZIP */