summaryrefslogtreecommitdiffstats
path: root/src/corelib/io/qdir.cpp
diff options
context:
space:
mode:
authorHarald Fernengel <harald@trolltech.com>2009-08-03 13:12:46 (GMT)
committerHarald Fernengel <harald@trolltech.com>2009-08-03 13:12:46 (GMT)
commit41a83e1ff19ad1396e6001e6b0ac003c701ba55a (patch)
tree609e40eda10418bbf925002c36552074796b96b6 /src/corelib/io/qdir.cpp
parentd1f3b9df2bc5c57d414da73a7d4f9ed7b25df3db (diff)
downloadQt-41a83e1ff19ad1396e6001e6b0ac003c701ba55a.zip
Qt-41a83e1ff19ad1396e6001e6b0ac003c701ba55a.tar.gz
Qt-41a83e1ff19ad1396e6001e6b0ac003c701ba55a.tar.bz2
Squashed commit of the topic/exceptions branch.
Contains some smaller fixes and renaming of macros. Looks big, but isn't scary at all ;)
Diffstat (limited to 'src/corelib/io/qdir.cpp')
-rw-r--r--src/corelib/io/qdir.cpp10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/corelib/io/qdir.cpp b/src/corelib/io/qdir.cpp
index edbe5f0..9787566 100644
--- a/src/corelib/io/qdir.cpp
+++ b/src/corelib/io/qdir.cpp
@@ -86,7 +86,7 @@ class QDirPrivate
QDir *q_ptr;
Q_DECLARE_PUBLIC(QDir)
- friend class QScopedPointer<QDirPrivate>;
+ friend class QScopedPointerDeleter<QDirPrivate>;
protected:
QDirPrivate(QDir*, const QDir *copy=0);
~QDirPrivate();
@@ -288,10 +288,10 @@ inline void QDirPrivate::sortFileList(QDir::SortFlags sort, QFileInfoList &l,
names->append(l.at(i).fileName());
}
} else {
- QDirSortItem *si = new QDirSortItem[n];
+ QScopedArrayPointer<QDirSortItem> si(new QDirSortItem[n]);
for (int i = 0; i < n; ++i)
si[i].item = l.at(i);
- qSort(si, si+n, QDirSortItemComparator(sort));
+ qSort(si.data(), si.data()+n, QDirSortItemComparator(sort));
// put them back in the list(s)
if(infos) {
for (int i = 0; i < n; ++i)
@@ -301,7 +301,6 @@ inline void QDirPrivate::sortFileList(QDir::SortFlags sort, QFileInfoList &l,
for (int i = 0; i < n; ++i)
names->append(si[i].item.fileName());
}
- delete [] si;
}
}
}
@@ -334,8 +333,9 @@ void QDirPrivate::detach(bool createFileEngine)
{
qAtomicDetach(data);
if (createFileEngine) {
+ QAbstractFileEngine *newFileEngine = QAbstractFileEngine::create(data->path);
delete data->fileEngine;
- data->fileEngine = QAbstractFileEngine::create(data->path);
+ data->fileEngine = newFileEngine;
}
}