From 3b5db8f3a6663fd65d74da875a6d22c430c2e4f7 Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Fri, 1 Jul 2016 17:49:26 -0700 Subject: 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) --- examples/network/torrent/connectionmanager.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/network/torrent/connectionmanager.cpp b/examples/network/torrent/connectionmanager.cpp index fa10251749..0e15c226b8 100644 --- a/examples/network/torrent/connectionmanager.cpp +++ b/examples/network/torrent/connectionmanager.cpp @@ -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(), '-'); } -- cgit v1.2.3