[sane-devel] wrong assumption on char signedness
Aurelien Jarno
ml at aurel32.net
Tue Oct 15 14:32:45 BST 2002
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
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
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];
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.6 (GNU/Linux)
Comment: For info see http://www.gnupg.org
iD8DBQE9rBkAw3ao2vG823MRAuu9AJ4rdLlIs5o+nzWz+Y7AzLErdWDyAwCeMcld
dG5kZBRwXvvkjywR4syZA2U=
=fu0A
-----END PGP SIGNATURE-----
More information about the sane-devel
mailing list