gpsd-dev
[Top][All Lists]
Advanced

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

RE: Problems with miss-behaving uBlox Module


From: Neustifter Andreas
Subject: RE: Problems with miss-behaving uBlox Module
Date: Wed, 31 Mar 2021 07:02:33 +0000

Hi,

> From: gpsd-dev <gpsd-dev-bounces+andreas.neustifter=kapsch.net@nongnu.org> On 
> Behalf Of Gary E. Miller - Sent: Dienstag, 30. März 2021 07:50
>
> > Philosophical topic: since lexer->length is a (unsigned) size_t I
> > think the else branch will never be executed. In this case: do you
> > prefer leaving the else in there, just in case or remove it (and maybe
> > add a comment?).
>
> I think you are talking about this code:
>
>         if (0 == lexer->length) {
>             // no payload
>             lexer->state = UBX_CHECKSUM_A;
>         } else if (MAX_PACKET_LENGTH >= lexer->length) {
>             // normal size payload
>             lexer->state = UBX_LENGTH_2;
>         } else {
>             // bad length
>             return character_pushback(lexer, GROUND_STATE);
>         }
>
> In that case the else can happen if the length is too long.  Coverity is 
> pretty
> fussy about having tests like that.

Ah, overlooked that one, sorry. I get Yoda-style for equality checks (to 
prevent inadvertent assignments), for everything else they trip me up each and 
every time.

Andreas



The information contained in this e-mail message is privileged and confidential 
and is for the exclusive use of the addressee. The person who receives this 
message and who is not the addressee, one of his employees or an agent entitled 
to hand it over to the addressee, is informed that he may not use, disclose or 
reproduce the contents thereof, and is kindly asked to notify the sender and 
delete the e-mail immediately.




reply via email to

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