[sane-devel] uninitialized variables in sane-backends
Johannes Meixner
jsmeix at suse.de
Thu Jan 5 12:57:43 UTC 2006
Hello,
in sane-backends 1.0.17 our compiler recognized the following
uninitialized variables which I simply initialized with 0:
===================================================================
--- backend/umax_pp_low.c.orig 2004-10-08 12:01:29.000000000 +0200
+++ backend/umax_pp_low.c 2005-05-17 15:01:59.000000000 +0200
@@ -6136,7 +6136,7 @@
int
sanei_umax_pp_initScanner (int recover)
{
- int i, j;
+ int i, j = 0;
int status;
int readcmd[64];
/* in umax1220u, this buffer is opc[16] */
--- backend/genesys.c.orig 2006-01-03 11:57:23.000000000 +0100
+++ backend/genesys.c 2006-01-03 12:04:25.000000000 +0100
@@ -2686,7 +2686,7 @@
u_int8_t channels;
int x, j, o;
unsigned int i;
- unsigned int coeff, target_code, val, avgpixels, dk, words_per_color;
+ unsigned int coeff, target_code, val, avgpixels, dk, words_per_color = 0;
DBG (DBG_proc, "genesys_send_shading_coefficient\n");
===================================================================
In umax_pp_low.c in it seems j is incremented but never used
so that it might be better to remove j at all.
In genesys.c it might be better to change the switch which
sets words_per_color so that there is a default case.
Kind Regards
Johannes Meixner
--
SUSE LINUX Products GmbH, Maxfeldstrasse 5 Mail: jsmeix at suse.de
90409 Nuernberg, Germany WWW: http://www.suse.de/
More information about the sane-devel
mailing list