summaryrefslogtreecommitdiffstats
path: root/src/corelib/io
diff options
context:
space:
mode:
authorRitt Konstantin <ritt.ks@gmail.com>2009-08-11 16:11:48 (GMT)
committerJoerg Bornemann <joerg.bornemann@trolltech.com>2009-08-11 16:34:06 (GMT)
commit1693931ac92a6a7d98eb28acda371f2d7c9c6dc2 (patch)
treedca9de8aab50f80f2a30707626f87e0d99a9f25f /src/corelib/io
parent96a578afeaf2ee08db3eeea0f0250e8b08bcf9b6 (diff)
downloadQt-1693931ac92a6a7d98eb28acda371f2d7c9c6dc2.zip
Qt-1693931ac92a6a7d98eb28acda371f2d7c9c6dc2.tar.gz
Qt-1693931ac92a6a7d98eb28acda371f2d7c9c6dc2.tar.bz2
code clean-up and style fixes
remove unused includes; tabs -> whitespaces; clean extra whitespaces Merge-request: 1176 Reviewed-by: Joerg Bornemann <joerg.bornemann@trolltech.com>
Diffstat (limited to 'src/corelib/io')
-rw-r--r--src/corelib/io/qfsfileengine_iterator.cpp1
-rw-r--r--src/corelib/io/qfsfileengine_iterator_p.h2
-rw-r--r--src/corelib/io/qfsfileengine_iterator_unix.cpp2
-rw-r--r--src/corelib/io/qfsfileengine_iterator_win.cpp12
-rw-r--r--src/corelib/io/qfsfileengine_unix.cpp4
-rw-r--r--src/corelib/io/qfsfileengine_win.cpp41
6 files changed, 25 insertions, 37 deletions
diff --git a/src/corelib/io/qfsfileengine_iterator.cpp b/src/corelib/io/qfsfileengine_iterator.cpp
index 35b388f..52fc80d 100644
--- a/src/corelib/io/qfsfileengine_iterator.cpp
+++ b/src/corelib/io/qfsfileengine_iterator.cpp
@@ -79,4 +79,3 @@ QFileInfo QFSFileEngineIterator::currentFileInfo() const
QT_END_NAMESPACE
#endif // QT_NO_FSFILEENGINE
-
diff --git a/src/corelib/io/qfsfileengine_iterator_p.h b/src/corelib/io/qfsfileengine_iterator_p.h
index 7829fff..342ef8d 100644
--- a/src/corelib/io/qfsfileengine_iterator_p.h
+++ b/src/corelib/io/qfsfileengine_iterator_p.h
@@ -89,4 +89,4 @@ QT_END_NAMESPACE
#endif // QT_NO_FSFILEENGINE
-#endif
+#endif // QFSFILEENGINE_ITERATOR_P_H
diff --git a/src/corelib/io/qfsfileengine_iterator_unix.cpp b/src/corelib/io/qfsfileengine_iterator_unix.cpp
index a6c965c..107a500 100644
--- a/src/corelib/io/qfsfileengine_iterator_unix.cpp
+++ b/src/corelib/io/qfsfileengine_iterator_unix.cpp
@@ -56,7 +56,7 @@ public:
#if defined(_POSIX_THREAD_SAFE_FUNCTIONS) && !defined(Q_OS_CYGWIN)
, mt_file(0)
#endif
- { }
+ {}
DIR *dir;
dirent *dirEntry;
diff --git a/src/corelib/io/qfsfileengine_iterator_win.cpp b/src/corelib/io/qfsfileengine_iterator_win.cpp
index dd4ddf3..3d9c20e 100644
--- a/src/corelib/io/qfsfileengine_iterator_win.cpp
+++ b/src/corelib/io/qfsfileengine_iterator_win.cpp
@@ -39,14 +39,11 @@
**
****************************************************************************/
-#include "qdebug.h"
#include "qfsfileengine_iterator_p.h"
#include "qfsfileengine_p.h"
#include "qplatformdefs.h"
#include <QtCore/qvariant.h>
-#include <QtCore/qmutex.h>
-#include <private/qmutexpool_p.h>
QT_BEGIN_NAMESPACE
@@ -56,7 +53,7 @@ public:
inline QFSFileEngineIteratorPlatformSpecificData()
: uncShareIndex(-1), findFileHandle(INVALID_HANDLE_VALUE),
done(false), uncFallback(false)
- { }
+ {}
QFSFileEngineIterator *it;
@@ -68,7 +65,6 @@ public:
bool done;
bool uncFallback;
- void advance();
void saveCurrentFileName();
};
@@ -116,10 +112,10 @@ bool QFSFileEngineIterator::hasNext() const
{
if (platform->done)
return false;
-
+
if (platform->uncFallback)
return platform->uncShareIndex > 0 && platform->uncShareIndex <= platform->uncShares.size();
-
+
if (platform->findFileHandle == INVALID_HANDLE_VALUE) {
QString path = this->path();
// Local directory
@@ -151,7 +147,7 @@ bool QFSFileEngineIterator::hasNext() const
platform->done = true;
}
} else {
- platform->done = true;
+ platform->done = true;
}
}
diff --git a/src/corelib/io/qfsfileengine_unix.cpp b/src/corelib/io/qfsfileengine_unix.cpp
index 50ed46d..7d91764 100644
--- a/src/corelib/io/qfsfileengine_unix.cpp
+++ b/src/corelib/io/qfsfileengine_unix.cpp
@@ -582,7 +582,7 @@ QAbstractFileEngine::FileFlags QFSFileEngine::fileFlags(FileFlags type) const
{
Q_D(const QFSFileEngine);
// Force a stat, so that we're guaranteed to get up-to-date results
- if (type & QAbstractFileEngine::FileFlag(QAbstractFileEngine::Refresh)) {
+ if (type & Refresh) {
d->tried_stat = 0;
d->need_lstat = 1;
}
@@ -777,7 +777,7 @@ QString QFSFileEngine::fileName(FileName file) const
s[len] = '\0';
ret += QFile::decodeName(QByteArray(s));
#if defined(__GLIBC__) && !defined(PATH_MAX)
- ::free(s);
+ ::free(s);
#endif
if (!ret.startsWith(QLatin1Char('/'))) {
diff --git a/src/corelib/io/qfsfileengine_win.cpp b/src/corelib/io/qfsfileengine_win.cpp
index edf65d2..0cddee3 100644
--- a/src/corelib/io/qfsfileengine_win.cpp
+++ b/src/corelib/io/qfsfileengine_win.cpp
@@ -47,10 +47,6 @@
#include "qfile.h"
#include "qdir.h"
-#include "qtemporaryfile.h"
-#ifndef QT_NO_REGEXP
-# include "qregexp.h"
-#endif
#include "private/qmutexpool_p.h"
#include "qvarlengtharray.h"
#include "qdatetime.h"
@@ -125,7 +121,7 @@ static TRUSTEE_W currentUserTrusteeW;
typedef BOOL (WINAPI *PtrOpenProcessToken)(HANDLE, DWORD, PHANDLE );
static PtrOpenProcessToken ptrOpenProcessToken = 0;
-typedef BOOL (WINAPI *PtrGetUserProfileDirectoryW)( HANDLE, LPWSTR, LPDWORD);
+typedef BOOL (WINAPI *PtrGetUserProfileDirectoryW)(HANDLE, LPWSTR, LPDWORD);
static PtrGetUserProfileDirectoryW ptrGetUserProfileDirectoryW = 0;
typedef BOOL (WINAPI *PtrSetFilePointerEx)(HANDLE, LARGE_INTEGER, PLARGE_INTEGER, DWORD);
static PtrSetFilePointerEx ptrSetFilePointerEx = 0;
@@ -266,7 +262,7 @@ bool QFSFileEnginePrivate::uncListSharesOnServer(const QString &server, QStringL
do {
res = ptrNetShareEnum((wchar_t*)server.utf16(), 1, (LPBYTE *)&BufPtr, DWORD(-1), &er, &tr, &resume);
if (res == ERROR_SUCCESS || res == ERROR_MORE_DATA) {
- p=BufPtr;
+ p = BufPtr;
for (i = 1; i <= er; ++i) {
if (list && p->shi1_type == 0)
list->append(QString::fromWCharArray(p->shi1_netname));
@@ -276,7 +272,6 @@ bool QFSFileEnginePrivate::uncListSharesOnServer(const QString &server, QStringL
ptrNetApiBufferFree(BufPtr);
} while (res==ERROR_MORE_DATA);
return res == ERROR_SUCCESS;
-
}
return false;
}
@@ -306,10 +301,11 @@ static inline bool isUncPath(const QString &path)
static inline bool isRelativePath(const QString &path)
{
+ // drive, e.g. "a:", or UNC root, e.q. "//"
return !(path.startsWith(QLatin1Char('/'))
|| (path.length() >= 2
&& ((path.at(0).isLetter() && path.at(1) == QLatin1Char(':'))
- || (path.at(0) == QLatin1Char('/') && path.at(1) == QLatin1Char('/'))))); // drive, e.g. a:
+ || (path.at(0) == QLatin1Char('/') && path.at(1) == QLatin1Char('/')))));
}
static QString fixIfRelativeUncPath(const QString &path)
@@ -328,12 +324,8 @@ static bool uncShareExists(const QString &server)
QStringList parts = server.split(QLatin1Char('\\'), QString::SkipEmptyParts);
if (parts.count()) {
QStringList shares;
- if (QFSFileEnginePrivate::uncListSharesOnServer(QLatin1String("\\\\") + parts.at(0), &shares)) {
- if (parts.count() >= 2)
- return shares.contains(parts.at(1), Qt::CaseInsensitive);
- else
- return true;
- }
+ if (QFSFileEnginePrivate::uncListSharesOnServer(QLatin1String("\\\\") + parts.at(0), &shares))
+ return parts.count() >= 2 ? shares.contains(parts.at(1), Qt::CaseInsensitive) : true;
}
return false;
}
@@ -400,8 +392,8 @@ QString QFSFileEnginePrivate::longFileName(const QString &path)
*/
void QFSFileEnginePrivate::nativeInitFileName()
{
- QString path = longFileName(QDir::toNativeSeparators(fixIfRelativeUncPath(filePath)));
- nativeFilePath = QByteArray((const char *)path.utf16(), path.size() * 2 + 1);
+ QString path = longFileName(QDir::toNativeSeparators(fixIfRelativeUncPath(filePath)));
+ nativeFilePath = QByteArray((const char *)path.utf16(), path.size() * 2 + 1);
}
/*
@@ -423,8 +415,7 @@ bool QFSFileEnginePrivate::nativeOpen(QIODevice::OpenMode openMode)
SECURITY_ATTRIBUTES securityAtts = { sizeof(SECURITY_ATTRIBUTES), NULL, FALSE };
// WriteOnly can create files, ReadOnly cannot.
- DWORD creationDisp = (openMode & QIODevice::WriteOnly)
- ? OPEN_ALWAYS : OPEN_EXISTING;
+ DWORD creationDisp = (openMode & QIODevice::WriteOnly) ? OPEN_ALWAYS : OPEN_EXISTING;
// Create the file handle.
fileHandle = CreateFile((const wchar_t*)nativeFilePath.constData(),
@@ -1145,10 +1136,10 @@ QFileInfoList QFSFileEngine::drives()
char driveName[] = "A:/";
while(driveBits) {
- if(driveBits & 1)
- ret.append(QString::fromLatin1(driveName));
- driveName[0]++;
- driveBits = driveBits >> 1;
+ if(driveBits & 1)
+ ret.append(QString::fromLatin1(driveName));
+ driveName[0]++;
+ driveBits = driveBits >> 1;
}
return ret;
#else
@@ -1501,7 +1492,7 @@ QAbstractFileEngine::FileFlags QFSFileEngine::fileFlags(QAbstractFileEngine::Fil
Q_D(const QFSFileEngine);
QAbstractFileEngine::FileFlags ret = 0;
// Force a stat, so that we're guaranteed to get up-to-date results
- if (type & QAbstractFileEngine::FileFlag(QAbstractFileEngine::Refresh)) {
+ if (type & Refresh) {
d->tried_stat = 0;
}
@@ -1647,10 +1638,11 @@ QString QFSFileEngine::fileName(FileName file) const
bool QFSFileEngine::isRelativePath() const
{
Q_D(const QFSFileEngine);
+ // drive, e.g. "a:", or UNC root, e.q. "//"
return !(d->filePath.startsWith(QLatin1Char('/'))
|| (d->filePath.length() >= 2
&& ((d->filePath.at(0).isLetter() && d->filePath.at(1) == QLatin1Char(':'))
- || (d->filePath.at(0) == QLatin1Char('/') && d->filePath.at(1) == QLatin1Char('/'))))); // drive, e.g. a:
+ || (d->filePath.at(0) == QLatin1Char('/') && d->filePath.at(1) == QLatin1Char('/')))));
}
uint QFSFileEngine::ownerId(FileOwner /*own*/) const
@@ -1966,4 +1958,5 @@ void QFSFileEnginePrivate::mapHandleClose()
}
}
#endif
+
QT_END_NAMESPACE