Line | Source Code | Coverage |
---|
1 | | - |
2 | | - |
3 | | - |
4 | | - |
5 | | - |
6 | | - |
7 | | - |
8 | static const int QFILE_WRITEBUFFER_SIZE = 16384; | - |
9 | | - |
10 | QFileDevicePrivate::QFileDevicePrivate() | - |
11 | : fileEngine(0), lastWasWrite(false), | - |
12 | writeBuffer(QFILE_WRITEBUFFER_SIZE), error(QFile::NoError), | - |
13 | cachedSize(0) | - |
14 | { | - |
15 | } executed: } Execution Count:27020 | 27020 |
16 | | - |
17 | QFileDevicePrivate::~QFileDevicePrivate() | - |
18 | { | - |
19 | delete fileEngine; | - |
20 | fileEngine = 0; | - |
21 | } executed: } Execution Count:27007 | 27007 |
22 | | - |
23 | QAbstractFileEngine * QFileDevicePrivate::engine() const | - |
24 | { | - |
25 | if (!fileEngine) never evaluated: !fileEngine | 0 |
26 | fileEngine = new QFSFileEngine; never executed: fileEngine = new QFSFileEngine; | 0 |
27 | return fileEngine; never executed: return fileEngine; | 0 |
28 | } | - |
29 | | - |
30 | void QFileDevicePrivate::setError(QFileDevice::FileError err) | - |
31 | { | - |
32 | error = err; | - |
33 | errorString.clear(); | - |
34 | } executed: } Execution Count:615532 | 615532 |
35 | | - |
36 | void QFileDevicePrivate::setError(QFileDevice::FileError err, const QString &errStr) | - |
37 | { | - |
38 | error = err; | - |
39 | errorString = errStr; | - |
40 | } executed: } Execution Count:3970 | 3970 |
41 | | - |
42 | void QFileDevicePrivate::setError(QFileDevice::FileError err, int errNum) | - |
43 | { | - |
44 | error = err; | - |
45 | errorString = qt_error_string(errNum); | - |
46 | } | 0 |
47 | QFileDevice::QFileDevice() | - |
48 | : QIODevice(*new QFileDevicePrivate, 0) | - |
49 | { | - |
50 | } | 0 |
51 | | - |
52 | | - |
53 | | - |
54 | QFileDevice::QFileDevice(QObject *parent) | - |
55 | : QIODevice(*new QFileDevicePrivate, parent) | - |
56 | { | - |
57 | } | 0 |
58 | | - |
59 | | - |
60 | | - |
61 | QFileDevice::QFileDevice(QFileDevicePrivate &dd, QObject *parent) | - |
62 | : QIODevice(dd, parent) | - |
63 | { | - |
64 | } executed: } Execution Count:27020 | 27020 |
65 | | - |
66 | | - |
67 | | - |
68 | | - |
69 | | - |
70 | QFileDevice::~QFileDevice() | - |
71 | { | - |
72 | close(); | - |
73 | } executed: } Execution Count:27007 | 27007 |
74 | bool QFileDevice::isSequential() const | - |
75 | { | - |
76 | const QFileDevicePrivate * const d = d_func(); | - |
77 | return d->fileEngine && d->fileEngine->isSequential(); executed: return d->fileEngine && d->fileEngine->isSequential(); Execution Count:29058 | 29058 |
78 | } | - |
79 | int QFileDevice::handle() const | - |
80 | { | - |
81 | const QFileDevicePrivate * const d = d_func(); | - |
82 | if (!isOpen() || !d->fileEngine) evaluated: !isOpen() yes Evaluation Count:4 | yes Evaluation Count:975 |
partially evaluated: !d->fileEngine no Evaluation Count:0 | yes Evaluation Count:975 |
| 0-975 |
83 | return -1; executed: return -1; Execution Count:4 | 4 |
84 | | - |
85 | return d->fileEngine->handle(); executed: return d->fileEngine->handle(); Execution Count:975 | 975 |
86 | } | - |
87 | | - |
88 | | - |
89 | | - |
90 | | - |
91 | | - |
92 | QString QFileDevice::fileName() const | - |
93 | { | - |
94 | return QString(); never executed: return QString(); | 0 |
95 | } | - |
96 | | - |
97 | static inline qint64 _qfile_writeData(QAbstractFileEngine *engine, QRingBuffer *buffer) | - |
98 | { | - |
99 | qint64 ret = engine->write(buffer->readPointer(), buffer->nextDataBlockSize()); | - |
100 | if (ret > 0) evaluated: ret > 0 yes Evaluation Count:16069 | yes Evaluation Count:6 |
| 6-16069 |
101 | buffer->free(ret); executed: buffer->free(ret); Execution Count:16069 | 16069 |
102 | return ret; executed: return ret; Execution Count:16075 | 16075 |
103 | } | - |
104 | | - |
105 | | - |
106 | | - |
107 | | - |
108 | | - |
109 | bool QFileDevice::flush() | - |
110 | { | - |
111 | QFileDevicePrivate * const d = d_func(); | - |
112 | if (!d->fileEngine) { partially evaluated: !d->fileEngine no Evaluation Count:0 | yes Evaluation Count:34023 |
| 0-34023 |
113 | QMessageLogger("io/qfiledevice.cpp", 296, __PRETTY_FUNCTION__).warning("QFileDevice::flush: No file engine. Is IODevice open?"); | - |
114 | return false; never executed: return false; | 0 |
115 | } | - |
116 | | - |
117 | if (!d->writeBuffer.isEmpty()) { evaluated: !d->writeBuffer.isEmpty() yes Evaluation Count:16075 | yes Evaluation Count:17948 |
| 16075-17948 |
118 | qint64 size = d->writeBuffer.size(); | - |
119 | if (_qfile_writeData(d->fileEngine, &d->writeBuffer) != size) { evaluated: _qfile_writeData(d->fileEngine, &d->writeBuffer) != size yes Evaluation Count:6 | yes Evaluation Count:16069 |
| 6-16069 |
120 | QFileDevice::FileError err = d->fileEngine->error(); | - |
121 | if (err == QFileDevice::UnspecifiedError) partially evaluated: err == QFileDevice::UnspecifiedError no Evaluation Count:0 | yes Evaluation Count:6 |
| 0-6 |
122 | err = QFileDevice::WriteError; never executed: err = QFileDevice::WriteError; | 0 |
123 | d->setError(err, d->fileEngine->errorString()); | - |
124 | return false; executed: return false; Execution Count:6 | 6 |
125 | } | - |
126 | } executed: } Execution Count:16069 | 16069 |
127 | | - |
128 | if (!d->fileEngine->flush()) { partially evaluated: !d->fileEngine->flush() no Evaluation Count:0 | yes Evaluation Count:34017 |
| 0-34017 |
129 | QFileDevice::FileError err = d->fileEngine->error(); | - |
130 | if (err == QFileDevice::UnspecifiedError) never evaluated: err == QFileDevice::UnspecifiedError | 0 |
131 | err = QFileDevice::WriteError; never executed: err = QFileDevice::WriteError; | 0 |
132 | d->setError(err, d->fileEngine->errorString()); | - |
133 | return false; never executed: return false; | 0 |
134 | } | - |
135 | return true; executed: return true; Execution Count:34017 | 34017 |
136 | } | - |
137 | | - |
138 | | - |
139 | | - |
140 | | - |
141 | | - |
142 | | - |
143 | void QFileDevice::close() | - |
144 | { | - |
145 | QFileDevicePrivate * const d = d_func(); | - |
146 | if (!isOpen()) evaluated: !isOpen() yes Evaluation Count:18455 | yes Evaluation Count:18065 |
| 18065-18455 |
147 | return; executed: return; Execution Count:18455 | 18455 |
148 | bool flushed = flush(); | - |
149 | QIODevice::close(); | - |
150 | | - |
151 | | - |
152 | d->lastWasWrite = false; | - |
153 | d->writeBuffer.clear(); | - |
154 | | - |
155 | | - |
156 | if (d->fileEngine->close() && flushed) partially evaluated: d->fileEngine->close() yes Evaluation Count:18065 | no Evaluation Count:0 |
evaluated: flushed yes Evaluation Count:18063 | yes Evaluation Count:2 |
| 0-18065 |
157 | unsetError(); executed: unsetError(); Execution Count:18063 | 18063 |
158 | else if (flushed) partially evaluated: flushed no Evaluation Count:0 | yes Evaluation Count:2 |
| 0-2 |
159 | d->setError(d->fileEngine->error(), d->fileEngine->errorString()); never executed: d->setError(d->fileEngine->error(), d->fileEngine->errorString()); | 0 |
160 | } | - |
161 | | - |
162 | | - |
163 | | - |
164 | | - |
165 | qint64 QFileDevice::pos() const | - |
166 | { | - |
167 | return QIODevice::pos(); executed: return QIODevice::pos(); Execution Count:441278 | 441278 |
168 | } | - |
169 | bool QFileDevice::atEnd() const | - |
170 | { | - |
171 | const QFileDevicePrivate * const d = d_func(); | - |
172 | | - |
173 | | - |
174 | if (!d->buffer.isEmpty()) evaluated: !d->buffer.isEmpty() yes Evaluation Count:95840 | yes Evaluation Count:4267 |
| 4267-95840 |
175 | return false; executed: return false; Execution Count:95840 | 95840 |
176 | | - |
177 | if (!isOpen()) partially evaluated: !isOpen() no Evaluation Count:0 | yes Evaluation Count:4267 |
| 0-4267 |
178 | return true; never executed: return true; | 0 |
179 | | - |
180 | if (!d->ensureFlushed()) partially evaluated: !d->ensureFlushed() no Evaluation Count:0 | yes Evaluation Count:4267 |
| 0-4267 |
181 | return false; never executed: return false; | 0 |
182 | | - |
183 | | - |
184 | if (d->fileEngine->supportsExtension(QAbstractFileEngine::AtEndExtension)) { partially evaluated: d->fileEngine->supportsExtension(QAbstractFileEngine::AtEndExtension) no Evaluation Count:0 | yes Evaluation Count:4267 |
| 0-4267 |
185 | | - |
186 | | - |
187 | return d->fileEngine->atEnd(); never executed: return d->fileEngine->atEnd(); | 0 |
188 | } | - |
189 | | - |
190 | | - |
191 | | - |
192 | if (pos() < d->cachedSize) evaluated: pos() < d->cachedSize yes Evaluation Count:271 | yes Evaluation Count:3996 |
| 271-3996 |
193 | return false; executed: return false; Execution Count:271 | 271 |
194 | | - |
195 | | - |
196 | return bytesAvailable() == 0; executed: return bytesAvailable() == 0; Execution Count:3996 | 3996 |
197 | } | - |
198 | bool QFileDevice::seek(qint64 off) | - |
199 | { | - |
200 | QFileDevicePrivate * const d = d_func(); | - |
201 | if (!isOpen()) { partially evaluated: !isOpen() no Evaluation Count:0 | yes Evaluation Count:220544 |
| 0-220544 |
202 | QMessageLogger("io/qfiledevice.cpp", 411, __PRETTY_FUNCTION__).warning("QFileDevice::seek: IODevice is not open"); | - |
203 | return false; never executed: return false; | 0 |
204 | } | - |
205 | | - |
206 | if (!d->ensureFlushed()) partially evaluated: !d->ensureFlushed() no Evaluation Count:0 | yes Evaluation Count:220544 |
| 0-220544 |
207 | return false; never executed: return false; | 0 |
208 | | - |
209 | if (!d->fileEngine->seek(off) || !QIODevice::seek(off)) { partially evaluated: !d->fileEngine->seek(off) no Evaluation Count:0 | yes Evaluation Count:220544 |
partially evaluated: !QIODevice::seek(off) no Evaluation Count:0 | yes Evaluation Count:220544 |
| 0-220544 |
210 | QFileDevice::FileError err = d->fileEngine->error(); | - |
211 | if (err == QFileDevice::UnspecifiedError) never evaluated: err == QFileDevice::UnspecifiedError | 0 |
212 | err = QFileDevice::PositionError; never executed: err = QFileDevice::PositionError; | 0 |
213 | d->setError(err, d->fileEngine->errorString()); | - |
214 | return false; never executed: return false; | 0 |
215 | } | - |
216 | unsetError(); | - |
217 | return true; executed: return true; Execution Count:220544 | 220544 |
218 | } | - |
219 | | - |
220 | | - |
221 | | - |
222 | | - |
223 | qint64 QFileDevice::readLineData(char *data, qint64 maxlen) | - |
224 | { | - |
225 | QFileDevicePrivate * const d = d_func(); | - |
226 | if (!d->ensureFlushed()) partially evaluated: !d->ensureFlushed() no Evaluation Count:0 | yes Evaluation Count:361 |
| 0-361 |
227 | return -1; never executed: return -1; | 0 |
228 | | - |
229 | qint64 read; | - |
230 | if (d->fileEngine->supportsExtension(QAbstractFileEngine::FastReadLineExtension)) { evaluated: d->fileEngine->supportsExtension(QAbstractFileEngine::FastReadLineExtension) yes Evaluation Count:8 | yes Evaluation Count:353 |
| 8-353 |
231 | read = d->fileEngine->readLine(data, maxlen); | - |
232 | } else { executed: } Execution Count:8 | 8 |
233 | | - |
234 | | - |
235 | read = QIODevice::readLineData(data, maxlen); | - |
236 | } executed: } Execution Count:353 | 353 |
237 | | - |
238 | if (read < maxlen) { evaluated: read < maxlen yes Evaluation Count:360 | yes Evaluation Count:1 |
| 1-360 |
239 | | - |
240 | d->cachedSize = 0; | - |
241 | } executed: } Execution Count:360 | 360 |
242 | | - |
243 | return read; executed: return read; Execution Count:361 | 361 |
244 | } | - |
245 | | - |
246 | | - |
247 | | - |
248 | | - |
249 | qint64 QFileDevice::readData(char *data, qint64 len) | - |
250 | { | - |
251 | QFileDevicePrivate * const d = d_func(); | - |
252 | if (!len) evaluated: !len yes Evaluation Count:83771 | yes Evaluation Count:151402 |
| 83771-151402 |
253 | return 0; executed: return 0; Execution Count:83771 | 83771 |
254 | unsetError(); | - |
255 | if (!d->ensureFlushed()) partially evaluated: !d->ensureFlushed() no Evaluation Count:0 | yes Evaluation Count:151402 |
| 0-151402 |
256 | return -1; never executed: return -1; | 0 |
257 | | - |
258 | const qint64 read = d->fileEngine->read(data, len); | - |
259 | if (read < 0) { partially evaluated: read < 0 no Evaluation Count:0 | yes Evaluation Count:151403 |
| 0-151403 |
260 | QFileDevice::FileError err = d->fileEngine->error(); | - |
261 | if (err == QFileDevice::UnspecifiedError) never evaluated: err == QFileDevice::UnspecifiedError | 0 |
262 | err = QFileDevice::ReadError; never executed: err = QFileDevice::ReadError; | 0 |
263 | d->setError(err, d->fileEngine->errorString()); | - |
264 | } | 0 |
265 | | - |
266 | if (read < len) { evaluated: read < len yes Evaluation Count:134212 | yes Evaluation Count:17191 |
| 17191-134212 |
267 | | - |
268 | d->cachedSize = 0; | - |
269 | } executed: } Execution Count:134212 | 134212 |
270 | | - |
271 | return read; executed: return read; Execution Count:151403 | 151403 |
272 | } | - |
273 | | - |
274 | | - |
275 | | - |
276 | | - |
277 | bool QFileDevicePrivate::putCharHelper(char c) | - |
278 | { | - |
279 | | - |
280 | | - |
281 | | - |
282 | | - |
283 | | - |
284 | int writeBufferSize = writeBuffer.size(); | - |
285 | if ((openMode & QIODevice::Unbuffered) || writeBufferSize + 1 >= QFILE_WRITEBUFFER_SIZE partially evaluated: (openMode & QIODevice::Unbuffered) no Evaluation Count:0 | yes Evaluation Count:1304 |
partially evaluated: writeBufferSize + 1 >= QFILE_WRITEBUFFER_SIZE no Evaluation Count:0 | yes Evaluation Count:1304 |
| 0-1304 |
286 | | - |
287 | | - |
288 | | - |
289 | ) { | - |
290 | return QIODevicePrivate::putCharHelper(c); never executed: return QIODevicePrivate::putCharHelper(c); | 0 |
291 | } | - |
292 | | - |
293 | if (!(openMode & QIODevice::WriteOnly)) { partially evaluated: !(openMode & QIODevice::WriteOnly) no Evaluation Count:0 | yes Evaluation Count:1304 |
| 0-1304 |
294 | if (openMode == QIODevice::NotOpen) never evaluated: openMode == QIODevice::NotOpen | 0 |
295 | QMessageLogger("io/qfiledevice.cpp", 504, __PRETTY_FUNCTION__).warning("QIODevice::putChar: Closed device"); never executed: QMessageLogger("io/qfiledevice.cpp", 504, __PRETTY_FUNCTION__).warning("QIODevice::putChar: Closed device"); | 0 |
296 | else | - |
297 | QMessageLogger("io/qfiledevice.cpp", 506, __PRETTY_FUNCTION__).warning("QIODevice::putChar: ReadOnly device"); never executed: QMessageLogger("io/qfiledevice.cpp", 506, __PRETTY_FUNCTION__).warning("QIODevice::putChar: ReadOnly device"); | 0 |
298 | return false; never executed: return false; | 0 |
299 | } | - |
300 | | - |
301 | | - |
302 | const bool sequential = isSequential(); | - |
303 | if (pos != devicePos && !sequential && !q_func()->seek(pos)) partially evaluated: pos != devicePos no Evaluation Count:0 | yes Evaluation Count:1304 |
never evaluated: !sequential never evaluated: !q_func()->seek(pos) | 0-1304 |
304 | return false; never executed: return false; | 0 |
305 | | - |
306 | lastWasWrite = true; | - |
307 | | - |
308 | int len = 1; | - |
309 | *writeBuffer.reserve(1) = c; | - |
310 | | - |
311 | if (!sequential) { partially evaluated: !sequential yes Evaluation Count:1304 | no Evaluation Count:0 |
| 0-1304 |
312 | pos += len; | - |
313 | devicePos += len; | - |
314 | if (!buffer.isEmpty()) partially evaluated: !buffer.isEmpty() no Evaluation Count:0 | yes Evaluation Count:1304 |
| 0-1304 |
315 | buffer.skip(len); never executed: buffer.skip(len); | 0 |
316 | } executed: } Execution Count:1304 | 1304 |
317 | | - |
318 | return true; executed: return true; Execution Count:1304 | 1304 |
319 | | - |
320 | } | - |
321 | | - |
322 | | - |
323 | | - |
324 | | - |
325 | qint64 QFileDevice::writeData(const char *data, qint64 len) | - |
326 | { | - |
327 | QFileDevicePrivate * const d = d_func(); | - |
328 | unsetError(); | - |
329 | d->lastWasWrite = true; | - |
330 | bool buffered = !(d->openMode & Unbuffered); | - |
331 | | - |
332 | | - |
333 | if (buffered && (d->writeBuffer.size() + len) > QFILE_WRITEBUFFER_SIZE) { evaluated: buffered yes Evaluation Count:125002 | yes Evaluation Count:601 |
evaluated: (d->writeBuffer.size() + len) > QFILE_WRITEBUFFER_SIZE yes Evaluation Count:396 | yes Evaluation Count:124606 |
| 396-125002 |
334 | if (!flush()) partially evaluated: !flush() no Evaluation Count:0 | yes Evaluation Count:396 |
| 0-396 |
335 | return -1; never executed: return -1; | 0 |
336 | } executed: } Execution Count:396 | 396 |
337 | | - |
338 | | - |
339 | | - |
340 | if (!buffered || len > QFILE_WRITEBUFFER_SIZE) { evaluated: !buffered yes Evaluation Count:601 | yes Evaluation Count:125002 |
evaluated: len > QFILE_WRITEBUFFER_SIZE yes Evaluation Count:25 | yes Evaluation Count:124977 |
| 25-125002 |
341 | const qint64 ret = d->fileEngine->write(data, len); | - |
342 | if (ret < 0) { partially evaluated: ret < 0 no Evaluation Count:0 | yes Evaluation Count:626 |
| 0-626 |
343 | QFileDevice::FileError err = d->fileEngine->error(); | - |
344 | if (err == QFileDevice::UnspecifiedError) never evaluated: err == QFileDevice::UnspecifiedError | 0 |
345 | err = QFileDevice::WriteError; never executed: err = QFileDevice::WriteError; | 0 |
346 | d->setError(err, d->fileEngine->errorString()); | - |
347 | } | 0 |
348 | return ret; executed: return ret; Execution Count:626 | 626 |
349 | } | - |
350 | | - |
351 | | - |
352 | char *writePointer = d->writeBuffer.reserve(len); | - |
353 | if (len == 1) evaluated: len == 1 yes Evaluation Count:69757 | yes Evaluation Count:55220 |
| 55220-69757 |
354 | *writePointer = *data; executed: *writePointer = *data; Execution Count:69757 | 69757 |
355 | else | - |
356 | ::memcpy(writePointer, data, len); executed: ::memcpy(writePointer, data, len); Execution Count:55220 | 55220 |
357 | return len; executed: return len; Execution Count:124977 | 124977 |
358 | } | - |
359 | QFileDevice::FileError QFileDevice::error() const | - |
360 | { | - |
361 | const QFileDevicePrivate * const d = d_func(); | - |
362 | return d->error; executed: return d->error; Execution Count:6074 | 6074 |
363 | } | - |
364 | | - |
365 | | - |
366 | | - |
367 | | - |
368 | | - |
369 | | - |
370 | void QFileDevice::unsetError() | - |
371 | { | - |
372 | QFileDevicePrivate * const d = d_func(); | - |
373 | d->setError(QFileDevice::NoError); | - |
374 | } executed: } Execution Count:615532 | 615532 |
375 | qint64 QFileDevice::size() const | - |
376 | { | - |
377 | const QFileDevicePrivate * const d = d_func(); | - |
378 | if (!d->ensureFlushed()) partially evaluated: !d->ensureFlushed() no Evaluation Count:0 | yes Evaluation Count:123885 |
| 0-123885 |
379 | return 0; never executed: return 0; | 0 |
380 | d->cachedSize = d->engine()->size(); | - |
381 | return d->cachedSize; executed: return d->cachedSize; Execution Count:123885 | 123885 |
382 | } | - |
383 | bool QFileDevice::resize(qint64 sz) | - |
384 | { | - |
385 | QFileDevicePrivate * const d = d_func(); | - |
386 | if (!d->ensureFlushed()) partially evaluated: !d->ensureFlushed() no Evaluation Count:0 | yes Evaluation Count:773 |
| 0-773 |
387 | return false; never executed: return false; | 0 |
388 | d->engine(); | - |
389 | if (isOpen() && d->fileEngine->pos() > sz) evaluated: isOpen() yes Evaluation Count:768 | yes Evaluation Count:5 |
evaluated: d->fileEngine->pos() > sz yes Evaluation Count:5 | yes Evaluation Count:763 |
| 5-768 |
390 | seek(sz); executed: seek(sz); Execution Count:5 | 5 |
391 | if (d->fileEngine->setSize(sz)) { partially evaluated: d->fileEngine->setSize(sz) yes Evaluation Count:773 | no Evaluation Count:0 |
| 0-773 |
392 | unsetError(); | - |
393 | d->cachedSize = sz; | - |
394 | return true; executed: return true; Execution Count:773 | 773 |
395 | } | - |
396 | d->cachedSize = 0; | - |
397 | d->setError(QFile::ResizeError, d->fileEngine->errorString()); | - |
398 | return false; never executed: return false; | 0 |
399 | } | - |
400 | | - |
401 | | - |
402 | | - |
403 | | - |
404 | | - |
405 | | - |
406 | | - |
407 | QFile::Permissions QFileDevice::permissions() const | - |
408 | { | - |
409 | const QFileDevicePrivate * const d = d_func(); | - |
410 | QAbstractFileEngine::FileFlags perms = d->engine()->fileFlags(QAbstractFileEngine::PermsMask) & QAbstractFileEngine::PermsMask; | - |
411 | return QFile::Permissions((int)perms); executed: return QFile::Permissions((int)perms); Execution Count:226 | 226 |
412 | } | - |
413 | bool QFileDevice::setPermissions(Permissions permissions) | - |
414 | { | - |
415 | QFileDevicePrivate * const d = d_func(); | - |
416 | if (d->engine()->setPermissions(permissions)) { evaluated: d->engine()->setPermissions(permissions) yes Evaluation Count:510 | yes Evaluation Count:5 |
| 5-510 |
417 | unsetError(); | - |
418 | return true; executed: return true; Execution Count:510 | 510 |
419 | } | - |
420 | d->setError(QFile::PermissionsError, d->fileEngine->errorString()); | - |
421 | return false; executed: return false; Execution Count:5 | 5 |
422 | } | - |
423 | uchar *QFileDevice::map(qint64 offset, qint64 size, MemoryMapFlags flags) | - |
424 | { | - |
425 | QFileDevicePrivate * const d = d_func(); | - |
426 | if (d->engine() partially evaluated: d->engine() yes Evaluation Count:33344 | no Evaluation Count:0 |
| 0-33344 |
427 | && d->fileEngine->supportsExtension(QAbstractFileEngine::MapExtension)) { partially evaluated: d->fileEngine->supportsExtension(QAbstractFileEngine::MapExtension) yes Evaluation Count:33344 | no Evaluation Count:0 |
| 0-33344 |
428 | unsetError(); | - |
429 | uchar *address = d->fileEngine->map(offset, size, flags); | - |
430 | if (address == 0) evaluated: address == 0 yes Evaluation Count:24 | yes Evaluation Count:33320 |
| 24-33320 |
431 | d->setError(d->fileEngine->error(), d->fileEngine->errorString()); executed: d->setError(d->fileEngine->error(), d->fileEngine->errorString()); Execution Count:24 | 24 |
432 | return address; executed: return address; Execution Count:33344 | 33344 |
433 | } | - |
434 | return 0; never executed: return 0; | 0 |
435 | } | - |
436 | bool QFileDevice::unmap(uchar *address) | - |
437 | { | - |
438 | QFileDevicePrivate * const d = d_func(); | - |
439 | if (d->engine() partially evaluated: d->engine() yes Evaluation Count:32812 | no Evaluation Count:0 |
| 0-32812 |
440 | && d->fileEngine->supportsExtension(QAbstractFileEngine::UnMapExtension)) { partially evaluated: d->fileEngine->supportsExtension(QAbstractFileEngine::UnMapExtension) yes Evaluation Count:32812 | no Evaluation Count:0 |
| 0-32812 |
441 | unsetError(); | - |
442 | bool success = d->fileEngine->unmap(address); | - |
443 | if (!success) evaluated: !success yes Evaluation Count:8 | yes Evaluation Count:32804 |
| 8-32804 |
444 | d->setError(d->fileEngine->error(), d->fileEngine->errorString()); executed: d->setError(d->fileEngine->error(), d->fileEngine->errorString()); Execution Count:8 | 8 |
445 | return success; executed: return success; Execution Count:32812 | 32812 |
446 | } | - |
447 | d->setError(PermissionsError, tr("No file engine available or engine does not support UnMapExtension")); | - |
448 | return false; never executed: return false; | 0 |
449 | } | - |
450 | | - |
451 | | - |
452 | | - |
| | |