RE: HPLIP 0.9.5: uninitialised variable bug

"Suffield, David" <[email protected]> Mon, 3 Oct 2005 16:45:18 -0700
Newsgroups gmane.linux.drivers.hpofficejet.devel
Message-ID <0EB0CFC9C4536543A1B1554960E879F702E57882@cacexc09.americas.cpqcorp.net>
The un-initialized variable "mode" causes no hplip problem because
ChannelMode is not use in the uni-di device class. But, to make gcc
happy I have fixed this up-stream.

ChannelMode =3D UNI_MODE;

-dave

> -----Original Message-----
> From: Till Kamppeter [mailto:[email protected]]=20
> Sent: Monday, October 03, 2005 5:42 AM
> To: Tim Waugh
> Cc: [email protected]; hplip; Suffield, David;=20
> Yie, Shiyun
> Subject: Re: [hpoj-devel] HPLIP 0.9.5: uninitialised variable bug
>=20
>=20
> For me this code has clearly a bug. Either there is a global "mode"=20
> variable, then the declaration  of "mode" must be removed, so=20
> that the=20
> global "mode" does not get overloaded or there is missing=20
> some code to=20
> give the "mode" variable a value.
>=20
>     Till
>=20
>=20
> Tim Waugh wrote:
> > Hi,
> >=20
> > This warning:
> >=20
> > io/hpiod/uppdevice.cpp:192: warning: 'mode' is used=20
> uninitialized in=20
> > this function
> >=20
> > corresponds to this function:
> >=20
> > Channel *UniParDevice::NewChannel(unsigned char sockid)
> > {
> >    Channel *pC=3DNULL;
> >    int i, mode;
> >=20
> >    /* Only support one channel. */
> >    if (ChannelCnt >=3D 1)
> >       goto bugout;
> >=20
> >    /* Look for unused slot in channel array. Note, slot 0=20
> is unused. */
> >    for (i=3D1; i<MAX_CHANNEL; i++)
> >    {
> >       if (pChannel[i] =3D=3D NULL)
> >       {
> >          pC =3D new RawChannel(this);  /* constructor sets=20
> ClientCnt=3D1 */
> >          pC->SetIndex(i);
> >          pC->SetSocketID(sockid);
> >          pChannel[i] =3D pC;
> >          ChannelCnt++;
> >          ChannelMode =3D mode;
> >          break;
> >       }
> >    }    =20
> >=20
> > bugout:
> >    return pC;
> > }
> >=20
> > As you can see, 'mode' is indeed never initialised.  What=20
> is meant to=20
> > happen here?
> >=20
> > Tim.
> > */
>=20
>=20


-------------------------------------------------------
This SF.Net email is sponsored by:
Power Architecture Resource Center: Free content, downloads, discussions,
and more. http://solutions.newsforge.com/ibmarch.tmpl