OpenCoverage

qfiledevice.cpp

Absolute File Name:/home/qt/qt5_coco/qt5/qtbase/src/corelib/io/qfiledevice.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 "qplatformdefs.h"-
41#include "qfiledevice.h"-
42#include "qfiledevice_p.h"-
43#include "qfsfileengine_p.h"-
44-
45#ifdef QT_NO_QOBJECT-
46#define tr(X) QString::fromLatin1(X)-
47#endif-
48-
49QT_BEGIN_NAMESPACE-
50-
51#ifndef QFILE_WRITEBUFFER_SIZE-
52#define QFILE_WRITEBUFFER_SIZE 16384-
53#endif-
54-
55QFileDevicePrivate::QFileDevicePrivate()-
56 : fileEngine(0),-
57 cachedSize(0),-
58 error(QFile::NoError), lastWasWrite(false)-
59{-
60 writeBufferChunkSize = QFILE_WRITEBUFFER_SIZE;-
61}
executed 65126 times by 217 tests: end of block
Executed by:
  • tst_LargeFile
  • tst_NetworkSelfTest
  • tst_QAbstractFileEngine
  • tst_QAbstractItemView
  • tst_QAbstractNetworkCache
  • tst_QAbstractPrintDialog
  • tst_QAbstractScrollArea
  • tst_QAccessibility
  • tst_QApplication
  • tst_QBrush
  • tst_QButtonGroup
  • tst_QByteArray
  • tst_QCalendarWidget
  • tst_QChar
  • tst_QColorDialog
  • tst_QColumnView
  • tst_QComboBox
  • tst_QCommandLineParser
  • tst_QCommandLinkButton
  • tst_QCompleter
  • tst_QCoreApplication
  • tst_QCryptographicHash
  • tst_QCssParser
  • tst_QDBusConnectionNoBus
  • tst_QDBusConnectionNoLibDBus1
  • ...
65126
62-
63QFileDevicePrivate::~QFileDevicePrivate()-
64{-
65 delete fileEngine;-
66 fileEngine = 0;-
67}
executed 65118 times by 252 tests: end of block
Executed by:
  • tst_LargeFile
  • tst_NetworkSelfTest
  • tst_QAbstractFileEngine
  • tst_QAbstractItemView
  • tst_QAbstractNetworkCache
  • tst_QAbstractPrintDialog
  • tst_QAbstractScrollArea
  • tst_QAccessibility
  • tst_QApplication
  • tst_QBrush
  • tst_QButtonGroup
  • tst_QByteArray
  • tst_QCalendarWidget
  • tst_QChar
  • tst_QColorDialog
  • tst_QColumnView
  • tst_QComboBox
  • tst_QCommandLineParser
  • tst_QCommandLinkButton
  • tst_QCompleter
  • tst_QCoreApplication
  • tst_QCryptographicHash
  • tst_QCssParser
  • tst_QDBusConnectionNoBus
  • tst_QDBusConnectionNoLibDBus1
  • ...
65118
68-
69QAbstractFileEngine * QFileDevicePrivate::engine() const-
70{-
71 if (!fileEngine)
!fileEngineDescription
TRUEnever evaluated
FALSEevaluated 453 times by 7 tests
Evaluated by:
  • tst_QColorDialog
  • tst_QFileDialog2
  • tst_QFiledialog
  • tst_QGraphicsProxyWidget
  • tst_QSaveFile
  • tst_QSettings
  • tst_languageChange
0-453
72 fileEngine = new QFSFileEngine;
never executed: fileEngine = new QFSFileEngine;
0
73 return fileEngine;
executed 453 times by 7 tests: return fileEngine;
Executed by:
  • tst_QColorDialog
  • tst_QFileDialog2
  • tst_QFiledialog
  • tst_QGraphicsProxyWidget
  • tst_QSaveFile
  • tst_QSettings
  • tst_languageChange
453
74}-
75-
76void QFileDevicePrivate::setError(QFileDevice::FileError err)-
77{-
78 error = err;-
79 errorString.clear();-
80}
executed 719154 times by 248 tests: end of block
Executed by:
  • tst_LargeFile
  • tst_NetworkSelfTest
  • tst_QAbstractFileEngine
  • tst_QAbstractItemView
  • tst_QAbstractNetworkCache
  • tst_QAbstractPrintDialog
  • tst_QAbstractScrollArea
  • tst_QAccessibility
  • tst_QApplication
  • tst_QBrush
  • tst_QButtonGroup
  • tst_QByteArray
  • tst_QCalendarWidget
  • tst_QChar
  • tst_QColorDialog
  • tst_QColumnView
  • tst_QComboBox
  • tst_QCommandLineParser
  • tst_QCommandLinkButton
  • tst_QCompleter
  • tst_QCoreApplication
  • tst_QCryptographicHash
  • tst_QCssParser
  • tst_QDBusConnectionNoBus
  • tst_QDBusConnectionNoLibDBus1
  • ...
719154
81-
82void QFileDevicePrivate::setError(QFileDevice::FileError err, const QString &errStr)-
83{-
84 error = err;-
85 errorString = errStr;-
86}
executed 4367 times by 63 tests: end of block
Executed by:
  • tst_QAbstractNetworkCache
  • tst_QApplication
  • tst_QCommandLineParser
  • tst_QCoreApplication
  • tst_QDBusConnectionNoBus
  • tst_QDBusConnectionNoLibDBus1
  • tst_QDBusConnection_Delayed
  • tst_QDateTime
  • tst_QDir
  • tst_QDirIterator
  • tst_QDirModel
  • tst_QDnsLookup_Appless
  • tst_QFile
  • tst_QFileInfo
  • tst_QFileSystemWatcher
  • tst_QGlobal
  • tst_QGraphicsWidget
  • tst_QGuiApplication
  • tst_QIODevice
  • tst_QIcon
  • tst_QImage
  • tst_QImageReader
  • tst_QImageWriter
  • tst_QLabel
  • tst_QLocalSocket
  • ...
4367
87-
88void QFileDevicePrivate::setError(QFileDevice::FileError err, int errNum)-
89{-
90 error = err;-
91 errorString = qt_error_string(errNum);-
92}
never executed: end of block
0
93-
94/*!-
95 \enum QFileDevice::FileError-
96-
97 This enum describes the errors that may be returned by the error()-
98 function.-
99-
100 \value NoError No error occurred.-
101 \value ReadError An error occurred when reading from the file.-
102 \value WriteError An error occurred when writing to the file.-
103 \value FatalError A fatal error occurred.-
104 \value ResourceError Out of resources (e.g., too many open files, out of memory, etc.)-
105 \value OpenError The file could not be opened.-
106 \value AbortError The operation was aborted.-
107 \value TimeOutError A timeout occurred.-
108 \value UnspecifiedError An unspecified error occurred.-
109 \value RemoveError The file could not be removed.-
110 \value RenameError The file could not be renamed.-
111 \value PositionError The position in the file could not be changed.-
112 \value ResizeError The file could not be resized.-
113 \value PermissionsError The file could not be accessed.-
114 \value CopyError The file could not be copied.-
115*/-
116-
117/*!-
118 \enum QFileDevice::Permission-
119-
120 This enum is used by the permission() function to report the-
121 permissions and ownership of a file. The values may be OR-ed-
122 together to test multiple permissions and ownership values.-
123-
124 \value ReadOwner The file is readable by the owner of the file.-
125 \value WriteOwner The file is writable by the owner of the file.-
126 \value ExeOwner The file is executable by the owner of the file.-
127 \value ReadUser The file is readable by the user.-
128 \value WriteUser The file is writable by the user.-
129 \value ExeUser The file is executable by the user.-
130 \value ReadGroup The file is readable by the group.-
131 \value WriteGroup The file is writable by the group.-
132 \value ExeGroup The file is executable by the group.-
133 \value ReadOther The file is readable by anyone.-
134 \value WriteOther The file is writable by anyone.-
135 \value ExeOther The file is executable by anyone.-
136-
137 \warning Because of differences in the platforms supported by Qt,-
138 the semantics of ReadUser, WriteUser and ExeUser are-
139 platform-dependent: On Unix, the rights of the owner of the file-
140 are returned and on Windows the rights of the current user are-
141 returned. This behavior might change in a future Qt version.-
142-
143 \note On NTFS file systems, ownership and permissions checking is-
144 disabled by default for performance reasons. To enable it,-
145 include the following line:-
146-
147 \snippet ntfsp.cpp 0-
148-
149 Permission checking is then turned on and off by incrementing and-
150 decrementing \c qt_ntfs_permission_lookup by 1.-
151-
152 \snippet ntfsp.cpp 1-
153*/-
154-
155//************* QFileDevice-
156-
157/*!-
158 \class QFileDevice-
159 \inmodule QtCore-
160 \since 5.0-
161-
162 \brief The QFileDevice class provides an interface for reading from and writing to open files.-
163-
164 \ingroup io-
165-
166 \reentrant-
167-
168 QFileDevice is the base class for I/O devices that can read and write text and binary files-
169 and \l{The Qt Resource System}{resources}. QFile offers the main functionality,-
170 QFileDevice serves as a base class for sharing functionality with other file devices such-
171 as QTemporaryFile, by providing all the operations that can be done on files that have-
172 been opened by QFile or QTemporaryFile.-
173-
174 \sa QFile, QTemporaryFile-
175*/-
176-
177/*!-
178 \enum QFileDevice::FileHandleFlag-
179-
180 This enum is used when opening a file to specify additional-
181 options which only apply to files and not to a generic-
182 QIODevice.-
183-
184 \value AutoCloseHandle The file handle passed into open() should be-
185 closed by close(), the default behavior is that close just flushes-
186 the file and the application is responsible for closing the file handle.-
187 When opening a file by name, this flag is ignored as Qt always owns the-
188 file handle and must close it.-
189 \value DontCloseHandle If not explicitly closed, the underlying file-
190 handle is left open when the QFile object is destroyed.-
191 */-
192-
193#ifdef QT_NO_QOBJECT-
194QFileDevice::QFileDevice()-
195 : QIODevice(*new QFileDevicePrivate)-
196{-
197}-
198QFileDevice::QFileDevice(QFileDevicePrivate &dd)-
199 : QIODevice(dd)-
200{-
201}-
202#else-
203/*!-
204 \internal-
205*/-
206QFileDevice::QFileDevice()-
207 : QIODevice(*new QFileDevicePrivate, 0)-
208{-
209}
never executed: end of block
0
210/*!-
211 \internal-
212*/-
213QFileDevice::QFileDevice(QObject *parent)-
214 : QIODevice(*new QFileDevicePrivate, parent)-
215{-
216}
never executed: end of block
0
217/*!-
218 \internal-
219*/-
220QFileDevice::QFileDevice(QFileDevicePrivate &dd, QObject *parent)-
221 : QIODevice(dd, parent)-
222{-
223}
executed 65126 times by 217 tests: end of block
Executed by:
  • tst_LargeFile
  • tst_NetworkSelfTest
  • tst_QAbstractFileEngine
  • tst_QAbstractItemView
  • tst_QAbstractNetworkCache
  • tst_QAbstractPrintDialog
  • tst_QAbstractScrollArea
  • tst_QAccessibility
  • tst_QApplication
  • tst_QBrush
  • tst_QButtonGroup
  • tst_QByteArray
  • tst_QCalendarWidget
  • tst_QChar
  • tst_QColorDialog
  • tst_QColumnView
  • tst_QComboBox
  • tst_QCommandLineParser
  • tst_QCommandLinkButton
  • tst_QCompleter
  • tst_QCoreApplication
  • tst_QCryptographicHash
  • tst_QCssParser
  • tst_QDBusConnectionNoBus
  • tst_QDBusConnectionNoLibDBus1
  • ...
