lwip-users
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [lwip-users] Strange "always true" conditional in tcp_in.c


From: Lou Cypher
Subject: Re: [lwip-users] Strange "always true" conditional in tcp_in.c
Date: Mon, 01 Mar 2010 09:31:31 +0100
User-agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; it; rv:1.9.1.8) Gecko/20100216 Thunderbird/3.0.2

> On line 883 of core/tcp_in.c is the somewhat strange construct...
> 883 :                  if (pcb->dupacks + 1 > pcb->dupacks)

That would be always true, indeed

> Perhaps what was meant was...
>   if( (u8_t)(pcb->dupacks+1) > ....
> 
> Even that is dubious since 1 is an int

I don't catch the sense of the last note.
The case above isn't always true, in fact it yields false when pcb->dupacks == 
0xFF.
May be that was the intended behavior? Then could have been shorter (and more
intuitive) checking for
  if( pcb->dupacks != 0xFF )
...

~ Lou





reply via email to

[Prev in Thread] Current Thread [Next in Thread]