Firefox

Firefox-logo.svg

A typo

V593 Consider reviewing the expression of the ‘A = B < C' kind. The expression is calculated as following: 'A = (B < C)'. datachannel.cpp 1105

bool DataChannelConnection::SendDeferredMessages()
{
  ....
  if ((result = usrsctp_sendv(mSocket, data, ...., 0) < 0)) {
  ....
}

A parenthesis is written in a wrong place. Let’s simplify the expression to make the mistake clearer:

if ((result = foo() < 0))

This expression is calculated in the following way. The result returned by the function is compared to 0; then true or false is written into the ‘result’ variable. The mistake is about one of the closing parentheses written in a wrong place. The programmer actually meant the expression to look as follows:

if ((result = foo()) < 0)

In this case, the result returned by the function is first written into the ‘result’ variable and only then is compared to 0.

Please click here to see more bugs from this project.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s