65126
224#endif-
225-
226/*!-
227 Destroys the file device, closing it if necessary.-
228*/-
229QFileDevice::~QFileDevice()-
230{-
231 close();-
232}
executed 65118 times by 252 tests: end of block
Executed by:
  • tst_LargeFile
  • tst_NetworkSelfTest
  • tst_QAbstractFileEngine
  • tst_QAbstractItemView
  • tst_QAbstractNetworkCache
  • tst_QAbstractPrintDialog
  • tst_QAbstractScrollArea
  • tst_QAccessibility
  • tst_QApplication
  • tst_QBrush
  • tst_QButtonGroup
  • tst_QByteArray
  • tst_QCalendarWidget
  • tst_QChar
  • tst_QColorDialog
  • tst_QColumnView
  • tst_QComboBox
  • tst_QCommandLineParser
  • tst_QCommandLinkButton
  • tst_QCompleter
  • tst_QCoreApplication
  • tst_QCryptographicHash
  • tst_QCssParser
  • tst_QDBusConnectionNoBus
  • tst_QDBusConnectionNoLibDBus1
  • ...
65118
233-
234/*!-
235 Returns \c true if the file can only be manipulated sequentially;-
236 otherwise returns \c false.-
237-
238 Most files support random-access, but some special files may not.-
239-
240 \sa QIODevice::isSequential()-
241*/-
242bool QFileDevice::isSequential() const-
243{-
244 Q_D(const QFileDevice);-
245 return d->fileEngine && d->fileEngine->isSequential();
executed 97100 times by 144 tests: return d->fileEngine && d->fileEngine->isSequential();
Executed by:
  • tst_LargeFile
  • tst_QAbstractFileEngine
  • tst_QAbstractItemView
  • tst_QAbstractNetworkCache
  • tst_QAbstractScrollArea
  • tst_QAccessibility
  • tst_QButtonGroup
  • tst_QByteArray
  • tst_QCalendarWidget
  • tst_QChar
  • tst_QColorDialog
  • tst_QColumnView
  • tst_QComboBox
  • tst_QCommandLinkButton
  • tst_QCompleter
  • tst_QCryptographicHash
  • tst_QCssParser
  • tst_QDataStream
  • tst_QDateTime
  • tst_QDateTimeEdit
  • tst_QDebug
  • tst_QDialog
  • tst_QDir
  • tst_QDoubleSpinBox
  • tst_QErrorMessage
  • ...
97100
246}-
247-
248/*!-
249 Returns the file handle of the file.-
250-
251 This is a small positive integer, suitable for use with C library-
252 functions such as \c fdopen() and \c fcntl(). On systems that use file-
253 descriptors for sockets (i.e. Unix systems, but not Windows) the handle-
254 can be used with QSocketNotifier as well.-
255-
256 If the file is not open, or there is an error, handle() returns -1.-
257-
258 \sa QSocketNotifier-
259*/-
260int QFileDevice::handle() const-
261{-
262 Q_D(const QFileDevice);-
263 if (!isOpen() || !d->fileEngine)
!isOpen()Description
TRUEevaluated 4 times by 1 test
Evaluated by:
  • tst_QFile
FALSEevaluated 35 times by 6 tests
Evaluated by:
  • tst_QDBusMarshall
  • tst_QFile
  • tst_QFileInfo
  • tst_QKeySequence
  • tst_QTemporaryFile
  • tst_QTranslator
!d->fileEngineDescription
TRUEnever evaluated
FALSEevaluated 35 times by 6 tests
Evaluated by:
  • tst_QDBusMarshall
  • tst_QFile
  • tst_QFileInfo
  • tst_QKeySequence
  • tst_QTemporaryFile
  • tst_QTranslator
0-35
264 return -1;
executed 4 times by 1 test: return -1;
Executed by:
  • tst_QFile
4
265-
266 return d->fileEngine->handle();
executed 35 times by 6 tests: return d->fileEngine->handle();
Executed by:
  • tst_QDBusMarshall
  • tst_QFile
  • tst_QFileInfo
  • tst_QKeySequence
  • tst_QTemporaryFile
  • tst_QTranslator
35
267}-
268-
269/*!-
270 Returns the name of the file.-
271 The default implementation in QFileDevice returns a null string.-
272*/-
273QString QFileDevice::fileName() const-
274{-
275 return QString();
never executed: return QString();
0
276}-
277-
278/*!-
279 Flushes any buffered data to the file. Returns \c true if successful;-
280 otherwise returns \c false.-
281*/-
282bool QFileDevice::flush()-
283{-
284 Q_D(QFileDevice);-
285 if (!d->fileEngine) {
!d->fileEngineDescription
TRUEnever evaluated
FALSEevaluated 64296 times by 212 tests
Evaluated by:
  • tst_LargeFile
  • tst_NetworkSelfTest
  • tst_QAbstractFileEngine
  • tst_QAbstractItemView
  • tst_QAbstractNetworkCache
  • tst_QAbstractPrintDialog
  • tst_QAbstractScrollArea
  • tst_QAccessibility
  • tst_QApplication
  • tst_QBrush
  • tst_QButtonGroup
  • tst_QByteArray
  • tst_QCalendarWidget
  • tst_QChar
  • tst_QColorDialog
  • tst_QColumnView
  • tst_QComboBox
  • tst_QCommandLinkButton
  • tst_QCompleter
  • tst_QCryptographicHash
  • tst_QCssParser
  • tst_QDataStream
  • tst_QDateTime
  • tst_QDateTimeEdit
  • tst_QDebug
  • ...
0-64296
286 qWarning("QFileDevice::flush: No file engine. Is IODevice open?");-
287 return false;
never executed: return false;
0
288 }-
289-
290 if (!d->writeBuffer.isEmpty()) {
!d->writeBuffer.isEmpty()Description
TRUEevaluated 18450 times by 43 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QColorDialog
  • tst_QDataStream
  • tst_QDir
  • tst_QFile
  • tst_QFileDialog2
  • tst_QFileInfo
  • tst_QFileSystemModel
  • tst_QFileSystemWatcher
  • tst_QFiledialog
  • tst_QFtp
  • tst_QGraphicsProxyWidget
  • tst_QIODevice
  • tst_QIcon
  • tst_QImage
  • tst_QImageReader
  • tst_QImageWriter
  • tst_QLoggingRegistry
  • tst_QMimeDatabase
  • tst_QNetworkDiskCache
  • tst_QNetworkReply
  • tst_QPainter
  • tst_QPainterPath
  • tst_QPixmap
  • tst_QPrinter
  • ...
FALSEevaluated 45846 times by 212 tests
Evaluated by:
  • tst_LargeFile
  • tst_NetworkSelfTest
  • tst_QAbstractFileEngine
  • tst_QAbstractItemView
  • tst_QAbstractNetworkCache
  • tst_QAbstractPrintDialog
  • tst_QAbstractScrollArea
  • tst_QAccessibility
  • tst_QApplication
  • tst_QBrush
  • tst_QButtonGroup
  • tst_QByteArray
  • tst_QCalendarWidget
  • tst_QChar
  • tst_QColorDialog
  • tst_QColumnView
  • tst_QComboBox
  • tst_QCommandLinkButton
  • tst_QCompleter
  • tst_QCryptographicHash
  • tst_QCssParser
  • tst_QDataStream
  • tst_QDateTime
  • tst_QDateTimeEdit
  • tst_QDebug
  • ...
18450-45846
291 qint64 size = d->writeBuffer.nextDataBlockSize();-
292 qint64 written = d->fileEngine->write(d->writeBuffer.readPointer(), size);-
293 if (written > 0)
written > 0Description
TRUEevaluated 18444 times by 43 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QColorDialog
  • tst_QDataStream
  • tst_QDir
  • tst_QFile
  • tst_QFileDialog2
  • tst_QFileInfo
  • tst_QFileSystemModel
  • tst_QFileSystemWatcher
  • tst_QFiledialog
  • tst_QFtp
  • tst_QGraphicsProxyWidget
  • tst_QIODevice
  • tst_QIcon
  • tst_QImage
  • tst_QImageReader
  • tst_QImageWriter
  • tst_QLoggingRegistry
  • tst_QMimeDatabase
  • tst_QNetworkDiskCache
  • tst_QNetworkReply
  • tst_QPainter
  • tst_QPainterPath
  • tst_QPixmap
  • tst_QPrinter
  • ...
FALSEevaluated 6 times by 1 test
Evaluated by:
  • tst_QFile
6-18444
294 d->writeBuffer.free(written);
executed 18444 times by 43 tests: d->writeBuffer.free(written);
Executed by:
  • tst_QAbstractNetworkCache
  • tst_QColorDialog
  • tst_QDataStream
  • tst_QDir
  • tst_QFile
  • tst_QFileDialog2
  • tst_QFileInfo
  • tst_QFileSystemModel
  • tst_QFileSystemWatcher
  • tst_QFiledialog
  • tst_QFtp
  • tst_QGraphicsProxyWidget
  • tst_QIODevice
  • tst_QIcon
  • tst_QImage
  • tst_QImageReader
  • tst_QImageWriter
  • tst_QLoggingRegistry
  • tst_QMimeDatabase
  • tst_QNetworkDiskCache
  • tst_QNetworkReply
  • tst_QPainter
  • tst_QPainterPath
  • tst_QPixmap
  • tst_QPrinter
  • ...
18444
295 if (written != size) {
written != sizeDescription
TRUEevaluated 6 times by 1 test
Evaluated by:
  • tst_QFile
FALSEevaluated 18444 times by 43 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QColorDialog
  • tst_QDataStream
  • tst_QDir
  • tst_QFile
  • tst_QFileDialog2
  • tst_QFileInfo
  • tst_QFileSystemModel
  • tst_QFileSystemWatcher
  • tst_QFiledialog
  • tst_QFtp
  • tst_QGraphicsProxyWidget
  • tst_QIODevice
  • tst_QIcon
  • tst_QImage
  • tst_QImageReader
  • tst_QImageWriter
  • tst_QLoggingRegistry
  • tst_QMimeDatabase
  • tst_QNetworkDiskCache
  • tst_QNetworkReply
  • tst_QPainter
  • tst_QPainterPath
  • tst_QPixmap
  • tst_QPrinter
  • ...
6-18444
296 QFileDevice::FileError err = d->fileEngine->error();-
297 if (err == QFileDevice::UnspecifiedError)
err == QFileDe...specifiedErrorDescription
TRUEnever evaluated
FALSEevaluated 6 times by 1 test
Evaluated by:
  • tst_QFile
0-6
298 err = QFileDevice::WriteError;
never executed: err = QFileDevice::WriteError;
0
299 d->setError(err, d->fileEngine->errorString());-
300 return false;
executed 6 times by 1 test: return false;
Executed by:
  • tst_QFile
6
301 }-
302 }
executed 18444 times by 43 tests: end of block
Executed by:
  • tst_QAbstractNetworkCache
  • tst_QColorDialog
  • tst_QDataStream
  • tst_QDir
  • tst_QFile
  • tst_QFileDialog2
  • tst_QFileInfo
  • tst_QFileSystemModel
  • tst_QFileSystemWatcher
  • tst_QFiledialog
  • tst_QFtp
  • tst_QGraphicsProxyWidget
  • tst_QIODevice
  • tst_QIcon
  • tst_QImage
  • tst_QImageReader
  • tst_QImageWriter
  • tst_QLoggingRegistry
  • tst_QMimeDatabase
  • tst_QNetworkDiskCache
  • tst_QNetworkReply
  • tst_QPainter
  • tst_QPainterPath
  • tst_QPixmap
  • tst_QPrinter
  • ...
18444
303-
304 if (!d->fileEngine->flush()) {
!d->fileEngine->flush()Description
TRUEnever evaluated
FALSEevaluated 64290 times by 212 tests
Evaluated by:
  • tst_LargeFile
  • tst_NetworkSelfTest
  • tst_QAbstractFileEngine
  • tst_QAbstractItemView
  • tst_QAbstractNetworkCache
  • tst_QAbstractPrintDialog
  • tst_QAbstractScrollArea
  • tst_QAccessibility
  • tst_QApplication
  • tst_QBrush
  • tst_QButtonGroup
  • tst_QByteArray
  • tst_QCalendarWidget
  • tst_QChar
  • tst_QColorDialog
  • tst_QColumnView
  • tst_QComboBox
  • tst_QCommandLinkButton
  • tst_QCompleter
  • tst_QCryptographicHash
  • tst_QCssParser
  • tst_QDataStream
  • tst_QDateTime
  • tst_QDateTimeEdit
  • tst_QDebug
  • ...
0-64290
305 QFileDevice::FileError err = d->fileEngine->error();-
306 if (err == QFileDevice::UnspecifiedError)
err == QFileDe...specifiedErrorDescription
TRUEnever evaluated
FALSEnever evaluated
0
307 err = QFileDevice::WriteError;
never executed: err = QFileDevice::WriteError;
0
308 d->setError(err, d->fileEngine->errorString());-
309 return false;
never executed: return false;
0
310 }-
311 return true;
executed 64290 times by 212 tests: return true;
Executed by:
  • tst_LargeFile
  • tst_NetworkSelfTest
  • tst_QAbstractFileEngine
  • tst_QAbstractItemView
  • tst_QAbstractNetworkCache
  • tst_QAbstractPrintDialog
  • tst_QAbstractScrollArea
  • tst_QAccessibility
  • tst_QApplication
  • tst_QBrush
  • tst_QButtonGroup
  • tst_QByteArray
  • tst_QCalendarWidget
  • tst_QChar
  • tst_QColorDialog
  • tst_QColumnView
  • tst_QComboBox
  • tst_QCommandLinkButton
  • tst_QCompleter
  • tst_QCryptographicHash
  • tst_QCssParser
  • tst_QDataStream
  • tst_QDateTime
  • tst_QDateTimeEdit
  • tst_QDebug
  • ...
64290
312}-
313-
314/*!-
315 Calls QFileDevice::flush() and closes the file. Errors from flush are ignored.-
316-
317 \sa QIODevice::close()-
318*/-
319void QFileDevice::close()-
320{-
321 Q_D(QFileDevice);-
322 if (!isOpen())
!isOpen()Description
TRUEevaluated 38531 times by 196 tests
Evaluated by:
  • tst_LargeFile
  • tst_NetworkSelfTest
  • tst_QAbstractFileEngine
  • tst_QAbstractItemView
  • tst_QAbstractNetworkCache
  • tst_QAbstractPrintDialog
  • tst_QAbstractScrollArea
  • tst_QAccessibility
  • tst_QApplication
  • tst_QBrush
  • tst_QButtonGroup
  • tst_QCalendarWidget
  • tst_QColorDialog
  • tst_QColumnView
  • tst_QComboBox
  • tst_QCommandLineParser
  • tst_QCommandLinkButton
  • tst_QCompleter
  • tst_QCoreApplication
  • tst_QDBusConnectionNoBus
  • tst_QDBusConnectionNoLibDBus1
  • tst_QDBusConnection_Delayed
  • tst_QDataStream
  • tst_QDateTime
  • tst_QDateTimeEdit
  • ...
FALSEevaluated 46137 times by 212 tests
Evaluated by:
  • tst_LargeFile
  • tst_NetworkSelfTest
  • tst_QAbstractFileEngine
  • tst_QAbstractItemView
  • tst_QAbstractNetworkCache
  • tst_QAbstractPrintDialog
  • tst_QAbstractScrollArea
  • tst_QAccessibility
  • tst_QApplication
  • tst_QBrush
  • tst_QButtonGroup
  • tst_QByteArray
  • tst_QCalendarWidget
  • tst_QChar
  • tst_QColorDialog
  • tst_QColumnView
  • tst_QComboBox
  • tst_QCommandLinkButton
  • tst_QCompleter
  • tst_QCryptographicHash
  • tst_QCssParser
  • tst_QDataStream
  • tst_QDateTime
  • tst_QDateTimeEdit
  • tst_QDebug
  • ...
38531-46137
323 return;
executed 38531 times by 196 tests: return;
Executed by:
  • tst_LargeFile
  • tst_NetworkSelfTest
  • tst_QAbstractFileEngine
  • tst_QAbstractItemView
  • tst_QAbstractNetworkCache
  • tst_QAbstractPrintDialog
  • tst_QAbstractScrollArea
  • tst_QAccessibility
  • tst_QApplication
  • tst_QBrush
  • tst_QButtonGroup
  • tst_QCalendarWidget
  • tst_QColorDialog
  • tst_QColumnView
  • tst_QComboBox
  • tst_QCommandLineParser
  • tst_QCommandLinkButton
  • tst_QCompleter
  • tst_QCoreApplication
  • tst_QDBusConnectionNoBus
  • tst_QDBusConnectionNoLibDBus1
  • tst_QDBusConnection_Delayed
  • tst_QDataStream
  • tst_QDateTime
  • tst_QDateTimeEdit
  • ...
38531
324 bool flushed = flush();-
325 QIODevice::close();-
326-
327 // reset write buffer-
328 d->lastWasWrite = false;-
329 d->writeBuffer.clear();-
330-
331 // keep earlier error from flush-
332 if (d->fileEngine->close() && flushed)
d->fileEngine->close()Description
TRUEevaluated 46137 times by 212 tests
Evaluated by:
  • tst_LargeFile
  • tst_NetworkSelfTest
  • tst_QAbstractFileEngine
  • tst_QAbstractItemView
  • tst_QAbstractNetworkCache
  • tst_QAbstractPrintDialog
  • tst_QAbstractScrollArea
  • tst_QAccessibility
  • tst_QApplication
  • tst_QBrush
  • tst_QButtonGroup
  • tst_QByteArray
  • tst_QCalendarWidget
  • tst_QChar
  • tst_QColorDialog
  • tst_QColumnView
  • tst_QComboBox
  • tst_QCommandLinkButton
  • tst_QCompleter
  • tst_QCryptographicHash
  • tst_QCssParser
  • tst_QDataStream
  • tst_QDateTime
  • tst_QDateTimeEdit
  • tst_QDebug
  • ...
FALSEnever evaluated
flushedDescription
TRUEevaluated 46135 times by 212 tests
Evaluated by:
  • tst_LargeFile
  • tst_NetworkSelfTest
  • tst_QAbstractFileEngine
  • tst_QAbstractItemView
  • tst_QAbstractNetworkCache
  • tst_QAbstractPrintDialog
  • tst_QAbstractScrollArea
  • tst_QAccessibility
  • tst_QApplication
  • tst_QBrush
  • tst_QButtonGroup
  • tst_QByteArray
  • tst_QCalendarWidget
  • tst_QChar
  • tst_QColorDialog
  • tst_QColumnView
  • tst_QComboBox
  • tst_QCommandLinkButton
  • tst_QCompleter
  • tst_QCryptographicHash
  • tst_QCssParser
  • tst_QDataStream
  • tst_QDateTime
  • tst_QDateTimeEdit
  • tst_QDebug
  • ...
FALSEevaluated 2 times by 1 test
Evaluated by:
  • tst_QFile
0-46137
333 unsetError();
executed 46135 times by 212 tests: unsetError();
Executed by:
  • tst_LargeFile
  • tst_NetworkSelfTest
  • tst_QAbstractFileEngine
  • tst_QAbstractItemView
  • tst_QAbstractNetworkCache
  • tst_QAbstractPrintDialog
  • tst_QAbstractScrollArea
  • tst_QAccessibility
  • tst_QApplication
  • tst_QBrush
  • tst_QButtonGroup
  • tst_QByteArray
  • tst_QCalendarWidget
  • tst_QChar
  • tst_QColorDialog
  • tst_QColumnView
  • tst_QComboBox
  • tst_QCommandLinkButton
  • tst_QCompleter
  • tst_QCryptographicHash
  • tst_QCssParser
  • tst_QDataStream
  • tst_QDateTime
  • tst_QDateTimeEdit
  • tst_QDebug
  • ...
46135
334 else if (flushed)
flushedDescription
TRUEnever evaluated
FALSEevaluated 2 times by 1 test
Evaluated by:
  • tst_QFile
0-2
335 d->setError(d->fileEngine->error(), d->fileEngine->errorString());
never executed: d->setError(d->fileEngine->error(), d->fileEngine->errorString());
0
336}
executed 46137 times by 212 tests: end of block
Executed by:
  • tst_LargeFile
  • tst_NetworkSelfTest
  • tst_QAbstractFileEngine
  • tst_QAbstractItemView
  • tst_QAbstractNetworkCache
  • tst_QAbstractPrintDialog
  • tst_QAbstractScrollArea
  • tst_QAccessibility
  • tst_QApplication
  • tst_QBrush
  • tst_QButtonGroup
  • tst_QByteArray
  • tst_QCalendarWidget
  • tst_QChar
  • tst_QColorDialog
  • tst_QColumnView
  • tst_QComboBox
  • tst_QCommandLinkButton
  • tst_QCompleter
  • tst_QCryptographicHash
  • tst_QCssParser
  • tst_QDataStream
  • tst_QDateTime
  • tst_QDateTimeEdit
  • tst_QDebug
  • ...
