[sane-devel] wrong assumption on char signedness

Jaeger, Gerhard gerhard@gjaeger.de
Tue, 15 Oct 2002 20:01:18 +0200


Thanks for the patch,

I'll check that and will apply or correct in any other way...
Gerhard

On Tuesday, 15. October 2002 15:32, Aurelien Jarno wrote:
> Hi all,
>
> In backends/plustek-usbshading.c, in function usb_GetNewOffset, there
> is
>
> if( pcOffset[dw] >= 0 )
>
> pcOffset[dw] is defined as char. On some architectures (at least arm,
> powerpc and s390), char is per default unsigned on. This causes a
> warning on compilation ("warning: comparison is always true due to
> limited range of data type"), and may cause some errors at run time.
>
> I have made a small patch, but I am not sure it corrects everything.
>
> Regards,
> Aurelien
>> On Mon, 14 Oct 2002, Jaeger, Gerhard wrote:
> > Hi,
> >
> > can you please check the latest 0.44-8. The problem
> > should be solved so far!
> >
> > Gerhard

> diff -u -1 -b -p -u -r1.9 plustek-usbshading.c
> --- plustek-usbshading.c        2002/10/04 17:55:51     1.9
> +++ plustek-usbshading.c        2002/10/15 10:47:13
> @@ -719,3 +719,3 @@ TOGAIN:
>   */
> -static void usb_GetNewOffset( u_long *pdwSum, u_long *pdwDiff, char
> *pcOffset,
> +static void usb_GetNewOffset( u_long *pdwSum, u_long *pdwDiff, signed
> char *pcOffset,
>                                                   u_char *pIdeal,
> u_long dw, char cAdjust )
> @@ -766,3 +766,3 @@ static SANE_Bool usb_AdjustOffset( pPlus
>         char   cAdjust = 16;
> -       char   cOffset[3];
> +       signed char   cOffset[3];
>         u_char bExpect[3];