Details
-
Bug
-
Resolution: Invalid
-
Not Evaluated
-
None
-
4.6.1, 4.6.2, 4.6.3, 4.7.0, 4.7.1, 4.8.0, 4.8.x, 5.0.0
-
None
-
windows and linux
Description
1. calling ->size() will call flush() implicitly. Should be documented. as well as calling flush() in ->read() and maybe in other places...
but ->map() does not call ensureFlushed(). why ?
2. after unsuccessfull flush(), QFile hang in intermediate state (lastWasWrite has been reset, but data was not actually written. )
inline bool QFilePrivate::ensureFlushed() const { // This function ensures that the write buffer has been flushed (const // because certain const functions need to call it. if (lastWasWrite) { const_cast<QFilePrivate *>(this)->lastWasWrite = false; if (!const_cast<QFile *>(q_func())->flush()) return false; } return true; }
3. At least bug in returning size as zero, beacuse:
qint64 QFile::size() const { Q_D(const QFile); if (!d->ensureFlushed()) return 0; d->cachedSize = fileEngine()->size(); return d->cachedSize; }
maybe more proper is to return -1 ? If yes, please fix documentation about negative return value.