OSDN Git Service

remove redundant QFSFileEnginePrivate::is_sequential member
authorIvailo Monev <xakepa10@gmail.com>
Sat, 26 Dec 2020 01:15:11 +0000 (01:15 +0000)
committerIvailo Monev <xakepa10@gmail.com>
Sat, 26 Dec 2020 02:17:06 +0000 (02:17 +0000)
metadata already caches the flag and upon reset of fd/metdata the
information holded by the member may not be valid, in fact the warning
about not being able to seek on sequential device was printed sometimes
notably on BSD hosts and from the testing so far that is no longer the case

Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
src/core/io/qfsfileengine.cpp
src/core/io/qfsfileengine_p.h

index 9b309f4..08c5dfa 100644 (file)
@@ -77,7 +77,6 @@ QFSFileEnginePrivate::QFSFileEnginePrivate() : QAbstractFileEnginePrivate()
 */
 void QFSFileEnginePrivate::init()
 {
-    is_sequential = 0;
     metaData.clear();
     openMode = QIODevice::NotOpen;
     fd = -1;
@@ -462,13 +461,9 @@ QAbstractFileEngine::Iterator *QFSFileEngine::beginEntryList(QDir::Filters filte
 bool QFSFileEngine::isSequential() const
 {
     Q_D(const QFSFileEngine);
-    if (d->is_sequential == 0) {
-        bool isSequentialFdFh = true;
-        if (d->doStat(QFileSystemMetaData::SequentialType))
-            isSequentialFdFh = d->metaData.isSequential();
-        d->is_sequential = (isSequentialFdFh ? 1 : 2);
-    }
-    return (d->is_sequential == 1);
+    if (d->doStat(QFileSystemMetaData::SequentialType))
+        return d->metaData.isSequential();
+    return true;
 }
 
 /*!
index 9b5b2ce..dc64b63 100644 (file)
@@ -74,8 +74,6 @@ public:
 
     bool closeFileHandle;
 
-    mutable uint is_sequential;
-
     bool doStat(QFileSystemMetaData::MetaDataFlags flags) const;
 
 protected: