summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorQuincey Koziol <koziol@hdfgroup.org>2004-12-30 14:52:51 (GMT)
committerQuincey Koziol <koziol@hdfgroup.org>2004-12-30 14:52:51 (GMT)
commit12a728c05af4d7af04ce805324854ef2599d0f12 (patch)
tree68eeee474a0f38296e4a845a6989a4e19f03b1d0 /src
parentc47ff1656fa52bca192e9f1b830863e2d549e382 (diff)
downloadhdf5-12a728c05af4d7af04ce805324854ef2599d0f12.zip
hdf5-12a728c05af4d7af04ce805324854ef2599d0f12.tar.gz
hdf5-12a728c05af4d7af04ce805324854ef2599d0f12.tar.bz2
[svn-r9732] Purpose:
Bug fix Description: szip tests were failing due to a few "H5_SZIP_CAN_ENCODE" ifdefs still lying around in the source code. Solution: Eliminate compile time testing by using new SZ_encoder_enabled() routine at run time. Platforms tested: FreeBSD 4.10 (sleipnir) w/szip
Diffstat (limited to 'src')
-rw-r--r--src/H5Pdcpl.c14
-rw-r--r--src/H5Z.c12
-rw-r--r--src/H5Zszip.c4
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)
diff --git a/src/H5Z.c b/src/H5Z.c
index 87fe166..6e958f2 100644
--- a/src/H5Z.c
+++ b/src/H5Z.c
@@ -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")