OpenCoverage

qdatastream.cpp

Absolute File Name:/home/qt/qt5_coco/qt5/qtbase/src/corelib/io/qdatastream.cpp
Source codeSwitch to Preprocessed file
LineSourceCount
1/****************************************************************************-
2**-
3** Copyright (C) 2016 The Qt Company Ltd.-
4** Contact: https://www.qt.io/licensing/-
5**-
6** This file is part of the QtCore module of the Qt Toolkit.-
7**-
8** $QT_BEGIN_LICENSE:LGPL$-
9** Commercial License Usage-
10** Licensees holding valid commercial Qt licenses may use this file in-
11** accordance with the commercial license agreement provided with the-
12** Software or, alternatively, in accordance with the terms contained in-
13** a written agreement between you and The Qt Company. For licensing terms-
14** and conditions see https://www.qt.io/terms-conditions. For further-
15** information use the contact form at https://www.qt.io/contact-us.-
16**-
17** GNU Lesser General Public License Usage-
18** Alternatively, this file may be used under the terms of the GNU Lesser-
19** General Public License version 3 as published by the Free Software-
20** Foundation and appearing in the file LICENSE.LGPL3 included in the-
21** packaging of this file. Please review the following information to-
22** ensure the GNU Lesser General Public License version 3 requirements-
23** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.-
24**-
25** GNU General Public License Usage-
26** Alternatively, this file may be used under the terms of the GNU-
27** General Public License version 2.0 or (at your option) the GNU General-
28** Public license version 3 or any later version approved by the KDE Free-
29** Qt Foundation. The licenses are as published by the Free Software-
30** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3-
31** included in the packaging of this file. Please review the following-
32** information to ensure the GNU General Public License requirements will-
33** be met: https://www.gnu.org/licenses/gpl-2.0.html and-
34** https://www.gnu.org/licenses/gpl-3.0.html.-
35**-
36** $QT_END_LICENSE$-
37**-
38****************************************************************************/-
39-
40#include "qdatastream.h"-
41#include "qdatastream_p.h"-
42-
43#if !defined(QT_NO_DATASTREAM) || defined(QT_BOOTSTRAPPED)-
44#include "qbuffer.h"-
45#include "qstring.h"-
46#include <stdio.h>-
47#include <ctype.h>-
48#include <stdlib.h>-
49#include "qendian.h"-
50-
51QT_BEGIN_NAMESPACE-
52-
53/*!-
54 \class QDataStream-
55 \inmodule QtCore-
56 \reentrant-
57 \brief The QDataStream class provides serialization of binary data-
58 to a QIODevice.-
59-
60 \ingroup io-
61-
62-
63 A data stream is a binary stream of encoded information which is-
64 100% independent of the host computer's operating system, CPU or-
65 byte order. For example, a data stream that is written by a PC-
66 under Windows can be read by a Sun SPARC running Solaris.-
67-
68 You can also use a data stream to read/write \l{raw}{raw-
69 unencoded binary data}. If you want a "parsing" input stream, see-
70 QTextStream.-
71-
72 The QDataStream class implements the serialization of C++'s basic-
73 data types, like \c char, \c short, \c int, \c{char *}, etc.-
74 Serialization of more complex data is accomplished by breaking up-
75 the data into primitive units.-
76-
77 A data stream cooperates closely with a QIODevice. A QIODevice-
78 represents an input/output medium one can read data from and write-
79 data to. The QFile class is an example of an I/O device.-
80-
81 Example (write binary data to a stream):-
82-
83 \snippet code/src_corelib_io_qdatastream.cpp 0-
84-
85 Example (read binary data from a stream):-
86-
87 \snippet code/src_corelib_io_qdatastream.cpp 1-
88-
89 Each item written to the stream is written in a predefined binary-
90 format that varies depending on the item's type. Supported Qt-
91 types include QBrush, QColor, QDateTime, QFont, QPixmap, QString,-
92 QVariant and many others. For the complete list of all Qt types-
93 supporting data streaming see \l{Serializing Qt Data Types}.-
94-
95 For integers it is best to always cast to a Qt integer type for-
96 writing, and to read back into the same Qt integer type. This-
97 ensures that you get integers of the size you want and insulates-
98 you from compiler and platform differences.-
99-
100 To take one example, a \c{char *} string is written as a 32-bit-
101 integer equal to the length of the string including the '\\0' byte,-
102 followed by all the characters of the string including the-
103 '\\0' byte. When reading a \c{char *} string, 4 bytes are read to-
104 create the 32-bit length value, then that many characters for the-
105 \c {char *} string including the '\\0' terminator are read.-
106-
107 The initial I/O device is usually set in the constructor, but can be-
108 changed with setDevice(). If you've reached the end of the data-
109 (or if there is no I/O device set) atEnd() will return true.-
110-
111 \section1 Versioning-
112-
113 QDataStream's binary format has evolved since Qt 1.0, and is-
114 likely to continue evolving to reflect changes done in Qt. When-
115 inputting or outputting complex types, it's very important to-
116 make sure that the same version of the stream (version()) is used-
117 for reading and writing. If you need both forward and backward-
118 compatibility, you can hardcode the version number in the-
119 application:-
120-
121 \snippet code/src_corelib_io_qdatastream.cpp 2-
122-
123 If you are producing a new binary data format, such as a file-
124 format for documents created by your application, you could use a-
125 QDataStream to write the data in a portable format. Typically, you-
126 would write a brief header containing a magic string and a version-
127 number to give yourself room for future expansion. For example:-
128-
129 \snippet code/src_corelib_io_qdatastream.cpp 3-
130-
131 Then read it in with:-
132-
133 \snippet code/src_corelib_io_qdatastream.cpp 4-
134-
135 You can select which byte order to use when serializing data. The-
136 default setting is big endian (MSB first). Changing it to little-
137 endian breaks the portability (unless the reader also changes to-
138 little endian). We recommend keeping this setting unless you have-
139 special requirements.-
140-
141 \target raw-
142 \section1 Reading and Writing Raw Binary Data-
143-
144 You may wish to read/write your own raw binary data to/from the-
145 data stream directly. Data may be read from the stream into a-
146 preallocated \c{char *} using readRawData(). Similarly data can be-
147 written to the stream using writeRawData(). Note that any-
148 encoding/decoding of the data must be done by you.-
149-
150 A similar pair of functions is readBytes() and writeBytes(). These-
151 differ from their \e raw counterparts as follows: readBytes()-
152 reads a quint32 which is taken to be the length of the data to be-
153 read, then that number of bytes is read into the preallocated-
154 \c{char *}; writeBytes() writes a quint32 containing the length of the-
155 data, followed by the data. Note that any encoding/decoding of-
156 the data (apart from the length quint32) must be done by you.-
157-
158 \section1 Reading and Writing Qt Collection Classes-
159-
160 The Qt container classes can also be serialized to a QDataStream.-
161 These include QList, QLinkedList, QVector, QSet, QHash, and QMap.-
162 The stream operators are declared as non-members of the classes.-
163-
164 \target Serializing Qt Classes-
165 \section1 Reading and Writing Other Qt Classes-
166-
167 In addition to the overloaded stream operators documented here,-
168 any Qt classes that you might want to serialize to a QDataStream-
169 will have appropriate stream operators declared as non-member of-
170 the class:-
171-
172 \code-
173 QDataStream &operator<<(QDataStream &, const QXxx &);-
174 QDataStream &operator>>(QDataStream &, QXxx &);-
175 \endcode-
176-
177 For example, here are the stream operators declared as non-members-
178 of the QImage class:-
179-
180 \code-
181 QDataStream & operator<< (QDataStream& stream, const QImage& image);-
182 QDataStream & operator>> (QDataStream& stream, QImage& image);-
183 \endcode-
184-
185 To see if your favorite Qt class has similar stream operators-
186 defined, check the \b {Related Non-Members} section of the-
187 class's documentation page.-
188-
189 \section1 Using Read Transactions-
190-
191 When a data stream operates on an asynchronous device, the chunks of data-
192 can arrive at arbitrary points in time. The QDataStream class implements-
193 a transaction mechanism that provides the ability to read the data-
194 atomically with a series of stream operators. As an example, you can-
195 handle incomplete reads from a socket by using a transaction in a slot-
196 connected to the readyRead() signal:-
197-
198 \snippet code/src_corelib_io_qdatastream.cpp 6-
199-
200 If no full packet is received, this code restores the stream to the-
201 initial position, after which you need to wait for more data to arrive.-
202-
203 \sa QTextStream, QVariant-
204*/-
205-
206/*!-
207 \enum QDataStream::ByteOrder-
208-
209 The byte order used for reading/writing the data.-
210-
211 \value BigEndian Most significant byte first (the default)-
212 \value LittleEndian Least significant byte first-
213*/-
214-
215/*!-
216 \enum QDataStream::FloatingPointPrecision-
217-
218 The precision of floating point numbers used for reading/writing the data. This will only have-
219 an effect if the version of the data stream is Qt_4_6 or higher.-
220-
221 \warning The floating point precision must be set to the same value on the object that writes-
222 and the object that reads the data stream.-
223-
224 \value SinglePrecision All floating point numbers in the data stream have 32-bit precision.-
225 \value DoublePrecision All floating point numbers in the data stream have 64-bit precision.-
226-
227 \sa setFloatingPointPrecision(), floatingPointPrecision()-
228*/-
229-
230/*!-
231 \enum QDataStream::Status-
232-
233 This enum describes the current status of the data stream.-
234-
235 \value Ok The data stream is operating normally.-
236 \value ReadPastEnd The data stream has read past the end of the-
237 data in the underlying device.-
238 \value ReadCorruptData The data stream has read corrupt data.-
239 \value WriteFailed The data stream cannot write to the underlying device.-
240*/-
241-
242/*****************************************************************************-
243 QDataStream member functions-
244 *****************************************************************************/-
245-
246#define Q_VOID-
247-
248#undef CHECK_STREAM_PRECOND-
249#ifndef QT_NO_DEBUG-
250#define CHECK_STREAM_PRECOND(retVal) \-
251 if (!dev) { \-
252 qWarning("QDataStream: No device"); \-
253 return retVal; \-
254 }-
255#else-
256#define CHECK_STREAM_PRECOND(retVal) \-
257 if (!dev) { \-
258 return retVal; \-
259 }-
260#endif-
261-
262#define CHECK_STREAM_WRITE_PRECOND(retVal) \-
263 CHECK_STREAM_PRECOND(retVal) \-
264 if (q_status != Ok) \-
265 return retVal;-
266-
267#define CHECK_STREAM_TRANSACTION_PRECOND(retVal) \-
268 if (!d || d->transactionDepth == 0) { \-
269 qWarning("QDataStream: No transaction in progress"); \-
270 return retVal; \-
271 }-
272-
273/*!-
274 Constructs a data stream that has no I/O device.-
275-
276 \sa setDevice()-
277*/-
278-
279QDataStream::QDataStream()-
280{-
281 dev = 0;-
282 owndev = false;-
283 byteorder = BigEndian;-
284 ver = Qt_DefaultCompiledVersion;-
285 noswap = QSysInfo::ByteOrder == QSysInfo::BigEndian;-
286 q_status = Ok;-
287}
executed 292 times by 8 tests: end of block
Executed by:
  • tst_QAbstractPrintDialog
  • tst_QDataStream
  • tst_QDateTime
  • tst_QFont
  • tst_QNetworkDiskCache
  • tst_QPdfWriter
  • tst_QPicture
  • tst_QPrinter
292
288-
289/*!-
290 Constructs a data stream that uses the I/O device \a d.-
291-
292 \sa setDevice(), device()-
293*/-
294-
295QDataStream::QDataStream(QIODevice *d)-
296{-
297 dev = d; // set device-
298 owndev = false;-
299 byteorder = BigEndian; // default byte order-
300 ver = Qt_DefaultCompiledVersion;-
301 noswap = QSysInfo::ByteOrder == QSysInfo::BigEndian;-
302 q_status = Ok;-
303}
executed 7498 times by 23 tests: end of block
Executed by:
  • tst_QAbstractNetworkCache
  • tst_QBitArray
  • tst_QBuffer
  • tst_QDataStream
  • tst_QDateTime
  • tst_QFile
  • tst_QGuiVariant
  • tst_QIODevice
  • tst_QIcon
  • tst_QImage
  • tst_QImageReader
  • tst_QImageWriter
  • tst_QLocalSocket
  • tst_QNetworkCacheMetaData
  • tst_QNetworkDiskCache
  • tst_QNetworkReply
  • tst_QPainterPath
  • tst_QPixmap
  • tst_QPoint
  • tst_QPointF
  • tst_QSettings
  • tst_QTimeZone
  • tst_QVariant
7498
304-
305/*!-
306 \fn QDataStream::QDataStream(QByteArray *a, QIODevice::OpenMode mode)-
307-
308 Constructs a data stream that operates on a byte array, \a a. The-
309 \a mode describes how the device is to be used.-
310-
311 Alternatively, you can use QDataStream(const QByteArray &) if you-
312 just want to read from a byte array.-
313-
314 Since QByteArray is not a QIODevice subclass, internally a QBuffer-
315 is created to wrap the byte array.-
316*/-
317-
318QDataStream::QDataStream(QByteArray *a, QIODevice::OpenMode flags)-
319{-
320 QBuffer *buf = new QBuffer(a);-
321#ifndef QT_NO_QOBJECT-
322 buf->blockSignals(true);-
323#endif-
324 buf->open(flags);-
325 dev = buf;-
326 owndev = true;-
327 byteorder = BigEndian;-
328 ver = Qt_DefaultCompiledVersion;-
329 noswap = QSysInfo::ByteOrder == QSysInfo::BigEndian;-
330 q_status = Ok;-
331}
executed 6224 times by 47 tests: end of block
Executed by:
  • tst_QAbstractItemModel
  • tst_QAsn1Element
  • tst_QAuthenticator
  • tst_QBrush
  • tst_QDataStream
  • tst_QDate
  • tst_QDateTime
  • tst_QDockWidget
  • tst_QFileDialog2
  • tst_QFiledialog
  • tst_QGraphicsProxyWidget
  • tst_QGuiVariant
  • tst_QHeaderView
  • tst_QHostAddress
  • tst_QIODevice
  • tst_QImage
  • tst_QKeySequence
  • tst_QListWidget
  • tst_QLocalSocket
  • tst_QMainWindow
  • tst_QMargins
  • tst_QMetaObjectBuilder
  • tst_QMetaType
  • tst_QObject
  • tst_QPen
  • ...
6224
332-
333/*!-
334 Constructs a read-only data stream that operates on byte array \a a.-
335 Use QDataStream(QByteArray*, int) if you want to write to a byte-
336 array.-
337-
338 Since QByteArray is not a QIODevice subclass, internally a QBuffer-
339 is created to wrap the byte array.-
340*/-
341QDataStream::QDataStream(const QByteArray &a)-
342{-
343 QBuffer *buf = new QBuffer;-
344#ifndef QT_NO_QOBJECT-
345 buf->blockSignals(true);-
346#endif-
347 buf->setData(a);-
348 buf->open(QIODevice::ReadOnly);-
349 dev = buf;-
350 owndev = true;-
351 byteorder = BigEndian;-
352 ver = Qt_DefaultCompiledVersion;-
353 noswap = QSysInfo::ByteOrder == QSysInfo::BigEndian;-
354 q_status = Ok;-
355}
executed 138 times by 13 tests: end of block
Executed by:
  • tst_QAsn1Element
  • tst_QAuthenticator
  • tst_QDataStream
  • tst_QDockWidget
  • tst_QGuiVariant
  • tst_QMainWindow
  • tst_QMetaObjectBuilder
  • tst_QSizePolicy
  • tst_QTranslator
  • tst_QUrl
  • tst_QVariant
  • tst_QVersionNumber
  • tst_QWidget