46137
337-
338/*!-
339 \reimp-
340*/-
341qint64 QFileDevice::pos() const-
342{-
343 return QIODevice::pos();
executed 481309 times by 101 tests: return QIODevice::pos();
Executed by:
  • tst_LargeFile
  • tst_QAbstractFileEngine
  • tst_QAbstractItemView
  • tst_QAbstractNetworkCache
  • tst_QAbstractScrollArea
  • tst_QAccessibility
  • tst_QButtonGroup
  • tst_QCalendarWidget
  • tst_QChar
  • tst_QColorDialog
  • tst_QColumnView
  • tst_QComboBox
  • tst_QCommandLinkButton
  • tst_QCompleter
  • tst_QCryptographicHash
  • tst_QCssParser
  • tst_QDataStream
  • tst_QDateTimeEdit
  • tst_QDebug
  • tst_QDialog
  • tst_QDoubleSpinBox
  • tst_QFile
  • tst_QFileDialog2
  • tst_QFileIconProvider
  • tst_QFileInfo
  • ...
481309
344}-
345-
346/*!-
347 Returns \c true if the end of the file has been reached; otherwise returns-
348 false.-
349-
350 For regular empty files on Unix (e.g. those in \c /proc), this function-
351 returns \c true, since the file system reports that the size of such a file is-
352 0. Therefore, you should not depend on atEnd() when reading data from such a-
353 file, but rather call read() until no more data can be read.-
354*/-
355bool QFileDevice::atEnd() const-
356{-
357 Q_D(const QFileDevice);-
358-
359 // If there's buffered data left, we're not at the end.-
360 if (!d->isBufferEmpty())
!d->isBufferEmpty()Description
TRUEevaluated 121702 times by 36 tests
Evaluated by:
  • tst_QAccessibility
  • tst_QCalendarWidget
  • tst_QChar
  • tst_QComboBox
  • tst_QCompleter
  • tst_QCssParser
  • tst_QDataStream
  • tst_QDateTimeEdit
  • tst_QDebug
  • tst_QFile
  • tst_QFileDialog2
  • tst_QFileIconProvider
  • tst_QFileInfo
  • tst_QFileSystemModel
  • tst_QFiledialog
  • tst_QFontComboBox
  • tst_QGraphicsProxyWidget
  • tst_QGraphicsWidget
  • tst_QGuiApplication
  • tst_QGuiVariant
  • tst_QIODevice
  • tst_QIcon
  • tst_QImageReader
  • tst_QImageWriter
  • tst_QMimeDatabase
  • ...
FALSEevaluated 4487 times by 45 tests
Evaluated by:
  • tst_QAccessibility
  • tst_QCalendarWidget
  • tst_QChar
  • tst_QComboBox
  • tst_QCompleter
  • tst_QCryptographicHash
  • tst_QCssParser
  • tst_QDataStream
  • tst_QDateTimeEdit
  • tst_QDebug
  • tst_QFile
  • tst_QFileDialog2
  • tst_QFileIconProvider
  • tst_QFileInfo
  • tst_QFileSystemModel
  • tst_QFiledialog
  • tst_QFontComboBox
  • tst_QGraphicsProxyWidget
  • tst_QGraphicsWidget
  • tst_QGuiApplication
  • tst_QGuiVariant
  • tst_QIODevice
  • tst_QIcon
  • tst_QImageReader
  • tst_QLayout
  • ...
4487-121702
361 return false;
executed 121702 times by 36 tests: return false;
Executed by:
  • tst_QAccessibility
  • tst_QCalendarWidget
  • tst_QChar
  • tst_QComboBox
  • tst_QCompleter
  • tst_QCssParser
  • tst_QDataStream
  • tst_QDateTimeEdit
  • tst_QDebug
  • tst_QFile
  • tst_QFileDialog2
  • tst_QFileIconProvider
  • tst_QFileInfo
  • tst_QFileSystemModel
  • tst_QFiledialog
  • tst_QFontComboBox
  • tst_QGraphicsProxyWidget
  • tst_QGraphicsWidget
  • tst_QGuiApplication
  • tst_QGuiVariant
  • tst_QIODevice
  • tst_QIcon
  • tst_QImageReader
  • tst_QImageWriter
  • tst_QMimeDatabase
  • ...
121702
362-
363 if (!isOpen())
!isOpen()Description
TRUEnever evaluated
FALSEevaluated 4487 times by 45 tests
Evaluated by:
  • tst_QAccessibility
  • tst_QCalendarWidget
  • tst_QChar
  • tst_QComboBox
  • tst_QCompleter
  • tst_QCryptographicHash
  • tst_QCssParser
  • tst_QDataStream
  • tst_QDateTimeEdit
  • tst_QDebug
  • tst_QFile
  • tst_QFileDialog2
  • tst_QFileIconProvider
  • tst_QFileInfo
  • tst_QFileSystemModel
  • tst_QFiledialog
  • tst_QFontComboBox
  • tst_QGraphicsProxyWidget
  • tst_QGraphicsWidget
  • tst_QGuiApplication
  • tst_QGuiVariant
  • tst_QIODevice
  • tst_QIcon
  • tst_QImageReader
  • tst_QLayout
  • ...
0-4487
364 return true;
never executed: return true;
0
365-
366 if (!d->ensureFlushed())
!d->ensureFlushed()Description
TRUEnever evaluated
FALSEevaluated 4487 times by 45 tests
Evaluated by:
  • tst_QAccessibility
  • tst_QCalendarWidget
  • tst_QChar
  • tst_QComboBox
  • tst_QCompleter
  • tst_QCryptographicHash
  • tst_QCssParser
  • tst_QDataStream
  • tst_QDateTimeEdit
  • tst_QDebug
  • tst_QFile
  • tst_QFileDialog2
  • tst_QFileIconProvider
  • tst_QFileInfo
  • tst_QFileSystemModel
  • tst_QFiledialog
  • tst_QFontComboBox
  • tst_QGraphicsProxyWidget
  • tst_QGraphicsWidget
  • tst_QGuiApplication
  • tst_QGuiVariant
  • tst_QIODevice
  • tst_QIcon
  • tst_QImageReader
  • tst_QLayout
  • ...
0-4487
367 return false;
never executed: return false;
0
368-
369 // If the file engine knows best, say what it says.-
370 if (d->fileEngine->supportsExtension(QAbstractFileEngine::AtEndExtension)) {
d->fileEngine-...tEndExtension)Description
TRUEnever evaluated
FALSEevaluated 4487 times by 45 tests
Evaluated by:
  • tst_QAccessibility
  • tst_QCalendarWidget
  • tst_QChar
  • tst_QComboBox
  • tst_QCompleter
  • tst_QCryptographicHash
  • tst_QCssParser
  • tst_QDataStream
  • tst_QDateTimeEdit
  • tst_QDebug
  • tst_QFile
  • tst_QFileDialog2
  • tst_QFileIconProvider
  • tst_QFileInfo
  • tst_QFileSystemModel
  • tst_QFiledialog
  • tst_QFontComboBox
  • tst_QGraphicsProxyWidget
  • tst_QGraphicsWidget
  • tst_QGuiApplication
  • tst_QGuiVariant
  • tst_QIODevice
  • tst_QIcon
  • tst_QImageReader
  • tst_QLayout
  • ...
0-4487
371 // Check if the file engine supports AtEndExtension, and if it does,-
372 // check if the file engine claims to be at the end.-
373 return d->fileEngine->atEnd();
never executed: return d->fileEngine->atEnd();
0
374 }-
375-
376 // if it looks like we are at the end, or if size is not cached,-
377 // fall through to bytesAvailable() to make sure.-
378 if (pos() < d->cachedSize)
pos() < d->cachedSizeDescription
TRUEevaluated 275 times by 5 tests
Evaluated by:
  • tst_QFile
  • tst_QFileInfo
  • tst_QImageReader
  • tst_QMimeDatabase
  • tst_QTextStream
