From ac31d397a8a82a0a5b5b1276025e55371c3c9972 Mon Sep 17 00:00:00 2001 From: Daniel Teske Date: Thu, 15 Jan 2015 16:34:53 +0100 Subject: 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 --- tools/qmlprofiler/qpacketprotocol.cpp | 16 ++-------------- 1 file changed, 2 insertions(+), 14 deletions(-) (limited to 'tools') 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 #include +#include // 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); } -- cgit v1.2.3