Examples: Fix stringification of the Qt version

(QT_VERSION % 0xffff00) is useless for now, as QT_VERSION < 0x1000000
(for now). The author of this code probably meant to use bitwise-AND.
But even that is unnecessary as the right shift discards the lower 8
bits anyway.

Change-Id: Ie585843cfb684bc3b6e3fffd145d533b05288dfc
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
This commit is contained in:
Thiago Macieira 2016-07-01 17:49:26 -07:00
parent 946c1a578a
commit 3b5db8f3a6

View File

@ -78,7 +78,7 @@ QByteArray ConnectionManager::clientId() const
// Generate peer id
int startupTime = int(QDateTime::currentDateTime().toTime_t());
id += QString::asprintf("-QT%04x-", (QT_VERSION % 0xffff00) >> 8).toLatin1();
id += QString::asprintf("-QT%04x-", QT_VERSION >> 8).toLatin1();
id += QByteArray::number(startupTime, 10);
id += QByteArray(20 - id.size(), '-');
}