Skip to content

Commit

Permalink
[tests] Fix undefined behavior. MER#1749
Browse files Browse the repository at this point in the history
Compiler warns about both incrementing and testing the same variable in
a single expression sequence.

Move the pre-increment out of the sequence.

Signed-off-by: Simo Piiroinen <simo.piiroinen@jollamobile.com>
  • Loading branch information
spiiroin committed Feb 7, 2017
1 parent 49f2022 commit 346882b
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions tests/client/clientapitest.cpp
Expand Up @@ -920,8 +920,9 @@ TestClient::~TestClient()
void TestClient::dataAvailable(const MagneticField&)
{
QTime now = QTime::currentTime();
++dataCount;
qDebug() << "dataAvailable() "
<< ++dataCount << " in "
<< dataCount << " in "
<< (dataCount > -1 ? m_exTimeData.msecsTo(now) : 0)
<< " ms" ;
m_exTimeData = now;
Expand All @@ -943,8 +944,9 @@ void TestClient::frameAvailable(const QVector<MagneticField>& frame)
void TestClient::dataAvailable2(const XYZ&)
{
QTime now = QTime::currentTime();
++dataCount;
qDebug() << "dataAvailable() "
<< ++dataCount
<< dataCount
<< " in "
<< (dataCount > -1 ? m_exTimeData.msecsTo(now) : 0)
<< " ms";
Expand Down

0 comments on commit 346882b

Please sign in to comment.