From: Suffield, D. <dav...@hp...> - 2005-10-03 23:45:29
|
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:til...@gm...]=20 > Sent: Monday, October 03, 2005 5:42 AM > To: Tim Waugh > Cc: hpo...@li...; 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 |