summaryrefslogtreecommitdiffstats
path: root/src/corelib/io
diff options
context:
space:
mode:
Diffstat (limited to 'src/corelib/io')
-rw-r--r--src/corelib/io/io.pri6
-rw-r--r--src/corelib/io/qabstractfileengine.cpp4
-rw-r--r--src/corelib/io/qabstractfileengine.h5
-rw-r--r--src/corelib/io/qabstractfileengine_p.h4
-rw-r--r--src/corelib/io/qbuffer.cpp4
-rw-r--r--src/corelib/io/qbuffer.h5
-rw-r--r--src/corelib/io/qdatastream.cpp6
-rw-r--r--src/corelib/io/qdatastream.h7
-rw-r--r--src/corelib/io/qdatastream_p.h4
-rw-r--r--src/corelib/io/qdataurl.cpp4
-rw-r--r--src/corelib/io/qdataurl_p.h4
-rw-r--r--src/corelib/io/qdebug.cpp12
-rw-r--r--src/corelib/io/qdebug.h35
-rw-r--r--src/corelib/io/qdir.cpp42
-rw-r--r--src/corelib/io/qdir.h10
-rw-r--r--src/corelib/io/qdir_p.h4
-rw-r--r--src/corelib/io/qdiriterator.cpp6
-rw-r--r--src/corelib/io/qdiriterator.h5
-rw-r--r--src/corelib/io/qfile.cpp93
-rw-r--r--src/corelib/io/qfile.h11
-rw-r--r--src/corelib/io/qfile_p.h7
-rw-r--r--src/corelib/io/qfileinfo.cpp6
-rw-r--r--src/corelib/io/qfileinfo.h5
-rw-r--r--src/corelib/io/qfileinfo_p.h9
-rw-r--r--src/corelib/io/qfilesystemengine.cpp32
-rw-r--r--src/corelib/io/qfilesystemengine_mac.cpp4
-rw-r--r--src/corelib/io/qfilesystemengine_p.h6
-rw-r--r--src/corelib/io/qfilesystemengine_unix.cpp4
-rw-r--r--src/corelib/io/qfilesystemengine_win.cpp27
-rw-r--r--src/corelib/io/qfilesystementry.cpp24
-rw-r--r--src/corelib/io/qfilesystementry_p.h8
-rw-r--r--src/corelib/io/qfilesystemiterator_p.h14
-rw-r--r--src/corelib/io/qfilesystemiterator_unix.cpp4
-rw-r--r--src/corelib/io/qfilesystemiterator_win.cpp6
-rw-r--r--src/corelib/io/qfilesystemmetadata_p.h55
-rw-r--r--src/corelib/io/qfilesystemwatcher.cpp4
-rw-r--r--src/corelib/io/qfilesystemwatcher.h5
-rw-r--r--src/corelib/io/qfilesystemwatcher_inotify.cpp8
-rw-r--r--src/corelib/io/qfilesystemwatcher_inotify_p.h4
-rw-r--r--src/corelib/io/qfilesystemwatcher_kqueue.cpp4
-rw-r--r--src/corelib/io/qfilesystemwatcher_kqueue_p.h4
-rw-r--r--src/corelib/io/qfilesystemwatcher_p.h4
-rw-r--r--src/corelib/io/qfilesystemwatcher_polling.cpp4
-rw-r--r--src/corelib/io/qfilesystemwatcher_polling_p.h4
-rw-r--r--src/corelib/io/qfilesystemwatcher_win.cpp11
-rw-r--r--src/corelib/io/qfilesystemwatcher_win_p.h19
-rw-r--r--src/corelib/io/qfsfileengine.cpp28
-rw-r--r--src/corelib/io/qfsfileengine.h11
-rw-r--r--src/corelib/io/qfsfileengine_iterator.cpp4
-rw-r--r--src/corelib/io/qfsfileengine_iterator_p.h4
-rw-r--r--src/corelib/io/qfsfileengine_p.h33
-rw-r--r--src/corelib/io/qfsfileengine_unix.cpp365
-rw-r--r--src/corelib/io/qfsfileengine_win.cpp6
-rw-r--r--src/corelib/io/qiodevice.cpp19
-rw-r--r--src/corelib/io/qiodevice.h5
-rw-r--r--src/corelib/io/qiodevice_p.h4
-rw-r--r--src/corelib/io/qnoncontiguousbytedevice.cpp4
-rw-r--r--src/corelib/io/qnoncontiguousbytedevice_p.h4
-rw-r--r--src/corelib/io/qprocess.cpp88
-rw-r--r--src/corelib/io/qprocess.h9
-rw-r--r--src/corelib/io/qprocess_p.h22
-rw-r--r--src/corelib/io/qprocess_unix.cpp22
-rw-r--r--src/corelib/io/qprocess_win.cpp217
-rw-r--r--src/corelib/io/qprocess_wince.cpp9
-rw-r--r--src/corelib/io/qresource.cpp6
-rw-r--r--src/corelib/io/qresource.h5
-rw-r--r--src/corelib/io/qresource_iterator.cpp4
-rw-r--r--src/corelib/io/qresource_iterator_p.h4
-rw-r--r--src/corelib/io/qresource_p.h4
-rw-r--r--src/corelib/io/qsettings.cpp32
-rw-r--r--src/corelib/io/qsettings.h5
-rw-r--r--src/corelib/io/qsettings_mac.cpp4
-rw-r--r--src/corelib/io/qsettings_p.h8
-rw-r--r--src/corelib/io/qsettings_win.cpp6
-rw-r--r--src/corelib/io/qstandardpaths.cpp12
-rw-r--r--src/corelib/io/qstandardpaths.h5
-rw-r--r--src/corelib/io/qstandardpaths_mac.cpp4
-rw-r--r--src/corelib/io/qstandardpaths_unix.cpp6
-rw-r--r--src/corelib/io/qstandardpaths_win.cpp8
-rw-r--r--src/corelib/io/qtemporarydir.cpp62
-rw-r--r--src/corelib/io/qtemporarydir.h5
-rw-r--r--src/corelib/io/qtemporaryfile.cpp40
-rw-r--r--src/corelib/io/qtemporaryfile.h5
-rw-r--r--src/corelib/io/qtextstream.cpp28
-rw-r--r--src/corelib/io/qtextstream.h8
-rw-r--r--src/corelib/io/qtldurl.cpp4
-rw-r--r--src/corelib/io/qtldurl_p.h4
-rw-r--r--src/corelib/io/qurl.cpp200
-rw-r--r--src/corelib/io/qurl.h34
-rw-r--r--src/corelib/io/qwindowspipereader.cpp167
-rw-r--r--src/corelib/io/qwindowspipereader_p.h20
-rw-r--r--src/corelib/io/qwindowspipewriter.cpp4
-rw-r--r--src/corelib/io/qwindowspipewriter_p.h5
-rw-r--r--src/corelib/io/qwinoverlappedionotifier.cpp228
-rw-r--r--src/corelib/io/qwinoverlappedionotifier_p.h101
95 files changed, 1063 insertions, 1372 deletions
diff --git a/src/corelib/io/io.pri b/src/corelib/io/io.pri
index 1d31e5d794..e8a41b2d76 100644
--- a/src/corelib/io/io.pri
+++ b/src/corelib/io/io.pri
@@ -87,7 +87,11 @@ win32 {
wince* {
SOURCES += io/qprocess_wince.cpp
} else {
- SOURCES += io/qprocess_win.cpp
+ HEADERS += \
+ io/qwinoverlappedionotifier_p.h
+ SOURCES += \
+ io/qprocess_win.cpp \
+ io/qwinoverlappedionotifier.cpp
}
} else:unix|integrity {
SOURCES += \
diff --git a/src/corelib/io/qabstractfileengine.cpp b/src/corelib/io/qabstractfileengine.cpp
index c315d33606..fb18809e48 100644
--- a/src/corelib/io/qabstractfileengine.cpp
+++ b/src/corelib/io/qabstractfileengine.cpp
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtCore module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/corelib/io/qabstractfileengine.h b/src/corelib/io/qabstractfileengine.h
index c9bab7d435..6ea5a2b94e 100644
--- a/src/corelib/io/qabstractfileengine.h
+++ b/src/corelib/io/qabstractfileengine.h
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtCore module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -52,7 +52,6 @@ QT_BEGIN_HEADER
QT_BEGIN_NAMESPACE
-QT_MODULE(Core)
class QFileExtension;
class QFileExtensionResult;
diff --git a/src/corelib/io/qabstractfileengine_p.h b/src/corelib/io/qabstractfileengine_p.h
index 72b8339e39..08bb7fb097 100644
--- a/src/corelib/io/qabstractfileengine_p.h
+++ b/src/corelib/io/qabstractfileengine_p.h
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtCore module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/corelib/io/qbuffer.cpp b/src/corelib/io/qbuffer.cpp
index a5e605b9d5..dfc85a434d 100644
--- a/src/corelib/io/qbuffer.cpp
+++ b/src/corelib/io/qbuffer.cpp
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtCore module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/corelib/io/qbuffer.h b/src/corelib/io/qbuffer.h
index b222c7d6ca..8b42363f24 100644
--- a/src/corelib/io/qbuffer.h
+++ b/src/corelib/io/qbuffer.h
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtCore module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -49,7 +49,6 @@ QT_BEGIN_HEADER
QT_BEGIN_NAMESPACE
-QT_MODULE(Core)
class QObject;
class QBufferPrivate;
diff --git a/src/corelib/io/qdatastream.cpp b/src/corelib/io/qdatastream.cpp
index fb2528e45f..7920d881b4 100644
--- a/src/corelib/io/qdatastream.cpp
+++ b/src/corelib/io/qdatastream.cpp
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtCore module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -250,7 +250,7 @@ QT_BEGIN_NAMESPACE
return retVal;
enum {
- DefaultStreamVersion = QDataStream::Qt_4_6
+ DefaultStreamVersion = QDataStream::Qt_5_0
};
// ### 5.0: when streaming invalid QVariants, just the type should
diff --git a/src/corelib/io/qdatastream.h b/src/corelib/io/qdatastream.h
index 30cf8417ad..752246a543 100644
--- a/src/corelib/io/qdatastream.h
+++ b/src/corelib/io/qdatastream.h
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtCore module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -54,7 +54,6 @@ QT_BEGIN_HEADER
QT_BEGIN_NAMESPACE
-QT_MODULE(Core)
class QByteArray;
class QIODevice;
@@ -88,7 +87,7 @@ public:
Qt_4_7 = Qt_4_6,
Qt_4_8 = Qt_4_7,
Qt_4_9 = Qt_4_8,
- Qt_5_0 = Qt_4_8
+ Qt_5_0 = 13
#if QT_VERSION >= 0x050100
#error Add the datastream version for this Qt version
#endif
diff --git a/src/corelib/io/qdatastream_p.h b/src/corelib/io/qdatastream_p.h
index 2501e98d1d..e4ac0e45c2 100644
--- a/src/corelib/io/qdatastream_p.h
+++ b/src/corelib/io/qdatastream_p.h
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtCore module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/corelib/io/qdataurl.cpp b/src/corelib/io/qdataurl.cpp
index 7e856ad647..8002f10889 100644
--- a/src/corelib/io/qdataurl.cpp
+++ b/src/corelib/io/qdataurl.cpp
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtCore module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/corelib/io/qdataurl_p.h b/src/corelib/io/qdataurl_p.h
index b92f363e1d..66b3e74418 100644
--- a/src/corelib/io/qdataurl_p.h
+++ b/src/corelib/io/qdataurl_p.h
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtCore module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/corelib/io/qdebug.cpp b/src/corelib/io/qdebug.cpp
index 8ca15b19ca..6726537842 100644
--- a/src/corelib/io/qdebug.cpp
+++ b/src/corelib/io/qdebug.cpp
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtCore module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -165,14 +165,6 @@
*/
/*!
- \fn QDebug &QDebug::operator<<(QBool t)
- \internal
-
- Writes the boolean value, \a t, to the stream and returns a reference to the
- stream.
-*/
-
-/*!
\fn QDebug &QDebug::operator<<(bool t)
Writes the boolean value, \a t, to the stream and returns a reference to the
diff --git a/src/corelib/io/qdebug.h b/src/corelib/io/qdebug.h
index 54663d5d65..48a382eea6 100644
--- a/src/corelib/io/qdebug.h
+++ b/src/corelib/io/qdebug.h
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtCore module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -57,10 +57,10 @@ QT_BEGIN_HEADER
QT_BEGIN_NAMESPACE
-QT_MODULE(Core)
class Q_CORE_EXPORT QDebug
{
+ friend class QMessageLogger;
struct Stream {
Stream(QIODevice *device) : ts(device), ref(1), type(QtDebugMsg), space(true), message_output(false) {}
Stream(QString *string) : ts(string, QIODevice::WriteOnly), ref(1), type(QtDebugMsg), space(true), message_output(false) {}
@@ -71,6 +71,7 @@ class Q_CORE_EXPORT QDebug
QtMsgType type;
bool space;
bool message_output;
+ QMessageLogContext context;
} *stream;
public:
inline QDebug(QIODevice *device) : stream(new Stream(device)) {}
@@ -82,7 +83,9 @@ public:
if (!--stream->ref) {
if(stream->message_output) {
QT_TRY {
- qt_message_output(stream->type, stream->buffer.toLocal8Bit().data());
+ qt_message_output(stream->type,
+ stream->context,
+ stream->buffer.toLocal8Bit().data());
} QT_CATCH(std::bad_alloc&) { /* We're out of memory - give up. */ }
}
delete stream;
@@ -93,7 +96,6 @@ public:
inline QDebug &maybeSpace() { if (stream->space) stream->ts << ' '; return *this; }
inline QDebug &operator<<(QChar t) { stream->ts << '\'' << t << '\''; return maybeSpace(); }
- inline QDebug &operator<<(QBool t) { stream->ts << (bool(t != 0) ? "true" : "false"); return maybeSpace(); }
inline QDebug &operator<<(bool t) { stream->ts << (t ? "true" : "false"); return maybeSpace(); }
inline QDebug &operator<<(char t) { stream->ts << t; return maybeSpace(); }
inline QDebug &operator<<(signed short t) { stream->ts << t; return maybeSpace(); }
@@ -111,7 +113,7 @@ public:
inline QDebug &operator<<(const char* t) { stream->ts << QString::fromAscii(t); return maybeSpace(); }
inline QDebug &operator<<(const QString & t) { stream->ts << '\"' << t << '\"'; return maybeSpace(); }
inline QDebug &operator<<(const QStringRef & t) { return operator<<(t.toString()); }
- inline QDebug &operator<<(const QLatin1String &t) { stream->ts << '\"' << t.latin1() << '\"'; return maybeSpace(); }
+ inline QDebug &operator<<(const QLatin1String &t) { stream->ts << '\"' << t << '\"'; return maybeSpace(); }
inline QDebug &operator<<(const QByteArray & t) { stream->ts << '\"' << t << '\"'; return maybeSpace(); }
inline QDebug &operator<<(const void * t) { stream->ts << t; return maybeSpace(); }
inline QDebug &operator<<(QTextStreamFunction f) {
@@ -271,27 +273,6 @@ inline QDebug operator<<(QDebug debug, const QFlags<T> &flags)
return debug.space();
}
-#if !defined(QT_NO_DEBUG_OUTPUT) && !defined(QT_NO_DEBUG_STREAM)
-Q_CORE_EXPORT_INLINE QDebug qDebug() { return QDebug(QtDebugMsg); }
-#else
-#undef qDebug
-inline QNoDebug qDebug() { return QNoDebug(); }
-#define qDebug QT_NO_QDEBUG_MACRO
-#endif
-
-#if !defined(QT_NO_WARNING_OUTPUT) && !defined(QT_NO_DEBUG_STREAM)
-Q_CORE_EXPORT_INLINE QDebug qWarning() { return QDebug(QtWarningMsg); }
-#else
-#undef qWarning
-inline QNoDebug qWarning() { return QNoDebug(); }
-#define qWarning QT_NO_QWARNING_MACRO
-#endif
-
-#if !defined(QT_NO_DEBUG_STREAM)
-Q_CORE_EXPORT_INLINE QDebug qCritical() { return QDebug(QtCriticalMsg); }
-#endif
-
-
QT_END_NAMESPACE
QT_END_HEADER
diff --git a/src/corelib/io/qdir.cpp b/src/corelib/io/qdir.cpp
index d6979bad57..afd6620e65 100644
--- a/src/corelib/io/qdir.cpp
+++ b/src/corelib/io/qdir.cpp
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtCore module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -70,7 +70,7 @@ QT_BEGIN_NAMESPACE
static QString driveSpec(const QString &path)
{
-#if defined(Q_OS_WIN) || defined(Q_OS_SYMBIAN)
+#if defined(Q_OS_WIN)
if (path.size() < 2)
return QString();
char c = path.at(0).toAscii();
@@ -162,7 +162,7 @@ inline void QDirPrivate::setPath(const QString &path)
QString p = QDir::fromNativeSeparators(path);
if (p.endsWith(QLatin1Char('/'))
&& p.length() > 1
-#if defined(Q_OS_WIN) || defined(Q_OS_SYMBIAN)
+#if defined(Q_OS_WIN)
&& (!(p.length() == 3 && p.at(1).unicode() == ':' && p.at(0).isLetter()))
#endif
) {
@@ -736,8 +736,6 @@ QString QDir::relativeFilePath(const QString &fileName) const
if (fileDrive.toLower() != dirDrive.toLower()
|| (file.startsWith(QLatin1String("//"))
&& !dir.startsWith(QLatin1String("//"))))
-#elif defined(Q_OS_SYMBIAN)
- if (fileDrive.toLower() != dirDrive.toLower())
#else
if (fileDrive != dirDrive)
#endif
@@ -753,7 +751,7 @@ QString QDir::relativeFilePath(const QString &fileName) const
int i = 0;
while (i < dirElts.size() && i < fileElts.size() &&
-#if defined(Q_OS_WIN) || defined(Q_OS_SYMBIAN)
+#if defined(Q_OS_WIN)
dirElts.at(i).toLower() == fileElts.at(i).toLower())
#else
dirElts.at(i) == fileElts.at(i))
@@ -772,18 +770,6 @@ QString QDir::relativeFilePath(const QString &fileName) const
return result;
}
-#ifndef QT_NO_DEPRECATED
-/*!
- \obsolete
-
- Use QDir::toNativeSeparators() instead.
-*/
-QString QDir::convertSeparators(const QString &pathName)
-{
- return toNativeSeparators(pathName);
-}
-#endif
-
/*!
\since 4.2
@@ -801,7 +787,7 @@ QString QDir::convertSeparators(const QString &pathName)
*/
QString QDir::toNativeSeparators(const QString &pathName)
{
-#if defined(Q_OS_WIN) || defined(Q_OS_SYMBIAN)
+#if defined(Q_OS_WIN)
int i = pathName.indexOf(QLatin1Char('/'));
if (i != -1) {
QString n(pathName);
@@ -834,7 +820,7 @@ QString QDir::toNativeSeparators(const QString &pathName)
*/
QString QDir::fromNativeSeparators(const QString &pathName)
{
-#if defined(Q_OS_WIN) || defined(Q_OS_SYMBIAN)
+#if defined(Q_OS_WIN)
int i = pathName.indexOf(QLatin1Char('\\'));
if (i != -1) {
QString n(pathName);
@@ -1375,7 +1361,6 @@ QFileInfoList QDir::entryInfoList(const QStringList &nameFilters, Filters filter
\sa rmdir()
*/
-// ### Qt5: behaviour when directory already exists should be made consistent for mkdir and mkpath
bool QDir::mkdir(const QString &dirName) const
{
const QDirPrivate* d = d_ptr.constData();
@@ -1428,7 +1413,6 @@ bool QDir::rmdir(const QString &dirName) const
\sa rmpath()
*/
-// ### Qt5: behaviour when directory already exists should be made consistent for mkdir and mkpath
bool QDir::mkpath(const QString &dirPath) const
{
const QDirPrivate* d = d_ptr.constData();
@@ -1816,7 +1800,7 @@ QFileInfoList QDir::drives()
*/
QChar QDir::separator()
{
-#if defined(Q_OS_WIN) || defined(Q_OS_SYMBIAN)
+#if defined(Q_OS_WIN)
return QLatin1Char('\\');
#else
return QLatin1Char('/');
@@ -1896,7 +1880,7 @@ QString QDir::currentPath()
Under non-Windows operating systems the \c HOME environment
variable is used if it exists, otherwise the path returned by the
- rootPath(). On Symbian always the same as the path returned by the rootPath().
+ rootPath().
\sa home(), currentPath(), rootPath(), tempPath()
*/
@@ -1951,8 +1935,7 @@ QString QDir::tempPath()
Returns the absolute path of the root directory.
For Unix operating systems this returns "/". For Windows file
- systems this normally returns "c:/". On Symbian this typically returns
- "c:/data", i.e. the same as native PathInfo::PhoneMemoryRootPath().
+ systems this normally returns "c:/".
\sa root(), drives(), currentPath(), homePath(), tempPath()
*/
@@ -2084,7 +2067,7 @@ QString QDir::cleanPath(const QString &path)
levels++;
}
} else if (last != -1 && iwrite - last == 1) {
-#if defined(Q_OS_WIN) || defined(Q_OS_SYMBIAN)
+#if defined(Q_OS_WIN)
eaten = (iwrite > 2);
#else
eaten = true;
@@ -2119,7 +2102,7 @@ QString QDir::cleanPath(const QString &path)
QString ret = (used == len ? name : QString(out, used));
// Strip away last slash except for root directories
if (ret.length() > 1 && ret.endsWith(QLatin1Char('/'))) {
-#if defined (Q_OS_WIN) || defined (Q_OS_SYMBIAN)
+#if defined (Q_OS_WIN)
if (!(ret.length() == 3 && ret.at(1) == QLatin1Char(':')))
#endif
ret.chop(1);
@@ -2234,7 +2217,6 @@ 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"); // ### 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");
diff --git a/src/corelib/io/qdir.h b/src/corelib/io/qdir.h
index 5b058272e7..5551ecd2fb 100644
--- a/src/corelib/io/qdir.h
+++ b/src/corelib/io/qdir.h
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtCore module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -51,7 +51,6 @@ QT_BEGIN_HEADER
QT_BEGIN_NAMESPACE
-QT_MODULE(Core)
class QDirPrivate;
@@ -78,9 +77,9 @@ public:
AllDirs = 0x400,
CaseSensitive = 0x800,
- NoDotAndDotDot = 0x1000, // ### Qt5 NoDotAndDotDot = NoDot|NoDotDot
NoDot = 0x2000,
NoDotDot = 0x4000,
+ NoDotAndDotDot = NoDot | NoDotDot,
NoFilter = -1
};
@@ -131,9 +130,6 @@ public:
QString absoluteFilePath(const QString &fileName) const;
QString relativeFilePath(const QString &fileName) const;
-#ifdef QT_DEPRECATED
- QT_DEPRECATED static QString convertSeparators(const QString &pathName);
-#endif
static QString toNativeSeparators(const QString &pathName);
static QString fromNativeSeparators(const QString &pathName);
diff --git a/src/corelib/io/qdir_p.h b/src/corelib/io/qdir_p.h
index 7865c1d5a3..9fe93cefa0 100644
--- a/src/corelib/io/qdir_p.h
+++ b/src/corelib/io/qdir_p.h
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtCore module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/corelib/io/qdiriterator.cpp b/src/corelib/io/qdiriterator.cpp
index 28aa4a0f59..c5f24071aa 100644
--- a/src/corelib/io/qdiriterator.cpp
+++ b/src/corelib/io/qdiriterator.cpp
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtCore module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -330,8 +330,6 @@ bool QDirIteratorPrivate::matchesFilters(const QString &fileName, const QFileInf
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
#ifndef QT_NO_REGEXP
diff --git a/src/corelib/io/qdiriterator.h b/src/corelib/io/qdiriterator.h
index be03415372..27189e2efd 100644
--- a/src/corelib/io/qdiriterator.h
+++ b/src/corelib/io/qdiriterator.h
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtCore module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -48,7 +48,6 @@ QT_BEGIN_HEADER
QT_BEGIN_NAMESPACE
-QT_MODULE(Core)
class QDirIteratorPrivate;
class Q_CORE_EXPORT QDirIterator {
diff --git a/src/corelib/io/qfile.cpp b/src/corelib/io/qfile.cpp
index 95d842da42..d7308c710d 100644
--- a/src/corelib/io/qfile.cpp
+++ b/src/corelib/io/qfile.cpp
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtCore module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -66,8 +66,6 @@ static QByteArray locale_encode(const QString &f)
#if defined(Q_OS_DARWIN)
// Mac always expects UTF-8... and decomposed...
return f.normalized(QString::NormalizationForm_D).toUtf8();
-#elif defined(Q_OS_SYMBIAN)
- return f.toUtf8();
#else
return f.toLocal8Bit();
#endif
@@ -78,8 +76,6 @@ static QString locale_decode(const QByteArray &f)
#if defined(Q_OS_DARWIN)
// Mac always gives us UTF-8 and decomposed, we want that composed...
return QString::fromUtf8(f).normalized(QString::NormalizationForm_C);
-#elif defined(Q_OS_SYMBIAN)
- return QString::fromUtf8(f);
#else
return QString::fromLocal8Bit(f);
#endif
@@ -134,23 +130,6 @@ QFilePrivate::openExternalFile(int flags, FILE *fh, QFile::FileHandleFlags handl
#endif
}
-#ifdef Q_OS_SYMBIAN
-bool QFilePrivate::openExternalFile(int flags, const RFile &f, QFile::FileHandleFlags handleFlags)
-{
-#ifdef QT_NO_FSFILEENGINE
- Q_UNUSED(flags);
- Q_UNUSED(fh);
- return false;
-#else
- delete fileEngine;
- fileEngine = 0;
- QFSFileEngine *fe = new QFSFileEngine;
- fileEngine = fe;
- return fe->open(QIODevice::OpenMode(flags), f, handleFlags);
-#endif
-}
-#endif
-
inline bool QFilePrivate::ensureFlushed() const
{
// This function ensures that the write buffer has been flushed (const
@@ -815,9 +794,6 @@ QFile::rename(const QString &oldName, const QString &newName)
\note To create a valid link on Windows, \a linkName must have a \c{.lnk} file extension.
- \note On Symbian, no link is created and false is returned if fileName()
- currently specifies a directory.
-
\sa setFileName()
*/
@@ -1019,14 +995,8 @@ bool QFile::open(OpenMode mode)
return false;
}
-#ifdef Q_OS_SYMBIAN
- // For symbian, the unbuffered flag is used to control write-behind cache behaviour
- if (fileEngine()->open(mode))
-#else
// QIODevice provides the buffering, so there's no need to request it from the file engine.
- if (fileEngine()->open(mode | QIODevice::Unbuffered))
-#endif
- {
+ if (fileEngine()->open(mode | QIODevice::Unbuffered)) {
QIODevice::open(mode);
if (mode & Append)
seek(size());
@@ -1247,63 +1217,6 @@ bool QFile::open(int fd, OpenMode mode, FileHandleFlags handleFlags)
return false;
}
-#ifdef Q_OS_SYMBIAN
-/*!
- \overload
-
- Opens the existing file object \a f in the given \a mode.
- Returns true if successful; otherwise returns false.
-
- When a QFile is opened using this function, behaviour of close() is
- controlled by the AutoCloseHandle flag.
- If AutoCloseHandle is specified, and this function succeeds,
- then calling close() closes the adopted handle.
- Otherwise, close() does not actually close the file, but only flushes it.
-
- \warning If the file handle is adopted from another process,
- you may not be able to use this QFile with a QFileInfo.
-
- \sa close()
-*/
-bool QFile::open(const RFile &f, OpenMode mode, FileHandleFlags handleFlags)
-{
- Q_D(QFile);
- if (isOpen()) {
- qWarning("QFile::open: File (%s) already open", qPrintable(fileName()));
- return false;
- }
- if (mode & Append)
- mode |= WriteOnly;
- unsetError();
- if ((mode & (ReadOnly | WriteOnly)) == 0) {
- qWarning("QFile::open: File access not specified");
- return false;
- }
- if (d->openExternalFile(mode, f, handleFlags)) {
- bool ok = QIODevice::open(mode);
- if (ok) {
- if (mode & Append) {
- ok = seek(size());
- } else {
- qint64 pos = 0;
- TInt err;
-#ifdef SYMBIAN_ENABLE_64_BIT_FILE_SERVER_API
- err = static_cast<const RFile64&>(f).Seek(ESeekCurrent, pos);
-#else
- TInt pos32 = 0;
- err = f.Seek(ESeekCurrent, pos32);
- pos = pos32;
-#endif
- ok = ok && (err == KErrNone);
- ok = ok && seek(pos);
- }
- }
- return ok;
- }
- return false;
-}
-#endif
-
/*!
Returns the file handle of the file.
diff --git a/src/corelib/io/qfile.h b/src/corelib/io/qfile.h
index 903ba13963..bc278cf600 100644
--- a/src/corelib/io/qfile.h
+++ b/src/corelib/io/qfile.h
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtCore module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -45,9 +45,6 @@
#include <QtCore/qiodevice.h>
#include <QtCore/qstring.h>
#include <stdio.h>
-#ifdef Q_OS_SYMBIAN
-#include <f32file.h>
-#endif
#ifdef open
#error qfile.h must be included before any header file that defines open
@@ -57,7 +54,6 @@ QT_BEGIN_HEADER
QT_BEGIN_NAMESPACE
-QT_MODULE(Core)
class QAbstractFileEngine;
class QFilePrivate;
@@ -151,9 +147,6 @@ public:
bool open(OpenMode flags);
bool open(FILE *f, OpenMode flags);
bool open(int fd, OpenMode flags);
-#ifdef Q_OS_SYMBIAN
- bool open(const RFile &f, OpenMode flags, FileHandleFlags handleFlags = DontCloseHandle);
-#endif
bool open(FILE *f, OpenMode ioFlags, FileHandleFlags handleFlags);
bool open(int fd, OpenMode ioFlags, FileHandleFlags handleFlags);
virtual void close();
diff --git a/src/corelib/io/qfile_p.h b/src/corelib/io/qfile_p.h
index 24013c3c3d..b932627ec0 100644
--- a/src/corelib/io/qfile_p.h
+++ b/src/corelib/io/qfile_p.h
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtCore module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -69,9 +69,6 @@ protected:
bool openExternalFile(int flags, int fd, QFile::FileHandleFlags handleFlags);
bool openExternalFile(int flags, FILE *fh, QFile::FileHandleFlags handleFlags);
-#ifdef Q_OS_SYMBIAN
- bool openExternalFile(int flags, const RFile& f, QFile::FileHandleFlags handleFlags);
-#endif
QString fileName;
mutable QAbstractFileEngine *fileEngine;
diff --git a/src/corelib/io/qfileinfo.cpp b/src/corelib/io/qfileinfo.cpp
index 226b5d3560..7277a7a0e4 100644
--- a/src/corelib/io/qfileinfo.cpp
+++ b/src/corelib/io/qfileinfo.cpp
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtCore module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -1019,7 +1019,7 @@ bool QFileInfo::isRoot() const
return true;
if (d->fileEngine == 0) {
if (d->fileEntry.isRoot()) {
-#if defined(Q_OS_WIN) || defined(Q_OS_SYMBIAN)
+#if defined(Q_OS_WIN)
//the path is a drive root, but the drive may not exist
//for backward compatibility, return true only if the drive exists
if (!d->cache_enabled || !d->metaData.hasFlags(QFileSystemMetaData::ExistsAttribute))
diff --git a/src/corelib/io/qfileinfo.h b/src/corelib/io/qfileinfo.h
index 6d6da3527a..bc9b057fb5 100644
--- a/src/corelib/io/qfileinfo.h
+++ b/src/corelib/io/qfileinfo.h
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtCore module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -50,7 +50,6 @@ QT_BEGIN_HEADER
QT_BEGIN_NAMESPACE
-QT_MODULE(Core)
class QDir;
class QDirIteratorPrivate;
diff --git a/src/corelib/io/qfileinfo_p.h b/src/corelib/io/qfileinfo_p.h
index 64e644f29f..aa1d88665c 100644
--- a/src/corelib/io/qfileinfo_p.h
+++ b/src/corelib/io/qfileinfo_p.h
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtCore module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -108,10 +108,15 @@ public:
: QSharedData(),
fileEntry(file),
metaData(data),
+ fileEngine(QFileSystemEngine::resolveEntryAndCreateLegacyEngine(fileEntry, metaData)),
cachedFlags(0),
isDefaultConstructed(false),
cache_enabled(true), fileFlags(0), fileSize(0)
{
+ //If the file engine is not null, this maybe a "mount point" for a custom file engine
+ //in which case we can't trust the metadata
+ if (fileEngine)
+ metaData = QFileSystemMetaData();
}
inline void clearFlags() const {
diff --git a/src/corelib/io/qfilesystemengine.cpp b/src/corelib/io/qfilesystemengine.cpp
index ab10f30585..21436c1cfc 100644
--- a/src/corelib/io/qfilesystemengine.cpp
+++ b/src/corelib/io/qfilesystemengine.cpp
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtCore module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -84,15 +84,7 @@ QString QFileSystemEngine::slowCanonicalized(const QString &path)
#endif
separatorPos = tmpPath.indexOf(slash, separatorPos + 1);
QString prefix = separatorPos == -1 ? tmpPath : tmpPath.left(separatorPos);
- if (
-#ifdef Q_OS_SYMBIAN
- // Symbian doesn't support directory symlinks, so do not check for link unless we
- // are handling the last path element. This not only slightly improves performance,
- // but also saves us from lot of unnecessary platform security check failures
- // when dealing with files under *:/private directories.
- separatorPos == -1 &&
-#endif
- !nonSymlinks.contains(prefix)) {
+ if (!nonSymlinks.contains(prefix)) {
fi.setFile(prefix);
if (fi.isSymLink()) {
QString target = fi.symLinkTarget();
@@ -276,20 +268,16 @@ void QFileSystemMetaData::fillFromStatBuf(const QT_STATBUF &statBuffer)
#endif
// Times
-#ifdef Q_OS_SYMBIAN
- modificationTime_ = qt_symbian_time_t_To_TTime(statBuffer.st_mtime);
-#else
creationTime_ = statBuffer.st_ctime ? statBuffer.st_ctime : statBuffer.st_mtime;
modificationTime_ = statBuffer.st_mtime;
accessTime_ = statBuffer.st_atime;
userId_ = statBuffer.st_uid;
groupId_ = statBuffer.st_gid;
-#endif
}
void QFileSystemMetaData::fillFromDirEnt(const QT_DIRENT &entry)
{
-#if defined(_DIRENT_HAVE_D_TYPE) || defined(Q_OS_BSD4) || defined(Q_OS_SYMBIAN)
+#if defined(_DIRENT_HAVE_D_TYPE) || defined(Q_OS_BSD4)
// BSD4 includes Mac OS X
// ### This will clear all entry flags and knownFlagsMask
@@ -357,11 +345,7 @@ void QFileSystemMetaData::fillFromDirEnt(const QT_DIRENT &entry)
//static
QString QFileSystemEngine::resolveUserName(const QFileSystemEntry &entry, QFileSystemMetaData &metaData)
{
-#if defined (Q_OS_SYMBIAN)
- Q_UNUSED(entry);
- Q_UNUSED(metaData);
- return QString();
-#elif defined(Q_OS_WIN)
+#if defined(Q_OS_WIN)
Q_UNUSED(metaData);
return QFileSystemEngine::owner(entry, QAbstractFileEngine::OwnerUser);
#else //(Q_OS_UNIX)
@@ -374,11 +358,7 @@ QString QFileSystemEngine::resolveUserName(const QFileSystemEntry &entry, QFileS
//static
QString QFileSystemEngine::resolveGroupName(const QFileSystemEntry &entry, QFileSystemMetaData &metaData)
{
-#if defined (Q_OS_SYMBIAN)
- Q_UNUSED(entry);
- Q_UNUSED(metaData);
- return QString();
-#elif defined(Q_OS_WIN)
+#if defined(Q_OS_WIN)
Q_UNUSED(metaData);
return QFileSystemEngine::owner(entry, QAbstractFileEngine::OwnerGroup);
#else //(Q_OS_UNIX)
diff --git a/src/corelib/io/qfilesystemengine_mac.cpp b/src/corelib/io/qfilesystemengine_mac.cpp
index f5e61ff29f..8bbb1a2e22 100644
--- a/src/corelib/io/qfilesystemengine_mac.cpp
+++ b/src/corelib/io/qfilesystemengine_mac.cpp
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtCore module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/corelib/io/qfilesystemengine_p.h b/src/corelib/io/qfilesystemengine_p.h
index af32a1c575..6d60d77c33 100644
--- a/src/corelib/io/qfilesystemengine_p.h
+++ b/src/corelib/io/qfilesystemengine_p.h
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtCore module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -71,7 +71,7 @@ public:
static QString resolveUserName(const QFileSystemEntry &entry, QFileSystemMetaData &data);
static QString resolveGroupName(const QFileSystemEntry &entry, QFileSystemMetaData &data);
-#if defined(Q_OS_UNIX) && !defined(Q_OS_SYMBIAN)
+#if defined(Q_OS_UNIX)
static QString resolveUserName(uint userId);
static QString resolveGroupName(uint groupId);
#endif
diff --git a/src/corelib/io/qfilesystemengine_unix.cpp b/src/corelib/io/qfilesystemengine_unix.cpp
index 901aaf8f91..52621eb23f 100644
--- a/src/corelib/io/qfilesystemengine_unix.cpp
+++ b/src/corelib/io/qfilesystemengine_unix.cpp
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtCore module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/corelib/io/qfilesystemengine_win.cpp b/src/corelib/io/qfilesystemengine_win.cpp
index d724429f6b..6ebaadad7e 100644
--- a/src/corelib/io/qfilesystemengine_win.cpp
+++ b/src/corelib/io/qfilesystemengine_win.cpp
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtCore module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -158,6 +158,12 @@ typedef VOID (WINAPI *PtrBuildTrusteeWithSidW)(PTRUSTEE_W, PSID);
static PtrBuildTrusteeWithSidW ptrBuildTrusteeWithSidW = 0;
typedef DWORD (WINAPI *PtrGetEffectiveRightsFromAclW)(PACL, PTRUSTEE_W, OUT PACCESS_MASK);
static PtrGetEffectiveRightsFromAclW ptrGetEffectiveRightsFromAclW = 0;
+typedef BOOL (WINAPI *PtrGetUserProfileDirectoryW)(HANDLE, LPWSTR, LPDWORD);
+static PtrGetUserProfileDirectoryW ptrGetUserProfileDirectoryW = 0;
+typedef BOOL (WINAPI *PtrGetVolumePathNamesForVolumeNameW)(LPCWSTR,LPWSTR,DWORD,PDWORD);
+static PtrGetVolumePathNamesForVolumeNameW ptrGetVolumePathNamesForVolumeNameW = 0;
+QT_END_INCLUDE_NAMESPACE
+
static TRUSTEE_W currentUserTrusteeW;
static TRUSTEE_W worldTrusteeW;
static PSID currentUserSID = 0;
@@ -174,7 +180,7 @@ public:
SidCleanup::~SidCleanup()
{
- qFree(currentUserSID);
+ free(currentUserSID);
currentUserSID = 0;
// worldSID was allocated with AllocateAndInitializeSid so it needs to be freed with FreeSid
@@ -186,13 +192,6 @@ SidCleanup::~SidCleanup()
Q_GLOBAL_STATIC(SidCleanup, initSidCleanup)
-typedef BOOL (WINAPI *PtrGetUserProfileDirectoryW)(HANDLE, LPWSTR, LPDWORD);
-static PtrGetUserProfileDirectoryW ptrGetUserProfileDirectoryW = 0;
-typedef BOOL (WINAPI *PtrGetVolumePathNamesForVolumeNameW)(LPCWSTR,LPWSTR,DWORD,PDWORD);
-static PtrGetVolumePathNamesForVolumeNameW ptrGetVolumePathNamesForVolumeNameW = 0;
-QT_END_INCLUDE_NAMESPACE
-
-
static void resolveLibs()
{
static bool triedResolve = false;
@@ -233,15 +232,15 @@ static void resolveLibs()
// doing a dummy GetTokenInformation call.
::GetTokenInformation(token, TokenUser, 0, 0, &retsize);
if (retsize) {
- void *tokenBuffer = qMalloc(retsize);
+ void *tokenBuffer = malloc(retsize);
if (::GetTokenInformation(token, TokenUser, tokenBuffer, retsize, &retsize)) {
PSID tokenSid = reinterpret_cast<PTOKEN_USER>(tokenBuffer)->User.Sid;
DWORD sidLen = ::GetLengthSid(tokenSid);
- currentUserSID = reinterpret_cast<PSID>(qMalloc(sidLen));
+ currentUserSID = reinterpret_cast<PSID>(malloc(sidLen));
if (::CopySid(sidLen, currentUserSID, tokenSid))
ptrBuildTrusteeWithSidW(&currentUserTrusteeW, currentUserSID);
}
- qFree(tokenBuffer);
+ free(tokenBuffer);
}
::CloseHandle(token);
}
@@ -357,7 +356,7 @@ static QString readSymLink(const QFileSystemEntry &link)
static QString readLink(const QFileSystemEntry &link)
{
#if !defined(Q_OS_WINCE)
-#if !defined(QT_NO_LIBRARY) && !defined(Q_CC_MWERKS)
+#if !defined(QT_NO_LIBRARY)
QString ret;
bool neededCoInit = false;
diff --git a/src/corelib/io/qfilesystementry.cpp b/src/corelib/io/qfilesystementry.cpp
index 11b73dd745..46881a1e5c 100644
--- a/src/corelib/io/qfilesystementry.cpp
+++ b/src/corelib/io/qfilesystementry.cpp
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtCore module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -176,7 +176,7 @@ void QFileSystemEntry::resolveNativeFilePath() const
QString QFileSystemEntry::fileName() const
{
findLastSeparator();
-#if defined(Q_OS_WIN) || defined(Q_OS_SYMBIAN)
+#if defined(Q_OS_WIN)
if (m_lastSeparator == -1 && m_filePath.length() >= 2 && m_filePath.at(1) == QLatin1Char(':'))
return m_filePath.mid(2);
#endif
@@ -187,7 +187,7 @@ QString QFileSystemEntry::path() const
{
findLastSeparator();
if (m_lastSeparator == -1) {
-#if defined(Q_OS_WIN) || defined(Q_OS_SYMBIAN)
+#if defined(Q_OS_WIN)
if (m_filePath.length() >= 2 && m_filePath.at(1) == QLatin1Char(':'))
return m_filePath.left(2);
#endif
@@ -195,7 +195,7 @@ QString QFileSystemEntry::path() const
}
if (m_lastSeparator == 0)
return QString(QLatin1Char('/'));
-#if defined(Q_OS_WIN) || defined(Q_OS_SYMBIAN)
+#if defined(Q_OS_WIN)
if (m_lastSeparator == 2 && m_filePath.at(1) == QLatin1Char(':'))
return m_filePath.left(m_lastSeparator + 1);
#endif
@@ -205,7 +205,7 @@ QString QFileSystemEntry::path() const
QString QFileSystemEntry::baseName() const
{
findFileNameSeparators();
-#if defined(Q_OS_WIN) || defined(Q_OS_SYMBIAN)
+#if defined(Q_OS_WIN)
if (m_lastSeparator == -1 && m_filePath.length() >= 2 && m_filePath.at(1) == QLatin1Char(':'))
return m_filePath.mid(2);
#endif
@@ -221,7 +221,7 @@ QString QFileSystemEntry::baseName() const
QString QFileSystemEntry::completeBaseName() const
{
findFileNameSeparators();
-#if defined(Q_OS_WIN) || defined(Q_OS_SYMBIAN)
+#if defined(Q_OS_WIN)
if (m_lastSeparator == -1 && m_filePath.length() >= 2 && m_filePath.at(1) == QLatin1Char(':'))
return m_filePath.mid(2);
#endif
@@ -253,7 +253,7 @@ QString QFileSystemEntry::completeSuffix() const
return m_filePath.mid(qMax((qint16)0, m_lastSeparator) + m_firstDotInFileName + 1);
}
-#if defined(Q_OS_WIN) || defined(Q_OS_SYMBIAN)
+#if defined(Q_OS_WIN)
bool QFileSystemEntry::isRelative() const
{
resolveFilePath();
@@ -266,9 +266,7 @@ bool QFileSystemEntry::isAbsolute() const
resolveFilePath();
return (!m_filePath.isEmpty() && ((m_filePath.length() >= 3
&& (m_filePath[0].isLetter() && m_filePath[1].unicode() == ':' && m_filePath[2].unicode() == '/'))
-#ifdef Q_OS_WIN
|| (m_filePath.length() >= 2 && (m_filePath.at(0) == QLatin1Char('/') && m_filePath.at(1) == QLatin1Char('/')))
-#endif
));
}
#else
@@ -284,7 +282,7 @@ bool QFileSystemEntry::isAbsolute() const
}
#endif
-#if defined(Q_OS_WIN) || defined(Q_OS_SYMBIAN)
+#if defined(Q_OS_WIN)
bool QFileSystemEntry::isDriveRoot() const
{
resolveFilePath();
@@ -298,12 +296,10 @@ bool QFileSystemEntry::isRoot() const
{
resolveFilePath();
if (m_filePath == QLatin1String("/")
-#if defined(Q_OS_WIN) || defined(Q_OS_SYMBIAN)
- || isDriveRoot()
#if defined(Q_OS_WIN)
+ || isDriveRoot()
|| isUncRoot(m_filePath)
#endif
-#endif
)
return true;
diff --git a/src/corelib/io/qfilesystementry_p.h b/src/corelib/io/qfilesystementry_p.h
index 61902f77d0..4b99d65c19 100644
--- a/src/corelib/io/qfilesystementry_p.h
+++ b/src/corelib/io/qfilesystementry_p.h
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtCore module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -56,7 +56,7 @@
#include <QtCore/qstring.h>
#include <QtCore/qbytearray.h>
-#if defined(Q_OS_WIN) || defined(Q_OS_SYMBIAN)
+#if defined(Q_OS_WIN)
#define QFILESYSTEMENTRY_NATIVE_PATH_IS_UTF16
#endif
@@ -93,7 +93,7 @@ public:
bool isRelative() const;
bool isClean() const;
-#if defined(Q_OS_WIN) || defined(Q_OS_SYMBIAN)
+#if defined(Q_OS_WIN)
bool isDriveRoot() const;
#endif
bool isRoot() const;
diff --git a/src/corelib/io/qfilesystemiterator_p.h b/src/corelib/io/qfilesystemiterator_p.h
index 7df5988459..5c249d6dba 100644
--- a/src/corelib/io/qfilesystemiterator_p.h
+++ b/src/corelib/io/qfilesystemiterator_p.h
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtCore module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -65,10 +65,7 @@
#include <QtCore/private/qfilesystemmetadata_p.h>
// Platform-specific headers
-#if defined(Q_OS_WIN)
-#elif defined (Q_OS_SYMBIAN)
-#include <f32file.h>
-#else
+#if !defined(Q_OS_WIN)
#include <QtCore/qscopedpointer.h>
#endif
@@ -95,11 +92,6 @@ private:
bool uncFallback;
int uncShareIndex;
bool onlyDirs;
-#elif defined (Q_OS_SYMBIAN)
- RDir dirHandle;
- TEntryArray entries;
- TInt lastError;
- TInt entryIndex;
#else
QT_DIR *dir;
QT_DIRENT *dirEntry;
diff --git a/src/corelib/io/qfilesystemiterator_unix.cpp b/src/corelib/io/qfilesystemiterator_unix.cpp
index d0eb04a145..5b7c82770b 100644
--- a/src/corelib/io/qfilesystemiterator_unix.cpp
+++ b/src/corelib/io/qfilesystemiterator_unix.cpp
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtCore module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/corelib/io/qfilesystemiterator_win.cpp b/src/corelib/io/qfilesystemiterator_win.cpp
index 1f5cf356a0..61dc633a65 100644
--- a/src/corelib/io/qfilesystemiterator_win.cpp
+++ b/src/corelib/io/qfilesystemiterator_win.cpp
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtCore module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -94,10 +94,12 @@ bool QFileSystemIterator::advance(QFileSystemEntry &fileEntry, QFileSystemMetaDa
haveData = true;
int infoLevel = 0 ; // FindExInfoStandard;
DWORD dwAdditionalFlags = 0;
+#ifndef Q_OS_WINCE
if (QSysInfo::windowsVersion() >= QSysInfo::WV_WINDOWS7) {
dwAdditionalFlags = 2; // FIND_FIRST_EX_LARGE_FETCH
infoLevel = 1 ; // FindExInfoBasic;
}
+#endif
int searchOps = 0; // FindExSearchNameMatch
if (onlyDirs)
searchOps = 1 ; // FindExSearchLimitToDirectories
diff --git a/src/corelib/io/qfilesystemmetadata_p.h b/src/corelib/io/qfilesystemmetadata_p.h
index 6ed5cec954..792ee0e714 100644
--- a/src/corelib/io/qfilesystemmetadata_p.h
+++ b/src/corelib/io/qfilesystemmetadata_p.h
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtCore module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -59,13 +59,11 @@
#include <QtCore/qabstractfileengine.h>
// Platform-specific includes
-#if defined(Q_OS_WIN)
-#ifndef IO_REPARSE_TAG_SYMLINK
-#define IO_REPARSE_TAG_SYMLINK (0xA000000CL)
-#endif
-#elif defined(Q_OS_SYMBIAN)
-#include <f32file.h>
-#include <QtCore/private/qdatetime_p.h>
+#ifdef Q_OS_WIN
+# include <QtCore/qt_windows.h>
+# ifndef IO_REPARSE_TAG_SYMLINK
+# define IO_REPARSE_TAG_SYMLINK (0xA000000CL)
+# endif
#endif
QT_BEGIN_NAMESPACE
@@ -99,11 +97,7 @@ public:
Permissions = OtherPermissions | GroupPermissions | UserPermissions | OwnerPermissions,
// Type
-#ifdef Q_OS_SYMBIAN
- LinkType = 0,
-#else
LinkType = 0x00010000,
-#endif
FileType = 0x00020000,
DirectoryType = 0x00040000,
#if defined(Q_OS_MAC) && !defined(QT_NO_CORESERVICES)
@@ -154,12 +148,6 @@ public:
| QFileSystemMetaData::Times
| QFileSystemMetaData::OwnerIds,
- SymbianTEntryFlags = QFileSystemMetaData::Permissions
- | QFileSystemMetaData::FileType
- | QFileSystemMetaData::DirectoryType
- | QFileSystemMetaData::SequentialType
- | QFileSystemMetaData::Attributes
- | QFileSystemMetaData::Times,
#if defined(Q_OS_WIN)
WinStatFlags = QFileSystemMetaData::FileType
| QFileSystemMetaData::DirectoryType
@@ -227,10 +215,6 @@ public:
void fillFromStatBuf(const QT_STATBUF &statBuffer);
void fillFromDirEnt(const QT_DIRENT &statBuffer);
#endif
-#ifdef Q_OS_SYMBIAN
- void fillFromTEntry(const TEntry& entry);
- void fillFromVolumeInfo(const TVolumeInfo& info);
-#endif
#if defined(Q_OS_WIN)
inline void fillFromFileAttribute(DWORD fileAttribute, bool isDriveRoot = false);
@@ -251,8 +235,6 @@ private:
FILETIME creationTime_;
FILETIME lastAccessTime_;
FILETIME lastWriteTime_;
-#elif defined(Q_OS_SYMBIAN)
- TTime modificationTime_;
#else
time_t creationTime_;
time_t modificationTime_;
@@ -274,7 +256,7 @@ inline bool QFileSystemMetaData::isBundle() const { return fal
inline bool QFileSystemMetaData::isAlias() const { return false; }
#endif
-#if (defined(Q_OS_UNIX) && !defined (Q_OS_SYMBIAN)) || defined (Q_OS_WIN)
+#if defined(Q_OS_UNIX) || defined (Q_OS_WIN)
inline QDateTime QFileSystemMetaData::fileTime(QAbstractFileEngine::FileTime time) const
{
switch (time) {
@@ -292,7 +274,7 @@ inline QDateTime QFileSystemMetaData::fileTime(QAbstractFileEngine::FileTime tim
}
#endif
-#if defined(Q_OS_UNIX) && !defined (Q_OS_SYMBIAN)
+#if defined(Q_OS_UNIX)
inline QDateTime QFileSystemMetaData::creationTime() const { return QDateTime::fromTime_t(creationTime_); }
inline QDateTime QFileSystemMetaData::modificationTime() const { return QDateTime::fromTime_t(modificationTime_); }
inline QDateTime QFileSystemMetaData::accessTime() const { return QDateTime::fromTime_t(accessTime_); }
@@ -309,25 +291,6 @@ inline uint QFileSystemMetaData::ownerId(QAbstractFileEngine::FileOwner owner) c
}
#endif
-#ifdef Q_OS_SYMBIAN
-inline QDateTime QFileSystemMetaData::creationTime() const { return modificationTime(); }
-inline QDateTime QFileSystemMetaData::modificationTime() const { return qt_symbian_TTime_To_QDateTime(modificationTime_); }
-inline QDateTime QFileSystemMetaData::accessTime() const { return modificationTime(); }
-
-inline QDateTime QFileSystemMetaData::fileTime(QAbstractFileEngine::FileTime time) const
-{
- Q_UNUSED(time);
- return modificationTime();
-}
-inline uint QFileSystemMetaData::userId() const { return (uint) -2; }
-inline uint QFileSystemMetaData::groupId() const { return (uint) -2; }
-inline uint QFileSystemMetaData::ownerId(QAbstractFileEngine::FileOwner owner) const
-{
- Q_UNUSED(owner);
- return (uint) -2;
-}
-#endif
-
#if defined(Q_OS_WIN)
inline uint QFileSystemMetaData::userId() const { return (uint) -2; }
inline uint QFileSystemMetaData::groupId() const { return (uint) -2; }
diff --git a/src/corelib/io/qfilesystemwatcher.cpp b/src/corelib/io/qfilesystemwatcher.cpp
index 4abb4f3cc1..57777179b5 100644
--- a/src/corelib/io/qfilesystemwatcher.cpp
+++ b/src/corelib/io/qfilesystemwatcher.cpp
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtCore module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/corelib/io/qfilesystemwatcher.h b/src/corelib/io/qfilesystemwatcher.h
index 7b7dbe98c5..7e38eb650a 100644
--- a/src/corelib/io/qfilesystemwatcher.h
+++ b/src/corelib/io/qfilesystemwatcher.h
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtCore module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -50,7 +50,6 @@ QT_BEGIN_HEADER
QT_BEGIN_NAMESPACE
-QT_MODULE(Core)
class QFileSystemWatcherPrivate;
diff --git a/src/corelib/io/qfilesystemwatcher_inotify.cpp b/src/corelib/io/qfilesystemwatcher_inotify.cpp
index ff732bc70e..ed95435afd 100644
--- a/src/corelib/io/qfilesystemwatcher_inotify.cpp
+++ b/src/corelib/io/qfilesystemwatcher_inotify.cpp
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtCore module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -131,7 +131,7 @@
# define __NR_inotify_rm_watch 286
# define __NR_inotify_init1 328
#else
-# error "This architecture is not supported. Please talk to qt-info@nokia.com"
+# error "This architecture is not supported. Please see http://www.qt-project.org/"
#endif
#if !defined(IN_CLOEXEC) && defined(O_CLOEXEC) && defined(__NR_inotify_init1)
@@ -277,7 +277,7 @@ QStringList QInotifyFileSystemWatcherEngine::addPaths(const QStringList &paths,
| IN_MOVE_SELF
| IN_DELETE_SELF
)));
- if (wd <= 0) {
+ if (wd < 0) {
perror("QInotifyFileSystemWatcherEngine::addPaths: inotify_add_watch failed");
continue;
}
diff --git a/src/corelib/io/qfilesystemwatcher_inotify_p.h b/src/corelib/io/qfilesystemwatcher_inotify_p.h
index 8b3ce62c46..6855f803e3 100644
--- a/src/corelib/io/qfilesystemwatcher_inotify_p.h
+++ b/src/corelib/io/qfilesystemwatcher_inotify_p.h
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtCore module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/corelib/io/qfilesystemwatcher_kqueue.cpp b/src/corelib/io/qfilesystemwatcher_kqueue.cpp
index fd7bfa2b27..542bbd23b2 100644
--- a/src/corelib/io/qfilesystemwatcher_kqueue.cpp
+++ b/src/corelib/io/qfilesystemwatcher_kqueue.cpp
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtCore module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/corelib/io/qfilesystemwatcher_kqueue_p.h b/src/corelib/io/qfilesystemwatcher_kqueue_p.h
index 9bd9378c0c..73d544abeb 100644
--- a/src/corelib/io/qfilesystemwatcher_kqueue_p.h
+++ b/src/corelib/io/qfilesystemwatcher_kqueue_p.h
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtCore module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/corelib/io/qfilesystemwatcher_p.h b/src/corelib/io/qfilesystemwatcher_p.h
index 9f403b308f..41bea1f951 100644
--- a/src/corelib/io/qfilesystemwatcher_p.h
+++ b/src/corelib/io/qfilesystemwatcher_p.h
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtCore module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/corelib/io/qfilesystemwatcher_polling.cpp b/src/corelib/io/qfilesystemwatcher_polling.cpp
index 23dca140d6..92d0a2b6b0 100644
--- a/src/corelib/io/qfilesystemwatcher_polling.cpp
+++ b/src/corelib/io/qfilesystemwatcher_polling.cpp
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtCore module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/corelib/io/qfilesystemwatcher_polling_p.h b/src/corelib/io/qfilesystemwatcher_polling_p.h
index 3b3272a890..14f6345412 100644
--- a/src/corelib/io/qfilesystemwatcher_polling_p.h
+++ b/src/corelib/io/qfilesystemwatcher_polling_p.h
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtCore module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/corelib/io/qfilesystemwatcher_win.cpp b/src/corelib/io/qfilesystemwatcher_win.cpp
index e82a9a5b56..715e16bc7e 100644
--- a/src/corelib/io/qfilesystemwatcher_win.cpp
+++ b/src/corelib/io/qfilesystemwatcher_win.cpp
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtCore module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -52,8 +52,15 @@
#include <qdir.h>
#include <qtextstream.h>
+#include <qt_windows.h>
+
QT_BEGIN_NAMESPACE
+QWindowsFileSystemWatcherEngine::Handle::Handle()
+ : handle(INVALID_HANDLE_VALUE), flags(0u)
+{
+}
+
QWindowsFileSystemWatcherEngine::~QWindowsFileSystemWatcherEngine()
{
foreach(QWindowsFileSystemWatcherEngineThread *thread, threads) {
diff --git a/src/corelib/io/qfilesystemwatcher_win_p.h b/src/corelib/io/qfilesystemwatcher_win_p.h
index 8e6b779b93..8daf5a94ad 100644
--- a/src/corelib/io/qfilesystemwatcher_win_p.h
+++ b/src/corelib/io/qfilesystemwatcher_win_p.h
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtCore module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -57,8 +57,6 @@
#ifndef QT_NO_FILESYSTEMWATCHER
-#include <qt_windows.h>
-
#include <QtCore/qdatetime.h>
#include <QtCore/qthread.h>
#include <QtCore/qfile.h>
@@ -90,15 +88,10 @@ public:
class Handle
{
public:
- HANDLE handle;
+ Qt::HANDLE handle;
uint flags;
- Handle()
- : handle(INVALID_HANDLE_VALUE), flags(0u)
- { }
- Handle(const Handle &other)
- : handle(other.handle), flags(other.flags)
- { }
+ Handle();
};
class PathInfo {
@@ -147,12 +140,12 @@ public:
void wakeup();
QMutex mutex;
- QVector<HANDLE> handles;
+ QVector<Qt::HANDLE> handles;
int msg;
QHash<QString, QWindowsFileSystemWatcherEngine::Handle> handleForDir;
- QHash<HANDLE, QHash<QString, QWindowsFileSystemWatcherEngine::PathInfo> > pathInfoForHandle;
+ QHash<Qt::HANDLE, QHash<QString, QWindowsFileSystemWatcherEngine::PathInfo> > pathInfoForHandle;
Q_SIGNALS:
void fileChanged(const QString &path, bool removed);
diff --git a/src/corelib/io/qfsfileengine.cpp b/src/corelib/io/qfsfileengine.cpp
index a49ea84603..4bf2e530a3 100644
--- a/src/corelib/io/qfsfileengine.cpp
+++ b/src/corelib/io/qfsfileengine.cpp
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtCore module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -120,9 +120,6 @@ void QFSFileEnginePrivate::init()
openMode = QIODevice::NotOpen;
fd = -1;
fh = 0;
-#ifdef Q_OS_SYMBIAN
- fileHandleForMaps = -1;
-#endif
lastIOCommand = IOFlushCommand;
lastFlushFailed = false;
closeFileHandle = false;
@@ -365,12 +362,7 @@ bool QFSFileEngine::close()
bool QFSFileEnginePrivate::closeFdFh()
{
Q_Q(QFSFileEngine);
- if (fd == -1 && !fh
-#ifdef Q_OS_SYMBIAN
- && !symbianFile.SubSessionHandle()
- && fileHandleForMaps == -1
-#endif
- )
+ if (fd == -1 && !fh)
return false;
// Flush the file if it's buffered, and if the last flush didn't fail.
@@ -378,24 +370,10 @@ bool QFSFileEnginePrivate::closeFdFh()
bool closed = true;
tried_stat = 0;
-#ifdef Q_OS_SYMBIAN
- // Map handle is always owned by us so always close it
- if (fileHandleForMaps >= 0) {
- QT_CLOSE(fileHandleForMaps);
- fileHandleForMaps = -1;
- }
-#endif
-
// Close the file if we created the handle.
if (closeFileHandle) {
int ret;
do {
-#ifdef Q_OS_SYMBIAN
- if (symbianFile.SubSessionHandle()) {
- symbianFile.Close();
- ret = 0;
- } else
-#endif
if (fh) {
// Close buffered file.
ret = fclose(fh) != 0 ? -1 : 0;
diff --git a/src/corelib/io/qfsfileengine.h b/src/corelib/io/qfsfileengine.h
index 0ed883a4a7..63659e709a 100644
--- a/src/corelib/io/qfsfileengine.h
+++ b/src/corelib/io/qfsfileengine.h
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtCore module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -43,9 +43,6 @@
#define QFSFILEENGINE_H
#include <QtCore/qabstractfileengine.h>
-#ifdef Q_OS_SYMBIAN
-#include <f32file.h>
-#endif
#ifndef QT_NO_FSFILEENGINE
@@ -53,7 +50,6 @@ QT_BEGIN_HEADER
QT_BEGIN_NAMESPACE
-QT_MODULE(Core)
class QFSFileEnginePrivate;
@@ -106,9 +102,6 @@ public:
bool open(QIODevice::OpenMode flags, int fd);
bool open(QIODevice::OpenMode flags, int fd, QFile::FileHandleFlags handleFlags);
bool open(QIODevice::OpenMode flags, FILE *fh, QFile::FileHandleFlags handleFlags);
-#ifdef Q_OS_SYMBIAN
- bool open(QIODevice::OpenMode flags, const RFile &f, QFile::FileHandleFlags handleFlags);
-#endif
static bool setCurrentPath(const QString &path);
static QString currentPath(const QString &path = QString());
static QString homePath();
diff --git a/src/corelib/io/qfsfileengine_iterator.cpp b/src/corelib/io/qfsfileengine_iterator.cpp
index 2d162f6a7d..d90dc87bbd 100644
--- a/src/corelib/io/qfsfileengine_iterator.cpp
+++ b/src/corelib/io/qfsfileengine_iterator.cpp
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtCore module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/corelib/io/qfsfileengine_iterator_p.h b/src/corelib/io/qfsfileengine_iterator_p.h
index 782930a52c..477e0ecd73 100644
--- a/src/corelib/io/qfsfileengine_iterator_p.h
+++ b/src/corelib/io/qfsfileengine_iterator_p.h
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtCore module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/corelib/io/qfsfileengine_p.h b/src/corelib/io/qfsfileengine_p.h
index 158c6f3a23..c06f662380 100644
--- a/src/corelib/io/qfsfileengine_p.h
+++ b/src/corelib/io/qfsfileengine_p.h
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtCore module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -60,10 +60,6 @@
#include <QtCore/private/qfilesystemmetadata_p.h>
#include <qhash.h>
-#ifdef Q_OS_SYMBIAN
-#include <f32file.h>
-#endif
-
#ifndef QT_NO_FSFILEENGINE
QT_BEGIN_NAMESPACE
@@ -117,31 +113,6 @@ public:
mutable QFileSystemMetaData metaData;
FILE *fh;
-#ifdef Q_OS_SYMBIAN
-#ifdef SYMBIAN_ENABLE_64_BIT_FILE_SERVER_API
- RFile64 symbianFile;
- TInt64 symbianFilePos;
-#else
- RFile symbianFile;
-
- /**
- * The cursor position in the underlying file. This differs
- * from devicePos because the latter is updated on calls to
- * writeData, even if no data was physically transferred to
- * the file, but instead stored in the write buffer.
- *
- * iFilePos is updated on calls to RFile::Read and
- * RFile::Write. It is also updated on calls to seek() but
- * RFile::Seek is not called when that happens because
- * Symbian supports positioned reads and writes, saving a file
- * server call, and because Symbian does not support seeking
- * past the end of a file.
- */
- TInt symbianFilePos;
-#endif
- mutable int fileHandleForMaps;
- int getMapHandle();
-#endif
#ifdef Q_OS_WIN
HANDLE fileHandle;
diff --git a/src/corelib/io/qfsfileengine_unix.cpp b/src/corelib/io/qfsfileengine_unix.cpp
index b09518865e..805c4b5989 100644
--- a/src/corelib/io/qfsfileengine_unix.cpp
+++ b/src/corelib/io/qfsfileengine_unix.cpp
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtCore module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -56,12 +56,6 @@
#include <sys/mman.h>
#include <stdlib.h>
#include <limits.h>
-#if defined(Q_OS_SYMBIAN)
-# include <sys/syslimits.h>
-# include <f32file.h>
-# include <pathinfo.h>
-# include "private/qcore_symbian_p.h"
-#endif
#include <errno.h>
#if !defined(QWS) && defined(Q_OS_MAC)
# include <private/qcore_mac_p.h>
@@ -69,23 +63,6 @@
QT_BEGIN_NAMESPACE
-#if defined(Q_OS_SYMBIAN)
-/*!
- \internal
-
- Returns true if supplied path is a relative path
-*/
-static bool isRelativePathSymbian(const QString& fileName)
-{
- return !(fileName.startsWith(QLatin1Char('/'))
- || (fileName.length() >= 2
- && ((fileName.at(0).isLetter() && fileName.at(1) == QLatin1Char(':'))
- || (fileName.at(0) == QLatin1Char('/') && fileName.at(1) == QLatin1Char('/')))));
-}
-
-#endif
-
-#ifndef Q_OS_SYMBIAN
/*!
\internal
@@ -125,7 +102,6 @@ static inline QByteArray openModeToFopenMode(QIODevice::OpenMode flags, const QF
return mode;
}
-#endif
/*!
\internal
@@ -155,7 +131,6 @@ static inline int openModeToOpenFlags(QIODevice::OpenMode mode)
return oflags;
}
-#ifndef Q_OS_SYMBIAN
/*!
\internal
@@ -166,151 +141,7 @@ static inline bool setCloseOnExec(int fd)
{
return fd != -1 && fcntl(fd, F_SETFD, FD_CLOEXEC) != -1;
}
-#endif
-
-#ifdef Q_OS_SYMBIAN
-/*!
- \internal
-*/
-bool QFSFileEnginePrivate::nativeOpen(QIODevice::OpenMode openMode)
-{
- Q_Q(QFSFileEngine);
-
- fh = 0;
- fd = -1;
-
- QString fn(QFileSystemEngine::absoluteName(fileEntry).nativeFilePath());
- RFs& fs = qt_s60GetRFs();
-
- TUint symbianMode = 0;
-
- if(openMode & QIODevice::ReadOnly)
- symbianMode |= EFileRead;
- if(openMode & QIODevice::WriteOnly)
- symbianMode |= EFileWrite;
- if(openMode & QIODevice::Text)
- symbianMode |= EFileStreamText;
-
- // pre Symbian 9.4, file I/O is always unbuffered, and the enum values don't exist
- if(QSysInfo::symbianVersion() >= QSysInfo::SV_9_4) {
- if (openMode & QFile::Unbuffered) {
- if (openMode & QIODevice::WriteOnly)
- symbianMode |= 0x00001000; //EFileWriteDirectIO;
- // ### Unbuffered read is not used, because it prevents file open in /resource
- // ### and has no obvious benefits
- } else {
- if (openMode & QIODevice::WriteOnly)
- symbianMode |= 0x00000800; //EFileWriteBuffered;
- // use implementation defaults for read buffering
- }
- }
-
- // Until Qt supports file sharing, we can't support EFileShareReadersOrWriters safely,
- // but Qt does this on other platforms and autotests rely on it.
- // The reason is that Unix locks are only advisory - the application needs to test the
- // lock after opening the file. Symbian and Windows locks are mandatory - opening a
- // locked file will fail.
- symbianMode |= EFileShareReadersOrWriters;
-
- TInt r;
- //note QIODevice::Truncate only has meaning for read/write access
- //write-only files are always truncated unless append is specified
- //reference openModeToOpenFlags in qfsfileengine_unix.cpp
- if ((openMode & QIODevice::Truncate) || (!(openMode & QIODevice::ReadOnly) && !(openMode & QIODevice::Append))) {
- r = symbianFile.Replace(fs, qt_QString2TPtrC(fn), symbianMode);
- } else {
- r = symbianFile.Open(fs, qt_QString2TPtrC(fn), symbianMode);
- if (r == KErrNotFound && (openMode & QIODevice::WriteOnly)) {
- r = symbianFile.Create(fs, qt_QString2TPtrC(fn), symbianMode);
- }
- }
-
- if (r == KErrNone) {
-#ifdef SYMBIAN_ENABLE_64_BIT_FILE_SERVER_API
- TInt64 size;
-#else
- TInt size;
-#endif
- r = symbianFile.Size(size);
- if (r==KErrNone) {
- if (openMode & QIODevice::Append)
- symbianFilePos = size;
- else
- symbianFilePos = 0;
- //TODO: port this (QFileSystemMetaData in open?)
- //cachedSize = size;
- }
- }
-
- if (r != KErrNone) {
- q->setError(QFile::OpenError, QSystemError(r, QSystemError::NativeError).toString());
- symbianFile.Close();
- return false;
- }
-
- closeFileHandle = true;
- return true;
-}
-
-bool QFSFileEngine::open(QIODevice::OpenMode openMode, const RFile &file, QFile::FileHandleFlags handleFlags)
-{
- Q_D(QFSFileEngine);
- // Append implies WriteOnly.
- if (openMode & QFile::Append)
- openMode |= QFile::WriteOnly;
-
- // WriteOnly implies Truncate if neither ReadOnly nor Append are sent.
- if ((openMode & QFile::WriteOnly) && !(openMode & (QFile::ReadOnly | QFile::Append)))
- openMode |= QFile::Truncate;
-
- d->openMode = openMode;
- d->lastFlushFailed = false;
- d->closeFileHandle = (handleFlags & QFile::AutoCloseHandle);
- d->fileEntry.clear();
- d->fh = 0;
- d->fd = -1;
- d->tried_stat = 0;
-
-#ifdef SYMBIAN_ENABLE_64_BIT_FILE_SERVER_API
- //RFile64 adds only functions to RFile, no data members
- d->symbianFile = static_cast<const RFile64&>(file);
-#else
- d->symbianFile = file;
-#endif
- TInt ret;
- d->symbianFilePos = 0;
- if (openMode & QFile::Append) {
- // Seek to the end when in Append mode.
- ret = d->symbianFile.Size(d->symbianFilePos);
- } else {
- // Seek to current otherwise
- ret = d->symbianFile.Seek(ESeekCurrent, d->symbianFilePos);
- }
-
- if (ret != KErrNone) {
- setError(QFile::OpenError, QSystemError(ret, QSystemError::NativeError).toString());
-
- d->openMode = QIODevice::NotOpen;
-#ifdef SYMBIAN_ENABLE_64_BIT_FILE_SERVER_API
- d->symbianFile = RFile64();
-#else
- d->symbianFile = RFile();
-#endif
- return false;
- }
-
- // Extract filename (best effort)
- TFileName fn;
- TInt err = d->symbianFile.FullName(fn);
- if (err == KErrNone)
- d->fileEntry = QFileSystemEntry(qt_TDesC2QString(fn), QFileSystemEntry::FromNativePath());
- else
- d->fileEntry.clear();
-
- return true;
-}
-#else
/*!
\internal
*/
@@ -407,7 +238,6 @@ bool QFSFileEnginePrivate::nativeOpen(QIODevice::OpenMode openMode)
closeFileHandle = true;
return true;
}
-#endif
/*!
\internal
@@ -423,10 +253,6 @@ bool QFSFileEnginePrivate::nativeClose()
*/
bool QFSFileEnginePrivate::nativeFlush()
{
-#ifdef Q_OS_SYMBIAN
- if (symbianFile.SubSessionHandle())
- return (KErrNone == symbianFile.Flush());
-#endif
return fh ? flushFh() : fd != -1;
}
@@ -437,24 +263,6 @@ qint64 QFSFileEnginePrivate::nativeRead(char *data, qint64 len)
{
Q_Q(QFSFileEngine);
-#ifdef Q_OS_SYMBIAN
- if (symbianFile.SubSessionHandle()) {
- if(len > KMaxTInt) {
- //this check is more likely to catch a corrupt length, since it isn't possible to allocate 2GB buffers (yet..)
- q->setError(QFile::ReadError, QLatin1String("Maximum 2GB in single read on this platform"));
- return -1;
- }
- TPtr8 ptr(reinterpret_cast<TUint8*>(data), static_cast<TInt>(len));
- TInt r = symbianFile.Read(symbianFilePos, ptr);
- if (r != KErrNone)
- {
- q->setError(QFile::ReadError, QSystemError(r, QSystemError::NativeError).toString());
- return -1;
- }
- symbianFilePos += ptr.Length();
- return qint64(ptr.Length());
- }
-#endif
if (fh && nativeIsSequential()) {
size_t readBytes = 0;
int oldFlags = fcntl(QT_FILENO(fh), F_GETFL);
@@ -522,40 +330,6 @@ qint64 QFSFileEnginePrivate::nativeReadLine(char *data, qint64 maxlen)
*/
qint64 QFSFileEnginePrivate::nativeWrite(const char *data, qint64 len)
{
-#ifdef Q_OS_SYMBIAN
- Q_Q(QFSFileEngine);
- if (symbianFile.SubSessionHandle()) {
- if(len > KMaxTInt) {
- //this check is more likely to catch a corrupt length, since it isn't possible to allocate 2GB buffers (yet..)
- q->setError(QFile::WriteError, QLatin1String("Maximum 2GB in single write on this platform"));
- return -1;
- }
- const TPtrC8 ptr(reinterpret_cast<const TUint8*>(data), static_cast<TInt>(len));
-#ifdef SYMBIAN_ENABLE_64_BIT_FILE_SERVER_API
- TInt64 eofpos = 0;
-#else
- TInt eofpos = 0;
-#endif
- //The end of file position is not cached because QFile is read/write sharable, therefore another
- //process may have altered the file size.
- TInt r = symbianFile.Seek(ESeekEnd, eofpos);
- if (r == KErrNone && symbianFilePos > eofpos) {
- //seek position is beyond end of file so file needs to be extended before write.
- //note that SetSize does not zero-initialise (c.f. posix lseek)
- r = symbianFile.SetSize(symbianFilePos);
- }
- if (r == KErrNone) {
- //write to specific position in the file (i.e. use our own cursor rather than calling seek)
- r = symbianFile.Write(symbianFilePos, ptr);
- }
- if (r != KErrNone) {
- q->setError(QFile::WriteError, QSystemError(r, QSystemError::NativeError).toString());
- return -1;
- }
- symbianFilePos += len;
- return len;
- }
-#endif
return writeFdFh(data, len);
}
@@ -564,12 +338,6 @@ qint64 QFSFileEnginePrivate::nativeWrite(const char *data, qint64 len)
*/
qint64 QFSFileEnginePrivate::nativePos() const
{
-#ifdef Q_OS_SYMBIAN
- const Q_Q(QFSFileEngine);
- if (symbianFile.SubSessionHandle()) {
- return symbianFilePos;
- }
-#endif
return posFdFh();
}
@@ -578,19 +346,6 @@ qint64 QFSFileEnginePrivate::nativePos() const
*/
bool QFSFileEnginePrivate::nativeSeek(qint64 pos)
{
-#ifdef Q_OS_SYMBIAN
- Q_Q(QFSFileEngine);
- if (symbianFile.SubSessionHandle()) {
-#ifndef SYMBIAN_ENABLE_64_BIT_FILE_SERVER_API
- if(pos > KMaxTInt) {
- q->setError(QFile::PositionError, QLatin1String("Maximum 2GB file position on this platform"));
- return false;
- }
-#endif
- symbianFilePos = pos;
- return true;
- }
-#endif
return seekFdFh(pos);
}
@@ -602,31 +357,11 @@ int QFSFileEnginePrivate::nativeHandle() const
return fh ? fileno(fh) : fd;
}
-#ifdef Q_OS_SYMBIAN
-int QFSFileEnginePrivate::getMapHandle()
-{
- if (symbianFile.SubSessionHandle()) {
- // Symbian file handle can't be used for open C mmap() so open the file with open C as well.
- if (fileHandleForMaps < 0) {
- int flags = openModeToOpenFlags(openMode);
- flags &= ~(O_CREAT | O_TRUNC);
- fileHandleForMaps = ::wopen((wchar_t*)(fileEntry.nativeFilePath().utf16()), flags, 0666);
- }
- return fileHandleForMaps;
- }
- return nativeHandle();
-}
-#endif
-
/*!
\internal
*/
bool QFSFileEnginePrivate::nativeIsSequential() const
{
-#ifdef Q_OS_SYMBIAN
- if (symbianFile.SubSessionHandle())
- return false;
-#endif
return isSequentialFdFh();
}
@@ -679,22 +414,6 @@ bool QFSFileEngine::link(const QString &newName)
qint64 QFSFileEnginePrivate::nativeSize() const
{
-#ifdef Q_OS_SYMBIAN
- const Q_Q(QFSFileEngine);
- if (symbianFile.SubSessionHandle()) {
-#ifdef SYMBIAN_ENABLE_64_BIT_FILE_SERVER_API
- qint64 size;
-#else
- TInt size;
-#endif
- TInt err = symbianFile.Size(size);
- if(err != KErrNone) {
- const_cast<QFSFileEngine*>(q)->setError(QFile::PositionError, QSystemError(err, QSystemError::NativeError).toString());
- return 0;
- }
- return size;
- }
-#endif
return sizeFdFh();
}
@@ -710,11 +429,7 @@ bool QFSFileEngine::rmdir(const QString &name, bool recurseParentDirectories) co
bool QFSFileEngine::caseSensitive() const
{
-#if defined(Q_OS_SYMBIAN)
- return false;
-#else
return true;
-#endif
}
bool QFSFileEngine::setCurrentPath(const QString &path)
@@ -745,25 +460,7 @@ QString QFSFileEngine::tempPath()
QFileInfoList QFSFileEngine::drives()
{
QFileInfoList ret;
-#if defined(Q_OS_SYMBIAN)
- TDriveList driveList;
- RFs rfs = qt_s60GetRFs();
- TInt err = rfs.DriveList(driveList);
- if (err == KErrNone) {
- char driveName[] = "A:/";
-
- for (char i = 0; i < KMaxDrives; i++) {
- if (driveList[i]) {
- driveName[0] = 'A' + i;
- ret.append(QFileInfo(QLatin1String(driveName)));
- }
- }
- } else {
- qWarning("QFSFileEngine::drives: Getting drives failed");
- }
-#else
ret.append(QFileInfo(rootPath()));
-#endif
return ret;
}
@@ -900,11 +597,7 @@ QString QFSFileEngine::fileName(FileName file) const
bool QFSFileEngine::isRelativePath() const
{
Q_D(const QFSFileEngine);
-#if defined(Q_OS_SYMBIAN)
- return isRelativePathSymbian(d->fileEntry.filePath());
-#else
return d->fileEntry.filePath().length() ? d->fileEntry.filePath()[0] != QLatin1Char('/') : true;
-#endif
}
uint QFSFileEngine::ownerId(FileOwner own) const
@@ -920,13 +613,9 @@ uint QFSFileEngine::ownerId(FileOwner own) const
QString QFSFileEngine::owner(FileOwner own) const
{
-#ifndef Q_OS_SYMBIAN
if (own == OwnerUser)
return QFileSystemEngine::resolveUserName(ownerId(own));
return QFileSystemEngine::resolveGroupName(ownerId(own));
-#else
- return QString();
-#endif
}
bool QFSFileEngine::setPermissions(uint perms)
@@ -940,44 +629,6 @@ bool QFSFileEngine::setPermissions(uint perms)
return true;
}
-#ifdef Q_OS_SYMBIAN
-bool QFSFileEngine::setSize(qint64 size)
-{
- Q_D(QFSFileEngine);
- bool ret = false;
- TInt err = KErrNone;
- if (d->symbianFile.SubSessionHandle()) {
- TInt err = d->symbianFile.SetSize(size);
- ret = (err == KErrNone);
- if (ret && d->symbianFilePos > size)
- d->symbianFilePos = size;
- }
- else if (d->fd != -1)
- ret = QT_FTRUNCATE(d->fd, size) == 0;
- else if (d->fh)
- ret = QT_FTRUNCATE(QT_FILENO(d->fh), size) == 0;
- else {
- RFile tmp;
- QString symbianFilename(d->fileEntry.nativeFilePath());
- err = tmp.Open(qt_s60GetRFs(), qt_QString2TPtrC(symbianFilename), EFileWrite);
- if (err == KErrNone)
- {
- err = tmp.SetSize(size);
- tmp.Close();
- }
- ret = (err == KErrNone);
- }
- if (!ret) {
- QSystemError error;
- if (err)
- error = QSystemError(err, QSystemError::NativeError);
- else
- error = QSystemError(errno, QSystemError::StandardLibraryError);
- setError(QFile::ResizeError, error.toString());
- }
- return ret;
-}
-#else
bool QFSFileEngine::setSize(qint64 size)
{
Q_D(QFSFileEngine);
@@ -992,7 +643,6 @@ bool QFSFileEngine::setSize(qint64 size)
setError(QFile::ResizeError, qt_error_string(errno));
return ret;
}
-#endif
QDateTime QFSFileEngine::fileTime(FileTime time) const
{
@@ -1045,19 +695,8 @@ uchar *QFSFileEnginePrivate::map(qint64 offset, qint64 size, QFile::MemoryMapFla
QT_OFF_T realOffset = QT_OFF_T(offset);
realOffset &= ~(QT_OFF_T(pageSize - 1));
-#ifdef Q_OS_SYMBIAN
- void *mapAddress;
- TRAPD(err, mapAddress = QT_MMAP((void*)0, realSize,
- access, MAP_SHARED, getMapHandle(), realOffset));
- if (err != KErrNone) {
- qWarning("OpenC bug: leave from mmap %d", err);
- mapAddress = MAP_FAILED;
- errno = EINVAL;
- }
-#else
void *mapAddress = QT_MMAP((void*)0, realSize,
access, MAP_SHARED, nativeHandle(), realOffset);
-#endif
if (MAP_FAILED != mapAddress) {
uchar *address = extra + static_cast<uchar*>(mapAddress);
maps[address] = QPair<int,size_t>(extra, realSize);
diff --git a/src/corelib/io/qfsfileengine_win.cpp b/src/corelib/io/qfsfileengine_win.cpp
index 5dc96ea8a2..cc78664275 100644
--- a/src/corelib/io/qfsfileengine_win.cpp
+++ b/src/corelib/io/qfsfileengine_win.cpp
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtCore module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -614,7 +614,7 @@ bool QFSFileEnginePrivate::doStat(QFileSystemMetaData::MetaDataFlags flags) cons
bool QFSFileEngine::link(const QString &newName)
{
#if !defined(Q_OS_WINCE)
-#if !defined(QT_NO_LIBRARY) && !defined(Q_CC_MWERKS)
+#if !defined(QT_NO_LIBRARY)
bool ret = false;
QString linkName = newName;
diff --git a/src/corelib/io/qiodevice.cpp b/src/corelib/io/qiodevice.cpp
index ef530f379f..0ad1a91d6c 100644
--- a/src/corelib/io/qiodevice.cpp
+++ b/src/corelib/io/qiodevice.cpp
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtCore module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -1088,15 +1088,6 @@ qint64 QIODevice::readLine(char *data, qint64 maxSize)
if (readSoFar)
debugBinaryString(data, int(readSoFar));
#endif
-#if defined(Q_OS_SYMBIAN)
- // Open C fgets strips '\r' but readSoFar gets returned as if it was still there
- if ((d->openMode & Text) &&
- readSoFar > 1 &&
- data[readSoFar - 1] == '\0' &&
- data[readSoFar - 2] == '\n') {
- --readSoFar;
- }
-#endif
if (readSoFar && data[readSoFar - 1] == '\n') {
if (d->openMode & Text) {
// QRingBuffer::readLine() isn't Text aware.
@@ -1135,12 +1126,6 @@ qint64 QIODevice::readLine(char *data, qint64 maxSize)
data[readSoFar] = '\0';
if (d->openMode & Text) {
-#if defined(Q_OS_SYMBIAN)
- // Open C fgets strips '\r' but readSoFar gets returned as if it was still there
- if (readSoFar > 1 && data[readSoFar - 1] == '\0' && data[readSoFar - 2] == '\n') {
- --readSoFar;
- }
-#endif
if (readSoFar > 1 && data[readSoFar - 1] == '\n' && data[readSoFar - 2] == '\r') {
data[readSoFar - 2] = '\n';
data[readSoFar - 1] = '\0';
diff --git a/src/corelib/io/qiodevice.h b/src/corelib/io/qiodevice.h
index 4b34ad4f69..eba408b285 100644
--- a/src/corelib/io/qiodevice.h
+++ b/src/corelib/io/qiodevice.h
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtCore module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -58,7 +58,6 @@ QT_BEGIN_HEADER
QT_BEGIN_NAMESPACE
-QT_MODULE(Core)
class QByteArray;
class QIODevicePrivate;
diff --git a/src/corelib/io/qiodevice_p.h b/src/corelib/io/qiodevice_p.h
index 2515fe5705..a510f5390c 100644
--- a/src/corelib/io/qiodevice_p.h
+++ b/src/corelib/io/qiodevice_p.h
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtCore module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/corelib/io/qnoncontiguousbytedevice.cpp b/src/corelib/io/qnoncontiguousbytedevice.cpp
index ba711493c6..f3d5bec196 100644
--- a/src/corelib/io/qnoncontiguousbytedevice.cpp
+++ b/src/corelib/io/qnoncontiguousbytedevice.cpp
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtCore module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/corelib/io/qnoncontiguousbytedevice_p.h b/src/corelib/io/qnoncontiguousbytedevice_p.h
index ded605681e..084d5b6cd8 100644
--- a/src/corelib/io/qnoncontiguousbytedevice_p.h
+++ b/src/corelib/io/qnoncontiguousbytedevice_p.h
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtCore module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/corelib/io/qprocess.cpp b/src/corelib/io/qprocess.cpp
index 8f76e0e4b9..0a0097c887 100644
--- a/src/corelib/io/qprocess.cpp
+++ b/src/corelib/io/qprocess.cpp
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtCore module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -97,10 +97,6 @@ QT_END_NAMESPACE
#include <qwineventnotifier.h>
#endif
-#ifdef Q_OS_SYMBIAN
-#include <e32std.h>
-#endif
-
#ifndef QT_NO_PROCESS
QT_BEGIN_NAMESPACE
@@ -473,7 +469,7 @@ void QProcessPrivate::Channel::clear()
used as an input source for QXmlReader, or for generating data to
be uploaded using QNetworkAccessManager.
- \note On Windows CE and Symbian, reading and writing to a process
+ \note On Windows CE, reading and writing to a process
is not supported.
When the process exits, QProcess reenters the \l NotRunning state
@@ -524,10 +520,6 @@ void QProcessPrivate::Channel::clear()
setWorkingDirectory(). By default, processes are run in the
current working directory of the calling process.
- \note On Symbian, setting environment or working directory
- is not supported. The working directory will always be the private
- directory of the running process.
-
\section1 Synchronous Process API
QProcess provides a set of functions which allow it to be used
@@ -564,16 +556,6 @@ void QProcessPrivate::Channel::clear()
interpreter itself (\c{cmd.exe} on some Windows systems), and ask
the interpreter to execute the desired command.
- \section1 Symbian Platform Security Requirements
-
- On Symbian, processes which use the functions kill() or terminate()
- must have the \c PowerMgmt platform security capability. If the client
- process lacks this capability, these functions will fail.
-
- Platform security capabilities are added via the
- \l{qmake-variable-reference.html#target-capability}{TARGET.CAPABILITY}
- qmake variable.
-
\sa QBuffer, QFile, QTcpSocket
*/
@@ -761,8 +743,6 @@ QProcessPrivate::QProcessPrivate()
exitStatus = QProcess::NormalExit;
startupSocketNotifier = 0;
deathNotifier = 0;
- notifier = 0;
- pipeWriter = 0;
childStartedPipe[0] = INVALID_Q_PIPE;
childStartedPipe[1] = INVALID_Q_PIPE;
deathPipe[0] = INVALID_Q_PIPE;
@@ -773,16 +753,15 @@ QProcessPrivate::QProcessPrivate()
emittedReadyRead = false;
emittedBytesWritten = false;
#ifdef Q_OS_WIN
+ notifier = 0;
+ stdoutReader = 0;
+ stderrReader = 0;
pipeWriter = 0;
processFinishedNotifier = 0;
#endif // Q_OS_WIN
#ifdef Q_OS_UNIX
serial = 0;
#endif
-#ifdef Q_OS_SYMBIAN
- symbianProcess = NULL;
- processLaunched = false;
-#endif
}
/*! \internal
@@ -843,25 +822,20 @@ void QProcessPrivate::cleanup()
qDeleteInEventHandler(deathNotifier);
deathNotifier = 0;
}
+#ifdef Q_OS_WIN
if (notifier) {
qDeleteInEventHandler(notifier);
notifier = 0;
}
- destroyPipe(stdoutChannel.pipe);
- destroyPipe(stderrChannel.pipe);
- destroyPipe(stdinChannel.pipe);
+#endif
+ destroyChannel(&stdoutChannel);
+ destroyChannel(&stderrChannel);
+ destroyChannel(&stdinChannel);
destroyPipe(childStartedPipe);
destroyPipe(deathPipe);
#ifdef Q_OS_UNIX
serial = 0;
#endif
-#ifdef Q_OS_SYMBIAN
- if (symbianProcess) {
- symbianProcess->Close();
- delete symbianProcess;
- symbianProcess = NULL;
- }
-#endif
}
/*! \internal
@@ -873,7 +847,7 @@ bool QProcessPrivate::_q_canReadStandardOutput()
if (available == 0) {
if (stdoutChannel.notifier)
stdoutChannel.notifier->setEnabled(false);
- destroyPipe(stdoutChannel.pipe);
+ destroyChannel(&stdoutChannel);
#if defined QPROCESS_DEBUG
qDebug("QProcessPrivate::canReadStandardOutput(), 0 bytes available");
#endif
@@ -928,7 +902,7 @@ bool QProcessPrivate::_q_canReadStandardError()
if (available == 0) {
if (stderrChannel.notifier)
stderrChannel.notifier->setEnabled(false);
- destroyPipe(stderrChannel.pipe);
+ destroyChannel(&stderrChannel);
return false;
}
@@ -981,7 +955,7 @@ bool QProcessPrivate::_q_canWrite()
qint64 written = writeToStdin(writeBuffer.readPointer(),
writeBuffer.nextDataBlockSize());
if (written < 0) {
- destroyPipe(stdinChannel.pipe);
+ destroyChannel(&stdinChannel);
processError = QProcess::WriteError;
q->setErrorString(QProcess::tr("Error writing to process"));
emit q->error(processError);
@@ -1125,7 +1099,7 @@ void QProcessPrivate::closeWriteChannel()
// instead.
flushPipeWriter();
#endif
- destroyPipe(stdinChannel.pipe);
+ destroyChannel(&stdinChannel);
}
/*!
@@ -1397,15 +1371,14 @@ void QProcess::setStandardOutputProcess(QProcess *destination)
dto->stdinChannel.pipeFrom(dfrom);
}
-#if defined(Q_OS_WIN) || defined(Q_OS_SYMBIAN)
+#if defined(Q_OS_WIN)
/*!
\since 4.7
Returns the additional native command line arguments for the program.
- \note This function is available only on the Windows and Symbian
- platforms.
+ \note This function is available only on the Windows platform.
\sa setNativeArguments()
*/
@@ -1428,8 +1401,7 @@ QString QProcess::nativeArguments() const
string which is \e appended to the string composed from the usual
argument list, with a delimiting space.
- \note This function is available only on the Windows and Symbian
- platforms.
+ \note This function is available only on the Windows platform.
\sa nativeArguments()
*/
@@ -1461,10 +1433,6 @@ QString QProcess::workingDirectory() const
process in this directory. The default behavior is to start the
process in the working directory of the calling process.
- \note The working directory setting is ignored on Symbian;
- the private directory of the process is considered its working
- directory.
-
\sa workingDirectory(), start()
*/
void QProcess::setWorkingDirectory(const QString &dir)
@@ -1610,7 +1578,7 @@ void QProcess::setEnvironment(const QStringList &environment)
using setEnvironment() or setEnvironmentHash(). If no environment
has been set, the environment of the calling process will be used.
- \note The environment settings are ignored on Windows CE and Symbian,
+ \note The environment settings are ignored on Windows CE,
as there is no concept of an environment.
\sa processEnvironment(), setEnvironment(), systemEnvironment()
@@ -2076,13 +2044,6 @@ void QProcess::start(const QString &program, OpenMode mode)
event loop does not handle the WM_CLOSE message, can only be terminated by
calling kill().
- On Symbian, this function requires platform security capability
- \c PowerMgmt. If absent, the process will panic with KERN-EXEC 46.
-
- \note Terminating running processes from other processes will typically
- cause a panic in Symbian due to platform security.
-
- \sa {Symbian Platform Security Requirements}
\sa kill()
*/
void QProcess::terminate()
@@ -2097,13 +2058,6 @@ void QProcess::terminate()
On Windows, kill() uses TerminateProcess, and on Unix and Mac OS X, the
SIGKILL signal is sent to the process.
- On Symbian, this function requires platform security capability
- \c PowerMgmt. If absent, the process will panic with KERN-EXEC 46.
-
- \note Killing running processes from other processes will typically
- cause a panic in Symbian due to platform security.
-
- \sa {Symbian Platform Security Requirements}
\sa terminate()
*/
void QProcess::kill()
@@ -2256,7 +2210,7 @@ QT_BEGIN_INCLUDE_NAMESPACE
#if defined(Q_OS_MAC) && !defined(QT_NO_CORESERVICES)
# include <crt_externs.h>
# define environ (*_NSGetEnviron())
-#elif defined(Q_OS_WINCE) || defined(Q_OS_SYMBIAN) || (defined(Q_OS_MAC) && defined(QT_NO_CORESERVICES))
+#elif defined(Q_OS_WINCE) || (defined(Q_OS_MAC) && defined(QT_NO_CORESERVICES))
static char *qt_empty_environ[] = { 0 };
#define environ qt_empty_environ
#elif !defined(Q_OS_WIN)
@@ -2317,7 +2271,7 @@ QStringList QProcess::systemEnvironment()
\relates QProcess
Typedef for the identifiers used to represent processes on the underlying
- platform. On Unix and Symbian, this corresponds to \l qint64; on Windows, it
+ platform. On Unix, this corresponds to \l qint64; on Windows, it
corresponds to \c{_PROCESS_INFORMATION*}.
\sa QProcess::pid()
diff --git a/src/corelib/io/qprocess.h b/src/corelib/io/qprocess.h
index 96a1edefd8..1890635eda 100644
--- a/src/corelib/io/qprocess.h
+++ b/src/corelib/io/qprocess.h
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtCore module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -50,11 +50,10 @@ QT_BEGIN_HEADER
QT_BEGIN_NAMESPACE
-QT_MODULE(Core)
#ifndef QT_NO_PROCESS
-#if (!defined(Q_OS_WIN32) && !defined(Q_OS_WINCE)) || defined(qdoc)
+#if !defined(Q_OS_WIN) || defined(qdoc)
typedef qint64 Q_PID;
#else
QT_END_NAMESPACE
@@ -152,7 +151,7 @@ public:
void setStandardErrorFile(const QString &fileName, OpenMode mode = Truncate);
void setStandardOutputProcess(QProcess *destination);
-#if defined(Q_OS_WIN) || defined(Q_OS_SYMBIAN)
+#if defined(Q_OS_WIN)
QString nativeArguments() const;
void setNativeArguments(const QString &arguments);
#endif
diff --git a/src/corelib/io/qprocess_p.h b/src/corelib/io/qprocess_p.h
index 7e0fecc320..236e716b34 100644
--- a/src/corelib/io/qprocess_p.h
+++ b/src/corelib/io/qprocess_p.h
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtCore module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -74,12 +74,10 @@ typedef int Q_PIPE;
QT_BEGIN_NAMESPACE
class QSocketNotifier;
+class QWindowsPipeReader;
class QWindowsPipeWriter;
class QWinEventNotifier;
class QTimer;
-#if defined(Q_OS_SYMBIAN)
-class RProcess;
-#endif
#ifdef Q_OS_WIN
class QProcEnvKey : public QString
@@ -279,7 +277,7 @@ public:
QString program;
QStringList arguments;
-#if defined(Q_OS_WIN) || defined(Q_OS_SYMBIAN)
+#if defined(Q_OS_WIN)
QString nativeArguments;
#endif
QProcessEnvironment environment;
@@ -291,17 +289,22 @@ public:
Q_PIPE childStartedPipe[2];
Q_PIPE deathPipe[2];
void destroyPipe(Q_PIPE pipe[2]);
+ void destroyChannel(Channel *channel);
QSocketNotifier *startupSocketNotifier;
QSocketNotifier *deathNotifier;
+#ifdef Q_OS_WIN
// the wonderful windows notifier
QTimer *notifier;
+ QWindowsPipeReader *stdoutReader;
+ QWindowsPipeReader *stderrReader;
QWindowsPipeWriter *pipeWriter;
QWinEventNotifier *processFinishedNotifier;
+#endif
void startProcess();
-#if defined(Q_OS_UNIX) && !defined(Q_OS_SYMBIAN)
+#if defined(Q_OS_UNIX)
void execChild(const char *workingDirectory, char **path, char **argv, char **envp);
#endif
bool processStarted();
@@ -342,11 +345,6 @@ public:
#ifdef Q_OS_UNIX
static void initializeProcessManager();
#endif
-
-#ifdef Q_OS_SYMBIAN
- bool processLaunched;
- RProcess* symbianProcess;
-#endif
};
QT_END_NAMESPACE
diff --git a/src/corelib/io/qprocess_unix.cpp b/src/corelib/io/qprocess_unix.cpp
index f01df3c078..9e35978c77 100644
--- a/src/corelib/io/qprocess_unix.cpp
+++ b/src/corelib/io/qprocess_unix.cpp
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtCore module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -169,16 +169,14 @@ private:
};
-Q_GLOBAL_STATIC(QMutex, processManagerGlobalMutex)
-
static QProcessManager *processManagerInstance = 0;
static QProcessManager *processManager()
{
// The constructor of QProcessManager should be called only once
// so we cannot use Q_GLOBAL_STATIC directly for QProcessManager
- QMutex *mutex = processManagerGlobalMutex();
- QMutexLocker locker(mutex);
+ static QBasicMutex processManagerGlobalMutex;
+ QMutexLocker locker(&processManagerGlobalMutex);
if (!processManagerInstance)
QProcessPrivate::initializeProcessManager();
@@ -357,6 +355,11 @@ void QProcessPrivate::destroyPipe(int *pipe)
}
}
+void QProcessPrivate::destroyChannel(Channel *channel)
+{
+ destroyPipe(channel->pipe);
+}
+
/*
Create the pipes to a QProcessPrivate::Channel.
@@ -545,10 +548,6 @@ inline pid_t qt_fork()
#endif
}
-#ifdef Q_OS_MAC
-Q_GLOBAL_STATIC(QMutex, cfbundleMutex);
-#endif
-
void QProcessPrivate::startProcess()
{
Q_Q(QProcess);
@@ -599,7 +598,8 @@ void QProcessPrivate::startProcess()
{
// CFBundle is not reentrant, since CFBundleCreate might return a reference
// to a cached bundle object. Protect the bundle calls with a mutex lock.
- QMutexLocker lock(cfbundleMutex());
+ static QBasicMutex cfbundleMutex;
+ QMutexLocker lock(&cfbundleMutex);
QCFType<CFBundleRef> bundle = CFBundleCreate(0, url);
url = CFBundleCopyExecutableURL(bundle);
}
diff --git a/src/corelib/io/qprocess_win.cpp b/src/corelib/io/qprocess_win.cpp
index 8c6444d173..51f34a61a6 100644
--- a/src/corelib/io/qprocess_win.cpp
+++ b/src/corelib/io/qprocess_win.cpp
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtCore module of the Qt Toolkit.
**
@@ -35,28 +34,31 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
#include "qprocess.h"
#include "qprocess_p.h"
+#include "qwindowspipereader_p.h"
#include "qwindowspipewriter_p.h"
#include <qdatetime.h>
#include <qdir.h>
+#include <qelapsedtimer.h>
#include <qfileinfo.h>
#include <qregexp.h>
#include <qtimer.h>
-#include <qthread.h>
-#include <qmutex.h>
-#include <qwaitcondition.h>
#include <qwineventnotifier.h>
#include <private/qthread_p.h>
#include <qdebug.h>
#include "private/qfsfileengine_p.h" // for longFileName
+#ifndef PIPE_REJECT_REMOTE_CLIENTS
+#define PIPE_REJECT_REMOTE_CLIENTS 0x08
+#endif
#ifndef QT_NO_PROCESS
@@ -66,30 +68,63 @@ QT_BEGIN_NAMESPACE
#define NOTIFYTIMEOUT 100
-static void qt_create_pipe(Q_PIPE *pipe, bool in)
+static void qt_create_pipe(Q_PIPE *pipe, bool isInputPipe)
{
- // Open the pipes. Make non-inheritable copies of input write and output
- // read handles to avoid non-closable handles (this is done by the
- // DuplicateHandle() call).
+ // Anomymous pipes do not support asynchronous I/O. Thus we
+ // create named pipes for redirecting stdout, stderr and stdin.
- SECURITY_ATTRIBUTES secAtt = { sizeof( SECURITY_ATTRIBUTES ), NULL, TRUE };
+ SECURITY_ATTRIBUTES secAtt = { 0 };
+ secAtt.nLength = sizeof(secAtt);
+ secAtt.bInheritHandle = isInputPipe; // The read handle must be non-inheritable for output pipes.
- HANDLE tmpHandle;
- if (in) { // stdin
- if (!CreatePipe(&pipe[0], &tmpHandle, &secAtt, 1024 * 1024))
- return;
- if (!DuplicateHandle(GetCurrentProcess(), tmpHandle, GetCurrentProcess(),
- &pipe[1], 0, FALSE, DUPLICATE_SAME_ACCESS))
- return;
- } else { // stdout or stderr
- if (!CreatePipe(&tmpHandle, &pipe[1], &secAtt, 1024 * 1024))
- return;
- if (!DuplicateHandle(GetCurrentProcess(), tmpHandle, GetCurrentProcess(),
- &pipe[0], 0, FALSE, DUPLICATE_SAME_ACCESS))
+ HANDLE hRead;
+ wchar_t pipeName[256];
+ unsigned int attempts = 1000;
+ forever {
+ // ### The user must make sure to call qsrand() to make the pipe names less predictable.
+ // ### Replace the call to qrand() with a secure version, once we have it in Qt.
+ swprintf(pipeName, L"\\\\.\\pipe\\qt-%X", qrand());
+
+ const DWORD dwPipeBufferSize = 1024 * 1024;
+ hRead = CreateNamedPipe(pipeName,
+ PIPE_ACCESS_INBOUND | FILE_FLAG_OVERLAPPED,
+ PIPE_TYPE_BYTE | PIPE_WAIT | PIPE_REJECT_REMOTE_CLIENTS,
+ 1, // only one pipe instance
+ 0, // output buffer size
+ dwPipeBufferSize, // input buffer size
+ 0,
+ &secAtt);
+ if (hRead != INVALID_HANDLE_VALUE)
+ break;
+ DWORD dwError = GetLastError();
+ if (dwError != ERROR_PIPE_BUSY || !--attempts) {
+ qErrnoWarning(dwError, "QProcess: CreateNamedPipe failed.");
return;
+ }
}
- CloseHandle(tmpHandle);
+ // The write handle must be non-inheritable for input pipes.
+ secAtt.bInheritHandle = !isInputPipe;
+
+ HANDLE hWrite = INVALID_HANDLE_VALUE;
+ hWrite = CreateFile(pipeName,
+ GENERIC_WRITE,
+ 0,
+ &secAtt,
+ OPEN_EXISTING,
+ FILE_FLAG_OVERLAPPED,
+ NULL);
+ if (hWrite == INVALID_HANDLE_VALUE) {
+ qErrnoWarning("QProcess: CreateFile failed.");
+ CloseHandle(hRead);
+ return;
+ }
+
+ // Wait until connection is in place.
+ ConnectNamedPipe(hRead, NULL);
+
+ pipe[0] = hRead;
+ pipe[1] = hWrite;
}
static void duplicateStdWriteChannel(Q_PIPE *pipe, DWORD nStdHandle)
@@ -122,6 +157,26 @@ bool QProcessPrivate::createChannel(Channel &channel)
qt_create_pipe(channel.pipe, isStdInChannel);
else
duplicateStdWriteChannel(channel.pipe, (&channel == &stdoutChannel) ? STD_OUTPUT_HANDLE : STD_ERROR_HANDLE);
+
+ QWindowsPipeReader *pipeReader = 0;
+ if (&channel == &stdoutChannel) {
+ if (!stdoutReader) {
+ stdoutReader = new QWindowsPipeReader(q);
+ q->connect(stdoutReader, SIGNAL(readyRead()), SLOT(_q_canReadStandardOutput()));
+ }
+ pipeReader = stdoutReader;
+ } else if (&channel == &stderrChannel) {
+ if (!stderrReader) {
+ stderrReader = new QWindowsPipeReader(q);
+ q->connect(stderrReader, SIGNAL(readyRead()), SLOT(_q_canReadStandardError()));
+ }
+ pipeReader = stderrReader;
+ }
+ if (pipeReader) {
+ pipeReader->setHandle(channel.pipe[0]);
+ pipeReader->startAsyncRead();
+ }
+
return true;
} else if (channel.type == Channel::Redirect) {
// we're redirecting the channel to/from a file
@@ -233,11 +288,6 @@ bool QProcessPrivate::createChannel(Channel &channel)
void QProcessPrivate::destroyPipe(Q_PIPE pipe[2])
{
- if (pipe[0] == stdinChannel.pipe[0] && pipe[1] == stdinChannel.pipe[1] && pipeWriter) {
- delete pipeWriter;
- pipeWriter = 0;
- }
-
if (pipe[0] != INVALID_Q_PIPE) {
CloseHandle(pipe[0]);
pipe[0] = INVALID_Q_PIPE;
@@ -248,6 +298,26 @@ void QProcessPrivate::destroyPipe(Q_PIPE pipe[2])
}
}
+void QProcessPrivate::destroyChannel(Channel *channel)
+{
+ if (channel == &stdinChannel) {
+ if (pipeWriter) {
+ delete pipeWriter;
+ pipeWriter = 0;
+ }
+ } else if (channel == &stdoutChannel) {
+ if (stdoutReader) {
+ stdoutReader->deleteLater();
+ stdoutReader = 0;
+ }
+ } else if (channel == &stderrChannel) {
+ if (stderrReader) {
+ stderrReader->deleteLater();
+ stderrReader = 0;
+ }
+ }
+ destroyPipe(channel->pipe);
+}
static QString qt_create_commandline(const QString &program, const QStringList &arguments)
{
@@ -472,8 +542,10 @@ qint64 QProcessPrivate::bytesAvailableFromStdout() const
if (stdoutChannel.pipe[0] == INVALID_Q_PIPE)
return 0;
- DWORD bytesAvail = 0;
- PeekNamedPipe(stdoutChannel.pipe[0], 0, 0, 0, &bytesAvail, 0);
+ if (!stdoutReader)
+ return 0;
+
+ DWORD bytesAvail = stdoutReader->bytesAvailable();
#if defined QPROCESS_DEBUG
qDebug("QProcessPrivate::bytesAvailableFromStdout() == %d", bytesAvail);
#endif
@@ -485,8 +557,10 @@ qint64 QProcessPrivate::bytesAvailableFromStderr() const
if (stderrChannel.pipe[0] == INVALID_Q_PIPE)
return 0;
- DWORD bytesAvail = 0;
- PeekNamedPipe(stderrChannel.pipe[0], 0, 0, 0, &bytesAvail, 0);
+ if (!stderrReader)
+ return 0;
+
+ DWORD bytesAvail = stderrReader->bytesAvailable();
#if defined QPROCESS_DEBUG
qDebug("QProcessPrivate::bytesAvailableFromStderr() == %d", bytesAvail);
#endif
@@ -495,22 +569,12 @@ qint64 QProcessPrivate::bytesAvailableFromStderr() const
qint64 QProcessPrivate::readFromStdout(char *data, qint64 maxlen)
{
- DWORD read = qMin(maxlen, bytesAvailableFromStdout());
- DWORD bytesRead = 0;
-
- if (read > 0 && !ReadFile(stdoutChannel.pipe[0], data, read, &bytesRead, 0))
- return -1;
- return bytesRead;
+ return stdoutReader ? stdoutReader->read(data, maxlen) : 0;
}
qint64 QProcessPrivate::readFromStderr(char *data, qint64 maxlen)
{
- DWORD read = qMin(maxlen, bytesAvailableFromStderr());
- DWORD bytesRead = 0;
-
- if (read > 0 && !ReadFile(stderrChannel.pipe[0], data, read, &bytesRead, 0))
- return -1;
- return bytesRead;
+ return stderrReader ? stderrReader->read(data, maxlen) : 0;
}
@@ -553,6 +617,30 @@ bool QProcessPrivate::waitForStarted(int)
return false;
}
+static bool drainOutputPipes(QProcessPrivate *d)
+{
+ if (!d->stdoutReader && !d->stderrReader)
+ return false;
+
+ bool readyReadEmitted = false;
+ forever {
+ bool readOperationActive = false;
+ if (d->stdoutReader) {
+ readyReadEmitted |= d->stdoutReader->waitForReadyRead(0);
+ readOperationActive = d->stdoutReader->isReadOperationActive();
+ }
+ if (d->stderrReader) {
+ readyReadEmitted |= d->stderrReader->waitForReadyRead(0);
+ readOperationActive |= d->stderrReader->isReadOperationActive();
+ }
+ if (!readOperationActive)
+ break;
+ Sleep(100);
+ }
+
+ return readyReadEmitted;
+}
+
bool QProcessPrivate::waitForReadyRead(int msecs)
{
Q_Q(QProcess);
@@ -564,26 +652,18 @@ bool QProcessPrivate::waitForReadyRead(int msecs)
return false;
if (pipeWriter && pipeWriter->waitForWrite(0))
timer.resetIncrements();
- bool readyReadEmitted = false;
- if (bytesAvailableFromStdout() != 0) {
- readyReadEmitted = _q_canReadStandardOutput() ? true : readyReadEmitted;
- timer.resetIncrements();
- }
-
- if (bytesAvailableFromStderr() != 0) {
- readyReadEmitted = _q_canReadStandardError() ? true : readyReadEmitted;
- timer.resetIncrements();
- }
- if (readyReadEmitted)
+ if (processChannelMode != QProcess::ForwardedChannels
+ && ((stdoutReader && stdoutReader->waitForReadyRead(0))
+ || (stderrReader && stderrReader->waitForReadyRead(0))))
return true;
if (!pid)
return false;
if (WaitForSingleObject(pid->hProcess, 0) == WAIT_OBJECT_0) {
- // find the return value if there is noew data to read
+ bool readyReadEmitted = drainOutputPipes(this);
_q_processDied();
- return false;
+ return readyReadEmitted;
}
Sleep(timer.nextSleepTime());
@@ -664,7 +744,6 @@ bool QProcessPrivate::waitForBytesWritten(int msecs)
return false;
}
-
bool QProcessPrivate::waitForFinished(int msecs)
{
Q_Q(QProcess);
@@ -679,21 +758,18 @@ bool QProcessPrivate::waitForFinished(int msecs)
return false;
if (pipeWriter && pipeWriter->waitForWrite(0))
timer.resetIncrements();
-
- if (bytesAvailableFromStdout() != 0) {
- _q_canReadStandardOutput();
+ if (stdoutReader && stdoutReader->waitForReadyRead(0))
timer.resetIncrements();
- }
-
- if (bytesAvailableFromStderr() != 0) {
- _q_canReadStandardError();
+ if (stderrReader && stderrReader->waitForReadyRead(0))
timer.resetIncrements();
- }
- if (!pid)
+ if (!pid) {
+ drainOutputPipes(this);
return true;
+ }
if (WaitForSingleObject(pid->hProcess, timer.nextSleepTime()) == WAIT_OBJECT_0) {
+ drainOutputPipes(this);
_q_processDied();
return true;
}
@@ -701,6 +777,7 @@ bool QProcessPrivate::waitForFinished(int msecs)
if (timer.hasTimedOut())
break;
}
+
processError = QProcess::Timedout;
q->setErrorString(QProcess::tr("Process operation timed out"));
return false;
@@ -760,12 +837,6 @@ void QProcessPrivate::_q_notified()
if (!writeBuffer.isEmpty() && (!pipeWriter || pipeWriter->waitForWrite(0)))
_q_canWrite();
- if (bytesAvailableFromStdout())
- _q_canReadStandardOutput();
-
- if (bytesAvailableFromStderr())
- _q_canReadStandardError();
-
if (processState != QProcess::NotRunning)
notifier->start(NOTIFYTIMEOUT);
}
diff --git a/src/corelib/io/qprocess_wince.cpp b/src/corelib/io/qprocess_wince.cpp
index 16a34469e7..8ae1d11c80 100644
--- a/src/corelib/io/qprocess_wince.cpp
+++ b/src/corelib/io/qprocess_wince.cpp
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtCore module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -60,6 +60,11 @@ void QProcessPrivate::destroyPipe(Q_PIPE pipe[2])
Q_UNUSED(pipe);
}
+void QProcessPrivate::destroyChannel(Channel *channel)
+{
+ Q_UNUSED(channel);
+}
+
static QString qt_create_commandline(const QString &program, const QStringList &arguments)
{
QString args;
diff --git a/src/corelib/io/qresource.cpp b/src/corelib/io/qresource.cpp
index 0ae3f9e647..e46ab260b0 100644
--- a/src/corelib/io/qresource.cpp
+++ b/src/corelib/io/qresource.cpp
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtCore module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -928,7 +928,7 @@ public:
}
};
-#if defined(Q_OS_UNIX) && !defined(Q_OS_SYMBIAN) && !defined (Q_OS_NACL) && !defined(Q_OS_INTEGRITY)
+#if defined(Q_OS_UNIX) && !defined (Q_OS_NACL) && !defined(Q_OS_INTEGRITY)
#define QT_USE_MMAP
#endif
diff --git a/src/corelib/io/qresource.h b/src/corelib/io/qresource.h
index 452e141e41..4790adcb61 100644
--- a/src/corelib/io/qresource.h
+++ b/src/corelib/io/qresource.h
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtCore module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -51,7 +51,6 @@ QT_BEGIN_HEADER
QT_BEGIN_NAMESPACE
-QT_MODULE(Core)
class QResourcePrivate;
diff --git a/src/corelib/io/qresource_iterator.cpp b/src/corelib/io/qresource_iterator.cpp
index 3317ef5fff..f09bd07411 100644
--- a/src/corelib/io/qresource_iterator.cpp
+++ b/src/corelib/io/qresource_iterator.cpp
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtCore module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/corelib/io/qresource_iterator_p.h b/src/corelib/io/qresource_iterator_p.h
index 3603c64819..e01b5d3e5f 100644
--- a/src/corelib/io/qresource_iterator_p.h
+++ b/src/corelib/io/qresource_iterator_p.h
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtCore module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/corelib/io/qresource_p.h b/src/corelib/io/qresource_p.h
index f558319dc2..73046888a5 100644
--- a/src/corelib/io/qresource_p.h
+++ b/src/corelib/io/qresource_p.h
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtCore module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/corelib/io/qsettings.cpp b/src/corelib/io/qsettings.cpp
index 81dc5bb078..2021c42c4d 100644
--- a/src/corelib/io/qsettings.cpp
+++ b/src/corelib/io/qsettings.cpp
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtCore module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -68,17 +68,17 @@
#include "qcoreapplication.h"
#endif
-#ifdef Q_OS_WIN // for homedirpath reading from registry
-#include "qt_windows.h"
-#include <private/qsystemlibrary_p.h>
-#endif
-
#ifdef Q_OS_VXWORKS
# include <ioLib.h>
#endif
#include <stdlib.h>
+#ifdef Q_OS_WIN // for homedirpath reading from registry
+# include <private/qsystemlibrary_p.h>
+# include <qt_windows.h>
+#endif
+
#ifndef CSIDL_COMMON_APPDATA
#define CSIDL_COMMON_APPDATA 0x0023 // All Users\Application Data
#endif
@@ -122,7 +122,9 @@ Q_GLOBAL_STATIC(ConfFileHash, usedHashFunc)
Q_GLOBAL_STATIC(ConfFileCache, unusedCacheFunc)
Q_GLOBAL_STATIC(PathHash, pathHashFunc)
Q_GLOBAL_STATIC(CustomFormatVector, customFormatVectorFunc)
-Q_GLOBAL_STATIC(QMutex, globalMutex)
+
+static QBasicMutex settingsGlobalMutex;
+
static QSettings::Format globalDefaultFormat = QSettings::NativeFormat;
#ifndef Q_OS_WIN
@@ -277,7 +279,7 @@ QConfFile *QConfFile::fromName(const QString &fileName, bool _userPerms)
ConfFileCache *unusedCache = unusedCacheFunc();
QConfFile *confFile = 0;
- QMutexLocker locker(globalMutex());
+ QMutexLocker locker(&settingsGlobalMutex);
if (!(confFile = usedHash->value(absPath))) {
if ((confFile = unusedCache->take(absPath)))
@@ -292,7 +294,7 @@ QConfFile *QConfFile::fromName(const QString &fileName, bool _userPerms)
void QConfFile::clearCache()
{
- QMutexLocker locker(globalMutex());
+ QMutexLocker locker(&settingsGlobalMutex);
unusedCacheFunc()->clear();
}
@@ -992,7 +994,7 @@ void QConfFileSettingsPrivate::initFormat()
#endif
if (format > QSettings::IniFormat) {
- QMutexLocker locker(globalMutex());
+ QMutexLocker locker(&settingsGlobalMutex);
const CustomFormatVector *customFormatVector = customFormatVectorFunc();
int i = (int)format - (int)QSettings::CustomFormat1;
@@ -1127,7 +1129,7 @@ static QString getPath(QSettings::Format format, QSettings::Scope scope)
Q_ASSERT((int)QSettings::NativeFormat == 0);
Q_ASSERT((int)QSettings::IniFormat == 1);
- QMutexLocker locker(globalMutex());
+ QMutexLocker locker(&settingsGlobalMutex);
PathHash *pathHash = pathHashFunc();
if (pathHash->isEmpty())
initDefaultPaths(&locker);
@@ -1195,7 +1197,7 @@ QConfFileSettingsPrivate::QConfFileSettingsPrivate(const QString &fileName,
QConfFileSettingsPrivate::~QConfFileSettingsPrivate()
{
- QMutexLocker locker(globalMutex());
+ QMutexLocker locker(&settingsGlobalMutex);
ConfFileHash *usedHash = usedHashFunc();
ConfFileCache *unusedCache = unusedCacheFunc();
@@ -3437,7 +3439,7 @@ void QSettings::setUserIniPath(const QString &dir)
*/
void QSettings::setPath(Format format, Scope scope, const QString &path)
{
- QMutexLocker locker(globalMutex());
+ QMutexLocker locker(&settingsGlobalMutex);
PathHash *pathHash = pathHashFunc();
if (pathHash->isEmpty())
initDefaultPaths(&locker);
@@ -3520,7 +3522,7 @@ QSettings::Format QSettings::registerFormat(const QString &extension, ReadFunc r
Q_ASSERT(caseSensitivity == Qt::CaseSensitive);
#endif
- QMutexLocker locker(globalMutex());
+ QMutexLocker locker(&settingsGlobalMutex);
CustomFormatVector *customFormatVector = customFormatVectorFunc();
int index = customFormatVector->size();
if (index == 16) // the QSettings::Format enum has room for 16 custom formats
diff --git a/src/corelib/io/qsettings.h b/src/corelib/io/qsettings.h
index 65aeb89523..a4bb8349a8 100644
--- a/src/corelib/io/qsettings.h
+++ b/src/corelib/io/qsettings.h
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtCore module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -49,7 +49,6 @@
QT_BEGIN_HEADER
QT_BEGIN_NAMESPACE
-QT_MODULE(Core)
QT_END_NAMESPACE
#ifndef QT_NO_SETTINGS
diff --git a/src/corelib/io/qsettings_mac.cpp b/src/corelib/io/qsettings_mac.cpp
index 6bb815c561..c572fa7b72 100644
--- a/src/corelib/io/qsettings_mac.cpp
+++ b/src/corelib/io/qsettings_mac.cpp
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtCore module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/corelib/io/qsettings_p.h b/src/corelib/io/qsettings_p.h
index cf348122dc..f4f285bae4 100644
--- a/src/corelib/io/qsettings_p.h
+++ b/src/corelib/io/qsettings_p.h
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtCore module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -64,10 +64,6 @@
#endif
#include "private/qscopedpointer_p.h"
-#ifdef Q_OS_WIN
-#include "QtCore/qt_windows.h"
-#endif
-
QT_BEGIN_NAMESPACE
#define QT_QSETTINGS_ALWAYS_CASE_SENSITIVE_AND_FORGET_ORIGINAL_KEY_ORDER
diff --git a/src/corelib/io/qsettings_win.cpp b/src/corelib/io/qsettings_win.cpp
index 2cac379ec6..5ddc1dd1b1 100644
--- a/src/corelib/io/qsettings_win.cpp
+++ b/src/corelib/io/qsettings_win.cpp
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtCore module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -46,8 +46,8 @@
#include "qsettings_p.h"
#include "qvector.h"
#include "qmap.h"
-#include "qt_windows.h"
#include "qdebug.h"
+#include <qt_windows.h>
QT_BEGIN_NAMESPACE
diff --git a/src/corelib/io/qstandardpaths.cpp b/src/corelib/io/qstandardpaths.cpp
index 5accb61cc5..78bf6c7b96 100644
--- a/src/corelib/io/qstandardpaths.cpp
+++ b/src/corelib/io/qstandardpaths.cpp
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -105,12 +105,6 @@ QT_BEGIN_NAMESPACE
\note The storage location returned can be a directory that does not exist; i.e., it
may need to be created by the system or the user.
-
- \note On Symbian OS, ApplicationsLocation always point /sys/bin folder on the same drive
- with executable. FontsLocation always points to folder on ROM drive. Symbian OS does not
- have desktop concept, DesktopLocation returns same path as DocumentsLocation.
- Rest of the standard locations point to folder on same drive with executable, except
- that if executable is in ROM the folder from C drive is returned.
*/
@@ -232,7 +226,7 @@ QString QStandardPaths::findExecutable(const QString &executableName, const QStr
QStringList searchPaths = paths;
if (paths.isEmpty()) {
QByteArray pEnv = qgetenv("PATH");
-#if defined(Q_OS_WIN) || defined(Q_OS_SYMBIAN)
+#if defined(Q_OS_WIN)
const QLatin1Char pathSep(';');
#else
const QLatin1Char pathSep(':');
diff --git a/src/corelib/io/qstandardpaths.h b/src/corelib/io/qstandardpaths.h
index bae7b3f7b5..e647f46f18 100644
--- a/src/corelib/io/qstandardpaths.h
+++ b/src/corelib/io/qstandardpaths.h
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -48,7 +48,6 @@ QT_BEGIN_HEADER
QT_BEGIN_NAMESPACE
-QT_MODULE(Core)
#ifndef QT_NO_STANDARDPATHS
diff --git a/src/corelib/io/qstandardpaths_mac.cpp b/src/corelib/io/qstandardpaths_mac.cpp
index f37c21ed39..e3779220af 100644
--- a/src/corelib/io/qstandardpaths_mac.cpp
+++ b/src/corelib/io/qstandardpaths_mac.cpp
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/corelib/io/qstandardpaths_unix.cpp b/src/corelib/io/qstandardpaths_unix.cpp
index 5aef52eaba..6057c26e0d 100644
--- a/src/corelib/io/qstandardpaths_unix.cpp
+++ b/src/corelib/io/qstandardpaths_unix.cpp
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
@@ -35,13 +34,12 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
#include "qstandardpaths.h"
-#include <qprocess.h>
-#include <qurl.h>
#include <qdir.h>
#include <qfile.h>
#include <qtextstream.h>
diff --git a/src/corelib/io/qstandardpaths_win.cpp b/src/corelib/io/qstandardpaths_win.cpp
index e3f86b7134..310b1eb40d 100644
--- a/src/corelib/io/qstandardpaths_win.cpp
+++ b/src/corelib/io/qstandardpaths_win.cpp
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
@@ -35,19 +34,16 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
#include "qstandardpaths.h"
-#include <qsettings.h>
#include <qdir.h>
#include <private/qsystemlibrary_p.h>
-#include <qurl.h>
#include <qstringlist.h>
-#include <qprocess.h>
-#include <qtemporaryfile.h>
#include <qcoreapplication.h>
#include <qt_windows.h>
diff --git a/src/corelib/io/qtemporarydir.cpp b/src/corelib/io/qtemporarydir.cpp
index 15d3258a9a..53a48609e5 100644
--- a/src/corelib/io/qtemporarydir.cpp
+++ b/src/corelib/io/qtemporarydir.cpp
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtCore module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -53,8 +53,8 @@
#include <stdlib.h> // mkdtemp
#ifdef Q_OS_WIN
-#include <windows.h>
#include <private/qfsfileengine_p.h>
+#include <qt_windows.h>
#endif
QT_BEGIN_NAMESPACE
@@ -95,6 +95,42 @@ static QString defaultTemplateName()
return QDir::tempPath() + QLatin1Char('/') + baseName + QLatin1String("-XXXXXX");
}
+#ifdef Q_OS_QNX
+static char *mkdtemp(char *templateName)
+{
+ static const char letters[] = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";
+
+ const int length = strlen(templateName);
+
+ char *XXXXXX = templateName + length - 6;
+
+ if ((length < 6) || strncmp(XXXXXX, "XXXXXX", 6))
+ return 0;
+
+ for (int i = 0; i < 256; ++i) {
+ int v = qrand();
+
+ /* Fill in the random bits. */
+ XXXXXX[0] = letters[v % 62];
+ v /= 62;
+ XXXXXX[1] = letters[v % 62];
+ v /= 62;
+ XXXXXX[2] = letters[v % 62];
+ v /= 62;
+ XXXXXX[3] = letters[v % 62];
+ v /= 62;
+ XXXXXX[4] = letters[v % 62];
+ v /= 62;
+ XXXXXX[5] = letters[v % 62];
+
+ if (!mkdir(templateName, 0700))
+ return templateName;
+ }
+
+ return 0;
+}
+#endif
+
void QTemporaryDirPrivate::create(const QString &templateName)
{
#ifdef Q_OS_WIN
@@ -163,12 +199,32 @@ void QTemporaryDirPrivate::create(const QString &templateName)
\sa QDir::tempPath(), QDir, QTemporaryFile
*/
+/*!
+ Constructs a QTemporaryDir using as template the application name
+ returned by QCoreApplication::applicationName() (otherwise \c qt_temp).
+ The directory is stored in the system's temporary directory, QDir::tempPath().
+
+ \sa QDir::tempPath()
+*/
QTemporaryDir::QTemporaryDir()
: d_ptr(new QTemporaryDirPrivate)
{
d_ptr->create(defaultTemplateName());
}
+/*!
+ Constructs a QTemporaryFile with a template name of \a templateName.
+
+ If \a templateName is a relative path, the path will be relative to the
+ current working directory. You can use QDir::tempPath() to construct \a
+ templateName if you want use the system's temporary directory.
+
+ If the \a templateName ends with XXXXXX it will be used as the dynamic portion
+ of the directory name, otherwise it will be appended.
+ Unlike QTemporaryFile, XXXXXX in the middle of the template string is not supported.
+
+ \sa QDir::tempPath()
+*/
QTemporaryDir::QTemporaryDir(const QString &templateName)
: d_ptr(new QTemporaryDirPrivate)
{
diff --git a/src/corelib/io/qtemporarydir.h b/src/corelib/io/qtemporarydir.h
index 22c0a271e4..78d33e90b4 100644
--- a/src/corelib/io/qtemporarydir.h
+++ b/src/corelib/io/qtemporarydir.h
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtCore module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -49,7 +49,6 @@ QT_BEGIN_HEADER
QT_BEGIN_NAMESPACE
-QT_MODULE(Core)
#ifndef QT_NO_TEMPORARYFILE
diff --git a/src/corelib/io/qtemporaryfile.cpp b/src/corelib/io/qtemporaryfile.cpp
index eb645fabe8..b80ba6eee1 100644
--- a/src/corelib/io/qtemporaryfile.cpp
+++ b/src/corelib/io/qtemporaryfile.cpp
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtCore module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -49,11 +49,7 @@
#include "private/qsystemerror_p.h"
#include "private/qfilesystemengine_p.h"
-#if defined(Q_OS_SYMBIAN)
-#include "private/qcore_symbian_p.h"
-#endif
-
-#if !defined(Q_OS_WIN) && !defined(Q_OS_SYMBIAN)
+#if !defined(Q_OS_WIN)
#include "private/qcore_unix_p.h" // overrides QT_OPEN
#include <errno.h>
#endif
@@ -64,7 +60,7 @@
QT_BEGIN_NAMESPACE
-#if defined(Q_OS_WIN) || defined(Q_OS_SYMBIAN)
+#if defined(Q_OS_WIN)
typedef ushort Char;
static inline Char Latin1Char(char ch)
@@ -72,15 +68,7 @@ static inline Char Latin1Char(char ch)
return ushort(uchar(ch));
}
-# ifdef Q_OS_WIN
typedef HANDLE NativeFileHandle;
-# else // Q_OS_SYMBIAN
-# ifdef SYMBIAN_ENABLE_64_BIT_FILE_SERVER_API
-typedef RFile64 NativeFileHandle;
-# else
-typedef RFile NativeFileHandle;
-# endif
-# endif
#else // POSIX
typedef char Char;
@@ -161,10 +149,6 @@ static bool createFileFromTemplate(NativeFileHandle &file,
}
}
-#ifdef Q_OS_SYMBIAN
- RFs& fs = qt_s60GetRFs();
-#endif
-
for (;;) {
// Atomically create file and obtain handle
#if defined(Q_OS_WIN)
@@ -181,17 +165,6 @@ static bool createFileFromTemplate(NativeFileHandle &file,
error = QSystemError(err, QSystemError::NativeError);
return false;
}
-#elif defined(Q_OS_SYMBIAN)
- TInt err = file.Create(fs, qt_QString2TPtrC(path),
- EFileRead | EFileWrite | EFileShareReadersOrWriters);
-
- if (err == KErrNone)
- return true;
-
- if (err != KErrAlreadyExists) {
- error = QSystemError(err, QSystemError::NativeError);
- return false;
- }
#else // POSIX
file = QT_OPEN(path.constData(),
QT_OPEN_CREAT | O_EXCL | QT_OPEN_RDWR | QT_OPEN_LARGEFILE,
@@ -283,9 +256,6 @@ bool QTemporaryFileEngine::isReallyOpen()
Q_D(QFSFileEngine);
if (!((0 == d->fh) && (-1 == d->fd)
-#if defined (Q_OS_SYMBIAN)
- && (0 == d->symbianFile.SubSessionHandle())
-#endif
#if defined Q_OS_WIN
&& (INVALID_HANDLE_VALUE == d->fileHandle)
#endif
@@ -377,8 +347,6 @@ bool QTemporaryFileEngine::open(QIODevice::OpenMode openMode)
QSystemError error;
#if defined(Q_OS_WIN)
NativeFileHandle &file = d->fileHandle;
-#elif defined(Q_OS_SYMBIAN)
- NativeFileHandle &file = d->symbianFile;
#else // POSIX
NativeFileHandle &file = d->fd;
#endif
diff --git a/src/corelib/io/qtemporaryfile.h b/src/corelib/io/qtemporaryfile.h
index 20956d2cf0..8b14e5a14a 100644
--- a/src/corelib/io/qtemporaryfile.h
+++ b/src/corelib/io/qtemporaryfile.h
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtCore module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -53,7 +53,6 @@ QT_BEGIN_HEADER
QT_BEGIN_NAMESPACE
-QT_MODULE(Core)
#ifndef QT_NO_TEMPORARYFILE
diff --git a/src/corelib/io/qtextstream.cpp b/src/corelib/io/qtextstream.cpp
index 8c7f57fddf..7f37866226 100644
--- a/src/corelib/io/qtextstream.cpp
+++ b/src/corelib/io/qtextstream.cpp
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtCore module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -2324,15 +2324,6 @@ void QTextStreamPrivate::putNumber(qulonglong number, bool negative)
}
/*!
- \internal
- \overload
-*/
-QTextStream &QTextStream::operator<<(QBool b)
-{
- return *this << bool(b);
-}
-
-/*!
Writes the character \a c to the stream, then returns a reference
to the QTextStream.
@@ -2542,6 +2533,21 @@ QTextStream &QTextStream::operator<<(const QString &string)
/*!
\overload
+ Writes \a string to the stream, and returns a reference to the
+ QTextStream. The contents of \a string are converted with the
+ QString constructor that takes a QLatin1String as argument.
+*/
+QTextStream &QTextStream::operator<<(const QLatin1String &string)
+{
+ Q_D(QTextStream);
+ CHECK_VALID_STREAM(*this);
+ d->putString(QString(string));
+ return *this;
+}
+
+/*!
+ \overload
+
Writes \a array to the stream. The contents of \a array are
converted with QString::fromAscii().
*/
diff --git a/src/corelib/io/qtextstream.h b/src/corelib/io/qtextstream.h
index 0531d4017d..011d43ebb0 100644
--- a/src/corelib/io/qtextstream.h
+++ b/src/corelib/io/qtextstream.h
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtCore module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -58,7 +58,6 @@ QT_BEGIN_HEADER
QT_BEGIN_NAMESPACE
-QT_MODULE(Core)
class QTextCodec;
class QTextDecoder;
@@ -175,7 +174,6 @@ public:
QTextStream &operator>>(QByteArray &array);
QTextStream &operator>>(char *c);
- QTextStream &operator<<(QBool b);
QTextStream &operator<<(QChar ch);
QTextStream &operator<<(char ch);
QTextStream &operator<<(signed short i);
@@ -189,6 +187,7 @@ public:
QTextStream &operator<<(float f);
QTextStream &operator<<(double f);
QTextStream &operator<<(const QString &s);
+ QTextStream &operator<<(const QLatin1String &s);
QTextStream &operator<<(const QByteArray &array);
QTextStream &operator<<(const char *c);
QTextStream &operator<<(const void *ptr);
@@ -209,6 +208,7 @@ typedef QTextStream & (*QTextStreamFunction)(QTextStream &);// manipulator funct
typedef void (QTextStream::*QTSMFI)(int); // manipulator w/int argument
typedef void (QTextStream::*QTSMFC)(QChar); // manipulator w/QChar argument
+
class Q_CORE_EXPORT QTextStreamManipulator
{
public:
diff --git a/src/corelib/io/qtldurl.cpp b/src/corelib/io/qtldurl.cpp
index 2c725f17fd..7adb40261b 100644
--- a/src/corelib/io/qtldurl.cpp
+++ b/src/corelib/io/qtldurl.cpp
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtCore module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/corelib/io/qtldurl_p.h b/src/corelib/io/qtldurl_p.h
index 0a94f3015b..bba532b179 100644
--- a/src/corelib/io/qtldurl_p.h
+++ b/src/corelib/io/qtldurl_p.h
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtCore module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/corelib/io/qurl.cpp b/src/corelib/io/qurl.cpp
index 53b4df4729..d74e7b8121 100644
--- a/src/corelib/io/qurl.cpp
+++ b/src/corelib/io/qurl.cpp
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtCore module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -114,9 +114,6 @@
\list
\o When creating an QString to contain a URL from a QByteArray or a
char*, always use QString::fromUtf8().
- \o Favor the use of QUrl::fromEncoded() and QUrl::toEncoded() instead of
- QUrl(string) and QUrl::toString() when converting a QUrl to or from
- a string.
\endlist
\sa QUrlInfo
@@ -318,6 +315,7 @@ public:
QString userInfo(QUrl::FormattingOptions options = QUrl::None) const;
void setEncodedAuthority(const QByteArray &authority);
void setEncodedUserInfo(const QUrlParseData *parseData);
+ void setEncodedUrl(const QByteArray&, QUrl::ParsingMode);
QByteArray mergePaths(const QByteArray &relativePath) const;
@@ -3880,7 +3878,7 @@ void QUrlPrivate::parse(ParseOptions parseOptions) const
if (parseData.scheme) {
QByteArray s(parseData.scheme, parseData.schemeLength);
- that->scheme = fromPercentEncodingMutable(&s);
+ that->scheme = fromPercentEncodingMutable(&s).toLower();
}
that->setEncodedUserInfo(&parseData);
@@ -4041,7 +4039,6 @@ const QByteArray &QUrlPrivate::normalized() const
QURL_SETFLAG(that->stateFlags, QUrlPrivate::Normalized);
QUrlPrivate tmp = *this;
- tmp.scheme = tmp.scheme.toLower();
tmp.host = tmp.canonicalHost();
// ensure the encoded and normalized parts of the URL
@@ -4180,28 +4177,13 @@ QString QUrlPrivate::createErrorString()
readable representation, with no percent encoding. QUrl will automatically
percent encode all characters that are not allowed in a URL.
+ The parsing mode \a parsingMode is used for parsing \a url.
+
Example:
\snippet doc/src/snippets/code/src_corelib_io_qurl.cpp 0
- To construct a URL from an encoded string, call fromEncoded():
-
- \snippet doc/src/snippets/code/src_corelib_io_qurl.cpp 1
-
- \sa setUrl(), setEncodedUrl(), fromEncoded(), TolerantMode
-*/
-QUrl::QUrl(const QString &url) : d(0)
-{
- if (!url.isEmpty())
- setUrl(url);
-}
-
-/*!
- \overload
-
- Parses the \a url using the parser mode \a parsingMode.
-
- \sa setUrl()
+ \sa setUrl(), TolerantMode
*/
QUrl::QUrl(const QString &url, ParsingMode parsingMode) : d(0)
{
@@ -4292,35 +4274,23 @@ void QUrl::clear()
/*!
Constructs a URL by parsing the contents of \a url.
- \a url is assumed to be in unicode format, with no percent
- encoding.
+ \a url is assumed to be in unicode format, and encoded,
+ such as URLs produced by url().
+
+ The parsing mode \a parsingMode is used for parsing \a url.
Calling isValid() will tell whether or not a valid URL was
constructed.
\sa setEncodedUrl()
*/
-void QUrl::setUrl(const QString &url)
-{
- setUrl(url, TolerantMode);
-}
-
-/*!
- \overload
-
- Parses \a url using the parsing mode \a parsingMode.
-
- \sa setEncodedUrl()
-*/
void QUrl::setUrl(const QString &url, ParsingMode parsingMode)
{
detach();
- // escape all reserved characters and delimiters
- // reserved = gen-delims / sub-delims
- if (parsingMode != TolerantMode) {
- setEncodedUrl(toPercentEncodingHelper(url, ABNF_reserved), parsingMode);
+
+ d->setEncodedUrl(url.toUtf8(), parsingMode);
+ if (isValid() || parsingMode == StrictMode)
return;
- }
// Tolerant preprocessing
QString tmp = url;
@@ -4351,22 +4321,7 @@ void QUrl::setUrl(const QString &url, ParsingMode parsingMode)
} else {
encodedUrl = toPercentEncodingHelper(tmp, ABNF_reserved);
}
- setEncodedUrl(encodedUrl, StrictMode);
-}
-
-/*!
- Constructs a URL by parsing the contents of \a encodedUrl.
-
- \a encodedUrl is assumed to be a URL string in percent encoded
- form, containing only ASCII characters.
-
- Use isValid() to determine if a valid URL was constructed.
-
- \sa setUrl()
-*/
-void QUrl::setEncodedUrl(const QByteArray &encodedUrl)
-{
- setEncodedUrl(encodedUrl, TolerantMode);
+ d->setEncodedUrl(encodedUrl, StrictMode);
}
inline static bool isHex(char c)
@@ -4381,15 +4336,26 @@ static inline char toHex(quint8 c)
}
/*!
- Constructs a URL by parsing the contents of \a encodedUrl using
- the given \a parsingMode.
+ \fn void QUrl::setEncodedUrl(const QByteArray &encodedUrl, ParsingMode parsingMode)
+ Constructs a URL by parsing the contents of \a encodedUrl.
+
+ \a encodedUrl is assumed to be a URL string in percent encoded
+ form, containing only ASCII characters.
+
+ The parsing mode \a parsingMode is used for parsing \a encodedUrl.
+
+ \obsolete Use setUrl(QString::fromUtf8(encodedUrl), parsingMode)
+
+ \sa setUrl()
*/
-void QUrl::setEncodedUrl(const QByteArray &encodedUrl, ParsingMode parsingMode)
+
+
+void QUrlPrivate::setEncodedUrl(const QByteArray &encodedUrl, QUrl::ParsingMode mode)
{
QByteArray tmp = encodedUrl;
- if (!d) d = new QUrlPrivate;
- else d->clear();
- if ((d->parsingMode = parsingMode) == TolerantMode) {
+ clear();
+ parsingMode = mode;
+ if (parsingMode == QUrl::TolerantMode) {
// Replace stray % with %25
QByteArray copy = tmp;
for (int i = 0, j = 0; i < copy.size(); ++i, ++j) {
@@ -4440,7 +4406,7 @@ void QUrl::setEncodedUrl(const QByteArray &encodedUrl, ParsingMode parsingMode)
}
}
- d->encodedOriginal = tmp;
+ encodedOriginal = tmp;
}
/*!
@@ -4467,13 +4433,15 @@ void QUrl::setScheme(const QString &scheme)
detach();
QURL_UNSETFLAG(d->stateFlags, QUrlPrivate::Validated | QUrlPrivate::Normalized);
- d->scheme = scheme;
+ d->scheme = scheme.toLower();
}
/*!
Returns the scheme of the URL. If an empty string is returned,
this means the scheme is undefined and the URL is then relative.
+ The returned scheme is always lowercase, for convenience.
+
\sa setScheme(), isRelative()
*/
QString QUrl::scheme() const
@@ -4807,18 +4775,6 @@ void QUrl::setPort(int port)
}
/*!
- Returns the port of the URL, or -1 if the port is unspecified.
-*/
-int QUrl::port() const
-{
- if (!d) return -1;
- if (!QURL_HASFLAG(d->stateFlags, QUrlPrivate::Parsed)) d->parse();
- if (!QURL_HASFLAG(d->stateFlags, QUrlPrivate::Validated)) d->validate();
- return d->port;
-}
-
-/*!
- \overload
\since 4.1
Returns the port of the URL, or \a defaultPort if the port is
@@ -5695,12 +5651,42 @@ bool QUrl::isRelative() const
return d->scheme.isEmpty();
}
+// Encodes only what really needs to be encoded.
+// \a input must be decoded.
+static QString toPrettyPercentEncoding(const QString &input, bool forFragment)
+{
+ const int len = input.length();
+ QString result;
+ result.reserve(len);
+ for (int i = 0; i < len; ++i) {
+ const QChar c = input.at(i);
+ register ushort u = c.unicode();
+ if (u < 0x20
+ || (!forFragment && u == '?') // don't escape '?' in fragments
+ || u == '#' || u == '%'
+ || (u == ' ' && (i+1 == len|| input.at(i+1).unicode() == ' '))) {
+ static const char hexdigits[] = "0123456789ABCDEF";
+ result += QLatin1Char('%');
+ result += QLatin1Char(hexdigits[(u & 0xf0) >> 4]);
+ result += QLatin1Char(hexdigits[u & 0xf]);
+ } else {
+ result += c;
+ }
+ }
+
+ return result;
+}
+
/*!
Returns the human-displayable string representation of the
URL. The output can be customized by passing flags with \a
options.
- \sa FormattingOptions, toEncoded()
+ The resulting QString can be passed back to a QUrl later on.
+
+ Synonym for url(options).
+
+ \sa FormattingOptions, toEncoded(), url()
*/
QString QUrl::toString(FormattingOptions options) const
{
@@ -5727,7 +5713,7 @@ QString QUrl::toString(FormattingOptions options) const
if ((options & QUrl::RemoveAuthority) != QUrl::RemoveAuthority
&& !d->authority(options).isEmpty() && !ourPath.isEmpty() && ourPath.at(0) != QLatin1Char('/'))
url += QLatin1Char('/');
- url += ourPath;
+ url += toPrettyPercentEncoding(ourPath, false);
// check if we need to remove trailing slashes
while ((options & StripTrailingSlash) && url.endsWith(QLatin1Char('/')))
url.chop(1);
@@ -5735,7 +5721,8 @@ QString QUrl::toString(FormattingOptions options) const
if (!(options & QUrl::RemoveQuery) && d->hasQuery) {
url += QLatin1Char('?');
- url += fromPercentEncoding(d->query);
+ // query is already encoded, but possibly more than necessary.
+ url += toPrettyPercentEncoding(fromPercentEncoding(d->query), true);
}
if (!(options & QUrl::RemoveFragment) && d->hasFragment) {
url += QLatin1Char('#');
@@ -5746,6 +5733,22 @@ QString QUrl::toString(FormattingOptions options) const
}
/*!
+ Returns the human-displayable string representation of the
+ URL. The output can be customized by passing flags with \a
+ options.
+
+ The resulting QString can be passed back to a QUrl later on.
+
+ Synonym for toString(options).
+
+ \sa FormattingOptions, toEncoded(), toString()
+*/
+QString QUrl::url(FormattingOptions options) const
+{
+ return toString(options);
+}
+
+/*!
Returns the encoded representation of the URL if it's valid;
otherwise an empty QByteArray is returned. The output can be
customized by passing flags with \a options.
@@ -5761,33 +5764,18 @@ QByteArray QUrl::toEncoded(FormattingOptions options) const
}
/*!
+ \fn QUrl QUrl::fromEncoded(const QByteArray &input, ParsingMode parsingMode)
+ \obsolete
+
Parses \a input and returns the corresponding QUrl. \a input is
assumed to be in encoded form, containing only ASCII characters.
- The URL is parsed using TolerantMode.
+ The URL is parsed using \a parsingMode.
- \sa toEncoded(), setUrl()
-*/
-QUrl QUrl::fromEncoded(const QByteArray &input)
-{
- QUrl tmp;
- tmp.setEncodedUrl(input, TolerantMode);
- return tmp;
-}
-
-/*!
- \overload
-
- Parses the URL using \a parsingMode.
+ Use QUrl(QString::fromUtf8(input), parsingMode) instead.
\sa toEncoded(), setUrl()
*/
-QUrl QUrl::fromEncoded(const QByteArray &input, ParsingMode parsingMode)
-{
- QUrl tmp;
- tmp.setEncodedUrl(input, parsingMode);
- return tmp;
-}
/*!
Returns a decoded copy of \a input. \a input is first decoded from
@@ -6241,7 +6229,7 @@ QDataStream &operator>>(QDataStream &in, QUrl &url)
{
QByteArray u;
in >> u;
- url = QUrl::fromEncoded(u);
+ url = QUrl(QString::fromUtf8(u));
return in;
}
#endif // QT_NO_DATASTREAM
@@ -6345,8 +6333,8 @@ QUrl QUrl::fromUserInput(const QString &userInput)
if (QDir::isAbsolutePath(trimmedString))
return QUrl::fromLocalFile(trimmedString);
- QUrl url = QUrl::fromEncoded(trimmedString.toUtf8(), QUrl::TolerantMode);
- QUrl urlPrepended = QUrl::fromEncoded("http://" + trimmedString.toUtf8(), QUrl::TolerantMode);
+ QUrl url(trimmedString, QUrl::TolerantMode);
+ QUrl urlPrepended(QString::fromLatin1("http://") + trimmedString, QUrl::TolerantMode);
// Check the most common case of a valid url with scheme and host
// We check if the port would be valid by adding the scheme to handle the case host:port
diff --git a/src/corelib/io/qurl.h b/src/corelib/io/qurl.h
index 75a88e8048..c301d92dfb 100644
--- a/src/corelib/io/qurl.h
+++ b/src/corelib/io/qurl.h
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtCore module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -52,7 +52,6 @@ QT_BEGIN_HEADER
QT_BEGIN_NAMESPACE
-QT_MODULE(Core)
class QUrlPrivate;
class QDataStream;
@@ -86,9 +85,7 @@ public:
#ifdef QT_NO_URL_CAST_FROM_STRING
explicit
#endif
- QUrl(const QString &url);
- QUrl(const QString &url, ParsingMode mode);
- // ### Qt 5: merge the two constructors, with mode = TolerantMode
+ QUrl(const QString &url, ParsingMode mode = TolerantMode);
QUrl(const QUrl &copy);
QUrl &operator =(const QUrl &copy);
#ifndef QT_NO_URL_CAST_FROM_STRING
@@ -102,12 +99,9 @@ public:
inline void swap(QUrl &other) { qSwap(d, other.d); }
- void setUrl(const QString &url);
- void setUrl(const QString &url, ParsingMode mode);
- // ### Qt 5: merge the two setUrl() functions, with mode = TolerantMode
- void setEncodedUrl(const QByteArray &url);
- void setEncodedUrl(const QByteArray &url, ParsingMode mode);
- // ### Qt 5: merge the two setEncodedUrl() functions, with mode = TolerantMode
+ void setUrl(const QString &url, ParsingMode mode = TolerantMode);
+ QString url(FormattingOptions options = None) const;
+ QString toString(FormattingOptions options = None) const;
bool isValid() const;
@@ -140,9 +134,7 @@ public:
QByteArray encodedHost() const;
void setPort(int port);
- int port() const;
- int port(int defaultPort) const;
- // ### Qt 5: merge the two port() functions, with defaultPort = -1
+ int port(int defaultPort = -1) const;
void setPath(const QString &path);
QString path() const;
@@ -194,12 +186,7 @@ public:
QString toLocalFile() const;
bool isLocalFile() const;
- QString toString(FormattingOptions options = None) const;
-
QByteArray toEncoded(FormattingOptions options = None) const;
- static QUrl fromEncoded(const QByteArray &url);
- static QUrl fromEncoded(const QByteArray &url, ParsingMode mode);
- // ### Qt 5: merge the two fromEncoded() functions, with mode = TolerantMode
static QUrl fromUserInput(const QString &userInput);
@@ -223,6 +210,13 @@ public:
QString errorString() const;
+#if QT_DEPRECATED_SINCE(5,0)
+ QT_DEPRECATED void setEncodedUrl(const QByteArray &url, ParsingMode mode = TolerantMode)
+ { setUrl(QString::fromUtf8(url.constData(), url.size()), mode); }
+ QT_DEPRECATED static QUrl fromEncoded(const QByteArray &url, ParsingMode mode = TolerantMode)
+ { return QUrl(QString::fromUtf8(url.constData(), url.size()), mode); }
+#endif
+
private:
QUrlPrivate *d;
public:
diff --git a/src/corelib/io/qwindowspipereader.cpp b/src/corelib/io/qwindowspipereader.cpp
index 8da786ebd9..61ab5c9440 100644
--- a/src/corelib/io/qwindowspipereader.cpp
+++ b/src/corelib/io/qwindowspipereader.cpp
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtCore module of the Qt Toolkit.
**
@@ -35,16 +34,17 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
#include "qwindowspipereader_p.h"
+#include "qwinoverlappedionotifier_p.h"
#include <qdebug.h>
#include <qelapsedtimer.h>
#include <qeventloop.h>
#include <qtimer.h>
-#include <qwineventnotifier.h>
QT_BEGIN_NAMESPACE
@@ -53,21 +53,23 @@ QWindowsPipeReader::QWindowsPipeReader(QObject *parent)
handle(INVALID_HANDLE_VALUE),
readBufferMaxSize(0),
actualReadBufferSize(0),
+ readSequenceStarted(false),
emitReadyReadTimer(new QTimer(this)),
- pipeBroken(false)
+ pipeBroken(false),
+ readyReadEmitted(false)
{
emitReadyReadTimer->setSingleShot(true);
connect(emitReadyReadTimer, SIGNAL(timeout()), SIGNAL(readyRead()));
-
- ZeroMemory(&overlapped, sizeof(overlapped));
- overlapped.hEvent = CreateEvent(NULL, TRUE, FALSE, NULL);
- dataReadNotifier = new QWinEventNotifier(overlapped.hEvent, this);
- connect(dataReadNotifier, SIGNAL(activated(HANDLE)), SLOT(readEventSignalled()));
+ dataReadNotifier = new QWinOverlappedIoNotifier(this);
+ connect(dataReadNotifier, &QWinOverlappedIoNotifier::notified, this, &QWindowsPipeReader::notified);
}
QWindowsPipeReader::~QWindowsPipeReader()
{
- CloseHandle(overlapped.hEvent);
+ if (readSequenceStarted) {
+ CancelIo(handle);
+ dataReadNotifier->waitForNotified(-1);
+ }
}
/*!
@@ -78,8 +80,13 @@ void QWindowsPipeReader::setHandle(HANDLE hPipeReadEnd)
readBuffer.clear();
actualReadBufferSize = 0;
handle = hPipeReadEnd;
+ ZeroMemory(&overlapped, sizeof(overlapped));
pipeBroken = false;
- dataReadNotifier->setEnabled(true);
+ readyReadEmitted = false;
+ if (hPipeReadEnd != INVALID_HANDLE_VALUE) {
+ dataReadNotifier->setHandle(hPipeReadEnd);
+ dataReadNotifier->setEnabled(true);
+ }
}
/*!
@@ -92,7 +99,6 @@ void QWindowsPipeReader::stop()
dataReadNotifier->setEnabled(false);
readSequenceStarted = false;
handle = INVALID_HANDLE_VALUE;
- ResetEvent(overlapped.hEvent);
}
/*!
@@ -149,19 +155,18 @@ bool QWindowsPipeReader::canReadLine() const
/*!
\internal
Will be called whenever the read operation completes.
- Returns true, if readyRead() has been emitted.
*/
-bool QWindowsPipeReader::readEventSignalled()
+void QWindowsPipeReader::notified(DWORD numberOfBytesRead, DWORD errorCode)
{
- if (!completeAsyncRead()) {
+ if (!completeAsyncRead(numberOfBytesRead, errorCode)) {
pipeBroken = true;
emit pipeClosed();
- return false;
+ return;
}
startAsyncRead();
emitReadyReadTimer->stop();
+ readyReadEmitted = true;
emit readyRead();
- return true;
}
/*!
@@ -170,56 +175,50 @@ bool QWindowsPipeReader::readEventSignalled()
*/
void QWindowsPipeReader::startAsyncRead()
{
- do {
- DWORD bytesToRead = checkPipeState();
- if (pipeBroken)
- return;
+ const DWORD minReadBufferSize = 4096;
+ DWORD bytesToRead = qMax(checkPipeState(), minReadBufferSize);
+ if (pipeBroken)
+ return;
+ if (readBufferMaxSize && bytesToRead > (readBufferMaxSize - readBuffer.size())) {
+ bytesToRead = readBufferMaxSize - readBuffer.size();
if (bytesToRead == 0) {
- // There are no bytes in the pipe but we need to
- // start the overlapped read with some buffer size.
- bytesToRead = initialReadBufferSize;
- }
-
- if (readBufferMaxSize && bytesToRead > (readBufferMaxSize - readBuffer.size())) {
- bytesToRead = readBufferMaxSize - readBuffer.size();
- if (bytesToRead == 0) {
- // Buffer is full. User must read data from the buffer
- // before we can read more from the pipe.
- return;
- }
+ // Buffer is full. User must read data from the buffer
+ // before we can read more from the pipe.
+ return;
}
+ }
- char *ptr = readBuffer.reserve(bytesToRead);
+ char *ptr = readBuffer.reserve(bytesToRead);
- readSequenceStarted = true;
- if (ReadFile(handle, ptr, bytesToRead, NULL, &overlapped)) {
- completeAsyncRead();
- } else {
- switch (GetLastError()) {
- case ERROR_IO_PENDING:
- // This is not an error. We're getting notified, when data arrives.
- return;
- case ERROR_MORE_DATA:
- // This is not an error. The synchronous read succeeded.
- // We're connected to a message mode pipe and the message
- // didn't fit into the pipe's system buffer.
- completeAsyncRead();
- break;
- case ERROR_PIPE_NOT_CONNECTED:
- {
- // It may happen, that the other side closes the connection directly
- // after writing data. Then we must set the appropriate socket state.
- pipeBroken = true;
- emit pipeClosed();
- return;
- }
- default:
- emit winError(GetLastError(), QLatin1String("QWindowsPipeReader::startAsyncRead"));
- return;
+ readSequenceStarted = true;
+ if (ReadFile(handle, ptr, bytesToRead, NULL, &overlapped)) {
+ // We get notified by the QWinOverlappedIoNotifier - even in the synchronous case.
+ return;
+ } else {
+ switch (GetLastError()) {
+ case ERROR_IO_PENDING:
+ // This is not an error. We're getting notified, when data arrives.
+ return;
+ case ERROR_MORE_DATA:
+ // This is not an error. The synchronous read succeeded.
+ // We're connected to a message mode pipe and the message
+ // didn't fit into the pipe's system buffer.
+ // We're getting notified by the QWinOverlappedIoNotifier.
+ break;
+ case ERROR_PIPE_NOT_CONNECTED:
+ {
+ // It may happen, that the other side closes the connection directly
+ // after writing data. Then we must set the appropriate socket state.
+ pipeBroken = true;
+ emit pipeClosed();
+ return;
}
+ default:
+ emit winError(GetLastError(), QLatin1String("QWindowsPipeReader::startAsyncRead"));
+ return;
}
- } while (!readSequenceStarted);
+ }
}
/*!
@@ -227,26 +226,24 @@ void QWindowsPipeReader::startAsyncRead()
Sets the correct size of the read buffer after a read operation.
Returns false, if an error occurred or the connection dropped.
*/
-bool QWindowsPipeReader::completeAsyncRead()
+bool QWindowsPipeReader::completeAsyncRead(DWORD bytesRead, DWORD errorCode)
{
- ResetEvent(overlapped.hEvent);
readSequenceStarted = false;
- DWORD bytesRead;
- if (!GetOverlappedResult(handle, &overlapped, &bytesRead, TRUE)) {
- switch (GetLastError()) {
- case ERROR_MORE_DATA:
- // This is not an error. We're connected to a message mode
- // pipe and the message didn't fit into the pipe's system
- // buffer. We will read the remaining data in the next call.
- break;
- case ERROR_BROKEN_PIPE:
- case ERROR_PIPE_NOT_CONNECTED:
- return false;
- default:
- emit winError(GetLastError(), QLatin1String("QWindowsPipeReader::completeAsyncRead"));
- return false;
- }
+ switch (errorCode) {
+ case ERROR_SUCCESS:
+ break;
+ case ERROR_MORE_DATA:
+ // This is not an error. We're connected to a message mode
+ // pipe and the message didn't fit into the pipe's system
+ // buffer. We will read the remaining data in the next call.
+ break;
+ case ERROR_BROKEN_PIPE:
+ case ERROR_PIPE_NOT_CONNECTED:
+ return false;
+ default:
+ emit winError(errorCode, QLatin1String("QWindowsPipeReader::completeAsyncRead"));
+ return false;
}
actualReadBufferSize += bytesRead;
@@ -281,17 +278,11 @@ DWORD QWindowsPipeReader::checkPipeState()
*/
bool QWindowsPipeReader::waitForReadyRead(int msecs)
{
- Q_ASSERT(readSequenceStarted);
- DWORD result = WaitForSingleObject(overlapped.hEvent, msecs == -1 ? INFINITE : msecs);
- switch (result) {
- case WAIT_OBJECT_0:
- return readEventSignalled();
- case WAIT_TIMEOUT:
- return false;
- }
-
- qWarning("QWindowsPipeReader::waitForReadyRead WaitForSingleObject failed with error code %d.", int(GetLastError()));
- return false;
+ if (!readSequenceStarted)
+ return false;
+ readyReadEmitted = false;
+ dataReadNotifier->waitForNotified(msecs);
+ return readyReadEmitted;
}
/*!
diff --git a/src/corelib/io/qwindowspipereader_p.h b/src/corelib/io/qwindowspipereader_p.h
index e78d6b29ad..6bf950eec1 100644
--- a/src/corelib/io/qwindowspipereader_p.h
+++ b/src/corelib/io/qwindowspipereader_p.h
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtCore module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -56,17 +56,16 @@
#include <qbytearray.h>
#include <qobject.h>
#include <qtimer.h>
-#include <qt_windows.h>
-
#include <private/qringbuffer_p.h>
+#include <qt_windows.h>
+
QT_BEGIN_HEADER
QT_BEGIN_NAMESPACE
-QT_MODULE(Core)
-class QWinEventNotifier;
+class QWinOverlappedIoNotifier;
class Q_CORE_EXPORT QWindowsPipeReader : public QObject
{
@@ -89,7 +88,7 @@ public:
bool waitForPipeClosed(int msecs);
void startAsyncRead();
- bool completeAsyncRead();
+ bool isReadOperationActive() const { return readSequenceStarted; }
Q_SIGNALS:
void winError(ulong, const QString &);
@@ -97,22 +96,23 @@ Q_SIGNALS:
void pipeClosed();
private Q_SLOTS:
- bool readEventSignalled();
+ void notified(DWORD numberOfBytesRead, DWORD errorCode);
private:
+ bool completeAsyncRead(DWORD bytesRead, DWORD errorCode);
DWORD checkPipeState();
private:
HANDLE handle;
OVERLAPPED overlapped;
- QWinEventNotifier *dataReadNotifier;
+ QWinOverlappedIoNotifier *dataReadNotifier;
qint64 readBufferMaxSize;
QRingBuffer readBuffer;
int actualReadBufferSize;
bool readSequenceStarted;
QTimer *emitReadyReadTimer;
bool pipeBroken;
- static const qint64 initialReadBufferSize = 4096;
+ bool readyReadEmitted;
};
QT_END_NAMESPACE
diff --git a/src/corelib/io/qwindowspipewriter.cpp b/src/corelib/io/qwindowspipewriter.cpp
index a1765b4178..e31337d0fd 100644
--- a/src/corelib/io/qwindowspipewriter.cpp
+++ b/src/corelib/io/qwindowspipewriter.cpp
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtCore module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/corelib/io/qwindowspipewriter_p.h b/src/corelib/io/qwindowspipewriter_p.h
index 44a1d04b4e..fd648deefc 100644
--- a/src/corelib/io/qwindowspipewriter_p.h
+++ b/src/corelib/io/qwindowspipewriter_p.h
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtCore module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -63,7 +63,6 @@ QT_BEGIN_HEADER
QT_BEGIN_NAMESPACE
-QT_MODULE(Core)
#ifndef QT_NO_THREAD
diff --git a/src/corelib/io/qwinoverlappedionotifier.cpp b/src/corelib/io/qwinoverlappedionotifier.cpp
new file mode 100644
index 0000000000..a26dfd406c
--- /dev/null
+++ b/src/corelib/io/qwinoverlappedionotifier.cpp
@@ -0,0 +1,228 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the QtCore module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** GNU Lesser General Public License Usage
+** This file may be used under the terms of the GNU Lesser General Public
+** License version 2.1 as published by the Free Software Foundation and
+** appearing in the file LICENSE.LGPL included in the packaging of this
+** file. Please review the following information to ensure the GNU Lesser
+** General Public License version 2.1 requirements will be met:
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU General
+** Public License version 3.0 as published by the Free Software Foundation
+** and appearing in the file LICENSE.GPL included in the packaging of this
+** file. Please review the following information to ensure the GNU General
+** Public License version 3.0 requirements will be met:
+** http://www.gnu.org/copyleft/gpl.html.
+**
+** Other Usage
+** Alternatively, this file may be used in accordance with the terms and
+** conditions contained in a signed written agreement between you and Nokia.
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qwinoverlappedionotifier_p.h"
+#include <qdebug.h>
+#include <qmutex.h>
+#include <qpointer.h>
+#include <qset.h>
+#include <qthread.h>
+
+QT_BEGIN_NAMESPACE
+
+/*!
+ \class QWinOverlappedIoNotifier
+ \brief The QWinOverlappedIoNotifier class provides support for overlapped I/O notifications on Windows.
+ \since 5.0
+ \internal
+
+ The QWinOverlappedIoNotifier class makes it possible to use efficient
+ overlapped (asynchronous) I/O notifications on Windows by using an
+ I/O completion port.
+
+ Once you have obtained a file handle, you can use setHandle() to get
+ notifications for I/O operations. Whenever an I/O operation completes,
+ the notified() signal is emitted which will pass the number of transferred
+ bytes and the operation's error code to the receiver.
+
+ Every handle that supports overlapped I/O can be used by
+ QWinOverlappedIoNotifier. That includes file handles, TCP sockets
+ and named pipes.
+
+ Note that you must not use ReadFileEx() and WriteFileEx() together
+ with QWinOverlappedIoNotifier. They are not supported as they use a
+ different I/O notification mechanism.
+
+ The hEvent member in the OVERLAPPED structure passed to ReadFile()
+ or WriteFile() is ignored and can be used for other purposes.
+
+ \warning This class is only available on Windows.
+*/
+
+class QWinIoCompletionPort : protected QThread
+{
+public:
+ QWinIoCompletionPort()
+ : hPort(INVALID_HANDLE_VALUE)
+ {
+ setObjectName(QLatin1String("I/O completion port thread"));
+ HANDLE hIOCP = CreateIoCompletionPort(INVALID_HANDLE_VALUE, NULL, 0, 0);
+ if (!hIOCP) {
+ qErrnoWarning("CreateIoCompletionPort failed.");
+ return;
+ }
+ hPort = hIOCP;
+ }
+
+ ~QWinIoCompletionPort()
+ {
+ PostQueuedCompletionStatus(hPort, 0, 0, NULL);
+ QThread::wait();
+ CloseHandle(hPort);
+ }
+
+ void registerNotifier(QWinOverlappedIoNotifier *notifier)
+ {
+ HANDLE hIOCP = CreateIoCompletionPort(notifier->hHandle, hPort, reinterpret_cast<ULONG_PTR>(notifier), 0);
+ if (!hIOCP) {
+ qErrnoWarning("Can't associate file handle %x with I/O completion port.", notifier->hHandle);
+ return;
+ }
+ mutex.lock();
+ notifiers += notifier;
+ mutex.unlock();
+ if (!QThread::isRunning())
+ QThread::start();
+ }
+
+ void unregisterNotifier(QWinOverlappedIoNotifier *notifier)
+ {
+ mutex.lock();
+ notifiers.remove(notifier);
+ mutex.unlock();
+ }
+
+protected:
+ void run()
+ {
+ DWORD dwBytesRead;
+ ULONG_PTR pulCompletionKey;
+ OVERLAPPED *overlapped;
+
+ forever {
+ BOOL success = GetQueuedCompletionStatus(hPort,
+ &dwBytesRead,
+ &pulCompletionKey,
+ &overlapped,
+ INFINITE);
+
+ DWORD errorCode = success ? ERROR_SUCCESS : GetLastError();
+ if (!success && !overlapped) {
+ qErrnoWarning(errorCode, "GetQueuedCompletionStatus failed.");
+ return;
+ }
+
+ if (success && !(dwBytesRead || pulCompletionKey || overlapped)) {
+ // We've posted null values via PostQueuedCompletionStatus to end this thread.
+ return;
+ }
+
+ QWinOverlappedIoNotifier *notifier = reinterpret_cast<QWinOverlappedIoNotifier *>(pulCompletionKey);
+ mutex.lock();
+ if (notifiers.contains(notifier))
+ notifier->notify(dwBytesRead, errorCode);
+ mutex.unlock();
+ }
+ }
+
+private:
+ HANDLE hPort;
+ QSet<QWinOverlappedIoNotifier *> notifiers;
+ QMutex mutex;
+};
+
+Q_GLOBAL_STATIC(QWinIoCompletionPort, iocp)
+
+QWinOverlappedIoNotifier::QWinOverlappedIoNotifier(QObject *parent)
+ : QObject(parent),
+ hHandle(INVALID_HANDLE_VALUE),
+ lastNumberOfBytes(0),
+ lastErrorCode(ERROR_SUCCESS)
+{
+ hEvent = CreateEvent(NULL, TRUE, FALSE, NULL);
+ connect(this, &QWinOverlappedIoNotifier::_q_notify,
+ this, &QWinOverlappedIoNotifier::_q_notified, Qt::QueuedConnection);
+}
+
+QWinOverlappedIoNotifier::~QWinOverlappedIoNotifier()
+{
+ setEnabled(false);
+ CloseHandle(hEvent);
+}
+
+void QWinOverlappedIoNotifier::setHandle(HANDLE h)
+{
+ hHandle = h;
+}
+
+void QWinOverlappedIoNotifier::setEnabled(bool enabled)
+{
+ if (enabled)
+ iocp()->registerNotifier(this);
+ else
+ iocp()->unregisterNotifier(this);
+}
+
+bool QWinOverlappedIoNotifier::waitForNotified(int msecs)
+{
+ DWORD result = WaitForSingleObject(hEvent, msecs == -1 ? INFINITE : DWORD(msecs));
+ switch (result) {
+ case WAIT_OBJECT_0:
+ _q_notified();
+ return true;
+ case WAIT_TIMEOUT:
+ return false;
+ }
+
+ qErrnoWarning("QWinOverlappedIoNotifier::waitForNotified: WaitForSingleObject failed.");
+ return false;
+}
+
+/*!
+ * Note: This function runs in the I/O completion port thread.
+ */
+void QWinOverlappedIoNotifier::notify(DWORD numberOfBytes, DWORD errorCode)
+{
+ lastNumberOfBytes = numberOfBytes;
+ lastErrorCode = errorCode;
+ SetEvent(hEvent);
+ emit _q_notify();
+}
+
+void QWinOverlappedIoNotifier::_q_notified()
+{
+ if (WaitForSingleObject(hEvent, 0) == WAIT_OBJECT_0) {
+ ResetEvent(hEvent);
+ emit notified(lastNumberOfBytes, lastErrorCode);
+ }
+}
+
+QT_END_NAMESPACE
diff --git a/src/corelib/io/qwinoverlappedionotifier_p.h b/src/corelib/io/qwinoverlappedionotifier_p.h
new file mode 100644
index 0000000000..fb994b554e
--- /dev/null
+++ b/src/corelib/io/qwinoverlappedionotifier_p.h
@@ -0,0 +1,101 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the QtCore module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** GNU Lesser General Public License Usage
+** This file may be used under the terms of the GNU Lesser General Public
+** License version 2.1 as published by the Free Software Foundation and
+** appearing in the file LICENSE.LGPL included in the packaging of this
+** file. Please review the following information to ensure the GNU Lesser
+** General Public License version 2.1 requirements will be met:
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU General
+** Public License version 3.0 as published by the Free Software Foundation
+** and appearing in the file LICENSE.GPL included in the packaging of this
+** file. Please review the following information to ensure the GNU General
+** Public License version 3.0 requirements will be met:
+** http://www.gnu.org/copyleft/gpl.html.
+**
+** Other Usage
+** Alternatively, this file may be used in accordance with the terms and
+** conditions contained in a signed written agreement between you and Nokia.
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QWINOVERLAPPEDIONOTIFIER_P_H
+#define QWINOVERLAPPEDIONOTIFIER_P_H
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
+#include <qobject.h>
+#include <qt_windows.h>
+
+QT_BEGIN_HEADER
+
+QT_BEGIN_NAMESPACE
+
+QT_MODULE(Core)
+
+class Q_CORE_EXPORT QWinOverlappedIoNotifier : public QObject
+{
+ Q_OBJECT
+public:
+ QWinOverlappedIoNotifier(QObject *parent = 0);
+ ~QWinOverlappedIoNotifier();
+
+ void setHandle(HANDLE h);
+ HANDLE handle() const { return hHandle; }
+
+ void setEnabled(bool enabled);
+ bool waitForNotified(int msecs);
+
+Q_SIGNALS:
+ void notified(DWORD numberOfBytes, DWORD errorCode);
+ void _q_notify();
+
+private Q_SLOTS:
+ void _q_notified();
+
+private:
+ void notify(DWORD numberOfBytes, DWORD errorCode);
+
+private:
+ HANDLE hHandle;
+ HANDLE hEvent;
+ DWORD lastNumberOfBytes;
+ DWORD lastErrorCode;
+
+ friend class QWinIoCompletionPort;
+};
+
+QT_END_NAMESPACE
+
+QT_END_HEADER
+
+#endif // QWINOVERLAPPEDIONOTIFIER_P_H