For me this code has clearly a bug. Either there is a global "mode"
variable, then the declaration of "mode" must be removed, so that the
global "mode" does not get overloaded or there is missing some code to
give the "mode" variable a value.
Till
Tim Waugh wrote:
> Hi,
>
> This warning:
>
> io/hpiod/uppdevice.cpp:192: warning: 'mode' is used uninitialized in
> this function
>
> corresponds to this function:
>
> Channel *UniParDevice::NewChannel(unsigned char sockid)
> {
> Channel *pC=NULL;
> int i, mode;
>
> /* Only support one channel. */
> if (ChannelCnt >= 1)
> goto bugout;
>
> /* Look for unused slot in channel array. Note, slot 0 is unused. */
> for (i=1; i<MAX_CHANNEL; i++)
> {
> if (pChannel[i] == NULL)
> {
> pC = new RawChannel(this); /* constructor sets ClientCnt=1 */
> pC->SetIndex(i);
> pC->SetSocketID(sockid);
> pChannel[i] = pC;
> ChannelCnt++;
> ChannelMode = mode;
> break;
> }
> }
>
> bugout:
> return pC;
> }
>
> As you can see, 'mode' is indeed never initialised. What is meant to
> happen here?
>
> Tim.
> */
|