[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:
This commit is contained in:
MuQun Yang 2005-05-10 11:12:15 -05:00
parent b6f01bff10
commit fec2c355da

View File

@ -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 */