FALSEevaluated 4212 times by 45 tests
Evaluated by:
  • tst_QAccessibility
  • tst_QCalendarWidget
  • tst_QChar
  • tst_QComboBox
  • tst_QCompleter
  • tst_QCryptographicHash
  • tst_QCssParser
  • tst_QDataStream
  • tst_QDateTimeEdit
  • tst_QDebug
  • tst_QFile
  • tst_QFileDialog2
  • tst_QFileIconProvider
  • tst_QFileInfo
  • tst_QFileSystemModel
  • tst_QFiledialog
  • tst_QFontComboBox
  • tst_QGraphicsProxyWidget
  • tst_QGraphicsWidget
  • tst_QGuiApplication
  • tst_QGuiVariant
  • tst_QIODevice
  • tst_QIcon
  • tst_QImageReader
  • tst_QLayout
  • ...
275-4212
379 return false;
executed 275 times by 5 tests: return false;
Executed by:
  • tst_QFile
  • tst_QFileInfo
  • tst_QImageReader
  • tst_QMimeDatabase
  • tst_QTextStream
275
380-
381 // Fall back to checking how much is available (will stat files).-
382 return bytesAvailable() == 0;
executed 4212 times by 45 tests: return bytesAvailable() == 0;
Executed by:
  • tst_QAccessibility
  • tst_QCalendarWidget
  • tst_QChar
  • tst_QComboBox
  • tst_QCompleter
  • tst_QCryptographicHash
  • tst_QCssParser
  • tst_QDataStream
  • tst_QDateTimeEdit
  • tst_QDebug
  • tst_QFile
  • tst_QFileDialog2
  • tst_QFileIconProvider
  • tst_QFileInfo
  • tst_QFileSystemModel
  • tst_QFiledialog
  • tst_QFontComboBox
  • tst_QGraphicsProxyWidget
  • tst_QGraphicsWidget
  • tst_QGuiApplication
  • tst_QGuiVariant
  • tst_QIODevice
  • tst_QIcon
  • tst_QImageReader
  • tst_QLayout
  • ...
