Unified · Split
| @@ -148,7 +148,7 @@ sinc_get_description (int src_enum) · 147 unmodified lines | |||
| 148 | int | 148 | int |
| 149 | sinc_set_converter (SRC_PRIVATE *psrc, int src_enum) | 149 | sinc_set_converter (SRC_PRIVATE *psrc, int src_enum) |
| 150 | { SINC_FILTER *filter, temp_filter ; | 150 | { SINC_FILTER *filter, temp_filter ; |
| 151 | int count ; | 151 | int count, bits ; |
| 152 | 152 | ||
| 153 | /* Quick sanity check. */ | 153 | /* Quick sanity check. */ |
| 154 | if (SHIFT_BITS >= sizeof (increment_t) * 8 - 1) | 154 | if (SHIFT_BITS >= sizeof (increment_t) * 8 - 1) |
| @@ -217,9 +217,11 @@ sinc_set_converter (SRC_PRIVATE *psrc, int src_enum) · 62 unmodified lines | |||
| 217 | 217 | ||
| 218 | sinc_reset (psrc) ; | 218 | sinc_reset (psrc) ; |
| 219 | 219 | ||
| 220 | count = lrint ((filter->coeff_half_len * INT_TO_FP (1)) / FP_ONE) ; | 220 | count = filter->coeff_half_len ; |
| 221 | for (bits = 0 ; (1 << bits) < count ; bits++) | ||
| 222 | count |= (1 << bits) ; | ||
| 221 | 223 | ||
| 222 | if (abs (count - filter->coeff_half_len) >= 1) | 224 | if (bits + SHIFT_BITS - 1 >= (int) (sizeof (increment_t) * 8)) |
| 223 | return SRC_ERR_FILTER_LEN ; | 225 | return SRC_ERR_FILTER_LEN ; |
| 224 | 226 | ||
| 225 | return SRC_ERR_NO_ERROR ; | 227 | return SRC_ERR_NO_ERROR ; |