summaryrefslogtreecommitdiffstats
path: root/src/corelib/io
diff options
context:
space:
mode:
Diffstat (limited to 'src/corelib/io')
-rw-r--r--src/corelib/io/qdir.cpp6
-rw-r--r--src/corelib/io/qdir.h4
-rw-r--r--src/corelib/io/qdiriterator.cpp6
-rw-r--r--src/corelib/io/qfilesystemwatcher.cpp2
-rw-r--r--src/corelib/io/qfsfileengine.cpp2
-rw-r--r--src/corelib/io/qfsfileengine_p.h4
-rw-r--r--src/corelib/io/qfsfileengine_win.cpp28
-rw-r--r--src/corelib/io/qprocess.cpp6
-rw-r--r--src/corelib/io/qprocess_unix.cpp8
9 files changed, 45 insertions, 21 deletions
diff --git a/src/corelib/io/qdir.cpp b/src/corelib/io/qdir.cpp
index 505889e..1b60936 100644
--- a/src/corelib/io/qdir.cpp
+++ b/src/corelib/io/qdir.cpp
@@ -1079,6 +1079,8 @@ QDir::Filters QDir::filter() const
\value NoSymLinks Do not list symbolic links (ignored by operating
systems that don't support symbolic links).
\value NoDotAndDotDot Do not list the special entries "." and "..".
+ \value NoDot Do not list the special entry ".".
+ \value NoDotDot Do not list the special entry "..".
\value AllEntries List directories, files, drives and symlinks (this does not list
broken symlinks unless you specify System).
\value Readable List files for which the application has read
@@ -2367,7 +2369,9 @@ QDebug operator<<(QDebug debug, QDir::Filters filters)
if (filters & QDir::Files) flags << QLatin1String("Files");
if (filters & QDir::Drives) flags << QLatin1String("Drives");
if (filters & QDir::NoSymLinks) flags << QLatin1String("NoSymLinks");
- if (filters & QDir::NoDotAndDotDot) flags << QLatin1String("NoDotAndDotDot");
+ if (filters & QDir::NoDotAndDotDot) flags << QLatin1String("NoDotAndDotDot"); // ### Qt5: remove (because NoDotAndDotDot=NoDot|NoDotDot)
+ if (filters & QDir::NoDot) flags << QLatin1String("NoDot");
+ if (filters & QDir::NoDotDot) flags << QLatin1String("NoDotDot");
if ((filters & QDir::AllEntries) == QDir::AllEntries) flags << QLatin1String("AllEntries");
if (filters & QDir::Readable) flags << QLatin1String("Readable");
if (filters & QDir::Writable) flags << QLatin1String("Writable");
diff --git a/src/corelib/io/qdir.h b/src/corelib/io/qdir.h
index 186dd2f..28da271 100644
--- a/src/corelib/io/qdir.h
+++ b/src/corelib/io/qdir.h
@@ -88,7 +88,9 @@ public:
AllDirs = 0x400,
CaseSensitive = 0x800,
- NoDotAndDotDot = 0x1000,
+ NoDotAndDotDot = 0x1000, // ### Qt5 NoDotAndDotDot = NoDot|NoDotDot
+ NoDot = 0x2000,
+ NoDotDot = 0x4000,
NoFilter = -1
#ifdef QT3_SUPPORT
diff --git a/src/corelib/io/qdiriterator.cpp b/src/corelib/io/qdiriterator.cpp
index 860fb63..fd4b9c1 100644
--- a/src/corelib/io/qdiriterator.cpp
+++ b/src/corelib/io/qdiriterator.cpp
@@ -287,7 +287,11 @@ bool QDirIteratorPrivate::matchesFilters(const QString &fileName, const QFileInf
const bool dotOrDotDot = fileName[0] == QLatin1Char('.')
&& ((fileNameSize == 1)
||(fileNameSize == 2 && fileName[1] == QLatin1Char('.')));
- if ((filters & QDir::NoDotAndDotDot) && dotOrDotDot)
+ if ((filters & QDir::NoDot) && dotOrDotDot && fileNameSize == 1)
+ return false;
+ if ((filters & QDir::NoDotDot) && dotOrDotDot && fileNameSize == 2)
+ return false;
+ if ((filters & QDir::NoDotAndDotDot) && dotOrDotDot) // ### Qt5 remove (NoDotAndDotDot == NoDot|NoDotDot)
return false;
// name filter
diff --git a/src/corelib/io/qfilesystemwatcher.cpp b/src/corelib/io/qfilesystemwatcher.cpp
index 7223e49..00af3fd 100644
--- a/src/corelib/io/qfilesystemwatcher.cpp
+++ b/src/corelib/io/qfilesystemwatcher.cpp
@@ -248,7 +248,7 @@ QFileSystemWatcherEngine *QFileSystemWatcherPrivate::createNativeEngine()
eng = QDnotifyFileSystemWatcherEngine::create();
return eng;
#elif defined(Q_OS_FREEBSD) || defined(Q_OS_MAC)
-# if defined(Q_OS_MAC) && (MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_5)
+# if 0 && defined(Q_OS_MAC) && (MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_5)
if (QSysInfo::MacintoshVersion >= QSysInfo::MV_10_5)
return QFSEventsFileSystemWatcherEngine::create();
else
diff --git a/src/corelib/io/qfsfileengine.cpp b/src/corelib/io/qfsfileengine.cpp
index 5e14804..a1ffb81 100644
--- a/src/corelib/io/qfsfileengine.cpp
+++ b/src/corelib/io/qfsfileengine.cpp
@@ -126,8 +126,10 @@ void QFSFileEnginePrivate::init()
fileAttrib = INVALID_FILE_ATTRIBUTES;
fileHandle = INVALID_HANDLE_VALUE;
mapHandle = INVALID_HANDLE_VALUE;
+#ifndef Q_OS_WINCE
cachedFd = -1;
#endif
+#endif
}
/*!
diff --git a/src/corelib/io/qfsfileengine_p.h b/src/corelib/io/qfsfileengine_p.h
index 365652a..e9e55f3 100644
--- a/src/corelib/io/qfsfileengine_p.h
+++ b/src/corelib/io/qfsfileengine_p.h
@@ -112,7 +112,11 @@ public:
HANDLE fileHandle;
HANDLE mapHandle;
QHash<uchar *, DWORD /* offset % AllocationGranularity */> maps;
+
+#ifndef Q_OS_WINCE
mutable int cachedFd;
+#endif
+
mutable DWORD fileAttrib;
#else
QHash<uchar *, QPair<int /*offset % PageSize*/, size_t /*length + offset % PageSize*/> > maps;
diff --git a/src/corelib/io/qfsfileengine_win.cpp b/src/corelib/io/qfsfileengine_win.cpp
index 8d34486..eeca07e 100644
--- a/src/corelib/io/qfsfileengine_win.cpp
+++ b/src/corelib/io/qfsfileengine_win.cpp
@@ -450,13 +450,27 @@ bool QFSFileEnginePrivate::nativeClose()
// Windows native mode.
bool ok = true;
+
+#ifndef Q_OS_WINCE
+ if (cachedFd != -1) {
+ if (::_close(cachedFd) && !::CloseHandle(fileHandle)) {
+ q->setError(QFile::UnspecifiedError, qt_error_string());
+ ok = false;
+ }
+
+ // System handle is closed with associated file descriptor.
+ fileHandle = INVALID_HANDLE_VALUE;
+ cachedFd = -1;
+
+ return ok;
+ }
+#endif
+
if ((fileHandle == INVALID_HANDLE_VALUE || !::CloseHandle(fileHandle))) {
q->setError(QFile::UnspecifiedError, qt_error_string());
ok = false;
}
fileHandle = INVALID_HANDLE_VALUE;
- cachedFd = -1; // gets closed by CloseHandle above
-
return ok;
}
@@ -1261,12 +1275,7 @@ static QString readSymLink(const QString &link)
REPARSE_DATA_BUFFER *rdb = (REPARSE_DATA_BUFFER*)qMalloc(bufsize);
DWORD retsize = 0;
if (::DeviceIoControl(handle, FSCTL_GET_REPARSE_POINT, 0, 0, rdb, bufsize, &retsize, 0)) {
- if (rdb->ReparseTag == IO_REPARSE_TAG_MOUNT_POINT) {
- int length = rdb->MountPointReparseBuffer.SubstituteNameLength / sizeof(wchar_t);
- int offset = rdb->MountPointReparseBuffer.SubstituteNameOffset / sizeof(wchar_t);
- const wchar_t* PathBuffer = &rdb->MountPointReparseBuffer.PathBuffer[offset];
- result = QString::fromWCharArray(PathBuffer, length);
- } else {
+ if (rdb->ReparseTag == IO_REPARSE_TAG_SYMLINK) {
int length = rdb->SymbolicLinkReparseBuffer.SubstituteNameLength / sizeof(wchar_t);
int offset = rdb->SymbolicLinkReparseBuffer.SubstituteNameOffset / sizeof(wchar_t);
const wchar_t* PathBuffer = &rdb->SymbolicLinkReparseBuffer.PathBuffer[offset];
@@ -1529,8 +1538,7 @@ bool QFSFileEnginePrivate::isSymlink() const
if (hFind != INVALID_HANDLE_VALUE) {
::FindClose(hFind);
if ((findData.dwFileAttributes & FILE_ATTRIBUTE_REPARSE_POINT)
- && (findData.dwReserved0 == IO_REPARSE_TAG_MOUNT_POINT
- || findData.dwReserved0 == IO_REPARSE_TAG_SYMLINK)) {
+ && findData.dwReserved0 == IO_REPARSE_TAG_SYMLINK) {
is_link = true;
}
}
diff --git a/src/corelib/io/qprocess.cpp b/src/corelib/io/qprocess.cpp
index 12a992a..63c2ab8 100644
--- a/src/corelib/io/qprocess.cpp
+++ b/src/corelib/io/qprocess.cpp
@@ -88,7 +88,7 @@ QT_END_NAMESPACE
#include "qprocess_p.h"
#include <qbytearray.h>
-#include <qdatetime.h>
+#include <qelapsedtimer.h>
#include <qcoreapplication.h>
#include <qsocketnotifier.h>
#include <qtimer.h>
@@ -1639,7 +1639,7 @@ bool QProcess::waitForBytesWritten(int msecs)
if (d->processState == QProcess::NotRunning)
return false;
if (d->processState == QProcess::Starting) {
- QTime stopWatch;
+ QElapsedTimer stopWatch;
stopWatch.start();
bool started = waitForStarted(msecs);
if (!started)
@@ -1676,7 +1676,7 @@ bool QProcess::waitForFinished(int msecs)
if (d->processState == QProcess::NotRunning)
return false;
if (d->processState == QProcess::Starting) {
- QTime stopWatch;
+ QElapsedTimer stopWatch;
stopWatch.start();
bool started = waitForStarted(msecs);
if (!started)
diff --git a/src/corelib/io/qprocess_unix.cpp b/src/corelib/io/qprocess_unix.cpp
index 5119ec0..216c382 100644
--- a/src/corelib/io/qprocess_unix.cpp
+++ b/src/corelib/io/qprocess_unix.cpp
@@ -92,7 +92,6 @@ QT_END_NAMESPACE
#include <private/qcoreapplication_p.h>
#include <private/qthread_p.h>
-#include <qdatetime.h>
#include <qfile.h>
#include <qfileinfo.h>
#include <qlist.h>
@@ -101,6 +100,7 @@ QT_END_NAMESPACE
#include <qsemaphore.h>
#include <qsocketnotifier.h>
#include <qthread.h>
+#include <qelapsedtimer.h>
#include <errno.h>
#include <stdlib.h>
@@ -933,7 +933,7 @@ bool QProcessPrivate::waitForReadyRead(int msecs)
qDebug("QProcessPrivate::waitForReadyRead(%d)", msecs);
#endif
- QTime stopWatch;
+ QElapsedTimer stopWatch;
stopWatch.start();
forever {
@@ -1005,7 +1005,7 @@ bool QProcessPrivate::waitForBytesWritten(int msecs)
qDebug("QProcessPrivate::waitForBytesWritten(%d)", msecs);
#endif
- QTime stopWatch;
+ QElapsedTimer stopWatch;
stopWatch.start();
while (!writeBuffer.isEmpty()) {
@@ -1072,7 +1072,7 @@ bool QProcessPrivate::waitForFinished(int msecs)
qDebug("QProcessPrivate::waitForFinished(%d)", msecs);
#endif
- QTime stopWatch;
+ QElapsedTimer stopWatch;
stopWatch.start();
forever {