qringbuffer.cpp

Absolute File Name:/home/qt/qt5_coco/qt5/qtbase/src/corelib/tools/qringbuffer.cpp
Switch to Source codePreprocessed file
LineSourceCount
1-
2-
3-
4const char *QRingBuffer::readPointerAtPosition(qint64 pos, qint64 &length) const-
5{-
6 if (pos >= 0
pos >= 0Description
TRUEevaluated 904 times by 2 tests
Evaluated by:
  • tst_QNetworkReply
  • tst_QRingBuffer
FALSEnever evaluated
) {
0-904
7 pos += head;-
8 for (int i = 0; i < buffers.size()
i < buffers.size()Description
TRUEevaluated 926 times by 2 tests
Evaluated by:
  • tst_QNetworkReply
  • tst_QRingBuffer
FALSEevaluated 3 times by 1 test
Evaluated by:
  • tst_QRingBuffer
; ++i) {
3-926
9 length = (i == tailBuffer
i == tailBufferDescription
TRUEevaluated 182 times by 2 tests
Evaluated by:
  • tst_QNetworkReply
  • tst_QRingBuffer
FALSEevaluated 744 times by 2 tests
Evaluated by:
  • tst_QNetworkReply
  • tst_QRingBuffer
? tail : buffers[i].size());
182-744
10 if (length > pos
length > posDescription
TRUEevaluated 901 times by 2 tests
Evaluated by:
  • tst_QNetworkReply
  • tst_QRingBuffer
FALSEevaluated 25 times by 1 test
Evaluated by:
  • tst_QRingBuffer
) {
25-901
11 length -= pos;-
12 return
executed 901 times by 2 tests: return buffers[i].constData() + pos;
Executed by:
  • tst_QNetworkReply
  • tst_QRingBuffer
buffers[i].constData() + pos;
executed 901 times by 2 tests: return buffers[i].constData() + pos;
Executed by:
  • tst_QNetworkReply
  • tst_QRingBuffer
901
13 }-
14 pos -= length;-
15 }
executed 25 times by 1 test: end of block
Executed by:
  • tst_QRingBuffer
25
16 }
executed 3 times by 1 test: end of block
Executed by:
  • tst_QRingBuffer
3
17-
18 length = 0;-
19 return
executed 3 times by 1 test: return 0;
Executed by:
  • tst_QRingBuffer
0;
executed 3 times by 1 test: return 0;
Executed by:
  • tst_QRingBuffer
3
20}-
21-
22void QRingBuffer::free(qint64 bytes)-
23{-
24 while (bytes > 0
bytes > 0Description
TRUEevaluated 49496 times by 73 tests
Evaluated by:
  • tst_Lancelot
  • tst_NetworkSelfTest
  • tst_QAbstractNetworkCache
  • tst_QColorDialog
  • tst_QDBusConnection
  • tst_QDBusConnection_SpyHook
  • tst_QDataStream
  • tst_QDir
  • tst_QEventLoop
  • tst_QFile
  • tst_QFileDialog2
  • tst_QFileInfo
  • tst_QFileSystemModel
  • tst_QFileSystemWatcher
  • tst_QFiledialog
  • tst_QFont
  • tst_QFtp
  • tst_QGraphicsProxyWidget
  • tst_QGuiEventLoop
  • tst_QHttpNetworkConnection
  • tst_QHttpSocketEngine
  • tst_QIODevice
  • tst_QImage
  • tst_QImageReader
  • tst_QImageWriter
  • ...
FALSEevaluated 1283 times by 12 tests
Evaluated by:
  • tst_QHttpSocketEngine
  • tst_QLocalSocket
  • tst_QNetworkReply
  • tst_QProcess
  • tst_QRingBuffer
  • tst_QSharedPointer
  • tst_QSslSocket
  • tst_QTcpSocket
  • tst_Selftests
  • tst_Spdy
  • tst_qdbuscpp2xml
  • tst_rcc
) {
1283-49496
25 const qint64 blockSize = buffers.first().size() - head;-
26-
27 if (tailBuffer == 0
tailBuffer == 0Description
TRUEevaluated 48497 times by 73 tests
Evaluated by:
  • tst_Lancelot
  • tst_NetworkSelfTest
  • tst_QAbstractNetworkCache
  • tst_QColorDialog
  • tst_QDBusConnection
  • tst_QDBusConnection_SpyHook
  • tst_QDataStream
  • tst_QDir
  • tst_QEventLoop
  • tst_QFile
  • tst_QFileDialog2
  • tst_QFileInfo
  • tst_QFileSystemModel
  • tst_QFileSystemWatcher
  • tst_QFiledialog
  • tst_QFont
  • tst_QFtp
  • tst_QGraphicsProxyWidget
  • tst_QGuiEventLoop
  • tst_QHttpNetworkConnection
  • tst_QHttpSocketEngine
  • tst_QIODevice
  • tst_QImage
  • tst_QImageReader
  • tst_QImageWriter
  • ...
FALSEevaluated 999 times by 8 tests
Evaluated by:
  • tst_QLocalSocket
  • tst_QNetworkReply
  • tst_QProcess
  • tst_QRingBuffer
  • tst_QSharedPointer
  • tst_Selftests
  • tst_qdbuscpp2xml
  • tst_rcc
|| blockSize > bytes
blockSize > bytesDescription
TRUEevaluated 527 times by 4 tests
Evaluated by:
  • tst_QProcess
  • tst_QRingBuffer
  • tst_QSharedPointer
  • tst_Selftests
FALSEevaluated 472 times by 8 tests
Evaluated by:
  • tst_QLocalSocket
  • tst_QNetworkReply
  • tst_QProcess
  • tst_QRingBuffer
  • tst_QSharedPointer
  • tst_Selftests
  • tst_qdbuscpp2xml
  • tst_rcc
) {
472-48497
28-
29-
30-
31 if (bufferSize <= bytes
bufferSize <= bytesDescription
TRUEevaluated 47992 times by 73 tests
Evaluated by:
  • tst_Lancelot
  • tst_NetworkSelfTest
  • tst_QAbstractNetworkCache
  • tst_QColorDialog
  • tst_QDBusConnection
  • tst_QDBusConnection_SpyHook
  • tst_QDataStream
  • tst_QDir
  • tst_QEventLoop
  • tst_QFile
  • tst_QFileDialog2
  • tst_QFileInfo
  • tst_QFileSystemModel
  • tst_QFileSystemWatcher
  • tst_QFiledialog
  • tst_QFont
  • tst_QFtp
  • tst_QGraphicsProxyWidget
  • tst_QGuiEventLoop
  • tst_QHttpNetworkConnection
  • tst_QHttpSocketEngine
  • tst_QIODevice
  • tst_QImage
  • tst_QImageReader
  • tst_QImageWriter
  • ...
FALSEevaluated 1032 times by 7 tests
Evaluated by:
  • tst_QNetworkReply
  • tst_QProcess
  • tst_QRingBuffer
  • tst_QSharedPointer
  • tst_QSslSocket
  • tst_QTcpSocket
  • tst_Selftests
) {
1032-47992
32 if (buffers.first().size() <= basicBlockSize
buffers.first(...basicBlockSizeDescription
TRUEevaluated 47590 times by 73 tests
Evaluated by:
  • tst_Lancelot
  • tst_NetworkSelfTest
  • tst_QAbstractNetworkCache
  • tst_QColorDialog
  • tst_QDBusConnection
  • tst_QDBusConnection_SpyHook
  • tst_QDataStream
  • tst_QDir
  • tst_QEventLoop
  • tst_QFile
  • tst_QFileDialog2
  • tst_QFileInfo
  • tst_QFileSystemModel
  • tst_QFileSystemWatcher
  • tst_QFiledialog
  • tst_QFont
  • tst_QFtp
  • tst_QGraphicsProxyWidget
  • tst_QGuiEventLoop
  • tst_QHttpNetworkConnection
  • tst_QHttpSocketEngine
  • tst_QIODevice
  • tst_QImage
  • tst_QImageReader
  • tst_QImageWriter
  • ...
FALSEevaluated 402 times by 8 tests
Evaluated by:
  • tst_QImageReader
  • tst_QNetworkReply
  • tst_QProcess
  • tst_QSharedPointer
  • tst_QSslSocket
  • tst_QTcpSocket
  • tst_Selftests
  • tst_Spdy
) {
402-47590
33 bufferSize = 0;-
34 head = tail = 0;-
35 }
executed 47590 times by 73 tests: end of block
Executed by:
  • tst_Lancelot
  • tst_NetworkSelfTest
  • tst_QAbstractNetworkCache
  • tst_QColorDialog
  • tst_QDBusConnection
  • tst_QDBusConnection_SpyHook
  • tst_QDataStream
  • tst_QDir
  • tst_QEventLoop
  • tst_QFile
  • tst_QFileDialog2
  • tst_QFileInfo
  • tst_QFileSystemModel
  • tst_QFileSystemWatcher
  • tst_QFiledialog
  • tst_QFont
  • tst_QFtp
  • tst_QGraphicsProxyWidget
  • tst_QGuiEventLoop
  • tst_QHttpNetworkConnection
  • tst_QHttpSocketEngine
  • tst_QIODevice
  • tst_QImage
  • tst_QImageReader
  • tst_QImageWriter
  • ...
else {
47590
36 clear();-
37 }
executed 402 times by 8 tests: end of block
Executed by:
  • tst_QImageReader
  • tst_QNetworkReply
  • tst_QProcess
  • tst_QSharedPointer
  • tst_QSslSocket
  • tst_QTcpSocket
  • tst_Selftests
  • tst_Spdy
402
38 } else {-
39 ((!(bytes < MaxByteArraySize)) ? qt_assert("bytes < MaxByteArraySize",__FILE__,83) : qt_noop());-
40 head += int(bytes);-
41 bufferSize -= bytes;-
42 }
executed 1032 times by 7 tests: end of block
Executed by:
  • tst_QNetworkReply
  • tst_QProcess
  • tst_QRingBuffer
  • tst_QSharedPointer
  • tst_QSslSocket
  • tst_QTcpSocket
  • tst_Selftests
1032
43 return;
executed 49024 times by 73 tests: return;
Executed by:
  • tst_Lancelot
  • tst_NetworkSelfTest
  • tst_QAbstractNetworkCache
  • tst_QColorDialog
  • tst_QDBusConnection
  • tst_QDBusConnection_SpyHook
  • tst_QDataStream
  • tst_QDir
  • tst_QEventLoop
  • tst_QFile
  • tst_QFileDialog2
  • tst_QFileInfo
  • tst_QFileSystemModel
  • tst_QFileSystemWatcher
  • tst_QFiledialog
  • tst_QFont
  • tst_QFtp
  • tst_QGraphicsProxyWidget
  • tst_QGuiEventLoop
  • tst_QHttpNetworkConnection
  • tst_QHttpSocketEngine
  • tst_QIODevice
  • tst_QImage
  • tst_QImageReader
  • tst_QImageWriter
  • ...
49024
44 }-
45-
46 bufferSize -= blockSize;-
47 bytes -= blockSize;-
48 buffers.removeFirst();-
49 --tailBuffer;-
50 head = 0;-
51 }
executed 472 times by 8 tests: end of block
Executed by:
  • tst_QLocalSocket
  • tst_QNetworkReply
  • tst_QProcess
  • tst_QRingBuffer
  • tst_QSharedPointer
  • tst_Selftests
  • tst_qdbuscpp2xml
  • tst_rcc
472
52}
executed 1283 times by 12 tests: end of block
Executed by:
  • tst_QHttpSocketEngine
  • tst_QLocalSocket
  • tst_QNetworkReply
  • tst_QProcess
  • tst_QRingBuffer
  • tst_QSharedPointer
  • tst_QSslSocket
  • tst_QTcpSocket
  • tst_Selftests
  • tst_Spdy
  • tst_qdbuscpp2xml
  • tst_rcc
1283
53-
54char *QRingBuffer::reserve(qint64 bytes)-
55{-
56 if (bytes <= 0
bytes <= 0Description
TRUEevaluated 27 times by 8 tests
Evaluated by:
  • tst_QFile
  • tst_QHttpSocketEngine
  • tst_QNetworkReply
  • tst_QSharedPointer
  • tst_QTextStream
  • tst_qdbusxml2cpp
  • tst_qmakelib
  • tst_qnetworkreply - unknown status
FALSEevaluated 202012 times by 83 tests
Evaluated by:
  • tst_Lancelot
  • tst_NetworkSelfTest
  • tst_QAbstractNetworkCache
  • tst_QApplication
  • tst_QColorDialog
  • tst_QDBusAbstractAdaptor
  • tst_QDBusAbstractInterface
  • tst_QDBusConnection
  • tst_QDBusConnection_SpyHook
  • tst_QDBusInterface
  • tst_QDBusMarshall
  • tst_QDataStream
  • tst_QDir
  • tst_QEventLoop
  • tst_QFile
  • tst_QFileDialog2
  • tst_QFileInfo
  • tst_QFileSystemModel
  • tst_QFileSystemWatcher
  • tst_QFiledialog
  • tst_QFont
  • tst_QFtp
  • tst_QGraphicsProxyWidget
  • tst_QGuiEventLoop
  • tst_QHttpNetworkConnection
  • ...
|| bytes >= MaxByteArraySize
bytes >= MaxByteArraySizeDescription
TRUEnever evaluated
FALSEevaluated 202012 times by 83 tests
Evaluated by:
  • tst_Lancelot
  • tst_NetworkSelfTest
  • tst_QAbstractNetworkCache
  • tst_QApplication
  • tst_QColorDialog
  • tst_QDBusAbstractAdaptor
  • tst_QDBusAbstractInterface
  • tst_QDBusConnection
  • tst_QDBusConnection_SpyHook
  • tst_QDBusInterface
  • tst_QDBusMarshall
  • tst_QDataStream
  • tst_QDir
  • tst_QEventLoop
  • tst_QFile
  • tst_QFileDialog2
  • tst_QFileInfo
  • tst_QFileSystemModel
  • tst_QFileSystemWatcher
  • tst_QFiledialog
  • tst_QFont
  • tst_QFtp
  • tst_QGraphicsProxyWidget
  • tst_QGuiEventLoop
  • tst_QHttpNetworkConnection
  • ...
)
0-202012
57 return
executed 27 times by 8 tests: return 0;
Executed by:
  • tst_QFile
  • tst_QHttpSocketEngine
  • tst_QNetworkReply
  • tst_QSharedPointer
  • tst_QTextStream
  • tst_qdbusxml2cpp
  • tst_qmakelib
  • tst_qnetworkreply - unknown status
0;
executed 27 times by 8 tests: return 0;
Executed by:
  • tst_QFile
  • tst_QHttpSocketEngine
  • tst_QNetworkReply
  • tst_QSharedPointer
  • tst_QTextStream
  • tst_qdbusxml2cpp
  • tst_qmakelib
  • tst_qnetworkreply - unknown status
27
58-
59 const qint64 newSize = bytes + tail;-
60-
61 if (newSize > buffers.last().size()
newSize > buff....last().size()Description
TRUEevaluated 23888 times by 83 tests
Evaluated by:
  • tst_Lancelot
  • tst_NetworkSelfTest
  • tst_QAbstractNetworkCache
  • tst_QApplication
  • tst_QColorDialog
  • tst_QDBusAbstractAdaptor
  • tst_QDBusAbstractInterface
  • tst_QDBusConnection
  • tst_QDBusConnection_SpyHook
  • tst_QDBusInterface
  • tst_QDBusMarshall
  • tst_QDataStream
  • tst_QDir
  • tst_QEventLoop
  • tst_QFile
  • tst_QFileDialog2
  • tst_QFileInfo
  • tst_QFileSystemModel
  • tst_QFileSystemWatcher
  • tst_QFiledialog
  • tst_QFont
  • tst_QFtp
  • tst_QGraphicsProxyWidget
  • tst_QGuiEventLoop
  • tst_QHttpNetworkConnection
  • ...
FALSEevaluated 178124 times by 65 tests
Evaluated by:
  • tst_Lancelot
  • tst_NetworkSelfTest
  • tst_QAbstractNetworkCache
  • tst_QColorDialog
  • tst_QDBusAbstractAdaptor
  • tst_QDBusAbstractInterface
  • tst_QDBusConnection
  • tst_QDBusConnection_SpyHook
  • tst_QDBusInterface
  • tst_QDBusMarshall
  • tst_QDataStream
  • tst_QFile
  • tst_QFileDialog2
  • tst_QFileInfo
  • tst_QFiledialog
  • tst_QFont
  • tst_QFtp
  • tst_QGraphicsProxyWidget
  • tst_QHttpNetworkConnection
  • tst_QHttpSocketEngine
  • tst_QIODevice
  • tst_QImage
  • tst_QImageReader
  • tst_QImageWriter
  • tst_QLocalSocket
  • ...
) {
23888-178124
62 if (newSize > buffers.last().capacity()
newSize > buff...t().capacity()Description
TRUEevaluated 11033 times by 83 tests
Evaluated by:
  • tst_Lancelot
  • tst_NetworkSelfTest
  • tst_QAbstractNetworkCache
  • tst_QApplication
  • tst_QColorDialog
  • tst_QDBusAbstractAdaptor
  • tst_QDBusAbstractInterface
  • tst_QDBusConnection
  • tst_QDBusConnection_SpyHook
  • tst_QDBusInterface
  • tst_QDBusMarshall
  • tst_QDataStream
  • tst_QDir
  • tst_QEventLoop
  • tst_QFile
  • tst_QFileDialog2
  • tst_QFileInfo
  • tst_QFileSystemModel
  • tst_QFileSystemWatcher
  • tst_QFiledialog
  • tst_QFont
  • tst_QFtp
  • tst_QGraphicsProxyWidget
  • tst_QGuiEventLoop
  • tst_QHttpNetworkConnection
  • ...
FALSEevaluated 12855 times by 7 tests
Evaluated by:
  • tst_QNetworkReply
  • tst_QProcess
  • tst_QRingBuffer
  • tst_QSharedPointer
  • tst_QSslSocket
  • tst_Selftests
  • tst_qmake
&& (tail >= basicBlockSize
tail >= basicBlockSizeDescription
TRUEevaluated 661 times by 9 tests
Evaluated by:
  • tst_QLocalSocket
  • tst_QNetworkReply
  • tst_QProcess
  • tst_QRingBuffer
  • tst_QSharedPointer
  • tst_Selftests
  • tst_qdbuscpp2xml
  • tst_qmake
  • tst_rcc
FALSEevaluated 10372 times by 83 tests
Evaluated by:
  • tst_Lancelot
  • tst_NetworkSelfTest
  • tst_QAbstractNetworkCache
  • tst_QApplication
  • tst_QColorDialog
  • tst_QDBusAbstractAdaptor
  • tst_QDBusAbstractInterface
  • tst_QDBusConnection
  • tst_QDBusConnection_SpyHook
  • tst_QDBusInterface
  • tst_QDBusMarshall
  • tst_QDataStream
  • tst_QDir
  • tst_QEventLoop
  • tst_QFile
  • tst_QFileDialog2
  • tst_QFileInfo
  • tst_QFileSystemModel
  • tst_QFileSystemWatcher
  • tst_QFiledialog
  • tst_QFont
  • tst_QFtp
  • tst_QGraphicsProxyWidget
  • tst_QGuiEventLoop
  • tst_QHttpNetworkConnection
  • ...
661-12855
63 || newSize >= MaxByteArraySize
newSize >= MaxByteArraySizeDescription
TRUEnever evaluated
FALSEevaluated 10372 times by 83 tests
Evaluated by:
  • tst_Lancelot
  • tst_NetworkSelfTest
  • tst_QAbstractNetworkCache
  • tst_QApplication
  • tst_QColorDialog
  • tst_QDBusAbstractAdaptor
  • tst_QDBusAbstractInterface
  • tst_QDBusConnection
  • tst_QDBusConnection_SpyHook
  • tst_QDBusInterface
  • tst_QDBusMarshall
  • tst_QDataStream
  • tst_QDir
  • tst_QEventLoop
  • tst_QFile
  • tst_QFileDialog2
  • tst_QFileInfo
  • tst_QFileSystemModel
  • tst_QFileSystemWatcher
  • tst_QFiledialog
  • tst_QFont
  • tst_QFtp
  • tst_QGraphicsProxyWidget
  • tst_QGuiEventLoop
  • tst_QHttpNetworkConnection
  • ...
)) {
0-10372
64-
65 buffers.last().resize(tail);-
66-
67-
68 buffers.append(QByteArray());-
69 ++tailBuffer;-
70 tail = 0;-
71 }
executed 661 times by 9 tests: end of block
Executed by:
  • tst_QLocalSocket
  • tst_QNetworkReply
  • tst_QProcess
  • tst_QRingBuffer
  • tst_QSharedPointer
  • tst_Selftests
  • tst_qdbuscpp2xml
  • tst_qmake
  • tst_rcc
661
72 buffers.last().resize(qMax(basicBlockSize, tail + int(bytes)));-
73 }
executed 23888 times by 83 tests: end of block
Executed by:
  • tst_Lancelot
  • tst_NetworkSelfTest
  • tst_QAbstractNetworkCache
  • tst_QApplication
  • tst_QColorDialog
  • tst_QDBusAbstractAdaptor
  • tst_QDBusAbstractInterface
  • tst_QDBusConnection
  • tst_QDBusConnection_SpyHook
  • tst_QDBusInterface
  • tst_QDBusMarshall
  • tst_QDataStream
  • tst_QDir
  • tst_QEventLoop
  • tst_QFile
  • tst_QFileDialog2
  • tst_QFileInfo
  • tst_QFileSystemModel
  • tst_QFileSystemWatcher
  • tst_QFiledialog
  • tst_QFont
  • tst_QFtp
  • tst_QGraphicsProxyWidget
  • tst_QGuiEventLoop
  • tst_QHttpNetworkConnection
  • ...
23888
74-
75 char *writePtr = buffers.last().data() + tail;-
76 bufferSize += bytes;-
77 ((!(bytes < MaxByteArraySize)) ? qt_assert("bytes < MaxByteArraySize",__FILE__,121) : qt_noop());-
78 tail += int(bytes);-
79 return
executed 202012 times by 83 tests: return writePtr;
Executed by:
  • tst_Lancelot
  • tst_NetworkSelfTest
  • tst_QAbstractNetworkCache
  • tst_QApplication
  • tst_QColorDialog
  • tst_QDBusAbstractAdaptor
  • tst_QDBusAbstractInterface
  • tst_QDBusConnection
  • tst_QDBusConnection_SpyHook
  • tst_QDBusInterface
  • tst_QDBusMarshall
  • tst_QDataStream
  • tst_QDir
  • tst_QEventLoop
  • tst_QFile
  • tst_QFileDialog2
  • tst_QFileInfo
  • tst_QFileSystemModel
  • tst_QFileSystemWatcher
  • tst_QFiledialog
  • tst_QFont
  • tst_QFtp
  • tst_QGraphicsProxyWidget
  • tst_QGuiEventLoop
  • tst_QHttpNetworkConnection
  • ...
writePtr;
executed 202012 times by 83 tests: return writePtr;
Executed by:
  • tst_Lancelot
  • tst_NetworkSelfTest
  • tst_QAbstractNetworkCache
  • tst_QApplication
  • tst_QColorDialog
  • tst_QDBusAbstractAdaptor
  • tst_QDBusAbstractInterface
  • tst_QDBusConnection
  • tst_QDBusConnection_SpyHook
  • tst_QDBusInterface
  • tst_QDBusMarshall
  • tst_QDataStream
  • tst_QDir
  • tst_QEventLoop
  • tst_QFile
  • tst_QFileDialog2
  • tst_QFileInfo
  • tst_QFileSystemModel
  • tst_QFileSystemWatcher
  • tst_QFiledialog
  • tst_QFont
  • tst_QFtp
  • tst_QGraphicsProxyWidget
  • tst_QGuiEventLoop
  • tst_QHttpNetworkConnection
  • ...
202012
80}-
81-
82-
83-
84-
85-
86-
87char *QRingBuffer::reserveFront(qint64 bytes)-
88{-
89 if (bytes <= 0
bytes <= 0Description
TRUEnever evaluated
FALSEevaluated 265 times by 2 tests
Evaluated by:
  • tst_QProcess
  • tst_QRingBuffer
|| bytes >= MaxByteArraySize
bytes >= MaxByteArraySizeDescription
TRUEnever evaluated
FALSEevaluated 265 times by 2 tests
Evaluated by:
  • tst_QProcess
  • tst_QRingBuffer
)
0-265
90 return
never executed: return 0;
0;
never executed: return 0;
0
91-
92 if (head < bytes
head < bytesDescription
TRUEevaluated 19 times by 2 tests
Evaluated by:
  • tst_QProcess
  • tst_QRingBuffer
FALSEevaluated 246 times by 1 test
Evaluated by:
  • tst_QRingBuffer
) {
19-246
93 buffers.first().remove(0, head);-
94 if (tailBuffer == 0
tailBuffer == 0Description
TRUEevaluated 12 times by 2 tests
Evaluated by:
  • tst_QProcess
  • tst_QRingBuffer
FALSEevaluated 7 times by 1 test
Evaluated by:
  • tst_QRingBuffer
)
7-12
95 tail -= head;
executed 12 times by 2 tests: tail -= head;
Executed by:
  • tst_QProcess
  • tst_QRingBuffer
12
96-
97 head = qMax(basicBlockSize, int(bytes));-
98 if (bufferSize == 0
bufferSize == 0Description
TRUEevaluated 10 times by 2 tests
Evaluated by:
  • tst_QProcess
  • tst_QRingBuffer
FALSEevaluated 9 times by 1 test
Evaluated by:
  • tst_QRingBuffer
) {
9-10
99 tail = head;-
100 }
executed 10 times by 2 tests: end of block
Executed by:
  • tst_QProcess
  • tst_QRingBuffer
else {
10
101 buffers.prepend(QByteArray());-
102 ++tailBuffer;-
103 }
executed 9 times by 1 test: end of block
Executed by:
  • tst_QRingBuffer
9
104 buffers.first().resize(head);-
105 }
executed 19 times by 2 tests: end of block
Executed by:
  • tst_QProcess
  • tst_QRingBuffer
19
106-
107 head -= int(bytes);-
108 bufferSize += bytes;-
109 return
executed 265 times by 2 tests: return buffers.first().data() + head;
Executed by:
  • tst_QProcess
  • tst_QRingBuffer
buffers.first().data() + head;
executed 265 times by 2 tests: return buffers.first().data() + head;
Executed by:
  • tst_QProcess
  • tst_QRingBuffer
265
110}-
111-
112void QRingBuffer::chop(qint64 bytes)-
113{-
114 while (bytes > 0
bytes > 0Description
TRUEevaluated 3660 times by 30 tests
Evaluated by:
  • tst_Lancelot
  • tst_QApplication
  • tst_QDBusAbstractAdaptor
  • tst_QDBusAbstractInterface
  • tst_QDBusConnection
  • tst_QDBusConnection_SpyHook
  • tst_QDBusInterface
  • tst_QDBusMarshall
  • tst_QDir
  • tst_QFont
  • tst_QMimeDatabase
  • tst_QNetworkReply
  • tst_QNetworkSession
  • tst_QObject
  • tst_QProcess
  • tst_QProcess_and_GuiEventLoop
  • tst_QRingBuffer
  • tst_QSharedMemory
  • tst_QSharedPointer
  • tst_QSystemSemaphore
  • tst_QUuid
  • tst_Selftests
  • tst_qdbuscpp2xml
  • tst_qdbusxml2cpp
  • tst_qmake
  • ...
FALSEevaluated 34687 times by 25 tests
Evaluated by:
  • tst_Lancelot
  • tst_QDBusAbstractAdaptor
  • tst_QDBusAbstractInterface
  • tst_QDBusConnection
  • tst_QDBusConnection_SpyHook
  • tst_QDBusInterface
  • tst_QDBusMarshall
  • tst_QFont
  • tst_QMimeDatabase
  • tst_QNetworkReply
  • tst_QNetworkSession
  • tst_QObject
  • tst_QProcess
  • tst_QProcess_and_GuiEventLoop
  • tst_QSharedPointer
  • tst_QUuid
  • tst_Selftests
  • tst_qdbuscpp2xml
  • tst_qdbusxml2cpp
  • tst_qmake
  • tst_qmakelib
  • tst_qmessagehandler
  • tst_qprocess - unknown status
  • tst_rcc
  • tst_uic
) {
3660-34687
115 if (tailBuffer == 0
tailBuffer == 0Description
TRUEevaluated 3574 times by 30 tests
Evaluated by:
  • tst_Lancelot
  • tst_QApplication
  • tst_QDBusAbstractAdaptor
  • tst_QDBusAbstractInterface
  • tst_QDBusConnection
  • tst_QDBusConnection_SpyHook
  • tst_QDBusInterface
  • tst_QDBusMarshall
  • tst_QDir
  • tst_QFont
  • tst_QMimeDatabase
  • tst_QNetworkReply
  • tst_QNetworkSession
  • tst_QObject
  • tst_QProcess
  • tst_QProcess_and_GuiEventLoop
  • tst_QRingBuffer
  • tst_QSharedMemory
  • tst_QSharedPointer
  • tst_QSystemSemaphore
  • tst_QUuid
  • tst_Selftests
  • tst_qdbuscpp2xml
  • tst_qdbusxml2cpp
  • tst_qmake
  • ...
FALSEevaluated 86 times by 6 tests
Evaluated by:
  • tst_QProcess
  • tst_QSharedPointer
  • tst_Selftests
  • tst_qdbuscpp2xml
  • tst_qmake
  • tst_rcc
|| tail > bytes
tail > bytesDescription
TRUEevaluated 79 times by 6 tests
Evaluated by:
  • tst_QProcess
  • tst_QSharedPointer
  • tst_Selftests
  • tst_qdbuscpp2xml
  • tst_qmake
  • tst_rcc
FALSEevaluated 7 times by 2 tests
Evaluated by:
  • tst_QProcess
  • tst_Selftests
) {
7-3574
116-
117-
118-
119 if (bufferSize <= bytes
bufferSize <= bytesDescription
TRUEevaluated 2635 times by 30 tests
Evaluated by:
  • tst_Lancelot
  • tst_QApplication
  • tst_QDBusAbstractAdaptor
  • tst_QDBusAbstractInterface
  • tst_QDBusConnection
  • tst_QDBusConnection_SpyHook
  • tst_QDBusInterface
  • tst_QDBusMarshall
  • tst_QDir
  • tst_QFont
  • tst_QMimeDatabase
  • tst_QNetworkReply
  • tst_QNetworkSession
  • tst_QObject
  • tst_QProcess
  • tst_QProcess_and_GuiEventLoop
  • tst_QRingBuffer
  • tst_QSharedMemory
  • tst_QSharedPointer
  • tst_QSystemSemaphore
  • tst_QUuid
  • tst_Selftests
  • tst_qdbuscpp2xml
  • tst_qdbusxml2cpp
  • tst_qmake
  • ...
FALSEevaluated 1018 times by 24 tests
Evaluated by:
  • tst_Lancelot
  • tst_QDBusAbstractAdaptor
  • tst_QDBusAbstractInterface
  • tst_QDBusInterface
  • tst_QDBusMarshall
  • tst_QFont
  • tst_QMimeDatabase
  • tst_QNetworkReply
  • tst_QNetworkSession
  • tst_QObject
  • tst_QProcess
  • tst_QProcess_and_GuiEventLoop
  • tst_QRingBuffer
  • tst_QSharedPointer
  • tst_QUuid
  • tst_Selftests
  • tst_qdbuscpp2xml
  • tst_qdbusxml2cpp
  • tst_qmake
  • tst_qmakelib
  • tst_qmessagehandler
  • tst_qprocess - unknown status
  • tst_rcc
  • tst_uic
) {
1018-2635
120 if (buffers.first().size() <= basicBlockSize
buffers.first(...basicBlockSizeDescription
TRUEevaluated 2634 times by 29 tests
Evaluated by:
  • tst_Lancelot
  • tst_QApplication
  • tst_QDBusAbstractAdaptor
  • tst_QDBusAbstractInterface
  • tst_QDBusConnection
  • tst_QDBusConnection_SpyHook
  • tst_QDBusInterface
  • tst_QDBusMarshall
  • tst_QDir
  • tst_QFont
  • tst_QMimeDatabase
  • tst_QNetworkReply
  • tst_QNetworkSession
  • tst_QObject
  • tst_QProcess
  • tst_QProcess_and_GuiEventLoop
  • tst_QSharedMemory
  • tst_QSharedPointer
  • tst_QSystemSemaphore
  • tst_QUuid
  • tst_Selftests
  • tst_qdbuscpp2xml
  • tst_qdbusxml2cpp
  • tst_qmake
  • tst_qmakelib
  • ...
FALSEevaluated 1 time by 1 test
Evaluated by:
  • tst_QRingBuffer
) {
1-2634
121 bufferSize = 0;-
122 head = tail = 0;-
123 }
executed 2634 times by 29 tests: end of block
Executed by:
  • tst_Lancelot
  • tst_QApplication
  • tst_QDBusAbstractAdaptor
  • tst_QDBusAbstractInterface
  • tst_QDBusConnection
  • tst_QDBusConnection_SpyHook
  • tst_QDBusInterface
  • tst_QDBusMarshall
  • tst_QDir
  • tst_QFont
  • tst_QMimeDatabase
  • tst_QNetworkReply
  • tst_QNetworkSession
  • tst_QObject
  • tst_QProcess
  • tst_QProcess_and_GuiEventLoop
  • tst_QSharedMemory
  • tst_QSharedPointer
  • tst_QSystemSemaphore
  • tst_QUuid
  • tst_Selftests
  • tst_qdbuscpp2xml
  • tst_qdbusxml2cpp
  • tst_qmake
  • tst_qmakelib
  • ...
else {
2634
124 clear();-
125 }
executed 1 time by 1 test: end of block
Executed by:
  • tst_QRingBuffer
1
126 } else {-
127 ((!(bytes < MaxByteArraySize)) ? qt_assert("bytes < MaxByteArraySize",__FILE__,171) : qt_noop());-
128 tail -= int(bytes);-
129 bufferSize -= bytes;-
130 }
executed 1018 times by 24 tests: end of block
Executed by:
  • tst_Lancelot
  • tst_QDBusAbstractAdaptor
  • tst_QDBusAbstractInterface
  • tst_QDBusInterface
  • tst_QDBusMarshall
  • tst_QFont
  • tst_QMimeDatabase
  • tst_QNetworkReply
  • tst_QNetworkSession
  • tst_QObject
  • tst_QProcess
  • tst_QProcess_and_GuiEventLoop
  • tst_QRingBuffer
  • tst_QSharedPointer
  • tst_QUuid
  • tst_Selftests
  • tst_qdbuscpp2xml
  • tst_qdbusxml2cpp
  • tst_qmake
  • tst_qmakelib
  • tst_qmessagehandler
  • tst_qprocess - unknown status
  • tst_rcc
  • tst_uic
1018
131 return;
executed 3653 times by 30 tests: return;
Executed by:
  • tst_Lancelot
  • tst_QApplication
  • tst_QDBusAbstractAdaptor
  • tst_QDBusAbstractInterface
  • tst_QDBusConnection
  • tst_QDBusConnection_SpyHook
  • tst_QDBusInterface
  • tst_QDBusMarshall
  • tst_QDir
  • tst_QFont
  • tst_QMimeDatabase
  • tst_QNetworkReply
  • tst_QNetworkSession
  • tst_QObject
  • tst_QProcess
  • tst_QProcess_and_GuiEventLoop
  • tst_QRingBuffer
  • tst_QSharedMemory
  • tst_QSharedPointer
  • tst_QSystemSemaphore
  • tst_QUuid
  • tst_Selftests
  • tst_qdbuscpp2xml
  • tst_qdbusxml2cpp
  • tst_qmake
  • ...
3653
132 }-
133-
134 bufferSize -= tail;-
135 bytes -= tail;-
136 buffers.removeLast();-
137 --tailBuffer;-
138 tail = buffers.last().size();-
139 }
executed 7 times by 2 tests: end of block
Executed by:
  • tst_QProcess
  • tst_Selftests
7
140}
executed 34687 times by 25 tests: end of block
Executed by:
  • tst_Lancelot
  • tst_QDBusAbstractAdaptor
  • tst_QDBusAbstractInterface
  • tst_QDBusConnection
  • tst_QDBusConnection_SpyHook
  • tst_QDBusInterface
  • tst_QDBusMarshall
  • tst_QFont
  • tst_QMimeDatabase
  • tst_QNetworkReply
  • tst_QNetworkSession
  • tst_QObject
  • tst_QProcess
  • tst_QProcess_and_GuiEventLoop
  • tst_QSharedPointer
  • tst_QUuid
  • tst_Selftests
  • tst_qdbuscpp2xml
  • tst_qdbusxml2cpp
  • tst_qmake
  • tst_qmakelib
  • tst_qmessagehandler
  • tst_qprocess - unknown status
  • tst_rcc
  • tst_uic
34687
141-
142void QRingBuffer::clear()-
143{-
144 buffers.erase(buffers.begin() + 1, buffers.end());-
145 buffers.first().clear();-
146-
147 head = tail = 0;-
148 tailBuffer = 0;-
149 bufferSize = 0;-
150}
executed 72606 times by 210 tests: end of block
Executed by:
  • tst_Lancelot
  • tst_LargeFile
  • tst_NetworkSelfTest
  • tst_QAbstractFileEngine
  • tst_QAbstractItemView
  • tst_QAbstractNetworkCache
  • tst_QAbstractPrintDialog
  • tst_QAbstractScrollArea
  • tst_QAccessibility
  • tst_QApplication
  • tst_QBrush
  • tst_QButtonGroup
  • tst_QByteArray
  • tst_QCalendarWidget
  • tst_QChar
  • tst_QColorDialog
  • tst_QColumnView
  • tst_QComboBox
  • tst_QCommandLineParser
  • tst_QCommandLinkButton
  • tst_QCompleter
  • tst_QCryptographicHash
  • tst_QCssParser
  • tst_QDBusAbstractAdaptor
  • tst_QDBusAbstractInterface
  • ...
72606
151-
152qint64 QRingBuffer::indexOf(char c, qint64 maxLength) const-
153{-
154 qint64 index = 0;-
155 qint64 j = head;-
156 for (int i = 0; index < maxLength
index < maxLengthDescription
TRUEevaluated 6467 times by 1 test
Evaluated by:
  • tst_QRingBuffer
FALSEevaluated 256 times by 2 tests
Evaluated by:
  • tst_QProcess
  • tst_QRingBuffer
&& i < buffers.size()
i < buffers.size()Description
TRUEevaluated 6467 times by 1 test
Evaluated by:
  • tst_QRingBuffer
FALSEnever evaluated
; ++i) {
0-6467
157 const char *ptr = buffers[i].constData() + j;-
158 j = qMin(index + (i == tailBuffer ? tail : buffers[i].size()) - j, maxLength);-
159-
160 while (index < j
index < jDescription
TRUEevaluated 97702 times by 1 test
Evaluated by:
  • tst_QRingBuffer
FALSEevaluated 5954 times by 1 test
Evaluated by:
  • tst_QRingBuffer
) {
5954-97702
161 if (*
*ptr++ == cDescription
TRUEevaluated 513 times by 1 test
Evaluated by:
  • tst_QRingBuffer
FALSEevaluated 97189 times by 1 test
Evaluated by:
  • tst_QRingBuffer
ptr++ == c
*ptr++ == cDescription
TRUEevaluated 513 times by 1 test
Evaluated by:
  • tst_QRingBuffer
FALSEevaluated 97189 times by 1 test
Evaluated by:
  • tst_QRingBuffer
)
513-97189
162 return
executed 513 times by 1 test: return index;
Executed by:
  • tst_QRingBuffer
index;
executed 513 times by 1 test: return index;
Executed by:
  • tst_QRingBuffer
513
163 ++index;-
164 }
executed 97189 times by 1 test: end of block
Executed by:
  • tst_QRingBuffer
97189
165 j = 0;-
166 }
executed 5954 times by 1 test: end of block
Executed by:
  • tst_QRingBuffer
5954
167 return
executed 256 times by 2 tests: return -1;
Executed by:
  • tst_QProcess
  • tst_QRingBuffer
-1;
executed 256 times by 2 tests: return -1;
Executed by:
  • tst_QProcess
  • tst_QRingBuffer
256
168}-
169-
170qint64 QRingBuffer::read(char *data, qint64 maxLength)-
171{-
172 const qint64 bytesToRead = qMin(size(), maxLength);-
173 qint64 readSoFar = 0;-
174 while (readSoFar < bytesToRead
readSoFar < bytesToReadDescription
TRUEevaluated 513 times by 1 test
Evaluated by:
  • tst_QRingBuffer
FALSEevaluated 513 times by 1 test
Evaluated by:
  • tst_QRingBuffer
) {
513
175 const qint64 bytesToReadFromThisBlock = qMin(bytesToRead - readSoFar,-
176 nextDataBlockSize());-
177 if (data
dataDescription
TRUEevaluated 513 times by 1 test
Evaluated by:
  • tst_QRingBuffer
FALSEnever evaluated
)
0-513
178 memcpy(data + readSoFar, readPointer(), bytesToReadFromThisBlock);
executed 513 times by 1 test: memcpy(data + readSoFar, readPointer(), bytesToReadFromThisBlock);
Executed by:
  • tst_QRingBuffer
513
179 readSoFar += bytesToReadFromThisBlock;-
180 free(bytesToReadFromThisBlock);-
181 }
executed 513 times by 1 test: end of block
Executed by:
  • tst_QRingBuffer
513
182 return
executed 513 times by 1 test: return readSoFar;
Executed by:
  • tst_QRingBuffer
readSoFar;
executed 513 times by 1 test: return readSoFar;
Executed by:
  • tst_QRingBuffer
513
183}-
184-
185-
186-
187-
188-
189-
190QByteArray QRingBuffer::read()-
191{-
192 if (bufferSize == 0
bufferSize == 0Description
TRUEnever evaluated
FALSEevaluated 3 times by 1 test
Evaluated by:
  • tst_QRingBuffer
)
0-3
193 return
never executed: return QByteArray();
QByteArray();
never executed: return QByteArray();
0
194-
195 QByteArray qba(buffers.takeFirst());-
196-
197 qba.reserve(0);-
198 if (tailBuffer == 0
tailBuffer == 0Description
TRUEevaluated 1 time by 1 test
Evaluated by:
  • tst_QRingBuffer
FALSEevaluated 2 times by 1 test
Evaluated by:
  • tst_QRingBuffer
) {
1-2
199 qba.resize(tail);-
200 tail = 0;-
201 buffers.append(QByteArray());-
202 }
executed 1 time by 1 test: end of block
Executed by:
  • tst_QRingBuffer
else {
1
203 --tailBuffer;-
204 }
executed 2 times by 1 test: end of block
Executed by:
  • tst_QRingBuffer
2
205 qba.remove(0, head);-
206 head = 0;-
207 bufferSize -= qba.size();-
208 return
executed 3 times by 1 test: return qba;
Executed by:
  • tst_QRingBuffer
qba;
executed 3 times by 1 test: return qba;
Executed by:
  • tst_QRingBuffer
3
209}-
210-
211-
212-
213-
214-
215-
216qint64 QRingBuffer::peek(char *data, qint64 maxLength, qint64 pos) const-
217{-
218 qint64 readSoFar = 0;-
219-
220 if (pos >= 0
pos >= 0Description
TRUEevaluated 255 times by 1 test
Evaluated by:
  • tst_QRingBuffer
FALSEnever evaluated
) {
0-255
221 pos += head;-
222 for (int i = 0; readSoFar < maxLength
readSoFar < maxLengthDescription
TRUEevaluated 809 times by 1 test
Evaluated by:
  • tst_QRingBuffer
FALSEevaluated 255 times by 1 test
Evaluated by:
  • tst_QRingBuffer
&& i < buffers.size()
i < buffers.size()Description
TRUEevaluated 809 times by 1 test
Evaluated by:
  • tst_QRingBuffer
FALSEnever evaluated
; ++i) {
0-809
223 qint64 blockLength = (i == tailBuffer
i == tailBufferDescription
TRUEevaluated 23 times by 1 test
Evaluated by:
  • tst_QRingBuffer
FALSEevaluated 786 times by 1 test
Evaluated by:
  • tst_QRingBuffer
? tail : buffers[i].size());
23-786
224-
225 if (pos < blockLength
pos < blockLengthDescription
TRUEevaluated 259 times by 1 test
Evaluated by:
  • tst_QRingBuffer
FALSEevaluated 550 times by 1 test
Evaluated by:
  • tst_QRingBuffer
) {
259-550
226 blockLength = qMin(blockLength - pos, maxLength - readSoFar);-
227 memcpy(data + readSoFar, buffers[i].constData() + pos, blockLength);-
228 readSoFar += blockLength;-
229 pos = 0;-
230 }
executed 259 times by 1 test: end of block
Executed by:
  • tst_QRingBuffer
else {
259
231 pos -= blockLength;-
232 }
executed 550 times by 1 test: end of block
Executed by:
  • tst_QRingBuffer
550
233 }-
234 }
executed 255 times by 1 test: end of block
Executed by:
  • tst_QRingBuffer
255
235-
236 return
executed 255 times by 1 test: return readSoFar;
Executed by:
  • tst_QRingBuffer
readSoFar;
executed 255 times by 1 test: return readSoFar;
Executed by:
  • tst_QRingBuffer
255
237}-
238-
239-
240-
241-
242-
243-
244void QRingBuffer::append(const QByteArray &qba)-
245{-
246 if (tail == 0
tail == 0Description
TRUEevaluated 44 times by 2 tests
Evaluated by:
  • tst_QNetworkReply
  • tst_QRingBuffer
FALSEevaluated 42 times by 2 tests
Evaluated by:
  • tst_QNetworkReply
  • tst_QRingBuffer
) {
42-44
247 buffers.last() = qba;-
248 }
executed 44 times by 2 tests: end of block
Executed by:
  • tst_QNetworkReply
  • tst_QRingBuffer
else {
44
249 buffers.last().resize(tail);-
250 buffers.append(qba);-
251 ++tailBuffer;-
252 }
executed 42 times by 2 tests: end of block
Executed by:
  • tst_QNetworkReply
  • tst_QRingBuffer
42
253 tail = qba.size();-
254 bufferSize += tail;-
255}
executed 86 times by 2 tests: end of block
Executed by:
  • tst_QNetworkReply
  • tst_QRingBuffer
86
256-
257qint64 QRingBuffer::readLine(char *data, qint64 maxLength)-
258{-
259 if (!data
!dataDescription
TRUEnever evaluated
FALSEevaluated 3 times by 1 test
Evaluated by:
  • tst_QRingBuffer
|| --
--maxLength <= 0Description
TRUEnever evaluated
FALSEevaluated 3 times by 1 test
Evaluated by:
  • tst_QRingBuffer
maxLength <= 0
--maxLength <= 0Description
TRUEnever evaluated
FALSEevaluated 3 times by 1 test
Evaluated by:
  • tst_QRingBuffer
)
0-3
260 return
never executed: return -1;
-1;
never executed: return -1;
0
261-
262 qint64 i = indexOf('\n', maxLength);-
263 i = read(data, i >= 0 ? (i + 1) : maxLength);-
264-
265-
266 data[i] = '\0';-
267 return
executed 3 times by 1 test: return i;
Executed by:
  • tst_QRingBuffer
i;
executed 3 times by 1 test: return i;
Executed by:
  • tst_QRingBuffer
3
268}-
269-
270-
Switch to Source codePreprocessed file

Generated by Squish Coco Non-Commercial 4.3.0-BETA-master-30-08-2018-4cb69e9