From 728c91d7118d45d0e1d8f03c66fa6ea1d8349054 Mon Sep 17 00:00:00 2001 From: Ivailo Monev Date: Sat, 26 Dec 2020 01:15:11 +0000 Subject: [PATCH] remove redundant QFSFileEnginePrivate::is_sequential member 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 --- src/core/io/qfsfileengine.cpp | 11 +++-------- src/core/io/qfsfileengine_p.h | 2 -- 2 files changed, 3 insertions(+), 10 deletions(-) diff --git a/src/core/io/qfsfileengine.cpp b/src/core/io/qfsfileengine.cpp index 9b309f4d9..08c5dfa87 100644 --- a/src/core/io/qfsfileengine.cpp +++ b/src/core/io/qfsfileengine.cpp @@ -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; } /*! diff --git a/src/core/io/qfsfileengine_p.h b/src/core/io/qfsfileengine_p.h index 9b5b2ce91..dc64b6376 100644 --- a/src/core/io/qfsfileengine_p.h +++ b/src/core/io/qfsfileengine_p.h @@ -74,8 +74,6 @@ public: bool closeFileHandle; - mutable uint is_sequential; - bool doStat(QFileSystemMetaData::MetaDataFlags flags) const; protected: -- 2.11.0