[sane-devel] Fix for backend/epson.c

Aurelien Jarno lists@aurel32.net
Sun, 8 Dec 2002 11:49:22 +0100


--ibTvN161/egqYuK8
Content-Type: text/plain; charset=iso-8859-15
Content-Disposition: inline

Hi all,

H i have received a bug report via the Debian BTS.

In backend/epson.c, lines 823 and 905, there is the following code:

     const u_char * s = buf;

     for( k = 0; k < buf_size; k++) {
       DBG( 125, "buf[%u] %02x %c\n", k, s[k], isprint( s[k]) ? s[k] : '.');

The second argument passed to DBG, s[k], is a char, but the compiler is
tell to read an int. It seems to work in most case, but it mail fail on
some architectures.

The following patch should fix the problem.

Aurelien


Index: epson.c
===================================================================
RCS file: /cvsroot/external/sane/sane-backends/backend/epson.c,v
retrieving revision 1.34
diff -u -1 -b -p -r1.34 epson.c
--- epson.c     2002/12/07 12:00:15     1.34
+++ epson.c     2002/12/08 10:41:34
@@ -832,3 +832,3 @@ send(Epson_Scanner * s, void *buf, size_
                {
-                       DBG( 125, "buf[%u] %02x %c\n", k, s[ k],
+                       DBG( 125, "buf[%u] %02hhx %c\n", k, s[ k],
                                        isprint( s[ k]) ? s[ k] : '.');
@@ -904,3 +904,3 @@ receive(Epson_Scanner * s, void *buf, ss
                for( k = 0; k < n; k++) {
-                       DBG( 127, "buf[%u] %02x %c\n", k, s[ k], isprint( s[ k]) ? s[ k] : '.');
+                       DBG( 127, "buf[%u] %02hhx %c\n", k, s[ k], isprint( s[ k]) ? s[ k] : '.');
                }

--ibTvN161/egqYuK8
Content-Type: application/pgp-signature
Content-Disposition: inline

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.0 (GNU/Linux)

iD8DBQE98yOyw3ao2vG823MRAn4VAJ9A8nxUXJv7OlKfQ1eoj2HjrJI16wCgjEGr
a7FevtOmz+xH5Oqmz+HTM1s=
=BrIz
-----END PGP SIGNATURE-----

--ibTvN161/egqYuK8--