From 798c96412a6e7e0db0713831675f4f0cda7e3c94 Mon Sep 17 00:00:00 2001 From: Ilia Sotnikov Date: Sat, 3 Oct 2009 13:25:05 +0300 Subject: [PATCH] Use own private function instead of roundf() --- ChangeLog | 3 +++ backend/epjitsu.c | 9 ++++++++- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 89db5a7dd..7cb2b6f66 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,6 @@ +2009-10-03 Ilia Sotnikov + * backend/epjitsu.c: use own private function instead of roundf() + 2009-10-02 Stéphane Voltz * backend/genesys_gl646.c: honor GENESYS_NO_CALIBRATION device flag when setting registers for final scan diff --git a/backend/epjitsu.c b/backend/epjitsu.c index 5eb80c2b5..c3e78fb89 100644 --- a/backend/epjitsu.c +++ b/backend/epjitsu.c @@ -2902,6 +2902,13 @@ finecal_get_line(struct scanner *s, struct image *img) return ret; } +/* roundf() is c99, so we provide our own, though this version wont return -0 */ +static float +round2(float x) +{ + return (float)(x >= 0.0) ? (int)(x+0.5) : (int)(x-0.5); +} + static SANE_Status finecal(struct scanner *s) { @@ -3017,7 +3024,7 @@ finecal(struct scanner *s) gain_slope[idx] *= 0.75; last_error[idx] = pixerror; /* set the new gain */ - newgain = oldgain + (int) roundf(pixerror * gain_slope[idx]); + newgain = oldgain + (int) round2(pixerror * gain_slope[idx]); if (newgain < 0) { low_pegs++;