4212
383}-
384-
385/*!-
386 \fn bool QFileDevice::seek(qint64 pos)-
387-
388 For random-access devices, this function sets the current position-
389 to \a pos, returning true on success, or false if an error occurred.-
390 For sequential devices, the default behavior is to do nothing and-
391 return false.-
392-
393 Seeking beyond the end of a file:-
394 If the position is beyond the end of a file, then seek() will not-
395 immediately extend the file. If a write is performed at this position,-
396 then the file will be extended. The content of the file between the-
397 previous end of file and the newly written data is UNDEFINED and-
398 varies between platforms and file systems.-
399*/-
400bool QFileDevice::seek(qint64 off)-
401{-
402 Q_D(QFileDevice);-
403 if (!isOpen()) {
!isOpen()Description
TRUEnever evaluated
FALSEevaluated 252027 times by 91 tests
Evaluated by:
  • tst_LargeFile
  • tst_QAbstractFileEngine
  • tst_QAbstractItemView
  • tst_QAbstractScrollArea
  • tst_QAccessibility
  • tst_QButtonGroup
  • tst_QCalendarWidget
  • tst_QColorDialog
  • tst_QColumnView
  • tst_QComboBox
  • tst_QCommandLinkButton
  • tst_QCompleter
  • tst_QDataStream
  • tst_QDateTimeEdit
  • tst_QDialog
  • tst_QDoubleSpinBox
  • tst_QFile
  • tst_QFileDialog2
  • tst_QFileIconProvider
  • tst_QFileSystemModel
  • tst_QFileSystemWatcher
  • tst_QFiledialog
  • tst_QFocusEvent
  • tst_QFontComboBox
  • tst_QFontDialog
  • ...
0-252027
404 qWarning("QFileDevice::seek: IODevice is not open");-
405 return false;
never executed: return false;
0
406 }-
407-
408 if (!d->ensureFlushed())
!d->ensureFlushed()Description
TRUEnever evaluated
FALSEevaluated 252027 times by 91 tests
Evaluated by:
  • tst_LargeFile
  • tst_QAbstractFileEngine
  • tst_QAbstractItemView
  • tst_QAbstractScrollArea
  • tst_QAccessibility
  • tst_QButtonGroup
  • tst_QCalendarWidget
  • tst_QColorDialog
  • tst_QColumnView
  • tst_QComboBox
  • tst_QCommandLinkButton
  • tst_QCompleter
  • tst_QDataStream
  • tst_QDateTimeEdit
  • tst_QDialog
  • tst_QDoubleSpinBox
  • tst_QFile
  • tst_QFileDialog2
  • tst_QFileIconProvider
  • tst_QFileSystemModel
  • tst_QFileSystemWatcher
  • tst_QFiledialog
  • tst_QFocusEvent
  • tst_QFontComboBox
  • tst_QFontDialog
  • ...
0-252027
409 return false;
never executed: return false;
0
410-
411 if (!d->fileEngine->seek(off) || !QIODevice::seek(off)) {
!d->fileEngine->seek(off)Description
TRUEnever evaluated
FALSEevaluated 252027 times by 91 tests
Evaluated by:
  • tst_LargeFile
  • tst_QAbstractFileEngine
  • tst_QAbstractItemView
  • tst_QAbstractScrollArea
  • tst_QAccessibility
  • tst_QButtonGroup
  • tst_QCalendarWidget
  • tst_QColorDialog
  • tst_QColumnView
  • tst_QComboBox
  • tst_QCommandLinkButton
  • tst_QCompleter
  • tst_QDataStream
  • tst_QDateTimeEdit
  • tst_QDialog
  • tst_QDoubleSpinBox
  • tst_QFile
  • tst_QFileDialog2
  • tst_QFileIconProvider
  • tst_QFileSystemModel
  • tst_QFileSystemWatcher
  • tst_QFiledialog
  • tst_QFocusEvent
  • tst_QFontComboBox
  • tst_QFontDialog
  • ...
!QIODevice::seek(off)Description
TRUEnever evaluated
FALSEevaluated 252027 times by 91 tests
Evaluated by:
  • tst_LargeFile
  • tst_QAbstractFileEngine
  • tst_QAbstractItemView
  • tst_QAbstractScrollArea
  • tst_QAccessibility
  • tst_QButtonGroup
  • tst_QCalendarWidget
  • tst_QColorDialog
  • tst_QColumnView
  • tst_QComboBox
  • tst_QCommandLinkButton
  • tst_QCompleter
  • tst_QDataStream
  • tst_QDateTimeEdit
  • tst_QDialog
  • tst_QDoubleSpinBox
  • tst_QFile
  • tst_QFileDialog2
  • tst_QFileIconProvider
  • tst_QFileSystemModel
  • tst_QFileSystemWatcher
  • tst_QFiledialog
  • tst_QFocusEvent
  • tst_QFontComboBox
  • tst_QFontDialog
  • ...
0-252027
412 QFileDevice::FileError err = d->fileEngine->error();-
413 if (err == QFileDevice::UnspecifiedError)
err == QFileDe...specifiedErrorDescription
TRUEnever evaluated
FALSEnever evaluated
0
414 err = QFileDevice::PositionError;
never executed: err = QFileDevice::PositionError;
0
415 d->setError(err, d->fileEngine->errorString());-
416 return false;
never executed: return false;
0
417 }-
418 unsetError();-
419 return true;
executed 252027 times by 91 tests: return true;
Executed by:
  • tst_LargeFile
  • tst_QAbstractFileEngine
  • tst_QAbstractItemView
  • tst_QAbstractScrollArea
  • tst_QAccessibility
  • tst_QButtonGroup
  • tst_QCalendarWidget
  • tst_QColorDialog
  • tst_QColumnView
  • tst_QComboBox
  • tst_QCommandLinkButton
  • tst_QCompleter
  • tst_QDataStream
  • tst_QDateTimeEdit
  • tst_QDialog
  • tst_QDoubleSpinBox
  • tst_QFile
  • tst_QFileDialog2
  • tst_QFileIconProvider
  • tst_QFileSystemModel
  • tst_QFileSystemWatcher
  • tst_QFiledialog
  • tst_QFocusEvent
  • tst_QFontComboBox
  • tst_QFontDialog
  • ...
252027
420}-
421-
422/*!-
423 \reimp-
424*/-
425qint64 QFileDevice::readLineData(char *data, qint64 maxlen)-
426{-
427 Q_D(QFileDevice);-
428 if (!d->ensureFlushed())
!d->ensureFlushed()Description
TRUEnever evaluated
FALSEevaluated 665 times by 37 tests
Evaluated by:
  • tst_QAccessibility
  • tst_QCalendarWidget
  • tst_QChar
  • tst_QComboBox
  • tst_QCompleter
  • tst_QCssParser
  • tst_QDateTimeEdit
  • tst_QDebug
  • tst_QFile
  • tst_QFileDialog2
  • tst_QFileIconProvider
  • tst_QFileSystemModel
  • tst_QFiledialog
  • tst_QFontComboBox
  • tst_QGraphicsProxyWidget
  • tst_QGraphicsWidget
  • tst_QGuiApplication
  • tst_QGuiVariant
  • tst_QIODevice
  • tst_QIcon
  • tst_QImage
  • tst_QImageReader
  • tst_QImageWriter
  • tst_QLockFile
  • tst_QMimeDatabase
  • ...
0-665
429 return -1;
never executed: return -1;
0
430-
431 qint64 read;-
432 if (d->fileEngine->supportsExtension(QAbstractFileEngine::FastReadLineExtension)) {
d->fileEngine-...LineExtension)Description
TRUEevaluated 8 times by 1 test
Evaluated by:
  • tst_QFile
FALSEevaluated 657 times by 37 tests
Evaluated by:
  • tst_QAccessibility
  • tst_QCalendarWidget
  • tst_QChar
  • tst_QComboBox
  • tst_QCompleter
  • tst_QCssParser
  • tst_QDateTimeEdit
  • tst_QDebug
  • tst_QFile
  • tst_QFileDialog2
  • tst_QFileIconProvider
  • tst_QFileSystemModel
  • tst_QFiledialog
  • tst_QFontComboBox
  • tst_QGraphicsProxyWidget
  • tst_QGraphicsWidget
  • tst_QGuiApplication
  • tst_QGuiVariant
  • tst_QIODevice
  • tst_QIcon
  • tst_QImage
  • tst_QImageReader
  • tst_QImageWriter
  • tst_QLockFile
  • tst_QMimeDatabase
  • ...
8-657
433 read = d->fileEngine->readLine(data, maxlen);-
434 } else {
executed 8 times by 1 test: end of block
Executed by:
  • tst_QFile
8
435 // Fall back to QIODevice's readLine implementation if the engine-
436 // cannot do it faster.-
437 read = QIODevice::readLineData(data, maxlen);-
438 }
executed 657 times by 37 tests: end of block
Executed by:
  • tst_QAccessibility
  • tst_QCalendarWidget
  • tst_QChar
  • tst_QComboBox
  • tst_QCompleter
  • tst_QCssParser
  • tst_QDateTimeEdit
  • tst_QDebug
  • tst_QFile
  • tst_QFileDialog2
  • tst_QFileIconProvider
  • tst_QFileSystemModel
  • tst_QFiledialog
  • tst_QFontComboBox
  • tst_QGraphicsProxyWidget
  • tst_QGraphicsWidget
  • tst_QGuiApplication
  • tst_QGuiVariant
  • tst_QIODevice
  • tst_QIcon
  • tst_QImage
  • tst_QImageReader
  • tst_QImageWriter
  • tst_QLockFile
  • tst_QMimeDatabase
  • ...
657
439-
440 if (read < maxlen) {
read < maxlenDescription
TRUEevaluated 658 times by 37 tests
Evaluated by:
  • tst_QAccessibility
  • tst_QCalendarWidget
  • tst_QChar
  • tst_QComboBox
  • tst_QCompleter
  • tst_QCssParser
  • tst_QDateTimeEdit
  • tst_QDebug
  • tst_QFile
  • tst_QFileDialog2
  • tst_QFileIconProvider
  • tst_QFileSystemModel
  • tst_QFiledialog
  • tst_QFontComboBox
  • tst_QGraphicsProxyWidget
  • tst_QGraphicsWidget
  • tst_QGuiApplication
  • tst_QGuiVariant
  • tst_QIODevice
  • tst_QIcon
  • tst_QImage
  • tst_QImageReader
  • tst_QImageWriter
  • tst_QLockFile
  • tst_QMimeDatabase
  • ...
FALSEevaluated 7 times by 2 tests
Evaluated by:
  • tst_QFile
  • tst_QImageReader
7-658
441 // failed to read all requested, may be at the end of file, stop caching size so that it's rechecked-
442 d->cachedSize = 0;-
443 }
executed 658 times by 37 tests: end of block
Executed by:
  • tst_QAccessibility
  • tst_QCalendarWidget
  • tst_QChar
  • tst_QComboBox
  • tst_QCompleter
  • tst_QCssParser
  • tst_QDateTimeEdit
  • tst_QDebug
  • tst_QFile
  • tst_QFileDialog2
  • tst_QFileIconProvider
  • tst_QFileSystemModel
  • tst_QFiledialog
  • tst_QFontComboBox
  • tst_QGraphicsProxyWidget
  • tst_QGraphicsWidget
  • tst_QGuiApplication
  • tst_QGuiVariant
  • tst_QIODevice
  • tst_QIcon
  • tst_QImage
  • tst_QImageReader
  • tst_QImageWriter
  • tst_QLockFile
  • tst_QMimeDatabase
  • ...
658
444-
445 return read;
executed 665 times by 37 tests: return read;
Executed by:
  • tst_QAccessibility
  • tst_QCalendarWidget
  • tst_QChar
  • tst_QComboBox
  • tst_QCompleter
  • tst_QCssParser
  • tst_QDateTimeEdit
  • tst_QDebug
  • tst_QFile
  • tst_QFileDialog2
  • tst_QFileIconProvider
  • tst_QFileSystemModel
  • tst_QFiledialog
  • tst_QFontComboBox
  • tst_QGraphicsProxyWidget
  • tst_QGraphicsWidget
  • tst_QGuiApplication
  • tst_QGuiVariant
  • tst_QIODevice
  • tst_QIcon
  • tst_QImage
  • tst_QImageReader
  • tst_QImageWriter
  • tst_QLockFile
  • tst_QMimeDatabase
  • ...
