aboutsummaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorDaniel Teske <daniel.teske@theqtcompany.com>2015-01-15 16:34:53 +0100
committerDaniel Teske <daniel.teske@theqtcompany.com>2015-04-14 15:20:46 +0000
commitac31d397a8a82a0a5b5b1276025e55371c3c9972 (patch)
tree4834bb3592666bc15e14da3aaf1437cfdf8827fa /tools
parent181824f2497b3c874acce0f4a54a5580ee64ea90 (diff)
Use qt_subtract_from_timeout instead of duplicating qt_timeout_value
The same function was duplicated 5 times in qtbase, so create one copy to rule them all and use it also in QtDeclarative. Change-Id: I4e39a7ee0541ce4fe9710cea344e537ee011bbe9 Reviewed-by: Kai Koehne <kai.koehne@theqtcompany.com>
Diffstat (limited to 'tools')
-rw-r--r--tools/qmlprofiler/qpacketprotocol.cpp16
1 files changed, 2 insertions, 14 deletions
diff --git a/tools/qmlprofiler/qpacketprotocol.cpp b/tools/qmlprofiler/qpacketprotocol.cpp
index dc4df69442..65cb9f15ae 100644
--- a/tools/qmlprofiler/qpacketprotocol.cpp
+++ b/tools/qmlprofiler/qpacketprotocol.cpp
@@ -35,6 +35,7 @@
#include <QtCore/QBuffer>
#include <QtCore/QElapsedTimer>
+#include <private/qiodevice_p.h> // for qt_subtract_from_timeout
static const unsigned int MAX_PACKET_SIZE = 0x7FFFFFFF;
@@ -316,19 +317,6 @@ QPacket QPacketProtocol::read()
return rv;
}
-/*
- Returns the difference between msecs and elapsed. If msecs is -1,
- however, -1 is returned.
-*/
-static int qt_timeout_value(int msecs, int elapsed)
-{
- if (msecs == -1)
- return -1;
-
- int timeout = msecs - elapsed;
- return timeout < 0 ? 0 : timeout;
-}
-
/*!
This function locks until a new packet is available for reading and the
\l{QIODevice::}{readyRead()} signal has been emitted. The function
@@ -354,7 +342,7 @@ bool QPacketProtocol::waitForReadyRead(int msecs)
return false;
if (!d->waitingForPacket)
return true;
- msecs = qt_timeout_value(msecs, stopWatch.elapsed());
+ msecs = qt_subtract_from_timeout(msecs, stopWatch.elapsed());
} while (true);
}