From f2dce82831706a38cd97225edb2edc0ed2a1520e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Abecasis?= Date: Fri, 17 Jul 2009 15:29:12 +0200 Subject: QDirIterator refactoring done was set no sooner and no later than the file engine iterators stack was emptied (in a single threaded setting, anyway). There is no need to maintain additional state separately. Reviewed-by: Marius Storm-Olsen --- src/corelib/io/qdiriterator.cpp | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/corelib/io/qdiriterator.cpp b/src/corelib/io/qdiriterator.cpp index 51bb98a..0ea7097 100644 --- a/src/corelib/io/qdiriterator.cpp +++ b/src/corelib/io/qdiriterator.cpp @@ -122,7 +122,6 @@ public: QDir::Filters filters; QStringList nameFilters; bool first; - bool done; QDirIterator *q; }; @@ -134,7 +133,7 @@ QDirIteratorPrivate::QDirIteratorPrivate(const QString &path, const QStringList QDir::Filters filters, QDirIterator::IteratorFlags flags) : engine(0), path(path), iteratorFlags(flags), filters(filters), nameFilters(nameFilters), - first(true), done(false) + first(true) { if (QDir::NoFilter == filters) this->filters = QDir::AllEntries; @@ -209,8 +208,8 @@ void QDirIteratorPrivate::advance() if (!foundDirectory) delete fileEngineIterators.pop(); } + currentFileInfo = nextFileInfo; - done = true; } /*! @@ -464,7 +463,7 @@ bool QDirIterator::hasNext() const d->first = false; d->advance(); } - return !d->done; + return !d->fileEngineIterators.isEmpty(); } /*! -- cgit v0.12