138
356-
357/*!-
358 Destroys the data stream.-
359-
360 The destructor will not affect the current I/O device, unless it is-
361 an internal I/O device (e.g. a QBuffer) processing a QByteArray-
362 passed in the \e constructor, in which case the internal I/O device-
363 is destroyed.-
364*/-
365-
366QDataStream::~QDataStream()-
367{-
368 if (owndev)
owndevDescription
TRUEevaluated 6362 times by 48 tests
Evaluated by:
  • tst_QAbstractItemModel
  • tst_QAsn1Element
  • tst_QAuthenticator
  • tst_QBrush
  • tst_QDataStream
  • tst_QDate
  • tst_QDateTime
  • tst_QDockWidget
  • tst_QFileDialog2
  • tst_QFiledialog
  • tst_QGraphicsProxyWidget
  • tst_QGuiVariant
  • tst_QHeaderView
  • tst_QHostAddress
  • tst_QIODevice
  • tst_QImage
  • tst_QKeySequence
  • tst_QListWidget
  • tst_QLocalSocket
  • tst_QMainWindow
  • tst_QMargins
  • tst_QMetaObjectBuilder
  • tst_QMetaType
  • tst_QObject
  • tst_QPen
  • ...
FALSEevaluated 7790 times by 28 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QAbstractPrintDialog
  • tst_QBitArray
  • tst_QBuffer
  • tst_QDataStream
  • tst_QDateTime
  • tst_QFile
  • tst_QFont
  • tst_QGuiVariant
  • tst_QIODevice
  • tst_QIcon
  • tst_QImage
  • tst_QImageReader
  • tst_QImageWriter
  • tst_QLocalSocket
  • tst_QNetworkCacheMetaData
  • tst_QNetworkDiskCache
  • tst_QNetworkReply
  • tst_QPainterPath
  • tst_QPdfWriter
  • tst_QPicture
  • tst_QPixmap
  • tst_QPoint
  • tst_QPointF
  • tst_QPrinter
  • ...
6362-7790
369 delete dev;
executed 6362 times by 48 tests: delete dev;
Executed by:
  • tst_QAbstractItemModel
  • tst_QAsn1Element
  • tst_QAuthenticator
  • tst_QBrush
  • tst_QDataStream
  • tst_QDate
  • tst_QDateTime
  • tst_QDockWidget
  • tst_QFileDialog2
  • tst_QFiledialog
  • tst_QGraphicsProxyWidget
  • tst_QGuiVariant
  • tst_QHeaderView
  • tst_QHostAddress
  • tst_QIODevice
  • tst_QImage
  • tst_QKeySequence
  • tst_QListWidget
  • tst_QLocalSocket
  • tst_QMainWindow
  • tst_QMargins
  • tst_QMetaObjectBuilder
  • tst_QMetaType
  • tst_QObject
  • tst_QPen
  • ...
6362
370}
executed 14152 times by 65 tests: end of block
Executed by:
  • tst_QAbstractItemModel
  • tst_QAbstractNetworkCache
  • tst_QAbstractPrintDialog
  • tst_QAsn1Element
  • tst_QAuthenticator
  • tst_QBitArray
  • tst_QBrush
  • tst_QBuffer
  • tst_QDataStream
  • tst_QDate
  • tst_QDateTime
  • tst_QDockWidget
  • tst_QFile
  • tst_QFileDialog2
  • tst_QFiledialog
  • tst_QFont
  • tst_QGraphicsProxyWidget
  • tst_QGuiVariant
  • tst_QHeaderView
  • tst_QHostAddress
  • tst_QIODevice
  • tst_QIcon
  • tst_QImage
  • tst_QImageReader
  • tst_QImageWriter
  • ...
14152
371-
372-
373/*!-
374 \fn QIODevice *QDataStream::device() const-
375-
376 Returns the I/O device currently set, or 0 if no-
377 device is currently set.-
378-
379 \sa setDevice()-
380*/-
381-
382/*!-
383 void QDataStream::setDevice(QIODevice *d)-
384-
385 Sets the I/O device to \a d, which can be 0-
386 to unset to current I/O device.-
387-
388 \sa device()-
389*/-
390-
391void QDataStream::setDevice(QIODevice *d)-
392{-
393 if (owndev) {
owndevDescription
TRUEnever evaluated
FALSEevaluated 654 times by 5 tests
Evaluated by:
  • tst_QDataStream
  • tst_QFont
  • tst_QIODevice
  • tst_QPicture
  • tst_QPrinter
0-654
394 delete dev;-
395 owndev = false;-
396 }
never executed: end of block
0
397 dev = d;-
398}
executed 654 times by 5 tests: end of block
Executed by:
  • tst_QDataStream
  • tst_QFont
  • tst_QIODevice
  • tst_QPicture
  • tst_QPrinter
654
399-
400/*!-
401 \obsolete-
402 Unsets the I/O device.-
403 Use setDevice(0) instead.-
404*/-
405-
406void QDataStream::unsetDevice()-
407{-
408 setDevice(0);-
409}
executed 20 times by 1 test: end of block
Executed by:
  • tst_QPrinter
20
410-
411-
412/*!-
413 \fn bool QDataStream::atEnd() const-
414-
415 Returns \c true if the I/O device has reached the end position (end of-
416 the stream or file) or if there is no I/O device set; otherwise-
417 returns \c false.-
418-
419 \sa QIODevice::atEnd()-
420*/-
421-
422bool QDataStream::atEnd() const-
423{-
424 return dev ? dev->atEnd() : true;
executed 2599 times by 16 tests: return dev ? dev->atEnd() : true;
Executed by:
  • tst_QAbstractItemModel
  • tst_QDataStream
  • tst_QDockWidget
  • tst_QFile
  • tst_QFileDialog2
  • tst_QFiledialog
  • tst_QGuiVariant
  • tst_QIODevice
  • tst_QIcon
  • tst_QKeySequence
  • tst_QMainWindow
  • tst_QPicture
  • tst_QPrinter
  • tst_QSettings
  • tst_QStandardItemModel
  • tst_QTranslator
2599
425}-
426-
427/*!-
428 Returns the floating point precision of the data stream.-
429-
430 \since 4.6-
431-
432 \sa FloatingPointPrecision, setFloatingPointPrecision()-
433*/-
434QDataStream::FloatingPointPrecision QDataStream::floatingPointPrecision() const-
435{-
436 return d == 0 ? QDataStream::DoublePrecision : d->floatingPointPrecision;
executed 42061 times by 15 tests: return d == 0 ? QDataStream::DoublePrecision : d->floatingPointPrecision;
Executed by:
  • tst_QBrush
  • tst_QDataStream
  • tst_QFont
  • tst_QGuiVariant
  • tst_QIODevice
  • tst_QMargins
  • tst_QMetaType
  • tst_QPainterPath
  • tst_QPen
  • tst_QPicture
  • tst_QPointF
  • tst_QPrinter
  • tst_QStandardItem
  • tst_QStyleSheetStyle
  • tst_QVariant
42061
437}-
438-
439/*!-
440 Sets the floating point precision of the data stream to \a precision. If the floating point precision is-
441 DoublePrecision and the version of the data stream is Qt_4_6 or higher, all floating point-
442 numbers will be written and read with 64-bit precision. If the floating point precision is-
443 SinglePrecision and the version is Qt_4_6 or higher, all floating point numbers will be written-
444 and read with 32-bit precision.-
445-
446 For versions prior to Qt_4_6, the precision of floating point numbers in the data stream depends-
447 on the stream operator called.-
448-
449 The default is DoublePrecision.-
450-
451 \warning This property must be set to the same value on the object that writes and the object-
452 that reads the data stream.-
453-
454 \since 4.6-
455*/-
456void QDataStream::setFloatingPointPrecision(QDataStream::FloatingPointPrecision precision)-
457{-
458 if (d == 0)
d == 0Description
TRUEevaluated 58 times by 1 test
Evaluated by:
  • tst_QDataStream
FALSEnever evaluated
0-58
459 d.reset(new QDataStreamPrivate());
executed 58 times by 1 test: d.reset(new QDataStreamPrivate());
Executed by:
  • tst_QDataStream
58
460 d->floatingPointPrecision = precision;-
461}
executed 58 times by 1 test: end of block
Executed by:
  • tst_QDataStream
58
462-
463/*!-
464 Returns the status of the data stream.-
465-
466 \sa Status, setStatus(), resetStatus()-
467*/-
468-
469QDataStream::Status QDataStream::status() const-
470{-
471 return q_status;
executed 360373 times by 37 tests: return q_status;
Executed by:
  • tst_QAbstractItemModel
  • tst_QAbstractNetworkCache
  • tst_QBitArray
  • tst_QBrush
  • tst_QDataStream
  • tst_QDate
  • tst_QDateTime
  • tst_QDockWidget
  • tst_QFileDialog2
  • tst_QFiledialog
  • tst_QGraphicsProxyWidget
  • tst_QGuiVariant
  • tst_QHeaderView
  • tst_QHostAddress
  • tst_QIODevice
  • tst_QImage
  • tst_QImageReader
  • tst_QImageWriter
  • tst_QListWidget
  • tst_QMainWindow
  • tst_QMetaObjectBuilder
  • tst_QMetaType
  • tst_QNetworkCacheMetaData
  • tst_QNetworkDiskCache
  • tst_QNetworkReply
  • ...
360373
472}-
473-
474/*!-
475 Resets the status of the data stream.-
476-
477 \sa Status, status(), setStatus()-
478*/-
479void QDataStream::resetStatus()-
480{-
481 q_status = Ok;-
482}
executed 3290 times by 26 tests: end of block
Executed by:
  • tst_QAbstractItemModel
  • tst_QAbstractNetworkCache
  • tst_QBrush
  • tst_QDataStream
  • tst_QFileDialog2
  • tst_QFiledialog
  • tst_QGraphicsProxyWidget
  • tst_QGuiVariant
  • tst_QHeaderView
  • tst_QIODevice
  • tst_QListWidget
  • tst_QMetaObjectBuilder
  • tst_QMetaType
  • tst_QNetworkCacheMetaData
  • tst_QNetworkDiskCache
  • tst_QNetworkReply
  • tst_QPen
  • tst_QSettings
  • tst_QSplitter
  • tst_QStandardItem
  • tst_QStandardItemModel
  • tst_QTableWidget
  • tst_QTreeWidget
  • tst_QVariant
  • tst_QVersionNumber
  • ...
3290
483-
484/*!-
485 Sets the status of the data stream to the \a status given.-
486-
487 Subsequent calls to setStatus() are ignored until resetStatus()-
488 is called.-
489-
490 \sa Status, status(), resetStatus()-
491*/-
492void QDataStream::setStatus(Status status)-
493{-
494 if (q_status == Ok)
q_status == OkDescription
TRUEevaluated 1344 times by 13 tests
Evaluated by:
  • tst_QAsn1Element
  • tst_QDataStream
  • tst_QDockWidget
  • tst_QHeaderView
  • tst_QIODevice
  • tst_QImage
  • tst_QImageReader
  • tst_QMainWindow
  • tst_QMetaType
  • tst_QNetworkDiskCache
  • tst_QPixmap
  • tst_QVariant
  • tst_languageChange
FALSEevaluated 200 times by 7 tests
Evaluated by:
  • tst_QDataStream
  • tst_QHeaderView
  • tst_QImage
  • tst_QImageReader
  • tst_QMainWindow
  • tst_QMetaType
  • tst_QNetworkDiskCache
200-1344
495 q_status = status;
executed 1344 times by 13 tests: q_status = status;
Executed by:
  • tst_QAsn1Element
  • tst_QDataStream
  • tst_QDockWidget
  • tst_QHeaderView
  • tst_QIODevice
  • tst_QImage
  • tst_QImageReader
  • tst_QMainWindow
  • tst_QMetaType
  • tst_QNetworkDiskCache
  • tst_QPixmap
  • tst_QVariant
  • tst_languageChange
1344
496}
executed 1544 times by 13 tests: end of block
Executed by:
  • tst_QAsn1Element
  • tst_QDataStream
  • tst_QDockWidget
  • tst_QHeaderView
  • tst_QIODevice
  • tst_QImage
  • tst_QImageReader
  • tst_QMainWindow
  • tst_QMetaType
  • tst_QNetworkDiskCache
  • tst_QPixmap
  • tst_QVariant
  • tst_languageChange
1544
497-
498/*!-
499 \fn int QDataStream::byteOrder() const-
500-
501 Returns the current byte order setting -- either BigEndian or-
502 LittleEndian.-
503-
504 \sa setByteOrder()-
505*/-
506-
507/*!-
508 Sets the serialization byte order to \a bo.-
509-
510 The \a bo parameter can be QDataStream::BigEndian or-
511 QDataStream::LittleEndian.-
512-
513 The default setting is big endian. We recommend leaving this-
514 setting unless you have special requirements.-
515-
516 \sa byteOrder()-
517*/-
518-
519void QDataStream::setByteOrder(ByteOrder bo)-
520{-
521 byteorder = bo;-
522 if (QSysInfo::ByteOrder == QSysInfo::BigEndian)
QSysInfo::Byte...nfo::BigEndianDescription
TRUEnever evaluated
FALSEevaluated 950 times by 9 tests
Evaluated by:
  • tst_QAuthenticator
  • tst_QDataStream
  • tst_QGuiVariant
  • tst_QImage
  • tst_QImageReader
  • tst_QImageWriter
  • tst_QPixmap
  • tst_QPrinter
  • tst_QUuid
0-950
523 noswap = (byteorder == BigEndian);
never executed: noswap = (byteorder == BigEndian);
0
524 else-
525 noswap = (byteorder == LittleEndian);
executed 950 times by 9 tests: noswap = (byteorder == LittleEndian);
Executed by:
  • tst_QAuthenticator
  • tst_QDataStream
  • tst_QGuiVariant
  • tst_QImage
  • tst_QImageReader
  • tst_QImageWriter
  • tst_QPixmap
  • tst_QPrinter
  • tst_QUuid
950
526}-
527-
528-
529/*!-
530 \enum QDataStream::Version-
531-
532 This enum provides symbolic synonyms for the data serialization-
533 format version numbers.-
534-
535 \value Qt_1_0 Version 1 (Qt 1.x)-
536 \value Qt_2_0 Version 2 (Qt 2.0)-
537 \value Qt_2_1 Version 3 (Qt 2.1, 2.2, 2.3)-
538 \value Qt_3_0 Version 4 (Qt 3.0)-
539 \value Qt_3_1 Version 5 (Qt 3.1, 3.2)-
540 \value Qt_3_3 Version 6 (Qt 3.3)-
541 \value Qt_4_0 Version 7 (Qt 4.0, Qt 4.1)-
542 \value Qt_4_1 Version 7 (Qt 4.0, Qt 4.1)-
543 \value Qt_4_2 Version 8 (Qt 4.2)-
544 \value Qt_4_3 Version 9 (Qt 4.3)-
545 \value Qt_4_4 Version 10 (Qt 4.4)-
546 \value Qt_4_5 Version 11 (Qt 4.5)-
547 \value Qt_4_6 Version 12 (Qt 4.6, Qt 4.7, Qt 4.8)-
548 \value Qt_4_7 Same as Qt_4_6.-
549 \value Qt_4_8 Same as Qt_4_6.-
550 \value Qt_4_9 Same as Qt_4_6.-
551 \value Qt_5_0 Version 13 (Qt 5.0)-
552 \value Qt_5_1 Version 14 (Qt 5.1)-
553 \value Qt_5_2 Version 15 (Qt 5.2)-
554 \value Qt_5_3 Same as Qt_5_2-
555 \value Qt_5_4 Version 16 (Qt 5.4)-
556 \value Qt_5_5 Same as Qt_5_4-
557 \value Qt_5_6 Version 17 (Qt 5.6)-
558 \value Qt_5_7 Same as Qt_5_6-
559 \omitvalue Qt_DefaultCompiledVersion-
560-
561 \sa setVersion(), version()-
562*/-
563-
564/*!-
565 \fn int QDataStream::version() const-
566-
567 Returns the version number of the data serialization format.-
568-
569 \sa setVersion(), Version-
570*/-
571-
572/*!-
573 \fn void QDataStream::setVersion(int v)-
574-
575 Sets the version number of the data serialization format to \a v,-
576 a value of the \l Version enum.-
577-
578 You don't \e have to set a version if you are using the current-
579 version of Qt, but for your own custom binary formats we-
580 recommend that you do; see \l{Versioning} in the Detailed-
581 Description.-
582-
583 To accommodate new functionality, the datastream serialization-
584 format of some Qt classes has changed in some versions of Qt. If-
585 you want to read data that was created by an earlier version of-
586 Qt, or write data that can be read by a program that was compiled-
587 with an earlier version of Qt, use this function to modify the-
588 serialization format used by QDataStream.-
589-
590 The \l Version enum provides symbolic constants for the different-
591 versions of Qt. For example:-
592-
593 \snippet code/src_corelib_io_qdatastream.cpp 5-
594-
595 \sa version(), Version-
596*/-
597-
598/*!-
599 \since 5.7-
600-
601 Starts a new read transaction on the stream.-
602-
603 Defines a restorable point within the sequence of read operations. For-
604 sequential devices, read data will be duplicated internally to allow-
605 recovery in case of incomplete reads. For random-access devices,-
606 this function saves the current position of the stream. Call-
607 commitTransaction(), rollbackTransaction(), or abortTransaction() to-
608 finish the current transaction.-
609-
610 Once a transaction is started, subsequent calls to this function will make-
611 the transaction recursive. Inner transactions act as agents of the-
612 outermost transaction (i.e., report the status of read operations to the-
613 outermost transaction, which can restore the position of the stream).-
614-
615 \note Restoring to the point of the nested startTransaction() call is not-
616 supported.-
617-
618 When an error occurs during a transaction (including an inner transaction-
619 failing), reading from the data stream is suspended (all subsequent read-
620 operations return empty/zero values) and subsequent inner transactions are-
621 forced to fail. Starting a new outermost transaction recovers from this-
622 state. This behavior makes it unnecessary to error-check every read-
623 operation separately.-
624-
625 \sa commitTransaction(), rollbackTransaction(), abortTransaction()-
626*/-
627-
628void QDataStream::startTransaction()-
629{-
630 CHECK_STREAM_PRECOND(Q_VOID)
never executed: return ;
!devDescription
TRUEnever evaluated
FALSEevaluated 719 times by 1 test
Evaluated by:
  • tst_QDataStream
0-719
631-
632 if (d == 0)
d == 0Description
TRUEevaluated 409 times by 1 test
Evaluated by:
  • tst_QDataStream
FALSEevaluated 310 times by 1 test
Evaluated by:
  • tst_QDataStream
310-409
633 d.reset(new QDataStreamPrivate());
executed 409 times by 1 test: d.reset(new QDataStreamPrivate());
Executed by:
  • tst_QDataStream
409
634-
635 if (++d->transactionDepth == 1) {
++d->transactionDepth == 1Description
TRUEevaluated 701 times by 1 test
Evaluated by:
  • tst_QDataStream
FALSEevaluated 18 times by 1 test
Evaluated by:
  • tst_QDataStream
18-701
636 dev->startTransaction();-
637 resetStatus();-
638 }
executed 701 times by 1 test: end of block
Executed by:
  • tst_QDataStream
701
639}
executed 719 times by 1 test: end of block
Executed by:
  • tst_QDataStream
