summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMuQun Yang <ymuqun@hdfgroup.org>2005-05-10 16:12:15 (GMT)
committerMuQun Yang <ymuqun@hdfgroup.org>2005-05-10 16:12:15 (GMT)
commitfec2c355da13444f9db68d82ccad9507b825348f (patch)
tree10955bf16da72e0131c50a5bb40832b021df8f84 /src
parentb6f01bff10d38867d7e00ffa3ec1297d13b7b499 (diff)
downloadhdf5-fec2c355da13444f9db68d82ccad9507b825348f.zip
hdf5-fec2c355da13444f9db68d82ccad9507b825348f.tar.gz
hdf5-fec2c355da13444f9db68d82ccad9507b825348f.tar.bz2
[svn-r10742] Purpose:
A little enhancement for integer datatype filter Description: Minimum-bit of the scaleoffset filter should not be less than 0, However, if the user accidently input a negative value for integer type, we will reset it to zero. Solution: Platforms tested: too minor to test. Misc. update:
Diffstat (limited to 'src')
-rw-r--r--src/H5Zscaleoffset.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/H5Zscaleoffset.c b/src/H5Zscaleoffset.c
index 4f668a6..da7df7f 100644
--- a/src/H5Zscaleoffset.c
+++ b/src/H5Zscaleoffset.c
@@ -974,8 +974,13 @@ H5Z_filter_scaleoffset (unsigned flags, size_t cd_nelmts, const unsigned cd_valu
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, 0, "scale type must be 0 or 1")
}
else if(dtype_class==H5Z_SCALEOFFSET_CLS_INTEGER) { /* integer type */
- if(scale_type==H5_SO_FLOAT_DSCALE || scale_type==H5_SO_FLOAT_ESCALE)
+ if(scale_type==H5_SO_FLOAT_DSCALE || scale_type==H5_SO_FLOAT_ESCALE) {
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, 0, "scale type cannot be 0 or 1")
+ /* check here when scale_factor is less than 0 for integer, library will reset it to 0
+ in this case, library will calculate the minimum-bits */
+ if(scale_factor < 0) scale_factor = 0;
+ }
+
}
if(scale_type==H5_SO_FLOAT_DSCALE) { /* floating-point type, variable-minimum-bits */