diff options
author | Quincey Koziol <koziol@hdfgroup.org> | 2010-01-28 13:11:38 (GMT) |
---|---|---|
committer | Quincey Koziol <koziol@hdfgroup.org> | 2010-01-28 13:11:38 (GMT) |
commit | 3360c3af0c100ac4d3a2fe2865f34661da862ec5 (patch) | |
tree | 9caf7dba62679504aa39ec02ebb72d8b8b5a848d /tools/lib/h5tools_filters.c | |
parent | 5b4d3279099e7e4fad6e0092c77aa93dfd35d616 (diff) | |
download | hdf5-3360c3af0c100ac4d3a2fe2865f34661da862ec5.zip hdf5-3360c3af0c100ac4d3a2fe2865f34661da862ec5.tar.gz hdf5-3360c3af0c100ac4d3a2fe2865f34661da862ec5.tar.bz2 |
[svn-r18175] Description:
Bring r17986:18172 from trunk to revise_chunks branch.
Tested on:
FreeBSD/32 6.3 (duty) in debug mode
FreeBSD/64 6.3 (liberty) w/C++ & FORTRAN, in debug mode
Linux/32 2.6 (jam) w/PGI compilers, w/default API=1.8.x,
w/C++ & FORTRAN, w/threadsafe, in debug mode
Linux/64-amd64 2.6 (amani) w/Intel compilers, w/default API=1.6.x,
w/C++ & FORTRAN, in production mode
Solaris/32 2.10 (linew) w/deprecated symbols disabled, w/C++ & FORTRAN,
w/szip filter, in production mode
Linux/64-ia64 2.6 (cobalt) w/Intel compilers, w/C++ & FORTRAN,
in production mode
Linux/64-ia64 2.4 (tg-login3) w/parallel, w/FORTRAN, in debug mode
Linux/64-amd64 2.6 (abe) w/parallel, w/FORTRAN, in production mode
Diffstat (limited to 'tools/lib/h5tools_filters.c')
-rw-r--r-- | tools/lib/h5tools_filters.c | 120 |
1 files changed, 30 insertions, 90 deletions
diff --git a/tools/lib/h5tools_filters.c b/tools/lib/h5tools_filters.c index 325023d..341a5c9 100644 --- a/tools/lib/h5tools_filters.c +++ b/tools/lib/h5tools_filters.c @@ -49,31 +49,6 @@ int h5tools_canreadf(const char* name, /* object name, serves also as boolean pr int nfilters; /* number of filters */ H5Z_filter_t filtn; /* filter identification number */ int i; /* index */ - int have_deflate=0; /* assume initially we do not have filters */ - int have_szip=0; - int have_shuffle=0; - int have_fletcher=0; - int have_nbit=0; - int have_scaleoffset=0; - -#ifdef H5_HAVE_FILTER_DEFLATE - have_deflate=1; -#endif -#ifdef H5_HAVE_FILTER_SZIP - have_szip=1; -#endif -#ifdef H5_HAVE_FILTER_SHUFFLE - have_shuffle=1; -#endif -#ifdef H5_HAVE_FILTER_FLETCHER32 - have_fletcher=1; -#endif -#ifdef H5_HAVE_FILTER_NBIT - have_nbit=1; -#endif -#ifdef H5_HAVE_FILTER_SCALEOFFSET - have_scaleoffset=1; -#endif /* get information about filters */ @@ -106,72 +81,66 @@ int h5tools_canreadf(const char* name, /* object name, serves also as boolean pr *------------------------------------------------------------------------- */ case H5Z_FILTER_DEFLATE: - if (!have_deflate) - { +#ifndef H5_HAVE_FILTER_DEFLATE if (name) print_warning(name,"deflate"); return 0; - } +#endif break; /*------------------------------------------------------------------------- * H5Z_FILTER_SZIP 4 , szip compression *------------------------------------------------------------------------- */ case H5Z_FILTER_SZIP: - if (!have_szip) - { +#ifndef H5_HAVE_FILTER_SZIP if (name) print_warning(name,"SZIP"); return 0; - } +#endif break; /*------------------------------------------------------------------------- * H5Z_FILTER_SHUFFLE 2 , shuffle the data *------------------------------------------------------------------------- */ case H5Z_FILTER_SHUFFLE: - if (!have_shuffle) - { +#ifndef H5_HAVE_FILTER_SHUFFLE if (name) print_warning(name,"shuffle"); return 0; - } +#endif break; /*------------------------------------------------------------------------- * H5Z_FILTER_FLETCHER32 3 , fletcher32 checksum of EDC *------------------------------------------------------------------------- */ case H5Z_FILTER_FLETCHER32: - if (!have_fletcher) - { +#ifndef H5_HAVE_FILTER_FLETCHER32 if (name) print_warning(name,"fletcher32"); return 0; - } +#endif break; /*------------------------------------------------------------------------- * H5Z_FILTER_NBIT *------------------------------------------------------------------------- */ case H5Z_FILTER_NBIT: - if (!have_nbit) - { +#ifndef H5_HAVE_FILTER_NBIT if (name) print_warning(name,"nbit"); return 0; - } +#endif break; /*------------------------------------------------------------------------- * H5Z_FILTER_SCALEOFFSET *------------------------------------------------------------------------- */ case H5Z_FILTER_SCALEOFFSET: - if (!have_scaleoffset) - { +#ifndef H5_HAVE_FILTER_SCALEOFFSET if (name) print_warning(name,"scaleoffset"); return 0; - } +#endif break; }/*switch*/ }/*for*/ @@ -197,34 +166,6 @@ int h5tools_canreadf(const char* name, /* object name, serves also as boolean pr */ int h5tools_can_encode( H5Z_filter_t filtn) { - - int have_deflate=0; /* assume initially we do not have filters */ - int have_szip=0; - int have_shuffle=0; - int have_fletcher=0; - int have_nbit=0; - int have_scaleoffset=0; - unsigned int filter_config_flags; - -#ifdef H5_HAVE_FILTER_DEFLATE - have_deflate=1; -#endif -#ifdef H5_HAVE_FILTER_SZIP - have_szip=1; -#endif -#ifdef H5_HAVE_FILTER_SHUFFLE - have_shuffle=1; -#endif -#ifdef H5_HAVE_FILTER_FLETCHER32 - have_fletcher=1; -#endif -#ifdef H5_HAVE_FILTER_NBIT - have_nbit=1; -#endif -#ifdef H5_HAVE_FILTER_SCALEOFFSET - have_scaleoffset=1; -#endif - switch (filtn) { /* user defined filter */ @@ -232,16 +173,17 @@ int h5tools_can_encode( H5Z_filter_t filtn) return 0; case H5Z_FILTER_DEFLATE: - if (!have_deflate) - { - return 0; - } +#ifndef H5_HAVE_FILTER_DEFLATE + return 0; +#endif break; case H5Z_FILTER_SZIP: - if (!have_szip) +#ifndef H5_HAVE_FILTER_SZIP + return 0; +#else { - return 0; - } + unsigned int filter_config_flags; + if(H5Zget_filter_info(filtn, &filter_config_flags)<0) return -1; if ((filter_config_flags & @@ -263,30 +205,28 @@ int h5tools_can_encode( H5Z_filter_t filtn) (H5Z_FILTER_CONFIG_ENCODE_ENABLED|H5Z_FILTER_CONFIG_DECODE_ENABLED)) { return 1; } + } +#endif break; case H5Z_FILTER_SHUFFLE: - if (!have_shuffle) - { +#ifndef H5_HAVE_FILTER_SHUFFLE return 0; - } +#endif break; case H5Z_FILTER_FLETCHER32: - if (!have_fletcher) - { +#ifndef H5_HAVE_FILTER_FLETCHER32 return 0; - } +#endif break; case H5Z_FILTER_NBIT: - if (!have_nbit) - { +#ifndef H5_HAVE_FILTER_NBIT return 0; - } +#endif break; case H5Z_FILTER_SCALEOFFSET: - if (!have_scaleoffset) - { +#ifndef H5_HAVE_FILTER_SCALEOFFSET return 0; - } +#endif break; }/*switch*/ |