[sane-devel] [sane-commit] [SCM] SANE backends - scanner drivers branch, master, updated. gitconversion-218-g798c964

m. allan noah kitno455 at gmail.com
Sat Oct 3 12:15:37 UTC 2009


this is funny- i add that function to someone else's backend, and Ilia
adds it to one of mine. That is what i get for accepting user's
patches :)

Thanks Ilia!

allan

On Sat, Oct 3, 2009 at 6:24 AM, Ilia Sotnikov <hostcc at gmail.com> wrote:
> The following commit has been merged in the master branch:
> commit 798c96412a6e7e0db0713831675f4f0cda7e3c94
> Author: Ilia Sotnikov <hostcc at gmail.com>
> Date:   Sat Oct 3 13:25:05 2009 +0300
>
>    Use own private function instead of roundf()
>
> diff --git a/ChangeLog b/ChangeLog
> index 89db5a7..7cb2b6f 100644
> --- a/ChangeLog
> +++ b/ChangeLog
> @@ -1,3 +1,6 @@
> +2009-10-03  Ilia Sotnikov <hostcc at gmail.com>
> +       * backend/epjitsu.c: use own private function instead of roundf()
> +
>  2009-10-02  Stéphane Voltz <stef.dev at free.fr>
>        * 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 5eb80c2..c3e78fb 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++;
>
> --
> SANE backends - scanner drivers
>
>
> _______________________________________________
> sane-commit mailing list
> sane-commit at lists.alioth.debian.org
> http://lists.alioth.debian.org/mailman/listinfo/sane-commit
>



-- 
"The truth is an offense, but not a sin"



More information about the sane-devel mailing list