719
640-
641/*!-
642 \since 5.7-
643-
644 Completes a read transaction. Returns \c true if no read errors have-
645 occurred during the transaction; otherwise returns \c false.-
646-
647 If called on an inner transaction, committing will be postponed until-
648 the outermost commitTransaction(), rollbackTransaction(), or-
649 abortTransaction() call occurs.-
650-
651 Otherwise, if the stream status indicates reading past the end of the-
652 data, this function restores the stream data to the point of the-
653 startTransaction() call. When this situation occurs, you need to wait for-
654 more data to arrive, after which you start a new transaction. If the data-
655 stream has read corrupt data or any of the inner transactions was aborted,-
656 this function aborts the transaction.-
657-
658 \sa startTransaction(), rollbackTransaction(), abortTransaction()-
659*/-
660-
661bool QDataStream::commitTransaction()-
662{-
663 CHECK_STREAM_TRANSACTION_PRECOND(false)
never executed: return false;
!dDescription
TRUEnever evaluated
FALSEevaluated 707 times by 1 test
Evaluated by:
  • tst_QDataStream
d->transactionDepth == 0Description
TRUEnever evaluated
FALSEevaluated 707 times by 1 test
Evaluated by:
  • tst_QDataStream
0-707
664 if (--d->transactionDepth == 0) {
--d->transactionDepth == 0Description
TRUEevaluated 701 times by 1 test
Evaluated by:
  • tst_QDataStream
FALSEevaluated 6 times by 1 test
Evaluated by:
  • tst_QDataStream
6-701
665 CHECK_STREAM_PRECOND(false)
never executed: return false;
!devDescription
TRUEnever evaluated
FALSEevaluated 701 times by 1 test
Evaluated by:
  • tst_QDataStream
0-701
666-
667 if (q_status == ReadPastEnd) {
q_status == ReadPastEndDescription
TRUEevaluated 370 times by 1 test
Evaluated by:
  • tst_QDataStream
FALSEevaluated 331 times by 1 test
Evaluated by:
  • tst_QDataStream
331-370
668 dev->rollbackTransaction();-
669 return false;
executed 370 times by 1 test: return false;
Executed by:
  • tst_QDataStream
370
670 }-
671 dev->commitTransaction();-
672 }
executed 331 times by 1 test: end of block
Executed by:
  • tst_QDataStream
331
673 return q_status == Ok;
executed 337 times by 1 test: return q_status == Ok;
Executed by:
  • tst_QDataStream
337
674}-
675-
676/*!-
677 \since 5.7-
678-
679 Reverts a read transaction.-
680-
681 This function is commonly used to rollback the transaction when an-
682 incomplete read was detected prior to committing the transaction.-
683-
684 If called on an inner transaction, reverting is delegated to the outermost-
685 transaction, and subsequently started inner transactions are forced to-
686 fail.-
687-
688 For the outermost transaction, restores the stream data to the point of-
689 the startTransaction() call. If the data stream has read corrupt data or-
690 any of the inner transactions was aborted, this function aborts the-
691 transaction.-
692-
693 If the preceding stream operations were successful, sets the status of the-
694 data stream to \value ReadPastEnd.-
695-
696 \sa startTransaction(), commitTransaction(), abortTransaction()-
697*/-
698-
699void QDataStream::rollbackTransaction()-
700{-
701 setStatus(ReadPastEnd);-
702-
703 CHECK_STREAM_TRANSACTION_PRECOND(Q_VOID)
never executed: return ;
!dDescription
TRUEnever evaluated
FALSEevaluated 6 times by 1 test
Evaluated by:
  • tst_QDataStream
d->transactionDepth == 0Description
TRUEnever evaluated
FALSEevaluated 6 times by 1 test
Evaluated by:
  • tst_QDataStream
0-6
704 if (--d->transactionDepth != 0)
--d->transactionDepth != 0Description
TRUEevaluated 6 times by 1 test
Evaluated by:
  • tst_QDataStream
FALSEnever evaluated
0-6
705 return;
executed 6 times by 1 test: return;
Executed by:
  • tst_QDataStream
6
706-
707 CHECK_STREAM_PRECOND(Q_VOID)
never executed: return ;
!devDescription
TRUEnever evaluated
FALSEnever evaluated
0
708 if (q_status == ReadPastEnd)
q_status == ReadPastEndDescription
TRUEnever evaluated
FALSEnever evaluated
0
709 dev->rollbackTransaction();
never executed: dev->rollbackTransaction();
0
710 else-
711 dev->commitTransaction();
never executed: dev->commitTransaction();
0
712}-
713-
714/*!-
715 \since 5.7-
716-
717 Aborts a read transaction.-
718-
719 This function is commonly used to discard the transaction after-
720 higher-level protocol errors or loss of stream synchronization.-
721-
722 If called on an inner transaction, aborting is delegated to the outermost-
723 transaction, and subsequently started inner transactions are forced to-
724 fail.-
725-
726 For the outermost transaction, discards the restoration point and any-
727 internally duplicated data of the stream. Will not affect the current-
728 read position of the stream.-
729-
730 Sets the status of the data stream to \value ReadCorruptData.-
731-
732 \sa startTransaction(), commitTransaction(), rollbackTransaction()-
733*/-
734-
735void QDataStream::abortTransaction()-
736{-
737 q_status = ReadCorruptData;-
738-
739 CHECK_STREAM_TRANSACTION_PRECOND(Q_VOID)
never executed: return ;
!dDescription
TRUEnever evaluated
FALSEevaluated 6 times by 1 test
Evaluated by:
  • tst_QDataStream
d->transactionDepth == 0Description
TRUEnever evaluated
FALSEevaluated 6 times by 1 test
Evaluated by:
  • tst_QDataStream
0-6
740 if (--d->transactionDepth != 0)
--d->transactionDepth != 0Description
TRUEevaluated 6 times by 1 test
Evaluated by:
  • tst_QDataStream
FALSEnever evaluated
0-6
741 return;
executed 6 times by 1 test: return;
Executed by:
  • tst_QDataStream
6
742-
743 CHECK_STREAM_PRECOND(Q_VOID)
never executed: return ;
!devDescription
TRUEnever evaluated
FALSEnever evaluated
0
744 dev->commitTransaction();-
745}
never executed: end of block
0
746-
747/*****************************************************************************-
748 QDataStream read functions-
749 *****************************************************************************/-
750-
751/*!-
752 \internal-
753*/-
754-
755int QDataStream::readBlock(char *data, int len)-
756{-
757 // Disable reads on failure in transacted stream-
758 if (q_status != Ok && dev->isTransactionStarted())
q_status != OkDescription
TRUEevaluated 1246 times by 8 tests
Evaluated by:
  • tst_QDataStream
  • tst_QHeaderView
  • tst_QIODevice
  • tst_QImage
  • tst_QImageReader
  • tst_QMainWindow
  • tst_QMetaType
  • tst_QNetworkDiskCache
FALSEevaluated 338953 times by 62 tests
Evaluated by:
  • tst_QAbstractItemModel
  • tst_QAbstractNetworkCache
  • tst_QAsn1Element
  • tst_QAuthenticator
  • tst_QBitArray
  • tst_QBrush
  • tst_QBuffer
  • tst_QDataStream
  • tst_QDate
  • tst_QDateTime
  • tst_QDockWidget
  • tst_QFile
  • tst_QFileDialog2
  • tst_QFiledialog
  • tst_QFont
  • tst_QGraphicsProxyWidget
  • tst_QGuiVariant
  • tst_QHeaderView
  • tst_QHostAddress
  • tst_QIODevice
  • tst_QIcon
  • tst_QImage
  • tst_QImageReader
  • tst_QImageWriter
  • tst_QKeySequence
  • ...
dev->isTransactionStarted()Description
TRUEevaluated 1075 times by 2 tests
Evaluated by:
  • tst_QDataStream
  • tst_QIODevice
FALSEevaluated 171 times by 7 tests
Evaluated by:
  • tst_QDataStream
  • tst_QHeaderView
  • tst_QImage
  • tst_QImageReader
  • tst_QMainWindow
  • tst_QMetaType
  • tst_QNetworkDiskCache
171-338953
759 return -1;
executed 1075 times by 2 tests: return -1;
Executed by:
  • tst_QDataStream
  • tst_QIODevice
1075
760-
761 const int readResult = dev->read(data, len);-
762 if (readResult != len)
readResult != lenDescription
TRUEevaluated 1217 times by 12 tests
Evaluated by:
  • tst_QAsn1Element
  • tst_QDataStream
  • tst_QDockWidget
  • tst_QHeaderView
  • tst_QIODevice
  • tst_QImage
  • tst_QImageReader
  • tst_QMainWindow
  • tst_QMetaType
  • tst_QNetworkDiskCache
  • tst_QPixmap
  • tst_languageChange
FALSEevaluated 337907 times by 62 tests
Evaluated by:
  • tst_QAbstractItemModel
  • tst_QAbstractNetworkCache
  • tst_QAsn1Element
  • tst_QAuthenticator
  • tst_QBitArray
  • tst_QBrush
  • tst_QBuffer
  • tst_QDataStream
  • tst_QDate
  • tst_QDateTime
  • tst_QDockWidget
  • tst_QFile
  • tst_QFileDialog2
  • tst_QFiledialog
  • tst_QFont
  • tst_QGraphicsProxyWidget
  • tst_QGuiVariant
  • tst_QHeaderView
  • tst_QHostAddress
  • tst_QIODevice
  • tst_QIcon
  • tst_QImage
  • tst_QImageReader
  • tst_QImageWriter
  • tst_QKeySequence
  • ...
1217-337907
763 setStatus(ReadPastEnd);
executed 1217 times by 12 tests: setStatus(ReadPastEnd);
Executed by:
  • tst_QAsn1Element
  • tst_QDataStream
  • tst_QDockWidget
  • tst_QHeaderView
  • tst_QIODevice
  • tst_QImage
  • tst_QImageReader
  • tst_QMainWindow
  • tst_QMetaType
  • tst_QNetworkDiskCache
  • tst_QPixmap
  • tst_languageChange
1217
764 return readResult;
executed 339124 times by 62 tests: return readResult;
Executed by:
  • tst_QAbstractItemModel
  • tst_QAbstractNetworkCache
  • tst_QAsn1Element
  • tst_QAuthenticator
  • tst_QBitArray
  • tst_QBrush
  • tst_QBuffer
  • tst_QDataStream
  • tst_QDate
  • tst_QDateTime
  • tst_QDockWidget
  • tst_QFile
  • tst_QFileDialog2
  • tst_QFiledialog
  • tst_QFont
  • tst_QGraphicsProxyWidget
  • tst_QGuiVariant
  • tst_QHeaderView
  • tst_QHostAddress
  • tst_QIODevice
  • tst_QIcon
  • tst_QImage
  • tst_QImageReader
  • tst_QImageWriter
  • tst_QKeySequence
  • ...
339124
765}-
766-
767/*!-
768 \fn QDataStream &QDataStream::operator>>(quint8 &i)-
769 \overload-
770-
771 Reads an unsigned byte from the stream into \a i, and returns a-
772 reference to the stream.-
773*/-
774-
775/*!-
776 Reads a signed byte from the stream into \a i, and returns a-
777 reference to the stream.-
778*/-
779-
780QDataStream &QDataStream::operator>>(qint8 &i)-
781{-
782 i = 0;-
783 CHECK_STREAM_PRECOND(*this)
never executed: return *this;
!devDescription
TRUEnever evaluated
FALSEevaluated 133653 times by 39 tests
Evaluated by:
  • tst_QAbstractItemModel
  • tst_QAbstractNetworkCache
  • tst_QAsn1Element
  • tst_QBrush
  • tst_QBuffer
  • tst_QDataStream
  • tst_QDateTime
  • tst_QDockWidget
  • tst_QFile
  • tst_QFileDialog2
  • tst_QFiledialog
  • tst_QFont
  • tst_QGraphicsProxyWidget
  • tst_QGuiVariant
  • tst_QHeaderView
  • tst_QHostAddress
  • tst_QIODevice
  • tst_QListWidget
  • tst_QLocalSocket
  • tst_QMainWindow
  • tst_QMetaObjectBuilder
  • tst_QMetaType
  • tst_QNetworkCacheMetaData
  • tst_QNetworkDiskCache
  • tst_QNetworkReply
  • ...
0-133653
784 char c;-
785 if (readBlock(&c, 1) == 1)
readBlock(&c, 1) == 1Description
TRUEevaluated 133470 times by 39 tests
Evaluated by:
  • tst_QAbstractItemModel
  • tst_QAbstractNetworkCache
  • tst_QAsn1Element
  • tst_QBrush
  • tst_QBuffer
  • tst_QDataStream
  • tst_QDateTime
  • tst_QDockWidget
  • tst_QFile
  • tst_QFileDialog2
  • tst_QFiledialog
  • tst_QFont
  • tst_QGraphicsProxyWidget
  • tst_QGuiVariant
  • tst_QHeaderView
  • tst_QHostAddress
  • tst_QIODevice
  • tst_QListWidget
  • tst_QLocalSocket
  • tst_QMainWindow
  • tst_QMetaObjectBuilder
  • tst_QMetaType
  • tst_QNetworkCacheMetaData
  • tst_QNetworkDiskCache
  • tst_QNetworkReply
  • ...
FALSEevaluated 183 times by 5 tests
Evaluated by:
  • tst_QAsn1Element
  • tst_QDataStream
  • tst_QHeaderView
  • tst_QIODevice
  • tst_QMetaType
183-133470
786 i = qint8(c);
executed 133470 times by 39 tests: i = qint8(c);
Executed by:
  • tst_QAbstractItemModel
  • tst_QAbstractNetworkCache
  • tst_QAsn1Element
  • tst_QBrush
  • tst_QBuffer
  • tst_QDataStream
  • tst_QDateTime
  • tst_QDockWidget
  • tst_QFile
  • tst_QFileDialog2
  • tst_QFiledialog
  • tst_QFont
  • tst_QGraphicsProxyWidget
  • tst_QGuiVariant
  • tst_QHeaderView
  • tst_QHostAddress
  • tst_QIODevice
  • tst_QListWidget
  • tst_QLocalSocket
  • tst_QMainWindow
  • tst_QMetaObjectBuilder
  • tst_QMetaType
  • tst_QNetworkCacheMetaData
  • tst_QNetworkDiskCache
  • tst_QNetworkReply
  • ...
133470
787 return *this;
executed 133653 times by 39 tests: return *this;
Executed by:
  • tst_QAbstractItemModel
  • tst_QAbstractNetworkCache
  • tst_QAsn1Element
  • tst_QBrush
  • tst_QBuffer
  • tst_QDataStream
  • tst_QDateTime
  • tst_QDockWidget
  • tst_QFile
  • tst_QFileDialog2
  • tst_QFiledialog
  • tst_QFont
  • tst_QGraphicsProxyWidget
  • tst_QGuiVariant
  • tst_QHeaderView
  • tst_QHostAddress
  • tst_QIODevice
  • tst_QListWidget
  • tst_QLocalSocket
  • tst_QMainWindow
  • tst_QMetaObjectBuilder
  • tst_QMetaType
  • tst_QNetworkCacheMetaData
  • tst_QNetworkDiskCache
  • tst_QNetworkReply
  • ...
133653
788}-
789-
790-
791/*!-
792 \fn QDataStream &QDataStream::operator>>(quint16 &i)-
793 \overload-
794-
795 Reads an unsigned 16-bit integer from the stream into \a i, and-
796 returns a reference to the stream.-
797*/-
798-
799/*!-
800 \overload-
801-
802 Reads a signed 16-bit integer from the stream into \a i, and-
803 returns a reference to the stream.-
804*/-
805-
806QDataStream &QDataStream::operator>>(qint16 &i)-
807{-
808 i = 0;-
809 CHECK_STREAM_PRECOND(*this)
never executed: return *this;
!devDescription
TRUEnever evaluated
FALSEevaluated 11603 times by 19 tests
Evaluated by:
  • tst_QAuthenticator
  • tst_QBrush
  • tst_QDataStream
  • tst_QDockWidget
  • tst_QFont
  • tst_QGuiVariant
  • tst_QIODevice
  • tst_QImage
  • tst_QImageReader
  • tst_QImageWriter
  • tst_QMetaType
  • tst_QPen
  • tst_QPicture
  • tst_QPixmap
  • tst_QPrinter
  • tst_QSettings
  • tst_QStandardItem
  • tst_QVariant
  • tst_QWidget
0-11603
810 if (readBlock(reinterpret_cast<char *>(&i), 2) != 2) {
readBlock(rein...>(&i), 2) != 2Description
TRUEevaluated 87 times by 5 tests
Evaluated by:
  • tst_QDataStream
  • tst_QIODevice
  • tst_QImage
  • tst_QImageReader
  • tst_QMetaType
FALSEevaluated 11516 times by 19 tests
Evaluated by:
  • tst_QAuthenticator
  • tst_QBrush
  • tst_QDataStream
  • tst_QDockWidget
  • tst_QFont
  • tst_QGuiVariant
  • tst_QIODevice
  • tst_QImage
  • tst_QImageReader
  • tst_QImageWriter
  • tst_QMetaType
  • tst_QPen
  • tst_QPicture
  • tst_QPixmap
  • tst_QPrinter
  • tst_QSettings
  • tst_QStandardItem
  • tst_QVariant
  • tst_QWidget
87-11516
811 i = 0;-
812 } else {
executed 87 times by 5 tests: end of block
Executed by:
  • tst_QDataStream
  • tst_QIODevice
  • tst_QImage
  • tst_QImageReader
  • tst_QMetaType
87
813 if (!noswap) {
!noswapDescription
TRUEevaluated 9998 times by 15 tests
Evaluated by:
  • tst_QBrush
  • tst_QDataStream
  • tst_QDockWidget
  • tst_QFont
  • tst_QGuiVariant
  • tst_QIODevice
  • tst_QImage
  • tst_QMetaType
  • tst_QPen
  • tst_QPicture
  • tst_QPrinter
  • tst_QSettings
  • tst_QStandardItem
  • tst_QVariant
  • tst_QWidget
FALSEevaluated 1518 times by 6 tests
Evaluated by:
  • tst_QAuthenticator
  • tst_QDataStream
  • tst_QImage
  • tst_QImageReader
  • tst_QImageWriter
  • tst_QPixmap
1518-9998
814 i = qbswap(i);-
815 }
executed 9998 times by 15 tests: end of block
Executed by:
  • tst_QBrush
  • tst_QDataStream
  • tst_QDockWidget
  • tst_QFont
  • tst_QGuiVariant
  • tst_QIODevice
  • tst_QImage
  • tst_QMetaType
  • tst_QPen
  • tst_QPicture
  • tst_QPrinter
  • tst_QSettings
  • tst_QStandardItem
  • tst_QVariant
  • tst_QWidget
9998
816 }
executed 11516 times by 19 tests: end of block
Executed by:
  • tst_QAuthenticator
  • tst_QBrush
  • tst_QDataStream
  • tst_QDockWidget
  • tst_QFont
  • tst_QGuiVariant
  • tst_QIODevice
  • tst_QImage
  • tst_QImageReader
  • tst_QImageWriter
  • tst_QMetaType
  • tst_QPen
  • tst_QPicture
  • tst_QPixmap
  • tst_QPrinter
  • tst_QSettings
  • tst_QStandardItem
  • tst_QVariant
  • tst_QWidget
11516
817 return *this;
executed 11603 times by 19 tests: return *this;
Executed by:
  • tst_QAuthenticator
  • tst_QBrush
  • tst_QDataStream
  • tst_QDockWidget
  • tst_QFont
  • tst_QGuiVariant
  • tst_QIODevice
  • tst_QImage
  • tst_QImageReader
  • tst_QImageWriter
  • tst_QMetaType
  • tst_QPen
  • tst_QPicture
  • tst_QPixmap
  • tst_QPrinter
  • tst_QSettings
  • tst_QStandardItem
  • tst_QVariant
  • tst_QWidget
11603
818}-
819-
820-
821/*!-
822 \fn QDataStream &QDataStream::operator>>(quint32 &i)-
823 \overload-
824-
825 Reads an unsigned 32-bit integer from the stream into \a i, and-
826 returns a reference to the stream.-
827*/-
828-
829/*!-
830 \overload-
831-
832 Reads a signed 32-bit integer from the stream into \a i, and-
833 returns a reference to the stream.-
834*/-
835-
836QDataStream &QDataStream::operator>>(qint32 &i)-
837{-
838 i = 0;-
839 CHECK_STREAM_PRECOND(*this)
never executed: return *this;
!devDescription
TRUEnever evaluated
FALSEevaluated 123863 times by 57 tests
Evaluated by:
  • tst_QAbstractItemModel
  • tst_QAbstractNetworkCache
  • tst_QAuthenticator
  • tst_QBitArray
  • tst_QBrush
  • tst_QDataStream
  • tst_QDate
  • tst_QDateTime
  • tst_QDockWidget
  • tst_QFileDialog2
  • tst_QFiledialog
  • tst_QFont
  • tst_QGraphicsProxyWidget
  • tst_QGuiVariant
  • tst_QHeaderView
  • tst_QHostAddress
  • tst_QIODevice
  • tst_QIcon
  • tst_QImage
  • tst_QImageReader
  • tst_QImageWriter
  • tst_QKeySequence
  • tst_QListWidget
  • tst_QLocalSocket
  • tst_QMainWindow
  • ...
0-123863
840 if (readBlock(reinterpret_cast<char *>(&i), 4) != 4) {
readBlock(rein...>(&i), 4) != 4Description
TRUEevaluated 728 times by 10 tests
Evaluated by:
  • tst_QDataStream
  • tst_QHeaderView
  • tst_QIODevice
  • tst_QImage
  • tst_QImageReader
  • tst_QMainWindow
  • tst_QMetaType
  • tst_QNetworkDiskCache
  • tst_QPixmap
  • tst_languageChange
FALSEevaluated 123135 times by 57 tests
Evaluated by:
  • tst_QAbstractItemModel
  • tst_QAbstractNetworkCache
  • tst_QAuthenticator
  • tst_QBitArray
  • tst_QBrush
  • tst_QDataStream
  • tst_QDate
  • tst_QDateTime
  • tst_QDockWidget
  • tst_QFileDialog2
  • tst_QFiledialog
  • tst_QFont
  • tst_QGraphicsProxyWidget
  • tst_QGuiVariant
  • tst_QHeaderView
  • tst_QHostAddress
  • tst_QIODevice
  • tst_QIcon
  • tst_QImage
  • tst_QImageReader
  • tst_QImageWriter
  • tst_QKeySequence
  • tst_QListWidget
  • tst_QLocalSocket
  • tst_QMainWindow
  • ...
728-123135
841 i = 0;-
842 } else {
executed 728 times by 10 tests: end of block
Executed by:
  • tst_QDataStream
  • tst_QHeaderView
  • tst_QIODevice
  • tst_QImage
  • tst_QImageReader
  • tst_QMainWindow
  • tst_QMetaType
  • tst_QNetworkDiskCache
  • tst_QPixmap
  • tst_languageChange
728
843 if (!noswap) {
!noswapDescription
TRUEevaluated 119399 times by 54 tests
Evaluated by:
  • tst_QAbstractItemModel
  • tst_QAbstractNetworkCache
  • tst_QBitArray
  • tst_QBrush
  • tst_QDataStream
  • tst_QDate
  • tst_QDateTime
  • tst_QDockWidget
  • tst_QFileDialog2
  • tst_QFiledialog
  • tst_QFont
  • tst_QGraphicsProxyWidget
  • tst_QGuiVariant
  • tst_QHeaderView
  • tst_QHostAddress
  • tst_QIODevice
  • tst_QIcon
  • tst_QImage
  • tst_QKeySequence
  • tst_QListWidget
  • tst_QLocalSocket
  • tst_QMainWindow
  • tst_QMargins
  • tst_QMetaObjectBuilder
  • tst_QMetaType
  • ...
FALSEevaluated 3736 times by 6 tests
Evaluated by:
  • tst_QAuthenticator
  • tst_QDataStream
  • tst_QImage
  • tst_QImageReader
  • tst_QImageWriter
  • tst_QPixmap
3736-119399
844 i = qbswap(i);-
845 }
executed 119399 times by 54 tests: end of block
Executed by:
  • tst_QAbstractItemModel
  • tst_QAbstractNetworkCache
  • tst_QBitArray
  • tst_QBrush
  • tst_QDataStream
  • tst_QDate
  • tst_QDateTime
  • tst_QDockWidget
  • tst_QFileDialog2
  • tst_QFiledialog
  • tst_QFont
  • tst_QGraphicsProxyWidget
  • tst_QGuiVariant
  • tst_QHeaderView
  • tst_QHostAddress
  • tst_QIODevice
  • tst_QIcon
  • tst_QImage
  • tst_QKeySequence
  • tst_QListWidget
  • tst_QLocalSocket
  • tst_QMainWindow
  • tst_QMargins
  • tst_QMetaObjectBuilder
  • tst_QMetaType
  • ...
119399
846 }
executed 123135 times by 57 tests: end of block
Executed by:
  • tst_QAbstractItemModel
  • tst_QAbstractNetworkCache
  • tst_QAuthenticator
  • tst_QBitArray
  • tst_QBrush
  • tst_QDataStream
  • tst_QDate
  • tst_QDateTime
  • tst_QDockWidget
  • tst_QFileDialog2
  • tst_QFiledialog
  • tst_QFont
  • tst_QGraphicsProxyWidget
  • tst_QGuiVariant
  • tst_QHeaderView
  • tst_QHostAddress
  • tst_QIODevice
  • tst_QIcon
  • tst_QImage
  • tst_QImageReader
  • tst_QImageWriter
  • tst_QKeySequence
  • tst_QListWidget
  • tst_QLocalSocket
  • tst_QMainWindow
  • ...
123135
847 return *this;
executed 123863 times by 57 tests: return *this;
Executed by:
  • tst_QAbstractItemModel
  • tst_QAbstractNetworkCache
  • tst_QAuthenticator
  • tst_QBitArray
  • tst_QBrush
  • tst_QDataStream
  • tst_QDate
  • tst_QDateTime
  • tst_QDockWidget
  • tst_QFileDialog2
  • tst_QFiledialog
  • tst_QFont
  • tst_QGraphicsProxyWidget
  • tst_QGuiVariant
  • tst_QHeaderView
  • tst_QHostAddress
  • tst_QIODevice
  • tst_QIcon
  • tst_QImage
  • tst_QImageReader
  • tst_QImageWriter
  • tst_QKeySequence
  • tst_QListWidget
  • tst_QLocalSocket
  • tst_QMainWindow
  • ...
123863
848}-
849-
850/*!-
851 \fn QDataStream &QDataStream::operator>>(quint64 &i)-
852 \overload-
853-
854 Reads an unsigned 64-bit integer from the stream, into \a i, and-
855 returns a reference to the stream.-
856*/-
857-
858/*!-
859 \overload-
860-
861 Reads a signed 64-bit integer from the stream into \a i, and-
862 returns a reference to the stream.-
863*/-
864-
865QDataStream &QDataStream::operator>>(qint64 &i)-
866{-
867 i = qint64(0);-
868 CHECK_STREAM_PRECOND(*this)
never executed: return *this;
!devDescription
TRUEnever evaluated
FALSEevaluated 35987 times by 13 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QDataStream
  • tst_QDate
  • tst_QDateTime
  • tst_QIODevice
  • tst_QLocalSocket
  • tst_QMetaType
  • tst_QNetworkCacheMetaData
  • tst_QNetworkDiskCache
  • tst_QNetworkReply
  • tst_QSettings
  • tst_QTimeZone
  • tst_QVariant
0-35987
869 if (version() < 6) {
version() < 6Description
TRUEnever evaluated
FALSEevaluated 35987 times by 13 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QDataStream
  • tst_QDate
  • tst_QDateTime
  • tst_QIODevice
  • tst_QLocalSocket
  • tst_QMetaType
  • tst_QNetworkCacheMetaData
  • tst_QNetworkDiskCache
  • tst_QNetworkReply
  • tst_QSettings
  • tst_QTimeZone
  • tst_QVariant
0-35987
870 quint32 i1, i2;-
871 *this >> i2 >> i1;-
872 i = ((quint64)i1 << 32) + i2;-
873 } else {
never executed: end of block
0
874 if (readBlock(reinterpret_cast<char *>(&i), 8) != 8) {
readBlock(rein...>(&i), 8) != 8Description
TRUEevaluated 185 times by 3 tests
Evaluated by:
  • tst_QDataStream
  • tst_QIODevice
  • tst_QMetaType
FALSEevaluated 35802 times by 13 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QDataStream
  • tst_QDate
  • tst_QDateTime
  • tst_QIODevice
  • tst_QLocalSocket
  • tst_QMetaType
  • tst_QNetworkCacheMetaData
  • tst_QNetworkDiskCache
  • tst_QNetworkReply
  • tst_QSettings
  • tst_QTimeZone
  • tst_QVariant
185-35802
875 i = qint64(0);-
876 } else {
executed 185 times by 3 tests: end of block
Executed by:
  • tst_QDataStream
  • tst_QIODevice
  • tst_QMetaType
185
877 if (!noswap) {
!noswapDescription
TRUEevaluated 35790 times by 13 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QDataStream
  • tst_QDate
  • tst_QDateTime
  • tst_QIODevice
  • tst_QLocalSocket
  • tst_QMetaType
  • tst_QNetworkCacheMetaData
  • tst_QNetworkDiskCache
  • tst_QNetworkReply
  • tst_QSettings
  • tst_QTimeZone
  • tst_QVariant
FALSEevaluated 12 times by 1 test
Evaluated by:
  • tst_QDataStream
12-35790
878 i = qbswap(i);-
879 }
executed 35790 times by 13 tests: end of block
Executed by:
  • tst_QAbstractNetworkCache
  • tst_QDataStream
  • tst_QDate
  • tst_QDateTime
  • tst_QIODevice
  • tst_QLocalSocket
  • tst_QMetaType
  • tst_QNetworkCacheMetaData
  • tst_QNetworkDiskCache
  • tst_QNetworkReply
  • tst_QSettings
  • tst_QTimeZone
  • tst_QVariant
35790
880 }
executed 35802 times by 13 tests: end of block
Executed by:
  • tst_QAbstractNetworkCache
  • tst_QDataStream
  • tst_QDate
  • tst_QDateTime
  • tst_QIODevice
  • tst_QLocalSocket
  • tst_QMetaType
  • tst_QNetworkCacheMetaData
  • tst_QNetworkDiskCache
  • tst_QNetworkReply
  • tst_QSettings
  • tst_QTimeZone
  • tst_QVariant
35802
881 }-
882 return *this;
executed 35987 times by 13 tests: return *this;
Executed by:
  • tst_QAbstractNetworkCache
  • tst_QDataStream
  • tst_QDate
  • tst_QDateTime
  • tst_QIODevice
  • tst_QLocalSocket
  • tst_QMetaType
  • tst_QNetworkCacheMetaData
  • tst_QNetworkDiskCache
  • tst_QNetworkReply
  • tst_QSettings
  • tst_QTimeZone
  • tst_QVariant
35987
883}-
884-
885/*!-
886 Reads a boolean value from the stream into \a i. Returns a-
887 reference to the stream.-
888*/-
889QDataStream &QDataStream::operator>>(bool &i)-
890{-
891 qint8 v;-
892 *this >> v;-
893 i = !!v;-
894 return *this;
executed 18849 times by 19 tests: return *this;
Executed by:
  • tst_QAbstractNetworkCache
  • tst_QDataStream
  • tst_QDateTime
  • tst_QFileDialog2
  • tst_QFiledialog
  • tst_QGraphicsProxyWidget
  • tst_QGuiVariant
  • tst_QHeaderView
  • tst_QIODevice
  • tst_QMetaObjectBuilder
  • tst_QMetaType
  • tst_QNetworkCacheMetaData
  • tst_QNetworkDiskCache
  • tst_QNetworkReply
  • tst_QPen
  • tst_QPrinter
  • tst_QSplitter
  • tst_QTimeZone
  • tst_languageChange
18849
895}-
896-
897/*!-
898 \overload-
899-
900 Reads a floating point number from the stream into \a f,-
901 using the standard IEEE 754 format. Returns a reference to the-
902 stream.-
903-
904 \sa setFloatingPointPrecision()-
905*/-
906-
907QDataStream &QDataStream::operator>>(float &f)-
908{-
909 if (version() >= QDataStream::Qt_4_6
version() >= Q...Stream::Qt_4_6Description
TRUEevaluated 1263 times by 4 tests
Evaluated by:
  • tst_QDataStream
  • tst_QIODevice
  • tst_QMetaType
  • tst_QVariant
FALSEnever evaluated
0-1263
910 && floatingPointPrecision() == QDataStream::DoublePrecision) {
floatingPointP...oublePrecisionDescription
TRUEevaluated 1237 times by 4 tests
Evaluated by:
  • tst_QDataStream
  • tst_QIODevice
  • tst_QMetaType
  • tst_QVariant
FALSEevaluated 26 times by 1 test
Evaluated by:
  • tst_QDataStream
26-1237
911 double d;-
912 *this >> d;-
913 f = d;-
914 return *this;
executed 1237 times by 4 tests: return *this;
Executed by:
  • tst_QDataStream
  • tst_QIODevice
  • tst_QMetaType
  • tst_QVariant
1237
915 }-
916-
917 f = 0.0f;-
918 CHECK_STREAM_PRECOND(*this)
never executed: return *this;
!devDescription
TRUEnever evaluated
FALSEevaluated 26 times by 1 test
Evaluated by:
  • tst_QDataStream
0-26
919 if (readBlock(reinterpret_cast<char *>(&f), 4) != 4) {
readBlock(rein...>(&f), 4) != 4Description
TRUEevaluated 10 times by 1 test
Evaluated by:
  • tst_QDataStream
FALSEevaluated 16 times by 1 test
Evaluated by:
  • tst_QDataStream
10-16
920 f = 0.0f;-
921 } else {
executed 10 times by 1 test: end of block
Executed by:
  • tst_QDataStream
10
922 if (!noswap) {
!noswapDescription
TRUEevaluated 10 times by 1 test
Evaluated by:
  • tst_QDataStream
FALSEevaluated 6 times by 1 test
Evaluated by:
  • tst_QDataStream
6-10
923 union {-
924 float val1;-
925 quint32 val2;-
926 } x;-
927 x.val2 = qbswap(*reinterpret_cast<quint32 *>(&f));-
928 f = x.val1;-
929 }
executed 10 times by 1 test: end of block
Executed by:
  • tst_QDataStream
10
930 }
executed 16 times by 1 test: end of block
Executed by:
  • tst_QDataStream
16
931 return *this;
executed 26 times by 1 test: return *this;
Executed by:
  • tst_QDataStream
26
932}-
933-
934/*!-
935 \overload-
936-
937 Reads a floating point number from the stream into \a f,-
938 using the standard IEEE 754 format. Returns a reference to the-
939 stream.-
940-
941 \sa setFloatingPointPrecision()-
942*/-
943-
944QDataStream &QDataStream::operator>>(double &f)-
945{-
946 if (version() >= QDataStream::Qt_4_6
version() >= Q...Stream::Qt_4_6Description
TRUEevaluated 11776 times by 14 tests
Evaluated by:
  • tst_QBrush
  • tst_QDataStream
  • tst_QFont
  • tst_QGuiVariant
  • tst_QIODevice
  • tst_QMargins
  • tst_QMetaType
  • tst_QPainterPath
  • tst_QPen
  • tst_QPicture
  • tst_QPointF
  • tst_QPrinter
  • tst_QStandardItem
  • tst_QVariant
FALSEevaluated 3248 times by 2 tests
Evaluated by:
  • tst_QDataStream
  • tst_QFont
3248-11776
947 && floatingPointPrecision() == QDataStream::SinglePrecision) {
floatingPointP...inglePrecisionDescription
TRUEevaluated 1 time by 1 test
Evaluated by:
  • tst_QDataStream
FALSEevaluated 11775 times by 14 tests
Evaluated by:
  • tst_QBrush
  • tst_QDataStream
  • tst_QFont
  • tst_QGuiVariant
  • tst_QIODevice
  • tst_QMargins
  • tst_QMetaType
  • tst_QPainterPath
  • tst_QPen
  • tst_QPicture
  • tst_QPointF
  • tst_QPrinter
  • tst_QStandardItem
  • tst_QVariant
1-11775
948 float d;-
949 *this >> d;-
950 f = d;-
951 return *this;
executed 1 time by 1 test: return *this;
Executed by:
  • tst_QDataStream
1
952 }-
953-
954 f = 0.0;-
955 CHECK_STREAM_PRECOND(*this)
never executed: return *this;
!devDescription
TRUEnever evaluated
FALSEevaluated 15023 times by 14 tests
Evaluated by:
  • tst_QBrush
  • tst_QDataStream
  • tst_QFont
  • tst_QGuiVariant
  • tst_QIODevice
  • tst_QMargins
  • tst_QMetaType
  • tst_QPainterPath
  • tst_QPen
  • tst_QPicture
  • tst_QPointF
  • tst_QPrinter
  • tst_QStandardItem
  • tst_QVariant
0-15023
956 if (readBlock(reinterpret_cast<char *>(&f), 8) != 8) {
readBlock(rein...>(&f), 8) != 8Description
TRUEevaluated 550 times by 3 tests
Evaluated by:
  • tst_QDataStream
  • tst_QIODevice
  • tst_QMetaType
FALSEevaluated 14473 times by 14 tests
Evaluated by:
  • tst_QBrush
  • tst_QDataStream
  • tst_QFont
  • tst_QGuiVariant
  • tst_QIODevice
  • tst_QMargins
  • tst_QMetaType
  • tst_QPainterPath
  • tst_QPen
  • tst_QPicture
  • tst_QPointF
  • tst_QPrinter
  • tst_QStandardItem
  • tst_QVariant
550-14473
957 f = 0.0;-
958 } else {
executed 550 times by 3 tests: end of block
Executed by:
  • tst_QDataStream
  • tst_QIODevice
  • tst_QMetaType
550
959 if (!noswap) {
!noswapDescription
TRUEevaluated 14466 times by 14 tests
Evaluated by:
  • tst_QBrush
  • tst_QDataStream
  • tst_QFont
  • tst_QGuiVariant
  • tst_QIODevice
  • tst_QMargins
  • tst_QMetaType
  • tst_QPainterPath
  • tst_QPen
  • tst_QPicture
  • tst_QPointF
  • tst_QPrinter
  • tst_QStandardItem
  • tst_QVariant
FALSEevaluated 7 times by 1 test
Evaluated by:
  • tst_QDataStream
7-14466
960 union {-
961 double val1;-
962 quint64 val2;-
963 } x;-
964 x.val2 = qbswap(*reinterpret_cast<quint64 *>(&f));-
965 f = x.val1;-
966 }
executed 14466 times by 14 tests: end of block
Executed by:
  • tst_QBrush
  • tst_QDataStream
  • tst_QFont
  • tst_QGuiVariant
  • tst_QIODevice
  • tst_QMargins
  • tst_QMetaType
  • tst_QPainterPath
  • tst_QPen
  • tst_QPicture
  • tst_QPointF
  • tst_QPrinter
  • tst_QStandardItem
  • tst_QVariant
14466
967 }
executed 14473 times by 14 tests: end of block
Executed by:
  • tst_QBrush
  • tst_QDataStream
  • tst_QFont
  • tst_QGuiVariant
  • tst_QIODevice
  • tst_QMargins
  • tst_QMetaType
  • tst_QPainterPath
  • tst_QPen
  • tst_QPicture
  • tst_QPointF
  • tst_QPrinter
  • tst_QStandardItem
  • tst_QVariant
14473
968 return *this;
executed 15023 times by 14 tests: return *this;
Executed by:
  • tst_QBrush
  • tst_QDataStream
  • tst_QFont
  • tst_QGuiVariant
  • tst_QIODevice
  • tst_QMargins
  • tst_QMetaType
  • tst_QPainterPath
  • tst_QPen
  • tst_QPicture
  • tst_QPointF
  • tst_QPrinter
  • tst_QStandardItem
  • tst_QVariant
15023
969}-
970-
971-
972/*!-
973 \overload-
974-
975 Reads the '\\0'-terminated string \a s from the stream and returns-
976 a reference to the stream.-
977-
978 The string is deserialized using \c{readBytes()}.-
979-
980 Space for the string is allocated using \c{new []} -- the caller must-
981 destroy it with \c{delete []}.-
982-
983 \sa readBytes(), readRawData()-
984*/-
985-
986QDataStream &QDataStream::operator>>(char *&s)-
987{-
988 uint len = 0;-
989 return readBytes(s, len);
executed 1253 times by 2 tests: return readBytes(s, len);
Executed by:
  • tst_QDataStream
  • tst_QIODevice
1253
990}-
991-
992-
993/*!-
994 Reads the buffer \a s from the stream and returns a reference to-
995 the stream.-
996-
997 The buffer \a s is allocated using \c{new []}. Destroy it with the-
998 \c{delete []} operator.-
999-
1000 The \a l parameter is set to the length of the buffer. If the-
1001 string read is empty, \a l is set to 0 and \a s is set to-
1002 a null pointer.-
1003-
1004 The serialization format is a quint32 length specifier first,-
1005 then \a l bytes of data.-
1006-
1007 \sa readRawData(), writeBytes()-
1008*/-
1009-
1010QDataStream &QDataStream::readBytes(char *&s, uint &l)-
1011{-
1012 s = 0;-
1013 l = 0;-
1014 CHECK_STREAM_PRECOND(*this)
never executed: return *this;
!devDescription
TRUEnever evaluated
FALSEevaluated 1281 times by 2 tests
Evaluated by:
  • tst_QDataStream
  • tst_QIODevice
0-1281
1015-
1016 quint32 len;-
1017 *this >> len;-
1018 if (len == 0)
len == 0Description
TRUEevaluated 334 times by 2 tests
Evaluated by:
  • tst_QDataStream
  • tst_QIODevice
FALSEevaluated 947 times by 2 tests
Evaluated by:
  • tst_QDataStream
  • tst_QIODevice
334-947
1019 return *this;
executed 334 times by 2 tests: return *this;
Executed by:
  • tst_QDataStream
  • tst_QIODevice
334
1020-
1021 const quint32 Step = 1024 * 1024;-
1022 quint32 allocated = 0;-
1023 char *prevBuf = 0;-
1024 char *curBuf = 0;-
1025-
1026 do {-
1027 int blockSize = qMin(Step, len - allocated);-
1028 prevBuf = curBuf;-
1029 curBuf = new char[allocated + blockSize + 1];-
1030 if (prevBuf) {
prevBufDescription
TRUEevaluated 28 times by 1 test
Evaluated by:
  • tst_QDataStream
FALSEevaluated 947 times by 2 tests
Evaluated by:
  • tst_QDataStream
  • tst_QIODevice
28-947
1031 memcpy(curBuf, prevBuf, allocated);-
1032 delete [] prevBuf;-
1033 }
executed 28 times by 1 test: end of block
Executed by:
  • tst_QDataStream
28
1034 if (readBlock(curBuf + allocated, blockSize) != blockSize) {
readBlock(curB...) != blockSizeDescription
TRUEevaluated 180 times by 2 tests
Evaluated by:
  • tst_QDataStream
  • tst_QIODevice
FALSEevaluated 795 times by 2 tests
Evaluated by:
  • tst_QDataStream
  • tst_QIODevice
180-795
1035 delete [] curBuf;-
1036 return *this;
executed 180 times by 2 tests: return *this;
Executed by:
  • tst_QDataStream
  • tst_QIODevice
180
1037 }-
1038 allocated += blockSize;-
1039 } while (allocated < len);
executed 795 times by 2 tests: end of block
Executed by:
  • tst_QDataStream
  • tst_QIODevice
allocated < lenDescription
TRUEevaluated 28 times by 1 test
Evaluated by:
  • tst_QDataStream
FALSEevaluated 767 times by 2 tests
Evaluated by:
  • tst_QDataStream
  • tst_QIODevice
28-795
1040-
1041 s = curBuf;-
1042 s[len] = '\0';-
1043 l = (uint)len;-
1044 return *this;
executed 767 times by 2 tests: return *this;
Executed by:
  • tst_QDataStream
  • tst_QIODevice
767
1045}-
1046-
1047/*!-
1048 Reads at most \a len bytes from the stream into \a s and returns the number of-
1049 bytes read. If an error occurs, this function returns -1.-
1050-
1051 The buffer \a s must be preallocated. The data is \e not encoded.-
1052-
1053 \sa readBytes(), QIODevice::read(), writeRawData()-
1054*/-
1055-
1056int QDataStream::readRawData(char *s, int len)-
1057{-
1058 CHECK_STREAM_PRECOND(-1)
never executed: return -1;
!devDescription
TRUEnever evaluated
FALSEevaluated 19060 times by 41 tests
Evaluated by:
  • tst_QAbstractItemModel
  • tst_QAbstractNetworkCache
  • tst_QAsn1Element
  • tst_QAuthenticator
  • tst_QBitArray
  • tst_QDataStream
  • tst_QDateTime
  • tst_QDockWidget
  • tst_QFileDialog2
  • tst_QFont
  • tst_QGuiVariant
  • tst_QHeaderView
  • tst_QHostAddress
  • tst_QIcon
  • tst_QImage
  • tst_QImageReader
  • tst_QImageWriter
  • tst_QListWidget
  • tst_QMainWindow
  • tst_QMetaObjectBuilder
  • tst_QMetaType
  • tst_QNetworkCacheMetaData
  • tst_QNetworkDiskCache
  • tst_QNetworkReply
  • tst_QPicture
  • ...
0-19060
1059 return readBlock(s, len);
executed 19060 times by 41 tests: return readBlock(s, len);
Executed by:
  • tst_QAbstractItemModel
  • tst_QAbstractNetworkCache
  • tst_QAsn1Element
  • tst_QAuthenticator
  • tst_QBitArray
  • tst_QDataStream
  • tst_QDateTime
  • tst_QDockWidget
  • tst_QFileDialog2
  • tst_QFont
  • tst_QGuiVariant
  • tst_QHeaderView
  • tst_QHostAddress
  • tst_QIcon
  • tst_QImage
  • tst_QImageReader
  • tst_QImageWriter
  • tst_QListWidget
  • tst_QMainWindow
  • tst_QMetaObjectBuilder
  • tst_QMetaType
  • tst_QNetworkCacheMetaData
  • tst_QNetworkDiskCache
  • tst_QNetworkReply
  • tst_QPicture
  • ...
19060
1060}-
1061-
1062-
1063/*****************************************************************************-
1064 QDataStream write functions-
1065 *****************************************************************************/-
1066-
1067-
1068/*!-
1069 \fn QDataStream &QDataStream::operator<<(quint8 i)-
1070 \overload-
1071-
1072 Writes an unsigned byte, \a i, to the stream and returns a-
1073 reference to the stream.-
1074*/-
1075-
1076/*!-
1077 Writes a signed byte, \a i, to the stream and returns a reference-
1078 to the stream.-
1079*/-
1080-
1081QDataStream &QDataStream::operator<<(qint8 i)-
1082{-
1083 CHECK_STREAM_WRITE_PRECOND(*this)
never executed: return *this;
executed 2 times by 1 test: return *this;
Executed by:
  • tst_QDataStream
!devDescription
TRUEnever evaluated
FALSEevaluated 27419 times by 32 tests
Evaluated by:
  • tst_QAbstractItemModel
  • tst_QAbstractNetworkCache
  • tst_QAsn1Element
  • tst_QAuthenticator
  • tst_QBrush
  • tst_QDataStream
  • tst_QDateTime
  • tst_QDockWidget
  • tst_QFile
  • tst_QFont
  • tst_QGuiVariant
  • tst_QHostAddress
  • tst_QIODevice
  • tst_QListWidget
  • tst_QLocalSocket
  • tst_QMainWindow
  • tst_QMetaType
  • tst_QNetworkCacheMetaData
  • tst_QNetworkDiskCache
  • tst_QNetworkReply
  • tst_QPen
  • tst_QPicture
  • tst_QPrinter
  • tst_QSettings
  • tst_QStandardItem
  • ...
q_status != OkDescription
TRUEevaluated 2 times by 1 test
Evaluated by:
  • tst_QDataStream
FALSEevaluated 27417 times by 32 tests
Evaluated by:
  • tst_QAbstractItemModel
  • tst_QAbstractNetworkCache
  • tst_QAsn1Element
  • tst_QAuthenticator
  • tst_QBrush
  • tst_QDataStream
  • tst_QDateTime
  • tst_QDockWidget
  • tst_QFile
  • tst_QFont
  • tst_QGuiVariant
  • tst_QHostAddress
  • tst_QIODevice
  • tst_QListWidget
  • tst_QLocalSocket
  • tst_QMainWindow
  • tst_QMetaType
  • tst_QNetworkCacheMetaData
  • tst_QNetworkDiskCache
  • tst_QNetworkReply
  • tst_QPen
  • tst_QPicture
  • tst_QPrinter
  • tst_QSettings
  • tst_QStandardItem
  • ...
0-27419
1084 if (!dev->putChar(i))
!dev->putChar(i)Description
TRUEevaluated 2 times by 1 test
Evaluated by:
  • tst_QDataStream
FALSEevaluated 27415 times by 32 tests
Evaluated by:
  • tst_QAbstractItemModel
  • tst_QAbstractNetworkCache
  • tst_QAsn1Element
  • tst_QAuthenticator
  • tst_QBrush
  • tst_QDataStream
  • tst_QDateTime
  • tst_QDockWidget
  • tst_QFile
  • tst_QFont
  • tst_QGuiVariant
  • tst_QHostAddress
  • tst_QIODevice
  • tst_QListWidget
  • tst_QLocalSocket
  • tst_QMainWindow
  • tst_QMetaType
  • tst_QNetworkCacheMetaData
  • tst_QNetworkDiskCache
  • tst_QNetworkReply
  • tst_QPen
  • tst_QPicture
  • tst_QPrinter
  • tst_QSettings
  • tst_QStandardItem
  • ...
2-27415
1085 q_status = WriteFailed;
executed 2 times by 1 test: q_status = WriteFailed;
Executed by:
  • tst_QDataStream
2
1086 return *this;
executed 27417 times by 32 tests: return *this;
Executed by:
  • tst_QAbstractItemModel
  • tst_QAbstractNetworkCache
  • tst_QAsn1Element
  • tst_QAuthenticator
  • tst_QBrush
  • tst_QDataStream
  • tst_QDateTime
  • tst_QDockWidget
  • tst_QFile
  • tst_QFont
  • tst_QGuiVariant
  • tst_QHostAddress
  • tst_QIODevice
  • tst_QListWidget
  • tst_QLocalSocket
  • tst_QMainWindow
  • tst_QMetaType
  • tst_QNetworkCacheMetaData
  • tst_QNetworkDiskCache
  • tst_QNetworkReply
  • tst_QPen
  • tst_QPicture
  • tst_QPrinter
  • tst_QSettings
  • tst_QStandardItem
  • ...
27417
1087}-
1088-
1089-
1090/*!-
1091 \fn QDataStream &QDataStream::operator<<(quint16 i)-
1092 \overload-
1093-
1094 Writes an unsigned 16-bit integer, \a i, to the stream and returns-
1095 a reference to the stream.-
1096*/-
1097-
1098/*!-
1099 \overload-
1100-
1101 Writes a signed 16-bit integer, \a i, to the stream and returns a-
1102 reference to the stream.-
1103*/-
1104-
1105QDataStream &QDataStream::operator<<(qint16 i)-
1106{-
1107 CHECK_STREAM_WRITE_PRECOND(*this)
never executed: return *this;
executed 2 times by 1 test: return *this;
Executed by:
  • tst_QDataStream
!devDescription
TRUEnever evaluated
FALSEevaluated 20205 times by 21 tests
Evaluated by:
  • tst_QAuthenticator
  • tst_QBrush
  • tst_QDataStream
  • tst_QDockWidget
  • tst_QFont
  • tst_QGuiVariant
  • tst_QIODevice
  • tst_QIcon
  • tst_QImage
  • tst_QImageReader
  • tst_QImageWriter
  • tst_QMetaType
  • tst_QPen
  • tst_QPicture
  • tst_QPixmap
  • tst_QPrinter
  • tst_QSettings
  • tst_QStandardItem
  • tst_QStyleSheetStyle
  • tst_QVariant
  • tst_QWidget
q_status != OkDescription
TRUEevaluated 2 times by 1 test
Evaluated by:
  • tst_QDataStream
FALSEevaluated 20203 times by 21 tests
Evaluated by:
  • tst_QAuthenticator
  • tst_QBrush
  • tst_QDataStream
  • tst_QDockWidget
  • tst_QFont
  • tst_QGuiVariant
  • tst_QIODevice
  • tst_QIcon
  • tst_QImage
  • tst_QImageReader
  • tst_QImageWriter
  • tst_QMetaType
  • tst_QPen
  • tst_QPicture
  • tst_QPixmap
  • tst_QPrinter
  • tst_QSettings
  • tst_QStandardItem
  • tst_QStyleSheetStyle
  • tst_QVariant
  • tst_QWidget
0-20205
1108 if (!noswap) {
!noswapDescription
TRUEevaluated 19913 times by 16 tests
Evaluated by:
  • tst_QBrush
  • tst_QDataStream
  • tst_QDockWidget
  • tst_QFont
  • tst_QGuiVariant
  • tst_QIODevice
  • tst_QIcon
  • tst_QMetaType
  • tst_QPen
  • tst_QPicture
  • tst_QPrinter
  • tst_QSettings
  • tst_QStandardItem
  • tst_QStyleSheetStyle
  • tst_QVariant
  • tst_QWidget
FALSEevaluated 290 times by 5 tests
Evaluated by:
  • tst_QAuthenticator
  • tst_QImage
  • tst_QImageReader
  • tst_QImageWriter
  • tst_QPixmap
290-19913
1109 i = qbswap(i);-
1110 }
executed 19913 times by 16 tests: end of block
Executed by:
  • tst_QBrush
  • tst_QDataStream
  • tst_QDockWidget
  • tst_QFont
  • tst_QGuiVariant
  • tst_QIODevice
  • tst_QIcon
  • tst_QMetaType
  • tst_QPen
  • tst_QPicture
  • tst_QPrinter
  • tst_QSettings
  • tst_QStandardItem
  • tst_QStyleSheetStyle
  • tst_QVariant
  • tst_QWidget
19913
1111 if (dev->write((char *)&i, sizeof(qint16)) != sizeof(qint16))
dev->write((ch...sizeof(qint16)Description
TRUEevaluated 2 times by 1 test
Evaluated by:
  • tst_QDataStream
FALSEevaluated 20201 times by 21 tests
Evaluated by:
  • tst_QAuthenticator
  • tst_QBrush
  • tst_QDataStream
  • tst_QDockWidget
  • tst_QFont
  • tst_QGuiVariant
  • tst_QIODevice
  • tst_QIcon
  • tst_QImage
  • tst_QImageReader
  • tst_QImageWriter
  • tst_QMetaType
  • tst_QPen
  • tst_QPicture
  • tst_QPixmap
  • tst_QPrinter
  • tst_QSettings
  • tst_QStandardItem
  • tst_QStyleSheetStyle
  • tst_QVariant
  • tst_QWidget
2-20201
1112 q_status = WriteFailed;
executed 2 times by 1 test: q_status = WriteFailed;
Executed by:
  • tst_QDataStream
2
1113 return *this;
executed 20203 times by 21 tests: return *this;
Executed by:
  • tst_QAuthenticator
  • tst_QBrush
  • tst_QDataStream
  • tst_QDockWidget
  • tst_QFont
  • tst_QGuiVariant
  • tst_QIODevice
  • tst_QIcon
  • tst_QImage
  • tst_QImageReader
  • tst_QImageWriter
  • tst_QMetaType
  • tst_QPen
  • tst_QPicture
  • tst_QPixmap
  • tst_QPrinter
  • tst_QSettings
  • tst_QStandardItem
  • tst_QStyleSheetStyle
  • tst_QVariant
  • tst_QWidget
20203
1114}-
1115-
1116/*!-
1117 \overload-
1118-
1119 Writes a signed 32-bit integer, \a i, to the stream and returns a-
1120 reference to the stream.-
1121*/-
1122-
1123QDataStream &QDataStream::operator<<(qint32 i)-
1124{-
1125 CHECK_STREAM_WRITE_PRECOND(*this)
never executed: return *this;
executed 3 times by 1 test: return *this;
Executed by:
  • tst_QDataStream
!devDescription
TRUEnever evaluated
FALSEevaluated 74641 times by 57 tests
Evaluated by:
  • tst_QAbstractItemModel
  • tst_QAbstractNetworkCache
  • tst_QAuthenticator
  • tst_QBitArray
  • tst_QBrush
  • tst_QDataStream
  • tst_QDate
  • tst_QDateTime
  • tst_QDockWidget
  • tst_QFileDialog2
  • tst_QFiledialog
  • tst_QFont
  • tst_QGraphicsProxyWidget
  • tst_QGuiVariant
  • tst_QHeaderView
  • tst_QHostAddress
  • tst_QIODevice
  • tst_QIcon
  • tst_QImage
  • tst_QImageReader
  • tst_QImageWriter
  • tst_QKeySequence
  • tst_QListWidget
  • tst_QLocalSocket
  • tst_QMainWindow
  • ...
q_status != OkDescription
TRUEevaluated 3 times by 1 test
Evaluated by:
  • tst_QDataStream
FALSEevaluated 74638 times by 57 tests
Evaluated by:
  • tst_QAbstractItemModel
  • tst_QAbstractNetworkCache
  • tst_QAuthenticator
  • tst_QBitArray
  • tst_QBrush
  • tst_QDataStream
  • tst_QDate
  • tst_QDateTime
  • tst_QDockWidget
  • tst_QFileDialog2
  • tst_QFiledialog
  • tst_QFont
  • tst_QGraphicsProxyWidget
  • tst_QGuiVariant
  • tst_QHeaderView
  • tst_QHostAddress
  • tst_QIODevice
  • tst_QIcon
  • tst_QImage
  • tst_QImageReader
  • tst_QImageWriter
  • tst_QKeySequence
  • tst_QListWidget
  • tst_QLocalSocket
  • tst_QMainWindow
  • ...
0-74641
1126 if (!noswap) {
!noswapDescription
TRUEevaluated 74139 times by 54 tests
Evaluated by:
  • tst_QAbstractItemModel
  • tst_QAbstractNetworkCache
  • tst_QBitArray
  • tst_QBrush
  • tst_QDataStream
  • tst_QDate
  • tst_QDateTime
  • tst_QDockWidget
  • tst_QFileDialog2
  • tst_QFiledialog
  • tst_QFont
  • tst_QGraphicsProxyWidget
  • tst_QGuiVariant
  • tst_QHeaderView
  • tst_QHostAddress
  • tst_QIODevice
  • tst_QIcon
  • tst_QImage
  • tst_QKeySequence
  • tst_QListWidget
  • tst_QLocalSocket
  • tst_QMainWindow
  • tst_QMargins
  • tst_QMetaObjectBuilder
  • tst_QMetaType
  • ...
FALSEevaluated 499 times by 5 tests
Evaluated by:
  • tst_QAuthenticator
  • tst_QImage
  • tst_QImageReader
  • tst_QImageWriter
  • tst_QPixmap
499-74139
1127 i = qbswap(i);-
1128 }
executed 74139 times by 54 tests: end of block
Executed by:
  • tst_QAbstractItemModel
  • tst_QAbstractNetworkCache
  • tst_QBitArray
  • tst_QBrush
  • tst_QDataStream
  • tst_QDate
  • tst_QDateTime
  • tst_QDockWidget
  • tst_QFileDialog2
  • tst_QFiledialog
  • tst_QFont
  • tst_QGraphicsProxyWidget
  • tst_QGuiVariant
  • tst_QHeaderView
  • tst_QHostAddress
  • tst_QIODevice
  • tst_QIcon
  • tst_QImage
  • tst_QKeySequence
  • tst_QListWidget
  • tst_QLocalSocket
  • tst_QMainWindow
  • tst_QMargins
  • tst_QMetaObjectBuilder
  • tst_QMetaType
  • ...
74139
1129 if (dev->write((char *)&i, sizeof(qint32)) != sizeof(qint32))
dev->write((ch...sizeof(qint32)Description
TRUEevaluated 3 times by 1 test
Evaluated by:
  • tst_QDataStream
FALSEevaluated 74635 times by 57 tests
Evaluated by:
  • tst_QAbstractItemModel
  • tst_QAbstractNetworkCache
  • tst_QAuthenticator
  • tst_QBitArray
  • tst_QBrush
  • tst_QDataStream
  • tst_QDate
  • tst_QDateTime
  • tst_QDockWidget
  • tst_QFileDialog2
  • tst_QFiledialog
  • tst_QFont
  • tst_QGraphicsProxyWidget
  • tst_QGuiVariant
  • tst_QHeaderView
  • tst_QHostAddress
  • tst_QIODevice
  • tst_QIcon
  • tst_QImage
  • tst_QImageReader
  • tst_QImageWriter
  • tst_QKeySequence
  • tst_QListWidget
  • tst_QLocalSocket
  • tst_QMainWindow
  • ...
3-74635
1130 q_status = WriteFailed;
executed 3 times by 1 test: q_status = WriteFailed;
Executed by:
  • tst_QDataStream
3
1131 return *this;
executed 74638 times by 57 tests: return *this;
Executed by:
  • tst_QAbstractItemModel
  • tst_QAbstractNetworkCache
  • tst_QAuthenticator
  • tst_QBitArray
  • tst_QBrush
  • tst_QDataStream
  • tst_QDate
  • tst_QDateTime
  • tst_QDockWidget
  • tst_QFileDialog2
  • tst_QFiledialog
  • tst_QFont
  • tst_QGraphicsProxyWidget
  • tst_QGuiVariant
  • tst_QHeaderView
  • tst_QHostAddress
  • tst_QIODevice
  • tst_QIcon
  • tst_QImage
  • tst_QImageReader
  • tst_QImageWriter
  • tst_QKeySequence
  • tst_QListWidget
  • tst_QLocalSocket
  • tst_QMainWindow
  • ...
74638
1132}-
1133-
1134/*!-
1135 \fn QDataStream &QDataStream::operator<<(quint64 i)-
1136 \overload-
1137-
1138 Writes an unsigned 64-bit integer, \a i, to the stream and returns a-
1139 reference to the stream.-
1140*/-
1141-
1142/*!-
1143 \overload-
1144-
1145 Writes a signed 64-bit integer, \a i, to the stream and returns a-
1146 reference to the stream.-
1147*/-
1148-
1149QDataStream &QDataStream::operator<<(qint64 i)-
1150{-
1151 CHECK_STREAM_WRITE_PRECOND(*this)
never executed: return *this;
executed 2 times by 1 test: return *this;
Executed by:
  • tst_QDataStream
!devDescription
TRUEnever evaluated
FALSEevaluated 5675 times by 13 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QAuthenticator
  • tst_QDataStream
  • tst_QDate
  • tst_QDateTime
  • tst_QIODevice
  • tst_QLocalSocket
  • tst_QMetaType
  • tst_QNetworkCacheMetaData
  • tst_QNetworkDiskCache
  • tst_QNetworkReply
  • tst_QSettings
  • tst_QVariant
q_status != OkDescription
TRUEevaluated 2 times by 1 test
Evaluated by:
  • tst_QDataStream
FALSEevaluated 5673 times by 13 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QAuthenticator
  • tst_QDataStream
  • tst_QDate
  • tst_QDateTime
  • tst_QIODevice
  • tst_QLocalSocket
  • tst_QMetaType
  • tst_QNetworkCacheMetaData
  • tst_QNetworkDiskCache
  • tst_QNetworkReply
  • tst_QSettings
  • tst_QVariant
0-5675
1152 if (version() < 6) {
version() < 6Description
TRUEnever evaluated
FALSEevaluated 5673 times by 13 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QAuthenticator
  • tst_QDataStream
  • tst_QDate
  • tst_QDateTime
  • tst_QIODevice
  • tst_QLocalSocket
  • tst_QMetaType
  • tst_QNetworkCacheMetaData
  • tst_QNetworkDiskCache
  • tst_QNetworkReply
  • tst_QSettings
  • tst_QVariant
0-5673
1153 quint32 i1 = i & 0xffffffff;-
1154 quint32 i2 = i >> 32;-
1155 *this << i2 << i1;-
1156 } else {
never executed: end of block
0
1157 if (!noswap) {
!noswapDescription
TRUEevaluated 5669 times by 12 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QDataStream
  • tst_QDate
  • tst_QDateTime
  • tst_QIODevice
  • tst_QLocalSocket
  • tst_QMetaType
  • tst_QNetworkCacheMetaData
  • tst_QNetworkDiskCache
  • tst_QNetworkReply
  • tst_QSettings
  • tst_QVariant
FALSEevaluated 4 times by 1 test
Evaluated by:
  • tst_QAuthenticator
4-5669
1158 i = qbswap(i);-
1159 }
executed 5669 times by 12 tests: end of block
Executed by:
  • tst_QAbstractNetworkCache
  • tst_QDataStream
  • tst_QDate
  • tst_QDateTime
  • tst_QIODevice
  • tst_QLocalSocket
  • tst_QMetaType
  • tst_QNetworkCacheMetaData
  • tst_QNetworkDiskCache
  • tst_QNetworkReply
  • tst_QSettings
  • tst_QVariant
5669
1160 if (dev->write((char *)&i, sizeof(qint64)) != sizeof(qint64))
dev->write((ch...sizeof(qint64)Description
TRUEevaluated 2 times by 1 test
Evaluated by:
  • tst_QDataStream
FALSEevaluated 5671 times by 13 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QAuthenticator
  • tst_QDataStream
  • tst_QDate
  • tst_QDateTime
  • tst_QIODevice
  • tst_QLocalSocket
  • tst_QMetaType
  • tst_QNetworkCacheMetaData
  • tst_QNetworkDiskCache
  • tst_QNetworkReply
  • tst_QSettings
  • tst_QVariant
2-5671
1161 q_status = WriteFailed;
executed 2 times by 1 test: q_status = WriteFailed;
Executed by:
  • tst_QDataStream
2
1162 }
executed 5673 times by 13 tests: end of block
Executed by:
  • tst_QAbstractNetworkCache
  • tst_QAuthenticator
  • tst_QDataStream
  • tst_QDate
  • tst_QDateTime
  • tst_QIODevice
  • tst_QLocalSocket
  • tst_QMetaType
  • tst_QNetworkCacheMetaData
  • tst_QNetworkDiskCache
  • tst_QNetworkReply
  • tst_QSettings
  • tst_QVariant
5673
1163 return *this;
executed 5673 times by 13 tests: return *this;
Executed by:
  • tst_QAbstractNetworkCache
  • tst_QAuthenticator
  • tst_QDataStream
  • tst_QDate
  • tst_QDateTime
  • tst_QIODevice
  • tst_QLocalSocket
  • tst_QMetaType
  • tst_QNetworkCacheMetaData
  • tst_QNetworkDiskCache
  • tst_QNetworkReply
  • tst_QSettings
  • tst_QVariant
5673
1164}-
1165-
1166/*!-
1167 \fn QDataStream &QDataStream::operator<<(quint32 i)-
1168 \overload-
1169-
1170 Writes an unsigned integer, \a i, to the stream as a 32-bit-
1171 unsigned integer (quint32). Returns a reference to the stream.-
1172*/-
1173-
1174/*!-
1175 Writes a boolean value, \a i, to the stream. Returns a reference-
1176 to the stream.-
1177*/-
1178-
1179QDataStream &QDataStream::operator<<(bool i)-
1180{-
1181 CHECK_STREAM_WRITE_PRECOND(*this)
never executed: return *this;
executed 1 time by 1 test: return *this;
Executed by:
  • tst_QDataStream
!devDescription
TRUEnever evaluated
FALSEevaluated 2155 times by 18 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QDataStream
  • tst_QFileDialog2
  • tst_QFiledialog
  • tst_QGraphicsProxyWidget
  • tst_QGuiVariant
  • tst_QHeaderView
  • tst_QIODevice
  • tst_QMetaObjectBuilder
  • tst_QMetaType
  • tst_QNetworkCacheMetaData
  • tst_QNetworkDiskCache
  • tst_QNetworkReply
  • tst_QPen
  • tst_QPicture
  • tst_QPrinter
  • tst_QSplitter
  • tst_languageChange
q_status != OkDescription
TRUEevaluated 1 time by 1 test
Evaluated by:
  • tst_QDataStream
FALSEevaluated 2154 times by 18 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QDataStream
  • tst_QFileDialog2
  • tst_QFiledialog
  • tst_QGraphicsProxyWidget
  • tst_QGuiVariant
  • tst_QHeaderView
  • tst_QIODevice
  • tst_QMetaObjectBuilder
  • tst_QMetaType
  • tst_QNetworkCacheMetaData
  • tst_QNetworkDiskCache
  • tst_QNetworkReply
  • tst_QPen
  • tst_QPicture
  • tst_QPrinter
  • tst_QSplitter
  • tst_languageChange
0-2155
1182 if (!dev->putChar(qint8(i)))
!dev->putChar(qint8(i))Description
TRUEevaluated 1 time by 1 test
Evaluated by:
  • tst_QDataStream
FALSEevaluated 2153 times by 18 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QDataStream
  • tst_QFileDialog2
  • tst_QFiledialog
  • tst_QGraphicsProxyWidget
  • tst_QGuiVariant
  • tst_QHeaderView
  • tst_QIODevice
  • tst_QMetaObjectBuilder
  • tst_QMetaType
  • tst_QNetworkCacheMetaData
  • tst_QNetworkDiskCache
  • tst_QNetworkReply
  • tst_QPen
  • tst_QPicture
  • tst_QPrinter
  • tst_QSplitter
  • tst_languageChange
1-2153
1183 q_status = WriteFailed;
executed 1 time by 1 test: q_status = WriteFailed;
Executed by:
  • tst_QDataStream
1
1184 return *this;
executed 2154 times by 18 tests: return *this;
Executed by:
  • tst_QAbstractNetworkCache
  • tst_QDataStream
  • tst_QFileDialog2
  • tst_QFiledialog
  • tst_QGraphicsProxyWidget
  • tst_QGuiVariant
  • tst_QHeaderView
  • tst_QIODevice
  • tst_QMetaObjectBuilder
  • tst_QMetaType
  • tst_QNetworkCacheMetaData
  • tst_QNetworkDiskCache
  • tst_QNetworkReply
  • tst_QPen
  • tst_QPicture
  • tst_QPrinter
  • tst_QSplitter
  • tst_languageChange
2154
1185}-
1186-
1187/*!-
1188 \overload-
1189-
1190 Writes a floating point number, \a f, to the stream using-
1191 the standard IEEE 754 format. Returns a reference to the stream.-
1192-
1193 \sa setFloatingPointPrecision()-
1194*/-
1195-
1196QDataStream &QDataStream::operator<<(float f)-
1197{-
1198 if (version() >= QDataStream::Qt_4_6
version() >= Q...Stream::Qt_4_6Description
TRUEevaluated 23 times by 4 tests
Evaluated by:
  • tst_QDataStream
  • tst_QIODevice
  • tst_QMetaType
  • tst_QVariant
FALSEnever evaluated
0-23
1199 && floatingPointPrecision() == QDataStream::DoublePrecision) {
floatingPointP...oublePrecisionDescription
TRUEevaluated 19 times by 4 tests
Evaluated by:
  • tst_QDataStream
  • tst_QIODevice
  • tst_QMetaType
  • tst_QVariant
FALSEevaluated 4 times by 1 test
Evaluated by:
  • tst_QDataStream
4-19
1200 *this << double(f);-
1201 return *this;
executed 19 times by 4 tests: return *this;
Executed by:
  • tst_QDataStream
  • tst_QIODevice
  • tst_QMetaType
  • tst_QVariant
19
1202 }-
1203-
1204 CHECK_STREAM_WRITE_PRECOND(*this)
never executed: return *this;
never executed: return *this;
!devDescription
TRUEnever evaluated
FALSEevaluated 4 times by 1 test
Evaluated by:
  • tst_QDataStream
q_status != OkDescription
TRUEnever evaluated
FALSEevaluated 4 times by 1 test
Evaluated by:
  • tst_QDataStream
0-4
1205 float g = f; // fixes float-on-stack problem-
1206 if (!noswap) {
!noswapDescription
TRUEevaluated 4 times by 1 test
Evaluated by:
  • tst_QDataStream
FALSEnever evaluated
0-4
1207 union {-
1208 float val1;-
1209 quint32 val2;-
1210 } x;-
1211 x.val1 = g;-
1212 x.val2 = qbswap(x.val2);-
1213-
1214 if (dev->write((char *)&x.val2, sizeof(float)) != sizeof(float))
dev->write((ch... sizeof(float)Description
TRUEnever evaluated
FALSEevaluated 4 times by 1 test
Evaluated by:
  • tst_QDataStream
0-4
1215 q_status = WriteFailed;
never executed: q_status = WriteFailed;
0
1216 return *this;
executed 4 times by 1 test: return *this;
Executed by:
  • tst_QDataStream
4
1217 }-
1218-
1219 if (dev->write((char *)&g, sizeof(float)) != sizeof(float))
dev->write((ch... sizeof(float)Description
TRUEnever evaluated
FALSEnever evaluated
0
1220 q_status = WriteFailed;
never executed: q_status = WriteFailed;
0
1221 return *this;
never executed: return *this;
0
1222}-
1223-
1224-
1225/*!-
1226 \overload-
1227-
1228 Writes a floating point number, \a f, to the stream using-
1229 the standard IEEE 754 format. Returns a reference to the stream.-
1230-
1231 \sa setFloatingPointPrecision()-
1232*/-
1233-
1234QDataStream &QDataStream::operator<<(double f)-
1235{-
1236 if (version() >= QDataStream::Qt_4_6
version() >= Q...Stream::Qt_4_6Description
TRUEevaluated 28998 times by 15 tests
Evaluated by:
  • tst_QBrush
  • tst_QDataStream
  • tst_QFont
  • tst_QGuiVariant
  • tst_QIODevice
  • tst_QMargins
  • tst_QMetaType
  • tst_QPainterPath
  • tst_QPen
  • tst_QPicture
  • tst_QPointF
  • tst_QPrinter
  • tst_QStandardItem
  • tst_QStyleSheetStyle
  • tst_QVariant
FALSEevaluated 3187 times by 2 tests
Evaluated by:
  • tst_QDataStream
  • tst_QFont
3187-28998
1237 && floatingPointPrecision() == QDataStream::SinglePrecision) {
floatingPointP...inglePrecisionDescription
TRUEevaluated 1 time by 1 test
Evaluated by:
  • tst_QDataStream
FALSEevaluated 28997 times by 15 tests
Evaluated by:
  • tst_QBrush
  • tst_QDataStream
  • tst_QFont
  • tst_QGuiVariant
  • tst_QIODevice
  • tst_QMargins
  • tst_QMetaType
  • tst_QPainterPath
  • tst_QPen
  • tst_QPicture
  • tst_QPointF
  • tst_QPrinter
  • tst_QStandardItem
  • tst_QStyleSheetStyle
  • tst_QVariant
1-28997
1238 *this << float(f);-
1239 return *this;
executed 1 time by 1 test: return *this;
Executed by:
  • tst_QDataStream
1
1240 }-
1241-
1242 CHECK_STREAM_WRITE_PRECOND(*this)
never executed: return *this;
executed 2 times by 1 test: return *this;
Executed by:
  • tst_QDataStream
!devDescription
TRUEnever evaluated
FALSEevaluated 32184 times by 15 tests
Evaluated by:
  • tst_QBrush
  • tst_QDataStream
  • tst_QFont
  • tst_QGuiVariant
  • tst_QIODevice
  • tst_QMargins
  • tst_QMetaType
  • tst_QPainterPath
  • tst_QPen
  • tst_QPicture
  • tst_QPointF
  • tst_QPrinter
  • tst_QStandardItem
  • tst_QStyleSheetStyle
  • tst_QVariant
q_status != OkDescription
TRUEevaluated 2 times by 1 test
Evaluated by:
  • tst_QDataStream
FALSEevaluated 32182 times by 15 tests
Evaluated by:
  • tst_QBrush
  • tst_QDataStream
  • tst_QFont
  • tst_QGuiVariant
  • tst_QIODevice
  • tst_QMargins
  • tst_QMetaType
  • tst_QPainterPath
  • tst_QPen
  • tst_QPicture
  • tst_QPointF
  • tst_QPrinter
  • tst_QStandardItem
  • tst_QStyleSheetStyle
  • tst_QVariant
0-32184
1243 if (noswap) {
noswapDescription
TRUEnever evaluated
FALSEevaluated 32182 times by 15 tests
Evaluated by:
  • tst_QBrush
  • tst_QDataStream
  • tst_QFont
  • tst_QGuiVariant
  • tst_QIODevice
  • tst_QMargins
  • tst_QMetaType
  • tst_QPainterPath
  • tst_QPen
  • tst_QPicture
  • tst_QPointF
  • tst_QPrinter
  • tst_QStandardItem
  • tst_QStyleSheetStyle
  • tst_QVariant
0-32182
1244 if (dev->write((char *)&f, sizeof(double)) != sizeof(double))
dev->write((ch...sizeof(double)Description
TRUEnever evaluated
FALSEnever evaluated
0
1245 q_status = WriteFailed;
never executed: q_status = WriteFailed;
0
1246 } else {
never executed: end of block
0
1247 union {-
1248 double val1;-
1249 quint64 val2;-
1250 } x;-
1251 x.val1 = f;-
1252 x.val2 = qbswap(x.val2);-
1253 if (dev->write((char *)&x.val2, sizeof(double)) != sizeof(double))
dev->write((ch...sizeof(double)Description
TRUEevaluated 2 times by 1 test
Evaluated by:
  • tst_QDataStream
FALSEevaluated 32180 times by 15 tests
Evaluated by:
  • tst_QBrush
  • tst_QDataStream
  • tst_QFont
  • tst_QGuiVariant
  • tst_QIODevice
  • tst_QMargins
  • tst_QMetaType
  • tst_QPainterPath
  • tst_QPen
  • tst_QPicture
  • tst_QPointF
  • tst_QPrinter
  • tst_QStandardItem
  • tst_QStyleSheetStyle
  • tst_QVariant
2-32180
1254 q_status = WriteFailed;
executed 2 times by 1 test: q_status = WriteFailed;
Executed by:
  • tst_QDataStream
2
1255 }
executed 32182 times by 15 tests: end of block
Executed by:
  • tst_QBrush
  • tst_QDataStream
  • tst_QFont
  • tst_QGuiVariant
  • tst_QIODevice
  • tst_QMargins
  • tst_QMetaType
  • tst_QPainterPath
  • tst_QPen
  • tst_QPicture
  • tst_QPointF
  • tst_QPrinter
  • tst_QStandardItem
  • tst_QStyleSheetStyle
  • tst_QVariant
32182
1256 return *this;
executed 32182 times by 15 tests: return *this;
Executed by:
  • tst_QBrush
  • tst_QDataStream
  • tst_QFont
  • tst_QGuiVariant
  • tst_QIODevice
  • tst_QMargins
  • tst_QMetaType
  • tst_QPainterPath
  • tst_QPen
  • tst_QPicture
  • tst_QPointF
  • tst_QPrinter
  • tst_QStandardItem
  • tst_QStyleSheetStyle
  • tst_QVariant
32182
1257}-
1258-
1259-
1260/*!-
1261 \overload-
1262-
1263 Writes the '\\0'-terminated string \a s to the stream and returns a-
1264 reference to the stream.-
1265-
1266 The string is serialized using \c{writeBytes()}.-
1267-
1268 \sa writeBytes(), writeRawData()-
1269*/-
1270-
1271QDataStream &QDataStream::operator<<(const char *s)-
1272{-
1273 if (!s) {
!sDescription
TRUEnever evaluated
FALSEevaluated 14 times by 4 tests
Evaluated by:
  • tst_QDataStream
  • tst_QIODevice
  • tst_QIcon
  • tst_QVariant
0-14
1274 *this << (quint32)0;-
1275 return *this;
never executed: return *this;
0
1276 }-
1277 uint len = qstrlen(s) + 1; // also write null terminator-
1278 *this << (quint32)len; // write length specifier-
1279 writeRawData(s, len);-
1280 return *this;
executed 14 times by 4 tests: return *this;
Executed by:
  • tst_QDataStream
  • tst_QIODevice
  • tst_QIcon
  • tst_QVariant
14
1281}-
1282-
1283-
1284/*!-
1285 Writes the length specifier \a len and the buffer \a s to the-
1286 stream and returns a reference to the stream.-
1287-
1288 The \a len is serialized as a quint32, followed by \a len bytes-
1289 from \a s. Note that the data is \e not encoded.-
1290-
1291 \sa writeRawData(), readBytes()-
1292*/-
1293-
1294QDataStream &QDataStream::writeBytes(const char *s, uint len)-
1295{-
1296 CHECK_STREAM_WRITE_PRECOND(*this)
never executed: return *this;
never executed: return *this;
!devDescription
TRUEnever evaluated
FALSEevaluated 15693 times by 31 tests
Evaluated by:
  • tst_QAbstractItemModel
  • tst_QAbstractNetworkCache
  • tst_QDataStream
  • tst_QDateTime
  • tst_QDockWidget
  • tst_QFileDialog2
  • tst_QFont
  • tst_QGuiVariant
  • tst_QHostAddress
  • tst_QIcon
  • tst_QListWidget
  • tst_QMainWindow
  • tst_QMetaObjectBuilder
  • tst_QMetaType
  • tst_QNetworkCacheMetaData
  • tst_QNetworkDiskCache
  • tst_QNetworkReply
  • tst_QPicture
  • tst_QPrinter
  • tst_QRegularExpression_AlwaysOptimize
  • tst_QRegularExpression_DefaultOptimize
  • tst_QRegularExpression_ForceOptimize
  • tst_QSettings
  • tst_QStandardItem
  • tst_QStandardItemModel
  • ...
q_status != OkDescription
TRUEnever evaluated
FALSEevaluated 15693 times by 31 tests
Evaluated by:
  • tst_QAbstractItemModel
  • tst_QAbstractNetworkCache
  • tst_QDataStream
  • tst_QDateTime
  • tst_QDockWidget
  • tst_QFileDialog2
  • tst_QFont
  • tst_QGuiVariant
  • tst_QHostAddress
  • tst_QIcon
  • tst_QListWidget
  • tst_QMainWindow
  • tst_QMetaObjectBuilder
  • tst_QMetaType
  • tst_QNetworkCacheMetaData
  • tst_QNetworkDiskCache
  • tst_QNetworkReply
  • tst_QPicture
  • tst_QPrinter
  • tst_QRegularExpression_AlwaysOptimize
  • tst_QRegularExpression_DefaultOptimize
  • tst_QRegularExpression_ForceOptimize
  • tst_QSettings
  • tst_QStandardItem
  • tst_QStandardItemModel
  • ...
0-15693
1297 *this << (quint32)len; // write length specifier-
1298 if (len)
lenDescription
TRUEevaluated 15469 times by 31 tests
Evaluated by:
  • tst_QAbstractItemModel
  • tst_QAbstractNetworkCache
  • tst_QDataStream
  • tst_QDateTime
  • tst_QDockWidget
  • tst_QFileDialog2
  • tst_QFont
  • tst_QGuiVariant
  • tst_QHostAddress
  • tst_QIcon
  • tst_QListWidget
  • tst_QMainWindow
  • tst_QMetaObjectBuilder
  • tst_QMetaType
  • tst_QNetworkCacheMetaData
  • tst_QNetworkDiskCache
  • tst_QNetworkReply
  • tst_QPicture
  • tst_QPrinter
  • tst_QRegularExpression_AlwaysOptimize
  • tst_QRegularExpression_DefaultOptimize
  • tst_QRegularExpression_ForceOptimize
  • tst_QSettings
  • tst_QStandardItem
  • tst_QStandardItemModel
  • ...
FALSEevaluated 224 times by 7 tests
Evaluated by:
  • tst_QDataStream
  • tst_QMetaObjectBuilder
  • tst_QRegularExpression_AlwaysOptimize
  • tst_QRegularExpression_DefaultOptimize
  • tst_QRegularExpression_ForceOptimize
  • tst_QSettings
  • tst_QVariant
224-15469
1299 writeRawData(s, len);
executed 15469 times by 31 tests: writeRawData(s, len);
Executed by:
  • tst_QAbstractItemModel
  • tst_QAbstractNetworkCache
  • tst_QDataStream
  • tst_QDateTime
  • tst_QDockWidget
  • tst_QFileDialog2
  • tst_QFont
  • tst_QGuiVariant
  • tst_QHostAddress
  • tst_QIcon
  • tst_QListWidget
  • tst_QMainWindow
  • tst_QMetaObjectBuilder
  • tst_QMetaType
  • tst_QNetworkCacheMetaData
  • tst_QNetworkDiskCache
  • tst_QNetworkReply
  • tst_QPicture
  • tst_QPrinter
  • tst_QRegularExpression_AlwaysOptimize
  • tst_QRegularExpression_DefaultOptimize
  • tst_QRegularExpression_ForceOptimize
  • tst_QSettings
  • tst_QStandardItem
  • tst_QStandardItemModel
  • ...
15469
1300 return *this;
executed 15693 times by 31 tests: return *this;
Executed by:
  • tst_QAbstractItemModel
  • tst_QAbstractNetworkCache
  • tst_QDataStream
  • tst_QDateTime
  • tst_QDockWidget
  • tst_QFileDialog2
  • tst_QFont
  • tst_QGuiVariant
  • tst_QHostAddress
  • tst_QIcon
  • tst_QListWidget
  • tst_QMainWindow
  • tst_QMetaObjectBuilder
  • tst_QMetaType
  • tst_QNetworkCacheMetaData
  • tst_QNetworkDiskCache
  • tst_QNetworkReply
  • tst_QPicture
  • tst_QPrinter
  • tst_QRegularExpression_AlwaysOptimize
  • tst_QRegularExpression_DefaultOptimize
  • tst_QRegularExpression_ForceOptimize
  • tst_QSettings
  • tst_QStandardItem
  • tst_QStandardItemModel
  • ...
15693
1301}-
1302-
1303-
1304/*!-
1305 Writes \a len bytes from \a s to the stream. Returns the-
1306 number of bytes actually written, or -1 on error.-
1307 The data is \e not encoded.-
1308-
1309 \sa writeBytes(), QIODevice::write(), readRawData()-
1310*/-
1311-
1312int QDataStream::writeRawData(const char *s, int len)-
1313{-
1314 CHECK_STREAM_WRITE_PRECOND(-1)
never executed: return -1;
executed 3 times by 1 test: return -1;
Executed by:
  • tst_QDataStream
!devDescription
TRUEnever evaluated
FALSEevaluated 16967 times by 41 tests
Evaluated by:
  • tst_QAbstractItemModel
  • tst_QAbstractNetworkCache
  • tst_QAsn1Element
  • tst_QAuthenticator
  • tst_QBitArray
  • tst_QDataStream
  • tst_QDateTime
  • tst_QDockWidget
  • tst_QFileDialog2
  • tst_QFont
  • tst_QGuiVariant
  • tst_QHeaderView
  • tst_QHostAddress
  • tst_QIODevice
  • tst_QIcon
  • tst_QImage
  • tst_QImageReader
  • tst_QImageWriter
  • tst_QListWidget
  • tst_QMainWindow
  • tst_QMetaObjectBuilder
  • tst_QMetaType
  • tst_QNetworkCacheMetaData
  • tst_QNetworkDiskCache
  • tst_QNetworkReply
  • ...
q_status != OkDescription
TRUEevaluated 3 times by 1 test
Evaluated by:
  • tst_QDataStream
FALSEevaluated 16964 times by 41 tests
Evaluated by:
  • tst_QAbstractItemModel
  • tst_QAbstractNetworkCache
  • tst_QAsn1Element
  • tst_QAuthenticator
  • tst_QBitArray
  • tst_QDataStream
  • tst_QDateTime
  • tst_QDockWidget
  • tst_QFileDialog2
  • tst_QFont
  • tst_QGuiVariant
  • tst_QHeaderView
  • tst_QHostAddress
  • tst_QIODevice
  • tst_QIcon
  • tst_QImage
  • tst_QImageReader
  • tst_QImageWriter
  • tst_QListWidget
  • tst_QMainWindow
  • tst_QMetaObjectBuilder
  • tst_QMetaType
  • tst_QNetworkCacheMetaData
  • tst_QNetworkDiskCache
  • tst_QNetworkReply
  • ...
0-16967
1315 int ret = dev->write(s, len);-
1316 if (ret != len)
ret != lenDescription
TRUEevaluated 1 time by 1 test
Evaluated by:
  • tst_QDataStream
FALSEevaluated 16963 times by 41 tests
Evaluated by:
  • tst_QAbstractItemModel
  • tst_QAbstractNetworkCache
  • tst_QAsn1Element
  • tst_QAuthenticator
  • tst_QBitArray
  • tst_QDataStream
  • tst_QDateTime
  • tst_QDockWidget
  • tst_QFileDialog2
  • tst_QFont
  • tst_QGuiVariant
  • tst_QHeaderView
  • tst_QHostAddress
  • tst_QIODevice
  • tst_QIcon
  • tst_QImage
  • tst_QImageReader
  • tst_QImageWriter
  • tst_QListWidget
  • tst_QMainWindow
  • tst_QMetaObjectBuilder
  • tst_QMetaType
  • tst_QNetworkCacheMetaData
  • tst_QNetworkDiskCache
  • tst_QNetworkReply
  • ...
1-16963
1317 q_status = WriteFailed;
executed 1 time by 1 test: q_status = WriteFailed;
Executed by:
  • tst_QDataStream
1
1318 return ret;
executed 16964 times by 41 tests: return ret;
Executed by:
  • tst_QAbstractItemModel
  • tst_QAbstractNetworkCache
  • tst_QAsn1Element
  • tst_QAuthenticator
  • tst_QBitArray
  • tst_QDataStream
  • tst_QDateTime
  • tst_QDockWidget
  • tst_QFileDialog2
  • tst_QFont
  • tst_QGuiVariant
  • tst_QHeaderView
  • tst_QHostAddress
  • tst_QIODevice
  • tst_QIcon
  • tst_QImage
  • tst_QImageReader
  • tst_QImageWriter
  • tst_QListWidget
  • tst_QMainWindow
  • tst_QMetaObjectBuilder
  • tst_QMetaType
  • tst_QNetworkCacheMetaData
  • tst_QNetworkDiskCache
  • tst_QNetworkReply
  • ...
16964
1319}-
1320-
1321/*!-
1322 \since 4.1-
1323-
1324 Skips \a len bytes from the device. Returns the number of bytes-
1325 actually skipped, or -1 on error.-
1326-
1327 This is equivalent to calling readRawData() on a buffer of length-
1328 \a len and ignoring the buffer.-
1329-
1330 \sa QIODevice::seek()-
1331*/-
1332int QDataStream::skipRawData(int len)-
1333{-
1334 CHECK_STREAM_PRECOND(-1)
never executed: return -1;
!devDescription
TRUEnever evaluated
FALSEevaluated 24 times by 2 tests
Evaluated by:
  • tst_QAuthenticator
  • tst_QDataStream
0-24
1335-
1336 if (dev->isSequential()) {
dev->isSequential()Description
TRUEevaluated 3 times by 1 test
Evaluated by:
  • tst_QDataStream
FALSEevaluated 21 times by 2 tests
Evaluated by:
  • tst_QAuthenticator
  • tst_QDataStream
3-21
1337 char buf[4096];-
1338 int sumRead = 0;-
1339-
1340 while (len > 0) {
len > 0Description
TRUEevaluated 9 times by 1 test
Evaluated by:
  • tst_QDataStream
FALSEevaluated 3 times by 1 test
Evaluated by:
  • tst_QDataStream
3-9
1341 int blockSize = qMin(len, (int)sizeof(buf));-
1342 int n = readBlock(buf, blockSize);-
1343 if (n == -1)
n == -1Description
TRUEnever evaluated
FALSEevaluated 9 times by 1 test
Evaluated by:
  • tst_QDataStream
0-9
1344 return -1;
never executed: return -1;
0
1345 if (n == 0)
n == 0Description
TRUEnever evaluated
FALSEevaluated 9 times by 1 test
Evaluated by:
  • tst_QDataStream
0-9
1346 return sumRead;
never executed: return sumRead;
0
1347-
1348 sumRead += n;-
1349 len -= blockSize;-
1350 }
executed 9 times by 1 test: end of block
Executed by:
  • tst_QDataStream
9
1351 return sumRead;
executed 3 times by 1 test: return sumRead;
Executed by:
  • tst_QDataStream
3
1352 } else {-
1353 qint64 pos = dev->pos();-
1354 qint64 size = dev->size();-
1355 if (pos + len > size)
pos + len > sizeDescription
TRUEevaluated 1 time by 1 test
Evaluated by:
  • tst_QDataStream
FALSEevaluated 20 times by 2 tests
Evaluated by:
  • tst_QAuthenticator
  • tst_QDataStream
1-20
1356 len = size - pos;
executed 1 time by 1 test: len = size - pos;
Executed by:
  • tst_QDataStream
1
1357 if (!dev->seek(pos + len))
!dev->seek(pos + len)Description
TRUEnever evaluated
FALSEevaluated 21 times by 2 tests
Evaluated by:
  • tst_QAuthenticator
  • tst_QDataStream
0-21
1358 return -1;
never executed: return -1;
0
1359 return len;
executed 21 times by 2 tests: return len;
Executed by:
  • tst_QAuthenticator
  • tst_QDataStream
21
1360 }-
1361}-
1362-
1363QT_END_NAMESPACE-
1364-
1365#endif // QT_NO_DATASTREAM-
Source codeSwitch to Preprocessed file

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