665
446}-
447-
448/*!-
449 \reimp-
450*/-
451qint64 QFileDevice::readData(char *data, qint64 len)-
452{-
453 Q_D(QFileDevice);-
454 if (!len)
!lenDescription
TRUEevaluated 17026 times by 92 tests
Evaluated by:
  • tst_QAbstractItemView
  • tst_QAbstractScrollArea
  • tst_QAccessibility
  • tst_QButtonGroup
  • tst_QCalendarWidget
  • tst_QChar
  • tst_QColorDialog
  • tst_QColumnView
  • tst_QComboBox
  • tst_QCommandLinkButton
  • tst_QCompleter
  • tst_QCssParser
  • tst_QDataStream
  • tst_QDateTime
  • tst_QDateTimeEdit
  • tst_QDebug
  • tst_QDialog
  • tst_QDoubleSpinBox
  • tst_QFile
  • tst_QFileDialog2
  • tst_QFileIconProvider
  • tst_QFileInfo
  • tst_QFileSystemModel
  • tst_QFiledialog
  • tst_QFocusEvent
  • ...
FALSEevaluated 146243 times by 138 tests
Evaluated by:
  • tst_LargeFile
  • tst_QAbstractFileEngine
  • tst_QAbstractItemView
  • tst_QAbstractNetworkCache
  • tst_QAbstractScrollArea
  • tst_QAccessibility
  • tst_QButtonGroup
  • tst_QByteArray
  • tst_QCalendarWidget
  • tst_QChar
  • tst_QColorDialog
  • tst_QColumnView
  • tst_QComboBox
  • tst_QCommandLinkButton
  • tst_QCompleter
  • tst_QCryptographicHash
  • tst_QCssParser
  • tst_QDataStream
  • tst_QDateTime
  • tst_QDateTimeEdit
  • tst_QDebug
  • tst_QDialog
  • tst_QDoubleSpinBox
  • tst_QErrorMessage
  • tst_QFile
  • ...
17026-146243
455 return 0;
executed 17026 times by 92 tests: return 0;
Executed by:
  • tst_QAbstractItemView
  • tst_QAbstractScrollArea
  • tst_QAccessibility
  • tst_QButtonGroup
  • tst_QCalendarWidget
  • tst_QChar
  • tst_QColorDialog
  • tst_QColumnView
  • tst_QComboBox
  • tst_QCommandLinkButton
  • tst_QCompleter
  • tst_QCssParser
  • tst_QDataStream
  • tst_QDateTime
  • tst_QDateTimeEdit
  • tst_QDebug
  • tst_QDialog
  • tst_QDoubleSpinBox
  • tst_QFile
  • tst_QFileDialog2
  • tst_QFileIconProvider
  • tst_QFileInfo
  • tst_QFileSystemModel
  • tst_QFiledialog
  • tst_QFocusEvent
  • ...
17026
456 unsetError();-
457 if (!d->ensureFlushed())
!d->ensureFlushed()Description
TRUEnever evaluated
FALSEevaluated 146243 times by 138 tests
Evaluated by:
  • tst_LargeFile
  • tst_QAbstractFileEngine
  • tst_QAbstractItemView
  • tst_QAbstractNetworkCache
  • tst_QAbstractScrollArea
  • tst_QAccessibility
  • tst_QButtonGroup
  • tst_QByteArray
  • tst_QCalendarWidget
  • tst_QChar
  • tst_QColorDialog
  • tst_QColumnView
  • tst_QComboBox
  • tst_QCommandLinkButton
  • tst_QCompleter
  • tst_QCryptographicHash
  • tst_QCssParser
  • tst_QDataStream
  • tst_QDateTime
  • tst_QDateTimeEdit
  • tst_QDebug
  • tst_QDialog
  • tst_QDoubleSpinBox
  • tst_QErrorMessage
  • tst_QFile
  • ...
0-146243
458 return -1;
never executed: return -1;
0
459-
460 const qint64 read = d->fileEngine->read(data, len);-
461 if (read < 0) {
read < 0Description
TRUEnever evaluated
FALSEevaluated 146243 times by 138 tests
Evaluated by:
  • tst_LargeFile
  • tst_QAbstractFileEngine
  • tst_QAbstractItemView
  • tst_QAbstractNetworkCache
  • tst_QAbstractScrollArea
  • tst_QAccessibility
  • tst_QButtonGroup
  • tst_QByteArray
  • tst_QCalendarWidget
  • tst_QChar
  • tst_QColorDialog
  • tst_QColumnView
  • tst_QComboBox
  • tst_QCommandLinkButton
  • tst_QCompleter
  • tst_QCryptographicHash
  • tst_QCssParser
  • tst_QDataStream
  • tst_QDateTime
  • tst_QDateTimeEdit
  • tst_QDebug
  • tst_QDialog
  • tst_QDoubleSpinBox
  • tst_QErrorMessage
  • tst_QFile
  • ...
0-146243
462 QFileDevice::FileError err = d->fileEngine->error();-
463 if (err == QFileDevice::UnspecifiedError)
err == QFileDe...specifiedErrorDescription
TRUEnever evaluated
FALSEnever evaluated
0
464 err = QFileDevice::ReadError;
never executed: err = QFileDevice::ReadError;
0
465 d->setError(err, d->fileEngine->errorString());-
466 }
never executed: end of block
0
467-
468 if (read < len) {
read < lenDescription
TRUEevaluated 129332 times by 128 tests
Evaluated by:
  • tst_LargeFile
  • tst_QAbstractItemView
  • tst_QAbstractNetworkCache
  • tst_QAbstractScrollArea
  • tst_QAccessibility
  • tst_QButtonGroup
  • tst_QCalendarWidget
  • tst_QChar
  • tst_QColorDialog
  • tst_QColumnView
  • tst_QComboBox
  • tst_QCommandLinkButton
  • tst_QCompleter
  • tst_QCryptographicHash
  • tst_QCssParser
  • tst_QDataStream
  • tst_QDateTime
  • tst_QDateTimeEdit
  • tst_QDebug
  • tst_QDialog
  • tst_QDoubleSpinBox
  • tst_QFile
  • tst_QFileDialog2
  • tst_QFileIconProvider
  • tst_QFileInfo
  • ...
FALSEevaluated 16911 times by 68 tests
Evaluated by:
  • tst_LargeFile
  • tst_QAbstractFileEngine
  • tst_QAbstractItemView
  • tst_QAbstractNetworkCache
  • tst_QAccessibility
  • tst_QByteArray
  • tst_QCalendarWidget
  • tst_QChar
  • tst_QCommandLinkButton
  • tst_QCompleter
  • tst_QDateTimeEdit
  • tst_QErrorMessage
  • tst_QFile
  • tst_QFileDialog2
  • tst_QFileIconProvider
  • tst_QFileInfo
  • tst_QFileSystemModel
  • tst_QFiledialog
  • tst_QFontDialog
  • tst_QFtp
  • tst_QGraphicsProxyWidget
  • tst_QIODevice
  • tst_QIcoImageFormat
  • tst_QIcon
  • tst_QImage
  • ...
16911-129332
469 // failed to read all requested, may be at the end of file, stop caching size so that it's rechecked-
470 d->cachedSize = 0;-
471 }
executed 129332 times by 128 tests: end of block
Executed by:
  • tst_LargeFile
  • tst_QAbstractItemView
  • tst_QAbstractNetworkCache
  • tst_QAbstractScrollArea
  • tst_QAccessibility
  • tst_QButtonGroup
  • tst_QCalendarWidget
  • tst_QChar
  • tst_QColorDialog
  • tst_QColumnView
  • tst_QComboBox
  • tst_QCommandLinkButton
  • tst_QCompleter
  • tst_QCryptographicHash
  • tst_QCssParser
  • tst_QDataStream
  • tst_QDateTime
  • tst_QDateTimeEdit
  • tst_QDebug
  • tst_QDialog
  • tst_QDoubleSpinBox
  • tst_QFile
  • tst_QFileDialog2
  • tst_QFileIconProvider
  • tst_QFileInfo
  • ...
129332
472-
473 return read;
executed 146243 times by 138 tests: return read;
Executed by:
  • tst_LargeFile
  • tst_QAbstractFileEngine
  • tst_QAbstractItemView
  • tst_QAbstractNetworkCache
  • tst_QAbstractScrollArea
  • tst_QAccessibility
  • tst_QButtonGroup
  • tst_QByteArray
  • tst_QCalendarWidget
  • tst_QChar
  • tst_QColorDialog
  • tst_QColumnView
  • tst_QComboBox
  • tst_QCommandLinkButton
  • tst_QCompleter
  • tst_QCryptographicHash
  • tst_QCssParser
  • tst_QDataStream
  • tst_QDateTime
  • tst_QDateTimeEdit
  • tst_QDebug
  • tst_QDialog
  • tst_QDoubleSpinBox
  • tst_QErrorMessage
  • tst_QFile
  • ...
146243
474}-
475-
476/*!-
477 \internal-
478*/-
479bool QFileDevicePrivate::putCharHelper(char c)-
480{-
481#ifdef QT_NO_QOBJECT-
482 return QIODevicePrivate::putCharHelper(c);-
483#else-
484-
485 // Cutoff for code that doesn't only touch the buffer.-
486 qint64 writeBufferSize = writeBuffer.size();-
487 if ((openMode & QIODevice::Unbuffered) || writeBufferSize + 1 >= writeBufferChunkSize
writeBufferSiz...ufferChunkSizeDescription
TRUEnever evaluated
FALSEevaluated 2144 times by 6 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QDataStream
  • tst_QFile
  • tst_QNetworkDiskCache
  • tst_QNetworkReply
  • tst_QSettings
0-2144
488#ifdef Q_OS_WIN-
489 || ((openMode & QIODevice::Text) && c == '\n'-
490 && writeBufferSize + 2 >= writeBufferChunkSize)-
491#endif-
492 ) {-
493 return QIODevicePrivate::putCharHelper(c);
never executed: return QIODevicePrivate::putCharHelper(c);
0
494 }-
495-
496 if (!(openMode & QIODevice::WriteOnly)) {
!(openMode & Q...ce::WriteOnly)Description
TRUEnever evaluated
FALSEevaluated 2144 times by 6 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QDataStream
  • tst_QFile
  • tst_QNetworkDiskCache
  • tst_QNetworkReply
  • tst_QSettings
0-2144
497 if (openMode == QIODevice::NotOpen)
openMode == QIODevice::NotOpenDescription
TRUEnever evaluated
FALSEnever evaluated
0
498 qWarning("QIODevice::putChar: Closed device");
never executed: QMessageLogger(__FILE__, 498, __PRETTY_FUNCTION__).warning("QIODevice::putChar: Closed device");
0
499 else-
500 qWarning("QIODevice::putChar: ReadOnly device");
never executed: QMessageLogger(__FILE__, 500, __PRETTY_FUNCTION__).warning("QIODevice::putChar: ReadOnly device");
0
501 return false;
never executed: return false;
0
502 }-
503-
504 // Make sure the device is positioned correctly.-
505 const bool sequential = isSequential();-
506 if (pos != devicePos && !sequential && !q_func()->seek(pos))
pos != devicePosDescription
TRUEnever evaluated
FALSEevaluated 2144 times by 6 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QDataStream
  • tst_QFile
  • tst_QNetworkDiskCache
  • tst_QNetworkReply
  • tst_QSettings
!sequentialDescription
TRUEnever evaluated
FALSEnever evaluated
!q_func()->seek(pos)Description
TRUEnever evaluated
FALSEnever evaluated
0-2144
507 return false;
never executed: return false;
0
508-
509 lastWasWrite = true;-
510-
511 int len = 1;-
512#ifdef Q_OS_WIN-
513 if ((openMode & QIODevice::Text) && c == '\n') {-
514 ++len;-
515 *writeBuffer.reserve(1) = '\r';-
516 }-
517#endif-
518-
519 // Write to buffer.-
520 *writeBuffer.reserve(1) = c;-
521-
522 if (!sequential) {
!sequentialDescription
TRUEevaluated 2144 times by 6 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QDataStream
  • tst_QFile
  • tst_QNetworkDiskCache
  • tst_QNetworkReply
  • tst_QSettings
FALSEnever evaluated
0-2144
523 pos += len;-
524 devicePos += len;-
525 if (!buffer.isEmpty())
!buffer.isEmpty()Description
TRUEnever evaluated
FALSEevaluated 2144 times by 6 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QDataStream
  • tst_QFile
  • tst_QNetworkDiskCache
  • tst_QNetworkReply
  • tst_QSettings
0-2144
526 buffer.skip(len);
never executed: buffer.skip(len);
0
527 }
executed 2144 times by 6 tests: end of block
Executed by:
  • tst_QAbstractNetworkCache
  • tst_QDataStream
  • tst_QFile
  • tst_QNetworkDiskCache
  • tst_QNetworkReply
  • tst_QSettings
2144
528-
529 return true;
executed 2144 times by 6 tests: return true;
Executed by:
  • tst_QAbstractNetworkCache
  • tst_QDataStream
  • tst_QFile
  • tst_QNetworkDiskCache
  • tst_QNetworkReply
  • tst_QSettings
2144
530#endif-
531}-
532-
533/*!-
534 \reimp-
535*/-
536qint64 QFileDevice::writeData(const char *data, qint64 len)-
537{-
538 Q_D(QFileDevice);-
539 unsetError();-
540 d->lastWasWrite = true;-
541 bool buffered = !(d->openMode & Unbuffered);-
542-
543 // Flush buffered data if this read will overflow.-
544 if (buffered && (d->writeBuffer.size() + len) > d->writeBufferChunkSize) {
bufferedDescription
TRUEevaluated 128830 times by 44 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QColorDialog
  • tst_QDataStream
  • tst_QDir
  • tst_QFile
  • tst_QFileDialog2
  • tst_QFileInfo
  • tst_QFileSystemModel
  • tst_QFileSystemWatcher
  • tst_QFiledialog
  • tst_QFtp
  • tst_QGraphicsProxyWidget
  • tst_QIODevice
  • tst_QIcon
  • tst_QImage
  • tst_QImageReader
  • tst_QImageWriter
  • tst_QLoggingRegistry
  • tst_QMimeDatabase
  • tst_QNetworkDiskCache
  • tst_QNetworkReply
  • tst_QPainter
  • tst_QPainterPath
  • tst_QPixmap
  • tst_QPrinter
  • ...
FALSEevaluated 651 times by 5 tests
Evaluated by:
  • tst_LargeFile
  • tst_QAbstractFileEngine
  • tst_QFile
  • tst_QNetworkReply
  • tst_qfileopenevent
(d->writeBuffe...ufferChunkSizeDescription
TRUEevaluated 542 times by 12 tests
Evaluated by:
  • tst_QFile
  • tst_QFileInfo
  • tst_QFtp
  • tst_QIODevice
  • tst_QImageReader
  • tst_QImageWriter
  • tst_QMimeDatabase
  • tst_QNetworkDiskCache
  • tst_QNetworkReply
  • tst_QStorageInfo
  • tst_QTextStream
  • tst_qnetworkreply - unknown status
FALSEevaluated 128288 times by 43 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QColorDialog
  • tst_QDataStream
  • tst_QDir
  • tst_QFile
  • tst_QFileDialog2
  • tst_QFileInfo
  • tst_QFileSystemModel
  • tst_QFileSystemWatcher
  • tst_QFiledialog
  • tst_QFtp
  • tst_QGraphicsProxyWidget
  • tst_QIODevice
  • tst_QIcon
  • tst_QImage
  • tst_QImageReader
  • tst_QImageWriter
  • tst_QLoggingRegistry
  • tst_QMimeDatabase
  • tst_QNetworkDiskCache
  • tst_QNetworkReply
  • tst_QPainter
  • tst_QPainterPath
  • tst_QPixmap
  • tst_QPrinter
  • ...
542-128830
545 if (!flush())
!flush()Description
TRUEnever evaluated
FALSEevaluated 542 times by 12 tests
Evaluated by:
  • tst_QFile
  • tst_QFileInfo
  • tst_QFtp
  • tst_QIODevice
  • tst_QImageReader
  • tst_QImageWriter
  • tst_QMimeDatabase
  • tst_QNetworkDiskCache
  • tst_QNetworkReply
  • tst_QStorageInfo
  • tst_QTextStream
  • tst_qnetworkreply - unknown status
0-542
546 return -1;
never executed: return -1;
0
547 }
executed 542 times by 12 tests: end of block
Executed by:
  • tst_QFile
  • tst_QFileInfo
  • tst_QFtp
  • tst_QIODevice
  • tst_QImageReader
  • tst_QImageWriter
  • tst_QMimeDatabase
  • tst_QNetworkDiskCache
  • tst_QNetworkReply
  • tst_QStorageInfo
  • tst_QTextStream
  • tst_qnetworkreply - unknown status
542
548-
549 // Write directly to the engine if the block size is larger than-
550 // the write buffer size.-
551 if (!buffered || len > d->writeBufferChunkSize) {
!bufferedDescription
TRUEevaluated 651 times by 5 tests
Evaluated by:
  • tst_LargeFile
  • tst_QAbstractFileEngine
  • tst_QFile
  • tst_QNetworkReply
  • tst_qfileopenevent
FALSEevaluated 128830 times by 44 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QColorDialog
  • tst_QDataStream
  • tst_QDir
  • tst_QFile
  • tst_QFileDialog2
  • tst_QFileInfo
  • tst_QFileSystemModel
  • tst_QFileSystemWatcher
  • tst_QFiledialog
  • tst_QFtp
  • tst_QGraphicsProxyWidget
  • tst_QIODevice
  • tst_QIcon
  • tst_QImage
  • tst_QImageReader
  • tst_QImageWriter
  • tst_QLoggingRegistry
  • tst_QMimeDatabase
  • tst_QNetworkDiskCache
  • tst_QNetworkReply
  • tst_QPainter
  • tst_QPainterPath
  • tst_QPixmap
  • tst_QPrinter
  • ...
len > d->writeBufferChunkSizeDescription
TRUEevaluated 53 times by 8 tests
Evaluated by:
  • tst_QFile
  • tst_QIODevice
  • tst_QImageWriter
  • tst_QNetworkDiskCache
  • tst_QNetworkReply
  • tst_QStorageInfo
  • tst_QTextStream
  • tst_qnetworkreply - unknown status
FALSEevaluated 128777 times by 43 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QColorDialog
  • tst_QDataStream
  • tst_QDir
  • tst_QFile
  • tst_QFileDialog2
  • tst_QFileInfo
  • tst_QFileSystemModel
  • tst_QFileSystemWatcher
  • tst_QFiledialog
  • tst_QFtp
  • tst_QGraphicsProxyWidget
  • tst_QIODevice
  • tst_QIcon
  • tst_QImage
  • tst_QImageReader
  • tst_QImageWriter
  • tst_QLoggingRegistry
  • tst_QMimeDatabase
  • tst_QNetworkDiskCache
  • tst_QNetworkReply
  • tst_QPainter
  • tst_QPainterPath
  • tst_QPixmap
  • tst_QPrinter
  • ...
53-128830
552 const qint64 ret = d->fileEngine->write(data, len);-
553 if (ret < 0) {
ret < 0Description
TRUEnever evaluated
FALSEevaluated 704 times by 11 tests
Evaluated by:
  • tst_LargeFile
  • tst_QAbstractFileEngine
  • tst_QFile
  • tst_QIODevice
  • tst_QImageWriter
  • tst_QNetworkDiskCache
  • tst_QNetworkReply
  • tst_QStorageInfo
  • tst_QTextStream
  • tst_qfileopenevent
  • tst_qnetworkreply - unknown status
0-704
554 QFileDevice::FileError err = d->fileEngine->error();-
555 if (err == QFileDevice::UnspecifiedError)
err == QFileDe...specifiedErrorDescription
TRUEnever evaluated
FALSEnever evaluated
0
556 err = QFileDevice::WriteError;
never executed: err = QFileDevice::WriteError;
0
557 d->setError(err, d->fileEngine->errorString());-
558 }
never executed: end of block
0
559 return ret;
executed 704 times by 11 tests: return ret;
Executed by:
  • tst_LargeFile
  • tst_QAbstractFileEngine
  • tst_QFile
  • tst_QIODevice
  • tst_QImageWriter
  • tst_QNetworkDiskCache
  • tst_QNetworkReply
  • tst_QStorageInfo
  • tst_QTextStream
  • tst_qfileopenevent
  • tst_qnetworkreply - unknown status
704
560 }-
561-
562 // Write to the buffer.-
563 d->writeBuffer.append(data, len);-
564 return len;
executed 128777 times by 43 tests: return len;
Executed by:
  • tst_QAbstractNetworkCache
  • tst_QColorDialog
  • tst_QDataStream
  • tst_QDir
  • tst_QFile
  • tst_QFileDialog2
  • tst_QFileInfo
  • tst_QFileSystemModel
  • tst_QFileSystemWatcher
  • tst_QFiledialog
  • tst_QFtp
  • tst_QGraphicsProxyWidget
  • tst_QIODevice
  • tst_QIcon
  • tst_QImage
  • tst_QImageReader
  • tst_QImageWriter
  • tst_QLoggingRegistry
  • tst_QMimeDatabase
  • tst_QNetworkDiskCache
  • tst_QNetworkReply
  • tst_QPainter
  • tst_QPainterPath
  • tst_QPixmap
  • tst_QPrinter
  • ...
128777
565}-
566-
567/*!-
568 Returns the file error status.-
569-
570 The I/O device status returns an error code. For example, if open()-
571 returns \c false, or a read/write operation returns -1, this function can-
572 be called to find out the reason why the operation failed.-
573-
574 \sa unsetError()-
575*/-
576QFileDevice::FileError QFileDevice::error() const-
577{-
578 Q_D(const QFileDevice);-
579 return d->error;
executed 13929 times by 76 tests: return d->error;
Executed by:
  • tst_LargeFile
  • tst_QAbstractFileEngine
  • tst_QAbstractNetworkCache
  • tst_QColorDialog
  • tst_QDataStream
  • tst_QDir
  • tst_QDirIterator
  • tst_QDirModel
  • tst_QFile
  • tst_QFileDialog2
  • tst_QFileInfo
  • tst_QFileSystemModel
  • tst_QFileSystemWatcher
  • tst_QFiledialog
  • tst_QFtp
  • tst_QGraphicsProxyWidget
  • tst_QIODevice
  • tst_QIcon
  • tst_QImage
  • tst_QImageReader
  • tst_QImageWriter
  • tst_QLocalSocket
  • tst_QLockFile
  • tst_QLoggingRegistry
  • tst_QMimeDatabase
  • ...
13929
580}-
581-
582/*!-
583 Sets the file's error to QFileDevice::NoError.-
584-
585 \sa error()-
586*/-
587void QFileDevice::unsetError()-
588{-
589 Q_D(QFileDevice);-
590 d->setError(QFileDevice::NoError);-
591}
executed 719154 times by 248 tests: end of block
Executed by:
  • tst_LargeFile
  • tst_NetworkSelfTest
  • tst_QAbstractFileEngine
  • tst_QAbstractItemView
  • tst_QAbstractNetworkCache
  • tst_QAbstractPrintDialog
  • tst_QAbstractScrollArea
  • tst_QAccessibility
  • tst_QApplication
  • tst_QBrush
  • tst_QButtonGroup
  • tst_QByteArray
  • tst_QCalendarWidget
  • tst_QChar
  • tst_QColorDialog
  • tst_QColumnView
  • tst_QComboBox
  • tst_QCommandLineParser
  • tst_QCommandLinkButton
  • tst_QCompleter
  • tst_QCoreApplication
  • tst_QCryptographicHash
  • tst_QCssParser
  • tst_QDBusConnectionNoBus
  • tst_QDBusConnectionNoLibDBus1
  • ...
719154
592-
593/*!-
594 Returns the size of the file.-
595-
596 For regular empty files on Unix (e.g. those in \c /proc), this function-
597 returns 0; the contents of such a file are generated on demand in response-
598 to you calling read().-
599*/-
600qint64 QFileDevice::size() const-
601{-
602 Q_D(const QFileDevice);-
603 if (!d->ensureFlushed())
!d->ensureFlushed()Description
TRUEnever evaluated
FALSEevaluated 165638 times by 164 tests
Evaluated by:
  • tst_LargeFile
  • tst_NetworkSelfTest
  • tst_QAbstractFileEngine
  • tst_QAbstractItemView
  • tst_QAbstractNetworkCache
  • tst_QAbstractPrintDialog
  • tst_QAbstractScrollArea
  • tst_QAccessibility
  • tst_QApplication
  • tst_QBrush
  • tst_QButtonGroup
  • tst_QByteArray
  • tst_QCalendarWidget
  • tst_QChar
  • tst_QColorDialog
  • tst_QColumnView
  • tst_QComboBox
  • tst_QCommandLinkButton
  • tst_QCompleter
  • tst_QCryptographicHash
  • tst_QCssParser
  • tst_QDataStream
  • tst_QDateTimeEdit
  • tst_QDebug
  • tst_QDialog
  • ...
0-165638
604 return 0;
never executed: return 0;
0
605 d->cachedSize = d->engine()->size();-
606 return d->cachedSize;
executed 165638 times by 164 tests: return d->cachedSize;
Executed by:
  • tst_LargeFile
  • tst_NetworkSelfTest
  • tst_QAbstractFileEngine
  • tst_QAbstractItemView
  • tst_QAbstractNetworkCache
  • tst_QAbstractPrintDialog
  • tst_QAbstractScrollArea
  • tst_QAccessibility
  • tst_QApplication
  • tst_QBrush
  • tst_QButtonGroup
  • tst_QByteArray
  • tst_QCalendarWidget
  • tst_QChar
  • tst_QColorDialog
  • tst_QColumnView
  • tst_QComboBox
  • tst_QCommandLinkButton
  • tst_QCompleter
  • tst_QCryptographicHash
  • tst_QCssParser
  • tst_QDataStream
  • tst_QDateTimeEdit
  • tst_QDebug
  • tst_QDialog
  • ...
165638
607}-
608-
609/*!-
610 Sets the file size (in bytes) \a sz. Returns \c true if the-
611 resize succeeds; false otherwise. If \a sz is larger than the file-
612 currently is, the new bytes will be set to 0; if \a sz is smaller, the-
613 file is simply truncated.-
614-
615 \sa size()-
616*/-
617bool QFileDevice::resize(qint64 sz)-
618{-
619 Q_D(QFileDevice);-
620 if (!d->ensureFlushed())
!d->ensureFlushed()Description
TRUEnever evaluated
FALSEevaluated 295 times by 7 tests
Evaluated by:
  • tst_QAbstractFileEngine
  • tst_QDirModel
  • tst_QFile
  • tst_QFileSystemModel
  • tst_QFiledialog
  • tst_QNetworkReply
  • tst_QTemporaryFile
0-295
621 return false;
never executed: return false;
0
622 d->engine();-
623 if (isOpen() && d->fileEngine->pos() > sz)
isOpen()Description
TRUEevaluated 284 times by 7 tests
Evaluated by:
  • tst_QAbstractFileEngine
  • tst_QDirModel
  • tst_QFile
  • tst_QFileSystemModel
  • tst_QFiledialog
  • tst_QNetworkReply
  • tst_QTemporaryFile
FALSEevaluated 11 times by 2 tests
Evaluated by:
  • tst_QAbstractFileEngine
  • tst_QFile
d->fileEngine->pos() > szDescription
TRUEevaluated 5 times by 2 tests
Evaluated by:
  • tst_QFile
  • tst_QNetworkReply
FALSEevaluated 279 times by 6 tests
Evaluated by:
  • tst_QAbstractFileEngine
  • tst_QDirModel
  • tst_QFile
  • tst_QFileSystemModel
  • tst_QFiledialog
  • tst_QTemporaryFile
5-284
624 seek(sz);
executed 5 times by 2 tests: seek(sz);
Executed by:
  • tst_QFile
  • tst_QNetworkReply
5
625 if (d->fileEngine->setSize(sz)) {
d->fileEngine->setSize(sz)Description
TRUEevaluated 295 times by 7 tests
Evaluated by:
  • tst_QAbstractFileEngine
  • tst_QDirModel
  • tst_QFile
  • tst_QFileSystemModel
  • tst_QFiledialog
  • tst_QNetworkReply
  • tst_QTemporaryFile
FALSEnever evaluated
0-295
626 unsetError();-
627 d->cachedSize = sz;-
628 return true;
executed 295 times by 7 tests: return true;
Executed by:
  • tst_QAbstractFileEngine
  • tst_QDirModel
  • tst_QFile
  • tst_QFileSystemModel
  • tst_QFiledialog
  • tst_QNetworkReply
  • tst_QTemporaryFile
295
629 }-
630 d->cachedSize = 0;-
631 d->setError(QFile::ResizeError, d->fileEngine->errorString());-
632 return false;
never executed: return false;
0
633}-
634-
635/*!-
636 Returns the complete OR-ed together combination of-
637 QFile::Permission for the file.-
638-
639 \sa setPermissions()-
640*/-
641QFile::Permissions QFileDevice::permissions() const-
642{-
643 Q_D(const QFileDevice);-
644 QAbstractFileEngine::FileFlags perms = d->engine()->fileFlags(QAbstractFileEngine::PermsMask) & QAbstractFileEngine::PermsMask;-
645 return QFile::Permissions((int)perms); //ewww
executed 200 times by 12 tests: return QFile::Permissions((int)perms);
Executed by:
  • tst_QFile
  • tst_QFileDialog2
  • tst_QFileInfo
  • tst_QFileSystemModel
  • tst_QIcon
  • tst_QImageReader
  • tst_QImageWriter
  • tst_QLocalSocket
  • tst_QMimeDatabase
  • tst_QSaveFile
  • tst_qmakelib
  • tst_qstandardpaths
200
646}-
647-
648/*!-
649 Sets the permissions for the file to the \a permissions specified.-
650 Returns \c true if successful, or \c false if the permissions cannot be-
651 modified.-
652-
653 \warning This function does not manipulate ACLs, which may limit its-
654 effectiveness.-
655-
656 \sa permissions()-
657*/-
658bool QFileDevice::setPermissions(Permissions permissions)-
659{-
660 Q_D(QFileDevice);-
661 if (d->engine()->setPermissions(permissions)) {
d->engine()->s...s(permissions)Description
TRUEevaluated 1074 times by 22 tests
Evaluated by:
  • tst_QColorDialog
  • tst_QDir
  • tst_QDirModel
  • tst_QFile
  • tst_QFileDialog2
  • tst_QFileInfo
  • tst_QFileSystemModel
  • tst_QFileSystemWatcher
  • tst_QFiledialog
  • tst_QGraphicsProxyWidget
  • tst_QIcon
  • tst_QImageReader
  • tst_QImageWriter
  • tst_QLockFile
  • tst_QMimeDatabase
  • tst_QNetworkReply
  • tst_QSaveFile
  • tst_QSettings
  • tst_QTemporaryDir
  • tst_languageChange
  • tst_qmakelib
  • tst_qstandardpaths
FALSEevaluated 1 time by 1 test
Evaluated by:
  • tst_QFile
1-1074
662 unsetError();-
663 return true;
executed 1074 times by 22 tests: return true;
Executed by:
  • tst_QColorDialog
  • tst_QDir
  • tst_QDirModel
  • tst_QFile
  • tst_QFileDialog2
  • tst_QFileInfo
  • tst_QFileSystemModel
  • tst_QFileSystemWatcher
  • tst_QFiledialog
  • tst_QGraphicsProxyWidget
  • tst_QIcon
  • tst_QImageReader
  • tst_QImageWriter
  • tst_QLockFile
  • tst_QMimeDatabase
  • tst_QNetworkReply
  • tst_QSaveFile
  • tst_QSettings
  • tst_QTemporaryDir
  • tst_languageChange
  • tst_qmakelib
  • tst_qstandardpaths
1074
664 }-
665 d->setError(QFile::PermissionsError, d->fileEngine->errorString());-
666 return false;
executed 1 time by 1 test: return false;
Executed by:
  • tst_QFile
1
667}-
668-
669/*!-
670 \enum QFileDevice::MemoryMapFlags-
671 \since 4.4-
672-
673 This enum describes special options that may be used by the map()-
674 function.-
675-
676 \value NoOptions No options.-
677 \value MapPrivateOption The mapped memory will be private, so any-
678 modifications will not be visible to other processes and will not-
679 be written to disk. Any such modifications will be lost when the-
680 memory is unmapped. It is unspecified whether modifications made-
681 to the file made after the mapping is created will be visible through-
682 the mapped memory. This enum value was introduced in Qt 5.4.-
683*/-
684-
685/*!-
686 Maps \a size bytes of the file into memory starting at \a offset. A file-
687 should be open for a map to succeed but the file does not need to stay-
688 open after the memory has been mapped. When the QFile is destroyed-
689 or a new file is opened with this object, any maps that have not been-
690 unmapped will automatically be unmapped.-
691-
692 The mapping will have the same open mode as the file (read and/or write),-
693 except when using MapPrivateOption, in which case it is always possible-
694 to write to the mapped memory.-
695-
696 Any mapping options can be passed through \a flags.-
697-
698 Returns a pointer to the memory or 0 if there is an error.-
699-
700 \sa unmap()-
701 */-
702uchar *QFileDevice::map(qint64 offset, qint64 size, MemoryMapFlags flags)-
703{-
704 Q_D(QFileDevice);-
705 if (d->engine()
d->engine()Description
TRUEevaluated 34390 times by 121 tests
Evaluated by:
  • tst_LargeFile
  • tst_NetworkSelfTest
  • tst_QAbstractItemView
  • tst_QAbstractNetworkCache
  • tst_QAbstractPrintDialog
  • tst_QAbstractScrollArea
  • tst_QAccessibility
  • tst_QApplication
  • tst_QBrush
  • tst_QButtonGroup
  • tst_QCalendarWidget
  • tst_QColorDialog
  • tst_QColumnView
  • tst_QComboBox
  • tst_QCommandLinkButton
  • tst_QCompleter
  • tst_QDataStream
  • tst_QDateTimeEdit
  • tst_QDebug
  • tst_QDialog
  • tst_QDoubleSpinBox
  • tst_QErrorMessage
  • tst_QFactoryLoader
  • tst_QFile
  • tst_QFileDialog2
  • ...
FALSEnever evaluated
0-34390
706 && d->fileEngine->supportsExtension(QAbstractFileEngine::MapExtension)) {
d->fileEngine-...:MapExtension)Description
TRUEevaluated 34390 times by 121 tests
Evaluated by:
  • tst_LargeFile
  • tst_NetworkSelfTest
  • tst_QAbstractItemView
  • tst_QAbstractNetworkCache
  • tst_QAbstractPrintDialog
  • tst_QAbstractScrollArea
  • tst_QAccessibility
  • tst_QApplication
  • tst_QBrush
  • tst_QButtonGroup
  • tst_QCalendarWidget
  • tst_QColorDialog
  • tst_QColumnView
  • tst_QComboBox
  • tst_QCommandLinkButton
  • tst_QCompleter
  • tst_QDataStream
  • tst_QDateTimeEdit
  • tst_QDebug
  • tst_QDialog
  • tst_QDoubleSpinBox
  • tst_QErrorMessage
  • tst_QFactoryLoader
  • tst_QFile
  • tst_QFileDialog2
  • ...
FALSEnever evaluated
0-34390
707 unsetError();-
708 uchar *address = d->fileEngine->map(offset, size, flags);-
709 if (address == 0)
address == 0Description
TRUEevaluated 24 times by 1 test
Evaluated by:
  • tst_QFile
FALSEevaluated 34366 times by 121 tests
Evaluated by:
  • tst_LargeFile
  • tst_NetworkSelfTest
  • tst_QAbstractItemView
  • tst_QAbstractNetworkCache
  • tst_QAbstractPrintDialog
  • tst_QAbstractScrollArea
  • tst_QAccessibility
  • tst_QApplication
  • tst_QBrush
  • tst_QButtonGroup
  • tst_QCalendarWidget
  • tst_QColorDialog
  • tst_QColumnView
  • tst_QComboBox
  • tst_QCommandLinkButton
  • tst_QCompleter
  • tst_QDataStream
  • tst_QDateTimeEdit
  • tst_QDebug
  • tst_QDialog
  • tst_QDoubleSpinBox
  • tst_QErrorMessage
  • tst_QFactoryLoader
  • tst_QFile
  • tst_QFileDialog2
  • ...
24-34366
710 d->setError(d->fileEngine->error(), d->fileEngine->errorString());
executed 24 times by 1 test: d->setError(d->fileEngine->error(), d->fileEngine->errorString());
Executed by:
  • tst_QFile
24
711 return address;
executed 34390 times by 121 tests: return address;
Executed by:
  • tst_LargeFile
  • tst_NetworkSelfTest
  • tst_QAbstractItemView
  • tst_QAbstractNetworkCache
  • tst_QAbstractPrintDialog
  • tst_QAbstractScrollArea
  • tst_QAccessibility
  • tst_QApplication
  • tst_QBrush
  • tst_QButtonGroup
  • tst_QCalendarWidget
  • tst_QColorDialog
  • tst_QColumnView
  • tst_QComboBox
  • tst_QCommandLinkButton
  • tst_QCompleter
  • tst_QDataStream
  • tst_QDateTimeEdit
  • tst_QDebug
  • tst_QDialog
  • tst_QDoubleSpinBox
  • tst_QErrorMessage
  • tst_QFactoryLoader
  • tst_QFile
  • tst_QFileDialog2
  • ...
34390
712 }-
713 return 0;
never executed: return 0;
0
714}-
715-
716/*!-
717 Unmaps the memory \a address.-
718-
719 Returns \c true if the unmap succeeds; false otherwise.-
720-
721 \sa map()-
722 */-
723bool QFileDevice::unmap(uchar *address)-
724{-
725 Q_D(QFileDevice);-
726 if (d->engine()
d->engine()Description
TRUEevaluated 32814 times by 2 tests
Evaluated by:
  • tst_LargeFile
  • tst_QFile
FALSEnever evaluated
0-32814
727 && d->fileEngine->supportsExtension(QAbstractFileEngine::UnMapExtension)) {
d->fileEngine-...nMapExtension)Description
TRUEevaluated 32814 times by 2 tests
Evaluated by:
  • tst_LargeFile
  • tst_QFile
FALSEnever evaluated
0-32814
728 unsetError();-
729 bool success = d->fileEngine->unmap(address);-
730 if (!success)
!successDescription
TRUEevaluated 8 times by 1 test
Evaluated by:
  • tst_QFile
FALSEevaluated 32806 times by 2 tests
Evaluated by:
  • tst_LargeFile
  • tst_QFile
8-32806
731 d->setError(d->fileEngine->error(), d->fileEngine->errorString());
executed 8 times by 1 test: d->setError(d->fileEngine->error(), d->fileEngine->errorString());
Executed by:
  • tst_QFile
8
732 return success;
executed 32814 times by 2 tests: return success;
Executed by:
  • tst_LargeFile
  • tst_QFile
32814
733 }-
734 d->setError(PermissionsError, tr("No file engine available or engine does not support UnMapExtension"));-
735 return false;
never executed: return false;
0
736}-
737-
738QT_END_NAMESPACE-
Source codeSwitch to Preprocessed file

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